webpack 5.65.0 → 5.66.0

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 (60) hide show
  1. package/lib/CacheFacade.js +2 -9
  2. package/lib/Chunk.js +2 -0
  3. package/lib/Compilation.js +79 -38
  4. package/lib/Dependency.js +10 -0
  5. package/lib/DependencyTemplate.js +9 -0
  6. package/lib/ExternalModule.js +92 -52
  7. package/lib/Generator.js +2 -0
  8. package/lib/Module.js +24 -1
  9. package/lib/ModuleFilenameHelpers.js +5 -1
  10. package/lib/NormalModule.js +3 -1
  11. package/lib/RuntimeGlobals.js +11 -1
  12. package/lib/RuntimePlugin.js +25 -0
  13. package/lib/RuntimeTemplate.js +21 -0
  14. package/lib/Template.js +2 -1
  15. package/lib/Watching.js +1 -1
  16. package/lib/WebpackOptionsApply.js +43 -2
  17. package/lib/asset/AssetGenerator.js +3 -1
  18. package/lib/asset/RawDataUrlModule.js +145 -0
  19. package/lib/config/defaults.js +59 -3
  20. package/lib/css/CssGenerator.js +106 -0
  21. package/lib/css/CssLoadingRuntimeModule.js +393 -0
  22. package/lib/css/CssModulesPlugin.js +444 -0
  23. package/lib/css/CssParser.js +618 -0
  24. package/lib/css/walkCssTokens.js +659 -0
  25. package/lib/dependencies/CssExportDependency.js +85 -0
  26. package/lib/dependencies/CssImportDependency.js +75 -0
  27. package/lib/dependencies/CssLocalIdentifierDependency.js +119 -0
  28. package/lib/dependencies/CssSelfLocalIdentifierDependency.js +101 -0
  29. package/lib/dependencies/CssUrlDependency.js +132 -0
  30. package/lib/dependencies/URLDependency.js +3 -8
  31. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +1 -1
  32. package/lib/hmr/lazyCompilationBackend.js +3 -1
  33. package/lib/javascript/JavascriptGenerator.js +1 -0
  34. package/lib/javascript/StartupHelpers.js +3 -3
  35. package/lib/library/AssignLibraryPlugin.js +26 -3
  36. package/lib/library/EnableLibraryPlugin.js +11 -0
  37. package/lib/node/ReadFileChunkLoadingRuntimeModule.js +1 -1
  38. package/lib/node/RequireChunkLoadingRuntimeModule.js +1 -1
  39. package/lib/optimize/ConcatenatedModule.js +10 -4
  40. package/lib/util/hash/xxhash64.js +2 -2
  41. package/lib/util/internalSerializables.js +11 -0
  42. package/lib/web/JsonpChunkLoadingRuntimeModule.js +2 -2
  43. package/lib/webworker/ImportScriptsChunkLoadingRuntimeModule.js +1 -1
  44. package/package.json +2 -2
  45. package/schemas/WebpackOptions.check.js +1 -1
  46. package/schemas/WebpackOptions.json +55 -1
  47. package/schemas/plugins/container/ContainerPlugin.check.js +1 -1
  48. package/schemas/plugins/container/ContainerPlugin.json +2 -1
  49. package/schemas/plugins/container/ContainerReferencePlugin.check.js +1 -1
  50. package/schemas/plugins/container/ContainerReferencePlugin.json +1 -0
  51. package/schemas/plugins/container/ExternalsType.check.js +1 -1
  52. package/schemas/plugins/container/ModuleFederationPlugin.check.js +1 -1
  53. package/schemas/plugins/container/ModuleFederationPlugin.json +3 -1
  54. package/schemas/plugins/css/CssGeneratorOptions.check.d.ts +7 -0
  55. package/schemas/plugins/css/CssGeneratorOptions.check.js +6 -0
  56. package/schemas/plugins/css/CssGeneratorOptions.json +3 -0
  57. package/schemas/plugins/css/CssParserOptions.check.d.ts +7 -0
  58. package/schemas/plugins/css/CssParserOptions.check.js +6 -0
  59. package/schemas/plugins/css/CssParserOptions.json +3 -0
  60. package/types.d.ts +86 -2
