@depup/webpack 5.110.1-depup.0 → 5.110.3-depup.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.
Files changed (70) hide show
  1. package/README.md +4 -4
  2. package/changes.json +3 -3
  3. package/lib/ChunkGraph.js +20 -18
  4. package/lib/Compilation.js +1 -1
  5. package/lib/ConcatenationScope.js +25 -35
  6. package/lib/DotenvPlugin.js +41 -13
  7. package/lib/ExportsInfo.js +10 -0
  8. package/lib/FlagDependencyUsagePlugin.js +8 -2
  9. package/lib/NormalModule.js +13 -20
  10. package/lib/RuntimePlugin.js +3 -0
  11. package/lib/RuntimeTemplate.js +437 -432
  12. package/lib/async-modules/AsyncModuleHelpers.js +10 -4
  13. package/lib/config/defaults.js +26 -16
  14. package/lib/config/normalization.js +18 -8
  15. package/lib/css/CssLoadingRuntimeModule.js +32 -13
  16. package/lib/css/CssModulesPlugin.js +9 -17
  17. package/lib/css/data.js +13 -3
  18. package/lib/css/syntax.js +78 -10
  19. package/lib/dependencies/CommonJsRequireDependency.js +18 -4
  20. package/lib/dependencies/ContextDependencyTemplateAsRequireCall.js +20 -7
  21. package/lib/dependencies/HarmonyEvaluatedImportSpecifierDependency.js +10 -4
  22. package/lib/dependencies/HarmonyExportDependencyParserPlugin.js +2 -0
  23. package/lib/dependencies/HarmonyExportImportedSpecifierDependency.js +143 -17
  24. package/lib/dependencies/HarmonyImportDependency.js +94 -41
  25. package/lib/dependencies/HarmonyImportDependencyParserPlugin.js +93 -14
  26. package/lib/dependencies/HarmonyImportSideEffectDependency.js +114 -0
  27. package/lib/dependencies/HtmlEntryDependency.js +12 -2
  28. package/lib/dependencies/ImportContextDependency.js +43 -3
  29. package/lib/dependencies/ImportDependency.js +8 -29
  30. package/lib/dependencies/ImportParserPlugin.js +24 -14
  31. package/lib/dependencies/RequireHeaderDependency.js +20 -21
  32. package/lib/dependencies/WorkerAndWorkletPlugin.js +1 -0
  33. package/lib/dependencies/WorkerDependency.js +6 -12
  34. package/lib/dependencies/WorkletDependency.js +7 -11
  35. package/lib/dependencies/importOptionsCheck.js +47 -0
  36. package/lib/errors/DotenvFileError.js +29 -0
  37. package/lib/errors/ImportedBindingAssignmentError.js +30 -0
  38. package/lib/esm/ModuleChunkLoadingPlugin.js +6 -9
  39. package/lib/esm/ModuleChunkLoadingRuntimeModule.js +7 -1
  40. package/lib/html/HtmlModulesPlugin.js +84 -38
  41. package/lib/html/syntax.js +417 -169
  42. package/lib/javascript/JavascriptModulesPlugin.js +5 -10
  43. package/lib/loaders/LoaderRunner.js +33 -5
  44. package/lib/node/ReadFileCompileAsyncWasmPlugin.js +8 -15
  45. package/lib/optimize/ConcatenatedModule.js +46 -7
  46. package/lib/optimize/ConstExportsPlugin.js +5 -0
  47. package/lib/optimize/InlineExports.js +121 -0
  48. package/lib/optimize/RealContentHashPlugin.js +111 -35
  49. package/lib/prefetch/ResourceHintPlugin.js +12 -13
  50. package/lib/runtime/AsyncModuleRuntimeModule.js +5 -1
  51. package/lib/runtime/MakeDeferredNamespaceObjectRuntime.js +11 -1
  52. package/lib/schemes/HttpUriPlugin.js +22 -5
  53. package/lib/serialization/FileMiddleware.js +15 -2
  54. package/lib/typescript/TypeScriptPlugin.js +8 -10
  55. package/lib/util/ArrayQueue.js +3 -3
  56. package/lib/util/SourceProcessor.js +24 -8
  57. package/lib/util/URLAbsoluteSpecifier.js +3 -1
  58. package/lib/util/conventions.js +5 -1
  59. package/lib/util/createMappings.js +25 -3
  60. package/lib/util/internalSerializables.js +2 -0
  61. package/lib/util/removeBOM.js +82 -1
  62. package/lib/wasm-async/AsyncWasmCompileRuntimeModule.js +5 -3
  63. package/lib/wasm-async/AsyncWasmLoadingRuntimeModule.js +5 -3
  64. package/lib/wasm-async/UniversalCompileAsyncWasmPlugin.js +7 -12
  65. package/lib/web/FetchCompileAsyncWasmPlugin.js +10 -6
  66. package/lib/web/FetchCompileWasmPlugin.js +4 -2
  67. package/package.json +7 -7
  68. package/schemas/WebpackOptions.check.js +1 -1
  69. package/schemas/WebpackOptions.json +9 -10
  70. package/types.d.ts +95 -27
