adnbn 0.12.0 → 0.13.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 (128) hide show
  1. package/dist/cli/bundler/layers.d.ts +3 -3
  2. package/dist/cli/bundler/layers.js +6 -7
  3. package/dist/cli/bundler/layers.js.map +1 -1
  4. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +42 -14
  5. package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -1
  6. package/dist/cli/bundler/plugins/build-assets-map/normalize.d.ts +3 -0
  7. package/dist/cli/bundler/plugins/build-assets-map/normalize.js +24 -0
  8. package/dist/cli/bundler/plugins/build-assets-map/normalize.js.map +1 -0
  9. package/dist/cli/bundler/plugins/build-assets-map/templates/runtime.template.d.ts +2 -0
  10. package/dist/cli/bundler/plugins/build-assets-map/templates.d.ts +9 -0
  11. package/dist/cli/bundler/plugins/build-assets-map/templates.js +32 -0
  12. package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js +11 -0
  13. package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -1
  14. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +1 -1
  15. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +38 -13
  16. package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -1
  17. package/dist/cli/bundler/plugins/isolated-styles/chunks.d.ts +5 -1
  18. package/dist/cli/bundler/plugins/isolated-styles/chunks.js +17 -16
  19. package/dist/cli/bundler/plugins/isolated-styles/chunks.js.map +1 -1
  20. package/dist/cli/bundler/plugins/isolated-styles/split-chunks.d.ts +4 -0
  21. package/dist/cli/bundler/plugins/isolated-styles/split-chunks.js +51 -0
  22. package/dist/cli/bundler/plugins/isolated-styles/split-chunks.js.map +1 -0
  23. package/dist/cli/bundler/plugins/isolated-styles/templates.js +36 -6
  24. package/dist/cli/plugins/content/bundler.d.ts +0 -3
  25. package/dist/cli/plugins/content/bundler.js +4 -20
  26. package/dist/cli/plugins/content/bundler.js.map +1 -1
  27. package/dist/cli/plugins/content/index.js +2 -3
  28. package/dist/cli/plugins/content/index.js.map +1 -1
  29. package/dist/cli/plugins/locale/Locale.js +5 -2
  30. package/dist/cli/plugins/locale/Locale.js.map +1 -1
  31. package/dist/cli/plugins/style/index.d.ts +1 -2
  32. package/dist/cli/plugins/style/index.js +19 -30
  33. package/dist/cli/plugins/style/index.js.map +1 -1
  34. package/dist/cli/resolvers/config.js +1 -2
  35. package/dist/cli/resolvers/config.js.map +1 -1
  36. package/dist/entry/content/adapters/react/Builder.d.ts +4 -2
  37. package/dist/entry/content/adapters/react/Builder.js +11 -5
  38. package/dist/entry/content/adapters/react/Builder.js.map +1 -1
  39. package/dist/entry/content/adapters/react/Node.js +2 -2
  40. package/dist/entry/content/adapters/react/Node.js.map +1 -1
  41. package/dist/entry/content/adapters/react/definition.d.ts +2 -0
  42. package/dist/entry/content/adapters/react/{resolvers/definition.js → definition.js} +1 -1
  43. package/dist/entry/content/adapters/react/definition.js.map +1 -0
  44. package/dist/entry/content/adapters/react/index.d.ts +1 -1
  45. package/dist/entry/content/adapters/react/index.js +1 -1
  46. package/dist/entry/content/adapters/react/index.js.map +1 -1
  47. package/dist/entry/content/adapters/vanilla/Builder.d.ts +4 -2
  48. package/dist/entry/content/adapters/vanilla/Builder.js +14 -5
  49. package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
  50. package/dist/entry/content/adapters/vanilla/definition.d.ts +2 -0
  51. package/dist/entry/content/adapters/vanilla/{resolvers/definition.js → definition.js} +2 -2
  52. package/dist/entry/content/adapters/vanilla/definition.js.map +1 -0
  53. package/dist/entry/content/adapters/vanilla/index.d.ts +1 -1
  54. package/dist/entry/content/adapters/vanilla/index.js +1 -1
  55. package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
  56. package/dist/entry/content/adapters/vanilla/utils.d.ts +1 -0
  57. package/dist/entry/content/adapters/vanilla/utils.js +7 -0
  58. package/dist/entry/content/adapters/vanilla/utils.js.map +1 -0
  59. package/dist/entry/content/lifecycle/Builder.d.ts +10 -4
  60. package/dist/entry/content/lifecycle/Builder.js +102 -60
  61. package/dist/entry/content/lifecycle/Builder.js.map +1 -1
  62. package/dist/entry/content/lifecycle/MountBuilder.d.ts +6 -3
  63. package/dist/entry/content/lifecycle/MountBuilder.js +32 -16
  64. package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -1
  65. package/dist/entry/content/lifecycle/context/ContainerRegistry.d.ts +7 -0
  66. package/dist/entry/content/lifecycle/context/ContainerRegistry.js +45 -0
  67. package/dist/entry/content/lifecycle/context/ContainerRegistry.js.map +1 -0
  68. package/dist/entry/content/lifecycle/context/Context.d.ts +6 -3
  69. package/dist/entry/content/lifecycle/context/Context.js +21 -6
  70. package/dist/entry/content/lifecycle/context/Context.js.map +1 -1
  71. package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +4 -1
  72. package/dist/entry/content/lifecycle/context/ManagedContext.js +7 -0
  73. package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -1
  74. package/dist/entry/content/lifecycle/context/index.d.ts +1 -0
  75. package/dist/entry/content/lifecycle/context/index.js +6 -4
  76. package/dist/entry/content/lifecycle/context/index.js.map +1 -1
  77. package/dist/entry/content/lifecycle/markers/AttributeMarker.js +3 -1
  78. package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -1
  79. package/dist/entry/content/lifecycle/nodes/EventNode.d.ts +4 -2
  80. package/dist/entry/content/lifecycle/nodes/EventNode.js +7 -2
  81. package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -1
  82. package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +2 -1
  83. package/dist/entry/content/lifecycle/nodes/FrameNode.js +3 -0
  84. package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -1
  85. package/dist/entry/content/lifecycle/nodes/MarkerNode.d.ts +1 -1
  86. package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -1
  87. package/dist/entry/content/lifecycle/nodes/MountNode.d.ts +7 -3
  88. package/dist/entry/content/lifecycle/nodes/MountNode.js +47 -12
  89. package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -1
  90. package/dist/entry/content/lifecycle/nodes/Node.d.ts +1 -1
  91. package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -1
  92. package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +13 -4
  93. package/dist/entry/content/lifecycle/nodes/RenderNode.js +71 -6
  94. package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -1
  95. package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +2 -1
  96. package/dist/entry/content/lifecycle/nodes/ShadowNode.js +3 -0
  97. package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -1
  98. package/dist/entry/content/lifecycle/types.d.ts +28 -0
  99. package/dist/entry/content/resolvers/watch.d.ts +1 -1
  100. package/dist/entry/content/resolvers/watch.js +29 -14
  101. package/dist/entry/content/resolvers/watch.js.map +1 -1
  102. package/dist/entry/relay/index.js.map +1 -1
  103. package/dist/shared/locale/index.d.ts +1 -1
  104. package/dist/shared/locale/index.js +3 -1
  105. package/dist/shared/locale/index.js.map +1 -1
  106. package/dist/shared/locale/messages.d.ts +4 -0
  107. package/dist/shared/locale/messages.js +12 -0
  108. package/dist/shared/locale/messages.js.map +1 -1
  109. package/dist/types/content/common.d.ts +8 -0
  110. package/dist/types/content/common.js.map +1 -1
  111. package/dist/types/content/definition.d.ts +5 -0
  112. package/dist/types/locale.d.ts +3 -0
  113. package/dist/types/locale.js.map +1 -1
  114. package/package.json +1 -3
  115. package/types/client.d.ts +3 -3
  116. package/dist/cli/plugins/style/types.d.ts +0 -5
  117. package/dist/entry/content/adapters/react/resolvers/definition.d.ts +0 -2
  118. package/dist/entry/content/adapters/react/resolvers/definition.js.map +0 -1
  119. package/dist/entry/content/adapters/react/resolvers/render.d.ts +0 -2
  120. package/dist/entry/content/adapters/react/resolvers/render.js +0 -9
  121. package/dist/entry/content/adapters/react/resolvers/render.js.map +0 -1
  122. package/dist/entry/content/adapters/vanilla/resolvers/definition.d.ts +0 -2
  123. package/dist/entry/content/adapters/vanilla/resolvers/definition.js.map +0 -1
  124. package/dist/entry/content/adapters/vanilla/resolvers/render.d.ts +0 -3
  125. package/dist/entry/content/adapters/vanilla/resolvers/render.js +0 -15
  126. package/dist/entry/content/adapters/vanilla/resolvers/render.js.map +0 -1
  127. /package/dist/{cli/plugins/style → entry/content/lifecycle}/types.js +0 -0
  128. /package/dist/{cli/plugins/style → entry/content/lifecycle}/types.js.map +0 -0
@@ -1,5 +1,5 @@
1
1
  import type { ContentScriptWorld } from "../../types/content/index.js";
2
- export declare const IsolatedStylesLayer = "adnbn:css:isolation";
3
- /** Shared build identity for content and Relay modules, independent of their UI isolation. */
2
+ export declare const DefaultStylesLayer = "adnbn:css:default";
3
+ export declare const DocumentStylesLayer = "adnbn:css:document";
4
+ /** JavaScript identity depends on the execution world, never on CSS delivery. */
4
5
  export declare const getContentLayer: (world: ContentScriptWorld) => string;
5
- export declare const isContentLayer: (layer: string) => boolean;
@@ -1,12 +1,11 @@
1
- const ContentLayerPrefix = "adnbn:content:";
2
- const IsolatedStylesLayer = "adnbn:css:isolation";
1
+ const DefaultStylesLayer = "adnbn:css:default";
2
+ const DocumentStylesLayer = "adnbn:css:document";
3
3
  const getContentLayer = (world) => {
4
- return `${ContentLayerPrefix}${world.toLowerCase()}`;
4
+ return `adnbn:content:${world.toLowerCase()}`;
5
5
  };
6
- const isContentLayer = (layer) => layer.startsWith(ContentLayerPrefix);
7
6
  export {
8
- IsolatedStylesLayer,
9
- getContentLayer,
10
- isContentLayer
7
+ DefaultStylesLayer,
8
+ DocumentStylesLayer,
9
+ getContentLayer
11
10
  };
12
11
  //# sourceMappingURL=layers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/bundler/layers.ts"],"sourcesContent":["import type {ContentScriptWorld} from \"@typing/content\";\n\nconst ContentLayerPrefix = \"adnbn:content:\";\n\n// This is a bundler layer, not a CSS @layer. A distinct css-loader identity is\n// also required: CssExtract deduplicates dependencies by their loader request.\nexport const IsolatedStylesLayer = \"adnbn:css:isolation\";\n\n/** Shared build identity for content and Relay modules, independent of their UI isolation. */\nexport const getContentLayer = (world: ContentScriptWorld): string => {\n return `${ContentLayerPrefix}${world.toLowerCase()}`;\n};\n\nexport const isContentLayer = (layer: string): boolean => layer.startsWith(ContentLayerPrefix);\n"],"mappings":"AAEA,MAAM,qBAAqB;AAIpB,MAAM,sBAAsB;AAG5B,MAAM,kBAAkB,CAAC,UAAsC;AAClE,SAAO,GAAG,kBAAkB,GAAG,MAAM,YAAY,CAAC;AACtD;AAEO,MAAM,iBAAiB,CAAC,UAA2B,MAAM,WAAW,kBAAkB;","names":[]}
1
+ {"version":3,"sources":["../../../src/cli/bundler/layers.ts"],"sourcesContent":["import type {ContentScriptWorld} from \"@typing/content\";\n\n// CSS classification is independent of the importing JavaScript module's layer.\n// Default styles follow each entry's delivery policy; ?unisolated always targets the document.\nexport const DefaultStylesLayer = \"adnbn:css:default\";\nexport const DocumentStylesLayer = \"adnbn:css:document\";\n\n/** JavaScript identity depends on the execution world, never on CSS delivery. */\nexport const getContentLayer = (world: ContentScriptWorld): string => {\n return `adnbn:content:${world.toLowerCase()}`;\n};\n"],"mappings":"AAIO,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAG5B,MAAM,kBAAkB,CAAC,UAAsC;AAClE,SAAO,iBAAiB,MAAM,YAAY,CAAC;AAC/C;","names":[]}
@@ -2,6 +2,8 @@ import { Compilation, RuntimeGlobals, RuntimeModule, sources } from "@rspack/cor
2
2
  import stringify from "json-stringify-deterministic";
3
3
  import ts from "typescript";
4
4
  import { collectBuildAssets } from "./../../../../cli/bundler/utils/assets.js";
5
+ import { normalizeAssets, normalizeAssetsMap } from "./normalize.js";
6
+ import { renderBuildAssetsRuntime } from "./templates.js";
5
7
  import { setCompilationBuildAssets } from "../utils/index.js";
