webpack 5.72.0 → 5.74.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 (42) hide show
  1. package/README.md +16 -9
  2. package/lib/Compilation.js +5 -1
  3. package/lib/Compiler.js +1 -1
  4. package/lib/DllReferencePlugin.js +1 -1
  5. package/lib/FileSystemInfo.js +35 -14
  6. package/lib/NodeStuffPlugin.js +3 -3
  7. package/lib/NormalModule.js +1 -1
  8. package/lib/RuntimePlugin.js +7 -0
  9. package/lib/config/defaults.js +12 -4
  10. package/lib/container/ModuleFederationPlugin.js +2 -0
  11. package/lib/css/CssLoadingRuntimeModule.js +9 -7
  12. package/lib/dependencies/CommonJsImportsParserPlugin.js +342 -61
  13. package/lib/dependencies/CommonJsRequireContextDependency.js +2 -2
  14. package/lib/dependencies/CommonJsRequireDependency.js +2 -1
  15. package/lib/dependencies/ContextDependency.js +15 -2
  16. package/lib/dependencies/ContextDependencyHelpers.js +18 -5
  17. package/lib/dependencies/ContextElementDependency.js +0 -16
  18. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +35 -3
  19. package/lib/dependencies/ImportParserPlugin.js +31 -25
  20. package/lib/dependencies/JsonExportsDependency.js +17 -21
  21. package/lib/dependencies/LoaderDependency.js +13 -0
  22. package/lib/dependencies/LoaderImportDependency.js +13 -0
  23. package/lib/dependencies/ModuleDependency.js +11 -1
  24. package/lib/dependencies/ProvidedDependency.js +31 -8
  25. package/lib/dependencies/RequireResolveContextDependency.js +2 -2
  26. package/lib/dependencies/RequireResolveDependency.js +2 -1
  27. package/lib/dependencies/URLPlugin.js +21 -0
  28. package/lib/index.js +4 -0
  29. package/lib/javascript/JavascriptParser.js +47 -21
  30. package/lib/json/JsonData.js +8 -0
  31. package/lib/json/JsonParser.js +4 -6
  32. package/lib/optimize/ConcatenatedModule.js +40 -17
  33. package/lib/optimize/ModuleConcatenationPlugin.js +1 -1
  34. package/lib/runtime/AsyncModuleRuntimeModule.js +32 -58
  35. package/lib/runtime/LoadScriptRuntimeModule.js +9 -7
  36. package/lib/runtime/NonceRuntimeModule.js +24 -0
  37. package/lib/sharing/ProvideSharedPlugin.js +1 -2
  38. package/lib/web/JsonpChunkLoadingRuntimeModule.js +11 -9
  39. package/package.json +6 -5
  40. package/schemas/WebpackOptions.check.js +1 -1
  41. package/schemas/WebpackOptions.json +60 -0
  42. package/types.d.ts +94 -4
@@ -1580,6 +1580,43 @@
1580
1580
  "description": "Enable/disable parsing of magic comments in CommonJs syntax.",
1581
1581
  "type": "boolean"
1582
1582
  },
1583
+ "createRequire": {
1584
+ "description": "Enable/disable parsing \"import { createRequire } from \"module\"\" and evaluating createRequire().",
1585
+ "anyOf": [
1586
+ {
1587
+ "type": "boolean"
1588
+ },
1589
+ {
1590
+ "type": "string"
1591
+ }
1592
+ ]
1593
+ },
1594
+ "dynamicImportMode": {
1595
+ "description": "Specifies global mode for dynamic import.",
1596
+ "enum": ["eager", "weak", "lazy", "lazy-once"]
1597
+ },
1598
+ "dynamicImportPrefetch": {
1599
+ "description": "Specifies global prefetch for dynamic import.",
1600
+ "anyOf": [
1601
+ {
1602
+ "type": "number"
1603
+ },
1604
+ {
1605
+ "type": "boolean"
1606
+ }
1607
+ ]
1608
+ },
1609
+ "dynamicImportPreload": {
1610
+ "description": "Specifies global preload for dynamic import.",
1611
+ "anyOf": [
1612
+ {
1613
+ "type": "number"
1614
+ },
1615
+ {
1616
+ "type": "boolean"
1617
+ }
1618
+ ]
1619
+ },
1583
1620
  "exportsPresence": {
1584
1621
  "description": "Specifies the behavior of invalid export names in \"import ... from ...\" and \"export ... from ...\".",
1585
1622
  "enum": ["error", "warn", "auto", false]
@@ -3700,6 +3737,29 @@
3700
3737
  "type": "string"
3701
3738
  }
