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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/background/index.ts"],"sourcesContent":["import {Configuration as RspackConfig} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {virtualBackgroundModule} from \"@cli/virtual/index.js\";\n\nimport {EntrypointPlugin} from \"@cli/bundler\";\n\nimport Background from \"./Background\";\nimport BackgroundEntry from \"./BackgroundEntry\";\nimport BackgroundManifest from \"./BackgroundManifest\";\nimport Command from \"./Command\";\nimport Service from \"./Service\";\nimport ServiceDeclaration from \"./ServiceDeclaration\";\n\nimport {Command as AppCommand} from \"@typing/app\";\n\nexport default definePlugin(() => {\n let background: Background;\n let command: Command;\n let service: Service;\n let serviceDeclaration: ServiceDeclaration;\n\n return {\n name: \"adnbn:background\",\n startup: async ({config}) => {\n background = new Background(config);\n command = new Command(config);\n service = new Service(config);\n serviceDeclaration = new ServiceDeclaration(config);\n },\n background: () => background.files(),\n command: () => command.files(),\n service: () => service.files(),\n bundler: async ({config}) => {\n serviceDeclaration.dictionary(await service.dictionary()).build();\n\n if ((await background.empty()) && (await command.empty()) && (await service.empty())) {\n if (config.debug) {\n console.warn(\"Background, command or service entries not found\");\n }\n\n return {};\n }\n\n // prettier-ignore\n const backgroundPlugin = EntrypointPlugin.from(await background.entry().entries())\n .virtual(file => virtualBackgroundModule(file));\n\n // prettier-ignore\n const commandPlugin = EntrypointPlugin.from(await command.entry().entries())\n .virtual(file => command.virtual(file));\n\n // prettier-ignore\n const servicePlugin = EntrypointPlugin.from(await service.entry().entries())\n .virtual(file => service.virtual(file));\n\n if (config.command === AppCommand.Watch) {\n backgroundPlugin.watch(() => background.clear().entry().entries());\n\n commandPlugin.watch(async () => {\n // Clear the command cache\n await command.clear().commands();\n\n return command.entry().entries();\n });\n\n servicePlugin.watch(async () => {\n serviceDeclaration.dictionary(await service.clear().dictionary()).build();\n\n return service.entry().entries();\n });\n }\n\n return {\n plugins: [servicePlugin, commandPlugin, backgroundPlugin],\n optimization: {\n splitChunks: {\n chunks(chunk) {\n return chunk.name !== BackgroundEntry.name;\n },\n },\n },\n } satisfies RspackConfig;\n },\n manifest: async ({manifest}) => {\n // prettier-ignore\n const mft = new BackgroundManifest()\n .add(background.entry())\n .add(command.entry())\n .add(service.entry());\n\n manifest\n .setBackground(\n (await mft.hasBackground())\n ? {\n entry: BackgroundEntry.name,\n persistent: await mft.isPersistent(),\n }\n : undefined\n )\n .setCommands(await command.manifest());\n\n const permissions = await mft.getPermissions();\n const optionalPermissions = await mft.getOptionalPermissions();\n const hostPermissions = await mft.getHostPermissions();\n const optionalHostPermissions = await mft.getOptionalHostPermissions();\n\n if (permissions.size > 0) {\n manifest.appendPermissions(permissions);\n }\n\n if (optionalPermissions.size > 0) {\n manifest.appendOptionalPermissions(optionalPermissions);\n }\n\n if (hostPermissions.size > 0) {\n manifest.appendHostPermissions(hostPermissions);\n }\n\n if (optionalHostPermissions.size > 0) {\n manifest.appendOptionalHostPermissions(optionalHostPermissions);\n }\n },\n };\n});\n"],"mappings":"AAEA,SAAQ,oBAAmB;AAC3B,SAAQ,+BAA8B;AAEtC,SAAQ,wBAAuB;AAE/B,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,OAAO,wBAAwB;AAC/B,OAAO,aAAa;AACpB,OAAO,aAAa;AACpB,OAAO,wBAAwB;AAE/B,SAAQ,WAAW,kBAAiB;AAEpC,IAAO,qBAAQ,aAAa,MAAM;AAC9B,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,mBAAa,IAAI,WAAW,MAAM;AAClC,gBAAU,IAAI,QAAQ,MAAM;AAC5B,gBAAU,IAAI,QAAQ,MAAM;AAC5B,2BAAqB,IAAI,mBAAmB,MAAM;AAAA,IACtD;AAAA,IACA,YAAY,MAAM,WAAW,MAAM;AAAA,IACnC,SAAS,MAAM,QAAQ,MAAM;AAAA,IAC7B,SAAS,MAAM,QAAQ,MAAM;AAAA,IAC7B,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,yBAAmB,WAAW,MAAM,QAAQ,WAAW,CAAC,EAAE,MAAM;AAEhE,UAAK,MAAM,WAAW,MAAM,KAAO,MAAM,QAAQ,MAAM,KAAO,MAAM,QAAQ,MAAM,GAAI;AAClF,YAAI,OAAO,OAAO;AACd,kBAAQ,KAAK,kDAAkD;AAAA,QACnE;AAEA,eAAO,CAAC;AAAA,MACZ;AAGA,YAAM,mBAAmB,iBAAiB,KAAK,MAAM,WAAW,MAAM,EAAE,QAAQ,CAAC,EAC5E,QAAQ,UAAQ,wBAAwB,IAAI,CAAC;AAGlD,YAAM,gBAAgB,i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I,uBAAuB;AAC7D,YAAM,kBAAkB,MAAM,IAAI,mBAAmB;AACrD,YAAM,0BAA0B,MAAM,IAAI,2BAA2B;AAErE,UAAI,YAAY,OAAO,GAAG;AACtB,iBAAS,kBAAkB,WAAW;AAAA,MAC1C;AAEA,UAAI,oBAAoB,OAAO,GAAG;AAC9B,iBAAS,0BAA0B,mBAAmB;AAAA,MAC1D;AAEA,UAAI,gBAAgB,OAAO,GAAG;AAC1B,iBAAS,sBAAsB,eAAe;AAAA,MAClD;AAEA,UAAI,wBAAwB,OAAO,GAAG;AAClC,iBAAS,8BAA8B,uBAAuB;AAAA,MAClE;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/background/index.ts"],"sourcesContent":["import {Configuration as RspackConfig} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {virtualBackgroundModule} from \"@cli/virtual/index.js\";\n\nimport {EntrypointPlugin} from \"@cli/bundler\";\n\nimport Background from \"./Background\";\nimport BackgroundEntry from \"./BackgroundEntry\";\nimport BackgroundManifest from \"./BackgroundManifest\";\nimport Command from \"./Command\";\nimport Service from \"./Service\";\nimport ServiceDeclaration from \"./ServiceDeclaration\";\n\nimport {Command as AppCommand} from \"@typing/app\";\n\nexport default definePlugin(() => {\n let background: Background;\n let command: Command;\n let service: Service;\n let serviceDeclaration: ServiceDeclaration;\n\n return {\n name: \"adnbn:background\",\n startup: async ({config}) => {\n background = new Background(config);\n command = new Command(config);\n service = new Service(config);\n serviceDeclaration = new ServiceDeclaration(config);\n },\n background: () => background.files(),\n command: () => command.files(),\n service: () => service.files(),\n bundler: async ({config}) => {\n serviceDeclaration.dictionary(await service.dictionary()).build();\n\n if ((await background.empty()) && (await command.empty()) && (await service.empty())) {\n if (config.debug) {\n console.warn(\"Background, command or service entries not found\");\n }\n\n return {};\n }\n\n // prettier-ignore\n const backgroundPlugin = EntrypointPlugin.from(await background.entry().entries())\n .entryOptions({asyncChunks: false, runtime: false})\n .virtual(file => virtualBackgroundModule(file));\n\n // prettier-ignore\n const commandPlugin = EntrypointPlugin.from(await command.entry().entries())\n .virtual(file => command.virtual(file));\n\n // prettier-ignore\n const servicePlugin = EntrypointPlugin.from(await service.entry().entries())\n .virtual(file => service.virtual(file));\n\n if (config.command === AppCommand.Watch) {\n backgroundPlugin.watch(() => background.clear().entry().entries());\n\n commandPlugin.watch(async () => {\n // Clear the command cache\n await command.clear().commands();\n\n return command.entry().entries();\n });\n\n servicePlugin.watch(async () => {\n serviceDeclaration.dictionary(await service.clear().dictionary()).build();\n\n return service.entry().entries();\n });\n }\n\n return {\n plugins: [servicePlugin, commandPlugin, backgroundPlugin],\n optimization: {\n splitChunks: {\n chunks(chunk) {\n return chunk.name !== BackgroundEntry.name;\n },\n },\n },\n } satisfies RspackConfig;\n },\n manifest: async ({manifest}) => {\n // prettier-ignore\n const mft = new BackgroundManifest()\n .add(background.entry())\n .add(command.entry())\n .add(service.entry());\n\n manifest\n .setBackground(\n (await mft.hasBackground())\n ? {\n entry: BackgroundEntry.name,\n persistent: await mft.isPersistent(),\n }\n : undefined\n )\n .setCommands(await command.manifest());\n\n const permissions = await mft.getPermissions();\n const optionalPermissions = await mft.getOptionalPermissions();\n const hostPermissions = await mft.getHostPermissions();\n const optionalHostPermissions = await mft.getOptionalHostPermissions();\n\n if (permissions.size > 0) {\n manifest.appendPermissions(permissions);\n }\n\n if (optionalPermissions.size > 0) {\n manifest.appendOptionalPermissions(optionalPermissions);\n }\n\n if (hostPermissions.size > 0) {\n manifest.appendHostPermissions(hostPermissions);\n }\n\n if (optionalHostPermissions.size > 0) {\n manifest.appendOptionalHostPermissions(optionalHostPermissions);\n }\n },\n };\n});\n"],"mappings":"AAEA,SAAQ,oBAAmB;AAC3B,SAAQ,+BAA8B;AAEtC,SAAQ,wBAAuB;AAE/B,OAAO,gBAAgB;AACvB,OAAO,qBAAqB;AAC5B,OAAO,wBAAwB;AAC/B,OAAO,a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iBAAS,sBAAsB,eAAe;AAAA,MAClD;AAEA,UAAI,wBAAwB,OAAO,GAAG;AAClC,iBAAS,8BAA8B,uBAAuB;AAAA,MAClE;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
@@ -8,6 +8,6 @@ export default class extends ContentFinder implements ContentProvider<ContentScr
|
|
|
8
8
|
protected _driver?: ContentDriver<ContentScriptEntrypointOptions>;
|
|
9
9
|
constructor(config: ReadonlyConfig);
|
|
10
10
|
driver(): ContentDriver<ContentScriptEntrypointOptions>;
|
|
11
|
-
virtual(file: EntrypointFile): string;
|
|
11
|
+
virtual(file: EntrypointFile, options?: ContentScriptEntrypointOptions): string;
|
|
12
12
|
clear(): this;
|
|
13
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ContentDriver from "./ContentDriver.js";
|
|
2
2
|
import { ContentFinder } from "./../../../cli/entrypoint/index.js";
|
|
3
3
|
import { virtualContentScriptModule } from "./../../../cli/virtual/index.js";
|
|
4
|
+
import { isContentScriptFrameNavigation } from "./../../../shared/content/index.js";
|
|
4
5
|
class Content_default extends ContentFinder {
|
|
5
6
|
_driver;
|
|
6
7
|
constructor(config) {
|
|
@@ -9,11 +10,11 @@ class Content_default extends ContentFinder {
|
|
|
9
10
|
driver() {
|
|
10
11
|
return this._driver ?? (this._driver = new ContentDriver(this));
|
|
11
12
|
}
|
|
12
|
-
virtual(file) {
|
|
13
|
+
virtual(file, options) {
|
|
13
14
|
if (!this.holds(file)) {
|
|
14
15
|
throw new Error(`File ${file} not found for content script`);
|
|
15
16
|
}
|
|
16
|
-
return virtualContentScriptModule(file);
|
|
17
|
+
return virtualContentScriptModule(file, isContentScriptFrameNavigation(options == null ? void 0 : options.isolation));
|
|
17
18
|
}
|
|
18
19
|
clear() {
|
|
19
20
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/Content.ts"],"sourcesContent":["import ContentDriver from \"./ContentDriver\";\n\nimport {ContentProvider} from \"./types\";\n\nimport {ContentFinder} from \"@cli/entrypoint/index.js\";\nimport {virtualContentScriptModule} from \"@cli/virtual/index.js\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends ContentFinder implements ContentProvider<ContentScriptEntrypointOptions> {\n protected _driver?: ContentDriver<ContentScriptEntrypointOptions>;\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n public driver(): ContentDriver<ContentScriptEntrypointOptions> {\n return (this._driver ??= new ContentDriver(this));\n }\n\n public virtual(file: EntrypointFile): string {\n if (!this.holds(file)) {\n throw new Error(`File ${file} not found for content script`);\n }\n\n return virtualContentScriptModule(file);\n }\n\n public clear(): this {\n this._driver?.clear();\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,mBAAmB;AAI1B,SAAQ,qBAAoB;AAC5B,SAAQ,kCAAiC;
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/Content.ts"],"sourcesContent":["import ContentDriver from \"./ContentDriver\";\n\nimport {ContentProvider} from \"./types\";\n\nimport {ContentFinder} from \"@cli/entrypoint/index.js\";\nimport {virtualContentScriptModule} from \"@cli/virtual/index.js\";\nimport {isContentScriptFrameNavigation} from \"@shared/content\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends ContentFinder implements ContentProvider<ContentScriptEntrypointOptions> {\n protected _driver?: ContentDriver<ContentScriptEntrypointOptions>;\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n public driver(): ContentDriver<ContentScriptEntrypointOptions> {\n return (this._driver ??= new ContentDriver(this));\n }\n\n public virtual(file: EntrypointFile, options?: ContentScriptEntrypointOptions): string {\n if (!this.holds(file)) {\n throw new Error(`File ${file} not found for content script`);\n }\n\n return virtualContentScriptModule(file, isContentScriptFrameNavigation(options?.isolation));\n }\n\n public clear(): this {\n this._driver?.clear();\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,mBAAmB;AAI1B,SAAQ,qBAAoB;AAC5B,SAAQ,kCAAiC;AACzC,SAAQ,sCAAqC;AAM7C,MAAO,wBAAsB,cAAyE;AAAA,EACxF;AAAA,EAEV,YAAY,QAAwB;AAChC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEO,SAAwD;AAC3D,WAAQ,KAAK,YAAL,KAAK,UAAY,IAAI,cAAc,IAAI;AAAA,EACnD;AAAA,EAEO,QAAQ,MAAsB,SAAkD;AACnF,QAAI,CAAC,KAAK,MAAM,IAAI,GAAG;AACnB,YAAM,IAAI,MAAM,QAAQ,IAAI,+BAA+B;AAAA,IAC/D;AAEA,WAAO,2BAA2B,MAAM,+BAA+B,mCAAS,SAAS,CAAC;AAAA,EAC9F;AAAA,EAEO,QAAc;AA/BzB;AAgCQ,eAAK,YAAL,mBAAc;AAEd,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import ContentName from "./ContentName.js";
|
|
2
2
|
import { ContentGroupItems, ContentProvider } from "./types.js";
|
|
3
3
|
import { ReadonlyConfig } from "../../../types/config.js";
|
|
4
|
-
import { ContentScriptEntrypointOptions } from "../../../types/content.js";
|
|
4
|
+
import { ContentScriptEntrypointOptions, ContentScriptWorld, type ContentScriptWorldValue } from "../../../types/content.js";
|
|
5
5
|
import { EntrypointEntries, EntrypointFile } from "../../../types/entrypoint.js";
|
|
6
6
|
import { ManifestContentScripts, ManifestHostPermissions, ManifestOptionalPermissions, ManifestPermissions } from "../../../types/manifest.js";
|
|
7
|
-
export default class {
|
|
8
|
-
protected readonly
|
|
7
|
+
export default class ContentManager {
|
|
8
|
+
protected readonly config: ReadonlyConfig;
|
|
9
|
+
protected readonly providers: Set<ContentProvider<ContentScriptEntrypointOptions>>;
|
|
9
10
|
protected readonly names: ContentName;
|
|
10
11
|
protected _group?: ContentGroupItems<ContentScriptEntrypointOptions>;
|
|
11
12
|
protected _hostPermissions?: [ManifestHostPermissions, ManifestHostPermissions];
|
|
@@ -13,8 +14,11 @@ export default class {
|
|
|
13
14
|
constructor(config: ReadonlyConfig);
|
|
14
15
|
provider(provider: ContentProvider<ContentScriptEntrypointOptions>): this;
|
|
15
16
|
protected getGroup(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>>;
|
|
17
|
+
protected normalizeOptions(file: EntrypointFile, options: ContentScriptEntrypointOptions): ContentScriptEntrypointOptions;
|
|
16
18
|
group(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>>;
|
|
17
19
|
entries(): Promise<EntrypointEntries>;
|
|
20
|
+
/** Settings are keyed by the final grouped entrypoint name, not the original source files. */
|
|
21
|
+
entryOptions(): Promise<ReadonlyMap<string, ContentScriptEntrypointOptions>>;
|
|
18
22
|
manifest(): Promise<ManifestContentScripts>;
|
|
19
23
|
hostPermissions(): Promise<ManifestHostPermissions>;
|
|
20
24
|
optionalHostPermissions(): Promise<ManifestHostPermissions>;
|
|
@@ -25,7 +29,6 @@ export default class {
|
|
|
25
29
|
protected calculatePermissions(): Promise<[ManifestPermissions, ManifestOptionalPermissions]>;
|
|
26
30
|
virtual(file: EntrypointFile): string;
|
|
27
31
|
empty(): Promise<boolean>;
|
|
28
|
-
|
|
29
|
-
likely(name?: string): boolean;
|
|
32
|
+
protected resolveWorld(world?: ContentScriptWorldValue): ContentScriptWorld;
|
|
30
33
|
clear(): this;
|
|
31
34
|
}
|
|
@@ -1,31 +1,59 @@
|
|
|
1
1
|
import ContentName from "./ContentName.js";
|
|
2
|
-
import { getContentScriptConfigFromOptions } from "./utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { getContentScriptConfigFromOptions, hasIsolatedTarget } from "./utils.js";
|
|
3
|
+
import { getContentChunkName } from "./bundler.js";
|
|
4
|
+
import {
|
|
5
|
+
ContentScriptDeclarative,
|
|
6
|
+
ContentScriptIsolation,
|
|
7
|
+
ContentScriptWorld
|
|
8
|
+
} from "./../../../types/content.js";
|
|
9
|
+
class ContentManager {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
this.names = new ContentName(config);
|
|
13
|
+
Object.values(ContentScriptWorld).forEach((world) => this.names.reserve(getContentChunkName(world)));
|
|
14
|
+
}
|
|
15
|
+
config;
|
|
6
16
|
providers = /* @__PURE__ */ new Set();
|
|
7
17
|
names;
|
|
8
18
|
_group;
|
|
9
19
|
_hostPermissions;
|
|
10
20
|
_permissions;
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.names = new ContentName(config);
|
|
13
|
-
}
|
|
14
21
|
provider(provider) {
|
|
15
22
|
this.providers.add(provider);
|
|
16
23
|
return this;
|
|
17
24
|
}
|
|
18
25
|
async getGroup() {
|
|
19
|
-
const content = await Promise.all(
|
|
26
|
+
const content = await Promise.all(
|
|
27
|
+
Array.from(this.providers, (provider) => provider.driver().items())
|
|
28
|
+
);
|
|
20
29
|
const group = /* @__PURE__ */ new Map();
|
|
21
30
|
for (const items of content) {
|
|
22
31
|
for (const [name, item] of items) {
|
|
23
|
-
const
|
|
24
|
-
|
|
32
|
+
const options = this.normalizeOptions(item.file, item.options);
|
|
33
|
+
const entry = this.names.create(name, options);
|
|
34
|
+
group.set(entry, /* @__PURE__ */ new Set([...group.get(entry) || [], { ...item, options }]));
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
return group;
|
|
28
38
|
}
|
|
39
|
+
normalizeOptions(file, options) {
|
|
40
|
+
var _a, _b, _c;
|
|
41
|
+
const world = this.resolveWorld(options.world);
|
|
42
|
+
if (this.config.manifestVersion !== 2) {
|
|
43
|
+
if (world === ContentScriptWorld.Main && (((_a = options.isolation) == null ? void 0 : _a.type) === ContentScriptIsolation.Shadow || ((_b = options.isolation) == null ? void 0 : _b.type) === ContentScriptIsolation.Iframe && !(((_c = options.isolation) == null ? void 0 : _c.src) && /^https?:\/\//.test(options.isolation.src)))) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Content script "${file.file}" cannot use this isolation in the MAIN execution world; only external HTTP(S) isolation.src is supported`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
return options;
|
|
49
|
+
}
|
|
50
|
+
if (world === ContentScriptWorld.Main) {
|
|
51
|
+
console.warn(
|
|
52
|
+
`Content script "${file.file}" requests world "MAIN", but Addon Bone does not support MAIN content scripts in Manifest V2. It will be built and run in ISOLATED.`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return { ...options, world: ContentScriptWorld.Isolated };
|
|
56
|
+
}
|
|
29
57
|
async group() {
|
|
30
58
|
return this._group ?? (this._group = await this.getGroup());
|
|
31
59
|
}
|
|
@@ -36,15 +64,29 @@ class ContentManager_default {
|
|
|
36
64
|
}
|
|
37
65
|
return entries;
|
|
38
66
|
}
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
/** Settings are keyed by the final grouped entrypoint name, not the original source files. */
|
|
68
|
+
async entryOptions() {
|
|
69
|
+
const entries = /* @__PURE__ */ new Map();
|
|
41
70
|
for (const [entry, items] of await this.group()) {
|
|
42
|
-
const options = Array.from(items, (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
71
|
+
const options = Array.from(items, (item) => item.options);
|
|
72
|
+
const worlds = new Set(options.map((option) => this.resolveWorld(option.world)));
|
|
73
|
+
if (worlds.size !== 1) {
|
|
74
|
+
throw new Error(`Content entrypoint "${entry}" cannot mix execution worlds`);
|
|
75
|
+
}
|
|
76
|
+
if (new Set(options.map(hasIsolatedTarget)).size !== 1) {
|
|
77
|
+
throw new Error(`Content entrypoint "${entry}" cannot mix isolation style delivery modes`);
|
|
78
|
+
}
|
|
79
|
+
entries.set(entry, Object.assign({}, ...options));
|
|
46
80
|
}
|
|
47
|
-
return
|
|
81
|
+
return entries;
|
|
82
|
+
}
|
|
83
|
+
async manifest() {
|
|
84
|
+
return new Set(
|
|
85
|
+
Array.from(await this.entryOptions(), ([entry, options]) => ({
|
|
86
|
+
entry,
|
|
87
|
+
...getContentScriptConfigFromOptions(options)
|
|
88
|
+
}))
|
|
89
|
+
);
|
|
48
90
|
}
|
|
49
91
|
async hostPermissions() {
|
|
50
92
|
return (await this.calculateHostPermissions())[0];
|
|
@@ -114,9 +156,18 @@ class ContentManager_default {
|
|
|
114
156
|
return [permissions, optionalPermissions];
|
|
115
157
|
}
|
|
116
158
|
virtual(file) {
|
|
159
|
+
if (!this._group) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Cannot create virtual file "${file.file}": content group is not prepared. Await entries() or entryOptions() before virtual().`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const item = Array.from(this._group.values()).flatMap((items) => Array.from(items)).find((item2) => item2.file.file === file.file);
|
|
165
|
+
if (!item) {
|
|
166
|
+
throw new Error(`Virtual file "${file.file}" is not in the prepared content group.`);
|
|
167
|
+
}
|
|
117
168
|
for (const provider of this.providers) {
|
|
118
169
|
try {
|
|
119
|
-
return provider.virtual(file);
|
|
170
|
+
return provider.virtual(file, item.options);
|
|
120
171
|
} catch {
|
|
121
172
|
}
|
|
122
173
|
}
|
|
@@ -125,16 +176,16 @@ class ContentManager_default {
|
|
|
125
176
|
async empty() {
|
|
126
177
|
return (await this.group()).size === 0;
|
|
127
178
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
179
|
+
resolveWorld(world) {
|
|
180
|
+
switch (world) {
|
|
181
|
+
case void 0:
|
|
182
|
+
case ContentScriptWorld.Isolated:
|
|
183
|
+
return ContentScriptWorld.Isolated;
|
|
184
|
+
case ContentScriptWorld.Main:
|
|
185
|
+
return ContentScriptWorld.Main;
|
|
186
|
+
default:
|
|
187
|
+
throw new Error(`Unsupported content script execution world "${String(world)}"`);
|
|
134
188
|
}
|
|
135
|
-
return [EntrypointType.Relay, EntrypointType.ContentScript].some(
|
|
136
|
-
(type) => name === type || name.endsWith(`.${type}`)
|
|
137
|
-
);
|
|
138
189
|
}
|
|
139
190
|
clear() {
|
|
140
191
|
for (const provider of this.providers) {
|
|
@@ -148,6 +199,6 @@ class ContentManager_default {
|
|
|
148
199
|
}
|
|
149
200
|
}
|
|
150
201
|
export {
|
|
151
|
-
|
|
202
|
+
ContentManager as default
|
|
152
203
|
};
|
|
153
204
|
//# sourceMappingURL=ContentManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/content/ContentManager.ts"],"sourcesContent":["import ContentName from \"./ContentName\";\n\nimport {ContentGroupItems, ContentProvider} from \"./types\";\nimport {getContentScriptConfigFromOptions} from \"./utils\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {ContentScriptDeclarative, ContentScriptEntrypointOptions} from \"@typing/content\";\nimport {EntrypointEntries, EntrypointFile, EntrypointType} from \"@typing/entrypoint\";\nimport {\n ManifestContentScripts,\n ManifestHostPermissions,\n ManifestOptionalPermissions,\n ManifestPermissions,\n} from \"@typing/manifest\";\n\nexport default class {\n protected readonly providers = new Set<ContentProvider<ContentScriptEntrypointOptions>>();\n\n protected readonly names: ContentName;\n\n protected _group?: ContentGroupItems<ContentScriptEntrypointOptions>;\n\n protected _hostPermissions?: [ManifestHostPermissions, ManifestHostPermissions];\n\n protected _permissions?: Promise<[ManifestPermissions, ManifestOptionalPermissions]>;\n\n constructor(config: ReadonlyConfig) {\n this.names = new ContentName(config);\n }\n\n public provider(provider: ContentProvider<ContentScriptEntrypointOptions>): this {\n this.providers.add(provider);\n\n return this;\n }\n\n protected async getGroup(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>> {\n const content = await Promise.all(Array.from(this.providers, provider => provider.driver().items()));\n\n const group: ContentGroupItems<ContentScriptEntrypointOptions> = new Map();\n\n for (const items of content) {\n for (const [name, item] of items) {\n const entry = this.names.create(name, item.options);\n\n group.set(entry, new Set([...(group.get(entry) || []), item]));\n }\n }\n\n return group;\n }\n\n public async group(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>> {\n return (this._group ??= await this.getGroup());\n }\n\n public async entries(): Promise<EntrypointEntries> {\n const entries: EntrypointEntries = new Map();\n\n for (const [entry, items] of await this.group()) {\n entries.set(entry, new Set(Array.from(items, ({file}) => file)));\n }\n\n return entries;\n }\n\n public async manifest(): Promise<ManifestContentScripts> {\n const manifest: ManifestContentScripts = new Set();\n\n for (const [entry, items] of await this.group()) {\n const options = Array.from(items, ({options}) => options).reduce((acc, opt) => {\n return {...acc, ...opt};\n }, {} as ContentScriptEntrypointOptions);\n\n manifest.add({entry, ...getContentScriptConfigFromOptions(options)});\n }\n\n return manifest;\n }\n\n public async hostPermissions(): Promise<ManifestHostPermissions> {\n return (await this.calculateHostPermissions())[0];\n }\n\n public async optionalHostPermissions(): Promise<ManifestHostPermissions> {\n return (await this.calculateHostPermissions())[1];\n }\n\n protected async calculateHostPermissions(): Promise<[ManifestHostPermissions, ManifestHostPermissions]> {\n if (this._hostPermissions) {\n return this._hostPermissions;\n }\n\n const hostPermissions = new Set<string>();\n const optionalHostPermissions = new Set<string>();\n\n const group = await this.group();\n\n for (const items of group.values()) {\n for (const {options} of items) {\n const {matches, declarative} = options;\n\n if (!declarative || !matches) {\n continue;\n }\n\n for (const match of matches) {\n switch (declarative) {\n case ContentScriptDeclarative.Optional:\n optionalHostPermissions.add(match);\n\n break;\n case ContentScriptDeclarative.Required:\n case true:\n hostPermissions.add(match);\n\n break;\n }\n }\n }\n }\n\n return (this._hostPermissions = [hostPermissions, optionalHostPermissions]);\n }\n\n public async permissions(): Promise<ManifestPermissions> {\n return (await this.getPermissions())[0];\n }\n\n public async optionalPermissions(): Promise<ManifestOptionalPermissions> {\n return (await this.getPermissions())[1];\n }\n\n protected getPermissions(): Promise<[ManifestPermissions, ManifestOptionalPermissions]> {\n return (this._permissions ??= this.calculatePermissions());\n }\n\n protected async calculatePermissions(): Promise<[ManifestPermissions, ManifestOptionalPermissions]> {\n const permissions: ManifestPermissions = new Set();\n const optionalPermissions: ManifestOptionalPermissions = new Set();\n\n const contributions = await Promise.all(\n Array.from(this.providers, async provider => {\n const driver = provider.driver();\n\n return Promise.all([driver.permissions(), driver.optionalPermissions()]);\n })\n );\n\n for (const [required, optional] of contributions) {\n for (const permission of required) {\n permissions.add(permission);\n }\n\n for (const permission of optional) {\n optionalPermissions.add(permission);\n }\n }\n\n for (const permission of optionalPermissions) {\n if (permissions.has(permission)) {\n optionalPermissions.delete(permission);\n }\n }\n\n return [permissions, optionalPermissions];\n }\n\n public virtual(file: EntrypointFile): string {\n for (const provider of this.providers) {\n try {\n return provider.virtual(file);\n } catch {}\n }\n\n throw new Error(`Virtual file \"${file.file}\" not found.`);\n }\n\n public async empty(): Promise<boolean> {\n return (await this.group()).size === 0;\n }\n\n public chunkName(): string {\n return this.names.getChunkName();\n }\n\n public likely(name?: string): boolean {\n if (!name) {\n return false;\n }\n\n return [EntrypointType.Relay, EntrypointType.ContentScript].some(\n type => name === type || name.endsWith(`.${type}`)\n );\n }\n\n public clear(): this {\n for (const provider of this.providers) {\n provider.clear();\n }\n\n this.names.reset();\n\n this._group = undefined;\n this._hostPermissions = undefined;\n this._permissions = undefined;\n\n return this;\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AAGxB,SAAQ,yCAAwC;AAGhD,SAAQ,gCAA+D;AACvE,SAA2C,sBAAqB;AAQhE,MAAO,uBAAc;AAAA,EACE,YAAY,oBAAI,IAAqD;AAAA,EAErE;AAAA,EAET;AAAA,EAEA;AAAA,EAEA;AAAA,EAEV,YAAY,QAAwB;AAChC,SAAK,QAAQ,IAAI,YAAY,MAAM;AAAA,EACvC;AAAA,EAEO,SAAS,UAAiE;AAC7E,SAAK,UAAU,IAAI,QAAQ;AAE3B,WAAO;AAAA,EACX;AAAA,EAEA,MAAgB,WAAuE;AACnF,UAAM,UAAU,MAAM,QAAQ,IAAI,MAAM,K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,CAAC,CAAC;AAAA,MAC3E,CAAC;AAAA,IACL;AAEA,eAAW,CAAC,UAAU,QAAQ,KAAK,eAAe;AAC9C,iBAAW,cAAc,UAAU;AAC/B,oBAAY,IAAI,UAAU;AAAA,MAC9B;AAEA,iBAAW,cAAc,UAAU;AAC/B,4BAAoB,IAAI,UAAU;AAAA,MACtC;AAAA,IACJ;AAEA,eAAW,cAAc,qBAAqB;AAC1C,UAAI,YAAY,IAAI,UAAU,GAAG;AAC7B,4BAAoB,OAAO,UAAU;AAAA,MACzC;AAAA,IACJ;AAEA,WAAO,CAAC,aAAa,mBAAmB;AAAA,EAC5C;AAAA,EAEO,QAAQ,MAA8B;AACzC,eAAW,YAAY,KAAK,WAAW;AACnC,UAAI;AACA,eAAO,SAAS,QAAQ,IAAI;AAAA,MAChC,QAAQ;AAAA,MAAC;AAAA,IACb;AAEA,UAAM,IAAI,MAAM,iBAAiB,KAAK,IAAI,cAAc;AAAA,EAC5D;AAAA,EAEA,MAAa,QAA0B;AACnC,YAAQ,MAAM,KAAK,MAAM,GAAG,SAAS;AAAA,EACzC;AAAA,EAEO,YAAoB;AACvB,WAAO,KAAK,MAAM,aAAa;AAAA,EACnC;AAAA,EAEO,OAAO,MAAwB;AAClC,QAAI,CAAC,MAAM;AACP,aAAO;AAAA,IACX;AAEA,WAAO,CAAC,eAAe,OAAO,eAAe,aAAa,EAAE;AAAA,MACxD,UAAQ,SAAS,QAAQ,KAAK,SAAS,IAAI,IAAI,EAAE;AAAA,IACrD;AAAA,EACJ;AAAA,EAEO,QAAc;AACjB,eAAW,YAAY,KAAK,WAAW;AACnC,eAAS,MAAM;AAAA,IACnB;AAEA,SAAK,MAAM,MAAM;AAEjB,SAAK,SAAS;AACd,SAAK,mBAAmB;AACxB,SAAK,eAAe;AAEpB,WAAO;AAAA,EACX;AACJ;","names":["options"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/content/ContentManager.ts"],"sourcesContent":["import ContentName from \"./ContentName\";\n\nimport {ContentGroupItems, ContentProvider} from \"./types\";\nimport {getContentScriptConfigFromOptions, hasIsolatedTarget} from \"./utils\";\nimport {getContentChunkName} from \"./bundler\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {\n ContentScriptDeclarative,\n ContentScriptIsolation,\n ContentScriptEntrypointOptions,\n ContentScriptWorld,\n type ContentScriptWorldValue,\n} from \"@typing/content\";\nimport {EntrypointEntries, EntrypointFile} from \"@typing/entrypoint\";\nimport {\n ManifestContentScripts,\n ManifestHostPermissions,\n ManifestOptionalPermissions,\n ManifestPermissions,\n} from \"@typing/manifest\";\n\nexport default class ContentManager {\n protected readonly providers = new Set<ContentProvider<ContentScriptEntrypointOptions>>();\n\n protected readonly names: ContentName;\n\n protected _group?: ContentGroupItems<ContentScriptEntrypointOptions>;\n\n protected _hostPermissions?: [ManifestHostPermissions, ManifestHostPermissions];\n\n protected _permissions?: Promise<[ManifestPermissions, ManifestOptionalPermissions]>;\n\n constructor(protected readonly config: ReadonlyConfig) {\n this.names = new ContentName(config);\n\n Object.values(ContentScriptWorld).forEach(world => this.names.reserve(getContentChunkName(world)));\n }\n\n public provider(provider: ContentProvider<ContentScriptEntrypointOptions>): this {\n this.providers.add(provider);\n\n return this;\n }\n\n protected async getGroup(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>> {\n // prettier-ignore\n const content = await Promise.all(\n Array.from(this.providers, provider => provider.driver().items())\n );\n\n const group: ContentGroupItems<ContentScriptEntrypointOptions> = new Map();\n\n for (const items of content) {\n for (const [name, item] of items) {\n const options = this.normalizeOptions(item.file, item.options);\n const entry = this.names.create(name, options);\n\n group.set(entry, new Set([...(group.get(entry) || []), {...item, options}]));\n }\n }\n\n return group;\n }\n\n protected normalizeOptions(\n file: EntrypointFile,\n options: ContentScriptEntrypointOptions\n ): ContentScriptEntrypointOptions {\n const world = this.resolveWorld(options.world);\n\n if (this.config.manifestVersion !== 2) {\n if (\n world === ContentScriptWorld.Main &&\n (options.isolation?.type === ContentScriptIsolation.Shadow ||\n (options.isolation?.type === ContentScriptIsolation.Iframe &&\n !(options.isolation?.src && /^https?:\\/\\//.test(options.isolation.src))))\n ) {\n throw new Error(\n `Content script \"${file.file}\" cannot use this isolation in the MAIN execution world; only external HTTP(S) isolation.src is supported`\n );\n }\n\n return options;\n }\n\n if (world === ContentScriptWorld.Main) {\n console.warn(\n `Content script \"${file.file}\" requests world \"MAIN\", but Addon Bone does not support MAIN content scripts in Manifest V2. It will be built and run in ISOLATED.`\n );\n }\n\n return {...options, world: ContentScriptWorld.Isolated};\n }\n\n public async group(): Promise<ContentGroupItems<ContentScriptEntrypointOptions>> {\n return (this._group ??= await this.getGroup());\n }\n\n public async entries(): Promise<EntrypointEntries> {\n const entries: EntrypointEntries = new Map();\n\n for (const [entry, items] of await this.group()) {\n entries.set(entry, new Set(Array.from(items, ({file}) => file)));\n }\n\n return entries;\n }\n\n /** Settings are keyed by the final grouped entrypoint name, not the original source files. */\n public async entryOptions(): Promise<ReadonlyMap<string, ContentScriptEntrypointOptions>> {\n const entries = new Map<string, ContentScriptEntrypointOptions>();\n\n for (const [entry, items] of await this.group()) {\n const options = Array.from(items, item => item.options);\n const worlds = new Set(options.map(option => this.resolveWorld(option.world)));\n if (worlds.size !== 1) {\n throw new Error(`Content entrypoint \"${entry}\" cannot mix execution worlds`);\n }\n\n if (new Set(options.map(hasIsolatedTarget)).size !== 1) {\n throw new Error(`Content entrypoint \"${entry}\" cannot mix isolation style delivery modes`);\n }\n\n entries.set(entry, Object.assign({}, ...options));\n }\n\n return entries;\n }\n\n public async manifest(): Promise<ManifestContentScripts> {\n return new Set(\n Array.from(await this.entryOptions(), ([entry, options]) => ({\n entry,\n ...getContentScriptConfigFromOptions(options),\n }))\n );\n }\n\n public async hostPermissions(): Promise<ManifestHostPermissions> {\n return (await this.calculateHostPermissions())[0];\n }\n\n public async optionalHostPermissions(): Promise<ManifestHostPermissions> {\n return (await this.calculateHostPermissions())[1];\n }\n\n protected async calculateHostPermissions(): Promise<[ManifestHostPermissions, ManifestHostPermissions]> {\n if (this._hostPermissions) {\n return this._hostPermissions;\n }\n\n const hostPermissions = new Set<string>();\n const optionalHostPermissions = new Set<string>();\n\n const group = await this.group();\n\n for (const items of group.values()) {\n for (const {options} of items) {\n const {matches, declarative} = options;\n\n if (!declarative || !matches) {\n continue;\n }\n\n for (const match of matches) {\n switch (declarative) {\n case ContentScriptDeclarative.Optional:\n optionalHostPermissions.add(match);\n\n break;\n case ContentScriptDeclarative.Required:\n case true:\n hostPermissions.add(match);\n\n break;\n }\n }\n }\n }\n\n return (this._hostPermissions = [hostPermissions, optionalHostPermissions]);\n }\n\n public async permissions(): Promise<ManifestPermissions> {\n return (await this.getPermissions())[0];\n }\n\n public async optionalPermissions(): Promise<ManifestOptionalPermissions> {\n return (await this.getPermissions())[1];\n }\n\n protected getPermissions(): Promise<[ManifestPermissions, ManifestOptionalPermissions]> {\n return (this._permissions ??= this.calculatePermissions());\n }\n\n protected async calculatePermissions(): Promise<[ManifestPermissions, ManifestOptionalPermissions]> {\n const permissions: ManifestPermissions = new Set();\n const optionalPermissions: ManifestOptionalPermissions = new Set();\n\n const contributions = await Promise.all(\n Array.from(this.providers, async provider => {\n const driver = provider.driver();\n\n return Promise.all([driver.permissions(), driver.optionalPermissions()]);\n })\n );\n\n for (const [required, optional] of contributions) {\n for (const permission of required) {\n permissions.add(permission);\n }\n\n for (const permission of optional) {\n optionalPermissions.add(permission);\n }\n }\n\n for (const permission of optionalPermissions) {\n if (permissions.has(permission)) {\n optionalPermissions.delete(permission);\n }\n }\n\n return [permissions, optionalPermissions];\n }\n\n public virtual(file: EntrypointFile): string {\n if (!this._group) {\n throw new Error(\n `Cannot create virtual file \"${file.file}\": content group is not prepared. Await entries() or entryOptions() before virtual().`\n );\n }\n\n const item = Array.from(this._group.values())\n .flatMap(items => Array.from(items))\n .find(item => item.file.file === file.file);\n\n if (!item) {\n throw new Error(`Virtual file \"${file.file}\" is not in the prepared content group.`);\n }\n\n for (const provider of this.providers) {\n try {\n return provider.virtual(file, item.options);\n } catch {}\n }\n\n throw new Error(`Virtual file \"${file.file}\" not found.`);\n }\n\n public async empty(): Promise<boolean> {\n return (await this.group()).size === 0;\n }\n\n protected resolveWorld(world?: ContentScriptWorldValue): ContentScriptWorld {\n switch (world) {\n case undefined:\n case ContentScriptWorld.Isolated:\n return ContentScriptWorld.Isolated;\n case ContentScriptWorld.Main:\n return ContentScriptWorld.Main;\n default:\n throw new Error(`Unsupported content script execution world \"${String(world)}\"`);\n }\n }\n\n public clear(): this {\n for (const provider of this.providers) {\n provider.clear();\n }\n\n this.names.reset();\n\n this._group = undefined;\n this._hostPermissions = undefined;\n this._permissions = undefined;\n\n return this;\n }\n}\n"],"mappings":"AAAA,OAAO,iBAAiB;AAGxB,SAAQ,mCAAmC,yBAAwB;AACnE,SAAQ,2BAA0B;AAGlC;AAAA,EACI;AAAA,EACA;AAAA,EAEA;AAAA,OAEG;AASP,MAAO,eAA6B;AAAA,EAWhC,YAA+B,QAAwB;AAAxB;AAC3B,SAAK,QAAQ,IAAI,YAAY,MAAM;AAEnC,WAAO,OAAO,kBAAkB,EAAE,QAAQ,WAAS,KAAK,MAAM,QAAQ,oBAAoB,KAAK,CAAC,CAAC;AAAA,EACrG;AAAA,EAJ+B;AAAA,EAVZ,YAAY,oBAAI,IAAqD;AAAA,EAErE;AAAA,EAET;AAAA,EAEA;AAAA,EAEA;AAAA,EAQH,SAAS,UAAiE;AAC7E,SAAK,UAAU,IAAI,QAAQ;AAE3B,WAAO;AAAA,EACX;AAAA,EAEA,MAAgB,WAAuE;AAEnF,UAAM,UAAU,MAAM,QAAQ;AAAA,MAC1B,MAAM,KAAK,KAAK,WAAW,cAAY,SAAS,OAAO,EAAE,MAAM,CAAC;AAAA,IACpE;AAEA,UAAM,QAA2D,oBAAI,IAAI;AAEzE,eAAW,SAAS,SAAS;AACzB,iBAAW,CAAC,MAAM,IAAI,KAAK,OAAO;AAC9B,cAAM,UAAU,KAAK,iBAAiB,KA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AA,EAC5C;AAAA,EAEO,QAAQ,MAA8B;AACzC,QAAI,CAAC,KAAK,QAAQ;AACd,YAAM,IAAI;AAAA,QACN,+BAA+B,KAAK,IAAI;AAAA,MAC5C;AAAA,IACJ;AAEA,UAAM,OAAO,MAAM,KAAK,KAAK,OAAO,OAAO,CAAC,EACvC,QAAQ,WAAS,MAAM,KAAK,KAAK,CAAC,EAClC,KAAK,CAAAA,UAAQA,MAAK,KAAK,SAAS,KAAK,IAAI;AAE9C,QAAI,CAAC,MAAM;AACP,YAAM,IAAI,MAAM,iBAAiB,KAAK,IAAI,yCAAyC;AAAA,IACvF;AAEA,eAAW,YAAY,KAAK,WAAW;AACnC,UAAI;AACA,eAAO,SAAS,QAAQ,MAAM,KAAK,OAAO;AAAA,MAC9C,QAAQ;AAAA,MAAC;AAAA,IACb;AAEA,UAAM,IAAI,MAAM,iBAAiB,KAAK,IAAI,cAAc;AAAA,EAC5D;AAAA,EAEA,MAAa,QAA0B;AACnC,YAAQ,MAAM,KAAK,MAAM,GAAG,SAAS;AAAA,EACzC;AAAA,EAEU,aAAa,OAAqD;AACxE,YAAQ,OAAO;AAAA,MACX,KAAK;AAAA,MACL,KAAK,mBAAmB;AACpB,eAAO,mBAAmB;AAAA,MAC9B,KAAK,mBAAmB;AACpB,eAAO,mBAAmB;AAAA,MAC9B;AACI,cAAM,IAAI,MAAM,+CAA+C,OAAO,KAAK,CAAC,GAAG;AAAA,IACvF;AAAA,EACJ;AAAA,EAEO,QAAc;AACjB,eAAW,YAAY,KAAK,WAAW;AACnC,eAAS,MAAM;AAAA,IACnB;AAEA,SAAK,MAAM,MAAM;AAEjB,SAAK,SAAS;AACd,SAAK,mBAAmB;AACxB,SAAK,eAAe;AAEpB,WAAO;AAAA,EACX;AACJ;","names":["item"]}
|
|
@@ -6,6 +6,6 @@ export default class ContentName extends NameGenerator implements ContentNameGen
|
|
|
6
6
|
protected readonly config: ReadonlyConfig;
|
|
7
7
|
protected readonly _names: Map<string, string>;
|
|
8
8
|
constructor(config: ReadonlyConfig);
|
|
9
|
-
getChunkName(): string;
|
|
10
9
|
create(name: string, options: ContentScriptEntrypointOptions): string;
|
|
10
|
+
reset(): this;
|
|
11
11
|
}
|
|
@@ -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":[]}
|