Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101978408
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
Sat, Feb 15, 19:23
Size
961 B
Mime Type
text/x-c++
Expires
Mon, Feb 17, 19:23 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24231020
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