adnbn 0.10.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.js +16 -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.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/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/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/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/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/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 +2 -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 +1 -0
- package/dist/main/index.js +1 -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/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 +10 -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/page.d.ts +8 -0
- 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/tests/fixtures/options/discovery/account.options.d.ts +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/advanced.options/index.d.ts +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/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
|
@@ -2,30 +2,31 @@ import stringify from "json-stringify-deterministic";
|
|
|
2
2
|
import { getContentScriptConfigFromOptions } from "./utils.js";
|
|
3
3
|
import { NameGenerator } from "./../../../cli/entrypoint/index.js";
|
|
4
4
|
import { EntrypointType } from "./../../../types/entrypoint.js";
|
|
5
|
+
import { ContentScriptIsolation } from "./../../../types/content.js";
|
|
5
6
|
class ContentName extends NameGenerator {
|
|
6
7
|
constructor(config) {
|
|
7
8
|
super(EntrypointType.ContentScript);
|
|
8
9
|
this.config = config;
|
|
9
|
-
this.reserve(this.getChunkName());
|
|
10
10
|
}
|
|
11
11
|
config;
|
|
12
12
|
_names = /* @__PURE__ */ new Map();
|
|
13
|
-
getChunkName() {
|
|
14
|
-
return "common." + this.entrypoint;
|
|
15
|
-
}
|
|
16
13
|
create(name, options) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return entry;
|
|
14
|
+
if (!this.config.concatContentScripts || options.isolation !== void 0 && options.isolation.type !== ContentScriptIsolation.None) {
|
|
15
|
+
return this.name(name);
|
|
20
16
|
}
|
|
21
17
|
const key = stringify(getContentScriptConfigFromOptions(options));
|
|
22
18
|
const existingEntry = this._names.get(key);
|
|
23
19
|
if (existingEntry) {
|
|
24
20
|
return existingEntry;
|
|
25
21
|
}
|
|
22
|
+
const entry = this.name(name);
|
|
26
23
|
this._names.set(key, entry);
|
|
27
24
|
return entry;
|
|
28
25
|
}
|
|
26
|
+
reset() {
|
|
27
|
+
this._names.clear();
|
|
28
|
+
return super.reset();
|
|
29
|
+
}
|
|
29
30
|
}
|
|
30
31
|
export {
|
|
31
32
|
ContentName as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/ContentName.ts"],"sourcesContent":["import stringify from \"json-stringify-deterministic\";\n\nimport {getContentScriptConfigFromOptions} from \"./utils\";\nimport {ContentNameGenerator} from \"./types\";\n\nimport {NameGenerator} from \"@cli/entrypoint/index.js\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {EntrypointType} from \"@typing/entrypoint\";\nimport {ContentScriptEntrypointOptions} from \"@typing/content\";\n\nexport default class ContentName extends NameGenerator implements ContentNameGenerator<ContentScriptEntrypointOptions> {\n protected readonly _names = new Map<string, string>();\n\n constructor(protected readonly config: ReadonlyConfig) {\n super(EntrypointType.ContentScript);\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/ContentName.ts"],"sourcesContent":["import stringify from \"json-stringify-deterministic\";\n\nimport {getContentScriptConfigFromOptions} from \"./utils\";\nimport {ContentNameGenerator} from \"./types\";\n\nimport {NameGenerator} from \"@cli/entrypoint/index.js\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {EntrypointType} from \"@typing/entrypoint\";\nimport {ContentScriptIsolation, ContentScriptEntrypointOptions} from \"@typing/content\";\n\nexport default class ContentName extends NameGenerator implements ContentNameGenerator<ContentScriptEntrypointOptions> {\n protected readonly _names = new Map<string, string>();\n\n constructor(protected readonly config: ReadonlyConfig) {\n super(EntrypointType.ContentScript);\n }\n\n public create(name: string, options: ContentScriptEntrypointOptions): string {\n if (\n !this.config.concatContentScripts ||\n (options.isolation !== undefined && options.isolation.type !== ContentScriptIsolation.None)\n ) {\n return this.name(name);\n }\n\n const key = stringify(getContentScriptConfigFromOptions(options));\n\n const existingEntry = this._names.get(key);\n\n if (existingEntry) {\n return existingEntry;\n }\n\n const entry = this.name(name);\n\n this._names.set(key, entry);\n\n return entry;\n }\n\n public reset(): this {\n this._names.clear();\n\n return super.reset();\n }\n}\n"],"mappings":"AAAA,OAAO,eAAe;AAEtB,SAAQ,yCAAwC;AAGhD,SAAQ,qBAAoB;AAG5B,SAAQ,sBAAqB;AAC7B,SAAQ,8BAA6D;AAErE,MAAO,oBAAkC,cAA8E;AAAA,EAGnH,YAA+B,QAAwB;AACnD,UAAM,eAAe,aAAa;AADP;AAAA,EAE/B;AAAA,EAF+B;AAAA,EAFZ,SAAS,oBAAI,IAAoB;AAAA,EAM7C,OAAO,MAAc,SAAiD;AACzE,QACI,CAAC,KAAK,OAAO,wBACZ,QAAQ,cAAc,UAAa,QAAQ,UAAU,SAAS,uBAAuB,MACxF;AACE,aAAO,KAAK,KAAK,IAAI;AAAA,IACzB;AAEA,UAAM,MAAM,UAAU,kCAAkC,OAAO,CAAC;AAEhE,UAAM,gBAAgB,KAAK,OAAO,IAAI,GAAG;AAEzC,QAAI,eAAe;AACf,aAAO;AAAA,IACX;AAEA,UAAM,QAAQ,KAAK,KAAK,IAAI;AAE5B,SAAK,OAAO,IAAI,KAAK,KAAK;AAE1B,WAAO;AAAA,EACX;AAAA,EAEO,QAAc;AACjB,SAAK,OAAO,MAAM;AAElB,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -11,7 +11,7 @@ export default class extends RelayFinder implements ContentProvider<ContentScrip
|
|
|
11
11
|
* Before creating the virtual module, it is necessary to run a command `await this.transport()` that caches the Relays.
|
|
12
12
|
* This command is executed during the type declaration generation stage for the Relays.
|
|
13
13
|
*/
|
|
14
|
-
virtual(file: EntrypointFile): string;
|
|
14
|
+
virtual(file: EntrypointFile, contentOptions?: ContentScriptEntrypointOptions): string;
|
|
15
15
|
getOptionsMap(): Promise<Record<string, RelayOptions>>;
|
|
16
16
|
clear(): this;
|
|
17
17
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import RelayDriver from "./RelayDriver.js";
|
|
2
2
|
import { RelayFinder } from "./../../../cli/entrypoint/index.js";
|
|
3
3
|
import { virtualRelayModule } from "./../../../cli/virtual/index.js";
|
|
4
|
+
import { isContentScriptFrameNavigation } from "./../../../shared/content/index.js";
|
|
4
5
|
import { RelayMethod } from "./../../../types/relay.js";
|
|
5
6
|
class Relay_default extends RelayFinder {
|
|
6
7
|
_driver;
|
|
@@ -11,13 +12,13 @@ class Relay_default extends RelayFinder {
|
|
|
11
12
|
* Before creating the virtual module, it is necessary to run a command `await this.transport()` that caches the Relays.
|
|
12
13
|
* This command is executed during the type declaration generation stage for the Relays.
|
|
13
14
|
*/
|
|
14
|
-
virtual(file) {
|
|
15
|
+
virtual(file, contentOptions) {
|
|
15
16
|
var _a, _b;
|
|
16
17
|
const options = (_b = (_a = this._transport) == null ? void 0 : _a.get(file)) == null ? void 0 : _b.options;
|
|
17
18
|
if (!options) {
|
|
18
19
|
throw new Error(`Relay options not found for "${file}"`);
|
|
19
20
|
}
|
|
20
|
-
return virtualRelayModule(file, options.name);
|
|
21
|
+
return virtualRelayModule(file, options.name, isContentScriptFrameNavigation(contentOptions == null ? void 0 : contentOptions.isolation));
|
|
21
22
|
}
|
|
22
23
|
async getOptionsMap() {
|
|
23
24
|
const transport = await this.transport();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/Relay.ts"],"sourcesContent":["import RelayDriver from \"./RelayDriver\";\n\nimport {ContentProvider} from \"./types\";\n\nimport {RelayFinder} from \"@cli/entrypoint/index.js\";\nimport {virtualRelayModule} from \"@cli/virtual/index.js\";\n\nimport {RelayMethod, RelayOptions} from \"@typing/relay\";\nimport {ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends RelayFinder implements ContentProvider<ContentScriptEntrypointOptions> {\n protected _driver?: RelayDriver;\n\n public driver(): RelayDriver {\n return (this._driver ??= new RelayDriver(this));\n }\n\n /**\n * Before creating the virtual module, it is necessary to run a command `await this.transport()` that caches the Relays.\n * This command is executed during the type declaration generation stage for the Relays.\n */\n public virtual(file: EntrypointFile): string {\n const options = this._transport?.get(file)?.options;\n\n if (!options) {\n throw new Error(`Relay options not found for \"${file}\"`);\n }\n\n return virtualRelayModule(file, options.name);\n }\n\n public async getOptionsMap(): Promise<Record<string, RelayOptions>> {\n const transport = await this.transport();\n\n return Array.from(transport.values()).reduce(\n (map, {options}) => {\n map[options.name] = {\n ...options,\n method: options.method || RelayMethod.Messaging,\n };\n\n return map;\n },\n {} as Record<string, RelayOptions>\n );\n }\n\n public clear(): this {\n this._driver?.clear();\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AAIxB,SAAQ,mBAAkB;AAC1B,SAAQ,0BAAyB;
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/Relay.ts"],"sourcesContent":["import RelayDriver from \"./RelayDriver\";\n\nimport {ContentProvider} from \"./types\";\n\nimport {RelayFinder} from \"@cli/entrypoint/index.js\";\nimport {virtualRelayModule} from \"@cli/virtual/index.js\";\nimport {isContentScriptFrameNavigation} from \"@shared/content\";\n\nimport {RelayMethod, RelayOptions} from \"@typing/relay\";\nimport {ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends RelayFinder implements ContentProvider<ContentScriptEntrypointOptions> {\n protected _driver?: RelayDriver;\n\n public driver(): RelayDriver {\n return (this._driver ??= new RelayDriver(this));\n }\n\n /**\n * Before creating the virtual module, it is necessary to run a command `await this.transport()` that caches the Relays.\n * This command is executed during the type declaration generation stage for the Relays.\n */\n public virtual(file: EntrypointFile, contentOptions?: ContentScriptEntrypointOptions): string {\n const options = this._transport?.get(file)?.options;\n\n if (!options) {\n throw new Error(`Relay options not found for \"${file}\"`);\n }\n\n return virtualRelayModule(file, options.name, isContentScriptFrameNavigation(contentOptions?.isolation));\n }\n\n public async getOptionsMap(): Promise<Record<string, RelayOptions>> {\n const transport = await this.transport();\n\n return Array.from(transport.values()).reduce(\n (map, {options}) => {\n map[options.name] = {\n ...options,\n method: options.method || RelayMethod.Messaging,\n };\n\n return map;\n },\n {} as Record<string, RelayOptions>\n );\n }\n\n public clear(): this {\n this._driver?.clear();\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AAIxB,SAAQ,mBAAkB;AAC1B,SAAQ,0BAAyB;AACjC,SAAQ,sCAAqC;AAE7C,SAAQ,mBAAgC;AAIxC,MAAO,sBAAsB,YAAuE;AAAA,EACtF;AAAA,EAEH,SAAsB;AACzB,WAAQ,KAAK,YAAL,KAAK,UAAY,IAAI,YAAY,IAAI;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,QAAQ,MAAsB,gBAAyD;AAvBlG;AAwBQ,UAAM,WAAU,gBAAK,eAAL,mBAAiB,IAAI,UAArB,mBAA4B;AAE5C,QAAI,CAAC,SAAS;AACV,YAAM,IAAI,MAAM,gCAAgC,IAAI,GAAG;AAAA,IAC3D;AAEA,WAAO,mBAAmB,MAAM,QAAQ,MAAM,+BAA+B,iDAAgB,SAAS,CAAC;AAAA,EAC3G;AAAA,EAEA,MAAa,gBAAuD;AAChE,UAAM,YAAY,MAAM,KAAK,UAAU;AAEvC,WAAO,MAAM,KAAK,UAAU,OAAO,CAAC,EAAE;AAAA,MAClC,CAAC,KAAK,EAAC,QAAO,MAAM;AAChB,YAAI,QAAQ,IAAI,IAAI;AAAA,UAChB,GAAG;AAAA,UACH,QAAQ,QAAQ,UAAU,YAAY;AAAA,QAC1C;AAEA,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAEO,QAAc;AAjDzB;AAkDQ,eAAK,YAAL,mBAAc;AAEd,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ResourceAccessPluginRequirement } from "../../bundler/plugins/resource-access/index.js";
|
|
2
|
+
import type { IsolatedStylesPluginFiles } from "../../bundler/plugins/isolated-styles/index.js";
|
|
3
|
+
import { ContentScriptWorld, type ContentScriptEntrypointOptions } from "../../../types/content.js";
|
|
4
|
+
/** Reject unavailable destinations and warn about likely missing query flags without changing CSS routing. */
|
|
5
|
+
export declare const validateContentStyles: (entry: string, options: ContentScriptEntrypointOptions | undefined, files: IsolatedStylesPluginFiles) => readonly string[];
|
|
6
|
+
export declare const createPageAccessRequirements: (entries: ReadonlyMap<string, ContentScriptEntrypointOptions>, pages: ReadonlyMap<string, string>) => ResourceAccessPluginRequirement[];
|
|
7
|
+
export declare const getContentChunkName: (world: ContentScriptWorld) => string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isContentScriptFrameNavigation } from "./../../../shared/content/index.js";
|
|
2
|
+
import { hasIsolatedTarget } from "./utils.js";
|
|
3
|
+
import { ContentScriptMatches, ContentScriptWorld } from "./../../../types/content.js";
|
|
4
|
+
import { EntrypointType } from "./../../../types/entrypoint.js";
|
|
5
|
+
const validateContentStyles = (entry, options, files) => {
|
|
6
|
+
var _a;
|
|
7
|
+
if (!options) return [];
|
|
8
|
+
if (files.isolated.length > 0 && isContentScriptFrameNavigation(options.isolation)) {
|
|
9
|
+
throw new Error(
|
|
10
|
+
`Entrypoint "${entry}" uses ?isolation CSS with isolation.page/isolation.src, but has no local render target. Import these styles in the embedded page instead.`
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
if (hasIsolatedTarget(options) && files.document.length > 0 && files.isolated.length === 0) {
|
|
14
|
+
return [
|
|
15
|
+
`[adnbn:missing-isolation-css] Entrypoint "${entry}" uses isolation: "${(_a = options.isolation) == null ? void 0 : _a.type}", but has no CSS marked with ?isolation. Imported CSS will be delivered to the page document. If these styles belong to the isolated UI, import them with ?isolation. Document-only styles are valid; this warning can be suppressed with bundler ignoreWarnings.`
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
return [];
|
|
19
|
+
};
|
|
20
|
+
const createPageAccessRequirements = (entries, pages) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const requirements = [];
|
|
23
|
+
for (const [entry, options] of entries) {
|
|
24
|
+
const alias = (_a = options.isolation) == null ? void 0 : _a.page;
|
|
25
|
+
if (alias === void 0) continue;
|
|
26
|
+
const resource = pages.get(alias);
|
|
27
|
+
if (!resource) {
|
|
28
|
+
throw new Error(`Content entrypoint "${entry}" references unknown page "${alias}"`);
|
|
29
|
+
}
|
|
30
|
+
requirements.push({
|
|
31
|
+
resource,
|
|
32
|
+
matches: options.matches ?? ContentScriptMatches,
|
|
33
|
+
issuer: `Content entrypoint "${entry}" embedding page "${alias}"`,
|
|
34
|
+
hint: "add matches to the page or narrow the content matches"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return requirements;
|
|
38
|
+
};
|
|
39
|
+
const getContentChunkName = (world) => {
|
|
40
|
+
return `${world === ContentScriptWorld.Main ? "common-main" : "common"}.${EntrypointType.ContentScript}`;
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
createPageAccessRequirements,
|
|
44
|
+
getContentChunkName,
|
|
45
|
+
validateContentStyles
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=bundler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/bundler.ts"],"sourcesContent":["import type {ResourceAccessPluginRequirement} from \"@cli/bundler/plugins/resource-access\";\nimport type {IsolatedStylesPluginFiles} from \"@cli/bundler/plugins/isolated-styles\";\nimport {isContentScriptFrameNavigation} from \"@shared/content\";\nimport {hasIsolatedTarget} from \"./utils\";\n\nimport {ContentScriptMatches, ContentScriptWorld, type ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointType} from \"@typing/entrypoint\";\n\n/** Reject unavailable destinations and warn about likely missing query flags without changing CSS routing. */\nexport const validateContentStyles = (\n entry: string,\n options: ContentScriptEntrypointOptions | undefined,\n files: IsolatedStylesPluginFiles\n): readonly string[] => {\n if (!options) return [];\n if (files.isolated.length > 0 && isContentScriptFrameNavigation(options.isolation)) {\n throw new Error(\n `Entrypoint \"${entry}\" uses ?isolation CSS with isolation.page/isolation.src, but has no local render target. Import these styles in the embedded page instead.`\n );\n }\n if (hasIsolatedTarget(options) && files.document.length > 0 && files.isolated.length === 0) {\n return [\n `[adnbn:missing-isolation-css] Entrypoint \"${entry}\" uses isolation: \"${options.isolation?.type}\", but has no CSS marked with ?isolation. Imported CSS will be delivered to the page document. If these styles belong to the isolated UI, import them with ?isolation. Document-only styles are valid; this warning can be suppressed with bundler ignoreWarnings.`,\n ];\n }\n return [];\n};\n\nexport const createPageAccessRequirements = (\n entries: ReadonlyMap<string, ContentScriptEntrypointOptions>,\n pages: ReadonlyMap<string, string>\n): ResourceAccessPluginRequirement[] => {\n const requirements: ResourceAccessPluginRequirement[] = [];\n\n for (const [entry, options] of entries) {\n const alias = options.isolation?.page;\n if (alias === undefined) continue;\n\n const resource = pages.get(alias);\n if (!resource) {\n throw new Error(`Content entrypoint \"${entry}\" references unknown page \"${alias}\"`);\n }\n\n requirements.push({\n resource,\n matches: options.matches ?? ContentScriptMatches,\n issuer: `Content entrypoint \"${entry}\" embedding page \"${alias}\"`,\n hint: \"add matches to the page or narrow the content matches\",\n });\n }\n\n return requirements;\n};\n\nexport const getContentChunkName = (world: ContentScriptWorld): string => {\n return `${world === ContentScriptWorld.Main ? \"common-main\" : \"common\"}.${EntrypointType.ContentScript}`;\n};\n"],"mappings":"AAEA,SAAQ,sCAAqC;AAC7C,SAAQ,yBAAwB;AAEhC,SAAQ,sBAAsB,0BAA8D;AAC5F,SAAQ,sBAAqB;AAGtB,MAAM,wBAAwB,CACjC,OACA,SACA,UACoB;AAbxB;AAcI,MAAI,CAAC,QAAS,QAAO,CAAC;AACtB,MAAI,MAAM,SAAS,SAAS,KAAK,+BAA+B,QAAQ,SAAS,GAAG;AAChF,UAAM,IAAI;AAAA,MACN,eAAe,KAAK;AAAA,IACxB;AAAA,EACJ;AACA,MAAI,kBAAkB,OAAO,KAAK,MAAM,SAAS,SAAS,KAAK,MAAM,SAAS,WAAW,GAAG;AACxF,WAAO;AAAA,MACH,6CAA6C,KAAK,uBAAsB,aAAQ,cAAR,mBAAmB,IAAI;AAAA,IACnG;AAAA,EACJ;AACA,SAAO,CAAC;AACZ;AAEO,MAAM,+BAA+B,CACxC,SACA,UACoC;AA/BxC;AAgCI,QAAM,eAAkD,CAAC;AAEzD,aAAW,CAAC,OAAO,OAAO,KAAK,SAAS;AACpC,UAAM,SAAQ,aAAQ,cAAR,mBAAmB;AACjC,QAAI,UAAU,OAAW;AAEzB,UAAM,WAAW,MAAM,IAAI,KAAK;AAChC,QAAI,CAAC,UAAU;AACX,YAAM,IAAI,MAAM,uBAAuB,KAAK,8BAA8B,KAAK,GAAG;AAAA,IACtF;AAEA,iBAAa,KAAK;AAAA,MACd;AAAA,MACA,SAAS,QAAQ,WAAW;AAAA,MAC5B,QAAQ,uBAAuB,KAAK,qBAAqB,KAAK;AAAA,MAC9D,MAAM;AAAA,IACV,CAAC;AAAA,EACL;AAEA,SAAO;AACX;AAEO,MAAM,sBAAsB,CAAC,UAAsC;AACtE,SAAO,GAAG,UAAU,mBAAmB,OAAO,gBAAgB,QAAQ,IAAI,eAAe,aAAa;AAC1G;","names":[]}
|
|
@@ -1,87 +1,146 @@
|
|
|
1
|
-
import { DefinePlugin } from "@rspack/core";
|
|
2
|
-
import { merge as mergeConfig } from "webpack-merge";
|
|
3
1
|
import ContentManager from "./ContentManager.js";
|
|
4
2
|
import Content from "./Content.js";
|
|
5
3
|
import Relay from "./Relay.js";
|
|
6
4
|
import RelayDeclaration from "./RelayDeclaration.js";
|
|
5
|
+
import { hasIsolatedTarget } from "./utils.js";
|
|
6
|
+
import { createPageAccessRequirements, getContentChunkName, validateContentStyles } from "./bundler.js";
|
|
7
|
+
import { createRelayModule, RelayModuleName } from "./relay-module.js";
|
|
7
8
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
9
|
+
import { PageFinder } from "./../../../cli/entrypoint/index.js";
|
|
10
|
+
import { getContentLayer } from "./../../../cli/bundler/utils/layers.js";
|
|
11
|
+
import {
|
|
12
|
+
appFilenameResolver,
|
|
13
|
+
ChunkLoaderPlugin,
|
|
14
|
+
EntrypointPlugin,
|
|
15
|
+
onlyViaTopLevelEntry,
|
|
16
|
+
IsolatedStylesPlugin,
|
|
17
|
+
ResourceAccessPlugin,
|
|
18
|
+
GenerateModulePlugin
|
|
19
|
+
} from "./../../../cli/bundler/index.js";
|
|
10
20
|
import { Command } from "./../../../types/app.js";
|
|
21
|
+
import { ContentScriptStylesRuntimeProperty, ContentScriptWorld } from "./../../../types/content.js";
|
|
11
22
|
var content_default = definePlugin(() => {
|
|
12
|
-
let
|
|
13
|
-
let
|
|
14
|
-
let
|
|
23
|
+
let contentProvider;
|
|
24
|
+
let relayProvider;
|
|
25
|
+
let contentManager;
|
|
15
26
|
let relayDeclaration;
|
|
16
27
|
return {
|
|
17
28
|
name: "adnbn:content",
|
|
18
|
-
startup:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
startup: ({ config }) => {
|
|
30
|
+
contentProvider = new Content(config);
|
|
31
|
+
relayProvider = new Relay(config);
|
|
32
|
+
contentManager = new ContentManager(config).provider(contentProvider).provider(relayProvider);
|
|
22
33
|
relayDeclaration = new RelayDeclaration(config);
|
|
23
34
|
},
|
|
24
|
-
content: () =>
|
|
25
|
-
relay: () =>
|
|
35
|
+
content: () => contentProvider.files(),
|
|
36
|
+
relay: () => relayProvider.files(),
|
|
26
37
|
bundler: async ({ config }) => {
|
|
27
|
-
relayDeclaration.dictionary(await
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
|
|
38
|
+
relayDeclaration.dictionary(await relayProvider.dictionary()).build();
|
|
39
|
+
let entryOptionsByName = await contentManager.entryOptions();
|
|
40
|
+
const getModules = async () => ({
|
|
41
|
+
[RelayModuleName]: createRelayModule(await relayProvider.getOptionsMap())
|
|
42
|
+
});
|
|
43
|
+
const modulePlugin = new GenerateModulePlugin(await getModules());
|
|
44
|
+
if (config.command === Command.Watch) {
|
|
45
|
+
modulePlugin.watch(getModules);
|
|
46
|
+
}
|
|
47
|
+
const basePlugins = [
|
|
48
|
+
modulePlugin,
|
|
49
|
+
new ResourceAccessPlugin({
|
|
50
|
+
requirements: async () => {
|
|
51
|
+
if (!Array.from(entryOptionsByName.values()).some(
|
|
52
|
+
(options) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = options.isolation) == null ? void 0 : _a.page) !== void 0;
|
|
55
|
+
}
|
|
56
|
+
)) {
|
|
57
|
+
return [];
|
|
58
|
+
}
|
|
59
|
+
const views = await new PageFinder(config).views();
|
|
60
|
+
const pages = new Map(Array.from(views.values(), (view) => [view.alias, view.filename]));
|
|
61
|
+
return createPageAccessRequirements(entryOptionsByName, pages);
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
];
|
|
65
|
+
if (await contentManager.empty()) {
|
|
31
66
|
if (config.debug) {
|
|
32
67
|
console.warn("Content script or relay entries not found");
|
|
33
68
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return manager.entries();
|
|
42
|
-
});
|
|
69
|
+
return { plugins: basePlugins };
|
|
70
|
+
}
|
|
71
|
+
const entries = await contentManager.entries();
|
|
72
|
+
const getEntryWorld = (name) => {
|
|
73
|
+
const options = entryOptionsByName.get(name);
|
|
74
|
+
if (!options) {
|
|
75
|
+
throw new Error(`Execution world for content entrypoint "${name}" is unavailable`);
|
|
43
76
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const nm = module;
|
|
55
|
-
if (!nm.resource) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
if (nm.resource.startsWith(getResolvePath(getSourcePath(config)))) {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return entryTypeFilter(module, context);
|
|
62
|
-
},
|
|
63
|
-
chunks: (chunk) => {
|
|
64
|
-
return manager.likely(chunk.name);
|
|
65
|
-
},
|
|
66
|
-
enforce: false,
|
|
67
|
-
reuseExistingChunk: true,
|
|
68
|
-
priority: 20
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
77
|
+
return options.world === ContentScriptWorld.Main ? ContentScriptWorld.Main : ContentScriptWorld.Isolated;
|
|
78
|
+
};
|
|
79
|
+
const entrypointPlugin = EntrypointPlugin.from(entries).virtual((file) => contentManager.virtual(file)).entryOptions((name) => {
|
|
80
|
+
const world = getEntryWorld(name);
|
|
81
|
+
return {
|
|
82
|
+
// MAIN cannot resolve an installed extension URL without crossing contexts.
|
|
83
|
+
// ISOLATED keeps physical async chunks and resolves them through the extension API.
|
|
84
|
+
asyncChunks: world === ContentScriptWorld.Isolated,
|
|
85
|
+
layer: getContentLayer(world),
|
|
86
|
+
publicPath: ""
|
|
73
87
|
};
|
|
88
|
+
});
|
|
89
|
+
if (config.command === Command.Watch) {
|
|
90
|
+
entrypointPlugin.watch(async () => {
|
|
91
|
+
contentManager.clear();
|
|
92
|
+
relayDeclaration.dictionary(await relayProvider.dictionary()).build();
|
|
93
|
+
const entries2 = await contentManager.entries();
|
|
94
|
+
entryOptionsByName = await contentManager.entryOptions();
|
|
95
|
+
return entries2;
|
|
96
|
+
});
|
|
74
97
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
const isContentModule = onlyViaTopLevelEntry(["content", "relay"]);
|
|
99
|
+
const createCacheGroup = (world) => ({
|
|
100
|
+
minChunks: 2,
|
|
101
|
+
name: getContentChunkName(world),
|
|
102
|
+
test: (module, context) => {
|
|
103
|
+
const normalModule = module;
|
|
104
|
+
if (!normalModule.resource) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
return isContentModule(module, context);
|
|
108
|
+
},
|
|
109
|
+
chunks: (chunk) => chunk.name !== void 0 && entryOptionsByName.has(chunk.name) && getEntryWorld(chunk.name) === world,
|
|
110
|
+
enforce: false,
|
|
111
|
+
reuseExistingChunk: false,
|
|
112
|
+
priority: 20
|
|
81
113
|
});
|
|
114
|
+
return {
|
|
115
|
+
plugins: [
|
|
116
|
+
entrypointPlugin,
|
|
117
|
+
new ChunkLoaderPlugin({
|
|
118
|
+
test: (entry) => entryOptionsByName.has(entry) && getEntryWorld(entry) === ContentScriptWorld.Isolated
|
|
119
|
+
}),
|
|
120
|
+
new IsolatedStylesPlugin({
|
|
121
|
+
cssFilename: appFilenameResolver(config.app, config.cssFilename, config.cssDir),
|
|
122
|
+
cssChunkFilename: appFilenameResolver(config.app, config.cssFilename, config.cssDir),
|
|
123
|
+
property: ContentScriptStylesRuntimeProperty,
|
|
124
|
+
test: (entry) => {
|
|
125
|
+
const options = entryOptionsByName.get(entry);
|
|
126
|
+
return options !== void 0 && hasIsolatedTarget(options);
|
|
127
|
+
},
|
|
128
|
+
validate: (entry, files) => validateContentStyles(entry, entryOptionsByName.get(entry), files)
|
|
129
|
+
}),
|
|
130
|
+
...basePlugins
|
|
131
|
+
],
|
|
132
|
+
optimization: config.commonChunks ? {
|
|
133
|
+
splitChunks: {
|
|
134
|
+
cacheGroups: {
|
|
135
|
+
adnbnContentIsolated: createCacheGroup(ContentScriptWorld.Isolated),
|
|
136
|
+
adnbnContentMain: createCacheGroup(ContentScriptWorld.Main)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} : void 0
|
|
140
|
+
};
|
|
82
141
|
},
|
|
83
142
|
manifest: async ({ manifest }) => {
|
|
84
|
-
manifest.setContentScripts(await
|
|
143
|
+
manifest.setContentScripts(await contentManager.manifest()).appendHostPermissions(await contentManager.hostPermissions()).appendOptionalHostPermissions(await contentManager.optionalHostPermissions()).appendPermissions(await contentManager.permissions()).appendOptionalPermissions(await contentManager.optionalPermissions());
|
|
85
144
|
}
|
|
86
145
|
};
|
|
87
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/index.ts"],"sourcesContent":["import {Configuration as RspackConfig, DefinePlugin, NormalModule} from \"@rspack/core\";\nimport {merge as mergeConfig} from \"webpack-merge\";\n\nimport ContentManager from \"./ContentManager\";\nimport Content from \"./Content\";\nimport Relay from \"./Relay\";\nimport RelayDeclaration from \"./RelayDeclaration\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {EntrypointPlugin, onlyViaTopLevelEntry} from \"@cli/bundler\";\nimport {getResolvePath, getSourcePath} from \"@cli/resolvers/path\";\n\nimport {Command} from \"@typing/app\";\nimport {RelayOptions} from \"@typing/relay\";\n\nexport default definePlugin(() => {\n let content: Content;\n let relay: Relay;\n let manager: ContentManager;\n let relayDeclaration: RelayDeclaration;\n\n return {\n name: \"adnbn:content\",\n startup: async ({config}) => {\n content = new Content(config);\n relay = new Relay(config);\n\n // prettier-ignore\n manager = new ContentManager(config)\n .provider(content)\n .provider(relay);\n\n relayDeclaration = new RelayDeclaration(config);\n },\n content: () => content.files(),\n relay: () => relay.files(),\n bundler: async ({config}) => {\n relayDeclaration.dictionary(await relay.dictionary()).build();\n\n let rspack: RspackConfig = {};\n let options: Record<string, RelayOptions> = {};\n\n if (await manager.empty()) {\n if (config.debug) {\n console.warn(\"Content script or relay entries not found\");\n }\n } else {\n options = await relay.getOptionsMap();\n\n // prettier-ignore\n const plugin = EntrypointPlugin.from(await manager.entries())\n .virtual(file => manager.virtual(file));\n\n if (config.command === Command.Watch) {\n plugin.watch(async () => {\n manager.clear();\n\n relayDeclaration.dictionary(await relay.dictionary()).build();\n\n return manager.entries();\n });\n }\n\n const entryTypeFilter = onlyViaTopLevelEntry([\"content\", \"relay\"]);\n\n rspack = {\n plugins: [plugin],\n optimization: {\n splitChunks: {\n cacheGroups: {\n adnbnContent: {\n minChunks: 2,\n name: manager.chunkName(),\n test: (module, context) => {\n const nm = module as NormalModule;\n\n if (!nm.resource) {\n return false;\n }\n\n if (nm.resource.startsWith(getResolvePath(getSourcePath(config)))) {\n return false;\n }\n\n return entryTypeFilter(module, context);\n },\n chunks: (chunk): boolean => {\n return manager.likely(chunk.name);\n },\n enforce: false,\n reuseExistingChunk: true,\n priority: 20,\n },\n },\n },\n },\n };\n }\n\n return mergeConfig(rspack, {\n plugins: [\n new DefinePlugin({\n __ADNBN_RELAY_OPTIONS__: JSON.stringify(options),\n }),\n ],\n });\n },\n manifest: async ({manifest}) => {\n // prettier-ignore\n manifest\n .setContentScripts(await manager.manifest())\n .appendHostPermissions(await manager.hostPermissions())\n .appendOptionalHostPermissions(await manager.optionalHostPermissions())\n .appendPermissions(await manager.permissions())\n .appendOptionalPermissions(await manager.optionalPermissions());\n },\n };\n});\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/index.ts"],"sourcesContent":["import type {Chunk, Configuration as RspackConfig, NormalModule, Plugins} from \"@rspack/core\";\n\nimport ContentManager from \"./ContentManager\";\nimport Content from \"./Content\";\nimport Relay from \"./Relay\";\nimport RelayDeclaration from \"./RelayDeclaration\";\nimport {hasIsolatedTarget} from \"./utils\";\nimport {createPageAccessRequirements, getContentChunkName, validateContentStyles} from \"./bundler\";\nimport {createRelayModule, RelayModuleName} from \"./relay-module\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {PageFinder} from \"@cli/entrypoint/index.js\";\nimport {getContentLayer} from \"@cli/bundler/utils/layers\";\n\nimport {\n appFilenameResolver,\n ChunkLoaderPlugin,\n EntrypointPlugin,\n onlyViaTopLevelEntry,\n IsolatedStylesPlugin,\n ResourceAccessPlugin,\n GenerateModulePlugin,\n} from \"@cli/bundler\";\n\nimport {Command} from \"@typing/app\";\nimport {ContentScriptStylesRuntimeProperty, ContentScriptWorld} from \"@typing/content\";\n\nexport default definePlugin(() => {\n let contentProvider: Content;\n let relayProvider: Relay;\n let contentManager: ContentManager;\n let relayDeclaration: RelayDeclaration;\n\n return {\n name: \"adnbn:content\",\n startup: ({config}) => {\n contentProvider = new Content(config);\n relayProvider = new Relay(config);\n\n // prettier-ignore\n contentManager = new ContentManager(config)\n .provider(contentProvider)\n .provider(relayProvider);\n\n relayDeclaration = new RelayDeclaration(config);\n },\n content: () => contentProvider.files(),\n relay: () => relayProvider.files(),\n bundler: async ({config}) => {\n relayDeclaration.dictionary(await relayProvider.dictionary()).build();\n\n let entryOptionsByName = await contentManager.entryOptions();\n\n const getModules = async () => ({\n [RelayModuleName]: createRelayModule(await relayProvider.getOptionsMap()),\n });\n const modulePlugin = new GenerateModulePlugin(await getModules());\n\n if (config.command === Command.Watch) {\n modulePlugin.watch(getModules);\n }\n\n const basePlugins: Plugins = [\n modulePlugin,\n new ResourceAccessPlugin({\n requirements: async () => {\n if (\n !Array.from(entryOptionsByName.values()).some(\n options => options.isolation?.page !== undefined\n )\n ) {\n return [];\n }\n\n const views = await new PageFinder(config).views();\n const pages = new Map(Array.from(views.values(), view => [view.alias, view.filename]));\n return createPageAccessRequirements(entryOptionsByName, pages);\n },\n }),\n ];\n\n if (await contentManager.empty()) {\n if (config.debug) {\n console.warn(\"Content script or relay entries not found\");\n }\n\n return {plugins: basePlugins};\n }\n\n const entries = await contentManager.entries();\n const getEntryWorld = (name: string): ContentScriptWorld => {\n const options = entryOptionsByName.get(name);\n\n if (!options) {\n throw new Error(`Execution world for content entrypoint \"${name}\" is unavailable`);\n }\n\n return options.world === ContentScriptWorld.Main\n ? ContentScriptWorld.Main\n : ContentScriptWorld.Isolated;\n };\n\n // prettier-ignore\n const entrypointPlugin = EntrypointPlugin.from(entries)\n .virtual(file => contentManager.virtual(file))\n .entryOptions(name => {\n const world = getEntryWorld(name);\n\n return {\n // MAIN cannot resolve an installed extension URL without crossing contexts.\n // ISOLATED keeps physical async chunks and resolves them through the extension API.\n asyncChunks: world === ContentScriptWorld.Isolated,\n layer: getContentLayer(world),\n publicPath: \"\",\n };\n });\n\n if (config.command === Command.Watch) {\n entrypointPlugin.watch(async () => {\n contentManager.clear();\n\n relayDeclaration.dictionary(await relayProvider.dictionary()).build();\n\n const entries = await contentManager.entries();\n entryOptionsByName = await contentManager.entryOptions();\n\n return entries;\n });\n }\n\n const isContentModule = onlyViaTopLevelEntry([\"content\", \"relay\"]);\n\n const createCacheGroup = (world: ContentScriptWorld) => ({\n minChunks: 2,\n name: getContentChunkName(world),\n test: (\n module: Parameters<typeof isContentModule>[0],\n context: Parameters<typeof isContentModule>[1]\n ) => {\n const normalModule = module as NormalModule;\n\n if (!normalModule.resource) {\n return false;\n }\n\n return isContentModule(module, context);\n },\n chunks: (chunk: Chunk): boolean =>\n chunk.name !== undefined &&\n entryOptionsByName.has(chunk.name) &&\n getEntryWorld(chunk.name) === world,\n enforce: false,\n reuseExistingChunk: false,\n priority: 20,\n });\n\n return {\n plugins: [\n entrypointPlugin,\n new ChunkLoaderPlugin({\n test: entry =>\n entryOptionsByName.has(entry) && getEntryWorld(entry) === ContentScriptWorld.Isolated,\n }),\n new IsolatedStylesPlugin({\n cssFilename: appFilenameResolver(config.app, config.cssFilename, config.cssDir),\n cssChunkFilename: appFilenameResolver(config.app, config.cssFilename, config.cssDir),\n property: ContentScriptStylesRuntimeProperty,\n test: entry => {\n const options = entryOptionsByName.get(entry);\n return options !== undefined && hasIsolatedTarget(options);\n },\n validate: (entry, files) => validateContentStyles(entry, entryOptionsByName.get(entry), files),\n }),\n ...basePlugins,\n ],\n optimization: config.commonChunks\n ? {\n splitChunks: {\n cacheGroups: {\n adnbnContentIsolated: createCacheGroup(ContentScriptWorld.Isolated),\n adnbnContentMain: createCacheGroup(ContentScriptWorld.Main),\n },\n },\n }\n : undefined,\n } satisfies RspackConfig;\n },\n manifest: async ({manifest}) => {\n // prettier-ignore\n manifest\n .setContentScripts(await contentManager.manifest())\n .appendHostPermissions(await contentManager.hostPermissions())\n .appendOptionalHostPermissions(await contentManager.optionalHostPermissions())\n .appendPermissions(await contentManager.permissions())\n .appendOptionalPermissions(await contentManager.optionalPermissions());\n },\n };\n});\n"],"mappings":"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","names":["entries"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const RelayModuleName = "#adnbn/relay";
|
|
2
|
+
const createRelayModule = (options) => (
|
|
3
|
+
// Preserve the JSON payload, including omitted optional values, without retaining unused data.
|
|
4
|
+
`export const options = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(options))});
|
|
5
|
+
`
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
RelayModuleName,
|
|
9
|
+
createRelayModule
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=relay-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/relay-module.ts"],"sourcesContent":["import type {RelayOptions} from \"@typing/relay\";\n\nexport const RelayModuleName = \"#adnbn/relay\";\n\nexport const createRelayModule = (options: Record<string, RelayOptions>): string =>\n // Preserve the JSON payload, including omitted optional values, without retaining unused data.\n `export const options = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(options))});\\n`;\n"],"mappings":"AAEO,MAAM,kBAAkB;AAExB,MAAM,oBAAoB,CAAC;AAAA;AAAA,EAE9B,mDAAmD,KAAK,UAAU,KAAK,UAAU,OAAO,CAAC,CAAC;AAAA;AAAA;","names":[]}
|
|
@@ -16,7 +16,7 @@ export interface ContentDriver<O extends ContentScriptEntrypointOptions> {
|
|
|
16
16
|
optionalPermissions(): Promise<ManifestOptionalPermissions>;
|
|
17
17
|
}
|
|
18
18
|
export interface ContentProvider<O extends ContentScriptEntrypointOptions> {
|
|
19
|
-
virtual(file: EntrypointFile): string;
|
|
19
|
+
virtual(file: EntrypointFile, options?: ContentScriptEntrypointOptions): string;
|
|
20
20
|
driver(): ContentDriver<O>;
|
|
21
21
|
clear(): this;
|
|
22
22
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import { ContentScriptConfig, ContentScriptEntrypointOptions } from "../../../types/content.js";
|
|
2
|
+
/** ShadowRoot or a blank iframe provides a local target for isolated styles and UI. */
|
|
3
|
+
export declare const hasIsolatedTarget: (options: ContentScriptEntrypointOptions) => boolean;
|
|
2
4
|
export declare const getContentScriptConfigFromOptions: (options: ContentScriptEntrypointOptions) => ContentScriptConfig;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
|
+
import { isContentScriptFrameNavigation } from "./../../../shared/content/index.js";
|
|
3
|
+
import { ContentScriptIsolation } from "./../../../types/content.js";
|
|
4
|
+
const hasIsolatedTarget = (options) => {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
return ((_a = options.isolation) == null ? void 0 : _a.type) === ContentScriptIsolation.Shadow || ((_b = options.isolation) == null ? void 0 : _b.type) === ContentScriptIsolation.Iframe && !isContentScriptFrameNavigation(options.isolation);
|
|
7
|
+
};
|
|
2
8
|
const getContentScriptConfigFromOptions = (options) => {
|
|
3
9
|
const config = _.pick(options, [
|
|
4
10
|
"matches",
|
|
@@ -21,6 +27,7 @@ const getContentScriptConfigFromOptions = (options) => {
|
|
|
21
27
|
};
|
|
22
28
|
};
|
|
23
29
|
export {
|
|
24
|
-
getContentScriptConfigFromOptions
|
|
30
|
+
getContentScriptConfigFromOptions,
|
|
31
|
+
hasIsolatedTarget
|
|
25
32
|
};
|
|
26
33
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/utils.ts"],"sourcesContent":["import _ from \"lodash\";\n\nimport {ContentScriptConfig, ContentScriptEntrypointOptions} from \"@typing/content\";\n\nexport const getContentScriptConfigFromOptions = (options: ContentScriptEntrypointOptions): ContentScriptConfig => {\n const config = _.pick(options, [\n \"matches\",\n \"excludeMatches\",\n \"includeGlobs\",\n \"excludeGlobs\",\n \"allFrames\",\n \"runAt\",\n \"world\",\n \"matchAboutBlank\",\n \"matchOriginAsFallback\",\n ]) as ContentScriptConfig;\n\n const sort = (arr?: string[]) => arr?.toSorted((a, b) => a.localeCompare(b));\n\n return {\n ...config,\n matches: sort(config.matches),\n excludeMatches: sort(config.excludeMatches),\n includeGlobs: sort(config.includeGlobs),\n excludeGlobs: sort(config.excludeGlobs),\n };\n};\n"],"mappings":"AAAA,OAAO,OAAO;
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/utils.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {isContentScriptFrameNavigation} from \"@shared/content\";\n\nimport {ContentScriptConfig, ContentScriptEntrypointOptions, ContentScriptIsolation} from \"@typing/content\";\n\n/** ShadowRoot or a blank iframe provides a local target for isolated styles and UI. */\nexport const hasIsolatedTarget = (options: ContentScriptEntrypointOptions): boolean =>\n options.isolation?.type === ContentScriptIsolation.Shadow ||\n (options.isolation?.type === ContentScriptIsolation.Iframe && !isContentScriptFrameNavigation(options.isolation));\n\nexport const getContentScriptConfigFromOptions = (options: ContentScriptEntrypointOptions): ContentScriptConfig => {\n const config = _.pick(options, [\n \"matches\",\n \"excludeMatches\",\n \"includeGlobs\",\n \"excludeGlobs\",\n \"allFrames\",\n \"runAt\",\n \"world\",\n \"matchAboutBlank\",\n \"matchOriginAsFallback\",\n ]) as ContentScriptConfig;\n\n const sort = (arr?: string[]) => arr?.toSorted((a, b) => a.localeCompare(b));\n\n return {\n ...config,\n matches: sort(config.matches),\n excludeMatches: sort(config.excludeMatches),\n includeGlobs: sort(config.includeGlobs),\n excludeGlobs: sort(config.excludeGlobs),\n };\n};\n"],"mappings":"AAAA,OAAO,OAAO;AACd,SAAQ,sCAAqC;AAE7C,SAA6D,8BAA6B;AAGnF,MAAM,oBAAoB,CAAC,YAAkD;AANpF;AAOI,wBAAQ,cAAR,mBAAmB,UAAS,uBAAuB,YAClD,aAAQ,cAAR,mBAAmB,UAAS,uBAAuB,UAAU,CAAC,+BAA+B,QAAQ,SAAS;AAAA;AAE5G,MAAM,oCAAoC,CAAC,YAAiE;AAC/G,QAAM,SAAS,EAAE,KAAK,SAAS;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,CAAC;AAED,QAAM,OAAO,CAAC,QAAmB,2BAAK,SAAS,CAAC,GAAG,MAAM,EAAE,cAAc,CAAC;AAE1E,SAAO;AAAA,IACH,GAAG;AAAA,IACH,SAAS,KAAK,OAAO,OAAO;AAAA,IAC5B,gBAAgB,KAAK,OAAO,cAAc;AAAA,IAC1C,cAAc,KAAK,OAAO,YAAY;AAAA,IACtC,cAAc,KAAK,OAAO,YAAY;AAAA,EAC1C;AACJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileBuilder } from "../../../plugins/typescript/index.js";
|
|
2
2
|
import { ReadonlyConfig } from "../../../../types/config.js";
|
|
3
|
-
export default class extends FileBuilder {
|
|
3
|
+
export default class IconDeclaration extends FileBuilder {
|
|
4
4
|
protected names: Set<string>;
|
|
5
5
|
constructor(config: ReadonlyConfig);
|
|
6
6
|
protected filename(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FileBuilder } from "./../../../../cli/plugins/typescript/index.js";
|
|
2
|
-
class
|
|
2
|
+
class IconDeclaration extends FileBuilder {
|
|
3
3
|
names = /* @__PURE__ */ new Set();
|
|
4
4
|
constructor(config) {
|
|
5
5
|
super(config);
|
|
@@ -12,10 +12,10 @@ class IconDeclaration_default extends FileBuilder {
|
|
|
12
12
|
}
|
|
13
13
|
template() {
|
|
14
14
|
let content = this.readFile();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
content = content.replace(
|
|
16
|
+
"// :icon-names",
|
|
17
|
+
Array.from(this.names, (name) => `${JSON.stringify(name)}: true;`).join("\n ")
|
|
18
|
+
);
|
|
19
19
|
return content;
|
|
20
20
|
}
|
|
21
21
|
setNames(names) {
|
|
@@ -24,6 +24,6 @@ class IconDeclaration_default extends FileBuilder {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
export {
|
|
27
|
-
|
|
27
|
+
IconDeclaration as default
|
|
28
28
|
};
|
|
29
29
|
//# sourceMappingURL=IconDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/plugins/icon/declaration/IconDeclaration.ts"],"sourcesContent":["import {FileBuilder} from \"@cli/plugins/typescript\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default class extends FileBuilder {\n protected names = new Set<string>();\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n protected filename(): string {\n return \"icon.d.ts\";\n }\n\n protected url(): string {\n return import.meta.url;\n }\n\n protected template(): string {\n let content = this.readFile();\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/plugins/icon/declaration/IconDeclaration.ts"],"sourcesContent":["import {FileBuilder} from \"@cli/plugins/typescript\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default class IconDeclaration extends FileBuilder {\n protected names = new Set<string>();\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n protected filename(): string {\n return \"icon.d.ts\";\n }\n\n protected url(): string {\n return import.meta.url;\n }\n\n protected template(): string {\n let content = this.readFile();\n\n content = content.replace(\n \"// :icon-names\",\n Array.from(this.names, name => `${JSON.stringify(name)}: true;`).join(\"\\n \")\n );\n\n return content;\n }\n\n public setNames(names: Set<string>): this {\n this.names = names;\n\n return this;\n }\n}\n"],"mappings":"AAAA,SAAQ,mBAAkB;AAI1B,MAAO,wBAAsC,YAAY;AAAA,EAC3C,QAAQ,oBAAI,IAAY;AAAA,EAElC,YAAY,QAAwB;AAChC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,WAAmB;AACzB,WAAO;AAAA,EACX;AAAA,EAEU,MAAc;AACpB,WAAO,YAAY;AAAA,EACvB;AAAA,EAEU,WAAmB;AACzB,QAAI,UAAU,KAAK,SAAS;AAE5B,cAAU,QAAQ;AAAA,MACd;AAAA,MACA,MAAM,KAAK,KAAK,OAAO,UAAQ,GAAG,KAAK,UAAU,IAAI,CAAC,SAAS,EAAE,KAAK,YAAY;AAAA,IACtF;AAEA,WAAO;AAAA,EACX;AAAA,EAEO,SAAS,OAA0B;AACtC,SAAK,QAAQ;AAEb,WAAO;AAAA,EACX;AACJ;","names":[]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import ":package";
|
|
2
2
|
|
|
3
3
|
declare module ":package" {
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export function changeSidebarIcon(icon?: IconName, tab?: number | chrome.tabs.Tab): Promise<void>;
|
|
4
|
+
export interface IconNameRegistry {
|
|
5
|
+
// :icon-names
|
|
6
|
+
}
|
|
9
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const IconModuleName = "#adnbn/icon";
|
|
2
|
+
const createIconModule = (groups) => (
|
|
3
|
+
// Preserve own __proto__ keys and allow unused data to be removed from optimized bundles.
|
|
4
|
+
`export const groups = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(groups))});
|
|
5
|
+
`
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
IconModuleName,
|
|
9
|
+
createIconModule
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=icon-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/icon/icon-module.ts"],"sourcesContent":["export const IconModuleName = \"#adnbn/icon\";\n\nexport const createIconModule = (groups: Record<string, Record<number, string>>): string =>\n // Preserve own __proto__ keys and allow unused data to be removed from optimized bundles.\n `export const groups = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(groups))});\\n`;\n"],"mappings":"AAAO,MAAM,iBAAiB;AAEvB,MAAM,mBAAmB,CAAC;AAAA;AAAA,EAE7B,kDAAkD,KAAK,UAAU,KAAK,UAAU,MAAM,CAAC,CAAC;AAAA;AAAA;","names":[]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { CopyRspackPlugin
|
|
1
|
+
import { CopyRspackPlugin } from "@rspack/core";
|
|
2
2
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
3
|
+
import { GenerateModulePlugin } from "./../../../cli/bundler/index.js";
|
|
3
4
|
import Icon from "./Icon.js";
|
|
5
|
+
import { createIconModule, IconModuleName } from "./icon-module.js";
|
|
4
6
|
import { IconDeclaration } from "./declaration/index.js";
|
|
5
7
|
var icon_default = definePlugin(() => {
|
|
6
8
|
let icon;
|
|
@@ -17,8 +19,8 @@ var icon_default = definePlugin(() => {
|
|
|
17
19
|
new CopyRspackPlugin({
|
|
18
20
|
patterns: await icon.copy()
|
|
19
21
|
}),
|
|
20
|
-
new
|
|
21
|
-
|
|
22
|
+
new GenerateModulePlugin({
|
|
23
|
+
[IconModuleName]: createIconModule(await icon.define())
|
|
22
24
|
})
|
|
23
25
|
]
|
|
24
26
|
};
|