Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F121680351
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
Sun, Jul 13, 02:48
Size
961 B
Mime Type
text/x-c++
Expires
Tue, Jul 15, 02:48 (2 d)
Engine
blob
Format
Raw Data
Handle
27373233
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