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
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
export { default as EntrypointPlugin, type EntrypointPluginModules, type EntrypointPluginModule, type EntrypointPluginEntryModules, type EntrypointPluginTemplate, type EntrypointPluginUpdate, } from "./
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
1
|
+
export { default as EntrypointPlugin, type EntrypointPluginEntryOptions, type EntrypointPluginEntryOptionsResolver, type EntrypointPluginModules, type EntrypointPluginModule, type EntrypointPluginEntryModules, type EntrypointPluginTemplate, type EntrypointPluginUpdate, } from "./entrypoint/index.js";
|
|
2
|
+
export { default as ChunkLoaderPlugin, type ChunkLoaderPluginOptions } from "./chunk-loader/index.js";
|
|
3
|
+
export { default as IsolatedStylesPlugin, type IsolatedStylesPluginOptions, type IsolatedStylesPluginFiles, } from "./isolated-styles/index.js";
|
|
4
|
+
export { default as BuildAssetsMapPlugin, type BuildAssetsMapPluginOptions, type BuildAssetsMapPluginModuleOptions, type BuildAssetsMapPluginExportOptions, createEntrypointModule, EntrypointAssetsModule, } from "./build-assets-map/index.js";
|
|
5
|
+
export { default as GenerateJsonPlugin, type GenerateJsonPluginData, type GenerateJsonPluginUpdate, } from "./generate-json/index.js";
|
|
6
|
+
export { GenerateModulePlugin, type GenerateModulePluginDependencies, type GenerateModulePluginDependenciesResolver, type GenerateModulePluginModules, type GenerateModulePluginUpdate, } from "./generate-module/index.js";
|
|
7
|
+
export { default as ManifestPlugin } from "./manifest/index.js";
|
|
8
|
+
export { default as ResourceAccessPlugin, type ResourceAccessPluginOptions, type ResourceAccessPluginRequirement, } from "./resource-access/index.js";
|
|
9
|
+
export { default as ReplacePlugin } from "./replace/index.js";
|
|
10
|
+
export { default as WatchPlugin } from "./watch/index.js";
|
|
11
|
+
export type { RuntimePropertyOptions } from "./types.js";
|
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
default as default2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./entrypoint/index.js";
|
|
4
|
+
import { default as default3 } from "./chunk-loader/index.js";
|
|
4
5
|
import {
|
|
5
|
-
default as
|
|
6
|
-
} from "./
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
default as default4
|
|
7
|
+
} from "./isolated-styles/index.js";
|
|
8
|
+
import {
|
|
9
|
+
default as default5,
|
|
10
|
+
createEntrypointModule,
|
|
11
|
+
EntrypointAssetsModule
|
|
12
|
+
} from "./build-assets-map/index.js";
|
|
13
|
+
import {
|
|
14
|
+
default as default6
|
|
15
|
+
} from "./generate-json/index.js";
|
|
16
|
+
import {
|
|
17
|
+
GenerateModulePlugin
|
|
18
|
+
} from "./generate-module/index.js";
|
|
19
|
+
import { default as default7 } from "./manifest/index.js";
|
|
20
|
+
import {
|
|
21
|
+
default as default8
|
|
22
|
+
} from "./resource-access/index.js";
|
|
23
|
+
import { default as default9 } from "./replace/index.js";
|
|
24
|
+
import { default as default10 } from "./watch/index.js";
|
|
10
25
|
export {
|
|
26
|
+
default5 as BuildAssetsMapPlugin,
|
|
27
|
+
default3 as ChunkLoaderPlugin,
|
|
28
|
+
EntrypointAssetsModule,
|
|
11
29
|
default2 as EntrypointPlugin,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
default6 as GenerateJsonPlugin,
|
|
31
|
+
GenerateModulePlugin,
|
|
32
|
+
default4 as IsolatedStylesPlugin,
|
|
33
|
+
default7 as ManifestPlugin,
|
|
34
|
+
default9 as ReplacePlugin,
|
|
35
|
+
default8 as ResourceAccessPlugin,
|
|
36
|
+
default10 as WatchPlugin,
|
|
37
|
+
createEntrypointModule
|
|
16
38
|
};
|
|
17
39
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/bundler/plugins/index.ts"],"sourcesContent":["export {\n default as EntrypointPlugin,\n type EntrypointPluginModules,\n type EntrypointPluginModule,\n type EntrypointPluginEntryModules,\n type EntrypointPluginTemplate,\n type EntrypointPluginUpdate,\n} from \"./
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/bundler/plugins/index.ts"],"sourcesContent":["export {\n default as EntrypointPlugin,\n type EntrypointPluginEntryOptions,\n type EntrypointPluginEntryOptionsResolver,\n type EntrypointPluginModules,\n type EntrypointPluginModule,\n type EntrypointPluginEntryModules,\n type EntrypointPluginTemplate,\n type EntrypointPluginUpdate,\n} from \"./entrypoint\";\n\nexport {default as ChunkLoaderPlugin, type ChunkLoaderPluginOptions} from \"./chunk-loader\";\n\nexport {\n default as IsolatedStylesPlugin,\n type IsolatedStylesPluginOptions,\n type IsolatedStylesPluginFiles,\n} from \"./isolated-styles\";\n\nexport {\n default as BuildAssetsMapPlugin,\n type BuildAssetsMapPluginOptions,\n type BuildAssetsMapPluginModuleOptions,\n type BuildAssetsMapPluginExportOptions,\n createEntrypointModule,\n EntrypointAssetsModule,\n} from \"./build-assets-map\";\n\nexport {\n default as GenerateJsonPlugin,\n type GenerateJsonPluginData,\n type GenerateJsonPluginUpdate,\n} from \"./generate-json\";\n\nexport {\n GenerateModulePlugin,\n type GenerateModulePluginDependencies,\n type GenerateModulePluginDependenciesResolver,\n type GenerateModulePluginModules,\n type GenerateModulePluginUpdate,\n} from \"./generate-module\";\n\nexport {default as ManifestPlugin} from \"./manifest\";\n\nexport {\n default as ResourceAccessPlugin,\n type ResourceAccessPluginOptions,\n type ResourceAccessPluginRequirement,\n} from \"./resource-access\";\n\nexport {default as ReplacePlugin} from \"./replace\";\n\nexport {default as WatchPlugin} from \"./watch\";\n\nexport type {RuntimePropertyOptions} from \"./types\";\n"],"mappings":"AAAA;AAAA,EACe,WAAXA;AAAA,OAQG;AAEP,SAAmB,WAAXA,gBAAkE;AAE1E;AAAA,EACe,WAAXA;AAAA,OAGG;AAEP;AAAA,EACe,WAAXA;AAAA,EAIA;AAAA,EACA;AAAA,OACG;AAEP;AAAA,EACe,WAAXA;AAAA,OAGG;AAEP;AAAA,EACI;AAAA,OAKG;AAEP,SAAmB,WAAXA,gBAAgC;AAExC;AAAA,EACe,WAAXA;AAAA,OAGG;AAEP,SAAmB,WAAXA,gBAA+B;AAEvC,SAAmB,WAAXA,iBAA6B;","names":["default"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Compiler, type Filename } from "@rspack/core";
|
|
2
|
+
import type { RuntimePropertyOptions } from "../types.js";
|
|
3
|
+
export interface IsolatedStylesPluginOptions extends RuntimePropertyOptions {
|
|
4
|
+
cssFilename: Filename;
|
|
5
|
+
cssChunkFilename: Filename;
|
|
6
|
+
test: (entry: string) => boolean;
|
|
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. */
|
|
9
|
+
validate?: (entry: string, files: IsolatedStylesPluginFiles) => void | readonly string[];
|
|
10
|
+
}
|
|
11
|
+
/** CSS destinations in one entrypoint's complete dependency graph, for build diagnostics only. */
|
|
12
|
+
export interface IsolatedStylesPluginFiles {
|
|
13
|
+
readonly document: readonly string[];
|
|
14
|
+
readonly isolated: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export default class IsolatedStylesPlugin {
|
|
17
|
+
private readonly options;
|
|
18
|
+
private readonly originalRuntimeSources;
|
|
19
|
+
constructor(options: IsolatedStylesPluginOptions);
|
|
20
|
+
apply(compiler: Compiler): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { RuntimeGlobals, RuntimeModule } from "@rspack/core";
|
|
2
|
+
import { getIsolatedStylesFiles, isIsolatedStylesChunk } from "./../../../../cli/bundler/utils/styles.js";
|
|
3
|
+
import { CssContentHashType, filenameRequiresFullHash, resolveChunkFilename } from "./../../../../cli/bundler/utils/chunk-filename.js";
|
|
4
|
+
import { getManifestHooks } from "../utils/manifest-hooks.js";
|
|
5
|
+
import { renderIsolatedStylesCssLoader, renderIsolatedStylesRuntime } from "./templates.js";
|
|
6
|
+
const PluginName = "IsolatedStylesPlugin";
|
|
7
|
+
const CssLoadingRuntimeIdentifier = "webpack/runtime/css loading";
|
|
8
|
+
const CssRuntimeBoundary = "// object to store loaded CSS chunks";
|
|
9
|
+
const CssFilenameExpression = /var href = (.+?)\(chunkId\);/;
|
|
10
|
+
class IsolatedStylesRuntimeModule extends RuntimeModule {
|
|
11
|
+
constructor(entry, property, timeout, cssFilename, cssChunkFilename, fullHash) {
|
|
12
|
+
super(`isolated styles ${entry}`, RuntimeModule.STAGE_ATTACH);
|
|
13
|
+
this.entry = entry;
|
|
14
|
+
this.property = property;
|
|
15
|
+
this.timeout = timeout;
|
|
16
|
+
this.cssFilename = cssFilename;
|
|
17
|
+
this.cssChunkFilename = cssChunkFilename;
|
|
18
|
+
this.dependentHash = true;
|
|
19
|
+
this.fullHash = fullHash;
|
|
20
|
+
}
|
|
21
|
+
entry;
|
|
22
|
+
property;
|
|
23
|
+
timeout;
|
|
24
|
+
cssFilename;
|
|
25
|
+
cssChunkFilename;
|
|
26
|
+
generate() {
|
|
27
|
+
const compilation = this.compilation;
|
|
28
|
+
if (!compilation) throw new Error("Isolated styles runtime is not attached to a compilation");
|
|
29
|
+
const initialStyles = initialStyleChunks(compilation, this.entry, this.cssFilename, this.cssChunkFilename).map(
|
|
30
|
+
({ chunk, filename }) => resolveChunkFilename(compilation, chunk, filename, CssContentHashType)
|
|
31
|
+
);
|
|
32
|
+
return renderIsolatedStylesRuntime({
|
|
33
|
+
entry: this.entry,
|
|
34
|
+
require: RuntimeGlobals.require,
|
|
35
|
+
property: this.property,
|
|
36
|
+
timeout: this.timeout,
|
|
37
|
+
initialStyles
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const initialStyleChunks = (compilation, entry, cssFilename, cssChunkFilename) => {
|
|
42
|
+
const entrypoint = compilation.entrypoints.get(entry);
|
|
43
|
+
if (!entrypoint) throw new Error(`Isolated styles entrypoint "${entry}" is unavailable`);
|
|
44
|
+
const entryChunk = entrypoint.getEntrypointChunk();
|
|
45
|
+
return Array.from(entrypoint.chunks).filter((chunk) => isIsolatedStylesChunk(compilation, chunk)).map((chunk) => ({ chunk, filename: chunk === entryChunk ? cssFilename : cssChunkFilename }));
|
|
46
|
+
};
|
|
47
|
+
const hasAsyncCss = (chunk) => {
|
|
48
|
+
return Array.from(chunk.getAllAsyncChunks()).some((candidate) => {
|
|
49
|
+
return [...candidate.files, ...candidate.auxiliaryFiles].some((file) => file.endsWith(".css"));
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
class IsolatedStylesPlugin {
|
|
53
|
+
constructor(options) {
|
|
54
|
+
this.options = options;
|
|
55
|
+
}
|
|
56
|
+
options;
|
|
57
|
+
originalRuntimeSources = /* @__PURE__ */ new WeakMap();
|
|
58
|
+
apply(compiler) {
|
|
59
|
+
compiler.hooks.compilation.tap(PluginName, (compilation) => {
|
|
60
|
+
getManifestHooks(compilation).prepareDependencies.tap(PluginName, (dependencies) => {
|
|
61
|
+
const isolatedFiles = getIsolatedStylesFiles(compilation);
|
|
62
|
+
for (const [entry, dependency] of dependencies) {
|
|
63
|
+
if (!this.options.test(entry)) continue;
|
|
64
|
+
for (const file of dependency.css) {
|
|
65
|
+
if (!isolatedFiles.has(file)) continue;
|
|
66
|
+
dependency.css.delete(file);
|
|
67
|
+
dependency.assets.add(file);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const timeout = this.options.timeout ?? compiler.options.output.chunkLoadTimeout ?? 12e4;
|
|
73
|
+
compiler.hooks.thisCompilation.tap(PluginName, (compilation) => {
|
|
74
|
+
const injected = /* @__PURE__ */ new Set();
|
|
75
|
+
const patched = /* @__PURE__ */ new Set();
|
|
76
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap(PluginName, (chunk, requirements) => {
|
|
77
|
+
if (chunk.name === void 0 || !this.options.test(chunk.name) || injected.has(chunk)) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
requirements.add(RuntimeGlobals.require);
|
|
81
|
+
requirements.add(RuntimeGlobals.publicPath);
|
|
82
|
+
injected.add(chunk);
|
|
83
|
+
const fullHash = initialStyleChunks(
|
|
84
|
+
compilation,
|
|
85
|
+
chunk.name,
|
|
86
|
+
this.options.cssFilename,
|
|
87
|
+
this.options.cssChunkFilename
|
|
88
|
+
).some(
|
|
89
|
+
({ chunk: chunk2, filename }) => filenameRequiresFullHash(compilation, chunk2, filename, CssContentHashType)
|
|
90
|
+
);
|
|
91
|
+
compilation.addRuntimeModule(
|
|
92
|
+
chunk,
|
|
93
|
+
new IsolatedStylesRuntimeModule(
|
|
94
|
+
chunk.name,
|
|
95
|
+
this.options.property,
|
|
96
|
+
timeout,
|
|
97
|
+
this.options.cssFilename,
|
|
98
|
+
this.options.cssChunkFilename,
|
|
99
|
+
fullHash
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
compilation.hooks.runtimeModule.tap(PluginName, (runtimeModule, chunk) => {
|
|
104
|
+
var _a;
|
|
105
|
+
if (chunk.name === void 0 || runtimeModule.identifier() !== CssLoadingRuntimeIdentifier) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const source = runtimeModule.source;
|
|
109
|
+
if (!source || typeof source.source !== "string") {
|
|
110
|
+
throw new Error(
|
|
111
|
+
`CSS loading runtime source for isolated entrypoint "${chunk.name}" is unavailable`
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
if (source.source.length === 0) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const originalSource = this.originalRuntimeSources.get(runtimeModule) ?? source.source;
|
|
118
|
+
this.originalRuntimeSources.set(runtimeModule, originalSource);
|
|
119
|
+
source.source = originalSource;
|
|
120
|
+
if (!this.options.test(chunk.name)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const boundary = originalSource.indexOf(CssRuntimeBoundary);
|
|
124
|
+
const filenameExpression = (_a = originalSource.match(CssFilenameExpression)) == null ? void 0 : _a[1];
|
|
125
|
+
if (boundary < 0 || !filenameExpression) {
|
|
126
|
+
throw new Error(`CSS loading runtime seam for isolated entrypoint "${chunk.name}" is unavailable`);
|
|
127
|
+
}
|
|
128
|
+
source.source = renderIsolatedStylesCssLoader({
|
|
129
|
+
isolatedChunks: Object.fromEntries(
|
|
130
|
+
[...compilation.chunks].filter((candidate) => isIsolatedStylesChunk(compilation, candidate)).map((candidate) => [candidate.id, true])
|
|
131
|
+
),
|
|
132
|
+
originalLoader: originalSource.slice(0, boundary),
|
|
133
|
+
cssFilenameExpression: filenameExpression,
|
|
134
|
+
originalRuntime: originalSource.slice(boundary),
|
|
135
|
+
publicPath: RuntimeGlobals.publicPath,
|
|
136
|
+
require: RuntimeGlobals.require,
|
|
137
|
+
property: this.options.property
|
|
138
|
+
});
|
|
139
|
+
patched.add(chunk);
|
|
140
|
+
});
|
|
141
|
+
compilation.hooks.afterSeal.tap(PluginName, () => {
|
|
142
|
+
for (const [entry, entrypoint] of compilation.entrypoints) {
|
|
143
|
+
const chunk = entrypoint.getRuntimeChunk();
|
|
144
|
+
if (this.options.validate) {
|
|
145
|
+
const document = /* @__PURE__ */ new Set();
|
|
146
|
+
const isolated = /* @__PURE__ */ new Set();
|
|
147
|
+
const referenced = /* @__PURE__ */ new Set([
|
|
148
|
+
...entrypoint.chunks,
|
|
149
|
+
...entrypoint.getEntrypointChunk().getAllReferencedChunks()
|
|
150
|
+
]);
|
|
151
|
+
for (const candidate of referenced) {
|
|
152
|
+
const destination = isIsolatedStylesChunk(compilation, candidate) ? isolated : document;
|
|
153
|
+
for (const file of candidate.files) {
|
|
154
|
+
if (file.endsWith(".css")) destination.add(file);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const warnings = this.options.validate(entry, {
|
|
158
|
+
document: [...document].sort(),
|
|
159
|
+
isolated: [...isolated].sort()
|
|
160
|
+
});
|
|
161
|
+
for (const message of warnings ?? []) compilation.warnings.push(new Error(message));
|
|
162
|
+
}
|
|
163
|
+
if (chunk && chunk.name !== void 0 && this.options.test(chunk.name) && hasAsyncCss(entrypoint.getEntrypointChunk()) && !patched.has(chunk)) {
|
|
164
|
+
throw new Error(`CSS loading runtime for isolated entrypoint "${chunk.name}" was not replaced`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export {
|
|
172
|
+
IsolatedStylesPlugin as default
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=IsolatedStylesPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.ts"],"sourcesContent":["import {type Chunk, type Compilation, type Compiler, type Filename, RuntimeGlobals, RuntimeModule} from \"@rspack/core\";\n\nimport {getIsolatedStylesFiles, isIsolatedStylesChunk} from \"@cli/bundler/utils/styles\";\nimport {CssContentHashType, filenameRequiresFullHash, resolveChunkFilename} from \"@cli/bundler/utils/chunk-filename\";\nimport type {RuntimePropertyOptions} from \"../types\";\nimport {getManifestHooks} from \"../utils/manifest-hooks\";\n\nimport {renderIsolatedStylesCssLoader, renderIsolatedStylesRuntime} from \"./templates\";\n\nconst PluginName = \"IsolatedStylesPlugin\";\nconst CssLoadingRuntimeIdentifier = \"webpack/runtime/css loading\";\nconst CssRuntimeBoundary = \"// object to store loaded CSS chunks\";\nconst CssFilenameExpression = /var href = (.+?)\\(chunkId\\);/;\n\nexport interface IsolatedStylesPluginOptions extends RuntimePropertyOptions {\n cssFilename: Filename;\n cssChunkFilename: Filename;\n test: (entry: string) => boolean;\n timeout?: number;\n /** Inspects every entry's initial, shared and async CSS, independently of test. Throw to reject; return warning messages to report without changing delivery. */\n validate?: (entry: string, files: IsolatedStylesPluginFiles) => void | readonly string[];\n}\n\n/** CSS destinations in one entrypoint's complete dependency graph, for build diagnostics only. */\nexport interface IsolatedStylesPluginFiles {\n readonly document: readonly string[];\n readonly isolated: readonly string[];\n}\n\nclass IsolatedStylesRuntimeModule extends RuntimeModule {\n public constructor(\n private readonly entry: string,\n private readonly property: string,\n private readonly timeout: number,\n private readonly cssFilename: Filename,\n private readonly cssChunkFilename: Filename,\n fullHash: boolean\n ) {\n super(`isolated styles ${entry}`, RuntimeModule.STAGE_ATTACH);\n this.dependentHash = true;\n this.fullHash = fullHash;\n }\n\n public generate(): string {\n const compilation = this.compilation;\n if (!compilation) throw new Error(\"Isolated styles runtime is not attached to a compilation\");\n\n const initialStyles = initialStyleChunks(compilation, this.entry, this.cssFilename, this.cssChunkFilename).map(\n ({chunk, filename}) => resolveChunkFilename(compilation, chunk, filename, CssContentHashType)\n );\n\n return renderIsolatedStylesRuntime({\n entry: this.entry,\n require: RuntimeGlobals.require,\n property: this.property,\n timeout: this.timeout,\n initialStyles,\n });\n }\n}\n\nconst initialStyleChunks = (\n compilation: Compilation,\n entry: string,\n cssFilename: Filename,\n cssChunkFilename: Filename\n): {chunk: Chunk; filename: Filename}[] => {\n const entrypoint = compilation.entrypoints.get(entry);\n if (!entrypoint) throw new Error(`Isolated styles entrypoint \"${entry}\" is unavailable`);\n\n const entryChunk = entrypoint.getEntrypointChunk();\n return Array.from(entrypoint.chunks)\n .filter(chunk => isIsolatedStylesChunk(compilation, chunk))\n .map(chunk => ({chunk, filename: chunk === entryChunk ? cssFilename : cssChunkFilename}));\n};\n\nconst hasAsyncCss = (chunk: Chunk): boolean => {\n return Array.from(chunk.getAllAsyncChunks()).some(candidate => {\n return [...candidate.files, ...candidate.auxiliaryFiles].some(file => file.endsWith(\".css\"));\n });\n};\n\nexport default class IsolatedStylesPlugin {\n private readonly originalRuntimeSources = new WeakMap<RuntimeModule, string>();\n\n public constructor(private readonly options: IsolatedStylesPluginOptions) {}\n\n public apply(compiler: Compiler): void {\n compiler.hooks.compilation.tap(PluginName, compilation => {\n getManifestHooks(compilation).prepareDependencies.tap(PluginName, dependencies => {\n const isolatedFiles = getIsolatedStylesFiles(compilation);\n for (const [entry, dependency] of dependencies) {\n if (!this.options.test(entry)) continue;\n\n for (const file of dependency.css) {\n if (!isolatedFiles.has(file)) continue;\n dependency.css.delete(file);\n dependency.assets.add(file);\n }\n }\n });\n });\n\n const timeout = this.options.timeout ?? compiler.options.output.chunkLoadTimeout ?? 120_000;\n\n compiler.hooks.thisCompilation.tap(PluginName, compilation => {\n const injected = new Set<Chunk>();\n const patched = new Set<Chunk>();\n\n compilation.hooks.additionalTreeRuntimeRequirements.tap(PluginName, (chunk, requirements) => {\n if (chunk.name === undefined || !this.options.test(chunk.name) || injected.has(chunk)) {\n return;\n }\n\n requirements.add(RuntimeGlobals.require);\n requirements.add(RuntimeGlobals.publicPath);\n injected.add(chunk);\n const fullHash = initialStyleChunks(\n compilation,\n chunk.name,\n this.options.cssFilename,\n this.options.cssChunkFilename\n ).some(({chunk, filename}) =>\n filenameRequiresFullHash(compilation, chunk, filename, CssContentHashType)\n );\n compilation.addRuntimeModule(\n chunk,\n new IsolatedStylesRuntimeModule(\n chunk.name,\n this.options.property,\n timeout,\n this.options.cssFilename,\n this.options.cssChunkFilename,\n fullHash\n )\n );\n });\n\n compilation.hooks.runtimeModule.tap(PluginName, (runtimeModule, chunk) => {\n if (chunk.name === undefined || runtimeModule.identifier() !== CssLoadingRuntimeIdentifier) {\n return;\n }\n\n const source = runtimeModule.source;\n\n if (!source || typeof source.source !== \"string\") {\n throw new Error(\n `CSS loading runtime source for isolated entrypoint \"${chunk.name}\" is unavailable`\n );\n }\n\n if (source.source.length === 0) {\n return;\n }\n\n const originalSource = this.originalRuntimeSources.get(runtimeModule) ?? source.source;\n this.originalRuntimeSources.set(runtimeModule, originalSource);\n source.source = originalSource;\n\n if (!this.options.test(chunk.name)) {\n return;\n }\n\n const boundary = originalSource.indexOf(CssRuntimeBoundary);\n const filenameExpression = originalSource.match(CssFilenameExpression)?.[1];\n\n if (boundary < 0 || !filenameExpression) {\n throw new Error(`CSS loading runtime seam for isolated entrypoint \"${chunk.name}\" is unavailable`);\n }\n\n source.source = renderIsolatedStylesCssLoader({\n isolatedChunks: Object.fromEntries(\n [...compilation.chunks]\n .filter(candidate => isIsolatedStylesChunk(compilation, candidate))\n .map(candidate => [candidate.id, true])\n ),\n originalLoader: originalSource.slice(0, boundary),\n cssFilenameExpression: filenameExpression,\n originalRuntime: originalSource.slice(boundary),\n publicPath: RuntimeGlobals.publicPath,\n require: RuntimeGlobals.require,\n property: this.options.property,\n });\n patched.add(chunk);\n });\n\n compilation.hooks.afterSeal.tap(PluginName, () => {\n for (const [entry, entrypoint] of compilation.entrypoints) {\n const chunk = entrypoint.getRuntimeChunk();\n\n if (this.options.validate) {\n const document = new Set<string>();\n const isolated = new Set<string>();\n const referenced = new Set([\n ...entrypoint.chunks,\n ...entrypoint.getEntrypointChunk().getAllReferencedChunks(),\n ]);\n for (const candidate of referenced) {\n const destination = isIsolatedStylesChunk(compilation, candidate) ? isolated : document;\n for (const file of candidate.files) {\n if (file.endsWith(\".css\")) destination.add(file);\n }\n }\n const warnings = this.options.validate(entry, {\n document: [...document].sort(),\n isolated: [...isolated].sort(),\n });\n for (const message of warnings ?? []) compilation.warnings.push(new Error(message));\n }\n\n if (\n chunk &&\n chunk.name !== undefined &&\n this.options.test(chunk.name) &&\n hasAsyncCss(entrypoint.getEntrypointChunk()) &&\n !patched.has(chunk)\n ) {\n throw new Error(`CSS loading runtime for isolated entrypoint \"${chunk.name}\" was not replaced`);\n }\n }\n });\n });\n }\n}\n"],"mappings":"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","names":["chunk"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, type IsolatedStylesPluginOptions, type IsolatedStylesPluginFiles } from "./IsolatedStylesPlugin.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/isolated-styles/index.ts"],"sourcesContent":["export {default, type IsolatedStylesPluginOptions, type IsolatedStylesPluginFiles} from \"./IsolatedStylesPlugin\";\n"],"mappings":"AAAA,SAAQ,WAAAA,gBAAgF;","names":["default"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare var loadDocumentStylesheet: any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare var isolatedStyleRoots: Map<any, any>;
|
|
2
|
+
declare var isolatedRequestedStyles: Set<any>;
|
|
3
|
+
declare var isolatedStyleTimeout: any;
|
|
4
|
+
declare var isolatedStyleEntry: any;
|
|
5
|
+
declare var isolatedInitialStyles: any;
|
|
6
|
+
declare function createStyleError(url: any, type: any): Error;
|
|
7
|
+
declare function attachStyle(root: any, url: any, retry: any): any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RuntimePropertyOptions } from "../types.js";
|
|
2
|
+
interface IsolatedStylesRuntimeTemplateOptions extends RuntimePropertyOptions {
|
|
3
|
+
readonly entry: string;
|
|
4
|
+
readonly require: string;
|
|
5
|
+
readonly timeout: number;
|
|
6
|
+
readonly initialStyles: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
interface IsolatedStylesCssLoaderTemplateOptions extends RuntimePropertyOptions {
|
|
9
|
+
readonly isolatedChunks: Readonly<Record<string, boolean>>;
|
|
10
|
+
readonly originalLoader: string;
|
|
11
|
+
readonly cssFilenameExpression: string;
|
|
12
|
+
readonly originalRuntime: string;
|
|
13
|
+
readonly publicPath: string;
|
|
14
|
+
readonly require: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const renderIsolatedStylesRuntime: (options: IsolatedStylesRuntimeTemplateOptions) => string;
|
|
17
|
+
export declare const renderIsolatedStylesCssLoader: (options: IsolatedStylesCssLoaderTemplateOptions) => string;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/bundler/plugins/isolated-styles/templates/css-loader.template.js?raw
|
|
2
|
+
var css_loader_template_default = "__ADNBN_ORIGINAL_CSS_LOADER__;\n\nvar loadDocumentStylesheet = loadStylesheet;\nloadStylesheet = function (chunkId) {\n if (!__ADNBN_ISOLATED_CSS_CHUNKS__[chunkId]) return loadDocumentStylesheet(chunkId);\n var href = __ADNBN_CSS_FILENAME_EXPRESSION__(chunkId);\n var fullhref = __ADNBN_PUBLIC_PATH__ + href;\n\n return __ADNBN_REQUIRE__[__ADNBN_PROPERTY__].load(fullhref);\n};\n\n__ADNBN_ORIGINAL_CSS_RUNTIME__;\n";
|
|
3
|
+
|
|
4
|
+
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/bundler/plugins/isolated-styles/templates/runtime.template.js?raw
|
|
5
|
+
var runtime_template_default = `var isolatedStyleRoots = new Map();
|
|
6
|
+
var isolatedRequestedStyles = new Set();
|
|
7
|
+
var isolatedStyleTimeout = __ADNBN_TIMEOUT__;
|
|
8
|
+
var isolatedStyleEntry = __ADNBN_ENTRY__;
|
|
9
|
+
var isolatedInitialStyles;
|
|
10
|
+
|
|
11
|
+
var createStyleError = function (url, type) {
|
|
12
|
+
var error = new Error('Loading isolated CSS for entrypoint "' + isolatedStyleEntry + '" failed.\\n(' + url + ")");
|
|
13
|
+
error.code = "CSS_CHUNK_LOAD_FAILED";
|
|
14
|
+
error.type = type;
|
|
15
|
+
error.request = url;
|
|
16
|
+
return error;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var attachStyle = function (root, url, retry) {
|
|
20
|
+
var rootState = isolatedStyleRoots.get(root);
|
|
21
|
+
|
|
22
|
+
if (!rootState) return Promise.resolve();
|
|
23
|
+
|
|
24
|
+
var existing = rootState.styles.get(url);
|
|
25
|
+
|
|
26
|
+
if (existing) return existing.promise;
|
|
27
|
+
|
|
28
|
+
var resolveStyle;
|
|
29
|
+
var rejectStyle;
|
|
30
|
+
var promise = new Promise(function (resolve, reject) {
|
|
31
|
+
resolveStyle = resolve;
|
|
32
|
+
rejectStyle = reject;
|
|
33
|
+
});
|
|
34
|
+
var settled = false;
|
|
35
|
+
var record = {
|
|
36
|
+
link: undefined,
|
|
37
|
+
promise: promise,
|
|
38
|
+
cancel: function () {
|
|
39
|
+
settle();
|
|
40
|
+
record.link.remove();
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
rootState.styles.set(url, record);
|
|
45
|
+
|
|
46
|
+
var settle = function (error) {
|
|
47
|
+
if (settled) return;
|
|
48
|
+
settled = true;
|
|
49
|
+
record.link.onerror = record.link.onload = null;
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
|
|
52
|
+
if (error) {
|
|
53
|
+
rootState.styles.delete(url);
|
|
54
|
+
record.link.remove();
|
|
55
|
+
rejectStyle(error);
|
|
56
|
+
} else {
|
|
57
|
+
resolveStyle();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
var start = function (previous) {
|
|
62
|
+
var link = root.ownerDocument.createElement("link");
|
|
63
|
+
record.link = link;
|
|
64
|
+
link.rel = "stylesheet";
|
|
65
|
+
link.type = "text/css";
|
|
66
|
+
link.href = url;
|
|
67
|
+
link.onload = function () {
|
|
68
|
+
if (!settled && record.link === link) settle();
|
|
69
|
+
};
|
|
70
|
+
link.onerror = function (event) {
|
|
71
|
+
if (settled || record.link !== link) return;
|
|
72
|
+
if (retry) {
|
|
73
|
+
retry = false;
|
|
74
|
+
link.onerror = link.onload = null;
|
|
75
|
+
start(link);
|
|
76
|
+
} else {
|
|
77
|
+
var type = event && event.type ? event.type : "error";
|
|
78
|
+
settle(createStyleError(url, type));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
// Replace in place: appending a retry could change the CSS cascade order.
|
|
82
|
+
root.insertBefore(link, previous || rootState.target);
|
|
83
|
+
if (previous) previous.remove();
|
|
84
|
+
};
|
|
85
|
+
// One budget for both attempts, never another timer for the retry.
|
|
86
|
+
var timer = setTimeout(function () {
|
|
87
|
+
settle(createStyleError(url, "timeout"));
|
|
88
|
+
}, isolatedStyleTimeout);
|
|
89
|
+
|
|
90
|
+
start();
|
|
91
|
+
|
|
92
|
+
return promise;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
__ADNBN_REQUIRE__[__ADNBN_PROPERTY__] = {
|
|
96
|
+
initialize: function (resolveUrl) {
|
|
97
|
+
if (!isolatedInitialStyles) isolatedInitialStyles = __ADNBN_INITIAL_STYLES__.map(resolveUrl);
|
|
98
|
+
},
|
|
99
|
+
add: function (root, target, retry) {
|
|
100
|
+
if (isolatedStyleRoots.has(root)) return;
|
|
101
|
+
if (!isolatedInitialStyles)
|
|
102
|
+
throw new Error('Isolated stylesheet URLs for entrypoint "' + isolatedStyleEntry + '" are not initialized');
|
|
103
|
+
|
|
104
|
+
isolatedStyleRoots.set(root, {target: target, styles: new Map()});
|
|
105
|
+
|
|
106
|
+
isolatedInitialStyles.concat(Array.from(isolatedRequestedStyles)).forEach(function (url) {
|
|
107
|
+
attachStyle(root, url, retry).catch(function (error) {
|
|
108
|
+
console.error(error);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
delete: function (root) {
|
|
113
|
+
var rootState = isolatedStyleRoots.get(root);
|
|
114
|
+
|
|
115
|
+
if (!rootState) return;
|
|
116
|
+
|
|
117
|
+
isolatedStyleRoots.delete(root);
|
|
118
|
+
rootState.styles.forEach(function (record) {
|
|
119
|
+
record.cancel();
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
load: function (url) {
|
|
123
|
+
isolatedRequestedStyles.add(url);
|
|
124
|
+
|
|
125
|
+
return Promise.all(
|
|
126
|
+
Array.from(isolatedStyleRoots.keys(), function (root) {
|
|
127
|
+
return attachStyle(root, url);
|
|
128
|
+
})
|
|
129
|
+
).then(function () {});
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
`;
|
|
133
|
+
|
|
134
|
+
// src/cli/bundler/plugins/utils/runtime-template.ts
|
|
135
|
+
var PlaceholderPattern = /__ADNBN_[A-Z0-9_]+__/g;
|
|
136
|
+
var renderRuntimeTemplate = (template, values) => {
|
|
137
|
+
for (const placeholder of Object.keys(values)) {
|
|
138
|
+
if (!template.includes(placeholder)) {
|
|
139
|
+
throw new Error(`Runtime template placeholder "${placeholder}" is unavailable`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return template.replace(PlaceholderPattern, (placeholder) => {
|
|
143
|
+
if (!Object.hasOwn(values, placeholder)) {
|
|
144
|
+
throw new Error(`Runtime template placeholder "${placeholder}" was not replaced`);
|
|
145
|
+
}
|
|
146
|
+
return values[placeholder];
|
|
147
|
+
}).trim();
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// src/cli/bundler/plugins/isolated-styles/templates.ts
|
|
151
|
+
var renderIsolatedStylesRuntime = (options) => {
|
|
152
|
+
return renderRuntimeTemplate(runtime_template_default, {
|
|
153
|
+
__ADNBN_ENTRY__: JSON.stringify(options.entry),
|
|
154
|
+
__ADNBN_REQUIRE__: options.require,
|
|
155
|
+
__ADNBN_PROPERTY__: JSON.stringify(options.property),
|
|
156
|
+
__ADNBN_TIMEOUT__: JSON.stringify(options.timeout),
|
|
157
|
+
__ADNBN_INITIAL_STYLES__: JSON.stringify(options.initialStyles)
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
var renderIsolatedStylesCssLoader = (options) => {
|
|
161
|
+
return renderRuntimeTemplate(css_loader_template_default, {
|
|
162
|
+
__ADNBN_ISOLATED_CSS_CHUNKS__: JSON.stringify(options.isolatedChunks),
|
|
163
|
+
__ADNBN_ORIGINAL_CSS_LOADER__: options.originalLoader,
|
|
164
|
+
__ADNBN_CSS_FILENAME_EXPRESSION__: options.cssFilenameExpression,
|
|
165
|
+
__ADNBN_ORIGINAL_CSS_RUNTIME__: options.originalRuntime,
|
|
166
|
+
__ADNBN_PUBLIC_PATH__: options.publicPath,
|
|
167
|
+
__ADNBN_REQUIRE__: options.require,
|
|
168
|
+
__ADNBN_PROPERTY__: JSON.stringify(options.property)
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
export {
|
|
172
|
+
renderIsolatedStylesCssLoader,
|
|
173
|
+
renderIsolatedStylesRuntime
|
|
174
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Compiler } from "@rspack/core";
|
|
2
|
+
import { ManifestBuilder, ManifestDependencies } from "../../../../types/manifest.js";
|
|
3
|
+
import { EntrypointAssetsMap } from "../../../../types/entrypoint.js";
|
|
4
|
+
export declare const createManifestDependencies: (buildAssets: EntrypointAssetsMap) => ManifestDependencies;
|
|
5
|
+
declare class ManifestPlugin {
|
|
6
|
+
private readonly manifest;
|
|
7
|
+
constructor(manifest: ManifestBuilder | (() => ManifestBuilder));
|
|
8
|
+
apply(compiler: Compiler): void;
|
|
9
|
+
}
|
|
10
|
+
export default ManifestPlugin;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import rspack, { Compilation } from "@rspack/core";
|
|
2
|
+
import { getCompilationBuildAssets } from "./../../../../cli/bundler/utils/output.js";
|
|
3
|
+
import { getManifestHooks } from "../utils/manifest-hooks.js";
|
|
4
|
+
const createManifestDependencies = (buildAssets) => {
|
|
5
|
+
const entryDependencies = /* @__PURE__ */ new Map();
|
|
6
|
+
Object.entries(buildAssets).forEach(([entryName, assets]) => {
|
|
7
|
+
const dependencies = {
|
|
8
|
+
assets: /* @__PURE__ */ new Set([...assets.assets, ...assets.async.js, ...assets.async.css]),
|
|
9
|
+
css: new Set(assets.initial.css),
|
|
10
|
+
js: new Set(assets.initial.js)
|
|
11
|
+
};
|
|
12
|
+
entryDependencies.set(entryName, dependencies);
|
|
13
|
+
});
|
|
14
|
+
return entryDependencies;
|
|
15
|
+
};
|
|
16
|
+
class ManifestPlugin {
|
|
17
|
+
constructor(manifest) {
|
|
18
|
+
this.manifest = manifest;
|
|
19
|
+
}
|
|
20
|
+
manifest;
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
compiler.hooks.compilation.tap("ManifestPlugin", (compilation) => {
|
|
23
|
+
const hooks = getManifestHooks(compilation);
|
|
24
|
+
compilation.hooks.processAssets.tapPromise(
|
|
25
|
+
{
|
|
26
|
+
name: "ManifestPlugin",
|
|
27
|
+
stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
|
|
28
|
+
},
|
|
29
|
+
async () => {
|
|
30
|
+
try {
|
|
31
|
+
const buildAssets = getCompilationBuildAssets(compilation);
|
|
32
|
+
if (!buildAssets) {
|
|
33
|
+
throw new Error("Build assets are unavailable before manifest generation");
|
|
34
|
+
}
|
|
35
|
+
const dependencies = createManifestDependencies(buildAssets);
|
|
36
|
+
await hooks.prepareDependencies.promise(dependencies, buildAssets);
|
|
37
|
+
const builder = typeof this.manifest === "function" ? this.manifest() : this.manifest;
|
|
38
|
+
const manifest = builder.setDependencies(dependencies).get();
|
|
39
|
+
await hooks.validate.promise(manifest);
|
|
40
|
+
const json = JSON.stringify(manifest, null, 2);
|
|
41
|
+
compilation.emitAsset("manifest.json", new rspack.sources.RawSource(json));
|
|
42
|
+
} catch (error) {
|
|
43
|
+
compilation.errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
var ManifestPlugin_default = ManifestPlugin;
|
|
51
|
+
export {
|
|
52
|
+
createManifestDependencies,
|
|
53
|
+
ManifestPlugin_default as default
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=ManifestPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/manifest/ManifestPlugin.ts"],"sourcesContent":["import rspack, {Compilation, Compiler} from \"@rspack/core\";\n\nimport {getCompilationBuildAssets} from \"@cli/bundler/utils/output\";\nimport {getManifestHooks} from \"../utils/manifest-hooks\";\n\nimport {ManifestBuilder, ManifestDependencies, ManifestDependency} from \"@typing/manifest\";\nimport {EntrypointAssetsMap} from \"@typing/entrypoint\";\n\nexport const createManifestDependencies = (buildAssets: EntrypointAssetsMap): ManifestDependencies => {\n const entryDependencies: ManifestDependencies = new Map();\n\n Object.entries(buildAssets).forEach(([entryName, assets]) => {\n const dependencies: ManifestDependency = {\n assets: new Set([...assets.assets, ...assets.async.js, ...assets.async.css]),\n css: new Set(assets.initial.css),\n js: new Set(assets.initial.js),\n };\n\n entryDependencies.set(entryName, dependencies);\n });\n\n return entryDependencies;\n};\n\nclass ManifestPlugin {\n constructor(private readonly manifest: ManifestBuilder | (() => ManifestBuilder)) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.compilation.tap(\"ManifestPlugin\", compilation => {\n const hooks = getManifestHooks(compilation);\n\n compilation.hooks.processAssets.tapPromise(\n {\n name: \"ManifestPlugin\",\n stage: Compilation.PROCESS_ASSETS_STAGE_REPORT,\n },\n async () => {\n try {\n const buildAssets = getCompilationBuildAssets(compilation);\n\n if (!buildAssets) {\n throw new Error(\"Build assets are unavailable before manifest generation\");\n }\n\n const dependencies = createManifestDependencies(buildAssets);\n await hooks.prepareDependencies.promise(dependencies, buildAssets);\n\n const builder = typeof this.manifest === \"function\" ? this.manifest() : this.manifest;\n const manifest = builder.setDependencies(dependencies).get();\n await hooks.validate.promise(manifest);\n\n const json = JSON.stringify(manifest, null, 2);\n\n compilation.emitAsset(\"manifest.json\", new rspack.sources.RawSource(json));\n } catch (error) {\n // A manifest failure rejects this build without terminating the watch compiler.\n compilation.errors.push(error instanceof Error ? error : new Error(String(error)));\n }\n }\n );\n });\n }\n}\n\nexport default ManifestPlugin;\n"],"mappings":"AAAA,OAAO,UAAS,mBAA4B;AAE5C,SAAQ,iCAAgC;AACxC,SAAQ,wBAAuB;AAKxB,MAAM,6BAA6B,CAAC,gBAA2D;AAClG,QAAM,oBAA0C,oBAAI,IAAI;AAExD,SAAO,QAAQ,WAAW,EAAE,QAAQ,CAAC,CAAC,WAAW,MAAM,MAAM;AACzD,UAAM,eAAmC;AAAA,MACrC,QAAQ,oBAAI,IAAI,CAAC,GAAG,OAAO,QAAQ,GAAG,OAAO,MAAM,IAAI,GAAG,OAAO,MAAM,GAAG,CAAC;AAAA,MAC3E,KAAK,IAAI,IAAI,OAAO,QAAQ,GAAG;AAAA,MAC/B,IAAI,IAAI,IAAI,OAAO,QAAQ,EAAE;AAAA,IACjC;AAEA,sBAAkB,IAAI,WAAW,YAAY;AAAA,EACjD,CAAC;AAED,SAAO;AACX;AAEA,MAAM,eAAe;AAAA,EACjB,YAA6B,UAAqD;AAArD;AAAA,EAAsD;AAAA,EAAtD;AAAA,EAE7B,MAAM,UAA0B;AAC5B,aAAS,MAAM,YAAY,IAAI,kBAAkB,iBAAe;AAC5D,YAAM,QAAQ,iBAAiB,WAAW;AAE1C,kBAAY,MAAM,cAAc;AAAA,QAC5B;AAAA,UACI,MAAM;AAAA,UACN,OAAO,YAAY;AAAA,QACvB;AAAA,QACA,YAAY;AACR,cAAI;AACA,kBAAM,cAAc,0BAA0B,WAAW;AAEzD,gBAAI,CAAC,aAAa;AACd,oBAAM,IAAI,MAAM,yDAAyD;AAAA,YAC7E;AAEA,kBAAM,eAAe,2BAA2B,WAAW;AAC3D,kBAAM,MAAM,oBAAoB,QAAQ,cAAc,WAAW;AAEjE,kBAAM,UAAU,OAAO,KAAK,aAAa,aAAa,KAAK,SAAS,IAAI,KAAK;AAC7E,kBAAM,WAAW,QAAQ,gBAAgB,YAAY,EAAE,IAAI;AAC3D,kBAAM,MAAM,SAAS,QAAQ,QAAQ;AAErC,kBAAM,OAAO,KAAK,UAAU,UAAU,MAAM,CAAC;AAE7C,wBAAY,UAAU,iBAAiB,IAAI,OAAO,QAAQ,UAAU,IAAI,CAAC;AAAA,UAC7E,SAAS,OAAO;AAEZ,wBAAY,OAAO,KAAK,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC,CAAC;AAAA,UACrF;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;AAEA,IAAO,yBAAQ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createManifestDependencies, default } from "./ManifestPlugin.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/manifest/index.ts"],"sourcesContent":["export {createManifestDependencies, default} from \"./ManifestPlugin\";\n"],"mappings":"AAAA,SAAQ,4BAA4B,WAAAA,gBAAc;","names":["default"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/replace/ReplacePlugin.ts"],"sourcesContent":["import {type Compiler} from \"@rspack/core\";\n\ninterface ReplaceOptions {\n values: Record<string, string>;\n}\n\nexport default class ReplacePlugin {\n constructor(private options: ReplaceOptions) {}\n\n apply(compiler: Compiler): void {\n compiler.hooks.emit.tap(\"ReplacePlugin\", compilation => {\n for (const filename in compilation.assets) {\n let content = compilation.assets[filename].source().toString();\n let hasChanges = false;\n\n for (const [search, replace] of Object.entries(this.options.values)) {\n if (content.includes(search)) {\n content = content.replace(new RegExp(search, \"g\"), replace);\n hasChanges = true;\n }\n }\n\n if (hasChanges) {\n const sourceMap = {\n version: 3,\n sources: [],\n names: [],\n mappings: \"\",\n file: filename,\n };\n\n compilation.assets[filename] = {\n source: () => content,\n size: () => content.length,\n buffer: () => Buffer.from(content),\n map: () => sourceMap,\n sourceAndMap: () => ({source: content, map: sourceMap}),\n updateHash: () => {},\n };\n }\n }\n });\n }\n}\n"],"mappings":"AAMA,MAAO,cAA4B;AAAA,EAC/B,YAAoB,SAAyB;AAAzB;AAAA,EAA0B;AAAA,EAA1B;AAAA,EAEpB,MAAM,UAA0B;AAC5B,aAAS,MAAM,KAAK,IAAI,iBAAiB,iBAAe;AACpD,iBAAW,YAAY,YAAY,QAAQ;AACvC,YAAI,UAAU,YAAY,OAAO,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC7D,YAAI,aAAa;AAEjB,mBAAW,CAAC,QAAQ,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,MAAM,GAAG;AACjE,cAAI,QAAQ,SAAS,MAAM,GAAG;AAC1B,sBAAU,QAAQ,QAAQ,IAAI,OAAO,QAAQ,GAAG,GAAG,OAAO;AAC1D,yBAAa;AAAA,UACjB;AAAA,QACJ;AAEA,YAAI,YAAY;AACZ,gBAAM,YAAY;AAAA,YACd,SAAS;AAAA,YACT,SAAS,CAAC;AAAA,YACV,OAAO,CAAC;AAAA,YACR,UAAU;AAAA,YACV,MAAM;AAAA,UACV;AAEA,sBAAY,OAAO,QAAQ,IAAI;AAAA,YAC3B,QAAQ,MAAM;AAAA,YACd,MAAM,MAAM,QAAQ;AAAA,YACpB,QAAQ,MAAM,OAAO,KAAK,OAAO;AAAA,YACjC,KAAK,MAAM;AAAA,YACX,cAAc,OAAO,EAAC,QAAQ,SAAS,KAAK,UAAS;AAAA,YACrD,YAAY,MAAM;AAAA,YAAC;AAAA,UACvB;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ReplacePlugin.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/bundler/plugins/replace/index.ts"],"sourcesContent":["export {default} from \"./ReplacePlugin\";\n"],"mappings":"AAAA,SAAQ,WAAAA,gBAAc;","names":["default"]}
|