@@ -3603,7 +3603,7 @@
3603
3603
  "type": "boolean"
3604
3604
  },
3605
3605
  "minimize": {
3606
- "description": "Enable minimizing the output. Uses optimization.minimizer. An object enables it and configures the built-in minimizer per asset type.",
3606
+ "description": "Enable minimizing the output. Uses optimization.minimizer. An options object implies 'true' and sets optimization.minimizeOptions.",
3607
3607
  "anyOf": [
3608
3608
  {
3609
3609
  "type": "boolean"
@@ -3613,6 +3613,9 @@
3613
3613
  }
3614
3614
  ]
3615
3615
  },
3616
+ "minimizeOptions": {
3617
+ "$ref": "#/definitions/OptimizationMinimizeOptions"
3618
+ },
3616
3619
  "minimizer": {
3617
3620
  "description": "Minimizer(s) to use for minimizing the output.",
3618
3621
  "type": "array",
@@ -4074,15 +4077,11 @@
4074
4077
  "type": "boolean"
4075
4078
  },
4076
4079
  "minimize": {
4077
- "description": "Enable minimizing the output. Uses optimization.minimizer. An object configures the built-in minimizer per asset type.",
4078
- "anyOf": [
4079
- {
4080
- "enum": [false]
4081
- },
4082
- {
4083
- "$ref": "#/definitions/OptimizationMinimizeOptions"
4084
- }
4085
- ]
4080
+ "description": "Enable minimizing the output. Uses optimization.minimizer.",
4081
+ "type": "boolean"
4082
+ },
4083
+ "minimizeOptions": {
4084
+ "$ref": "#/definitions/OptimizationMinimizeOptions"
4086
4085
  },
