webpack 5.109.1 → 5.109.2
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/README.md +4 -0
- package/lib/CleanPlugin.js +11 -9
- package/lib/Compilation.js +12 -3
- package/lib/Compiler.js +16 -4
- package/lib/DefinePlugin.js +10 -9
- package/lib/ExternalModule.js +10 -7
- package/lib/ModuleFilenameHelpers.js +13 -2
- package/lib/NormalModule.js +74 -71
- package/lib/NormalModuleFactory.js +8 -2
- package/lib/cache/PackFileCacheStrategy.js +259 -5
- package/lib/config/defaults.js +21 -2
- package/lib/container/ModuleFederationPlugin.js +15 -9
- package/lib/css/CssGenerator.js +8 -2
- package/lib/css/CssLoadingRuntimeModule.js +25 -12
- package/lib/css/CssModulesPlugin.js +29 -18
- package/lib/dependencies/CommonJsFullRequireDependency.js +33 -4
- package/lib/dependencies/CommonJsImportsParserPlugin.js +2 -0
- package/lib/dependencies/HarmonyImportGuard.js +2 -1
- package/lib/esm/ModuleChunkLoadingRuntimeModule.js +15 -9
- package/lib/html/HtmlModulesPlugin.js +30 -12
- package/lib/javascript/JavascriptModulesPlugin.js +83 -49
- package/lib/javascript/JavascriptParser.js +44 -11
- package/lib/optimize/RealContentHashPlugin.js +10 -7
- package/lib/serialization/FileMiddleware.js +299 -60
- package/lib/util/identifier.js +21 -1
- package/package.json +3 -3
- package/schemas/WebpackOptions.json +110 -55
- package/types.d.ts +832 -243
|
@@ -25,11 +25,21 @@ const { getUndoPath } = require("../util/identifier");
|
|
|
25
25
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
|
26
26
|
/** @typedef {import("../Module").ReadOnlyRuntimeRequirements} ReadOnlyRuntimeRequirements */
|
|
27
27
|
|
|
28
|
+
const createCompilationHooks = () => ({
|
|
29
|
+
/**
|
|
30
|
+
* @type {SyncWaterfallHook<[string, Chunk]>}
|
|
31
|
+
* @since 5.41.0
|
|
32
|
+
*/
|
|
33
|
+
linkPreload: new SyncWaterfallHook(["source", "chunk"]),
|
|
34
|
+
/**
|
|
35
|
+
* @type {SyncWaterfallHook<[string, Chunk]>}
|
|
36
|
+
* @since 5.41.0
|
|
37
|
+
*/
|
|
38
|
+
linkPrefetch: new SyncWaterfallHook(["source", "chunk"])
|
|
39
|
+
});
|
|
40
|
+
|
|
28
41
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @typedef {object} JsonpCompilationPluginHooks
|
|
31
|
-
* @property {SyncWaterfallHook<[string, Chunk]>} linkPreload
|
|
32
|
-
* @property {SyncWaterfallHook<[string, Chunk]>} linkPrefetch
|
|
42
|
+
* @typedef {ReturnType<typeof createCompilationHooks>} JsonpCompilationPluginHooks
|
|
33
43
|
*/
|
|
34
44
|
|
|
35
45
|
class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|
@@ -438,11 +448,7 @@ class ModuleChunkLoadingRuntimeModule extends RuntimeModule {
|
|
|
438
448
|
}
|
|
439
449
|
|
|
440
450
|
ModuleChunkLoadingRuntimeModule.getCompilationHooks = createHooksRegistry(
|
|
441
|
-
|
|
442
|
-
/** @type {JsonpCompilationPluginHooks} */ ({
|
|
443
|
-
linkPreload: new SyncWaterfallHook(["source", "chunk"]),
|
|
444
|
-
linkPrefetch: new SyncWaterfallHook(["source", "chunk"])
|
|
445
|
-
})
|
|
451
|
+
createCompilationHooks
|
|
446
452
|
);
|
|
447
453
|
|
|
448
454
|
module.exports = ModuleChunkLoadingRuntimeModule;
|
|
@@ -72,12 +72,36 @@ const { escapeAttribute } = require("./syntax");
|
|
|
72
72
|
* @property {boolean=} remove set true to delete the whole element
|
|
73
73
|
*/
|
|
74
74
|
/** @typedef {{ outputName: string, html: string }} HtmlTransformTagsContext */
|
|
75
|
+
|
|
76
|
+
const createCompilationHooks = () => ({
|
|
77
|
+
/**
|
|
78
|
+
* Called with the list of extra tags to inject into each page (initially empty) plus the current HTML; push `HtmlTagDescriptor`s and return the list — webpack serializes and places them by `injectTo`. A structured alternative to the string-level `transformHtml` for adding tags; runs before CSP so injected inline tags are hashed.
|
|
79
|
+
* @type {AsyncSeriesWaterfallHook<[HtmlTagDescriptor[], HtmlInjectTagsContext]>}
|
|
80
|
+
* @since 5.109.0
|
|
81
|
+
*/
|
|
82
|
+
injectTags: new AsyncSeriesWaterfallHook(["tags", "context"]),
|
|
83
|
+
/**
|
|
84
|
+
* Called with the page's `<script>`/`<link>`/`<style>`/`<meta>` tags (webpack's own and any injected) as mutable descriptors; mutate `attrs` (add a `nonce`/`data-*`, switch `defer`↔`async`, …), set `remove: true`, or change `injectTo` to move a tag between `<head>` and `<body>`, and webpack rewrites the changed tags. Add new tags with `injectTags` instead.
|
|
85
|
+
* @type {AsyncSeriesHook<[HtmlMutableTag[], HtmlTransformTagsContext]>}
|
|
86
|
+
* @since 5.109.0
|
|
87
|
+
*/
|
|
88
|
+
transformTags: new AsyncSeriesHook(["tags", "context"]),
|
|
89
|
+
/**
|
|
90
|
+
* Called with each emitted page's final HTML (all sentinels resolved) just before it is written; return the (possibly transformed) HTML — e.g. to minify, inject a CSP meta, or rewrite tags.
|
|
91
|
+
* @type {AsyncSeriesWaterfallHook<[string, HtmlTransformHtmlContext]>}
|
|
92
|
+
* @since 5.109.0
|
|
93
|
+
*/
|
|
94
|
+
transformHtml: new AsyncSeriesWaterfallHook(["html", "context"]),
|
|
95
|
+
/**
|
|
96
|
+
* Called once each page's HTML asset has been finalized — a post-emit notification (nothing to return).
|
|
97
|
+
* @type {AsyncSeriesHook<[HtmlEmittedContext]>}
|
|
98
|
+
* @since 5.109.0
|
|
99
|
+
*/
|
|
100
|
+
htmlEmitted: new AsyncSeriesHook(["context"])
|
|
101
|
+
});
|
|
102
|
+
|
|
75
103
|
/**
|
|
76
|
-
* @typedef {
|
|
77
|
-
* @property {AsyncSeriesWaterfallHook<[HtmlTagDescriptor[], HtmlInjectTagsContext]>} injectTags called with the list of extra tags to inject into each page (initially empty) plus the current HTML; push `HtmlTagDescriptor`s and return the list — webpack serializes and places them by `injectTo`. A structured alternative to the string-level `transformHtml` for adding tags; runs before CSP so injected inline tags are hashed
|
|
78
|
-
* @property {AsyncSeriesHook<[HtmlMutableTag[], HtmlTransformTagsContext]>} transformTags called with the page's `<script>`/`<link>`/`<style>`/`<meta>` tags (webpack's own and any injected) as mutable descriptors; mutate `attrs` (add a `nonce`/`data-*`, switch `defer`↔`async`, …), set `remove: true`, or change `injectTo` to move a tag between `<head>` and `<body>`, and webpack rewrites the changed tags. Add new tags with `injectTags` instead
|
|
79
|
-
* @property {AsyncSeriesWaterfallHook<[string, HtmlTransformHtmlContext]>} transformHtml called with each emitted page's final HTML (all sentinels resolved) just before it is written; return the (possibly transformed) HTML — e.g. to minify, inject a CSP meta, or rewrite tags
|
|
80
|
-
* @property {AsyncSeriesHook<[HtmlEmittedContext]>} htmlEmitted called once each page's HTML asset has been finalized — a post-emit notification (nothing to return)
|
|
104
|
+
* @typedef {ReturnType<typeof createCompilationHooks>} HtmlCompilationHooks
|
|
81
105
|
*/
|
|
82
106
|
|
|
83
107
|
const PLUGIN_NAME = "HtmlModulesPlugin";
|
|
@@ -1099,13 +1123,7 @@ class HtmlModulesPlugin {
|
|
|
1099
1123
|
* @returns {HtmlCompilationHooks} the hooks
|
|
1100
1124
|
*/
|
|
1101
1125
|
HtmlModulesPlugin.getCompilationHooks = createHooksRegistry(
|
|
1102
|
-
|
|
1103
|
-
/** @type {HtmlCompilationHooks} */ ({
|
|
1104
|
-
injectTags: new AsyncSeriesWaterfallHook(["tags", "context"]),
|
|
1105
|
-
transformTags: new AsyncSeriesHook(["tags", "context"]),
|
|
1106
|
-
transformHtml: new AsyncSeriesWaterfallHook(["html", "context"]),
|
|
1107
|
-
htmlEmitted: new AsyncSeriesHook(["context"])
|
|
1108
|
-
})
|
|
1126
|
+
createCompilationHooks
|
|
1109
1127
|
);
|
|
1110
1128
|
|
|
1111
1129
|
module.exports = HtmlModulesPlugin;
|
|
@@ -330,23 +330,89 @@ const printGeneratedCodeForStack = (module, code) => {
|
|
|
330
330
|
* @property {boolean=} renderInObject render module in object container
|
|
331
331
|
*/
|
|
332
332
|
|
|
333
|
+
const createCompilationHooks = () => ({
|
|
334
|
+
/**
|
|
335
|
+
* @type {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>}
|
|
336
|
+
*/
|
|
337
|
+
renderModuleContent: new SyncWaterfallHook([
|
|
338
|
+
"source",
|
|
339
|
+
"module",
|
|
340
|
+
"moduleRenderContext"
|
|
341
|
+
]),
|
|
342
|
+
/**
|
|
343
|
+
* @type {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>}
|
|
344
|
+
*/
|
|
345
|
+
renderModuleContainer: new SyncWaterfallHook([
|
|
346
|
+
"source",
|
|
347
|
+
"module",
|
|
348
|
+
"moduleRenderContext"
|
|
349
|
+
]),
|
|
350
|
+
/**
|
|
351
|
+
* @type {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>}
|
|
352
|
+
*/
|
|
353
|
+
renderModulePackage: new SyncWaterfallHook([
|
|
354
|
+
"source",
|
|
355
|
+
"module",
|
|
356
|
+
"moduleRenderContext"
|
|
357
|
+
]),
|
|
358
|
+
/**
|
|
359
|
+
* @type {SyncWaterfallHook<[Source, RenderContext]>}
|
|
360
|
+
*/
|
|
361
|
+
render: new SyncWaterfallHook(["source", "renderContext"]),
|
|
362
|
+
/**
|
|
363
|
+
* @type {SyncWaterfallHook<[Source, RenderContext]>}
|
|
364
|
+
* @since 5.41.0
|
|
365
|
+
*/
|
|
366
|
+
renderContent: new SyncWaterfallHook(["source", "renderContext"]),
|
|
367
|
+
/**
|
|
368
|
+
* @type {SyncWaterfallHook<[Source, Module, StartupRenderContext]>}
|
|
369
|
+
* @since 5.22.0
|
|
370
|
+
*/
|
|
371
|
+
renderStartup: new SyncWaterfallHook([
|
|
372
|
+
"source",
|
|
373
|
+
"module",
|
|
374
|
+
"startupRenderContext"
|
|
375
|
+
]),
|
|
376
|
+
/**
|
|
377
|
+
* @type {SyncWaterfallHook<[Source, RenderContext]>}
|
|
378
|
+
*/
|
|
379
|
+
renderChunk: new SyncWaterfallHook(["source", "renderContext"]),
|
|
380
|
+
/**
|
|
381
|
+
* @type {SyncWaterfallHook<[Source, RenderContext]>}
|
|
382
|
+
*/
|
|
383
|
+
renderMain: new SyncWaterfallHook(["source", "renderContext"]),
|
|
384
|
+
/**
|
|
385
|
+
* @type {SyncWaterfallHook<[string, RenderBootstrapContext]>}
|
|
386
|
+
*/
|
|
387
|
+
renderRequire: new SyncWaterfallHook(["code", "renderContext"]),
|
|
388
|
+
/**
|
|
389
|
+
* @type {SyncBailHook<[Module, Partial<RenderBootstrapContext>], string | void>}
|
|
390
|
+
* @since 5.22.0
|
|
391
|
+
*/
|
|
392
|
+
inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]),
|
|
393
|
+
/**
|
|
394
|
+
* @type {SyncBailHook<[Module, RenderContext], string | void>}
|
|
395
|
+
* @since 5.22.0
|
|
396
|
+
*/
|
|
397
|
+
embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]),
|
|
398
|
+
/**
|
|
399
|
+
* @type {SyncBailHook<[RenderContext], string | void>}
|
|
400
|
+
* @since 5.26.1
|
|
401
|
+
*/
|
|
402
|
+
strictRuntimeBailout: new SyncBailHook(["renderContext"]),
|
|
403
|
+
/**
|
|
404
|
+
* @type {SyncHook<[Chunk, Hash, ChunkHashContext]>}
|
|
405
|
+
*/
|
|
406
|
+
chunkHash: new SyncHook(["chunk", "hash", "context"]),
|
|
407
|
+
/**
|
|
408
|
+
* @type {SyncBailHook<[Chunk, RenderContext], boolean | void>}
|
|
409
|
+
* @since 5.2.1
|
|
410
|
+
*/
|
|
411
|
+
useSourceMap: new SyncBailHook(["chunk", "renderContext"])
|
|
412
|
+
});
|
|
413
|
+
|
|
333
414
|
/**
|
|
334
|
-
*
|
|
335
|
-
* @typedef {object} CompilationHooks
|
|
336
|
-
* @property {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>} renderModuleContent
|
|
337
|
-
* @property {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>} renderModuleContainer
|
|
338
|
-
* @property {SyncWaterfallHook<[Source, Module, ModuleRenderContext]>} renderModulePackage
|
|
339
|
-
* @property {SyncWaterfallHook<[Source, RenderContext]>} renderChunk
|
|
340
|
-
* @property {SyncWaterfallHook<[Source, RenderContext]>} renderMain
|
|
341
|
-
* @property {SyncWaterfallHook<[Source, RenderContext]>} renderContent
|
|
342
|
-
* @property {SyncWaterfallHook<[Source, RenderContext]>} render
|
|
343
|
-
* @property {SyncWaterfallHook<[Source, Module, StartupRenderContext]>} renderStartup
|
|
344
|
-
* @property {SyncWaterfallHook<[string, RenderBootstrapContext]>} renderRequire
|
|
345
|
-
* @property {SyncBailHook<[Module, Partial<RenderBootstrapContext>], string | void>} inlineInRuntimeBailout
|
|
346
|
-
* @property {SyncBailHook<[Module, RenderContext], string | void>} embedInRuntimeBailout
|
|
347
|
-
* @property {SyncBailHook<[RenderContext], string | void>} strictRuntimeBailout
|
|
348
|
-
* @property {SyncHook<[Chunk, Hash, ChunkHashContext]>} chunkHash
|
|
349
|
-
* @property {SyncBailHook<[Chunk, RenderContext], boolean | void>} useSourceMap
|
|
415
|
+
* @typedef {ReturnType<typeof createCompilationHooks>} CompilationHooks
|
|
350
416
|
*/
|
|
351
417
|
|
|
352
418
|
/**
|
|
@@ -2288,39 +2354,7 @@ class JavascriptModulesPlugin {
|
|
|
2288
2354
|
}
|
|
2289
2355
|
|
|
2290
2356
|
JavascriptModulesPlugin.getCompilationHooks = createHooksRegistry(
|
|
2291
|
-
|
|
2292
|
-
/** @type {CompilationHooks} */ ({
|
|
2293
|
-
renderModuleContent: new SyncWaterfallHook([
|
|
2294
|
-
"source",
|
|
2295
|
-
"module",
|
|
2296
|
-
"moduleRenderContext"
|
|
2297
|
-
]),
|
|
2298
|
-
renderModuleContainer: new SyncWaterfallHook([
|
|
2299
|
-
"source",
|
|
2300
|
-
"module",
|
|
2301
|
-
"moduleRenderContext"
|
|
2302
|
-
]),
|
|
2303
|
-
renderModulePackage: new SyncWaterfallHook([
|
|
2304
|
-
"source",
|
|
2305
|
-
"module",
|
|
2306
|
-
"moduleRenderContext"
|
|
2307
|
-
]),
|
|
2308
|
-
render: new SyncWaterfallHook(["source", "renderContext"]),
|
|
2309
|
-
renderContent: new SyncWaterfallHook(["source", "renderContext"]),
|
|
2310
|
-
renderStartup: new SyncWaterfallHook([
|
|
2311
|
-
"source",
|
|
2312
|
-
"module",
|
|
2313
|
-
"startupRenderContext"
|
|
2314
|
-
]),
|
|
2315
|
-
renderChunk: new SyncWaterfallHook(["source", "renderContext"]),
|
|
2316
|
-
renderMain: new SyncWaterfallHook(["source", "renderContext"]),
|
|
2317
|
-
renderRequire: new SyncWaterfallHook(["code", "renderContext"]),
|
|
2318
|
-
inlineInRuntimeBailout: new SyncBailHook(["module", "renderContext"]),
|
|
2319
|
-
embedInRuntimeBailout: new SyncBailHook(["module", "renderContext"]),
|
|
2320
|
-
strictRuntimeBailout: new SyncBailHook(["renderContext"]),
|
|
2321
|
-
chunkHash: new SyncHook(["chunk", "hash", "context"]),
|
|
2322
|
-
useSourceMap: new SyncBailHook(["chunk", "renderContext"])
|
|
2323
|
-
})
|
|
2357
|
+
createCompilationHooks
|
|
2324
2358
|
);
|
|
2325
2359
|
|
|
2326
2360
|
module.exports = JavascriptModulesPlugin;
|
|
@@ -514,11 +514,17 @@ class JavascriptParser extends Parser {
|
|
|
514
514
|
evaluateDefinedIdentifier: new HookMap(
|
|
515
515
|
() => new SyncBailHook(["expression"])
|
|
516
516
|
),
|
|
517
|
-
/**
|
|
517
|
+
/**
|
|
518
|
+
* @type {HookMap<SyncBailHook<[NewExpression], BasicEvaluatedExpression | null | undefined>>}
|
|
519
|
+
* @since 5.73.0
|
|
520
|
+
*/
|
|
518
521
|
evaluateNewExpression: new HookMap(
|
|
519
522
|
() => new SyncBailHook(["expression"])
|
|
520
523
|
),
|
|
521
|
-
/**
|
|
524
|
+
/**
|
|
525
|
+
* @type {HookMap<SyncBailHook<[CallExpression], BasicEvaluatedExpression | null | undefined>>}
|
|
526
|
+
* @since 5.73.0
|
|
527
|
+
*/
|
|
522
528
|
evaluateCallExpression: new HookMap(
|
|
523
529
|
() => new SyncBailHook(["expression"])
|
|
524
530
|
),
|
|
@@ -532,12 +538,18 @@ class JavascriptParser extends Parser {
|
|
|
532
538
|
),
|
|
533
539
|
/** @type {SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>} */
|
|
534
540
|
preStatement: new SyncBailHook(["statement"]),
|
|
535
|
-
/**
|
|
541
|
+
/**
|
|
542
|
+
* @type {HookMap<SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>>}
|
|
543
|
+
* @since 5.109.0
|
|
544
|
+
*/
|
|
536
545
|
preStatementByType: new HookMap(() => new SyncBailHook(["statement"])),
|
|
537
546
|
|
|
538
547
|
/** @type {SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>} */
|
|
539
548
|
blockPreStatement: new SyncBailHook(["declaration"]),
|
|
540
|
-
/**
|
|
549
|
+
/**
|
|
550
|
+
* @type {HookMap<SyncBailHook<[Statement | ModuleDeclaration | MaybeNamedClassDeclaration | MaybeNamedFunctionDeclaration], boolean | void>>}
|
|
551
|
+
* @since 5.109.0
|
|
552
|
+
*/
|
|
541
553
|
blockPreStatementByType: new HookMap(
|
|
542
554
|
() => new SyncBailHook(["declaration"])
|
|
543
555
|
),
|
|
@@ -545,7 +557,10 @@ class JavascriptParser extends Parser {
|
|
|
545
557
|
statement: new SyncBailHook(["statement"]),
|
|
546
558
|
/** @type {SyncBailHook<[IfStatement], boolean | void>} */
|
|
547
559
|
statementIf: new SyncBailHook(["statement"]),
|
|
548
|
-
/**
|
|
560
|
+
/**
|
|
561
|
+
* @type {SyncBailHook<[Expression], GuardCollection | void>}
|
|
562
|
+
* @since 5.105.0
|
|
563
|
+
*/
|
|
549
564
|
collectGuards: new SyncBailHook(["expression"]),
|
|
550
565
|
/** @type {SyncBailHook<[Expression, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>} */
|
|
551
566
|
classExtendsExpression: new SyncBailHook([
|
|
@@ -554,7 +569,10 @@ class JavascriptParser extends Parser {
|
|
|
554
569
|
]),
|
|
555
570
|
/** @type {SyncBailHook<[MethodDefinition | PropertyDefinition | StaticBlock, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>} */
|
|
556
571
|
classBodyElement: new SyncBailHook(["element", "classDefinition"]),
|
|
557
|
-
/**
|
|
572
|
+
/**
|
|
573
|
+
* @type {SyncBailHook<[Expression, MethodDefinition | PropertyDefinition, ClassExpression | ClassDeclaration | MaybeNamedClassDeclaration], boolean | void>}
|
|
574
|
+
* @since 5.36.0
|
|
575
|
+
*/
|
|
558
576
|
classBodyValue: new SyncBailHook([
|
|
559
577
|
"expression",
|
|
560
578
|
"element",
|
|
@@ -604,13 +622,19 @@ class JavascriptParser extends Parser {
|
|
|
604
622
|
varDeclarationLet: new HookMap(() => new SyncBailHook(["declaration"])),
|
|
605
623
|
/** @type {HookMap<SyncBailHook<[Identifier], boolean | void>>} */
|
|
606
624
|
varDeclarationConst: new HookMap(() => new SyncBailHook(["declaration"])),
|
|
607
|
-
/**
|
|
625
|
+
/**
|
|
626
|
+
* @type {HookMap<SyncBailHook<[Identifier], boolean | void>>}
|
|
627
|
+
* @since 5.100.0
|
|
628
|
+
*/
|
|
608
629
|
varDeclarationUsing: new HookMap(() => new SyncBailHook(["declaration"])),
|
|
609
630
|
/** @type {HookMap<SyncBailHook<[Identifier], boolean | void>>} */
|
|
610
631
|
varDeclarationVar: new HookMap(() => new SyncBailHook(["declaration"])),
|
|
611
632
|
/** @type {HookMap<SyncBailHook<[Identifier], boolean | void>>} */
|
|
612
633
|
pattern: new HookMap(() => new SyncBailHook(["pattern"])),
|
|
613
|
-
/**
|
|
634
|
+
/**
|
|
635
|
+
* @type {SyncBailHook<[Expression], boolean | void>}
|
|
636
|
+
* @since 5.101.3
|
|
637
|
+
*/
|
|
614
638
|
collectDestructuringAssignmentProperties: new SyncBailHook([
|
|
615
639
|
"expression"
|
|
616
640
|
]),
|
|
@@ -671,7 +695,10 @@ class JavascriptParser extends Parser {
|
|
|
671
695
|
optionalChaining: new SyncBailHook(["optionalChaining"]),
|
|
672
696
|
/** @type {HookMap<SyncBailHook<[NewExpression], boolean | void>>} */
|
|
673
697
|
new: new HookMap(() => new SyncBailHook(["expression"])),
|
|
674
|
-
/**
|
|
698
|
+
/**
|
|
699
|
+
* @type {SyncBailHook<[BinaryExpression], boolean | void>}
|
|
700
|
+
* @since 5.71.0
|
|
701
|
+
*/
|
|
675
702
|
binaryExpression: new SyncBailHook(["binaryExpression"]),
|
|
676
703
|
/** @type {HookMap<SyncBailHook<[Expression], boolean | void>>} */
|
|
677
704
|
expression: new HookMap(() => new SyncBailHook(["expression"])),
|
|
@@ -695,11 +722,17 @@ class JavascriptParser extends Parser {
|
|
|
695
722
|
expressionLogicalOperator: new SyncBailHook(["expression"]),
|
|
696
723
|
/** @type {SyncBailHook<[Program, Comment[]], boolean | void>} */
|
|
697
724
|
program: new SyncBailHook(["ast", "comments"]),
|
|
698
|
-
/**
|
|
725
|
+
/**
|
|
726
|
+
* @type {SyncBailHook<[ThrowStatement | ReturnStatement], boolean | void>}
|
|
727
|
+
* @since 5.99.0
|
|
728
|
+
*/
|
|
699
729
|
terminate: new SyncBailHook(["statement"]),
|
|
700
730
|
/** @type {SyncBailHook<[Program, Comment[]], boolean | void>} */
|
|
701
731
|
finish: new SyncBailHook(["ast", "comments"]),
|
|
702
|
-
/**
|
|
732
|
+
/**
|
|
733
|
+
* @type {SyncBailHook<[Statement], boolean | void>}
|
|
734
|
+
* @since 5.99.9
|
|
735
|
+
*/
|
|
703
736
|
unusedStatement: new SyncBailHook(["statement"])
|
|
704
737
|
});
|
|
705
738
|
this.sourceType = sourceType;
|
|
@@ -166,10 +166,16 @@ const toCachedSource = (source) => {
|
|
|
166
166
|
* @property {Hashes} hashes
|
|
167
167
|
*/
|
|
168
168
|
|
|
169
|
+
const createCompilationHooks = () => ({
|
|
170
|
+
/**
|
|
171
|
+
* @type {SyncBailHook<[Buffer[], string], string | void>}
|
|
172
|
+
* @since 5.8.0
|
|
173
|
+
*/
|
|
174
|
+
updateHash: new SyncBailHook(["content", "oldHash"])
|
|
175
|
+
});
|
|
176
|
+
|
|
169
177
|
/**
|
|
170
|
-
*
|
|
171
|
-
* @typedef {object} CompilationHooks
|
|
172
|
-
* @property {SyncBailHook<[Buffer[], string], string | void>} updateHash
|
|
178
|
+
* @typedef {ReturnType<typeof createCompilationHooks>} CompilationHooks
|
|
173
179
|
*/
|
|
174
180
|
|
|
175
181
|
/**
|
|
@@ -554,10 +560,7 @@ ${referencingAssets
|
|
|
554
560
|
}
|
|
555
561
|
|
|
556
562
|
RealContentHashPlugin.getCompilationHooks = createHooksRegistry(
|
|
557
|
-
|
|
558
|
-
/** @type {CompilationHooks} */ ({
|
|
559
|
-
updateHash: new SyncBailHook(["content", "oldHash"])
|
|
560
|
-
})
|
|
563
|
+
createCompilationHooks
|
|
561
564
|
);
|
|
562
565
|
|
|
563
566
|
module.exports = RealContentHashPlugin;
|