Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101995937
DataUriPlugin.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, Feb 16, 00:03
Size
922 B
Mime Type
text/x-c++
Expires
Tue, Feb 18, 00:03 (2 d)
Engine
blob
Format
Raw Data
Handle
24227399
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
DataUriPlugin.js
View Options
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict"
;
const
NormalModule
=
require
(
"../NormalModule"
);
const
{
getMimetype
,
decodeDataURI
}
=
require
(
"../util/DataURI"
);
/** @typedef {import("../Compiler")} Compiler */
class
DataUriPlugin
{
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply
(
compiler
)
{
compiler
.
hooks
.
compilation
.
tap
(
"DataUriPlugin"
,
(
compilation
,
{
normalModuleFactory
})
=>
{
normalModuleFactory
.
hooks
.
resolveForScheme
.
for
(
"data"
)
.
tap
(
"DataUriPlugin"
,
resourceData
=>
{
resourceData
.
data
.
mimetype
=
getMimetype
(
resourceData
.
resource
);
});
NormalModule
.
getCompilationHooks
(
compilation
)
.
readResourceForScheme
.
for
(
"data"
)
.
tap
(
"DataUriPlugin"
,
resource
=>
decodeDataURI
(
resource
));
}
);
}
}
module
.
exports
=
DataUriPlugin
;
Event Timeline
Log In to Comment