package/types.d.ts CHANGED
@@ -702,6 +702,10 @@ declare class Chunk {
702
702
  | null
703
703
  | string
704
704
  | ((arg0: PathData, arg1?: AssetInfo) => string);
705
+ cssFilenameTemplate:
706
+ | null
707
+ | string
708
+ | ((arg0: PathData, arg1?: AssetInfo) => string);
705
709
  runtime: RuntimeSpec;
706
710
  files: Set<string>;
707
711
  auxiliaryFiles: Set<string>;
@@ -1217,6 +1221,11 @@ declare interface CodeGenerationContext {
1217
1221
  * when in concatenated module, information about other concatenated modules
1218
1222
  */
1219
1223
  concatenationScope?: ConcatenationScope;
1224
+
1225
+ /**
1226
+ * code generation results of other modules (need to have a codeGenerationDependency to use that)
1227
+ */
1228
+ codeGenerationResults: CodeGenerationResults;
1220
1229
  }
1221
1230
  declare interface CodeGenerationResult {
1222
1231
  /**
@@ -2095,6 +2104,7 @@ declare interface Configuration {
2095
2104
  | "commonjs"
2096
2105
  | "commonjs2"
2097
2106
  | "commonjs-module"
2107
+ | "commonjs-static"
2098
2108
  | "amd"
2099
2109
  | "amd-require"
2100
2110
  | "umd"
@@ -2582,6 +2592,12 @@ declare class Dependency {
2582
2592
  readonly type: string;
2583
2593
  readonly category: string;
2584
2594
  loc: DependencyLocation;
2595
+ setLoc(
2596
+ startLine?: any,
2597
+ startColumn?: any,
2598
+ endLine?: any,
2599
+ endColumn?: any
2600
+ ): void;
2585
2601
  getResourceIdentifier(): null | string;
2586
2602
  couldAffectReferencingModule(): boolean | typeof TRANSITIVE;
2587
2603
 
@@ -2697,6 +2713,11 @@ declare interface DependencyTemplateContext {
2697
2713
  * when in a concatenated module, information about other concatenated modules
2698
2714
  */
2699
2715
  concatenationScope?: ConcatenationScope;
2716
+
2717
+ /**
2718
+ * the code generation results
2719
+ */
2720
+ codeGenerationResults: CodeGenerationResults;
2700
2721
  }
2701
2722
  declare abstract class DependencyTemplates {
2702
2723
  get(dependency: DependencyConstructor): DependencyTemplate;
@@ -3338,6 +3359,11 @@ declare interface ExperimentsCommon {
3338
3359
  */
3339
3360
  cacheUnaffected?: boolean;
3340
3361
 
3362
+ /**
3363
+ * Enable css support.
3364
+ */
3365
+ css?: boolean;
3366
+
3341
3367
  /**
3342
3368
  * Apply defaults of next major version.
3343
3369
  */
@@ -3853,6 +3879,7 @@ type ExternalsType =
3853
3879
  | "commonjs"
3854
3880
  | "commonjs2"
3855
3881
  | "commonjs-module"
3882
+ | "commonjs-static"
3856
3883
  | "amd"
3857
3884
  | "amd-require"
3858
3885
  | "umd"
@@ -4197,6 +4224,11 @@ declare interface GenerateContext {
4197
4224
  */
4198
4225
  concatenationScope?: ConcatenationScope;
4199
4226
 
4227
+ /**
4228
+ * code generation results of other modules (need to have a codeGenerationDependency to use that)
4229
+ */
4230
+ codeGenerationResults?: CodeGenerationResults;
4231
+
4200
4232
  /**
4201
4233
  * which kind of code should be generated
4202
4234
  */
@@ -6005,7 +6037,7 @@ declare interface LibraryOptions {
6005
6037
  name?: string | string[] | LibraryCustomUmdObject;
6006
6038
 
6007
6039
  /**
6008
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
6040
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
6009
6041
  */
6010
6042
  type: string;
6011
6043
 
@@ -6492,6 +6524,7 @@ declare class Module extends DependenciesBlock {
6492
6524
  buildMeta: BuildMeta;
6493
6525
  buildInfo: Record<string, any>;
6494
6526
  presentationalDependencies?: Dependency[];
6527
+ codeGenerationDependencies?: Dependency[];
6495
6528
  id: string | number;
6496
6529
  readonly hash: string;
6497
6530
  readonly renderedHash: string;
@@ -6521,6 +6554,7 @@ declare class Module extends DependenciesBlock {
6521
6554
  strict: boolean
6522
6555
  ): "namespace" | "default-only" | "default-with-named" | "dynamic";
6523
6556
  addPresentationalDependency(presentationalDependency: Dependency): void;
6557
+ addCodeGenerationDependency(codeGenerationDependency: Dependency): void;
6524
6558
  addWarning(warning: WebpackError): void;
6525
6559
  getWarnings(): undefined | Iterable<WebpackError>;
6526
6560
  getNumberOfWarnings(): number;
@@ -6708,6 +6742,7 @@ declare interface ModuleFederationPluginOptions {
6708
6742
  | "commonjs"
6709
6743
  | "commonjs2"
6710
6744
  | "commonjs-module"
6745
+ | "commonjs-static"
6711
6746
  | "amd"
6712
6747
  | "amd-require"
6713
6748
  | "umd"
@@ -8139,6 +8174,20 @@ declare interface Output {
8139
8174
  */
8140
8175
  crossOriginLoading?: false | "anonymous" | "use-credentials";
8141
8176
 
8177
+ /**
8178
+ * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
8179
+ */
8180
+ cssChunkFilename?:
8181
+ | string
8182
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8183
+
8184
+ /**
8185
+ * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
8186
+ */
8187
+ cssFilename?:
8188
+ | string
8189
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8190
+
8142
8191
  /**
8143
8192
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
8144
8193
  */
@@ -8245,7 +8294,7 @@ declare interface Output {
8245
8294
  libraryExport?: string | string[];
8246
8295
 
8247
8296
  /**
8248
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
8297
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
8249
8298
  */
8250
8299
  libraryTarget?: string;
8251
8300
 
@@ -8434,6 +8483,20 @@ declare interface OutputNormalized {
8434
8483
  */
8435
8484
  crossOriginLoading?: false | "anonymous" | "use-credentials";
8436
8485
 
8486
+ /**
8487
+ * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
8488
+ */
8489
+ cssChunkFilename?:
8490
+ | string
8491
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8492
+
8493
+ /**
8494
+ * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
8495
+ */
8496
+ cssFilename?:
8497
+ | string
8498
+ | ((pathData: PathData, assetInfo?: AssetInfo) => string);
8499
+
8437
8500
  /**
8438
8501
  * Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
8439
8502
  */
@@ -10413,6 +10476,24 @@ declare abstract class RuntimeTemplate {
10413
10476
  */
10414
10477
  runtimeRequirements: Set<string>;
10415
10478
  }): string;
10479
+ assetUrl(__0: {
10480
+ /**
10481
+ * the module
10482
+ */
10483
+ module: Module;
10484
+ /**
10485
+ * the public path
10486
+ */
10487
+ publicPath: string;
10488
+ /**
10489
+ * runtime
10490
+ */
10491
+ runtime?: RuntimeSpec;
10492
+ /**
10493
+ * the code generation results
10494
+ */
10495
+ codeGenerationResults: CodeGenerationResults;
10496
+ }): string;
10416
10497
  }
10417
10498
  declare abstract class RuntimeValue {
10418
10499
  fn: (arg0: {
@@ -12007,6 +12088,7 @@ declare interface WebpackOptionsNormalized {
12007
12088
  | "commonjs"
12008
12089
  | "commonjs2"
12009
12090
  | "commonjs-module"
12091
+ | "commonjs-static"
12010
12092
  | "amd"
12011
12093
  | "amd-require"
12012
12094
  | "umd"
@@ -12302,7 +12384,9 @@ declare namespace exports {
12302
12384
  export let chunkName: string;
12303
12385
  export let runtimeId: string;
12304
12386
  export let getChunkScriptFilename: string;
12387
+ export let getChunkCssFilename: string;
12305
12388
  export let getChunkUpdateScriptFilename: string;
12389
+ export let getChunkUpdateCssFilename: string;
12306
12390
  export let startup: string;
12307
12391
  export let startupNoDefault: string;
12308
12392
  export let startupOnlyAfter: string;