webpack 5.109.0 → 5.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/webpack.js +12 -0
- package/lib/ChunkGraph.js +17 -15
- package/lib/CompatibilityPlugin.js +31 -0
- package/lib/Compilation.js +9 -2
- package/lib/DefinePlugin.js +37 -11
- package/lib/ExportsInfo.js +22 -5
- package/lib/FileSystemInfo.js +126 -26
- package/lib/FlagDependencyUsagePlugin.js +33 -12
- package/lib/InitFragment.js +20 -32
- package/lib/NormalModule.js +6 -0
- package/lib/RuntimePlugin.js +40 -113
- package/lib/Template.js +23 -3
- package/lib/container/HoistContainerReferencesPlugin.js +47 -55
- package/lib/css/CssParser.js +135 -50
- package/lib/css/syntax.js +862 -765
- package/lib/dependencies/CommonJsExportRequireDependency.js +19 -0
- package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +2 -1
- package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +17 -9
- package/lib/dependencies/HarmonyImportDependency.js +1 -1
- package/lib/dependencies/HarmonyImportSpecifierDependency.js +10 -7
- package/lib/hmr/lazyCompilationBackend.js +19 -4
- package/lib/html/HtmlGenerator.js +23 -3
- package/lib/html/syntax.js +2485 -2399
- package/lib/ids/IdHelpers.js +24 -10
- package/lib/javascript/JavascriptParser.js +5 -2
- package/lib/javascript/syntax.js +700 -43
- package/lib/node/ReadFileCompileAsyncWasmPlugin.js +10 -2
- package/lib/node/ReadFileCompileWasmPlugin.js +10 -2
- package/lib/optimize/AggressiveMergingPlugin.js +19 -15
- package/lib/optimize/ConcatenatedModule.js +19 -15
- package/lib/optimize/ModuleConcatenationPlugin.js +73 -24
- package/lib/optimize/SplitChunksPlugin.js +146 -44
- package/lib/prefetch/ResourceHintPlugin.js +96 -72
- package/lib/serialization/BinaryMiddleware.js +270 -938
- package/lib/stats/DefaultStatsFactoryPlugin.js +204 -198
- package/lib/stats/DefaultStatsPrinterPlugin.js +24 -166
- package/lib/stats/StatsFactory.js +31 -9
- package/package.json +2 -2
- package/types.d.ts +0 -4
|
@@ -1695,172 +1695,30 @@ class DefaultStatsPrinterPlugin {
|
|
|
1695
1695
|
context.timeReference = compilation.time;
|
|
1696
1696
|
});
|
|
1697
1697
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
)) {
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
obj,
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
)
|
|
1723
|
-
);
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
for (const key of /** @type {(keyof ModuleSimplePrinters)[]} */ (
|
|
1727
|
-
Object.keys(MODULE_SIMPLE_PRINTERS)
|
|
1728
|
-
)) {
|
|
1729
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1730
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "module">} */
|
|
1731
|
-
(MODULE_SIMPLE_PRINTERS[key])(
|
|
1732
|
-
obj,
|
|
1733
|
-
/** @type {DefineStatsPrinterContext<"module">} */
|
|
1734
|
-
(ctx),
|
|
1735
|
-
stats
|
|
1736
|
-
)
|
|
1737
|
-
);
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
for (const key of /** @type {(keyof ModuleIssuerPrinters)[]} */ (
|
|
1741
|
-
Object.keys(MODULE_ISSUER_PRINTERS)
|
|
1742
|
-
)) {
|
|
1743
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1744
|
-
/** @type {NonNullable<ModuleIssuerPrinters[keyof ModuleIssuerPrinters]>} */
|
|
1745
|
-
(MODULE_ISSUER_PRINTERS[key])(
|
|
1746
|
-
obj,
|
|
1747
|
-
/** @type {DefineStatsPrinterContext<"moduleIssuer">} */
|
|
1748
|
-
(ctx),
|
|
1749
|
-
stats
|
|
1750
|
-
)
|
|
1751
|
-
);
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
for (const key of /** @type {(keyof ModuleReasonsPrinters)[]} */ (
|
|
1755
|
-
Object.keys(MODULE_REASON_PRINTERS)
|
|
1756
|
-
)) {
|
|
1757
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1758
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "moduleReason">} */
|
|
1759
|
-
(MODULE_REASON_PRINTERS[key])(
|
|
1760
|
-
obj,
|
|
1761
|
-
/** @type {DefineStatsPrinterContext<"moduleReason">} */
|
|
1762
|
-
(ctx),
|
|
1763
|
-
stats
|
|
1764
|
-
)
|
|
1765
|
-
);
|
|
1766
|
-
}
|
|
1767
|
-
|
|
1768
|
-
for (const key of /** @type {(keyof ModuleProfilePrinters)[]} */ (
|
|
1769
|
-
Object.keys(MODULE_PROFILE_PRINTERS)
|
|
1770
|
-
)) {
|
|
1771
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1772
|
-
/** @type {NonNullable<ModuleProfilePrinters[keyof ModuleProfilePrinters]>} */
|
|
1773
|
-
(MODULE_PROFILE_PRINTERS[key])(
|
|
1774
|
-
obj,
|
|
1775
|
-
/** @type {DefineStatsPrinterContext<"profile">} */
|
|
1776
|
-
(ctx),
|
|
1777
|
-
stats
|
|
1778
|
-
)
|
|
1779
|
-
);
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
for (const key of /** @type {(keyof ChunkGroupPrinters)[]} */ (
|
|
1783
|
-
Object.keys(CHUNK_GROUP_PRINTERS)
|
|
1784
|
-
)) {
|
|
1785
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1786
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "chunkGroupKind" | "chunkGroup">} */
|
|
1787
|
-
(CHUNK_GROUP_PRINTERS[key])(
|
|
1788
|
-
obj,
|
|
1789
|
-
/** @type {DefineStatsPrinterContext<"chunkGroupKind" | "chunkGroup">} */
|
|
1790
|
-
(ctx),
|
|
1791
|
-
stats
|
|
1792
|
-
)
|
|
1793
|
-
);
|
|
1794
|
-
}
|
|
1795
|
-
|
|
1796
|
-
for (const key of /** @type {(keyof ChunkPrinters)[]} */ (
|
|
1797
|
-
Object.keys(CHUNK_PRINTERS)
|
|
1798
|
-
)) {
|
|
1799
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1800
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "chunk">} */
|
|
1801
|
-
(CHUNK_PRINTERS[key])(
|
|
1802
|
-
obj,
|
|
1803
|
-
/** @type {DefineStatsPrinterContext<"chunk">} */
|
|
1804
|
-
(ctx),
|
|
1805
|
-
stats
|
|
1806
|
-
)
|
|
1807
|
-
);
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
for (const key of /** @type {(keyof ErrorPrinters)[]} */ (
|
|
1811
|
-
Object.keys(ERROR_PRINTERS)
|
|
1812
|
-
)) {
|
|
1813
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1814
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "error">} */
|
|
1815
|
-
(ERROR_PRINTERS[key])(
|
|
1816
|
-
obj,
|
|
1817
|
-
/** @type {DefineStatsPrinterContext<"error">} */
|
|
1818
|
-
(ctx),
|
|
1819
|
-
stats
|
|
1820
|
-
)
|
|
1821
|
-
);
|
|
1822
|
-
}
|
|
1823
|
-
|
|
1824
|
-
for (const key of /** @type {(keyof LogEntryPrinters)[]} */ (
|
|
1825
|
-
Object.keys(LOG_ENTRY_PRINTERS)
|
|
1826
|
-
)) {
|
|
1827
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1828
|
-
/** @type {SimplePrinter<EXPECTED_ANY, "logging">} */
|
|
1829
|
-
(LOG_ENTRY_PRINTERS[key])(
|
|
1830
|
-
obj,
|
|
1831
|
-
/** @type {DefineStatsPrinterContext<"logging">} */
|
|
1832
|
-
(ctx),
|
|
1833
|
-
stats
|
|
1834
|
-
)
|
|
1835
|
-
);
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
for (const key of /** @type {(keyof ModuleTraceDependencyPrinters)[]} */ (
|
|
1839
|
-
Object.keys(MODULE_TRACE_DEPENDENCY_PRINTERS)
|
|
1840
|
-
)) {
|
|
1841
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1842
|
-
/** @type {NonNullable<ModuleTraceDependencyPrinters[keyof ModuleTraceDependencyPrinters]>} */
|
|
1843
|
-
(MODULE_TRACE_DEPENDENCY_PRINTERS[key])(
|
|
1844
|
-
obj,
|
|
1845
|
-
/** @type {DefineStatsPrinterContext<"moduleTraceDependency">} */
|
|
1846
|
-
(ctx),
|
|
1847
|
-
stats
|
|
1848
|
-
)
|
|
1849
|
-
);
|
|
1850
|
-
}
|
|
1851
|
-
|
|
1852
|
-
for (const key of /** @type {(keyof ModuleTraceItemPrinters)[]} */ (
|
|
1853
|
-
Object.keys(MODULE_TRACE_ITEM_PRINTERS)
|
|
1854
|
-
)) {
|
|
1855
|
-
stats.hooks.print.for(key).tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1856
|
-
/** @type {NonNullable<ModuleTraceItemPrinters[keyof ModuleTraceItemPrinters]>} */
|
|
1857
|
-
(MODULE_TRACE_ITEM_PRINTERS[key])(
|
|
1858
|
-
obj,
|
|
1859
|
-
/** @type {DefineStatsPrinterContext<"moduleTraceItem">} */
|
|
1860
|
-
(ctx),
|
|
1861
|
-
stats
|
|
1862
|
-
)
|
|
1863
|
-
);
|
|
1698
|
+
// Every `*_SIMPLE_PRINTERS` map registers identically: tap
|
|
1699
|
+
// `print.for(key)` with a formatter called as `(obj, ctx, stats)`.
|
|
1700
|
+
// One loop over all maps replaces a dozen near-identical blocks.
|
|
1701
|
+
for (const simplePrinters of /** @type {Record<string, EXPECTED_ANY>[]} */ ([
|
|
1702
|
+
COMPILATION_SIMPLE_PRINTERS,
|
|
1703
|
+
ASSET_SIMPLE_PRINTERS,
|
|
1704
|
+
MODULE_SIMPLE_PRINTERS,
|
|
1705
|
+
MODULE_ISSUER_PRINTERS,
|
|
1706
|
+
MODULE_REASON_PRINTERS,
|
|
1707
|
+
MODULE_PROFILE_PRINTERS,
|
|
1708
|
+
CHUNK_GROUP_PRINTERS,
|
|
1709
|
+
CHUNK_PRINTERS,
|
|
1710
|
+
ERROR_PRINTERS,
|
|
1711
|
+
LOG_ENTRY_PRINTERS,
|
|
1712
|
+
MODULE_TRACE_DEPENDENCY_PRINTERS,
|
|
1713
|
+
MODULE_TRACE_ITEM_PRINTERS
|
|
1714
|
+
])) {
|
|
1715
|
+
for (const key of Object.keys(simplePrinters)) {
|
|
1716
|
+
stats.hooks.print
|
|
1717
|
+
.for(key)
|
|
1718
|
+
.tap(PLUGIN_NAME, (obj, ctx) =>
|
|
1719
|
+
simplePrinters[key](obj, ctx, stats)
|
|
1720
|
+
);
|
|
1721
|
+
}
|
|
1864
1722
|
}
|
|
1865
1723
|
|
|
1866
1724
|
for (const key of Object.keys(PREFERRED_ORDERS)) {
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"use strict";
|
|
7
7
|
|
|
8
8
|
const { HookMap, SyncBailHook, SyncWaterfallHook } = require("tapable");
|
|
9
|
-
const { concatComparators, keepOriginalOrder } = require("../util/comparators");
|
|
10
9
|
const smartGrouping = require("../util/smartGrouping");
|
|
11
10
|
|
|
12
11
|
/** @typedef {import("../Chunk")} Chunk */
|
|
@@ -294,10 +293,7 @@ class StatsFactory {
|
|
|
294
293
|
h.call(comparators, context)
|
|
295
294
|
);
|
|
296
295
|
if (comparators.length > 0) {
|
|
297
|
-
items
|
|
298
|
-
// @ts-expect-error number of arguments is correct
|
|
299
|
-
concatComparators(...comparators, keepOriginalOrder(items))
|
|
300
|
-
);
|
|
296
|
+
sortWithOriginalOrder(items, comparators);
|
|
301
297
|
}
|
|
302
298
|
|
|
303
299
|
// run filter on sorted items
|
|
@@ -358,10 +354,7 @@ class StatsFactory {
|
|
|
358
354
|
(h) => h.call(comparators2, context)
|
|
359
355
|
);
|
|
360
356
|
if (comparators2.length > 0) {
|
|
361
|
-
resultItems
|
|
362
|
-
// @ts-expect-error number of arguments is correct
|
|
363
|
-
concatComparators(...comparators2, keepOriginalOrder(resultItems))
|
|
364
|
-
);
|
|
357
|
+
sortWithOriginalOrder(resultItems, comparators2);
|
|
365
358
|
}
|
|
366
359
|
|
|
367
360
|
// group result items
|
|
@@ -424,4 +417,33 @@ class StatsFactory {
|
|
|
424
417
|
}
|
|
425
418
|
}
|
|
426
419
|
|
|
420
|
+
/**
|
|
421
|
+
* Stable in-place sort applying comparators in order, keeping the original order
|
|
422
|
+
* for equal items. Inlined instead of `concatComparators(...c, keepOriginalOrder())`
|
|
423
|
+
* because that combination is single-use per sort and only thrashes the comparator
|
|
424
|
+
* caches (a fresh tiebreaker closure every call allocates a new cache entry).
|
|
425
|
+
* @param {EXPECTED_ANY[]} items items to sort in place
|
|
426
|
+
* @param {Comparator[]} comparators comparators applied in order
|
|
427
|
+
* @returns {void}
|
|
428
|
+
*/
|
|
429
|
+
const sortWithOriginalOrder = (items, comparators) => {
|
|
430
|
+
// original-index tiebreaker keeps the sort stable on engines without a stable Array.sort
|
|
431
|
+
/** @type {Map<EXPECTED_ANY, number>} */
|
|
432
|
+
const originalOrder = new Map();
|
|
433
|
+
for (let i = 0; i < items.length; i++) {
|
|
434
|
+
originalOrder.set(items[i], i);
|
|
435
|
+
}
|
|
436
|
+
const count = comparators.length;
|
|
437
|
+
items.sort((a, b) => {
|
|
438
|
+
for (let i = 0; i < count; i++) {
|
|
439
|
+
const res = comparators[i](a, b);
|
|
440
|
+
if (res !== 0) return res;
|
|
441
|
+
}
|
|
442
|
+
return (
|
|
443
|
+
/** @type {number} */ (originalOrder.get(a)) -
|
|
444
|
+
/** @type {number} */ (originalOrder.get(b))
|
|
445
|
+
);
|
|
446
|
+
});
|
|
447
|
+
};
|
|
448
|
+
|
|
427
449
|
module.exports = StatsFactory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack",
|
|
3
|
-
"version": "5.109.
|
|
3
|
+
"version": "5.109.1",
|
|
4
4
|
"description": "Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.",
|
|
5
5
|
"homepage": "https://github.com/webpack/webpack",
|
|
6
6
|
"bugs": "https://github.com/webpack/webpack/issues",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"test:test262": "yarn test:base --testMatch \"<rootDir>/test/test262.spectest.js\"",
|
|
66
66
|
"test:html5lib": "yarn test:base --testMatch \"<rootDir>/test/html5lib.spectest.js\"",
|
|
67
67
|
"test:css-parsing": "yarn test:base --testMatch \"<rootDir>/test/cssParsing-webpack.spectest.js\"",
|
|
68
|
-
"test:deno": "yarn test:base:deno --reporters default --reporters \"<rootDir>/test/runtimeCrashReporter.js\" --testMatch \"<rootDir>/test/*.{basictest,longtest,test,unittest}.js\" --testPathIgnorePatterns \"/node_modules
|
|
68
|
+
"test:deno": "yarn test:base:deno --reporters default --reporters \"<rootDir>/test/runtimeCrashReporter.js\" --testMatch \"<rootDir>/test/*.{basictest,longtest,test,unittest}.js\" --testPathIgnorePatterns \"/node_modules/\"",
|
|
69
69
|
"test:base:deno": "deno --allow-read --allow-env --allow-sys --allow-ffi --allow-write --allow-run --allow-net --import-map=test/deno-import-map.json --v8-flags='--max-old-space-size=4096' ./node_modules/jest-cli/bin/jest.js --workerIdleMemoryLimit=512MB --logHeapUsage",
|
|
70
70
|
"test:bun": "yarn test:base:bun --reporters default --reporters \"<rootDir>/test/runtimeCrashReporter.js\" --testMatch \"<rootDir>/test/*.{basictest,longtest,test,unittest}.js\" --testPathIgnorePatterns \"/node_modules/\"",
|
|
71
71
|
"test:base:bun": "bun --bun --smol --preload ./test/bun-preload.js ./node_modules/jest-cli/bin/jest.js --workerThreads --workerIdleMemoryLimit=512MB --logHeapUsage",
|
package/types.d.ts
CHANGED
|
@@ -15239,10 +15239,6 @@ type Matcher =
|
|
|
15239
15239
|
| RegExp
|
|
15240
15240
|
| ((str: string) => boolean)
|
|
15241
15241
|
| (string | RegExp | ((str: string) => boolean))[];
|
|
15242
|
-
|
|
15243
|
-
/**
|
|
15244
|
-
* Extract fragment index.
|
|
15245
|
-
*/
|
|
15246
15242
|
declare interface MaybeMergeableInitFragment<GenerateContext> {
|
|
15247
15243
|
key?: string;
|
|
15248
15244
|
stage: number;
|