Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120962284
FileUriPlugin.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jul 8, 01:43
Size
961 B
Mime Type
text/x-c++
Expires
Thu, Jul 10, 01:43 (2 d)
Engine
blob
Format
Raw Data
Handle
27272587
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
FileUriPlugin.js
View Options
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { URL, fileURLToPath } = require("url");
/** @typedef {import("../Compiler")} Compiler */
class FileUriPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap(
"FileUriPlugin",
(compilation, { normalModuleFactory }) => {
normalModuleFactory.hooks.resolveForScheme
.for("file")
.tap("FileUriPlugin", resourceData => {
const url = new URL(resourceData.resource);
const path = fileURLToPath(url);
const query = url.search;
const fragment = url.hash;
resourceData.path = path;
resourceData.query = query;
resourceData.fragment = fragment;
resourceData.resource = path + query + fragment;
return true;
});
}
);
}
}
module.exports = FileUriPlugin;
Event Timeline
Log In to Comment