webpack 5.110.1 → 5.110.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.
Files changed (38) hide show
  1. package/README.md +10 -17
  2. package/lib/ExportsInfo.js +10 -0
  3. package/lib/RuntimeTemplate.js +423 -430
  4. package/lib/css/CssLoadingRuntimeModule.js +32 -13
  5. package/lib/css/CssModulesPlugin.js +9 -17
  6. package/lib/css/data.js +13 -3
  7. package/lib/css/syntax.js +78 -10
  8. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +10 -4
  9. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
  10. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +48 -3
  11. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +83 -14
  12. package/lib/dependencies/HarmonyImportSideEffectDependency.js +114 -0
  13. package/lib/dependencies/WorkerAndWorkletPlugin.js +1 -0
  14. package/lib/dependencies/WorkerDependency.js +6 -12
  15. package/lib/dependencies/WorkletDependency.js +7 -11
  16. package/lib/esm/ModuleChunkLoadingPlugin.js +6 -9
  17. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -1
  18. package/lib/html/HtmlModulesPlugin.js +55 -16
  19. package/lib/html/syntax.js +113 -26
  20. package/lib/javascript/JavascriptModulesPlugin.js +3 -10
  21. package/lib/loaders/LoaderRunner.js +33 -5
  22. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -15
  23. package/lib/optimize/ConcatenatedModule.js +8 -0
  24. package/lib/optimize/ConstExportsPlugin.js +5 -0
  25. package/lib/optimize/InlineExports.js +121 -0
  26. package/lib/optimize/RealContentHashPlugin.js +111 -35
  27. package/lib/prefetch/ResourceHintPlugin.js +6 -12
  28. package/lib/typescript/TypeScriptPlugin.js +8 -10
  29. package/lib/util/SourceProcessor.js +24 -8
  30. package/lib/util/createMappings.js +25 -3
  31. package/lib/util/removeBOM.js +82 -1
  32. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +5 -3
  33. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -3
  34. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +7 -12
  35. package/lib/web/FetchCompileAsyncWasmPlugin.js +10 -6
  36. package/lib/web/FetchCompileWasmPlugin.js +4 -2
  37. package/package.json +1 -1
  38. package/types.d.ts +69 -10
package/types.d.ts CHANGED
@@ -355,6 +355,18 @@ declare interface AllCodeGenerationSchemas {
355
355
  */
356
356
  "share-init": [{ shareScope: string; initStage: number; init: string }];
357
357
  }
358
+ declare interface AnalyzableChunkUrls {
359
+ /**
360
+ * the urls that could be written, by chunk id
361
+ */
362
+ urls: Map<ChunkId, string>;
363
+
364
+ /**
365
+ * false when some chunk kept the runtime form, whose
366
+ * ids the consumer then still resolves through the runtime name lookup
367
+ */
368
+ complete: boolean;
369
+ }
358
370
  type AnalyzableForm =
359
371
  "import" | "url" | "url-runtime" | "url-inline" | "wasm" | "wasm-relative";
360
372
  type AnyLoaderContext = NormalModuleLoaderContext<any> &
@@ -6108,13 +6120,14 @@ declare interface DefaultHandlerOptions {
6108
6120
  estimatedTime?: boolean;
6109
6121
  phaseTimings?: boolean;
6110
6122
  }
