Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100964750
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, Feb 4, 09:04
Size
961 B
Mime Type
text/x-c++
Expires
Thu, Feb 6, 09:04 (2 d)
Engine
blob
Format
Raw Data
Handle
24062241
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