adnbn 0.9.0 → 0.11.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.
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.d.ts +4 -1
- package/dist/cli/builders/manifest/ManifestBase.js +35 -6
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.js +1 -1
- package/dist/cli/builders/manifest/ManifestV3.js +12 -5
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
- package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
- package/dist/cli/builders/manifest/utils/index.js +19 -0
- package/dist/cli/builders/manifest/utils/index.js.map +1 -0
- package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
- package/dist/cli/builders/manifest/utils/permissions.js +34 -0
- package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +523 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.d.ts +13 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js +16 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +8 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +12 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +28 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
- package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
- package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
- package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
- package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
- package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
- package/dist/cli/bundler/plugins/index.d.ts +11 -5
- package/dist/cli/bundler/plugins/index.js +32 -10
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +55 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/manifest/index.js +6 -0
- package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/replace/index.js +5 -0
- package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
- package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
- package/dist/cli/bundler/plugins/types.d.ts +4 -0
- package/dist/cli/bundler/plugins/types.js +1 -0
- package/dist/cli/bundler/plugins/types.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/index.js +9 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/watch/index.js +5 -0
- package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
- package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
- package/dist/cli/bundler/utils/chunk-filename.js +93 -0
- package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -0
- package/dist/cli/bundler/utils/index.js +2 -0
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/bundler/utils/layers.d.ts +4 -0
- package/dist/cli/bundler/utils/layers.js +10 -0
- package/dist/cli/bundler/utils/layers.js.map +1 -0
- package/dist/cli/bundler/utils/output.d.ts +6 -2
- package/dist/cli/bundler/utils/output.js +165 -7
- package/dist/cli/bundler/utils/output.js.map +1 -1
- package/dist/cli/bundler/utils/styles.d.ts +5 -0
- package/dist/cli/bundler/utils/styles.js +30 -0
- package/dist/cli/bundler/utils/styles.js.map +1 -0
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.js → AbstractParsedFinder.js} +3 -3
- package/dist/cli/entrypoint/finder/AbstractParsedFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.d.ts +13 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js +33 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/PluginFinder.d.ts +4 -4
- package/dist/cli/entrypoint/finder/PluginFinder.js +2 -2
- package/dist/cli/entrypoint/finder/PluginFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/index.d.ts +2 -1
- package/dist/cli/entrypoint/finder/index.js +20 -18
- package/dist/cli/entrypoint/finder/index.js.map +1 -1
- package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
- package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
- package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +5 -1
- package/dist/cli/entrypoint/parser/ContentParser.js +55 -3
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/OptionsParser.d.ts +6 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js +16 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js.map +1 -0
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +4 -0
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/index.d.ts +1 -0
- package/dist/cli/entrypoint/parser/index.js +16 -14
- package/dist/cli/entrypoint/parser/index.js.map +1 -1
- package/dist/cli/plugins/asset.js +9 -4
- package/dist/cli/plugins/asset.js.map +1 -1
- package/dist/cli/plugins/background/index.js +1 -1
- package/dist/cli/plugins/background/index.js.map +1 -1
- package/dist/cli/plugins/content/Content.d.ts +1 -1
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
- package/dist/cli/plugins/content/ContentManager.js +79 -28
- package/dist/cli/plugins/content/ContentManager.js.map +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +1 -1
- package/dist/cli/plugins/content/ContentName.js +8 -7
- package/dist/cli/plugins/content/ContentName.js.map +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +1 -1
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +7 -0
- package/dist/cli/plugins/content/bundler.js +47 -0
- package/dist/cli/plugins/content/bundler.js.map +1 -0
- package/dist/cli/plugins/content/index.js +121 -62
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/relay-module.d.ts +3 -0
- package/dist/cli/plugins/content/relay-module.js +11 -0
- package/dist/cli/plugins/content/relay-module.js.map +1 -0
- package/dist/cli/plugins/content/types.d.ts +1 -1
- package/dist/cli/plugins/content/utils.d.ts +2 -0
- package/dist/cli/plugins/content/utils.js +8 -1
- package/dist/cli/plugins/content/utils.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
- package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
- package/dist/cli/plugins/icon/icon-module.js +11 -0
- package/dist/cli/plugins/icon/icon-module.js.map +1 -0
- package/dist/cli/plugins/icon/index.js +5 -3
- package/dist/cli/plugins/icon/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +1 -0
- package/dist/cli/plugins/index.js +22 -20
- package/dist/cli/plugins/index.js.map +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/options/Options.d.ts +10 -0
- package/dist/cli/plugins/options/Options.js +24 -0
- package/dist/cli/plugins/options/Options.js.map +1 -0
- package/dist/cli/plugins/options/index.d.ts +2 -0
- package/dist/cli/plugins/options/index.js +41 -0
- package/dist/cli/plugins/options/index.js.map +1 -0
- package/dist/cli/plugins/output.js +33 -3
- package/dist/cli/plugins/output.js.map +1 -1
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/plugins/view/index.js +1 -1
- package/dist/cli/plugins/view/index.js.map +1 -1
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +4 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +8 -10
- package/dist/entry/content/adapters/react/Builder.js +1 -1
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +2 -0
- package/dist/entry/content/adapters/react/Node.js +10 -2
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/Node.js +10 -7
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/core/Builder.d.ts +1 -2
- package/dist/entry/content/core/Builder.js +9 -5
- package/dist/entry/content/core/Builder.js.map +1 -1
- package/dist/entry/content/core/MountBuilder.js +14 -6
- package/dist/entry/content/core/MountBuilder.js.map +1 -1
- package/dist/entry/content/core/{Context.d.ts → context/Context.d.ts} +2 -1
- package/dist/entry/content/core/{Context.js → context/Context.js} +7 -0
- package/dist/entry/content/core/context/Context.js.map +1 -0
- package/dist/entry/content/core/{EventEmitter.d.ts → context/EventEmitter.d.ts} +1 -1
- package/dist/entry/content/core/{EventEmitter.js → context/EventEmitter.js} +1 -1
- package/dist/entry/content/core/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/core/{ManagedContext.d.ts → context/ManagedContext.d.ts} +1 -1
- package/dist/entry/content/core/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/core/context/index.d.ts +3 -0
- package/dist/entry/content/core/context/index.js +9 -0
- package/dist/entry/content/core/context/index.js.map +1 -0
- package/dist/entry/content/core/{AbstractMarker.d.ts → markers/AbstractMarker.d.ts} +1 -1
- package/dist/entry/content/core/{AbstractMarker.js → markers/AbstractMarker.js} +1 -1
- package/dist/entry/content/core/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/core/{AttributeMarker.d.ts → markers/AttributeMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/core/{WeakMarker.d.ts → markers/WeakMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/core/markers/index.d.ts +3 -0
- package/dist/entry/content/core/markers/index.js +9 -0
- package/dist/entry/content/core/markers/index.js.map +1 -0
- package/dist/entry/content/core/{EventNode.d.ts → nodes/EventNode.d.ts} +2 -1
- package/dist/entry/content/core/{EventNode.js → nodes/EventNode.js} +3 -0
- package/dist/entry/content/core/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/core/nodes/FrameNode.d.ts +23 -0
- package/dist/entry/content/core/nodes/FrameNode.js +125 -0
- package/dist/entry/content/core/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/core/{MarkerNode.d.ts → nodes/MarkerNode.d.ts} +2 -1
- package/dist/entry/content/core/{MarkerNode.js → nodes/MarkerNode.js} +3 -0
- package/dist/entry/content/core/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/core/{MountNode.d.ts → nodes/MountNode.d.ts} +2 -1
- package/dist/entry/content/core/{MountNode.js → nodes/MountNode.js} +3 -0
- package/dist/entry/content/core/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/core/{Node.d.ts → nodes/Node.d.ts} +2 -1
- package/dist/entry/content/core/{Node.js → nodes/Node.js} +3 -0
- package/dist/entry/content/core/nodes/Node.js.map +1 -0
- package/dist/entry/content/core/nodes/ShadowNode.d.ts +14 -0
- package/dist/entry/content/core/nodes/ShadowNode.js +67 -0
- package/dist/entry/content/core/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/core/nodes/index.d.ts +6 -0
- package/dist/entry/content/core/nodes/index.js +15 -0
- package/dist/entry/content/core/nodes/index.js.map +1 -0
- package/dist/entry/content/core/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/core/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/core/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/core/resolvers/watch.js +1 -1
- package/dist/entry/content/core/resolvers/watch.js.map +1 -1
- package/dist/entry/content/frame/Builder.d.ts +7 -0
- package/dist/entry/content/frame/Builder.js +14 -0
- package/dist/entry/content/frame/Builder.js.map +1 -0
- package/dist/entry/content/frame/index.d.ts +4 -0
- package/dist/entry/content/frame/index.js +7 -0
- package/dist/entry/content/frame/index.js.map +1 -0
- package/dist/entry/relay/Builder.js +5 -1
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +1 -1
- package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
- package/dist/locale/adapters/react/ReactLocale.js +41 -0
- package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
- package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
- package/dist/locale/adapters/react/index.d.ts +4 -2
- package/dist/locale/adapters/react/index.js +6 -4
- package/dist/locale/adapters/react/index.js.map +1 -1
- package/dist/locale/adapters/react/types.d.ts +22 -0
- package/dist/locale/adapters/react/types.js +1 -0
- package/dist/locale/adapters/react/types.js.map +1 -0
- package/dist/locale/helpers.d.ts +4 -5
- package/dist/locale/helpers.js +1 -1
- package/dist/locale/helpers.js.map +1 -1
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +1 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/providers/AbstractLocale.d.ts +4 -4
- package/dist/locale/providers/AbstractLocale.js +13 -94
- package/dist/locale/providers/AbstractLocale.js.map +1 -1
- package/dist/locale/providers/CustomLocale.d.ts +3 -3
- package/dist/locale/providers/CustomLocale.js +6 -5
- package/dist/locale/providers/CustomLocale.js.map +1 -1
- package/dist/locale/providers/DynamicLocale.d.ts +18 -11
- package/dist/locale/providers/DynamicLocale.js +60 -47
- package/dist/locale/providers/DynamicLocale.js.map +1 -1
- package/dist/locale/providers/NativeLocale.d.ts +4 -7
- package/dist/locale/providers/NativeLocale.js +5 -14
- package/dist/locale/providers/NativeLocale.js.map +1 -1
- package/dist/locale/providers/ObservableLocale.d.ts +35 -0
- package/dist/locale/providers/ObservableLocale.js +179 -0
- package/dist/locale/providers/ObservableLocale.js.map +1 -0
- package/dist/locale/providers/index.d.ts +2 -1
- package/dist/locale/providers/index.js +3 -1
- package/dist/locale/providers/index.js.map +1 -1
- package/dist/locale/storage/LocaleStorage.d.ts +11 -0
- package/dist/locale/storage/LocaleStorage.js +40 -0
- package/dist/locale/storage/LocaleStorage.js.map +1 -0
- package/dist/locale/storage/index.d.ts +1 -0
- package/dist/locale/storage/index.js +5 -0
- package/dist/locale/storage/index.js.map +1 -0
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/options.d.ts +3 -0
- package/dist/main/options.js +7 -0
- package/dist/main/options.js.map +1 -0
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +1 -2
- package/dist/main/relay.js +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +1 -4
- package/dist/main/sandbox.js +2 -1
- package/dist/main/sandbox.js.map +1 -1
- package/dist/main/service.d.ts +1 -2
- package/dist/main/service.js.map +1 -1
- package/dist/main/sidebar.d.ts +2 -5
- package/dist/main/sidebar.js +3 -3
- package/dist/main/sidebar.js.map +1 -1
- package/dist/message/index.d.ts +2 -4
- package/dist/message/index.js.map +1 -1
- package/dist/offscreen/index.d.ts +2 -6
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/index.d.ts +2 -5
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/service/index.d.ts +2 -6
- package/dist/service/index.js.map +1 -1
- package/dist/shared/content/index.d.ts +1 -0
- package/dist/shared/content/index.js +6 -0
- package/dist/shared/content/index.js.map +1 -0
- package/dist/shared/content/isolation.d.ts +4 -0
- package/dist/shared/content/isolation.js +70 -0
- package/dist/shared/content/isolation.js.map +1 -0
- package/dist/shared/locale/index.d.ts +5 -0
- package/dist/shared/locale/index.js +21 -0
- package/dist/shared/locale/index.js.map +1 -0
- package/dist/shared/locale/keys.d.ts +5 -0
- package/dist/shared/locale/keys.js +33 -0
- package/dist/shared/locale/keys.js.map +1 -0
- package/dist/shared/locale/language.d.ts +4 -0
- package/dist/shared/locale/language.js +23 -0
- package/dist/shared/locale/language.js.map +1 -0
- package/dist/shared/locale/messages.d.ts +3 -0
- package/dist/shared/locale/messages.js +9 -0
- package/dist/shared/locale/messages.js.map +1 -0
- package/dist/shared/locale/plural.d.ts +2 -0
- package/dist/shared/locale/plural.js +81 -0
- package/dist/shared/locale/plural.js.map +1 -0
- package/dist/shared/locale/substitutions.d.ts +10 -0
- package/dist/shared/locale/substitutions.js +32 -0
- package/dist/shared/locale/substitutions.js.map +1 -0
- package/dist/types/background.d.ts +1 -1
- package/dist/types/background.js.map +1 -1
- package/dist/types/command.d.ts +1 -1
- package/dist/types/command.js.map +1 -1
- package/dist/types/content.d.ts +120 -31
- package/dist/types/content.js +22 -1
- package/dist/types/content.js.map +1 -1
- package/dist/types/entrypoint.d.ts +20 -0
- package/dist/types/entrypoint.js +4 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js.map +1 -1
- package/dist/types/language.d.ts +57 -0
- package/dist/types/language.js +62 -0
- package/dist/types/language.js.map +1 -0
- package/dist/types/locale.d.ts +34 -63
- package/dist/types/locale.js +62 -119
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +24 -7
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/options.d.ts +9 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/page.d.ts +8 -0
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +16 -7
- package/dist/types/relay.js.map +1 -1
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/sandbox.js.map +1 -1
- package/dist/types/service.d.ts +10 -1
- package/dist/types/service.js.map +1 -1
- package/dist/types/sidebar.d.ts +9 -0
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/virtual/entrypoint.d.ts +5 -0
- package/dist/virtual/entrypoint.js +7 -0
- package/dist/virtual/entrypoint.js.map +1 -0
- package/dist/virtual/icon.d.ts +2 -0
- package/dist/virtual/icon.js +5 -0
- package/dist/virtual/icon.js.map +1 -0
- package/dist/virtual/locale.d.ts +7 -0
- package/dist/virtual/locale.js +13 -0
- package/dist/virtual/locale.js.map +1 -0
- package/dist/virtual/modules.d.ts +40 -0
- package/dist/virtual/offscreen.d.ts +3 -0
- package/dist/virtual/offscreen.js +5 -0
- package/dist/virtual/offscreen.js.map +1 -0
- package/dist/virtual/page.d.ts +2 -0
- package/dist/virtual/page.js +5 -0
- package/dist/virtual/page.js.map +1 -0
- package/dist/virtual/popup.d.ts +3 -0
- package/dist/virtual/popup.js +5 -0
- package/dist/virtual/popup.js.map +1 -0
- package/dist/virtual/relay.d.ts +3 -0
- package/dist/virtual/relay.js +5 -0
- package/dist/virtual/relay.js.map +1 -0
- package/dist/virtual/sandbox.d.ts +3 -0
- package/dist/virtual/sandbox.js +5 -0
- package/dist/virtual/sandbox.js.map +1 -0
- package/dist/virtual/sidebar.d.ts +3 -0
- package/dist/virtual/sidebar.js +5 -0
- package/dist/virtual/sidebar.js.map +1 -0
- package/package.json +31 -10
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/types/client.d.ts +15 -0
- package/dist/cli/builders/manifest/utils.d.ts +0 -32
- package/dist/cli/builders/manifest/utils.js +0 -209
- package/dist/cli/builders/manifest/utils.js.map +0 -1
- package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
- package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
- package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
- package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
- package/dist/cli/entrypoint/finder/AbstractOptionsFinder.js.map +0 -1
- package/dist/entry/content/core/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/Context.js.map +0 -1
- package/dist/entry/content/core/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/EventNode.js.map +0 -1
- package/dist/entry/content/core/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/MountNode.js.map +0 -1
- package/dist/entry/content/core/Node.js.map +0 -1
- package/dist/entry/content/core/WeakMarker.js.map +0 -1
- package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
- package/dist/locale/adapters/react/LocaleProvider.js +0 -58
- package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
- package/dist/locale/adapters/react/context.d.ts +0 -14
- package/dist/locale/adapters/react/context.js +0 -25
- package/dist/locale/adapters/react/context.js.map +0 -1
- package/dist/locale/utils.d.ts +0 -11
- package/dist/locale/utils.js +0 -67
- package/dist/locale/utils.js.map +0 -1
- /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
- /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
- /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
- /package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.d.ts → AbstractParsedFinder.d.ts} +0 -0
- /package/dist/entry/content/core/{ManagedContext.js → context/ManagedContext.js} +0 -0
- /package/dist/entry/content/core/{AttributeMarker.js → markers/AttributeMarker.js} +0 -0
- /package/dist/entry/content/core/{WeakMarker.js → markers/WeakMarker.js} +0 -0
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
import { Compilation, RuntimeGlobals, RuntimeModule, sources } from "@rspack/core";
|
|
2
|
+
import stringify from "json-stringify-deterministic";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { collectBuildAssets, setCompilationBuildAssets } from "./../../../../cli/bundler/utils/output.js";
|
|
5
|
+
import {
|
|
6
|
+
CssContentHashType,
|
|
7
|
+
JavaScriptContentHashType,
|
|
8
|
+
resolveChunkFilename,
|
|
9
|
+
resolveFilenameTemplate,
|
|
10
|
+
filenameRequiresFullHash
|
|
11
|
+
} from "./../../../../cli/bundler/utils/chunk-filename.js";
|
|
12
|
+
import { toPosix } from "./../../../../cli/utils/path.js";
|
|
13
|
+
import { trackModuleUsage } from "./usage.js";
|
|
14
|
+
const PluginName = "BuildAssetsMapPlugin";
|
|
15
|
+
const FullMapPlaceholder = "__ADNBN_BUILD_ASSETS_FULL_MAP_PLACEHOLDER__";
|
|
16
|
+
const FullMapEnvelopeKey = "__adnbnBuildAssetsFullMap__";
|
|
17
|
+
const CurrentMapEnvelopeKey = "__adnbnBuildAssetsCurrentMap__";
|
|
18
|
+
const EmbedStage = Number.NEGATIVE_INFINITY;
|
|
19
|
+
const FinalValidationStage = Infinity;
|
|
20
|
+
const validateAsyncChunkFilenames = (compilation, cssChunkFilename) => {
|
|
21
|
+
const asyncChunks = new Set(
|
|
22
|
+
Array.from(compilation.entrypoints.values()).flatMap((entrypoint) => {
|
|
23
|
+
return Array.from(entrypoint.getEntrypointChunk().getAllAsyncChunks());
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
const validate = (filename, chunks, contentHashType, assetType, configName) => {
|
|
27
|
+
if (typeof filename !== "function") {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const returnsFullHash = Array.from(chunks).some((chunk) => {
|
|
31
|
+
const template = resolveFilenameTemplate(compilation, chunk, filename, contentHashType);
|
|
32
|
+
return /\[(?:fullhash|hash)(?::\d+)?\]/i.test(template);
|
|
33
|
+
});
|
|
34
|
+
if (returnsFullHash) {
|
|
35
|
+
const target = assetType === "JavaScript" ? "async chunk URLs" : "async CSS chunk URLs";
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Rspack cannot generate ${target} when a filename callback returns [fullhash]; configure ${configName} as a string template instead`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
if (compilation.outputOptions.chunkFilename) {
|
|
42
|
+
validate(
|
|
43
|
+
compilation.outputOptions.chunkFilename,
|
|
44
|
+
asyncChunks,
|
|
45
|
+
JavaScriptContentHashType,
|
|
46
|
+
"JavaScript",
|
|
47
|
+
"jsFilename"
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
validate(
|
|
51
|
+
cssChunkFilename,
|
|
52
|
+
Array.from(asyncChunks).filter((chunk) => chunkHasCss(compilation, chunk)),
|
|
53
|
+
CssContentHashType,
|
|
54
|
+
"CSS",
|
|
55
|
+
"cssFilename"
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
const chunkHasCss = (compilation, chunk) => {
|
|
59
|
+
return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some((module) => {
|
|
60
|
+
return module.type === CssContentHashType;
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const chunkHasJavaScript = (compilation, chunk) => {
|
|
64
|
+
if (chunk.hasRuntime()) return true;
|
|
65
|
+
return Array.from(compilation.chunkGraph.getChunkModulesIterable(chunk)).some((module) => {
|
|
66
|
+
return module.type.startsWith("javascript");
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const getEntrypointRuntimeAssets = (compilation, name, cssFilename, cssChunkFilename) => {
|
|
70
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
71
|
+
if (!entrypoint) {
|
|
72
|
+
throw new Error(`Build assets entrypoint "${name}" is unavailable`);
|
|
73
|
+
}
|
|
74
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
75
|
+
const initialChunks = Array.from(entrypoint.chunks);
|
|
76
|
+
const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());
|
|
77
|
+
const jsFilename = compilation.outputOptions.filename;
|
|
78
|
+
const jsChunkFilename = compilation.outputOptions.chunkFilename;
|
|
79
|
+
if (!jsFilename || !jsChunkFilename) {
|
|
80
|
+
throw new Error("Build assets require output.filename and output.chunkFilename");
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
initial: {
|
|
84
|
+
js: initialChunks.filter((chunk) => chunkHasJavaScript(compilation, chunk)).map((chunk) => {
|
|
85
|
+
return resolveChunkFilename(
|
|
86
|
+
compilation,
|
|
87
|
+
chunk,
|
|
88
|
+
chunk === entryChunk ? jsFilename : jsChunkFilename,
|
|
89
|
+
JavaScriptContentHashType
|
|
90
|
+
);
|
|
91
|
+
}),
|
|
92
|
+
css: initialChunks.filter((chunk) => chunkHasCss(compilation, chunk)).map((chunk) => {
|
|
93
|
+
return resolveChunkFilename(
|
|
94
|
+
compilation,
|
|
95
|
+
chunk,
|
|
96
|
+
chunk === entryChunk ? cssFilename : cssChunkFilename,
|
|
97
|
+
CssContentHashType
|
|
98
|
+
);
|
|
99
|
+
})
|
|
100
|
+
},
|
|
101
|
+
async: {
|
|
102
|
+
js: asyncChunks.filter((chunk) => chunkHasJavaScript(compilation, chunk)).map((chunk) => {
|
|
103
|
+
return resolveChunkFilename(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);
|
|
104
|
+
}),
|
|
105
|
+
css: asyncChunks.filter((chunk) => chunkHasCss(compilation, chunk)).map((chunk) => {
|
|
106
|
+
return resolveChunkFilename(compilation, chunk, cssChunkFilename, CssContentHashType);
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const entrypointRuntimeUsesFullHash = (compilation, name, cssFilename, cssChunkFilename) => {
|
|
112
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
113
|
+
if (!entrypoint) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
117
|
+
const initialChunks = Array.from(entrypoint.chunks);
|
|
118
|
+
const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());
|
|
119
|
+
const jsFilename = compilation.outputOptions.filename;
|
|
120
|
+
const jsChunkFilename = compilation.outputOptions.chunkFilename;
|
|
121
|
+
if (!jsFilename || !jsChunkFilename) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return initialChunks.some((chunk) => {
|
|
125
|
+
const js = filenameRequiresFullHash(
|
|
126
|
+
compilation,
|
|
127
|
+
chunk,
|
|
128
|
+
chunk === entryChunk ? jsFilename : jsChunkFilename,
|
|
129
|
+
JavaScriptContentHashType
|
|
130
|
+
);
|
|
131
|
+
const css = chunkHasCss(compilation, chunk) && filenameRequiresFullHash(
|
|
132
|
+
compilation,
|
|
133
|
+
chunk,
|
|
134
|
+
chunk === entryChunk ? cssFilename : cssChunkFilename,
|
|
135
|
+
CssContentHashType
|
|
136
|
+
);
|
|
137
|
+
return js || css;
|
|
138
|
+
}) || asyncChunks.some((chunk) => {
|
|
139
|
+
const js = filenameRequiresFullHash(compilation, chunk, jsChunkFilename, JavaScriptContentHashType);
|
|
140
|
+
const css = chunkHasCss(compilation, chunk) && filenameRequiresFullHash(compilation, chunk, cssChunkFilename, CssContentHashType);
|
|
141
|
+
return js || css;
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
const getChunkKey = (chunk) => {
|
|
145
|
+
return `${String(chunk.name ?? "")}:${String(chunk.id ?? "")}`;
|
|
146
|
+
};
|
|
147
|
+
const getFullMapRuntime = (compilation, name, runtimes) => {
|
|
148
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
149
|
+
if (!entrypoint || !runtimes.has(entrypoint.getRuntimeChunk())) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
return { name, runtime: entrypoint.getRuntimeChunk() };
|
|
153
|
+
};
|
|
154
|
+
const getFullMapRuntimeFiles = (fullMap, assets) => {
|
|
155
|
+
const runtimeFiles = new Set(Array.from(fullMap.runtime.files, toPosix));
|
|
156
|
+
return assets[fullMap.name].initial.js.filter((file) => runtimeFiles.has(file));
|
|
157
|
+
};
|
|
158
|
+
const validateEntrypointRuntime = (compilation, name) => {
|
|
159
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
160
|
+
if (entrypoint.getRuntimeChunk() !== entrypoint.getEntrypointChunk()) {
|
|
161
|
+
throw new Error(
|
|
162
|
+
`Build assets require a self-contained runtime for entrypoint "${name}"; disable optimization.runtimeChunk`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const validateFullMapEntrypoint = (compilation, name) => {
|
|
167
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
168
|
+
if (!entrypoint) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
172
|
+
const initialChunks = Array.from(entrypoint.chunks);
|
|
173
|
+
const asyncChunks = Array.from(entryChunk.getAllAsyncChunks());
|
|
174
|
+
if (initialChunks.length !== 1 || initialChunks[0] !== entryChunk || asyncChunks.length > 0) {
|
|
175
|
+
throw new Error(
|
|
176
|
+
`Full build-assets entrypoint "${name}" must be a single self-contained chunk; async chunks are not supported`
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const validateFullMapAssets = (assets, name) => {
|
|
181
|
+
const entrypoint = assets[name];
|
|
182
|
+
if (!entrypoint) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (entrypoint.initial.js.length !== 1 || entrypoint.async.js.length > 0) {
|
|
186
|
+
throw new Error(
|
|
187
|
+
`Full build-assets entrypoint "${name}" must emit exactly one initial JavaScript file and no async JavaScript files`
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const serializeFilename = (filename) => {
|
|
192
|
+
return typeof filename === "function" ? filename.toString() : JSON.stringify(filename);
|
|
193
|
+
};
|
|
194
|
+
const collectRuntimeModuleFingerprints = (compilation) => {
|
|
195
|
+
const fingerprints = /* @__PURE__ */ new Map();
|
|
196
|
+
compilation.hooks.runtimeModule.tap(PluginName, (runtimeModule, chunk) => {
|
|
197
|
+
if (runtimeModule.identifier().startsWith("webpack/runtime/build assets ")) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
let chunkFingerprints = fingerprints.get(chunk);
|
|
201
|
+
if (!chunkFingerprints) {
|
|
202
|
+
chunkFingerprints = /* @__PURE__ */ new Map();
|
|
203
|
+
fingerprints.set(chunk, chunkFingerprints);
|
|
204
|
+
}
|
|
205
|
+
chunkFingerprints.set(`${runtimeModule.stage}:${runtimeModule.identifier()}`, runtimeModule.generate());
|
|
206
|
+
});
|
|
207
|
+
return fingerprints;
|
|
208
|
+
};
|
|
209
|
+
const updateBuildAssetsChunkHashes = (compilation, options, runtimeModuleFingerprints, runtimes) => {
|
|
210
|
+
compilation.hooks.chunkHash.tap(PluginName, (chunk, hash) => {
|
|
211
|
+
if (!runtimes.has(chunk)) return;
|
|
212
|
+
const runtimeEntry = Array.from(compilation.entrypoints).find(([, entrypoint]) => {
|
|
213
|
+
return entrypoint.getRuntimeChunk() === chunk;
|
|
214
|
+
});
|
|
215
|
+
if (!runtimeEntry) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const [runtimeName] = runtimeEntry;
|
|
219
|
+
const fullMap = runtimeName === options.fullMapEntrypoint;
|
|
220
|
+
const entries = fullMap ? Array.from(compilation.entrypoints).toSorted(([left], [right]) => left.localeCompare(right)) : [runtimeEntry];
|
|
221
|
+
hash.update(`${PluginName}:runtime-map:${runtimeName}`, "utf8");
|
|
222
|
+
hash.update(options.buildHashSalt, "utf8");
|
|
223
|
+
hash.update(serializeFilename(compilation.outputOptions.filename), "utf8");
|
|
224
|
+
hash.update(serializeFilename(compilation.outputOptions.chunkFilename), "utf8");
|
|
225
|
+
hash.update(serializeFilename(options.cssFilename), "utf8");
|
|
226
|
+
hash.update(serializeFilename(options.cssChunkFilename), "utf8");
|
|
227
|
+
if (fullMap) {
|
|
228
|
+
hash.update(serializeFilename(compilation.outputOptions.assetModuleFilename), "utf8");
|
|
229
|
+
}
|
|
230
|
+
for (const [entryName, entrypoint] of entries) {
|
|
231
|
+
hash.update(entryName, "utf8");
|
|
232
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
233
|
+
const initialChunks = new Set(entrypoint.chunks);
|
|
234
|
+
const chunks = Array.from(entryChunk.getAllReferencedChunks()).toSorted(
|
|
235
|
+
(left, right) => getChunkKey(left).localeCompare(getChunkKey(right))
|
|
236
|
+
);
|
|
237
|
+
for (const referencedChunk of chunks) {
|
|
238
|
+
const category = initialChunks.has(referencedChunk) ? "initial" : "async";
|
|
239
|
+
hash.update(`${category}:${getChunkKey(referencedChunk)}`, "utf8");
|
|
240
|
+
const jsFilename = referencedChunk === entryChunk ? compilation.outputOptions.filename : compilation.outputOptions.chunkFilename;
|
|
241
|
+
if (jsFilename) {
|
|
242
|
+
const template = resolveFilenameTemplate(
|
|
243
|
+
compilation,
|
|
244
|
+
referencedChunk,
|
|
245
|
+
jsFilename,
|
|
246
|
+
JavaScriptContentHashType
|
|
247
|
+
);
|
|
248
|
+
hash.update(`javascript-template:${template}`, "utf8");
|
|
249
|
+
}
|
|
250
|
+
if (chunkHasCss(compilation, referencedChunk)) {
|
|
251
|
+
const cssFilename = referencedChunk === entryChunk ? options.cssFilename : options.cssChunkFilename;
|
|
252
|
+
const template = resolveFilenameTemplate(
|
|
253
|
+
compilation,
|
|
254
|
+
referencedChunk,
|
|
255
|
+
cssFilename,
|
|
256
|
+
CssContentHashType
|
|
257
|
+
);
|
|
258
|
+
hash.update(`css-template:${template}`, "utf8");
|
|
259
|
+
}
|
|
260
|
+
const moduleHashes = Array.from(
|
|
261
|
+
compilation.chunkGraph.getChunkModulesIterable(referencedChunk),
|
|
262
|
+
(module) => {
|
|
263
|
+
return compilation.chunkGraph.getModuleHash(module, new Set(referencedChunk.runtime)) ?? "";
|
|
264
|
+
}
|
|
265
|
+
).toSorted();
|
|
266
|
+
moduleHashes.forEach((moduleHash) => hash.update(moduleHash, "utf8"));
|
|
267
|
+
const runtimeFingerprints = runtimeModuleFingerprints.get(referencedChunk);
|
|
268
|
+
if (runtimeFingerprints) {
|
|
269
|
+
Array.from(runtimeFingerprints).toSorted(([left], [right]) => left.localeCompare(right)).forEach(([identifier, source]) => {
|
|
270
|
+
hash.update(`runtime-module:${identifier}`, "utf8");
|
|
271
|
+
hash.update(source, "utf8");
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
class BuildAssetsRuntimeModule extends RuntimeModule {
|
|
279
|
+
constructor(fullMap, runtimeName, property, cssFilename, cssChunkFilename, fullHash) {
|
|
280
|
+
super(`build assets ${fullMap ? "full" : "current"} ${runtimeName}`, RuntimeModule.STAGE_TRIGGER);
|
|
281
|
+
this.fullMap = fullMap;
|
|
282
|
+
this.runtimeName = runtimeName;
|
|
283
|
+
this.property = property;
|
|
284
|
+
this.cssFilename = cssFilename;
|
|
285
|
+
this.cssChunkFilename = cssChunkFilename;
|
|
286
|
+
if (!fullMap) {
|
|
287
|
+
this.dependentHash = true;
|
|
288
|
+
this.fullHash = fullHash;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
fullMap;
|
|
292
|
+
runtimeName;
|
|
293
|
+
property;
|
|
294
|
+
cssFilename;
|
|
295
|
+
cssChunkFilename;
|
|
296
|
+
generate() {
|
|
297
|
+
const runtime = RuntimeGlobals.require;
|
|
298
|
+
if (this.fullMap) {
|
|
299
|
+
return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(FullMapPlaceholder)}).${FullMapEnvelopeKey};`;
|
|
300
|
+
}
|
|
301
|
+
const compilation = this.compilation;
|
|
302
|
+
if (!compilation) {
|
|
303
|
+
throw new Error("Build assets runtime is not attached to a compilation");
|
|
304
|
+
}
|
|
305
|
+
const current = getEntrypointRuntimeAssets(
|
|
306
|
+
compilation,
|
|
307
|
+
this.runtimeName,
|
|
308
|
+
this.cssFilename,
|
|
309
|
+
this.cssChunkFilename
|
|
310
|
+
);
|
|
311
|
+
const envelope = JSON.stringify({ [CurrentMapEnvelopeKey]: current });
|
|
312
|
+
return `${runtime}[${JSON.stringify(this.property)}] = JSON.parse(${JSON.stringify(envelope)}).${CurrentMapEnvelopeKey};`;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
const replaceFullMapPlaceholder = (compilation, runtimeFiles, assets) => {
|
|
316
|
+
const placeholder = JSON.stringify(FullMapPlaceholder);
|
|
317
|
+
const replacementValue = JSON.stringify(JSON.stringify({ [FullMapEnvelopeKey]: assets }));
|
|
318
|
+
let replacements = 0;
|
|
319
|
+
for (const file of runtimeFiles) {
|
|
320
|
+
const asset = compilation.getAsset(file);
|
|
321
|
+
if (!asset) {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
const code = asset.source.source().toString();
|
|
325
|
+
const start = code.indexOf(placeholder);
|
|
326
|
+
if (start < 0) {
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
if (code.indexOf(placeholder, start + placeholder.length) >= 0) {
|
|
330
|
+
throw new Error(`Build assets placeholder occurs more than once in "${file}"`);
|
|
331
|
+
}
|
|
332
|
+
const source = new sources.ReplaceSource(asset.source);
|
|
333
|
+
source.replace(start, start + placeholder.length - 1, replacementValue);
|
|
334
|
+
compilation.updateAsset(file, source);
|
|
335
|
+
replacements += 1;
|
|
336
|
+
}
|
|
337
|
+
if (replacements !== 1) {
|
|
338
|
+
throw new Error(`Expected one full build-assets runtime, found ${replacements}`);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const extractEmbeddedEnvelope = (file, source, key) => {
|
|
342
|
+
const sourceFile = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);
|
|
343
|
+
const values = [];
|
|
344
|
+
const visit = (node) => {
|
|
345
|
+
if (ts.isStringLiteralLike(node) && node.text.includes(key)) {
|
|
346
|
+
try {
|
|
347
|
+
const envelope = JSON.parse(node.text);
|
|
348
|
+
if (Object.prototype.hasOwnProperty.call(envelope, key)) {
|
|
349
|
+
values.push(envelope[key]);
|
|
350
|
+
}
|
|
351
|
+
} catch {
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
ts.forEachChild(node, visit);
|
|
355
|
+
};
|
|
356
|
+
visit(sourceFile);
|
|
357
|
+
if (values.length !== 1) {
|
|
358
|
+
throw new Error(`Expected one embedded build assets value in "${file}", found ${values.length}`);
|
|
359
|
+
}
|
|
360
|
+
return values[0];
|
|
361
|
+
};
|
|
362
|
+
const extractEmbeddedMap = (file, source) => {
|
|
363
|
+
return extractEmbeddedEnvelope(file, source, FullMapEnvelopeKey);
|
|
364
|
+
};
|
|
365
|
+
const validateEmbeddedMap = (compilation, fullMap, assets) => {
|
|
366
|
+
const runtimeFiles = getFullMapRuntimeFiles(fullMap, assets);
|
|
367
|
+
const runtime = runtimeFiles.map((file) => {
|
|
368
|
+
var _a;
|
|
369
|
+
return { file, source: ((_a = compilation.getAsset(file)) == null ? void 0 : _a.source.source().toString()) ?? "" };
|
|
370
|
+
}).find(({ source }) => source.length > 0);
|
|
371
|
+
if (!runtime) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`Full build-assets runtime for entrypoint "${fullMap.name}" is unavailable after asset processing`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
const embedded = extractEmbeddedMap(runtime.file, runtime.source);
|
|
377
|
+
if (stringify(embedded) !== stringify(assets)) {
|
|
378
|
+
throw new Error(
|
|
379
|
+
"Build assets changed after the runtime map was embedded; finalize entrypoint assets before processAssets begins"
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const validateCurrentEntrypointMaps = (compilation, assets, fullMapEntrypoint, runtimes) => {
|
|
384
|
+
for (const [name, entrypointAssets] of Object.entries(assets)) {
|
|
385
|
+
if (name === fullMapEntrypoint) {
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
const entrypoint = compilation.entrypoints.get(name);
|
|
389
|
+
if (!entrypoint) {
|
|
390
|
+
throw new Error(`Build assets entrypoint "${name}" is unavailable`);
|
|
391
|
+
}
|
|
392
|
+
if (!runtimes.has(entrypoint.getRuntimeChunk())) continue;
|
|
393
|
+
const runtimeFiles = new Set(Array.from(entrypoint.getRuntimeChunk().files, toPosix));
|
|
394
|
+
const runtime = entrypointAssets.initial.js.filter((file) => runtimeFiles.has(file)).map((file) => {
|
|
395
|
+
var _a;
|
|
396
|
+
return { file, source: ((_a = compilation.getAsset(file)) == null ? void 0 : _a.source.source().toString()) ?? "" };
|
|
397
|
+
}).find(({ source }) => source.length > 0);
|
|
398
|
+
if (!runtime) {
|
|
399
|
+
throw new Error(`Runtime map for entrypoint "${name}" is unavailable after asset processing`);
|
|
400
|
+
}
|
|
401
|
+
const runtimeAssets = extractEmbeddedEnvelope(
|
|
402
|
+
runtime.file,
|
|
403
|
+
runtime.source,
|
|
404
|
+
CurrentMapEnvelopeKey
|
|
405
|
+
);
|
|
406
|
+
const finalizedAssets = {
|
|
407
|
+
initial: entrypointAssets.initial,
|
|
408
|
+
async: entrypointAssets.async
|
|
409
|
+
};
|
|
410
|
+
if (stringify(runtimeAssets) !== stringify(finalizedAssets)) {
|
|
411
|
+
throw new Error(
|
|
412
|
+
`Build assets changed after the runtime map for entrypoint "${name}" was embedded: ${JSON.stringify({ embedded: runtimeAssets, finalized: finalizedAssets })}`
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
const finalizeBuildAssets = (compilation, options, runtimes) => {
|
|
418
|
+
const assets = collectBuildAssets(compilation);
|
|
419
|
+
const fullMap = getFullMapRuntime(compilation, options.fullMapEntrypoint, runtimes);
|
|
420
|
+
if (fullMap) {
|
|
421
|
+
validateFullMapAssets(assets, options.fullMapEntrypoint);
|
|
422
|
+
validateEmbeddedMap(compilation, fullMap, assets);
|
|
423
|
+
}
|
|
424
|
+
validateCurrentEntrypointMaps(compilation, assets, options.fullMapEntrypoint, runtimes);
|
|
425
|
+
setCompilationBuildAssets(compilation, assets);
|
|
426
|
+
};
|
|
427
|
+
class BuildAssetsMapPlugin {
|
|
428
|
+
options;
|
|
429
|
+
constructor(options) {
|
|
430
|
+
this.options = {
|
|
431
|
+
...options,
|
|
432
|
+
buildHashSalt: options.buildHashSalt ?? ""
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
apply(compiler) {
|
|
436
|
+
const runtimeSelections = /* @__PURE__ */ new WeakMap();
|
|
437
|
+
compiler.hooks.thisCompilation.tap({ name: PluginName, stage: EmbedStage }, (compilation) => {
|
|
438
|
+
const injectedRuntimes = /* @__PURE__ */ new Set();
|
|
439
|
+
runtimeSelections.set(compilation, injectedRuntimes);
|
|
440
|
+
let filenamesValidated = false;
|
|
441
|
+
let selectedRuntimes;
|
|
442
|
+
const runtimeModuleFingerprints = collectRuntimeModuleFingerprints(compilation);
|
|
443
|
+
const isUsed = trackModuleUsage(compiler, compilation, this.options.module);
|
|
444
|
+
updateBuildAssetsChunkHashes(compilation, this.options, runtimeModuleFingerprints, injectedRuntimes);
|
|
445
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap(PluginName, (chunk, requirements) => {
|
|
446
|
+
if (!selectedRuntimes) {
|
|
447
|
+
selectedRuntimes = /* @__PURE__ */ new Map();
|
|
448
|
+
for (const [name, entrypoint] of compilation.entrypoints) {
|
|
449
|
+
const runtime = entrypoint.getRuntimeChunk();
|
|
450
|
+
const fullMap = name === this.options.fullMapEntrypoint;
|
|
451
|
+
const delivery = fullMap ? this.options.module.full : this.options.module.current;
|
|
452
|
+
if (!isUsed(runtime, delivery.export)) continue;
|
|
453
|
+
validateEntrypointRuntime(compilation, name);
|
|
454
|
+
if (fullMap) validateFullMapEntrypoint(compilation, name);
|
|
455
|
+
selectedRuntimes.set(runtime, { name, fullMap, property: delivery.property });
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
if (!filenamesValidated) {
|
|
459
|
+
validateAsyncChunkFilenames(compilation, this.options.cssChunkFilename);
|
|
460
|
+
filenamesValidated = true;
|
|
461
|
+
}
|
|
462
|
+
const selection = selectedRuntimes.get(chunk);
|
|
463
|
+
if (!selection || injectedRuntimes.has(chunk)) return;
|
|
464
|
+
requirements.add(RuntimeGlobals.require);
|
|
465
|
+
injectedRuntimes.add(chunk);
|
|
466
|
+
compilation.addRuntimeModule(
|
|
467
|
+
chunk,
|
|
468
|
+
new BuildAssetsRuntimeModule(
|
|
469
|
+
selection.fullMap,
|
|
470
|
+
selection.name,
|
|
471
|
+
selection.property,
|
|
472
|
+
this.options.cssFilename,
|
|
473
|
+
this.options.cssChunkFilename,
|
|
474
|
+
entrypointRuntimeUsesFullHash(
|
|
475
|
+
compilation,
|
|
476
|
+
selection.name,
|
|
477
|
+
this.options.cssFilename,
|
|
478
|
+
this.options.cssChunkFilename
|
|
479
|
+
)
|
|
480
|
+
)
|
|
481
|
+
);
|
|
482
|
+
});
|
|
483
|
+
compilation.hooks.processAssets.tap(
|
|
484
|
+
{
|
|
485
|
+
name: PluginName,
|
|
486
|
+
stage: EmbedStage
|
|
487
|
+
},
|
|
488
|
+
() => {
|
|
489
|
+
const assets = collectBuildAssets(compilation);
|
|
490
|
+
const fullMap = getFullMapRuntime(compilation, this.options.fullMapEntrypoint, injectedRuntimes);
|
|
491
|
+
setCompilationBuildAssets(compilation, assets);
|
|
492
|
+
if (fullMap) {
|
|
493
|
+
validateFullMapAssets(assets, this.options.fullMapEntrypoint);
|
|
494
|
+
replaceFullMapPlaceholder(compilation, getFullMapRuntimeFiles(fullMap, assets), assets);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
);
|
|
498
|
+
compilation.hooks.processAssets.tap(
|
|
499
|
+
{
|
|
500
|
+
name: `${PluginName}:finalize`,
|
|
501
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_ANALYSE
|
|
502
|
+
},
|
|
503
|
+
() => finalizeBuildAssets(compilation, this.options, injectedRuntimes)
|
|
504
|
+
);
|
|
505
|
+
});
|
|
506
|
+
compiler.hooks.afterPlugins.intercept({
|
|
507
|
+
name: `${PluginName}:registerFinalValidation`,
|
|
508
|
+
done: () => {
|
|
509
|
+
compiler.hooks.emit.tap(
|
|
510
|
+
{ name: `${PluginName}:finalValidation`, stage: FinalValidationStage },
|
|
511
|
+
(compilation) => {
|
|
512
|
+
const runtimes = runtimeSelections.get(compilation);
|
|
513
|
+
if (runtimes) finalizeBuildAssets(compilation, this.options, runtimes);
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
export {
|
|
521
|
+
BuildAssetsMapPlugin as default
|
|
522
|
+
};
|
|
523
|
+
//# sourceMappingURL=BuildAssetsMapPlugin.js.map
|
|
@@ -0,0 +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, setCompilationBuildAssets} from \"@cli/bundler/utils/output\";\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,oBAAoB,iCAAgC;AAC5D;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,KAAK,YAAY,YAAY,OAAO,CAAC,EAAE,QAAQ,gBAAc;AAC/D,aAAO,MAAM,KAAK,WAAW,mBAAmB,EAAE,kBAAkB,CAAC;AAAA,IACzE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C;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":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const EntrypointAssetsModule: {
|
|
2
|
+
request: string;
|
|
3
|
+
current: {
|
|
4
|
+
export: string;
|
|
5
|
+
property: string;
|
|
6
|
+
};
|
|
7
|
+
full: {
|
|
8
|
+
export: string;
|
|
9
|
+
property: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/** Readers keep runtime data live without capturing a snapshot during module evaluation. */
|
|
13
|
+
export declare const createEntrypointModule: () => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RuntimeGlobals } from "@rspack/core";
|
|
2
|
+
import { EntrypointAssetsMapRuntimeProperty, EntrypointAssetsRuntimeProperty } from "./../../../../types/entrypoint.js";
|
|
3
|
+
const EntrypointAssetsModule = {
|
|
4
|
+
request: "#adnbn/entrypoint",
|
|
5
|
+
current: { export: "readAssets", property: EntrypointAssetsRuntimeProperty },
|
|
6
|
+
full: { export: "readAssetsMap", property: EntrypointAssetsMapRuntimeProperty }
|
|
7
|
+
};
|
|
8
|
+
const createEntrypointModule = () => [EntrypointAssetsModule.current, EntrypointAssetsModule.full].map(
|
|
9
|
+
({ export: name, property }) => `export const ${name} = () => ${RuntimeGlobals.require}[${JSON.stringify(property)}];
|
|
10
|
+
`
|
|
11
|
+
).join("");
|
|
12
|
+
export {
|
|
13
|
+
EntrypointAssetsModule,
|
|
14
|
+
createEntrypointModule
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=entrypoint-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/build-assets-map/entrypoint-module.ts"],"sourcesContent":["import {RuntimeGlobals} from \"@rspack/core\";\n\nimport {EntrypointAssetsMapRuntimeProperty, EntrypointAssetsRuntimeProperty} from \"@typing/entrypoint\";\n\nimport type {BuildAssetsMapPluginModuleOptions} from \"./usage\";\n\nexport const EntrypointAssetsModule = {\n request: \"#adnbn/entrypoint\",\n current: {export: \"readAssets\", property: EntrypointAssetsRuntimeProperty},\n full: {export: \"readAssetsMap\", property: EntrypointAssetsMapRuntimeProperty},\n} satisfies BuildAssetsMapPluginModuleOptions;\n\n/** Readers keep runtime data live without capturing a snapshot during module evaluation. */\nexport const createEntrypointModule = (): string =>\n [EntrypointAssetsModule.current, EntrypointAssetsModule.full]\n .map(\n ({export: name, property}) =>\n `export const ${name} = () => ${RuntimeGlobals.require}[${JSON.stringify(property)}];\\n`\n )\n .join(\"\");\n"],"mappings":"AAAA,SAAQ,sBAAqB;AAE7B,SAAQ,oCAAoC,uCAAsC;AAI3E,MAAM,yBAAyB;AAAA,EAClC,SAAS;AAAA,EACT,SAAS,EAAC,QAAQ,cAAc,UAAU,gCAA+B;AAAA,EACzE,MAAM,EAAC,QAAQ,iBAAiB,UAAU,mCAAkC;AAChF;AAGO,MAAM,yBAAyB,MAClC,CAAC,uBAAuB,SAAS,uBAAuB,IAAI,EACvD;AAAA,EACG,CAAC,EAAC,QAAQ,MAAM,SAAQ,MACpB,gBAAgB,IAAI,YAAY,eAAe,OAAO,IAAI,KAAK,UAAU,QAAQ,CAAC;AAAA;AAC1F,EACC,KAAK,EAAE;","names":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default, type BuildAssetsMapPluginOptions } from "./BuildAssetsMapPlugin.js";
|
|
2
|
+
export { createEntrypointModule, EntrypointAssetsModule } from "./entrypoint-module.js";
|
|
3
|
+
export type { BuildAssetsMapPluginModuleOptions, BuildAssetsMapPluginExportOptions } from "./usage.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as default2 } from "./BuildAssetsMapPlugin.js";
|
|
2
|
+
import { createEntrypointModule, EntrypointAssetsModule } from "./entrypoint-module.js";
|
|
3
|
+
export {
|
|
4
|
+
EntrypointAssetsModule,
|
|
5
|
+
createEntrypointModule,
|
|
6
|
+
default2 as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=index.js.map
|