Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102454202
NaturalChunkIdsPlugin.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
Thu, Feb 20, 21:58
Size
984 B
Mime Type
text/x-c++
Expires
Sat, Feb 22, 21:58 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24323444
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
NaturalChunkIdsPlugin.js
View Options
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { compareChunksNatural } = require("../util/comparators");
const { assignAscendingChunkIds } = require("./IdHelpers");
/** @typedef {import("../Chunk")} Chunk */
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
class NaturalChunkIdsPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap("NaturalChunkIdsPlugin", compilation => {
compilation.hooks.chunkIds.tap("NaturalChunkIdsPlugin", chunks => {
const chunkGraph = compilation.chunkGraph;
const compareNatural = compareChunksNatural(chunkGraph);
const chunksInNaturalOrder = Array.from(chunks).sort(compareNatural);
assignAscendingChunkIds(chunksInNaturalOrder, compilation);
});
});
}
}
module.exports = NaturalChunkIdsPlugin;
Event Timeline
Log In to Comment