6111
-
6112
- declare interface DeferredEmbeddedSource {
6113
- source: string;
6114
- build: (answer?: string) => string;
6123
+ type DeferredEmbeddedSource = DeferredWrite & {
6115
6124
  type: string;
6116
6125
  hostType: string;
6117
6126
  as?: string;
6127
+ };
6128
+ declare interface DeferredWrite {
6129
+ source: string;
6130
+ build: (answer?: string) => string;
6118
6131
  }
6119
6132
  type DefineConfigInput =
6120
6133
  | Configuration
@@ -8130,6 +8143,12 @@ declare abstract class ExportInfo {
8130
8143
  resolveTargetFilter?: (target: TargetItemWithConnection) => boolean
8131
8144
  ): undefined | TargetItemWithConnection;
8132
8145
 
8146
+ /**
8147
+ * Returns whether resolving the target leads back to this export, which
8148
+ * `getTarget` cannot express as it reports a cycle as "no target".
8149
+ */
8150
+ hasCircularTarget(moduleGraph: ModuleGraph): boolean;
8151
+
8133
8152
  /**
8134
8153
  * Move the target forward as long resolveTargetFilter is fulfilled
8135
8154
  */
@@ -8169,6 +8188,7 @@ declare abstract class ExportMode {
8169
8188
  items: null | NormalReexportItem[];
8170
8189
  name: null | string;
8171
8190
  partialNamespaceExportInfo: null | ExportInfo;
8191
+ circular: boolean;
8172
8192
  ignored: null | Set<string>;
8173
8193
  hidden?: null | Set<string>;
8174
8194
  userRequest: null | string;
@@ -9892,6 +9912,9 @@ declare class HarmonyImportDependencyTemplate extends DependencyTemplate {
9892
9912
  referencedModule: Module
9893
9913
  ): undefined | string | boolean | SortableSet<string>;
9894
9914
  }
9915
+ declare abstract class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
9916
+ unusedSpecifiers?: UnusedSpecifiers;
9917
+ }
9895
9918
  declare interface HarmonySettings {
9896
9919
  ids: string[];
9897
9920
  source: string;
@@ -9900,6 +9923,16 @@ declare interface HarmonySettings {
9900
9923
  await: boolean;
9901
9924
  attributes?: ImportAttributes;
9902
9925
  phase: ImportPhaseType;
9926
+
9927
+ /**
9928
+ * whether the binding is referenced anywhere
9929
+ */
9930
+ used: boolean;
9931
+
9932
+ /**
9933
+ * the statement's own dependency
9934
+ */
9935
+ dependency?: HarmonyImportSideEffectDependency;
9903
9936
  }
9904
9937
  declare abstract class HarmonyStarExportsList {
9905
9938
  dependencies: HarmonyExportImportedSpecifierDependency[];
@@ -26089,10 +26122,24 @@ declare abstract class RuntimeTemplate {
26089
26122
  */
26090
26123
  chunkRootOutputDir(chunk: Chunk, enforceRelative: boolean): string;
26091
26124
 
26125
+ /**
26126
+ * Static literal specifier (already quoted) for the `new URL(<here>, import.meta.url)`
26127
+ * a worker or worklet entry chunk bakes to, or `null` to keep the runtime form. The
26128
+ * gate and the build are asked together so every call site agrees on both — the
26129
+ * `new Worker(...)` emit, and the resource hint `ResourceHintPlugin` spells for it.
26130
+ */
26131
+ getAnalyzableWorkerUrl(
26132
+ overridePublicPath: undefined | string,
26133
+ chunk: Chunk,
26134
+ module: Module,
26135
+ chunkGraph: ChunkGraph,
26136
+ runtimeRequirements: Set<string>
26137
+ ): null | string;
26138
+
26092
26139
  /**
26093
26140
  * Static `new URL(<file>, import.meta.url)` for every stylesheet a runtime can load,
26094
- * keyed by chunk id, or `null` when any of them has to keep the runtime
26095
- * `publicPath + getChunkCssFilename(id)` form. Both the runtime module reading them
26141
+ * keyed by chunk id — one that cannot be named leaves the map incomplete, and its
26142
+ * id keeps the runtime `publicPath + getChunkCssFilename(id)` form. Both the runtime module reading them
26096
26143
  * and the plugin declaring what it needs ask this, so the two always agree. The
26097
26144
  * runtime hands an absolute url string to `link.href`, and so does this — the browser
26098
26145
  * resolves the element against the document, which is not where the chunk sits, and
@@ -26104,13 +26151,13 @@ declare abstract class RuntimeTemplate {
26104
26151
  chunkGraph: ChunkGraph,
26105
26152
  runtimeRequirements: ReadonlySet<string>,
26106
26153
  consumingModule?: Module
26107
- ): null | Map<ChunkId, string>;
26154
+ ): null | AnalyzableChunkUrls;
26108
26155
 
26109
26156
  /**
26110
26157
  * Static `new URL(<file>, import.meta.url).href` for every javascript chunk a
26111
26158
  * runtime can hint at with `<link rel="prefetch"/"modulepreload">`, keyed by chunk
26112
- * id, or `null` when any of them has to keep the runtime
26113
- * `publicPath + getChunkScriptFilename(id)` form. Both the runtime module reading
26159
+ * id — one that cannot be named leaves the map incomplete, and its id keeps the
26160
+ * runtime `publicPath + getChunkScriptFilename(id)` form. Both the runtime module reading
26114
26161
  * them and the plugin declaring what it needs ask this, so the two always agree.
26115
26162
  */
26116
26163
  analyzableChunkScriptUrls(
@@ -26118,7 +26165,7 @@ declare abstract class RuntimeTemplate {
26118
26165
  chunkGraph: ChunkGraph,
26119
26166
  runtimeRequirements: ReadonlySet<string>,
26120
26167
  consumingModule?: Module
26121
- ): null | Map<ChunkId, string>;
26168
+ ): null | AnalyzableChunkUrls;
26122
26169
 
26123
26170
  /**
26124
26171
  * Static `new URL(<file>, import.meta.url)` for the binary emitted for an async wasm
@@ -27156,6 +27203,10 @@ declare class SourceProcessorSyntaxClass_1 extends SourceProcessorClass<
27156
27203
  > {
27157
27204
  constructor();
27158
27205
  static PrintContext: typeof PrintContext;
27206
+ static declineDeferredWrites: (
27207
+ text: string,
27208
+ writes: DeferredWrite[]
27209
+ ) => string;
27159
27210
  static deferredWrite: (id: number) => string;
27160
27211
  }
27161
27212
 
@@ -27225,6 +27276,10 @@ declare class SourceProcessorSyntaxClass_2 extends SourceProcessorClass<
27225
27276
  > {
27226
27277
  constructor();
27227
27278
  static PrintContext: typeof PrintContext;
27279
+ static declineDeferredWrites: (
27280
+ text: string,
27281
+ writes: DeferredWrite[]
27282
+ ) => string;
27228
27283
  static deferredWrite: (id: number) => string;
27229
27284
  }
27230
27285
  declare interface SourceTable {
@@ -28763,6 +28818,10 @@ declare interface TsconfigPathsMap {
28763
28818
  declare const UNDEFINED_MARKER: unique symbol;
28764
28819
  declare interface URL_url extends URL {}
28765
28820
  type UnsafeCacheData = KnownUnsafeCacheData & Record<string, any>;
28821
+ declare interface UnusedSpecifiers {
28822
+ exportPresenceMode: ExportPresenceMode;
28823
+ specifiers: [string[], string][];
28824
+ }
28766
28825
  declare interface UpdateHashContextDependency {
28767
28826
  chunkGraph: ChunkGraph;
28768
28827
  runtime: RuntimeSpec;