webpack 5.36.0 → 5.37.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.

Potentially problematic release.


This version of webpack might be problematic. Click here for more details.

Files changed (110) hide show
  1. package/README.md +5 -8
  2. package/bin/webpack.js +0 -0
  3. package/lib/CacheFacade.js +3 -3
  4. package/lib/Chunk.js +10 -5
  5. package/lib/ChunkGraph.js +58 -35
  6. package/lib/Compilation.js +116 -98
  7. package/lib/Compiler.js +31 -17
  8. package/lib/ConcatenationScope.js +2 -1
  9. package/lib/ContextModule.js +3 -3
  10. package/lib/ContextReplacementPlugin.js +4 -3
  11. package/lib/DefinePlugin.js +16 -12
  12. package/lib/EntryPlugin.js +1 -1
  13. package/lib/EvalSourceMapDevToolPlugin.js +3 -1
  14. package/lib/FileSystemInfo.js +25 -31
  15. package/lib/FlagDependencyExportsPlugin.js +8 -7
  16. package/lib/FlagDependencyUsagePlugin.js +2 -4
  17. package/lib/HotModuleReplacementPlugin.js +20 -30
  18. package/lib/InitFragment.js +21 -6
  19. package/lib/JavascriptMetaInfoPlugin.js +2 -1
  20. package/lib/MainTemplate.js +2 -3
  21. package/lib/ModuleFilenameHelpers.js +4 -2
  22. package/lib/ModuleGraph.js +2 -2
  23. package/lib/ModuleGraphConnection.js +6 -2
  24. package/lib/ModuleInfoHeaderPlugin.js +2 -3
  25. package/lib/MultiCompiler.js +31 -27
  26. package/lib/NormalModule.js +38 -7
  27. package/lib/NormalModuleFactory.js +27 -23
  28. package/lib/RecordIdsPlugin.js +5 -4
  29. package/lib/ResolverFactory.js +10 -7
  30. package/lib/RuntimeGlobals.js +7 -0
  31. package/lib/RuntimePlugin.js +19 -1
  32. package/lib/SourceMapDevToolPlugin.js +14 -15
  33. package/lib/Template.js +4 -2
  34. package/lib/Watching.js +83 -46
  35. package/lib/WebpackOptionsApply.js +1 -0
  36. package/lib/asset/AssetGenerator.js +19 -23
  37. package/lib/buildChunkGraph.js +28 -23
  38. package/lib/cache/PackFileCacheStrategy.js +77 -13
  39. package/lib/config/defaults.js +24 -10
  40. package/lib/config/normalization.js +17 -7
  41. package/lib/debug/ProfilingPlugin.js +4 -3
  42. package/lib/dependencies/AMDRequireDependency.js +3 -3
  43. package/lib/dependencies/CommonJsExportRequireDependency.js +2 -3
  44. package/lib/dependencies/CommonJsExportsParserPlugin.js +3 -1
  45. package/lib/dependencies/CommonJsImportsParserPlugin.js +2 -4
  46. package/lib/dependencies/CommonJsPlugin.js +8 -7
  47. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -1
  48. package/lib/dependencies/ContextDependencyHelpers.js +10 -8
  49. package/lib/dependencies/CreateScriptUrlDependency.js +54 -0
  50. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +11 -13
  51. package/lib/dependencies/HarmonyExportInitFragment.js +47 -0
  52. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +2 -4
  53. package/lib/dependencies/HarmonyImportSpecifierDependency.js +4 -11
  54. package/lib/dependencies/ImportDependency.js +3 -3
  55. package/lib/dependencies/ImportParserPlugin.js +2 -4
  56. package/lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js +2 -3
  57. package/lib/dependencies/RequireEnsureDependency.js +3 -3
  58. package/lib/dependencies/WorkerDependency.js +6 -6
  59. package/lib/dependencies/WorkerPlugin.js +47 -20
  60. package/lib/hmr/LazyCompilationPlugin.js +6 -4
  61. package/lib/ids/HashedModuleIdsPlugin.js +3 -3
  62. package/lib/ids/OccurrenceModuleIdsPlugin.js +2 -3
  63. package/lib/index.js +5 -3
  64. package/lib/javascript/ArrayPushCallbackChunkFormatPlugin.js +4 -6
  65. package/lib/javascript/CommonJsChunkFormatPlugin.js +2 -3
  66. package/lib/javascript/JavascriptGenerator.js +3 -1
  67. package/lib/javascript/JavascriptModulesPlugin.js +15 -23
  68. package/lib/javascript/JavascriptParser.js +10 -8
  69. package/lib/library/AssignLibraryPlugin.js +4 -2
  70. package/lib/node/NodeWatchFileSystem.js +19 -4
  71. package/lib/optimize/AggressiveSplittingPlugin.js +5 -4
  72. package/lib/optimize/ConcatenatedModule.js +22 -27
  73. package/lib/optimize/FlagIncludedChunksPlugin.js +4 -6
  74. package/lib/optimize/InnerGraph.js +9 -11
  75. package/lib/optimize/InnerGraphPlugin.js +3 -1
  76. package/lib/optimize/ModuleConcatenationPlugin.js +7 -10
  77. package/lib/optimize/RealContentHashPlugin.js +14 -16
  78. package/lib/optimize/SideEffectsFlagPlugin.js +6 -5
  79. package/lib/optimize/SplitChunksPlugin.js +13 -15
  80. package/lib/runtime/CreateScriptUrlRuntimeModule.js +61 -0
  81. package/lib/runtime/EnsureChunkRuntimeModule.js +9 -8
  82. package/lib/runtime/LoadScriptRuntimeModule.js +12 -5
  83. package/lib/runtime/OnChunksLoadedRuntimeModule.js +38 -37
  84. package/lib/serialization/BinaryMiddleware.js +2 -3
  85. package/lib/serialization/FileMiddleware.js +3 -1
  86. package/lib/serialization/ObjectMiddleware.js +11 -7
  87. package/lib/stats/DefaultStatsFactoryPlugin.js +2 -3
  88. package/lib/stats/DefaultStatsPrinterPlugin.js +11 -9
  89. package/lib/stats/StatsFactory.js +2 -1
  90. package/lib/stats/StatsPrinter.js +3 -3
  91. package/lib/util/LazyBucketSortedSet.js +3 -3
  92. package/lib/util/cleverMerge.js +3 -1
  93. package/lib/util/comparators.js +13 -13
  94. package/lib/util/fs.js +8 -8
  95. package/lib/util/identifier.js +2 -1
  96. package/lib/util/internalSerializables.js +2 -0
  97. package/lib/validateSchema.js +5 -3
  98. package/lib/wasm-async/AsyncWebAssemblyModulesPlugin.js +4 -4
  99. package/lib/wasm-sync/WasmFinalizeExportsPlugin.js +5 -4
  100. package/lib/wasm-sync/WebAssemblyGenerator.js +89 -83
  101. package/lib/wasm-sync/WebAssemblyModulesPlugin.js +2 -1
  102. package/lib/wasm-sync/WebAssemblyParser.js +6 -5
  103. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -4
  104. package/lib/webpack.js +11 -7
  105. package/lib/webworker/ImportScriptsChunkLoadingPlugin.js +13 -1
  106. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +14 -4
  107. package/package.json +9 -6
  108. package/schemas/WebpackOptions.check.js +1 -1
  109. package/schemas/WebpackOptions.json +103 -60
  110. package/types.d.ts +463 -280