6
8
  import {
7
9
  CssContentHashType,
@@ -62,7 +64,9 @@ const chunkHasCss = (compilation, chunk) => {
62
64
  });
63
65
  };
64
66
  const chunkHasJavaScript = (compilation, chunk) => {
65
- if (chunk.hasRuntime()) return true;
67
+ if (chunk.hasRuntime()) {
68
+ return true;
69
+ }
66
70
  return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some((module) => {
67
71
  return module.type.startsWith("javascript");
68
72
  });
@@ -94,7 +98,7 @@ const getEntrypointRuntimeAssets = (compilation, name, cssFilename, cssChunkFile
94
98
  return resolveChunkFilename(
95
99
  compilation,
96
100
  chunk,
97
- chunk === entryChunk ? cssFilename : cssChunkFilename,
101
+ chunk.canBeInitial() ? cssFilename : cssChunkFilename,
98
102
  CssContentHashType
99
103
  );
100
104
  })
@@ -132,7 +136,7 @@ const entrypointRuntimeUsesFullHash = (compilation, name, cssFilename, cssChunkF
132
136
  const css = chunkHasCss(compilation, chunk) && filenameRequiresFullHash(
133
137
  compilation,
134
138
  chunk,
135
- chunk === entryChunk ? cssFilename : cssChunkFilename,
139
+ chunk.canBeInitial() ? cssFilename : cssChunkFilename,
136
140
  CssContentHashType
137
141
  );
138
142
  return js || css;
@@ -209,7 +213,9 @@ const collectRuntimeModuleFingerprints = (compilation) => {
209
213
  };
210
214
  const updateBuildAssetsChunkHashes = (compilation, options, runtimeModuleFingerprints, runtimes) => {
211
215
  compilation.hooks.chunkHash.tap(PluginName, (chunk, hash) => {
212
- if (!runtimes.has(chunk)) return;
216
+ if (!runtimes.has(chunk)) {
217
+ return;
218
+ }
213
219
  const runtimeEntry = Array.from(compilation.entrypoints).find(([, entrypoint]) => {
214
220
  return entrypoint.getRuntimeChunk() === chunk;
215
221
  });
@@ -249,7 +255,7 @@ const updateBuildAssetsChunkHashes = (compilation, options, runtimeModuleFingerp
249
255
  hash.update(`javascript-template:${template}`, "utf8");
250
256
  }
251
257
  if (chunkHasCss(compilation, referencedChunk)) {
252
- const cssFilename = referencedChunk === entryChunk ? options.cssFilename : options.cssChunkFilename;
258
+ const cssFilename = referencedChunk.canBeInitial() ? options.cssFilename : options.cssChunkFilename;
253
259
  const template = resolveFilenameTemplate(
254
260
  compilation,
255
261
  referencedChunk,
@@ -297,7 +303,13 @@ class BuildAssetsRuntimeModule extends RuntimeModule {
297
303
  generate() {
298
304
  const runtime = RuntimeGlobals.require;
299
305
  if (this.fullMap) {
300
- return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(FullMapPlaceholder)}).${FullMapEnvelopeKey};`;
306
+ return renderBuildAssetsRuntime({
307
+ require: runtime,
308
+ property: this.property,
309
+ value: FullMapPlaceholder,
310
+ envelope: FullMapEnvelopeKey,
311
+ full: true
312
+ });
301
313
  }
302
314
  const compilation = this.compilation;
303
315
  if (!compilation) {
@@ -310,7 +322,13 @@ class BuildAssetsRuntimeModule extends RuntimeModule {
310
322
  this.cssChunkFilename
311
323
  );
312
324
  const envelope = JSON.stringify({ [CurrentMapEnvelopeKey]: current });
313
- return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(envelope)}).${CurrentMapEnvelopeKey};`;
325
+ return renderBuildAssetsRuntime({
326
+ require: runtime,
327
+ property: this.property,
328
+ value: envelope,
329
+ envelope: CurrentMapEnvelopeKey,
330
+ full: false
331
+ });
314
332
  }
315
333
  }
316
334
  const replaceFullMapPlaceholder = (compilation, runtimeFiles, assets) => {
@@ -375,7 +393,7 @@ const validateEmbeddedMap = (compilation, fullMap, assets) => {
375
393
  );
376
394
  }
377
395
  const embedded = extractEmbeddedMap(runtime.file, runtime.source);
378
- if (stringify(embedded) !== stringify(assets)) {
396
+ if (stringify(normalizeAssetsMap(embedded)) !== stringify(assets)) {
379
397
  throw new Error(
380
398
  "Build assets changed after the runtime map was embedded; finalize entrypoint assets before processAssets begins"
381
399
  );
@@ -390,7 +408,9 @@ const validateCurrentEntrypointMaps = (compilation, assets, fullMapEntrypoint, r
390
408
  if (!entrypoint) {
391
409
  throw new Error(`Build assets entrypoint "${name}" is unavailable`);
392
410
  }
393
- if (!runtimes.has(entrypoint.getRuntimeChunk())) continue;
411
+ if (!runtimes.has(entrypoint.getRuntimeChunk())) {
412
+ continue;
413
+ }
394
414
  const runtimeFiles = new Set(Array.from(entrypoint.getRuntimeChunk().files, toPosix));
395
415
  const runtime = entrypointAssets.initial.js.filter((file) => runtimeFiles.has(file)).map((file) => {
396
416
  var _a;
@@ -408,7 +428,7 @@ const validateCurrentEntrypointMaps = (compilation, assets, fullMapEntrypoint, r
408
428
  initial: entrypointAssets.initial,
409
429
  async: entrypointAssets.async
410
430
  };
411
- if (stringify(runtimeAssets) !== stringify(finalizedAssets)) {
431
+ if (stringify(normalizeAssets(runtimeAssets)) !== stringify(finalizedAssets)) {
412
432
  throw new Error(
413
433
  `Build assets changed after the runtime map for entrypoint "${name}" was embedded: ${JSON.stringify({ embedded: runtimeAssets, finalized: finalizedAssets })}`
414
434
  );
@@ -450,9 +470,13 @@ class BuildAssetsMapPlugin {
450
470
  const runtime = entrypoint.getRuntimeChunk();
451
471
  const fullMap = name === this.options.fullMapEntrypoint;
452
472
  const delivery = fullMap ? this.options.module.full : this.options.module.current;
453
- if (!isUsed(runtime, delivery.export)) continue;
473
+ if (!isUsed(runtime, delivery.export)) {
474
+ continue;
475
+ }
454
476
  validateEntrypointRuntime(compilation, name);
455
- if (fullMap) validateFullMapEntrypoint(compilation, name);
477
+ if (fullMap) {
478
+ validateFullMapEntrypoint(compilation, name);
479
+ }
456
480
  selectedRuntimes.set(runtime, { name, fullMap, property: delivery.property });
457
481
  }
458
482
  }
@@ -461,7 +485,9 @@ class BuildAssetsMapPlugin {
461
485
  filenamesValidated = true;
462
486
  }
463
487
  const selection = selectedRuntimes.get(chunk);
464
- if (!selection || injectedRuntimes.has(chunk)) return;
488
+ if (!selection || injectedRuntimes.has(chunk)) {
489
+ return;
490
+ }
465
491
  requirements.add(RuntimeGlobals.require);
466
492
  injectedRuntimes.add(chunk);
467
493
  compilation.addRuntimeModule(
@@ -511,7 +537,9 @@ class BuildAssetsMapPlugin {
511
537
  { name: `${PluginName}:finalValidation`, stage: FinalValidationStage },
512
538
  (compilation) => {
513
539
  const runtimes = runtimeSelections.get(compilation);
514
- if (runtimes) finalizeBuildAssets(compilation, this.options, runtimes);
540
+ if (runtimes) {
541
+ finalizeBuildAssets(compilation, this.options, runtimes);
542
+ }
515
543
  }
516
544
  );
517
545
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.ts"],"sourcesContent":["import {Chunk, Compilation, Compiler, Filename, RuntimeGlobals, RuntimeModule, sources} from \"@rspack/core\";\nimport stringify from \"json-stringify-deterministic\";\nimport ts from \"typescript\";\n\nimport {collectBuildAssets} from \"@cli/bundler/utils/assets\";\nimport {setCompilationBuildAssets} from \"../utils\";\nimport {\n CssContentHashType,\n JavaScriptContentHashType,\n resolveChunkFilename,\n resolveFilenameTemplate,\n filenameRequiresFullHash,\n} from \"@cli/bundler/utils/chunk-filename\";\nimport {toPosix} from \"@cli/utils/path\";\n\nimport type {EntrypointAssetsMap, EntrypointAssets} from \"@typing/entrypoint\";\n\nimport {trackModuleUsage, type BuildAssetsMapPluginModuleOptions} from \"./usage\";\n\nconst PluginName = \"BuildAssetsMapPlugin\";\n// Replaced with the full map once Rspack has resolved the output filenames.\nconst FullMapPlaceholder = \"__ADNBN_BUILD_ASSETS_FULL_MAP_PLACEHOLDER__\";\n// These JSON envelope keys let final validation locate each map after minification.\nconst FullMapEnvelopeKey = \"__adnbnBuildAssetsFullMap__\";\nconst CurrentMapEnvelopeKey = \"__adnbnBuildAssetsCurrentMap__\";\n// Hash-based output names are fixed when processAssets starts, so the asset graph is frozen here.\nconst EmbedStage = Number.NEGATIVE_INFINITY;\nconst FinalValidationStage = Infinity;\n\ninterface FullMapRuntime {\n readonly name: string;\n readonly runtime: Chunk;\n}\n\ninterface RuntimeSelection {\n readonly name: string;\n readonly fullMap: boolean;\n readonly property: string;\n}\n\nexport interface BuildAssetsMapPluginOptions {\n readonly module: BuildAssetsMapPluginModuleOptions;\n readonly buildHashSalt?: string;\n readonly cssChunkFilename: Filename;\n readonly cssFilename: Filename;\n readonly fullMapEntrypoint: string;\n}\n\ntype RuntimeModuleFingerprints = Map<Chunk, Map<string, string>>;\n\nconst validateAsyncChunkFilenames = (compilation: Compilation, cssChunkFilename: Filename): void => {\n const asyncChunks = new Set(\n Array.from(compilation.entrypoints.values()).flatMap(entrypoint => {\n return Array.from(entrypoint.getEntrypointChunk().getAllAsyncChunks());\n })\n );\n const validate = (\n filename: Filename,\n chunks: Iterable<Chunk>,\n contentHashType: string,\n assetType: \"CSS\" | \"JavaScript\",\n configName: \"cssFilename\" | \"jsFilename\"\n ): void => {\n if (typeof filename !== \"function\") {\n return;\n }\n\n const returnsFullHash = Array.from(chunks).some(chunk => {\n const template = resolveFilenameTemplate(compilation, chunk, filename, contentHashType);\n\n return /\\[(?:fullhash|hash)(?::\\d+)?\\]/i.test(template);\n });\n\n if (returnsFullHash) {\n const target = assetType === \"JavaScript\" ? \"async chunk URLs\" : \"async CSS chunk URLs\";\n\n throw new Error(\n `Rspack cannot generate ${target} when a filename callback returns [fullhash]; configure ${configName} as a string template instead`\n );\n }\n };\n\n if (compilation.outputOptions.chunkFilename) {\n validate(\n compilation.outputOptions.chunkFilename,\n asyncChunks,\n JavaScriptContentHashType,\n \"JavaScript\",\n \"jsFilename\"\n );\n }\n validate(\n cssChunkFilename,\n Array.from(asyncChunks).filter(chunk => chunkHasCss(compilation, chunk)),\n CssContentHashType,\n \"CSS\",\n \"cssFilename\"\n );\n};\n\nconst chunkHasCss = (compilation: Compilation, chunk: Chunk): boolean => {\n return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some(module => {\n return module.type === CssContentHashType;\n });\n};\n\nconst chunkHasJavaScript = (compilation: Compilation, chunk: Chunk): boolean => {\n // splitChunks can move every user module out of an entry, but its bootstrap\n // still emits a JavaScript file and remains an initial dependency.\n if (chunk.hasRuntime()) return true;\n return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some(module => {\n return module.type.startsWith(\"javascript\");\n });\n};\n\nconst getEntrypointRuntimeAssets = (\n compilation: Compilation,\n name: string,\n cssFilename: Filename,\n cssChunkFilename: Filename\n): EntrypointAssets => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n throw new Error(`Build assets entrypoint \"${name}\" is unavailable`);\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n const jsFilename = compilation.outputOptions.filename;\n const jsChunkFilename = compilation.outputOptions.chunkFilename;\n\n if (!jsFilename || !jsChunkFilename) {\n throw new Error(\"Build assets require output.filename and output.chunkFilename\");\n }\n\n return {\n initial: {\n js: initialChunks\n .filter(chunk => chunkHasJavaScript(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(\n compilation,\n chunk,\n chunk === entryChunk ? jsFilename : jsChunkFilename,\n JavaScriptContentHashType\n );\n }),\n css: initialChunks\n .filter(chunk => chunkHasCss(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(\n compilation,\n chunk,\n chunk === entryChunk ? cssFilename : cssChunkFilename,\n CssContentHashType\n );\n }),\n },\n async: {\n js: asyncChunks\n .filter(chunk => chunkHasJavaScript(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);\n }),\n css: asyncChunks\n .filter(chunk => chunkHasCss(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(compilation, chunk, cssChunkFilename, CssContentHashType);\n }),\n },\n };\n};\n\nconst entrypointRuntimeUsesFullHash = (\n compilation: Compilation,\n name: string,\n cssFilename: Filename,\n cssChunkFilename: Filename\n): boolean => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n return false;\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n const jsFilename = compilation.outputOptions.filename;\n const jsChunkFilename = compilation.outputOptions.chunkFilename;\n\n if (!jsFilename || !jsChunkFilename) {\n return false;\n }\n\n return (\n initialChunks.some(chunk => {\n const js = filenameRequiresFullHash(\n compilation,\n chunk,\n chunk === entryChunk ? jsFilename : jsChunkFilename,\n JavaScriptContentHashType\n );\n const css =\n chunkHasCss(compilation, chunk) &&\n filenameRequiresFullHash(\n compilation,\n chunk,\n chunk === entryChunk ? cssFilename : cssChunkFilename,\n CssContentHashType\n );\n\n return js || css;\n }) ||\n asyncChunks.some(chunk => {\n const js = filenameRequiresFullHash(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);\n const css =\n chunkHasCss(compilation, chunk) &&\n filenameRequiresFullHash(compilation, chunk, cssChunkFilename, CssContentHashType);\n\n return js || css;\n })\n );\n};\n\nconst getChunkKey = (chunk: Chunk): string => {\n return `${String(chunk.name ?? \"\")}:${String(chunk.id ?? \"\")}`;\n};\n\nconst getFullMapRuntime = (\n compilation: Compilation,\n name: string,\n runtimes: ReadonlySet<Chunk>\n): FullMapRuntime | undefined => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint || !runtimes.has(entrypoint.getRuntimeChunk())) {\n return;\n }\n\n return {name, runtime: entrypoint.getRuntimeChunk()};\n};\n\nconst getFullMapRuntimeFiles = (fullMap: FullMapRuntime, assets: EntrypointAssetsMap): readonly string[] => {\n const runtimeFiles = new Set(Array.from(fullMap.runtime.files, toPosix));\n\n return assets[fullMap.name].initial.js.filter(file => runtimeFiles.has(file));\n};\n\nconst validateEntrypointRuntime = (compilation: Compilation, name: string): void => {\n const entrypoint = compilation.entrypoints.get(name)!;\n if (entrypoint.getRuntimeChunk() !== entrypoint.getEntrypointChunk()) {\n throw new Error(\n `Build assets require a self-contained runtime for entrypoint \"${name}\"; disable optimization.runtimeChunk`\n );\n }\n};\n\nconst validateFullMapEntrypoint = (compilation: Compilation, name: string): void => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n return;\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n\n if (initialChunks.length !== 1 || initialChunks[0] !== entryChunk || asyncChunks.length > 0) {\n throw new Error(\n `Full build-assets entrypoint \"${name}\" must be a single self-contained chunk; async chunks are not supported`\n );\n }\n};\n\nconst validateFullMapAssets = (assets: EntrypointAssetsMap, name: string): void => {\n const entrypoint = assets[name];\n\n if (!entrypoint) {\n return;\n }\n\n if (entrypoint.initial.js.length !== 1 || entrypoint.async.js.length > 0) {\n throw new Error(\n `Full build-assets entrypoint \"${name}\" must emit exactly one initial JavaScript file and no async JavaScript files`\n );\n }\n};\n\nconst serializeFilename = (filename: unknown): string => {\n return typeof filename === \"function\" ? filename.toString() : JSON.stringify(filename);\n};\n\nconst collectRuntimeModuleFingerprints = (compilation: Compilation): RuntimeModuleFingerprints => {\n const fingerprints: RuntimeModuleFingerprints = new Map();\n\n compilation.hooks.runtimeModule.tap(PluginName, (runtimeModule, chunk) => {\n if (runtimeModule.identifier().startsWith(\"webpack/runtime/build assets \")) {\n return;\n }\n\n let chunkFingerprints = fingerprints.get(chunk);\n\n if (!chunkFingerprints) {\n chunkFingerprints = new Map();\n fingerprints.set(chunk, chunkFingerprints);\n }\n\n chunkFingerprints.set(`${runtimeModule.stage}:${runtimeModule.identifier()}`, runtimeModule.generate());\n });\n\n return fingerprints;\n};\n\nconst updateBuildAssetsChunkHashes = (\n compilation: Compilation,\n options: Required<BuildAssetsMapPluginOptions>,\n runtimeModuleFingerprints: RuntimeModuleFingerprints,\n runtimes: ReadonlySet<Chunk>\n): void => {\n compilation.hooks.chunkHash.tap(PluginName, (chunk, hash) => {\n if (!runtimes.has(chunk)) return;\n const runtimeEntry = Array.from(compilation.entrypoints).find(([, entrypoint]) => {\n return entrypoint.getRuntimeChunk() === chunk;\n });\n\n if (!runtimeEntry) {\n return;\n }\n\n const [runtimeName] = runtimeEntry;\n const fullMap = runtimeName === options.fullMapEntrypoint;\n const entries = fullMap\n ? Array.from(compilation.entrypoints).toSorted(([left], [right]) => left.localeCompare(right))\n : [runtimeEntry];\n\n hash.update(`${PluginName}:runtime-map:${runtimeName}`, \"utf8\");\n hash.update(options.buildHashSalt, \"utf8\");\n hash.update(serializeFilename(compilation.outputOptions.filename), \"utf8\");\n hash.update(serializeFilename(compilation.outputOptions.chunkFilename), \"utf8\");\n hash.update(serializeFilename(options.cssFilename), \"utf8\");\n hash.update(serializeFilename(options.cssChunkFilename), \"utf8\");\n\n if (fullMap) {\n hash.update(serializeFilename(compilation.outputOptions.assetModuleFilename), \"utf8\");\n }\n\n for (const [entryName, entrypoint] of entries) {\n hash.update(entryName, \"utf8\");\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = new Set(entrypoint.chunks);\n const chunks = Array.from(entryChunk.getAllReferencedChunks()).toSorted((left, right) =>\n getChunkKey(left).localeCompare(getChunkKey(right))\n );\n\n for (const referencedChunk of chunks) {\n const category = initialChunks.has(referencedChunk) ? \"initial\" : \"async\";\n\n hash.update(`${category}:${getChunkKey(referencedChunk)}`, \"utf8\");\n\n const jsFilename =\n referencedChunk === entryChunk\n ? compilation.outputOptions.filename\n : compilation.outputOptions.chunkFilename;\n\n if (jsFilename) {\n const template = resolveFilenameTemplate(\n compilation,\n referencedChunk,\n jsFilename,\n JavaScriptContentHashType\n );\n\n hash.update(`javascript-template:${template}`, \"utf8\");\n }\n\n if (chunkHasCss(compilation, referencedChunk)) {\n const cssFilename = referencedChunk === entryChunk ? options.cssFilename : options.cssChunkFilename;\n const template = resolveFilenameTemplate(\n compilation,\n referencedChunk,\n cssFilename,\n CssContentHashType\n );\n\n hash.update(`css-template:${template}`, \"utf8\");\n }\n\n const moduleHashes = Array.from(\n compilation.chunkGraph.getChunkModulesIterable(referencedChunk),\n module => {\n return compilation.chunkGraph.getModuleHash(module, new Set(referencedChunk.runtime)) ?? \"\";\n }\n ).toSorted();\n\n moduleHashes.forEach(moduleHash => hash.update(moduleHash, \"utf8\"));\n\n const runtimeFingerprints = runtimeModuleFingerprints.get(referencedChunk);\n\n if (runtimeFingerprints) {\n Array.from(runtimeFingerprints)\n .toSorted(([left], [right]) => left.localeCompare(right))\n .forEach(([identifier, source]) => {\n hash.update(`runtime-module:${identifier}`, \"utf8\");\n hash.update(source, \"utf8\");\n });\n }\n }\n }\n });\n};\n\nclass BuildAssetsRuntimeModule extends RuntimeModule {\n public constructor(\n private readonly fullMap: boolean,\n private readonly runtimeName: string,\n private readonly property: string,\n private readonly cssFilename: Filename,\n private readonly cssChunkFilename: Filename,\n fullHash: boolean\n ) {\n super(`build assets ${fullMap ? \"full\" : \"current\"} ${runtimeName}`, RuntimeModule.STAGE_TRIGGER);\n\n if (!fullMap) {\n this.dependentHash = true;\n this.fullHash = fullHash;\n }\n }\n\n public generate(): string {\n const runtime = RuntimeGlobals.require;\n\n if (this.fullMap) {\n return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(FullMapPlaceholder)}).${FullMapEnvelopeKey};`;\n }\n\n const compilation = this.compilation;\n\n if (!compilation) {\n throw new Error(\"Build assets runtime is not attached to a compilation\");\n }\n\n const current = getEntrypointRuntimeAssets(\n compilation,\n this.runtimeName,\n this.cssFilename,\n this.cssChunkFilename\n );\n\n const envelope = JSON.stringify({[CurrentMapEnvelopeKey]: current});\n\n return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(envelope)}).${CurrentMapEnvelopeKey};`;\n }\n}\n\nconst replaceFullMapPlaceholder = (\n compilation: Compilation,\n runtimeFiles: readonly string[],\n assets: EntrypointAssetsMap\n): void => {\n const placeholder = JSON.stringify(FullMapPlaceholder);\n const replacementValue = JSON.stringify(JSON.stringify({[FullMapEnvelopeKey]: assets}));\n let replacements = 0;\n\n for (const file of runtimeFiles) {\n const asset = compilation.getAsset(file);\n\n if (!asset) {\n continue;\n }\n\n const code = asset.source.source().toString();\n const start = code.indexOf(placeholder);\n\n if (start < 0) {\n continue;\n }\n\n if (code.indexOf(placeholder, start + placeholder.length) >= 0) {\n throw new Error(`Build assets placeholder occurs more than once in \"${file}\"`);\n }\n\n const source = new sources.ReplaceSource(asset.source);\n\n source.replace(start, start + placeholder.length - 1, replacementValue);\n compilation.updateAsset(file, source);\n replacements += 1;\n }\n\n if (replacements !== 1) {\n throw new Error(`Expected one full build-assets runtime, found ${replacements}`);\n }\n};\n\nconst extractEmbeddedEnvelope = <T>(file: string, source: string, key: string): T => {\n const sourceFile = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);\n const values: T[] = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isStringLiteralLike(node) && node.text.includes(key)) {\n try {\n const envelope = JSON.parse(node.text) as Record<string, T>;\n\n if (Object.prototype.hasOwnProperty.call(envelope, key)) {\n values.push(envelope[key]);\n }\n } catch {}\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n if (values.length !== 1) {\n throw new Error(`Expected one embedded build assets value in \"${file}\", found ${values.length}`);\n }\n\n return values[0];\n};\n\nconst extractEmbeddedMap = (file: string, source: string): EntrypointAssetsMap => {\n return extractEmbeddedEnvelope<EntrypointAssetsMap>(file, source, FullMapEnvelopeKey);\n};\n\nconst validateEmbeddedMap = (compilation: Compilation, fullMap: FullMapRuntime, assets: EntrypointAssetsMap): void => {\n const runtimeFiles = getFullMapRuntimeFiles(fullMap, assets);\n const runtime = runtimeFiles\n .map(file => ({file, source: compilation.getAsset(file)?.source.source().toString() ?? \"\"}))\n .find(({source}) => source.length > 0);\n\n if (!runtime) {\n throw new Error(\n `Full build-assets runtime for entrypoint \"${fullMap.name}\" is unavailable after asset processing`\n );\n }\n\n const embedded = extractEmbeddedMap(runtime.file, runtime.source);\n\n if (stringify(embedded) !== stringify(assets)) {\n throw new Error(\n \"Build assets changed after the runtime map was embedded; finalize entrypoint assets before processAssets begins\"\n );\n }\n};\n\nconst validateCurrentEntrypointMaps = (\n compilation: Compilation,\n assets: EntrypointAssetsMap,\n fullMapEntrypoint: string,\n runtimes: ReadonlySet<Chunk>\n): void => {\n for (const [name, entrypointAssets] of Object.entries(assets)) {\n if (name === fullMapEntrypoint) {\n continue;\n }\n\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n throw new Error(`Build assets entrypoint \"${name}\" is unavailable`);\n }\n\n if (!runtimes.has(entrypoint.getRuntimeChunk())) continue;\n\n const runtimeFiles = new Set(Array.from(entrypoint.getRuntimeChunk().files, toPosix));\n const runtime = entrypointAssets.initial.js\n .filter(file => runtimeFiles.has(file))\n .map(file => ({file, source: compilation.getAsset(file)?.source.source().toString() ?? \"\"}))\n .find(({source}) => source.length > 0);\n\n if (!runtime) {\n throw new Error(`Runtime map for entrypoint \"${name}\" is unavailable after asset processing`);\n }\n\n const runtimeAssets = extractEmbeddedEnvelope<EntrypointAssets>(\n runtime.file,\n runtime.source,\n CurrentMapEnvelopeKey\n );\n const finalizedAssets: EntrypointAssets = {\n initial: entrypointAssets.initial,\n async: entrypointAssets.async,\n };\n\n if (stringify(runtimeAssets) !== stringify(finalizedAssets)) {\n throw new Error(\n `Build assets changed after the runtime map for entrypoint \"${name}\" was embedded: ${JSON.stringify({embedded: runtimeAssets, finalized: finalizedAssets})}`\n );\n }\n }\n};\n\nconst finalizeBuildAssets = (\n compilation: Compilation,\n options: Required<BuildAssetsMapPluginOptions>,\n runtimes: ReadonlySet<Chunk>\n): void => {\n const assets = collectBuildAssets(compilation);\n const fullMap = getFullMapRuntime(compilation, options.fullMapEntrypoint, runtimes);\n\n if (fullMap) {\n validateFullMapAssets(assets, options.fullMapEntrypoint);\n validateEmbeddedMap(compilation, fullMap, assets);\n }\n\n validateCurrentEntrypointMaps(compilation, assets, options.fullMapEntrypoint, runtimes);\n\n setCompilationBuildAssets(compilation, assets);\n};\n\nexport default class BuildAssetsMapPlugin {\n private readonly options: Required<BuildAssetsMapPluginOptions>;\n\n public constructor(options: BuildAssetsMapPluginOptions) {\n this.options = {\n ...options,\n buildHashSalt: options.buildHashSalt ?? \"\",\n };\n }\n\n public apply(compiler: Compiler): void {\n const runtimeSelections = new WeakMap<Compilation, ReadonlySet<Chunk>>();\n\n compiler.hooks.thisCompilation.tap({name: PluginName, stage: EmbedStage}, compilation => {\n const injectedRuntimes = new Set<Chunk>();\n runtimeSelections.set(compilation, injectedRuntimes);\n let filenamesValidated = false;\n let selectedRuntimes: Map<Chunk, RuntimeSelection> | undefined;\n const runtimeModuleFingerprints = collectRuntimeModuleFingerprints(compilation);\n const isUsed = trackModuleUsage(compiler, compilation, this.options.module);\n\n updateBuildAssetsChunkHashes(compilation, this.options, runtimeModuleFingerprints, injectedRuntimes);\n\n compilation.hooks.additionalTreeRuntimeRequirements.tap(PluginName, (chunk, requirements) => {\n if (!selectedRuntimes) {\n selectedRuntimes = new Map();\n // Select and validate in entrypoint order, independently of runtime hook order.\n for (const [name, entrypoint] of compilation.entrypoints) {\n const runtime = entrypoint.getRuntimeChunk();\n const fullMap = name === this.options.fullMapEntrypoint;\n const delivery = fullMap ? this.options.module.full : this.options.module.current;\n if (!isUsed(runtime, delivery.export)) continue;\n\n validateEntrypointRuntime(compilation, name);\n if (fullMap) validateFullMapEntrypoint(compilation, name);\n selectedRuntimes.set(runtime, {name, fullMap, property: delivery.property});\n }\n }\n\n if (!filenamesValidated) {\n validateAsyncChunkFilenames(compilation, this.options.cssChunkFilename);\n filenamesValidated = true;\n }\n\n const selection = selectedRuntimes.get(chunk);\n if (!selection || injectedRuntimes.has(chunk)) return;\n\n requirements.add(RuntimeGlobals.require);\n injectedRuntimes.add(chunk);\n compilation.addRuntimeModule(\n chunk,\n new BuildAssetsRuntimeModule(\n selection.fullMap,\n selection.name,\n selection.property,\n this.options.cssFilename,\n this.options.cssChunkFilename,\n entrypointRuntimeUsesFullHash(\n compilation,\n selection.name,\n this.options.cssFilename,\n this.options.cssChunkFilename\n )\n )\n );\n });\n\n compilation.hooks.processAssets.tap(\n {\n name: PluginName,\n stage: EmbedStage,\n },\n () => {\n const assets = collectBuildAssets(compilation);\n const fullMap = getFullMapRuntime(compilation, this.options.fullMapEntrypoint, injectedRuntimes);\n setCompilationBuildAssets(compilation, assets);\n\n if (fullMap) {\n validateFullMapAssets(assets, this.options.fullMapEntrypoint);\n replaceFullMapPlaceholder(compilation, getFullMapRuntimeFiles(fullMap, assets), assets);\n }\n }\n );\n\n compilation.hooks.processAssets.tap(\n {\n name: `${PluginName}:finalize`,\n stage: Compilation.PROCESS_ASSETS_STAGE_ANALYSE,\n },\n () => finalizeBuildAssets(compilation, this.options, injectedRuntimes)\n );\n });\n\n // Register after every afterPlugins callback, then run after ordinary emit taps but before files are written.\n compiler.hooks.afterPlugins.intercept({\n name: `${PluginName}:registerFinalValidation`,\n done: () => {\n compiler.hooks.emit.tap(\n {name: `${PluginName}:finalValidation`, stage: FinalValidationStage},\n compilation => {\n const runtimes = runtimeSelections.get(compilation);\n if (runtimes) finalizeBuildAssets(compilation, this.options, runtimes);\n }\n );\n },\n });\n }\n}\n"],"mappings":"AAAA,SAAe,aAAiC,gBAAgB,eAAe,eAAc;AAC7F,OAAO,eAAe;AACtB,OAAO,QAAQ;AAEf,SAAQ,0BAAyB;AACjC,SAAQ,iCAAgC;AACxC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAQ,eAAc;AAItB,SAAQ,wBAA+D;AAEvE,MAAM,aAAa;AAEnB,MAAM,qBAAqB;AAE3B,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,aAAa,OAAO;AAC1B,MAAM,uBAAuB;AAuB7B,MAAM,8BAA8B,CAAC,aAA0B,qBAAqC;AAChG,QAAM,cAAc,IAAI;AAAA,IACpB,MAAM,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I;AAAA,cACA,UAAU;AAAA,cACV,KAAK,QAAQ;AAAA,cACb,KAAK,QAAQ;AAAA,YACjB;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAED,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM;AAAA,UACN,OAAO;AAAA,QACX;AAAA,QACA,MAAM;AACF,gBAAM,SAAS,mBAAmB,WAAW;AAC7C,gBAAM,UAAU,kBAAkB,aAAa,KAAK,QAAQ,mBAAmB,gBAAgB;AAC/F,oCAA0B,aAAa,MAAM;AAE7C,cAAI,SAAS;AACT,kCAAsB,QAAQ,KAAK,QAAQ,iBAAiB;AAC5D,sCAA0B,aAAa,uBAAuB,SAAS,MAAM,GAAG,MAAM;AAAA,UAC1F;AAAA,QACJ;AAAA,MACJ;AAEA,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM,GAAG,UAAU;AAAA,UACnB,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM,oBAAoB,aAAa,KAAK,SAAS,gBAAgB;AAAA,MACzE;AAAA,IACJ,CAAC;AAGD,aAAS,MAAM,aAAa,UAAU;AAAA,MAClC,MAAM,GAAG,UAAU;AAAA,MACnB,MAAM,MAAM;AACR,iBAAS,MAAM,KAAK;AAAA,UAChB,EAAC,MAAM,GAAG,UAAU,oBAAoB,OAAO,qBAAoB;AAAA,UACnE,iBAAe;AACX,kBAAM,WAAW,kBAAkB,IAAI,WAAW;AAClD,gBAAI,SAAU,qBAAoB,aAAa,KAAK,SAAS,QAAQ;AAAA,UACzE;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.ts"],"sourcesContent":["import {Chunk, Compilation, Compiler, Filename, RuntimeGlobals, RuntimeModule, sources} from \"@rspack/core\";\nimport stringify from \"json-stringify-deterministic\";\nimport ts from \"typescript\";\n\nimport {collectBuildAssets} from \"@cli/bundler/utils/assets\";\nimport {normalizeAssets, normalizeAssetsMap} from \"./normalize\";\nimport {renderBuildAssetsRuntime} from \"./templates\";\nimport {setCompilationBuildAssets} from \"../utils\";\n\nimport {\n CssContentHashType,\n JavaScriptContentHashType,\n resolveChunkFilename,\n resolveFilenameTemplate,\n filenameRequiresFullHash,\n} from \"@cli/bundler/utils/chunk-filename\";\n\nimport {toPosix} from \"@cli/utils/path\";\n\nimport type {EntrypointAssetsMap, EntrypointAssets} from \"@typing/entrypoint\";\n\nimport {trackModuleUsage, type BuildAssetsMapPluginModuleOptions} from \"./usage\";\n\nconst PluginName = \"BuildAssetsMapPlugin\";\n// Replaced with the full map once Rspack has resolved the output filenames.\nconst FullMapPlaceholder = \"__ADNBN_BUILD_ASSETS_FULL_MAP_PLACEHOLDER__\";\n// These JSON envelope keys let final validation locate each map after minification.\nconst FullMapEnvelopeKey = \"__adnbnBuildAssetsFullMap__\";\nconst CurrentMapEnvelopeKey = \"__adnbnBuildAssetsCurrentMap__\";\n// Hash-based output names are fixed when processAssets starts, so the asset graph is frozen here.\nconst EmbedStage = Number.NEGATIVE_INFINITY;\nconst FinalValidationStage = Infinity;\n\ninterface FullMapRuntime {\n readonly name: string;\n readonly runtime: Chunk;\n}\n\ninterface RuntimeSelection {\n readonly name: string;\n readonly fullMap: boolean;\n readonly property: string;\n}\n\nexport interface BuildAssetsMapPluginOptions {\n readonly module: BuildAssetsMapPluginModuleOptions;\n readonly buildHashSalt?: string;\n readonly cssChunkFilename: Filename;\n readonly cssFilename: Filename;\n readonly fullMapEntrypoint: string;\n}\n\ntype RuntimeModuleFingerprints = Map<Chunk, Map<string, string>>;\n\nconst validateAsyncChunkFilenames = (compilation: Compilation, cssChunkFilename: Filename): void => {\n const asyncChunks = new Set(\n Array.from(compilation.entrypoints.values()).flatMap(entrypoint => {\n return Array.from(entrypoint.getEntrypointChunk().getAllAsyncChunks());\n })\n );\n\n const validate = (\n filename: Filename,\n chunks: Iterable<Chunk>,\n contentHashType: string,\n assetType: \"CSS\" | \"JavaScript\",\n configName: \"cssFilename\" | \"jsFilename\"\n ): void => {\n if (typeof filename !== \"function\") {\n return;\n }\n\n const returnsFullHash = Array.from(chunks).some(chunk => {\n const template = resolveFilenameTemplate(compilation, chunk, filename, contentHashType);\n\n return /\\[(?:fullhash|hash)(?::\\d+)?\\]/i.test(template);\n });\n\n if (returnsFullHash) {\n const target = assetType === \"JavaScript\" ? \"async chunk URLs\" : \"async CSS chunk URLs\";\n\n throw new Error(\n `Rspack cannot generate ${target} when a filename callback returns [fullhash]; configure ${configName} as a string template instead`\n );\n }\n };\n\n if (compilation.outputOptions.chunkFilename) {\n validate(\n compilation.outputOptions.chunkFilename,\n asyncChunks,\n JavaScriptContentHashType,\n \"JavaScript\",\n \"jsFilename\"\n );\n }\n\n validate(\n cssChunkFilename,\n Array.from(asyncChunks).filter(chunk => chunkHasCss(compilation, chunk)),\n CssContentHashType,\n \"CSS\",\n \"cssFilename\"\n );\n};\n\nconst chunkHasCss = (compilation: Compilation, chunk: Chunk): boolean => {\n return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some(module => {\n return module.type === CssContentHashType;\n });\n};\n\nconst chunkHasJavaScript = (compilation: Compilation, chunk: Chunk): boolean => {\n // splitChunks can move every user module out of an entry, but its bootstrap\n // still emits a JavaScript file and remains an initial dependency.\n if (chunk.hasRuntime()) {\n return true;\n }\n\n return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some(module => {\n return module.type.startsWith(\"javascript\");\n });\n};\n\nconst getEntrypointRuntimeAssets = (\n compilation: Compilation,\n name: string,\n cssFilename: Filename,\n cssChunkFilename: Filename\n): EntrypointAssets => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n throw new Error(`Build assets entrypoint \"${name}\" is unavailable`);\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n const jsFilename = compilation.outputOptions.filename;\n const jsChunkFilename = compilation.outputOptions.chunkFilename;\n\n if (!jsFilename || !jsChunkFilename) {\n throw new Error(\"Build assets require output.filename and output.chunkFilename\");\n }\n\n return {\n initial: {\n js: initialChunks\n .filter(chunk => chunkHasJavaScript(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(\n compilation,\n chunk,\n chunk === entryChunk ? jsFilename : jsChunkFilename,\n JavaScriptContentHashType\n );\n }),\n css: initialChunks\n .filter(chunk => chunkHasCss(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(\n compilation,\n chunk,\n chunk.canBeInitial() ? cssFilename : cssChunkFilename,\n CssContentHashType\n );\n }),\n },\n async: {\n js: asyncChunks\n .filter(chunk => chunkHasJavaScript(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);\n }),\n css: asyncChunks\n .filter(chunk => chunkHasCss(compilation, chunk))\n .map(chunk => {\n return resolveChunkFilename(compilation, chunk, cssChunkFilename, CssContentHashType);\n }),\n },\n };\n};\n\nconst entrypointRuntimeUsesFullHash = (\n compilation: Compilation,\n name: string,\n cssFilename: Filename,\n cssChunkFilename: Filename\n): boolean => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n return false;\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n const jsFilename = compilation.outputOptions.filename;\n const jsChunkFilename = compilation.outputOptions.chunkFilename;\n\n if (!jsFilename || !jsChunkFilename) {\n return false;\n }\n\n return (\n initialChunks.some(chunk => {\n const js = filenameRequiresFullHash(\n compilation,\n chunk,\n chunk === entryChunk ? jsFilename : jsChunkFilename,\n JavaScriptContentHashType\n );\n\n const css =\n chunkHasCss(compilation, chunk) &&\n filenameRequiresFullHash(\n compilation,\n chunk,\n chunk.canBeInitial() ? cssFilename : cssChunkFilename,\n CssContentHashType\n );\n\n return js || css;\n }) ||\n asyncChunks.some(chunk => {\n const js = filenameRequiresFullHash(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);\n\n const css =\n chunkHasCss(compilation, chunk) &&\n filenameRequiresFullHash(compilation, chunk, cssChunkFilename, CssContentHashType);\n\n return js || css;\n })\n );\n};\n\nconst getChunkKey = (chunk: Chunk): string => {\n return `${String(chunk.name ?? \"\")}:${String(chunk.id ?? \"\")}`;\n};\n\nconst getFullMapRuntime = (\n compilation: Compilation,\n name: string,\n runtimes: ReadonlySet<Chunk>\n): FullMapRuntime | undefined => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint || !runtimes.has(entrypoint.getRuntimeChunk())) {\n return;\n }\n\n return {name, runtime: entrypoint.getRuntimeChunk()};\n};\n\nconst getFullMapRuntimeFiles = (fullMap: FullMapRuntime, assets: EntrypointAssetsMap): readonly string[] => {\n const runtimeFiles = new Set(Array.from(fullMap.runtime.files, toPosix));\n\n return assets[fullMap.name].initial.js.filter(file => runtimeFiles.has(file));\n};\n\nconst validateEntrypointRuntime = (compilation: Compilation, name: string): void => {\n const entrypoint = compilation.entrypoints.get(name)!;\n\n if (entrypoint.getRuntimeChunk() !== entrypoint.getEntrypointChunk()) {\n throw new Error(\n `Build assets require a self-contained runtime for entrypoint \"${name}\"; disable optimization.runtimeChunk`\n );\n }\n};\n\nconst validateFullMapEntrypoint = (compilation: Compilation, name: string): void => {\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n return;\n }\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = Array.from(entrypoint.chunks);\n const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());\n\n if (initialChunks.length !== 1 || initialChunks[0] !== entryChunk || asyncChunks.length > 0) {\n throw new Error(\n `Full build-assets entrypoint \"${name}\" must be a single self-contained chunk; async chunks are not supported`\n );\n }\n};\n\nconst validateFullMapAssets = (assets: EntrypointAssetsMap, name: string): void => {\n const entrypoint = assets[name];\n\n if (!entrypoint) {\n return;\n }\n\n if (entrypoint.initial.js.length !== 1 || entrypoint.async.js.length > 0) {\n throw new Error(\n `Full build-assets entrypoint \"${name}\" must emit exactly one initial JavaScript file and no async JavaScript files`\n );\n }\n};\n\nconst serializeFilename = (filename: unknown): string => {\n return typeof filename === \"function\" ? filename.toString() : JSON.stringify(filename);\n};\n\nconst collectRuntimeModuleFingerprints = (compilation: Compilation): RuntimeModuleFingerprints => {\n const fingerprints: RuntimeModuleFingerprints = new Map();\n\n compilation.hooks.runtimeModule.tap(PluginName, (runtimeModule, chunk) => {\n if (runtimeModule.identifier().startsWith(\"webpack/runtime/build assets \")) {\n return;\n }\n\n let chunkFingerprints = fingerprints.get(chunk);\n\n if (!chunkFingerprints) {\n chunkFingerprints = new Map();\n fingerprints.set(chunk, chunkFingerprints);\n }\n\n chunkFingerprints.set(`${runtimeModule.stage}:${runtimeModule.identifier()}`, runtimeModule.generate());\n });\n\n return fingerprints;\n};\n\nconst updateBuildAssetsChunkHashes = (\n compilation: Compilation,\n options: Required<BuildAssetsMapPluginOptions>,\n runtimeModuleFingerprints: RuntimeModuleFingerprints,\n runtimes: ReadonlySet<Chunk>\n): void => {\n compilation.hooks.chunkHash.tap(PluginName, (chunk, hash) => {\n if (!runtimes.has(chunk)) {\n return;\n }\n\n const runtimeEntry = Array.from(compilation.entrypoints).find(([, entrypoint]) => {\n return entrypoint.getRuntimeChunk() === chunk;\n });\n\n if (!runtimeEntry) {\n return;\n }\n\n const [runtimeName] = runtimeEntry;\n const fullMap = runtimeName === options.fullMapEntrypoint;\n\n const entries = fullMap\n ? Array.from(compilation.entrypoints).toSorted(([left], [right]) => left.localeCompare(right))\n : [runtimeEntry];\n\n hash.update(`${PluginName}:runtime-map:${runtimeName}`, \"utf8\");\n hash.update(options.buildHashSalt, \"utf8\");\n hash.update(serializeFilename(compilation.outputOptions.filename), \"utf8\");\n hash.update(serializeFilename(compilation.outputOptions.chunkFilename), \"utf8\");\n hash.update(serializeFilename(options.cssFilename), \"utf8\");\n hash.update(serializeFilename(options.cssChunkFilename), \"utf8\");\n\n if (fullMap) {\n hash.update(serializeFilename(compilation.outputOptions.assetModuleFilename), \"utf8\");\n }\n\n for (const [entryName, entrypoint] of entries) {\n hash.update(entryName, \"utf8\");\n\n const entryChunk = entrypoint.getEntrypointChunk();\n const initialChunks = new Set(entrypoint.chunks);\n\n const chunks = Array.from(entryChunk.getAllReferencedChunks()).toSorted((left, right) =>\n getChunkKey(left).localeCompare(getChunkKey(right))\n );\n\n for (const referencedChunk of chunks) {\n const category = initialChunks.has(referencedChunk) ? \"initial\" : \"async\";\n\n hash.update(`${category}:${getChunkKey(referencedChunk)}`, \"utf8\");\n\n const jsFilename =\n referencedChunk === entryChunk\n ? compilation.outputOptions.filename\n : compilation.outputOptions.chunkFilename;\n\n if (jsFilename) {\n const template = resolveFilenameTemplate(\n compilation,\n referencedChunk,\n jsFilename,\n JavaScriptContentHashType\n );\n\n hash.update(`javascript-template:${template}`, \"utf8\");\n }\n\n if (chunkHasCss(compilation, referencedChunk)) {\n const cssFilename = referencedChunk.canBeInitial() ? options.cssFilename : options.cssChunkFilename;\n\n const template = resolveFilenameTemplate(\n compilation,\n referencedChunk,\n cssFilename,\n CssContentHashType\n );\n\n hash.update(`css-template:${template}`, \"utf8\");\n }\n\n const moduleHashes = Array.from(\n compilation.chunkGraph.getChunkModulesIterable(referencedChunk),\n module => {\n return compilation.chunkGraph.getModuleHash(module, new Set(referencedChunk.runtime)) ?? \"\";\n }\n ).toSorted();\n\n moduleHashes.forEach(moduleHash => hash.update(moduleHash, \"utf8\"));\n\n const runtimeFingerprints = runtimeModuleFingerprints.get(referencedChunk);\n\n if (runtimeFingerprints) {\n Array.from(runtimeFingerprints)\n .toSorted(([left], [right]) => left.localeCompare(right))\n .forEach(([identifier, source]) => {\n hash.update(`runtime-module:${identifier}`, \"utf8\");\n hash.update(source, \"utf8\");\n });\n }\n }\n }\n });\n};\n\nclass BuildAssetsRuntimeModule extends RuntimeModule {\n public constructor(\n private readonly fullMap: boolean,\n private readonly runtimeName: string,\n private readonly property: string,\n private readonly cssFilename: Filename,\n private readonly cssChunkFilename: Filename,\n fullHash: boolean\n ) {\n super(`build assets ${fullMap ? \"full\" : \"current\"} ${runtimeName}`, RuntimeModule.STAGE_TRIGGER);\n\n if (!fullMap) {\n this.dependentHash = true;\n this.fullHash = fullHash;\n }\n }\n\n public generate(): string {\n const runtime = RuntimeGlobals.require;\n\n if (this.fullMap) {\n return renderBuildAssetsRuntime({\n require: runtime,\n property: this.property,\n value: FullMapPlaceholder,\n envelope: FullMapEnvelopeKey,\n full: true,\n });\n }\n\n const compilation = this.compilation;\n\n if (!compilation) {\n throw new Error(\"Build assets runtime is not attached to a compilation\");\n }\n\n const current = getEntrypointRuntimeAssets(\n compilation,\n this.runtimeName,\n this.cssFilename,\n this.cssChunkFilename\n );\n\n const envelope = JSON.stringify({[CurrentMapEnvelopeKey]: current});\n\n return renderBuildAssetsRuntime({\n require: runtime,\n property: this.property,\n value: envelope,\n envelope: CurrentMapEnvelopeKey,\n full: false,\n });\n }\n}\n\nconst replaceFullMapPlaceholder = (\n compilation: Compilation,\n runtimeFiles: readonly string[],\n assets: EntrypointAssetsMap\n): void => {\n const placeholder = JSON.stringify(FullMapPlaceholder);\n const replacementValue = JSON.stringify(JSON.stringify({[FullMapEnvelopeKey]: assets}));\n let replacements = 0;\n\n for (const file of runtimeFiles) {\n const asset = compilation.getAsset(file);\n\n if (!asset) {\n continue;\n }\n\n const code = asset.source.source().toString();\n const start = code.indexOf(placeholder);\n\n if (start < 0) {\n continue;\n }\n\n if (code.indexOf(placeholder, start + placeholder.length) >= 0) {\n throw new Error(`Build assets placeholder occurs more than once in \"${file}\"`);\n }\n\n const source = new sources.ReplaceSource(asset.source);\n\n source.replace(start, start + placeholder.length - 1, replacementValue);\n compilation.updateAsset(file, source);\n replacements += 1;\n }\n\n if (replacements !== 1) {\n throw new Error(`Expected one full build-assets runtime, found ${replacements}`);\n }\n};\n\nconst extractEmbeddedEnvelope = <T>(file: string, source: string, key: string): T => {\n const sourceFile = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);\n const values: T[] = [];\n\n const visit = (node: ts.Node): void => {\n if (ts.isStringLiteralLike(node) && node.text.includes(key)) {\n try {\n const envelope = JSON.parse(node.text) as Record<string, T>;\n\n if (Object.prototype.hasOwnProperty.call(envelope, key)) {\n values.push(envelope[key]);\n }\n } catch {}\n }\n\n ts.forEachChild(node, visit);\n };\n\n visit(sourceFile);\n\n if (values.length !== 1) {\n throw new Error(`Expected one embedded build assets value in \"${file}\", found ${values.length}`);\n }\n\n return values[0];\n};\n\nconst extractEmbeddedMap = (file: string, source: string): EntrypointAssetsMap => {\n return extractEmbeddedEnvelope<EntrypointAssetsMap>(file, source, FullMapEnvelopeKey);\n};\n\nconst validateEmbeddedMap = (compilation: Compilation, fullMap: FullMapRuntime, assets: EntrypointAssetsMap): void => {\n const runtimeFiles = getFullMapRuntimeFiles(fullMap, assets);\n\n const runtime = runtimeFiles\n .map(file => ({file, source: compilation.getAsset(file)?.source.source().toString() ?? \"\"}))\n .find(({source}) => source.length > 0);\n\n if (!runtime) {\n throw new Error(\n `Full build-assets runtime for entrypoint \"${fullMap.name}\" is unavailable after asset processing`\n );\n }\n\n const embedded = extractEmbeddedMap(runtime.file, runtime.source);\n\n if (stringify(normalizeAssetsMap(embedded)) !== stringify(assets)) {\n throw new Error(\n \"Build assets changed after the runtime map was embedded; finalize entrypoint assets before processAssets begins\"\n );\n }\n};\n\nconst validateCurrentEntrypointMaps = (\n compilation: Compilation,\n assets: EntrypointAssetsMap,\n fullMapEntrypoint: string,\n runtimes: ReadonlySet<Chunk>\n): void => {\n for (const [name, entrypointAssets] of Object.entries(assets)) {\n if (name === fullMapEntrypoint) {\n continue;\n }\n\n const entrypoint = compilation.entrypoints.get(name);\n\n if (!entrypoint) {\n throw new Error(`Build assets entrypoint \"${name}\" is unavailable`);\n }\n\n if (!runtimes.has(entrypoint.getRuntimeChunk())) {\n continue;\n }\n\n const runtimeFiles = new Set(Array.from(entrypoint.getRuntimeChunk().files, toPosix));\n\n const runtime = entrypointAssets.initial.js\n .filter(file => runtimeFiles.has(file))\n .map(file => ({file, source: compilation.getAsset(file)?.source.source().toString() ?? \"\"}))\n .find(({source}) => source.length > 0);\n\n if (!runtime) {\n throw new Error(`Runtime map for entrypoint \"${name}\" is unavailable after asset processing`);\n }\n\n const runtimeAssets = extractEmbeddedEnvelope<EntrypointAssets>(\n runtime.file,\n runtime.source,\n CurrentMapEnvelopeKey\n );\n\n const finalizedAssets: EntrypointAssets = {\n initial: entrypointAssets.initial,\n async: entrypointAssets.async,\n };\n\n if (stringify(normalizeAssets(runtimeAssets)) !== stringify(finalizedAssets)) {\n throw new Error(\n `Build assets changed after the runtime map for entrypoint \"${name}\" was embedded: ${JSON.stringify({embedded: runtimeAssets, finalized: finalizedAssets})}`\n );\n }\n }\n};\n\nconst finalizeBuildAssets = (\n compilation: Compilation,\n options: Required<BuildAssetsMapPluginOptions>,\n runtimes: ReadonlySet<Chunk>\n): void => {\n const assets = collectBuildAssets(compilation);\n const fullMap = getFullMapRuntime(compilation, options.fullMapEntrypoint, runtimes);\n\n if (fullMap) {\n validateFullMapAssets(assets, options.fullMapEntrypoint);\n validateEmbeddedMap(compilation, fullMap, assets);\n }\n\n validateCurrentEntrypointMaps(compilation, assets, options.fullMapEntrypoint, runtimes);\n\n setCompilationBuildAssets(compilation, assets);\n};\n\nexport default class BuildAssetsMapPlugin {\n private readonly options: Required<BuildAssetsMapPluginOptions>;\n\n public constructor(options: BuildAssetsMapPluginOptions) {\n this.options = {\n ...options,\n buildHashSalt: options.buildHashSalt ?? \"\",\n };\n }\n\n public apply(compiler: Compiler): void {\n const runtimeSelections = new WeakMap<Compilation, ReadonlySet<Chunk>>();\n\n compiler.hooks.thisCompilation.tap({name: PluginName, stage: EmbedStage}, compilation => {\n const injectedRuntimes = new Set<Chunk>();\n runtimeSelections.set(compilation, injectedRuntimes);\n let filenamesValidated = false;\n let selectedRuntimes: Map<Chunk, RuntimeSelection> | undefined;\n const runtimeModuleFingerprints = collectRuntimeModuleFingerprints(compilation);\n const isUsed = trackModuleUsage(compiler, compilation, this.options.module);\n\n updateBuildAssetsChunkHashes(compilation, this.options, runtimeModuleFingerprints, injectedRuntimes);\n\n compilation.hooks.additionalTreeRuntimeRequirements.tap(PluginName, (chunk, requirements) => {\n if (!selectedRuntimes) {\n selectedRuntimes = new Map();\n // Select and validate in entrypoint order, independently of runtime hook order.\n for (const [name, entrypoint] of compilation.entrypoints) {\n const runtime = entrypoint.getRuntimeChunk();\n const fullMap = name === this.options.fullMapEntrypoint;\n const delivery = fullMap ? this.options.module.full : this.options.module.current;\n\n if (!isUsed(runtime, delivery.export)) {\n continue;\n }\n\n validateEntrypointRuntime(compilation, name);\n\n if (fullMap) {\n validateFullMapEntrypoint(compilation, name);\n }\n\n selectedRuntimes.set(runtime, {name, fullMap, property: delivery.property});\n }\n }\n\n if (!filenamesValidated) {\n validateAsyncChunkFilenames(compilation, this.options.cssChunkFilename);\n filenamesValidated = true;\n }\n\n const selection = selectedRuntimes.get(chunk);\n\n if (!selection || injectedRuntimes.has(chunk)) {\n return;\n }\n\n requirements.add(RuntimeGlobals.require);\n injectedRuntimes.add(chunk);\n\n compilation.addRuntimeModule(\n chunk,\n new BuildAssetsRuntimeModule(\n selection.fullMap,\n selection.name,\n selection.property,\n this.options.cssFilename,\n this.options.cssChunkFilename,\n entrypointRuntimeUsesFullHash(\n compilation,\n selection.name,\n this.options.cssFilename,\n this.options.cssChunkFilename\n )\n )\n );\n });\n\n compilation.hooks.processAssets.tap(\n {\n name: PluginName,\n stage: EmbedStage,\n },\n () => {\n const assets = collectBuildAssets(compilation);\n const fullMap = getFullMapRuntime(compilation, this.options.fullMapEntrypoint, injectedRuntimes);\n setCompilationBuildAssets(compilation, assets);\n\n if (fullMap) {\n validateFullMapAssets(assets, this.options.fullMapEntrypoint);\n replaceFullMapPlaceholder(compilation, getFullMapRuntimeFiles(fullMap, assets), assets);\n }\n }\n );\n\n compilation.hooks.processAssets.tap(\n {\n name: `${PluginName}:finalize`,\n stage: Compilation.PROCESS_ASSETS_STAGE_ANALYSE,\n },\n () => finalizeBuildAssets(compilation, this.options, injectedRuntimes)\n );\n });\n\n // Register after every afterPlugins callback, then run after ordinary emit taps but before files are written.\n compiler.hooks.afterPlugins.intercept({\n name: `${PluginName}:registerFinalValidation`,\n done: () => {\n compiler.hooks.emit.tap(\n {name: `${PluginName}:finalValidation`, stage: FinalValidationStage},\n compilation => {\n const runtimes = runtimeSelections.get(compilation);\n\n if (runtimes) {\n finalizeBuildAssets(compilation, this.options, runtimes);\n }\n }\n );\n },\n });\n }\n}\n"],"mappings":"AAAA,SAAe,aAAiC,gBAAgB,eAAe,eAAc;AAC7F,OAAO,eAAe;AACtB,OAAO,QAAQ;AAEf,SAAQ,0BAAyB;AACjC,SAAQ,iBAAiB,0BAAyB;AAClD,SAAQ,gCAA+B;AACvC,SAAQ,iCAAgC;AAExC;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAQ,eAAc;AAItB,SAAQ,wBAA+D;AAEvE,MAAM,aAAa;AAEnB,MAAM,qBAAqB;AAE3B,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,aAAa,OAAO;AAC1B,MAAM,uBAAuB;AAuB7B,MAAM,8BAA8B,CAAC,aAA0B,qBAAqC;AAChG,QAAM,cAAc,IAAI;AAAA,IACpB,MAAM,KAAK,YAAY,YAAY,OAAO,CAAC,EAAE,QAAQ,gBAAc;AAC/D,aAAO,MAAM,KAAK,WAAW,mBAAmB,EAAE,kBAAkB,CAAC;AAAA,IACzE,CAAC;AAAA,EACL;AAEA,QAAM,WAAW,CACb,UACA,QACA,iBACA,WACA,eACO;AACP,QAAI,OAAO,aAAa,YAAY;AAChC;AAAA,IACJ;AAEA,U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AAAA,cACb,KAAK,QAAQ;AAAA,YACjB;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ,CAAC;AAED,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM;AAAA,UACN,OAAO;AAAA,QACX;AAAA,QACA,MAAM;AACF,gBAAM,SAAS,mBAAmB,WAAW;AAC7C,gBAAM,UAAU,kBAAkB,aAAa,KAAK,QAAQ,mBAAmB,gBAAgB;AAC/F,oCAA0B,aAAa,MAAM;AAE7C,cAAI,SAAS;AACT,kCAAsB,QAAQ,KAAK,QAAQ,iBAAiB;AAC5D,sCAA0B,aAAa,uBAAuB,SAAS,MAAM,GAAG,MAAM;AAAA,UAC1F;AAAA,QACJ;AAAA,MACJ;AAEA,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM,GAAG,UAAU;AAAA,UACnB,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,MAAM,oBAAoB,aAAa,KAAK,SAAS,gBAAgB;AAAA,MACzE;AAAA,IACJ,CAAC;AAGD,aAAS,MAAM,aAAa,UAAU;AAAA,MAClC,MAAM,GAAG,UAAU;AAAA,MACnB,MAAM,MAAM;AACR,iBAAS,MAAM,KAAK;AAAA,UAChB,EAAC,MAAM,GAAG,UAAU,oBAAoB,OAAO,qBAAoB;AAAA,UACnE,iBAAe;AACX,kBAAM,WAAW,kBAAkB,IAAI,WAAW;AAElD,gBAAI,UAAU;AACV,kCAAoB,aAAa,KAAK,SAAS,QAAQ;AAAA,YAC3D;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { EntrypointAssets, EntrypointAssetsMap } from "../../../../types/entrypoint.js";
2
+ export declare const normalizeAssets: <T extends EntrypointAssets>(assets: T) => T;
3
+ export declare const normalizeAssetsMap: (assets: EntrypointAssetsMap) => EntrypointAssetsMap;
@@ -0,0 +1,24 @@
1
+ const normalizeAssets = (assets) => {
2
+ const initial = {
3
+ js: [...new Set(assets.initial.js)],
4
+ css: [...new Set(assets.initial.css)]
5
+ };
6
+ const initialFiles = /* @__PURE__ */ new Set([...initial.js, ...initial.css]);
7
+ const async = {
8
+ js: [...new Set(assets.async.js)].filter((file) => !initialFiles.has(file)),
9
+ css: [...new Set(assets.async.css)].filter((file) => !initialFiles.has(file))
10
+ };
11
+ return {
12
+ ...assets,
13
+ initial,
14
+ async
15
+ };
16
+ };
17
+ const normalizeAssetsMap = (assets) => {
18
+ return Object.fromEntries(Object.entries(assets).map(([name, entry]) => [name, normalizeAssets(entry)]));
19
+ };
20
+ export {
21
+ normalizeAssets,
22
+ normalizeAssetsMap
23
+ };
24
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/cli/bundler/plugins/build-assets-map/normalize.ts"],"sourcesContent":["import type {EntrypointAssets, EntrypointAssetsMap} from \"@typing/entrypoint\";\n\n// realContentHash may merge different chunk filenames into one emitted file.\nexport const normalizeAssets = <T extends EntrypointAssets>(assets: T): T => {\n const initial = {\n js: [...new Set(assets.initial.js)],\n css: [...new Set(assets.initial.css)],\n };\n\n const initialFiles = new Set([...initial.js, ...initial.css]);\n\n const async = {\n js: [...new Set(assets.async.js)].filter(file => !initialFiles.has(file)),\n css: [...new Set(assets.async.css)].filter(file => !initialFiles.has(file)),\n };\n\n return {\n ...assets,\n initial,\n async,\n };\n};\n\nexport const normalizeAssetsMap = (assets: EntrypointAssetsMap): EntrypointAssetsMap => {\n return Object.fromEntries(Object.entries(assets).map(([name, entry]) => [name, normalizeAssets(entry)]));\n};\n"],"mappings":"AAGO,MAAM,kBAAkB,CAA6B,WAAiB;AACzE,QAAM,UAAU;AAAA,IACZ,IAAI,CAAC,GAAG,IAAI,IAAI,OAAO,QAAQ,EAAE,CAAC;AAAA,IAClC,KAAK,CAAC,GAAG,IAAI,IAAI,OAAO,QAAQ,GAAG,CAAC;AAAA,EACxC;AAEA,QAAM,eAAe,oBAAI,IAAI,CAAC,GAAG,QAAQ,IAAI,GAAG,QAAQ,GAAG,CAAC;AAE5D,QAAM,QAAQ;AAAA,IACV,IAAI,CAAC,GAAG,IAAI,IAAI,OAAO,MAAM,EAAE,CAAC,EAAE,OAAO,UAAQ,CAAC,aAAa,IAAI,IAAI,CAAC;AAAA,IACxE,KAAK,CAAC,GAAG,IAAI,IAAI,OAAO,MAAM,GAAG,CAAC,EAAE,OAAO,UAAQ,CAAC,aAAa,IAAI,IAAI,CAAC;AAAA,EAC9E;AAEA,SAAO;AAAA,IACH,GAAG;AAAA,IACH;AAAA,IACA;AAAA,EACJ;AACJ;AAEO,MAAM,qBAAqB,CAAC,WAAqD;AACpF,SAAO,OAAO,YAAY,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,gBAAgB,KAAK,CAAC,CAAC,CAAC;AAC3G;","names":[]}
@@ -0,0 +1,2 @@
1
+ declare var assets: any;
2
+ declare var entries: any[];
@@ -0,0 +1,9 @@
1
+ import type { RuntimePropertyOptions } from "../types.js";
2
+ interface BuildAssetsRuntimeTemplateOptions extends RuntimePropertyOptions {
3
+ readonly require: string;
4
+ readonly value: string;
5
+ readonly envelope: string;
6
+ readonly full: boolean;
7
+ }
8
+ export declare const renderBuildAssetsRuntime: (options: BuildAssetsRuntimeTemplateOptions) => string;
9
+ export {};
@@ -0,0 +1,32 @@
1
+ // raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/bundler/plugins/build-assets-map/templates/runtime.template.js?raw
2
+ var runtime_template_default = "var assets = JSON.parse(__ADNBN_VALUE__)[__ADNBN_ENVELOPE__];\nvar entries = __ADNBN_FULL_MAP__ ? Object.keys(assets).map(name => assets[name]) : [assets];\n\n// realContentHash can merge multiple chunk filenames into one emitted file.\n// Normalize after those substitutions, preserving the dependency order.\nentries.forEach(entry => {\n entry.initial.js = Array.from(new Set(entry.initial.js));\n entry.initial.css = Array.from(new Set(entry.initial.css));\n var initial = new Set(entry.initial.js.concat(entry.initial.css));\n entry.async.js = Array.from(new Set(entry.async.js)).filter(file => !initial.has(file));\n entry.async.css = Array.from(new Set(entry.async.css)).filter(file => !initial.has(file));\n});\n\n__ADNBN_REQUIRE__[__ADNBN_PROPERTY__] = assets;\n";
3
+
4
+ // src/cli/bundler/plugins/utils/runtime-template.ts
5
+ var PlaceholderPattern = /__ADNBN_[A-Z0-9_]+__/g;
6
+ var renderRuntimeTemplate = (template, values) => {
7
+ for (const placeholder of Object.keys(values)) {
8
+ if (!template.includes(placeholder)) {
9
+ throw new Error(`Runtime template placeholder "${placeholder}" is unavailable`);
10
+ }
11
+ }
12
+ return template.replace(PlaceholderPattern, (placeholder) => {
13
+ if (!Object.hasOwn(values, placeholder)) {
14
+ throw new Error(`Runtime template placeholder "${placeholder}" was not replaced`);
15
+ }
16
+ return values[placeholder];
17
+ }).trim();
18
+ };
19
+
20
+ // src/cli/bundler/plugins/build-assets-map/templates.ts
21
+ var renderBuildAssetsRuntime = (options) => {
22
+ return renderRuntimeTemplate(runtime_template_default, {
23
+ __ADNBN_REQUIRE__: options.require,
24
+ __ADNBN_PROPERTY__: JSON.stringify(options.property),
25
+ __ADNBN_VALUE__: JSON.stringify(options.value),
26
+ __ADNBN_ENVELOPE__: JSON.stringify(options.envelope),
27
+ __ADNBN_FULL_MAP__: JSON.stringify(options.full)
28
+ });
29
+ };
30
+ export {
31
+ renderBuildAssetsRuntime
32
+ };
@@ -1,5 +1,6 @@
1
1
  import _ from "lodash";
2
2
  import path from "path";
3
+ import { DynamicEntryPlugin } from "@rspack/core";
3
4
  import { RspackVirtualModulePlugin as VirtualModulesPlugin } from "rspack-plugin-virtual-module";
4
5
  class EntrypointPlugin {
5
6
  constructor(entries = /* @__PURE__ */ new Map()) {
@@ -55,6 +56,16 @@ class EntrypointPlugin {
55
56
  this.hookEntryOption(entry);
56
57
  });
57
58
  if (this.update) {
59
+ compiler.hooks.afterEnvironment.tap(this.pluginName, () => {
60
+ compiler.hooks.entryOption.tap(`${this.pluginName}:watch`, (context, entry) => {
61
+ compiler.options.entry = entry;
62
+ new DynamicEntryPlugin(context, async () => {
63
+ const entry2 = compiler.options.entry;
64
+ return typeof entry2 === "function" ? entry2() : entry2;
65
+ }).apply(compiler);
66
+ return true;
67
+ });
68
+ });
58
69
  compiler.hooks.watchRun.tapAsync(this.pluginName, (compiler2, callback) => {
59
70
  this.hookWatchRun(compiler2).then(() => callback()).catch(callback);
60
71
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/cli/bundler/plugins/entrypoint/EntrypointPlugin.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\n\nimport {Compiler, type EntryDescription, EntryNormalized} from \"@rspack/core\";\nimport {RspackVirtualModulePlugin as VirtualModulesPlugin} from \"rspack-plugin-virtual-module\";\n\nimport {EntrypointEntries, EntrypointFile} from \"@typing/entrypoint\";\n\nexport type EntrypointPluginTemplate = (file: EntrypointFile) => string;\n\nexport type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;\n\nexport interface EntrypointPluginModule {\n /**\n * Virtual module name, used in the rspack entry and virtual module.\n */\n name: string;\n\n /**\n * Virtual module content.\n */\n module: string;\n}\n\nexport type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;\n\nexport type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;\n\nexport type EntrypointPluginEntryOptions = Omit<EntryDescription, \"import\">;\n\nexport type EntrypointPluginEntryOptionsResolver = (name: string) => EntrypointPluginEntryOptions;\n\nexport default class EntrypointPlugin {\n private readonly pluginName: string = \"EntrypointPlugin\";\n\n private _plugin?: VirtualModulesPlugin;\n private _modules?: EntrypointPluginEntryModules;\n private readonly _entryOptions: EntrypointPluginEntryOptionsResolver[] = [];\n\n protected template?: EntrypointPluginTemplate;\n protected update?: EntrypointPluginUpdate;\n\n public static filename(file: EntrypointFile): string {\n let name = file.file;\n\n if (file.external) {\n const {ext} = path.parse(name);\n name = file.import + ext;\n }\n\n return path.join(\"virtual\", name);\n }\n\n protected get plugin(): VirtualModulesPlugin {\n if (this._plugin) {\n return this._plugin;\n }\n\n const modules = Object.fromEntries(this.getModuleContents(this.modules));\n\n return (this._plugin = new VirtualModulesPlugin(modules, \"entrypoint\"));\n }\n\n protected get modules(): EntrypointPluginEntryModules {\n return (this._modules ??= this.createModules(this.entries));\n }\n\n protected get watchFiles(): ReadonlySet<string> {\n const files = Array.from(this.modules.values())\n .flatMap(modules => Array.from(modules.keys()))\n .filter(({external}) => !external)\n .map(({file}) => file);\n\n return new Set(files);\n }\n\n public static from(entries: EntrypointEntries): EntrypointPlugin {\n return new EntrypointPlugin(entries);\n }\n\n constructor(private readonly entries: EntrypointEntries = new Map()) {}\n\n public virtual(template: EntrypointPluginTemplate): this {\n this.template = template;\n\n return this;\n }\n\n public entryOptions(options: EntrypointPluginEntryOptions | EntrypointPluginEntryOptionsResolver): this {\n this._entryOptions.push(_.isFunction(options) ? options : () => options);\n\n return this;\n }\n\n public watch(update: EntrypointPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n public apply(compiler: Compiler): void {\n this.plugin.apply(compiler);\n\n compiler.hooks.entryOption.tap(this.pluginName, (_, entry) => {\n this.hookEntryOption(entry);\n });\n\n if (this.update) {\n compiler.hooks.watchRun.tapAsync(this.pluginName, (compiler, callback) => {\n this.hookWatchRun(compiler)\n .then(() => callback())\n .catch(callback);\n });\n }\n }\n\n protected hookEntryOption(entry: EntryNormalized): void {\n if (_.isPlainObject(entry)) {\n this.modules.entries().forEach(([name, modules]) => {\n const current = structuredClone(entry[name] ?? []);\n let currentFiles = current;\n let currentOptions: EntrypointPluginEntryOptions = {};\n\n if (\"import\" in currentFiles) {\n currentOptions = currentFiles;\n currentFiles = currentFiles.import;\n }\n\n currentFiles.push(...Array.from(modules.values(), ({name}) => name));\n\n entry[name] = {\n ...currentOptions,\n ...this.resolveEntryOptions(name),\n import: _.uniq(currentFiles),\n };\n });\n } else {\n throw new Error(\"EntrypointPlugin: entry is not an object\");\n }\n }\n\n protected async hookWatchRun(compiler: Compiler): Promise<void> {\n const {modifiedFiles = new Set()} = compiler;\n\n const watchFiles = new Set(Array.from(this.watchFiles, file => path.resolve(compiler.context, file)));\n const needUpdate = Array.from(modifiedFiles).some(file => watchFiles.has(path.resolve(compiler.context, file)));\n\n if (!needUpdate) {\n return;\n }\n\n const updatedEntries = await this.update!(modifiedFiles);\n\n const updatedModules = this.createModules(updatedEntries);\n\n const currentContents = this.getModuleContents(this.modules);\n const updatedContents = this.getModuleContents(updatedModules);\n\n const removedContents = new Map(Array.from(currentContents).filter(entry => !updatedContents.has(entry[0])));\n\n const changedContents = new Map(\n Array.from(updatedContents).filter(([name, content]) => currentContents.get(name) !== content)\n );\n\n removedContents.keys().forEach(name => {\n this.plugin.writeModule(name, \"\");\n });\n\n changedContents.forEach((content, name) => {\n this.plugin.writeModule(name, content);\n });\n\n this.modules.keys().forEach(name => {\n if (!updatedModules.has(name)) {\n delete compiler.options.entry[name];\n }\n });\n\n updatedModules.entries().forEach(([name, modules]) => {\n const current = structuredClone(compiler.options.entry[name] ?? []);\n let entry = current;\n let currentOptions: EntrypointPluginEntryOptions = {};\n\n if (\"import\" in entry) {\n currentOptions = entry;\n entry = entry.import as string[];\n }\n\n entry = entry.filter(file => !removedContents.has(file));\n\n entry.push(...Array.from(modules.values(), ({name}) => name));\n\n compiler.options.entry[name] = {\n ...currentOptions,\n ...this.resolveEntryOptions(name),\n import: _.uniq(entry),\n };\n });\n\n this._modules = updatedModules;\n }\n\n protected resolveEntryOptions(name: string): EntrypointPluginEntryOptions {\n return Object.assign({}, ...this._entryOptions.map(resolve => resolve(name)));\n }\n\n protected createModules(entries: EntrypointEntries): EntrypointPluginEntryModules {\n const entryModules: EntrypointPluginEntryModules = new Map();\n\n for (const [name, files] of entries) {\n const modules: EntrypointPluginModules = new Map();\n\n for (const file of files) {\n modules.set(file, {\n name: EntrypointPlugin.filename(file),\n module: this.template ? this.template(file) : \"\",\n });\n }\n\n entryModules.set(name, modules);\n }\n\n return entryModules;\n }\n\n protected getModuleContents(modules: EntrypointPluginEntryModules): Map<string, string> {\n const content = new Map<string, string>();\n\n modules.values().forEach(modules => {\n modules.forEach(({name, module}) => {\n content.set(name, module);\n });\n });\n\n return content;\n }\n}\n"],"mappings":"AAAA,OAAO,OAAO;AACd,OAAO,UAAU;AAGjB,SAAQ,6BAA6B,4BAA2B;AA4BhE,MAAO,iBAA+B;AAAA,EAgDlC,YAA6B,UAA6B,oBAAI,IAAI,GAAG;AAAxC;AAAA,EAAyC;AAAA,EAAzC;AAAA,EA/CZ,aAAqB;AAAA,EAE9B;AAAA,EACA;AAAA,EACS,gBAAwD,CAAC;AAAA,EAEhE;AAAA,EACA;AAAA,EAEV,OAAc,SAAS,MAA8B;AACjD,QAAI,OAAO,KAAK;AAEhB,QAAI,KAAK,UAAU;AACf,YAAM,EAAC,IAAG,IAAI,KAAK,MAAM,IAAI;AAC7B,aAAO,KAAK,SAAS;AAAA,IACzB;AAEA,WAAO,KAAK,KAAK,WAAW,IAAI;AAAA,EACpC;AAAA,EAEA,IAAc,SAA+B;AACzC,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,UAAU,OAAO,YAAY,KAAK,kBAAkB,KAAK,OAAO,CAAC;AAEvE,WAAQ,KAAK,UAAU,IAAI,qBAAqB,SAAS,YAAY;AAAA,EACzE;AAAA,EAEA,IAAc,UAAwC;AAClD,WAAQ,KAAK,aAAL,KAAK,WAAa,KAAK,cAAc,KAAK,OAAO;AAAA,EAC7D;AAAA,EAEA,IAAc,aAAkC;AAC5C,UAAM,QAAQ,MAAM,KAAK,KAAK,QAAQ,OAAO,CAAC,EACzC,QAAQ,aAAW,MAAM,KAAK,QAAQ,KAAK,CAAC,CAAC,EAC7C,OAAO,CAAC,EAAC,SAAQ,MAAM,CAAC,QAAQ,EAChC,IAAI,CAAC,EAAC,KAAI,MAAM,IAAI;AAEzB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AAC,aAAW;AAChC,MAAAA,SAAQ,QAAQ,CAAC,EAAC,MAAM,OAAM,MAAM;AAChC,gBAAQ,IAAI,MAAM,MAAM;AAAA,MAC5B,CAAC;AAAA,IACL,CAAC;AAED,WAAO;AAAA,EACX;AACJ;","names":["_","compiler","name","modules"]}
1
+ {"version":3,"sources":["../../../../../src/cli/bundler/plugins/entrypoint/EntrypointPlugin.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\n\nimport {Compiler, DynamicEntryPlugin, type EntryDescription, EntryNormalized} from \"@rspack/core\";\nimport {RspackVirtualModulePlugin as VirtualModulesPlugin} from \"rspack-plugin-virtual-module\";\n\nimport {EntrypointEntries, EntrypointFile} from \"@typing/entrypoint\";\n\nexport type EntrypointPluginTemplate = (file: EntrypointFile) => string;\n\nexport type EntrypointPluginUpdate = (files: ReadonlySet<string>) => Promise<EntrypointEntries>;\n\nexport interface EntrypointPluginModule {\n /**\n * Virtual module name, used in the rspack entry and virtual module.\n */\n name: string;\n\n /**\n * Virtual module content.\n */\n module: string;\n}\n\nexport type EntrypointPluginModules = Map<EntrypointFile, EntrypointPluginModule>;\n\nexport type EntrypointPluginEntryModules = Map<string, EntrypointPluginModules>;\n\nexport type EntrypointPluginEntryOptions = Omit<EntryDescription, \"import\">;\n\nexport type EntrypointPluginEntryOptionsResolver = (name: string) => EntrypointPluginEntryOptions;\n\nexport default class EntrypointPlugin {\n private readonly pluginName: string = \"EntrypointPlugin\";\n\n private _plugin?: VirtualModulesPlugin;\n private _modules?: EntrypointPluginEntryModules;\n private readonly _entryOptions: EntrypointPluginEntryOptionsResolver[] = [];\n\n protected template?: EntrypointPluginTemplate;\n protected update?: EntrypointPluginUpdate;\n\n public static filename(file: EntrypointFile): string {\n let name = file.file;\n\n if (file.external) {\n const {ext} = path.parse(name);\n name = file.import + ext;\n }\n\n return path.join(\"virtual\", name);\n }\n\n protected get plugin(): VirtualModulesPlugin {\n if (this._plugin) {\n return this._plugin;\n }\n\n const modules = Object.fromEntries(this.getModuleContents(this.modules));\n\n return (this._plugin = new VirtualModulesPlugin(modules, \"entrypoint\"));\n }\n\n protected get modules(): EntrypointPluginEntryModules {\n return (this._modules ??= this.createModules(this.entries));\n }\n\n protected get watchFiles(): ReadonlySet<string> {\n const files = Array.from(this.modules.values())\n .flatMap(modules => Array.from(modules.keys()))\n .filter(({external}) => !external)\n .map(({file}) => file);\n\n return new Set(files);\n }\n\n public static from(entries: EntrypointEntries): EntrypointPlugin {\n return new EntrypointPlugin(entries);\n }\n\n constructor(private readonly entries: EntrypointEntries = new Map()) {}\n\n public virtual(template: EntrypointPluginTemplate): this {\n this.template = template;\n\n return this;\n }\n\n public entryOptions(options: EntrypointPluginEntryOptions | EntrypointPluginEntryOptionsResolver): this {\n this._entryOptions.push(_.isFunction(options) ? options : () => options);\n\n return this;\n }\n\n public watch(update: EntrypointPluginUpdate): this {\n this.update = update;\n\n return this;\n }\n\n public apply(compiler: Compiler): void {\n this.plugin.apply(compiler);\n\n compiler.hooks.entryOption.tap(this.pluginName, (_, entry) => {\n this.hookEntryOption(entry);\n });\n\n if (this.update) {\n // Static EntryPlugin captures options once. Resolve the completed entry table\n // per compilation so watch changes to layers and asyncChunks reach Rspack too.\n // Register after other plugins have prepared their entryOption hooks, but\n // before Rspack installs its default static entry handler.\n compiler.hooks.afterEnvironment.tap(this.pluginName, () => {\n compiler.hooks.entryOption.tap(`${this.pluginName}:watch`, (context, entry) => {\n compiler.options.entry = entry;\n\n new DynamicEntryPlugin(context, async () => {\n const entry = compiler.options.entry;\n\n return typeof entry === \"function\" ? entry() : entry;\n }).apply(compiler);\n\n return true;\n });\n });\n\n compiler.hooks.watchRun.tapAsync(this.pluginName, (compiler, callback) => {\n this.hookWatchRun(compiler)\n .then(() => callback())\n .catch(callback);\n });\n }\n }\n\n protected hookEntryOption(entry: EntryNormalized): void {\n if (_.isPlainObject(entry)) {\n this.modules.entries().forEach(([name, modules]) => {\n const current = structuredClone(entry[name] ?? []);\n let currentFiles = current;\n let currentOptions: EntrypointPluginEntryOptions = {};\n\n if (\"import\" in currentFiles) {\n currentOptions = currentFiles;\n currentFiles = currentFiles.import;\n }\n\n currentFiles.push(...Array.from(modules.values(), ({name}) => name));\n\n entry[name] = {\n ...currentOptions,\n ...this.resolveEntryOptions(name),\n import: _.uniq(currentFiles),\n };\n });\n } else {\n throw new Error(\"EntrypointPlugin: entry is not an object\");\n }\n }\n\n protected async hookWatchRun(compiler: Compiler): Promise<void> {\n const {modifiedFiles = new Set()} = compiler;\n\n const watchFiles = new Set(Array.from(this.watchFiles, file => path.resolve(compiler.context, file)));\n const needUpdate = Array.from(modifiedFiles).some(file => watchFiles.has(path.resolve(compiler.context, file)));\n\n if (!needUpdate) {\n return;\n }\n\n const updatedEntries = await this.update!(modifiedFiles);\n\n const updatedModules = this.createModules(updatedEntries);\n\n const currentContents = this.getModuleContents(this.modules);\n const updatedContents = this.getModuleContents(updatedModules);\n\n const removedContents = new Map(Array.from(currentContents).filter(entry => !updatedContents.has(entry[0])));\n\n const changedContents = new Map(\n Array.from(updatedContents).filter(([name, content]) => currentContents.get(name) !== content)\n );\n\n removedContents.keys().forEach(name => {\n this.plugin.writeModule(name, \"\");\n });\n\n changedContents.forEach((content, name) => {\n this.plugin.writeModule(name, content);\n });\n\n this.modules.keys().forEach(name => {\n if (!updatedModules.has(name)) {\n delete compiler.options.entry[name];\n }\n });\n\n updatedModules.entries().forEach(([name, modules]) => {\n const current = structuredClone(compiler.options.entry[name] ?? []);\n let entry = current;\n let currentOptions: EntrypointPluginEntryOptions = {};\n\n if (\"import\" in entry) {\n currentOptions = entry;\n entry = entry.import as string[];\n }\n\n entry = entry.filter(file => !removedContents.has(file));\n\n entry.push(...Array.from(modules.values(), ({name}) => name));\n\n compiler.options.entry[name] = {\n ...currentOptions,\n ...this.resolveEntryOptions(name),\n import: _.uniq(entry),\n };\n });\n\n this._modules = updatedModules;\n }\n\n protected resolveEntryOptions(name: string): EntrypointPluginEntryOptions {\n return Object.assign({}, ...this._entryOptions.map(resolve => resolve(name)));\n }\n\n protected createModules(entries: EntrypointEntries): EntrypointPluginEntryModules {\n const entryModules: EntrypointPluginEntryModules = new Map();\n\n for (const [name, files] of entries) {\n const modules: EntrypointPluginModules = new Map();\n\n for (const file of files) {\n modules.set(file, {\n name: EntrypointPlugin.filename(file),\n module: this.template ? this.template(file) : \"\",\n });\n }\n\n entryModules.set(name, modules);\n }\n\n return entryModules;\n }\n\n protected getModuleContents(modules: EntrypointPluginEntryModules): Map<string, string> {\n const content = new Map<string, string>();\n\n modules.values().forEach(modules => {\n modules.forEach(({name, module}) => {\n content.set(name, module);\n });\n });\n\n return content;\n }\n}\n"],"mappings":"AAAA,OAAO,OAAO;AACd,OAAO,UAAU;AAEjB,SAAkB,0BAAiE;AACnF,SAAQ,6BAA6B,4BAA2B;AA4BhE,MAAO,iBAA+B;AAAA,EAgDlC,YAA6B,UAA6B,oBAAI,IAAI,GAAG;AAAxC;AAAA,EAAyC;AAAA,EAAzC;AAAA,EA/CZ,aAAqB;AAAA,EAE9B;AAAA,EACA;AAAA,EACS,gBAAwD,CAAC;AAAA,EAEhE;AAAA,EACA;AAAA,EAEV,OAAc,SAAS,MAA8B;AACjD,QAAI,OAAO,KAAK;AAEhB,QAAI,KAAK,UAAU;AACf,YAAM,EAAC,IAAG,IAAI,KAAK,MAAM,IAAI;AAC7B,aAAO,KAAK,SAAS;AAAA,IACzB;AAEA,WAAO,KAAK,KAAK,WAAW,IAAI;AAAA,EACpC;AAAA,EAEA,IAAc,SAA+B;AACzC,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,UAAU,OAAO,YAAY,KAAK,kBAAkB,KAAK,OAAO,CAAC;AAEvE,WAAQ,KAAK,UAAU,IAAI,qBAAqB,SAAS,YAAY;AAAA,EACzE;AAAA,EAEA,IAAc,UAAwC;AAClD,WAAQ,KAAK,aAAL,KAAK,WAAa,KAAK,cAAc,KAAK,OAAO;AAAA,EAC7D;AAA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oBAAoB,MAA4C;AACtE,WAAO,OAAO,OAAO,CAAC,GAAG,GAAG,KAAK,cAAc,IAAI,aAAW,QAAQ,IAAI,CAAC,CAAC;AAAA,EAChF;AAAA,EAEU,cAAc,SAA0D;AAC9E,UAAM,eAA6C,oBAAI,IAAI;AAE3D,eAAW,CAAC,MAAM,KAAK,KAAK,SAAS;AACjC,YAAM,UAAmC,oBAAI,IAAI;AAEjD,iBAAW,QAAQ,OAAO;AACtB,gBAAQ,IAAI,MAAM;AAAA,UACd,MAAM,iBAAiB,SAAS,IAAI;AAAA,UACpC,QAAQ,KAAK,WAAW,KAAK,SAAS,IAAI,IAAI;AAAA,QAClD,CAAC;AAAA,MACL;AAEA,mBAAa,IAAI,MAAM,OAAO;AAAA,IAClC;AAEA,WAAO;AAAA,EACX;AAAA,EAEU,kBAAkB,SAA4D;AACpF,UAAM,UAAU,oBAAI,IAAoB;AAExC,YAAQ,OAAO,EAAE,QAAQ,CAAAC,aAAW;AAChC,MAAAA,SAAQ,QAAQ,CAAC,EAAC,MAAM,OAAM,MAAM;AAChC,gBAAQ,IAAI,MAAM,MAAM;AAAA,MAC5B,CAAC;AAAA,IACL,CAAC;AAED,WAAO;AAAA,EACX;AACJ;","names":["_","entry","compiler","name","modules"]}
@@ -5,7 +5,7 @@ export interface IsolatedStylesPluginOptions extends RuntimePropertyOptions {
5
5
  cssChunkFilename: Filename;
6
6
  test: (entry: string) => boolean;
7
7
  timeout?: number;
8
- /** Inspects every entry's initial, shared and async CSS, independently of test. Throw to reject; return warning messages to report without changing delivery. */
8
+ /** Inspects every entry's initial, shared and async CSS using its delivery policy. Throw to reject; return warning messages without changing delivery. */
9
9
  validate?: (entry: string, files: IsolatedStylesPluginFiles) => void | readonly string[];
10
10
  }
11
11
  /** CSS destinations in one entrypoint's complete dependency graph, for build diagnostics only. */