3702
3739
  },
3740
+ "extensionAlias": {
3741
+ "description": "An object which maps extension to extension aliases.",
3742
+ "type": "object",
3743
+ "additionalProperties": {
3744
+ "description": "Extension alias.",
3745
+ "anyOf": [
3746
+ {
3747
+ "description": "Multiple extensions.",
3748
+ "type": "array",
3749
+ "items": {
3750
+ "description": "Aliased extension.",
3751
+ "type": "string",
3752
+ "minLength": 1
3753
+ }
3754
+ },
3755
+ {
3756
+ "description": "Aliased extension.",
3757
+ "type": "string",
3758
+ "minLength": 1
3759
+ }
3760
+ ]
3761
+ }
3762
+ },
3703
3763
  "extensions": {
3704
3764
  "description": "Extensions added to the request when trying to find the file.",
3705
3765
  "type": "array",
package/types.d.ts CHANGED
@@ -2503,11 +2503,11 @@ declare interface ContextHash {
2503
2503
  }
2504
2504
  type ContextMode =
2505
2505
  | "weak"
2506
- | "sync"
2507
2506
  | "eager"
2508
- | "async-weak"
2509
2507
  | "lazy"
2510
- | "lazy-once";
2508
+ | "lazy-once"
2509
+ | "sync"
2510
+ | "async-weak";
2511
2511
  declare abstract class ContextModuleFactory extends ModuleFactory {
2512
2512
  hooks: Readonly<{
2513
2513
  beforeResolve: AsyncSeriesWaterfallHook<[any]>;
@@ -3847,6 +3847,13 @@ declare interface ExpressionExpressionInfo {
3847
3847
  getMembers: () => string[];
3848
3848
  getMembersOptionals: () => boolean[];
3849
3849
  }
3850
+ declare interface ExtensionAliasOption {
3851
+ alias: string | string[];
3852
+ extension: string;
3853
+ }
3854
+ declare interface ExtensionAliasOptions {
3855
+ [index: string]: string | string[];
3856
+ }
3850
3857
  type ExternalItem =
3851
3858
  | string
3852
3859
  | RegExp
@@ -4502,6 +4509,42 @@ declare interface HandleModuleCreationOptions {
4502
4509
  */
4503
4510
  connectOrigin?: boolean;
4504
4511
  }
4512
+ declare class HarmonyImportDependency extends ModuleDependency {
4513
+ constructor(
4514
+ request: string,
4515
+ sourceOrder: number,
4516
+ assertions?: Record<string, any>
4517
+ );
4518
+ sourceOrder: number;
4519
+ getImportVar(moduleGraph: ModuleGraph): string;
4520
+ getImportStatement(
4521
+ update: boolean,
4522
+ __1: DependencyTemplateContext
4523
+ ): [string, string];
4524
+ getLinkingErrors(
4525
+ moduleGraph: ModuleGraph,
4526
+ ids: string[],
4527
+ additionalMessage: string
4528
+ ): undefined | WebpackError[];
4529
+ static Template: typeof HarmonyImportDependencyTemplate;
4530
+ static ExportPresenceModes: {
4531
+ NONE: 0;
4532
+ WARN: 1;
4533
+ AUTO: 2;
4534
+ ERROR: 3;
4535
+ fromUserOption(str?: any): 0 | 1 | 2 | 3;
4536
+ };
4537
+ static NO_EXPORTS_REFERENCED: string[][];
4538
+ static EXPORTS_OBJECT_REFERENCED: string[][];
4539
+ static TRANSITIVE: typeof TRANSITIVE;
4540
+ }
4541
+ declare class HarmonyImportDependencyTemplate extends DependencyTemplate {
4542
+ constructor();
4543
+ static getImportEmittedRuntime(
4544
+ module: Module,
4545
+ referencedModule: Module
4546
+ ): undefined | string | boolean | SortableSet<string>;
4547
+ }
4505
4548
  declare class Hash {
4506
4549
  constructor();
4507
4550
 
@@ -4902,6 +4945,15 @@ declare class JavascriptParser extends Parser {
4902
4945
  undefined | null | BasicEvaluatedExpression
4903
4946
  >
4904
4947
  >;
4948
+ evaluateNewExpression: HookMap<
4949
+ SyncBailHook<[NewExpression], undefined | null | BasicEvaluatedExpression>
4950
+ >;
4951
+ evaluateCallExpression: HookMap<
4952
+ SyncBailHook<
4953
+ [CallExpression],
4954
+ undefined | null | BasicEvaluatedExpression
4955
+ >
4956
+ >;
4905
4957
  evaluateCallExpressionMember: HookMap<
4906
4958
  SyncBailHook<
4907
4959
  [CallExpression, undefined | BasicEvaluatedExpression],
@@ -5410,6 +5462,7 @@ declare class JavascriptParser extends Parser {
5410
5462
  isVariableDefined(name?: any): boolean;
5411
5463
  getVariableInfo(name: string): ExportedVariableInfo;
5412
5464
  setVariable(name: string, variableInfo: ExportedVariableInfo): void;
5465
+ evaluatedVariable(tagInfo?: any): VariableInfo;
5413
5466
  parseCommentOptions(
5414
5467
  range?: any
5415
5468
  ): { options: null; errors: null } | { options: object; errors: unknown[] };
@@ -5490,6 +5543,26 @@ declare interface JavascriptParserOptions {
5490
5543
  */
5491
5544
  commonjsMagicComments?: boolean;
5492
5545
 
5546
+ /**
5547
+ * Enable/disable parsing "import { createRequire } from "module"" and evaluating createRequire().
5548
+ */
5549
+ createRequire?: string | boolean;
5550
+
5551
+ /**
5552
+ * Specifies global mode for dynamic import.
5553
+ */
5554
+ dynamicImportMode?: "weak" | "eager" | "lazy" | "lazy-once";
5555
+
5556
+ /**
5557
+ * Specifies global prefetch for dynamic import.
5558
+ */
5559
+ dynamicImportPrefetch?: number | boolean;
5560
+
5561
+ /**
5562
+ * Specifies global preload for dynamic import.
5563
+ */
5564
+ dynamicImportPreload?: number | boolean;
5565
+
5493
5566
  /**
5494
5567
  * Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
5495
5568
  */
@@ -9544,6 +9617,7 @@ declare interface ResolveOptionsTypes {
9544
9617
  alias: AliasOption[];
9545
9618
  fallback: AliasOption[];
9546
9619
  aliasFields: Set<string | string[]>;
9620
+ extensionAlias: ExtensionAliasOption[];
9547
9621
  cachePredicate: (arg0: ResolveRequest) => boolean;
9548
9622
  cacheWithContext: boolean;
9549
9623
 
@@ -9642,6 +9716,11 @@ declare interface ResolveOptionsWebpackOptions {
9642
9716
  */
9643
9717
  exportsFields?: string[];
9644
9718
 
9719
+ /**
9720
+ * An object which maps extension to extension aliases.
9721
+ */
9722
+ extensionAlias?: { [index: string]: string | string[] };
9723
+
9645
9724
  /**
9646
9725
  * Extensions added to the request when trying to find the file.
9647
9726
  */
@@ -11854,6 +11933,11 @@ declare interface UserResolveOptions {
11854
11933
  */
11855
11934
  fallback?: AliasOption[] | AliasOptions;
11856
11935
 
11936
+ /**
11937
+ * An object which maps extension to extension aliases
11938
+ */
11939
+ extensionAlias?: ExtensionAliasOptions;
11940
+
11857
11941
  /**
11858
11942
  * A list of alias fields in description files
11859
11943
  */
@@ -12691,7 +12775,12 @@ declare namespace exports {
12691
12775
  ) => void;
12692
12776
  }
12693
12777
  export namespace dependencies {
12694
- export { ModuleDependency, ConstDependency, NullDependency };
12778
+ export {
12779
+ ModuleDependency,
12780
+ HarmonyImportDependency,
12781
+ ConstDependency,
12782
+ NullDependency
12783
+ };
12695
12784
  }
12696
12785
  export namespace ids {
12697
12786
  export {
@@ -13063,6 +13152,7 @@ declare namespace exports {
13063
13152
  Asset,
13064
13153
  AssetInfo,
13065
13154
  EntryOptions,
13155
+ PathData,
13066
13156
  AssetEmittedInfo,
13067
13157
  MultiStats,
13068
13158
  ParserState,