@@ -999,6 +999,10 @@
999
999
  "description": "Name for the cache. Different names will lead to different coexisting caches.",
1000
1000
  "type": "string"
1001
1001
  },
1002
+ "profile": {
1003
+ "description": "Track and log detailed timing information for individual cache items.",
1004
+ "type": "boolean"
1005
+ },
1002
1006
  "store": {
1003
1007
  "description": "When to store data to the filesystem. (pack: Store data when compiler is idle in a single file).",
1004
1008
  "enum": ["pack"]
@@ -2682,6 +2686,22 @@
2682
2686
  "strictModuleExceptionHandling": {
2683
2687
  "$ref": "#/definitions/StrictModuleExceptionHandling"
2684
2688
  },
2689
+ "trustedTypes": {
2690
+ "description": "Use a Trusted Types policy to create urls for chunks. 'output.uniqueName' is used a default policy name. Passing a string sets a custom policy name.",
2691
+ "anyOf": [
2692
+ {
2693
+ "enum": [true]
2694
+ },
2695
+ {
2696
+ "description": "The name of the Trusted Types policy created by webpack to serve bundle chunks.",
2697
+ "type": "string",
2698
+ "minLength": 1
2699
+ },
2700
+ {
2701
+ "$ref": "#/definitions/TrustedTypes"
2702
+ }
2703
+ ]
2704
+ },
2685
2705
  "umdNamedDefine": {
2686
2706
  "cli": {
2687
2707
  "exclude": true
@@ -2835,6 +2855,9 @@
2835
2855
  "strictModuleExceptionHandling": {
2836
2856
  "$ref": "#/definitions/StrictModuleExceptionHandling"
2837
2857
  },
2858
+ "trustedTypes": {
2859
+ "$ref": "#/definitions/TrustedTypes"
2860
+ },
2838
2861
  "uniqueName": {
2839
2862
  "$ref": "#/definitions/UniqueName"
2840
2863
  },
@@ -3368,40 +3391,13 @@
3368
3391
  {
3369
3392
  "type": "string"
3370
3393
  },
3371
- {
3372
- "type": "object",
3373
- "additionalProperties": false,
3374
- "properties": {
3375
- "and": {
3376
- "description": "Logical AND.",
3377
- "oneOf": [
3378
- {
3379
- "$ref": "#/definitions/RuleSetConditions"
3380
- }
3381
- ]
3382
- },
3383
- "not": {
3384
- "description": "Logical NOT.",
3385
- "oneOf": [
3386
- {
3387
- "$ref": "#/definitions/RuleSetConditions"
3388
- }
3389
- ]
3390
- },
3391
- "or": {
3392
- "description": "Logical OR.",
3393
- "oneOf": [
3394
- {
3395
- "$ref": "#/definitions/RuleSetConditions"
3396
- }
3397
- ]
3398
- }
3399
- }
3400
- },
3401
3394
  {
3402
3395
  "instanceof": "Function",
3403
3396
  "tsType": "((value: string) => boolean)"
3404
3397
  },
3398
+ {
3399
+ "$ref": "#/definitions/RuleSetLogicalConditions"
3400
+ },
3405
3401
  {
3406
3402
  "$ref": "#/definitions/RuleSetConditions"
3407
3403
  }
@@ -3421,40 +3417,13 @@
3421
3417
  "type": "string",
3422
3418
  "absolutePath": true
3423
3419
  },
3424
- {
3425
- "type": "object",
3426
- "additionalProperties": false,
3427
- "properties": {
3428
- "and": {
3429
- "description": "Logical AND.",
3430
- "oneOf": [
3431
- {
3432
- "$ref": "#/definitions/RuleSetConditionsAbsolute"
3433
- }
3434
- ]
3435
- },
3436
- "not": {
3437
- "description": "Logical NOT.",
3438
- "oneOf": [
3439
- {
3440
- "$ref": "#/definitions/RuleSetConditionsAbsolute"
3441
- }
3442
- ]
3443
- },
3444
- "or": {
3445
- "description": "Logical OR.",
3446
- "oneOf": [
3447
- {
3448
- "$ref": "#/definitions/RuleSetConditionsAbsolute"
3449
- }
3450
- ]
3451
- }
3452
- }
3453
- },
3454
3420
  {
3455
3421
  "instanceof": "Function",
3456
3422
  "tsType": "((value: string) => boolean)"
3457
3423
  },
3424
+ {
3425
+ "$ref": "#/definitions/RuleSetLogicalConditionsAbsolute"
3426
+ },
3458
3427
  {
3459
3428
  "$ref": "#/definitions/RuleSetConditionsAbsolute"
3460
3429
  }
@@ -3528,6 +3497,68 @@
3528
3497
  }
3529
3498
  ]