4087
4086
  "minimizer": {
4088
4087
  "description": "Minimizer(s) to use for minimizing the output.",
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> &
@@ -4522,18 +4534,6 @@ declare class ConcatenationScope {
4522
4534
  */
4523
4535
  isWrapped(): boolean;
4524
4536
 
4525
- /**
4526
- * Records a `require(...)` call that was replaced as a whole by a
4527
- * concatenation reference, so nothing else rewrites a range inside it.
4528
- */
4529
- registerReplacedRequire(range: [number, number]): void;
4530
-
4531
- /**
4532
- * Checks whether an offset sits inside an already-replaced `require(...)` call.
4533
- * Containment, not exact match: `new require(...)` is replaced from `new`.
4534
- */
4535
- isInsideReplacedRequire(start: number): boolean;
4536
-
4537
4537
  /**
4538
4538
  * Records the symbol that should be used when the current module exports a
4539
4539
  * named binding.
@@ -4578,7 +4578,15 @@ declare class ConcatenationScope {
4578
4578
  static isModuleReference(name: string): boolean;
4579
4579
 
4580
4580
  /**
4581
- * Finds all encoded module references in a generated source.
4581
+ * Checks whether an identifier buries a reference token without being one,
4582
+ * which nothing can resolve: it would reach the output as an undeclared global.
4583
+ */
4584
+ static isLeakedModuleReference(name: string): boolean;
4585
+
4586
+ /**
4587
+ * Finds all encoded module references in a generated source. A match that
4588
+ * continues an identifier is reported as `leaked`: it is a token a wider
4589
+ * replacement swallowed, so substituting it would rewrite the middle of a name.
4582
4590
  */
4583
4591
  static findModuleReferences(source: Source): ModuleReferenceMatch[];
4584
4592
 
@@ -6108,13 +6116,14 @@ declare interface DefaultHandlerOptions {
6108
6116
  estimatedTime?: boolean;
6109
6117
  phaseTimings?: boolean;
6110
6118
  }
6111
-
6112
- declare interface DeferredEmbeddedSource {
6113
- source: string;
6114
- build: (answer?: string) => string;
6119
+ type DeferredEmbeddedSource = DeferredWrite & {
6115
6120
  type: string;
6116
6121
  hostType: string;
6117
6122
  as?: string;
6123
+ };
6124
+ declare interface DeferredWrite {
6125
+ source: string;
6126
+ build: (answer?: string) => string;
6118
6127
  }
6119
6128
  type DefineConfigInput =
6120
6129
  | Configuration
@@ -8130,6 +8139,12 @@ declare abstract class ExportInfo {
8130
8139
  resolveTargetFilter?: (target: TargetItemWithConnection) => boolean
8131
8140
  ): undefined | TargetItemWithConnection;
8132
8141
 
8142
+ /**
8143
+ * Returns whether resolving the target leads back to this export, which
8144
+ * `getTarget` cannot express as it reports a cycle as "no target".
8145
+ */
8146
+ hasCircularTarget(moduleGraph: ModuleGraph): boolean;
8147
+
8133
8148
  /**
8134
8149
  * Move the target forward as long resolveTargetFilter is fulfilled
8135
8150
  */
@@ -8169,6 +8184,7 @@ declare abstract class ExportMode {
8169
8184
  items: null | NormalReexportItem[];
8170
8185
  name: null | string;
8171
8186
  partialNamespaceExportInfo: null | ExportInfo;
8187
+ circular: boolean;
8172
8188
  ignored: null | Set<string>;
8173
8189
  hidden?: null | Set<string>;
8174
8190
  userRequest: null | string;
@@ -9892,6 +9908,9 @@ declare class HarmonyImportDependencyTemplate extends DependencyTemplate {
9892
9908
  referencedModule: Module
9893
9909
  ): undefined | string | boolean | SortableSet<string>;
9894
9910
  }
9911
+ declare abstract class HarmonyImportSideEffectDependency extends HarmonyImportDependency {
9912
+ unusedSpecifiers?: UnusedSpecifiers;
9913
+ }
9895
9914
  declare interface HarmonySettings {
9896
9915
  ids: string[];
9897
9916
  source: string;
@@ -9900,6 +9919,16 @@ declare interface HarmonySettings {
9900
9919
  await: boolean;
9901
9920
  attributes?: ImportAttributes;
9902
9921
  phase: ImportPhaseType;
9922
+
9923
+ /**
9924
+ * whether the binding is referenced anywhere
9925
+ */
9926
+ used: boolean;
9927
+
9928
+ /**
9929
+ * the statement's own dependency
9930
+ */
9931
+ dependency?: HarmonyImportSideEffectDependency;
9903
9932
  }
9904
9933
  declare abstract class HarmonyStarExportsList {
9905
9934
  dependencies: HarmonyExportImportedSpecifierDependency[];
@@ -18185,6 +18214,7 @@ declare interface ModuleReferenceMatch {
18185
18214
  start: number;
18186
18215
  end: number;
18187
18216
  name: string;
18217
+ leaked: boolean;
18188
18218
  }
18189
18219
  declare interface ModuleReferenceOptions {
18190
18220
  /**
@@ -20014,10 +20044,15 @@ declare interface Optimization {
20014
20044
  mergeDuplicateChunks?: boolean;
20015
20045
 
20016
20046
  /**
20017
- * Enable minimizing the output. Uses optimization.minimizer. An object enables it and configures the built-in minimizer per asset type.
20047
+ * Enable minimizing the output. Uses optimization.minimizer. An options object implies 'true' and sets optimization.minimizeOptions.
20018
20048
  */
20019
20049
  minimize?: boolean | OptimizationMinimizeOptions;
20020
20050
 
20051
+ /**
20052
+ * Enable minimizing the output, configured per asset type. An absent type is minimized with the defaults; `false` disables minimizing it.
20053
+ */
20054
+ minimizeOptions?: OptimizationMinimizeOptions;
20055
+
20021
20056
  /**
20022
20057
  * Minimizer(s) to use for minimizing the output.
20023
20058
  */
@@ -20403,9 +20438,15 @@ declare interface OptimizationNormalized {
20403
20438
  mergeDuplicateChunks?: boolean;
20404
20439
 
20405
20440
  /**
20406
- * Enable minimizing the output. Uses optimization.minimizer. An object configures the built-in minimizer per asset type.
20441
+ * Enable minimizing the output. Uses optimization.minimizer.
20442
+ */
20443
+ minimize?: boolean;
20444
+
20445
+ /**
20446
+ * Enable minimizing the output, configured per asset type. An absent type is minimized with the defaults; `false` disables minimizing it.
20447
+ * @since 5.110.0
20407
20448
  */
20408
- minimize?: false | OptimizationMinimizeOptions;
20449
+ minimizeOptions?: OptimizationMinimizeOptions;
20409
20450
 
20410
20451
  /**
20411
20452
  * Minimizer(s) to use for minimizing the output.
@@ -20533,7 +20574,8 @@ type OptimizationNormalizedWithDefaults = OptimizationNormalized & {
20533
20574
  mangleWasmImports: NonNullable<undefined | boolean>;
20534
20575
  portableRecords: NonNullable<undefined | boolean>;
20535
20576
  realContentHash: NonNullable<undefined | boolean>;
20536
- minimize: NonNullable<undefined | false | OptimizationMinimizeOptions>;
20577
+ minimize: NonNullable<undefined | boolean>;
20578
+ minimizeOptions: OptimizationMinimizeOptions;
20537
20579
  minimizer: (
20538
20580
  | ((this: Compiler, compiler: Compiler) => void)
20539
20581
  | WebpackPluginInstance
@@ -26089,10 +26131,24 @@ declare abstract class RuntimeTemplate {
26089
26131
  */
26090
26132
  chunkRootOutputDir(chunk: Chunk, enforceRelative: boolean): string;
26091
26133
 
26134
+ /**
26135
+ * Static literal specifier (already quoted) for the `new URL(<here>, import.meta.url)`
26136
+ * a worker or worklet entry chunk bakes to, or `null` to keep the runtime form. The
26137
+ * gate and the build are asked together so every call site agrees on both — the
26138
+ * `new Worker(...)` emit, and the resource hint `ResourceHintPlugin` spells for it.
26139
+ */
26140
+ getAnalyzableWorkerUrl(
26141
+ overridePublicPath: undefined | string,
26142
+ chunk: Chunk,
26143
+ module: Module,
26144
+ chunkGraph: ChunkGraph,
26145
+ runtimeRequirements: Set<string>
26146
+ ): null | string;
26147
+
26092
26148
  /**
26093
26149
  * 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
26150
+ * keyed by chunk id — one that cannot be named leaves the map incomplete, and its
26151
+ * id keeps the runtime `publicPath + getChunkCssFilename(id)` form. Both the runtime module reading them
26096
26152
  * and the plugin declaring what it needs ask this, so the two always agree. The
26097
26153
  * runtime hands an absolute url string to `link.href`, and so does this — the browser
26098
26154
  * resolves the element against the document, which is not where the chunk sits, and
@@ -26104,13 +26160,13 @@ declare abstract class RuntimeTemplate {
26104
26160
  chunkGraph: ChunkGraph,
26105
26161
  runtimeRequirements: ReadonlySet<string>,
26106
26162
  consumingModule?: Module
26107
- ): null | Map<ChunkId, string>;
26163
+ ): null | AnalyzableChunkUrls;
26108
26164
 
26109
26165
  /**
26110
26166
  * Static `new URL(<file>, import.meta.url).href` for every javascript chunk a
26111
26167
  * 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
26168
+ * id — one that cannot be named leaves the map incomplete, and its id keeps the
26169
+ * runtime `publicPath + getChunkScriptFilename(id)` form. Both the runtime module reading
26114
26170
  * them and the plugin declaring what it needs ask this, so the two always agree.
26115
26171
  */
26116
26172
  analyzableChunkScriptUrls(
@@ -26118,7 +26174,7 @@ declare abstract class RuntimeTemplate {
26118
26174
  chunkGraph: ChunkGraph,
26119
26175
  runtimeRequirements: ReadonlySet<string>,
26120
26176
  consumingModule?: Module
26121
- ): null | Map<ChunkId, string>;
26177
+ ): null | AnalyzableChunkUrls;
26122
26178
 
26123
26179
  /**
26124
26180
  * Static `new URL(<file>, import.meta.url)` for the binary emitted for an async wasm
@@ -27156,6 +27212,10 @@ declare class SourceProcessorSyntaxClass_1 extends SourceProcessorClass<
27156
27212
  > {
27157
27213
  constructor();
27158
27214
  static PrintContext: typeof PrintContext;
27215
+ static declineDeferredWrites: (
27216
+ text: string,
27217
+ writes: DeferredWrite[]
27218
+ ) => string;
27159
27219
  static deferredWrite: (id: number) => string;
27160
27220
  }
27161
27221
 
@@ -27225,6 +27285,10 @@ declare class SourceProcessorSyntaxClass_2 extends SourceProcessorClass<
27225
27285
  > {
27226
27286
  constructor();
27227
27287
  static PrintContext: typeof PrintContext;
27288
+ static declineDeferredWrites: (
27289
+ text: string,
27290
+ writes: DeferredWrite[]
27291
+ ) => string;
27228
27292
  static deferredWrite: (id: number) => string;
27229
27293
  }
27230
27294
  declare interface SourceTable {
@@ -28763,6 +28827,10 @@ declare interface TsconfigPathsMap {
28763
28827
  declare const UNDEFINED_MARKER: unique symbol;
28764
28828
  declare interface URL_url extends URL {}
28765
28829
  type UnsafeCacheData = KnownUnsafeCacheData & Record<string, any>;
28830
+ declare interface UnusedSpecifiers {
28831
+ exportPresenceMode: ExportPresenceMode;
28832
+ specifiers: [string[], string][];
28833
+ }
28766
28834
  declare interface UpdateHashContextDependency {
28767
28835
  chunkGraph: ChunkGraph;
28768
28836
  runtime: RuntimeSpec;