|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Florent Cailhol @ooflorent
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const {
|
|---|
| 9 | compareModulesByPreOrderIndexOrIdentifier
|
|---|
| 10 | } = require("../util/comparators");
|
|---|
| 11 | const {
|
|---|
| 12 | assignAscendingModuleIds,
|
|---|
| 13 | getUsedModuleIdsAndModules
|
|---|
| 14 | } = require("./IdHelpers");
|
|---|
| 15 |
|
|---|
| 16 | /** @typedef {import("../Compiler")} Compiler */
|
|---|
| 17 |
|
|---|
| 18 | const PLUGIN_NAME = "NaturalModuleIdsPlugin";
|
|---|
| 19 |
|
|---|
| 20 | class NaturalModuleIdsPlugin {
|
|---|
| 21 | /**
|
|---|
| 22 | * Applies the plugin by registering its hooks on the compiler.
|
|---|
| 23 | * @param {Compiler} compiler the compiler instance
|
|---|
| 24 | * @returns {void}
|
|---|
| 25 | */
|
|---|
| 26 | apply(compiler) {
|
|---|
| 27 | compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|---|
| 28 | compilation.hooks.moduleIds.tap(PLUGIN_NAME, () => {
|
|---|
| 29 | const [usedIds, modulesInNaturalOrder] =
|
|---|
| 30 | getUsedModuleIdsAndModules(compilation);
|
|---|
| 31 | modulesInNaturalOrder.sort(
|
|---|
| 32 | compareModulesByPreOrderIndexOrIdentifier(compilation.moduleGraph)
|
|---|
| 33 | );
|
|---|
| 34 | assignAscendingModuleIds(usedIds, modulesInNaturalOrder, compilation);
|
|---|
| 35 | });
|
|---|
| 36 | });
|
|---|
| 37 | }
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | module.exports = NaturalModuleIdsPlugin;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.