3530
3499
  },
3500
+ "RuleSetLogicalConditions": {
3501
+ "description": "Logic operators used in a condition matcher.",
3502
+ "type": "object",
3503
+ "additionalProperties": false,
3504
+ "properties": {
3505
+ "and": {
3506
+ "description": "Logical AND.",
3507
+ "oneOf": [
3508
+ {
3509
+ "$ref": "#/definitions/RuleSetConditions"
3510
+ }
3511
+ ]
3512
+ },
3513
+ "not": {
3514
+ "description": "Logical NOT.",
3515
+ "oneOf": [
3516
+ {
3517
+ "$ref": "#/definitions/RuleSetCondition"
3518
+ }
3519
+ ]
3520
+ },
3521
+ "or": {
3522
+ "description": "Logical OR.",
3523
+ "oneOf": [
3524
+ {
3525
+ "$ref": "#/definitions/RuleSetConditions"
3526
+ }
3527
+ ]
3528
+ }
3529
+ }
3530
+ },
3531
+ "RuleSetLogicalConditionsAbsolute": {
3532
+ "description": "Logic operators used in a condition matcher.",
3533
+ "type": "object",
3534
+ "additionalProperties": false,
3535
+ "properties": {
3536
+ "and": {
3537
+ "description": "Logical AND.",
3538
+ "oneOf": [
3539
+ {
3540
+ "$ref": "#/definitions/RuleSetConditionsAbsolute"
3541
+ }
3542
+ ]
3543
+ },
3544
+ "not": {
3545
+ "description": "Logical NOT.",
3546
+ "oneOf": [
3547
+ {
3548
+ "$ref": "#/definitions/RuleSetConditionAbsolute"
3549
+ }
3550
+ ]
3551
+ },
3552
+ "or": {
3553
+ "description": "Logical OR.",
3554
+ "oneOf": [
3555
+ {
3556
+ "$ref": "#/definitions/RuleSetConditionsAbsolute"
3557
+ }
3558
+ ]
3559
+ }
3560
+ }
3561
+ },
3531
3562
  "RuleSetRule": {
3532
3563
  "description": "A rule description with conditions and effects for modules.",
3533
3564
  "type": "object",
@@ -4352,6 +4383,18 @@
4352
4383
  }
4353
4384
  ]
4354
4385
  },
4386
+ "TrustedTypes": {
4387
+ "description": "Use a Trusted Types policy to create urls for chunks.",
4388
+ "type": "object",
4389
+ "additionalProperties": false,
4390
+ "properties": {
4391
+ "policyName": {
4392
+ "description": "The name of the Trusted Types policy created by webpack to serve bundle chunks.",
4393
+ "type": "string",
4394
+ "minLength": 1
4395
+ }
4396
+ }
4397
+ },
4355
4398
  "UmdNamedDefine": {
4356
4399
  "description": "If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.",
4357
4400
  "type": "boolean"