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
|
@@ -3,10 +3,13 @@ import path from "path";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import { CssExtractRspackPlugin } from "@rspack/core";
|
|
5
5
|
import { mergeStyleSources } from "./utils.js";
|
|
6
|
+
import { IsolatedStylesLayer } from "./../../../cli/bundler/utils/styles.js";
|
|
6
7
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
7
8
|
import { appFilenameResolver } from "./../../../cli/bundler/index.js";
|
|
8
9
|
import { getAppSourcePath, getResolvePath, getSharedPath } from "./../../../cli/resolvers/path.js";
|
|
9
10
|
import { toPosix } from "./../../../cli/utils/path.js";
|
|
11
|
+
const IsolatedAsIsLoaderIdent = "adnbn-isolated-asis";
|
|
12
|
+
const IsolatedModulesLoaderIdent = "adnbn-isolated-modules";
|
|
10
13
|
const styleMergerLoader = (config) => (sharedStyle, sharedPath) => {
|
|
11
14
|
const sharedDir = getResolvePath(getSharedPath(config));
|
|
12
15
|
if (sharedPath.startsWith(sharedDir)) {
|
|
@@ -29,7 +32,7 @@ const styleMergerLoader = (config) => (sharedStyle, sharedPath) => {
|
|
|
29
32
|
}
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
|
-
var style_default = definePlugin(() => {
|
|
35
|
+
var style_default = definePlugin(({ isolationIssuerLayer } = {}) => {
|
|
33
36
|
return {
|
|
34
37
|
name: "adnbn:styles",
|
|
35
38
|
bundler: ({ config }) => {
|
|
@@ -48,6 +51,31 @@ var style_default = definePlugin(() => {
|
|
|
48
51
|
}
|
|
49
52
|
return rules;
|
|
50
53
|
};
|
|
54
|
+
const createStyleRules = (isolated = false) => [
|
|
55
|
+
{
|
|
56
|
+
resourceQuery: /[?&]asis(?:[=&]|$)/,
|
|
57
|
+
use: createSassRuleSet({
|
|
58
|
+
loader: "css-loader",
|
|
59
|
+
...isolated ? { ident: IsolatedAsIsLoaderIdent } : {},
|
|
60
|
+
options: { esModule: true, modules: false }
|
|
61
|
+
})
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
use: createSassRuleSet({
|
|
65
|
+
loader: "css-loader",
|
|
66
|
+
...isolated ? { ident: IsolatedModulesLoaderIdent } : {},
|
|
67
|
+
options: {
|
|
68
|
+
esModule: true,
|
|
69
|
+
modules: {
|
|
70
|
+
exportLocalsConvention: "as-is",
|
|
71
|
+
namedExport: false,
|
|
72
|
+
localIdentName: cssIdentName.replaceAll("[app]", kebabApp),
|
|
73
|
+
localIdentHashSalt: kebabApp
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
];
|
|
51
79
|
return {
|
|
52
80
|
resolve: {
|
|
53
81
|
extensions: [".css", ".scss"]
|
|
@@ -58,36 +86,35 @@ var style_default = definePlugin(() => {
|
|
|
58
86
|
chunkFilename: filename
|
|
59
87
|
})
|
|
60
88
|
],
|
|
89
|
+
optimization: {
|
|
90
|
+
splitChunks: {
|
|
91
|
+
cacheGroups: {
|
|
92
|
+
adnbnIsolatedStyles: {
|
|
93
|
+
type: "css/mini-extract",
|
|
94
|
+
layer: IsolatedStylesLayer,
|
|
95
|
+
chunks: "all",
|
|
96
|
+
enforce: true,
|
|
97
|
+
name: false,
|
|
98
|
+
priority: 100
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
},
|
|
61
103
|
module: {
|
|
62
104
|
rules: [
|
|
63
105
|
{
|
|
64
106
|
test: /\.(scss|css)$/,
|
|
65
107
|
type: "javascript/auto",
|
|
66
108
|
oneOf: [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
use: createSassRuleSet({
|
|
79
|
-
loader: "css-loader",
|
|
80
|
-
options: {
|
|
81
|
-
esModule: true,
|
|
82
|
-
modules: {
|
|
83
|
-
exportLocalsConvention: "as-is",
|
|
84
|
-
namedExport: false,
|
|
85
|
-
localIdentName: cssIdentName.replaceAll("[app]", kebabApp),
|
|
86
|
-
localIdentHashSalt: kebabApp
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
}
|
|
109
|
+
...isolationIssuerLayer === void 0 ? [] : [
|
|
110
|
+
{
|
|
111
|
+
issuerLayer: isolationIssuerLayer,
|
|
112
|
+
resourceQuery: /[?&]isolation(?:[=&]|$)/,
|
|
113
|
+
layer: IsolatedStylesLayer,
|
|
114
|
+
oneOf: createStyleRules(true)
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
{ oneOf: createStyleRules() }
|
|
91
118
|
]
|
|
92
119
|
}
|
|
93
120
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/style/index.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport {Configuration as RspackConfig, CssExtractRspackPlugin, RuleSetUse, RuleSetUseItem} from \"@rspack/core\";\n\nimport {mergeStyleSources} from \"./utils\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {appFilenameResolver} from \"@cli/bundler\";\nimport {getAppSourcePath, getResolvePath, getSharedPath} from \"@cli/resolvers/path\";\nimport {toPosix} from \"@cli/utils/path\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\n// prettier-ignore\nconst styleMergerLoader =\n (config: ReadonlyConfig) =>\n (sharedStyle: string, sharedPath: string): string | void => {\n const sharedDir = getResolvePath(getSharedPath(config));\n\n if (sharedPath.startsWith(sharedDir)) {\n const relativePath = path.relative(sharedDir, sharedPath);\n\n const appDir = getResolvePath(getAppSourcePath(config));\n const appPath = getResolvePath(path.join(appDir, relativePath));\n\n if (fs.existsSync(appPath)) {\n let appStyle = fs.readFileSync(appPath, \"utf8\");\n\n appStyle = appStyle.replace(/url\\((['\"]?)(.*?)\\1\\)/g, (match, quote, filePath) => {\n if (\n filePath.startsWith(\"/\") ||\n filePath.startsWith(\"http\") ||\n filePath.startsWith(\"data:\")\n ) {\n return match;\n }\n\n const cssDir = path.dirname(appPath);\n const assetAbs = path.resolve(cssDir, filePath);\n\n const sharedFileDir = path.dirname(sharedPath);\n\n const relativeToSharedFile = path.relative(sharedFileDir, assetAbs);\n\n return `url(\"${toPosix(relativeToSharedFile)}\")`;\n });\n\n return mergeStyleSources(sharedStyle, appStyle);\n }\n }\n };\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:styles\",\n bundler: ({config}) => {\n const {app, cssDir, cssFilename, cssIdentName, mergeStyles} = config;\n\n const filename = appFilenameResolver(app, cssFilename, cssDir);\n const kebabApp = _.kebabCase(app);\n\n const createSassRuleSet = (rule: RuleSetUseItem): RuleSetUse => {\n const rules: RuleSetUse = [CssExtractRspackPlugin.loader, rule, \"sass-loader\"];\n\n if (mergeStyles) {\n rules.push({\n loader: \"source-modifier-loader\",\n options: {\n modify: styleMergerLoader(config),\n },\n });\n }\n\n return rules;\n };\n\n return {\n resolve: {\n extensions: [\".css\", \".scss\"],\n },\n plugins: [\n new CssExtractRspackPlugin({\n filename,\n chunkFilename: filename,\n }),\n ],\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/style/index.ts"],"sourcesContent":["import _ from \"lodash\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport {Configuration as RspackConfig, CssExtractRspackPlugin, RuleSetUse, RuleSetUseItem} from \"@rspack/core\";\n\nimport {mergeStyleSources} from \"./utils\";\nimport type {StylePluginOptions} from \"./types\";\nimport {IsolatedStylesLayer} from \"@cli/bundler/utils/styles\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {appFilenameResolver} from \"@cli/bundler\";\nimport {getAppSourcePath, getResolvePath, getSharedPath} from \"@cli/resolvers/path\";\nimport {toPosix} from \"@cli/utils/path\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\n// CssExtract also identifies dependencies by loader request, not just by layer.\n// Keep isolated requests distinct from ordinary CSS and from each other's options.\nconst IsolatedAsIsLoaderIdent = \"adnbn-isolated-asis\";\nconst IsolatedModulesLoaderIdent = \"adnbn-isolated-modules\";\n\n// prettier-ignore\nconst styleMergerLoader =\n (config: ReadonlyConfig) =>\n (sharedStyle: string, sharedPath: string): string | void => {\n const sharedDir = getResolvePath(getSharedPath(config));\n\n if (sharedPath.startsWith(sharedDir)) {\n const relativePath = path.relative(sharedDir, sharedPath);\n\n const appDir = getResolvePath(getAppSourcePath(config));\n const appPath = getResolvePath(path.join(appDir, relativePath));\n\n if (fs.existsSync(appPath)) {\n let appStyle = fs.readFileSync(appPath, \"utf8\");\n\n appStyle = appStyle.replace(/url\\((['\"]?)(.*?)\\1\\)/g, (match, quote, filePath) => {\n if (\n filePath.startsWith(\"/\") ||\n filePath.startsWith(\"http\") ||\n filePath.startsWith(\"data:\")\n ) {\n return match;\n }\n\n const cssDir = path.dirname(appPath);\n const assetAbs = path.resolve(cssDir, filePath);\n\n const sharedFileDir = path.dirname(sharedPath);\n\n const relativeToSharedFile = path.relative(sharedFileDir, assetAbs);\n\n return `url(\"${toPosix(relativeToSharedFile)}\")`;\n });\n\n return mergeStyleSources(sharedStyle, appStyle);\n }\n }\n };\n\nexport default definePlugin(({isolationIssuerLayer}: StylePluginOptions = {}) => {\n return {\n name: \"adnbn:styles\",\n bundler: ({config}) => {\n const {app, cssDir, cssFilename, cssIdentName, mergeStyles} = config;\n\n const filename = appFilenameResolver(app, cssFilename, cssDir);\n const kebabApp = _.kebabCase(app);\n\n const createSassRuleSet = (rule: RuleSetUseItem): RuleSetUse => {\n const rules: RuleSetUse = [CssExtractRspackPlugin.loader, rule, \"sass-loader\"];\n\n if (mergeStyles) {\n rules.push({\n loader: \"source-modifier-loader\",\n options: {\n modify: styleMergerLoader(config),\n },\n });\n }\n\n return rules;\n };\n\n const createStyleRules = (isolated = false) => [\n {\n resourceQuery: /[?&]asis(?:[=&]|$)/,\n use: createSassRuleSet({\n loader: \"css-loader\",\n ...(isolated ? {ident: IsolatedAsIsLoaderIdent} : {}),\n options: {esModule: true, modules: false},\n }),\n },\n {\n use: createSassRuleSet({\n loader: \"css-loader\",\n ...(isolated ? {ident: IsolatedModulesLoaderIdent} : {}),\n options: {\n esModule: true,\n modules: {\n exportLocalsConvention: \"as-is\",\n namedExport: false,\n localIdentName: cssIdentName.replaceAll(\"[app]\", kebabApp),\n localIdentHashSalt: kebabApp,\n },\n },\n }),\n },\n ];\n\n return {\n resolve: {\n extensions: [\".css\", \".scss\"],\n },\n plugins: [\n new CssExtractRspackPlugin({\n filename,\n chunkFilename: filename,\n }),\n ],\n optimization: {\n splitChunks: {\n cacheGroups: {\n adnbnIsolatedStyles: {\n type: \"css/mini-extract\",\n layer: IsolatedStylesLayer,\n chunks: \"all\",\n enforce: true,\n name: false,\n priority: 100,\n },\n },\n },\n },\n module: {\n rules: [\n {\n test: /\\.(scss|css)$/,\n type: \"javascript/auto\",\n oneOf: [\n ...(isolationIssuerLayer === undefined\n ? []\n : [\n {\n issuerLayer: isolationIssuerLayer,\n resourceQuery: /[?&]isolation(?:[=&]|$)/,\n layer: IsolatedStylesLayer,\n oneOf: createStyleRules(true),\n },\n ]),\n {oneOf: createStyleRules()},\n ],\n },\n ],\n },\n } satisfies RspackConfig;\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AACd,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAuC,8BAAyD;AAEhG,SAAQ,yBAAwB;AAEhC,SAAQ,2BAA0B;AAElC,SAAQ,oBAAmB;AAE3B,SAAQ,2BAA0B;AAClC,SAAQ,kBAAkB,gBAAgB,qBAAoB;AAC9D,SAAQ,eAAc;AAMtB,MAAM,0BAA0B;AAChC,MAAM,6BAA6B;AAGnC,MAAM,oBACF,CAAC,WACG,CAAC,aAAqB,eAAsC;AACxD,QAAM,YAAY,eAAe,cAAc,MAAM,CAAC;AAEtD,MAAI,WAAW,WAAW,SAAS,GAAG;AAClC,UAAM,eAAe,KAAK,SAAS,WAAW,UAAU;AAExD,UAAM,SAAS,eAAe,iBAAiB,MAAM,CAAC;AACtD,UAAM,UAAU,eAAe,KAAK,KAAK,QAAQ,YAAY,CAAC;AAE9D,QAAI,GAAG,WAAW,OAAO,GAAG;AACxB,UAAI,WAAW,GAAG,aAAa,SAAS,MAAM;AAE9C,iBAAW,SAAS,QAAQ,0BAA0B,CAAC,OAAO,OAAO,aAAa;AAC9E,YACI,SAAS,WAAW,GAAG,KACvB,SAAS,WAAW,MAAM,KAC1B,SAAS,WAAW,OAAO,GAC7B;AACE,iBAAO;AAAA,QACX;AAEA,cAAM,SAAS,KAAK,QAAQ,OAAO;AACnC,cAAM,WAAW,KAAK,QAAQ,QAAQ,QAAQ;AAE9C,cAAM,gBAAgB,KAAK,QAAQ,UAAU;AAE7C,c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AAAA,UACJ,CAAC;AAAA,QACL;AAAA,MACJ;AAEA,aAAO;AAAA,QACH,SAAS;AAAA,UACL,YAAY,CAAC,QAAQ,OAAO;AAAA,QAChC;AAAA,QACA,SAAS;AAAA,UACL,IAAI,uBAAuB;AAAA,YACvB;AAAA,YACA,eAAe;AAAA,UACnB,CAAC;AAAA,QACL;AAAA,QACA,cAAc;AAAA,UACV,aAAa;AAAA,YACT,aAAa;AAAA,cACT,qBAAqB;AAAA,gBACjB,MAAM;AAAA,gBACN,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,SAAS;AAAA,gBACT,MAAM;AAAA,gBACN,UAAU;AAAA,cACd;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,QACA,QAAQ;AAAA,UACJ,OAAO;AAAA,YACH;AAAA,cACI,MAAM;AAAA,cACN,MAAM;AAAA,cACN,OAAO;AAAA,gBACH,GAAI,yBAAyB,SACvB,CAAC,IACD;AAAA,kBACI;AAAA,oBACI,aAAa;AAAA,oBACb,eAAe;AAAA,oBACf,OAAO;AAAA,oBACP,OAAO,iBAAiB,IAAI;AAAA,kBAChC;AAAA,gBACJ;AAAA,gBACN,EAAC,OAAO,iBAAiB,EAAC;AAAA,cAC9B;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -6,7 +6,7 @@ var view_default = definePlugin(() => {
|
|
|
6
6
|
return {
|
|
7
7
|
name: "adnbn:view",
|
|
8
8
|
bundler: ({ config }) => {
|
|
9
|
-
const entryTypeFilter = onlyViaTopLevelEntry(["page", "popup", "sidebar", "offscreen"]);
|
|
9
|
+
const entryTypeFilter = onlyViaTopLevelEntry(["page", "popup", "sidebar", "offscreen", "options"]);
|
|
10
10
|
return {
|
|
11
11
|
optimization: {
|
|
12
12
|
splitChunks: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/view/index.ts"],"sourcesContent":["import {NormalModule} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {onlyViaTopLevelEntry} from \"@cli/bundler\";\nimport {getResolvePath, getSourcePath} from \"@cli/resolvers/path\";\n\nexport {default as View} from \"./View\";\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:view\",\n bundler: ({config}) => {\n const entryTypeFilter = onlyViaTopLevelEntry([\"page\", \"popup\", \"sidebar\", \"offscreen\"]);\n\n return {\n optimization: {\n splitChunks: {\n cacheGroups: {\n adnbnView: {\n minChunks: 2,\n minSize: 0,\n name: \"common.view\",\n test: (module, context) => {\n const nm = module as NormalModule;\n\n if (!nm.resource) {\n return false;\n }\n\n if (nm.resource.startsWith(getResolvePath(getSourcePath(config)))) {\n return false;\n }\n\n return entryTypeFilter(module, context);\n },\n enforce: false,\n reuseExistingChunk: true,\n priority: 50,\n },\n },\n },\n },\n };\n },\n };\n});\n"],"mappings":"AAEA,SAAQ,oBAAmB;AAE3B,SAAQ,4BAA2B;AACnC,SAAQ,gBAAgB,qBAAoB;AAE5C,SAAmB,WAAXA,gBAAsB;AAE9B,IAAO,eAAQ,aAAa,MAAM;AAC9B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,YAAM,kBAAkB,qBAAqB,CAAC,QAAQ,SAAS,WAAW,
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/view/index.ts"],"sourcesContent":["import {NormalModule} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {onlyViaTopLevelEntry} from \"@cli/bundler\";\nimport {getResolvePath, getSourcePath} from \"@cli/resolvers/path\";\n\nexport {default as View} from \"./View\";\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:view\",\n bundler: ({config}) => {\n const entryTypeFilter = onlyViaTopLevelEntry([\"page\", \"popup\", \"sidebar\", \"offscreen\", \"options\"]);\n\n return {\n optimization: {\n splitChunks: {\n cacheGroups: {\n adnbnView: {\n minChunks: 2,\n minSize: 0,\n name: \"common.view\",\n test: (module, context) => {\n const nm = module as NormalModule;\n\n if (!nm.resource) {\n return false;\n }\n\n if (nm.resource.startsWith(getResolvePath(getSourcePath(config)))) {\n return false;\n }\n\n return entryTypeFilter(module, context);\n },\n enforce: false,\n reuseExistingChunk: true,\n priority: 50,\n },\n },\n },\n },\n };\n },\n };\n});\n"],"mappings":"AAEA,SAAQ,oBAAmB;AAE3B,SAAQ,4BAA2B;AACnC,SAAQ,gBAAgB,qBAAoB;AAE5C,SAAmB,WAAXA,gBAAsB;AAE9B,IAAO,eAAQ,aAAa,MAAM;AAC9B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,YAAM,kBAAkB,qBAAqB,CAAC,QAAQ,SAAS,WAAW,aAAa,SAAS,CAAC;AAEjG,aAAO;AAAA,QACH,cAAc;AAAA,UACV,aAAa;AAAA,YACT,aAAa;AAAA,cACT,WAAW;AAAA,gBACP,WAAW;AAAA,gBACX,SAAS;AAAA,gBACT,MAAM;AAAA,gBACN,MAAM,CAAC,QAAQ,YAAY;AACvB,wBAAM,KAAK;AAEX,sBAAI,CAAC,GAAG,UAAU;AACd,2BAAO;AAAA,kBACX;AAEA,sBAAI,GAAG,SAAS,WAAW,eAAe,cAAc,MAAM,CAAC,CAAC,GAAG;AAC/D,2BAAO;AAAA,kBACX;AAEA,yBAAO,gBAAgB,QAAQ,OAAO;AAAA,gBAC1C;AAAA,gBACA,SAAS;AAAA,gBACT,oBAAoB;AAAA,gBACpB,UAAU;AAAA,cACd;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":["default"]}
|
|
@@ -2,8 +2,8 @@ import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
|
|
|
2
2
|
import { merge as mergeConfig } from "webpack-merge";
|
|
3
3
|
import manifestFactory from "../builders/manifest/index.js";
|
|
4
4
|
import { processPluginHandler } from "./plugin.js";
|
|
5
|
-
import ManifestPlugin from "./../../cli/bundler/plugins/
|
|
6
|
-
import WatchPlugin from "./../../cli/bundler/plugins/
|
|
5
|
+
import ManifestPlugin from "./../../cli/bundler/plugins/manifest/index.js";
|
|
6
|
+
import WatchPlugin from "./../../cli/bundler/plugins/watch/index.js";
|
|
7
7
|
import { Command } from "./../../types/app.js";
|
|
8
8
|
const getConfigFromPlugins = async (rspack, config) => {
|
|
9
9
|
let mergedConfig = {};
|
|
@@ -16,10 +16,12 @@ const getConfigFromPlugins = async (rspack, config) => {
|
|
|
16
16
|
return mergedConfig;
|
|
17
17
|
};
|
|
18
18
|
const getConfigForManifest = async (config) => {
|
|
19
|
-
|
|
20
|
-
const update = () =>
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
let manifest = manifestFactory(config);
|
|
20
|
+
const update = async () => {
|
|
21
|
+
const next = manifestFactory(config);
|
|
22
|
+
await Array.fromAsync(processPluginHandler(config.plugins, "manifest", { manifest: next, config }));
|
|
23
|
+
manifest = next;
|
|
24
|
+
};
|
|
23
25
|
await update();
|
|
24
26
|
const plugins = [];
|
|
25
27
|
if (config.command === Command.Watch) {
|
|
@@ -29,7 +31,7 @@ const getConfigForManifest = async (config) => {
|
|
|
29
31
|
})
|
|
30
32
|
);
|
|
31
33
|
}
|
|
32
|
-
plugins.push(new ManifestPlugin(manifest));
|
|
34
|
+
plugins.push(new ManifestPlugin(() => manifest));
|
|
33
35
|
return { plugins };
|
|
34
36
|
};
|
|
35
37
|
var bundler_default = async (config) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/resolvers/bundler.ts"],"sourcesContent":["import {Configuration as RspackConfig, RspackPluginInstance} from \"@rspack/core\";\nimport {RsdoctorRspackPlugin} from \"@rsdoctor/rspack-plugin\";\nimport {merge as mergeConfig} from \"webpack-merge\";\n\nimport manifestFactory from \"../builders/manifest\";\nimport {processPluginHandler} from \"./plugin\";\n\nimport ManifestPlugin from \"@cli/bundler/plugins/
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/resolvers/bundler.ts"],"sourcesContent":["import {Configuration as RspackConfig, RspackPluginInstance} from \"@rspack/core\";\nimport {RsdoctorRspackPlugin} from \"@rsdoctor/rspack-plugin\";\nimport {merge as mergeConfig} from \"webpack-merge\";\n\nimport manifestFactory from \"../builders/manifest\";\nimport {processPluginHandler} from \"./plugin\";\n\nimport ManifestPlugin from \"@cli/bundler/plugins/manifest\";\nimport WatchPlugin from \"@cli/bundler/plugins/watch\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {Command} from \"@typing/app\";\n\nconst getConfigFromPlugins = async (rspack: RspackConfig, config: ReadonlyConfig): Promise<RspackConfig> => {\n let mergedConfig: RspackConfig = {};\n\n for await (const {result: pluginConfig} of processPluginHandler(config.plugins, \"bundler\", () => ({\n rspack: mergeConfig(rspack, mergedConfig),\n config,\n }))) {\n mergedConfig = mergeConfig(mergedConfig, pluginConfig);\n }\n\n return mergedConfig;\n};\n\nconst getConfigForManifest = async (config: ReadonlyConfig): Promise<RspackConfig> => {\n let manifest = manifestFactory(config);\n\n const update = async () => {\n // Each compilation describes current entries; removed WAR/CSP rules must not accumulate.\n const next = manifestFactory(config);\n await Array.fromAsync(processPluginHandler(config.plugins, \"manifest\", {manifest: next, config}));\n manifest = next;\n };\n\n await update();\n\n const plugins: RspackPluginInstance[] = [];\n\n if (config.command === Command.Watch) {\n plugins.push(\n new WatchPlugin(async () => {\n await update();\n })\n );\n }\n\n plugins.push(new ManifestPlugin(() => manifest));\n\n return {plugins};\n};\n\nexport default async (config: ReadonlyConfig): Promise<RspackConfig> => {\n let rspack: RspackConfig = {\n entry: {},\n mode: config.mode,\n cache: false,\n };\n\n // prettier-ignore\n rspack = mergeConfig(\n rspack,\n await getConfigFromPlugins(rspack, config),\n await getConfigForManifest(config)\n );\n\n if (config.debug) {\n rspack = mergeConfig(rspack, {\n stats: {\n errorDetails: true,\n },\n });\n }\n\n if (config.command === Command.Watch) {\n rspack = mergeConfig(rspack, {\n devtool: \"inline-source-map\",\n });\n }\n\n if (config.command === Command.Build) {\n if (config.analyze) {\n rspack = mergeConfig(rspack, {\n plugins: [\n new RsdoctorRspackPlugin({\n supports: {\n banner: true,\n parseBundle: true,\n generateTileGraph: true,\n },\n }),\n ],\n });\n }\n }\n\n return rspack;\n};\n"],"mappings":"AACA,SAAQ,4BAA2B;AACnC,SAAQ,SAAS,mBAAkB;AAEnC,OAAO,qBAAqB;AAC5B,SAAQ,4BAA2B;AAEnC,OAAO,oBAAoB;AAC3B,OAAO,iBAAiB;AAGxB,SAAQ,eAAc;AAEtB,MAAM,uBAAuB,OAAO,QAAsB,WAAkD;AACxG,MAAI,eAA6B,CAAC;AAElC,mBAAiB,EAAC,QAAQ,aAAY,KAAK,qBAAqB,OAAO,SAAS,WAAW,OAAO;AAAA,IAC9F,QAAQ,YAAY,QAAQ,YAAY;AAAA,IACxC;AAAA,EACJ,EAAE,GAAG;AACD,mBAAe,YAAY,cAAc,YAAY;AAAA,EACzD;AAEA,SAAO;AACX;AAEA,MAAM,uBAAuB,OAAO,WAAkD;AAClF,MAAI,WAAW,gBAAgB,MAAM;AAErC,QAAM,SAAS,YAAY;AAEvB,UAAM,OAAO,gBAAgB,MAAM;AACnC,UAAM,MAAM,UAAU,qBAAqB,OAAO,SAAS,YAAY,EAAC,UAAU,MAAM,OAAM,CAAC,CAAC;AAChG,eAAW;AAAA,EACf;AAEA,QAAM,OAAO;AAEb,QAAM,UAAkC,CAAC;AAEzC,MAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,YAAQ;AAAA,MACJ,IAAI,YAAY,YAAY;AACxB,cAAM,OAAO;AAAA,MACjB,CAAC;AAAA,IACL;AAAA,EACJ;AAEA,UAAQ,KAAK,IAAI,eAAe,MAAM,QAAQ,CAAC;AAE/C,SAAO,EAAC,QAAO;AACnB;AAEA,IAAO,kBAAQ,OAAO,WAAkD;AACpE,MAAI,SAAuB;AAAA,IACvB,OAAO,CAAC;AAAA,IACR,MAAM,OAAO;AAAA,IACb,OAAO;AAAA,EACX;AAGA,WAAS;AAAA,IACL;AAAA,IACA,MAAM,qBAAqB,QAAQ,MAAM;AAAA,IACzC,MAAM,qBAAqB,MAAM;AAAA,EACrC;AAEA,MAAI,OAAO,OAAO;AACd,aAAS,YAAY,QAAQ;AAAA,MACzB,OAAO;AAAA,QACH,cAAc;AAAA,MAClB;AAAA,IACJ,CAAC;AAAA,EACL;AAEA,MAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,aAAS,YAAY,QAAQ;AAAA,MACzB,SAAS;AAAA,IACb,CAAC;AAAA,EACL;AAEA,MAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,QAAI,OAAO,SAAS;AAChB,eAAS,YAAY,QAAQ;AAAA,QACzB,SAAS;AAAA,UACL,IAAI,qBAAqB;AAAA,YACrB,UAAU;AAAA,cACN,QAAQ;AAAA,cACR,aAAa;AAAA,cACb,mBAAmB;AAAA,YACvB;AAAA,UACJ,CAAC;AAAA,QACL;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AAEA,SAAO;AACX;","names":[]}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
pluginOffscreen,
|
|
16
16
|
pluginManifest,
|
|
17
17
|
pluginOptimization,
|
|
18
|
+
pluginOptions,
|
|
18
19
|
pluginOutput,
|
|
19
20
|
pluginPage,
|
|
20
21
|
pluginPopup,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
pluginView
|
|
29
30
|
} from "../plugins/index.js";
|
|
30
31
|
import { fromRootPath, getAppPath, getAppSourcePath, getConfigFile } from "../resolvers/path.js";
|
|
32
|
+
import { isContentLayer } from "./../../cli/bundler/utils/layers.js";
|
|
31
33
|
import { Command, Mode, Workspace } from "./../../types/app.js";
|
|
32
34
|
import { Browser } from "./../../types/browser.js";
|
|
33
35
|
import { Language, LanguageCodes } from "./../../types/locale.js";
|
|
@@ -301,11 +303,12 @@ var config_default = async (config) => {
|
|
|
301
303
|
pluginReact(),
|
|
302
304
|
pluginIcon(),
|
|
303
305
|
pluginAsset(),
|
|
304
|
-
pluginStyle(),
|
|
306
|
+
pluginStyle({ isolationIssuerLayer: isContentLayer }),
|
|
305
307
|
pluginLocale(),
|
|
306
308
|
pluginMeta(),
|
|
307
309
|
pluginContent(),
|
|
308
310
|
pluginBackground(),
|
|
311
|
+
pluginOptions(),
|
|
309
312
|
pluginPopup(),
|
|
310
313
|
pluginPublic(),
|
|
311
314
|
pluginSidebar(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/resolvers/config.ts"],"sourcesContent":["import {existsSync} from \"fs\";\nimport dotenv, {type DotenvParseOutput} from \"dotenv\";\nimport {loadConfig} from \"c12\";\nimport _ from \"lodash\";\n\nimport {\n pluginAsset,\n pluginBackground,\n pluginBundler,\n pluginContent,\n pluginDotenv,\n pluginHtml,\n pluginIcon,\n pluginLocale,\n pluginMeta,\n pluginOffscreen,\n pluginManifest,\n pluginOptimization,\n pluginOutput,\n pluginPage,\n pluginPopup,\n pluginPublic,\n pluginReact,\n pluginSandbox,\n pluginSidebar,\n pluginStyle,\n pluginTypescript,\n pluginVersion,\n pluginView,\n} from \"../plugins\";\n\nimport {fromRootPath, getAppPath, getAppSourcePath, getConfigFile} from \"../resolvers/path\";\n\nimport type {Config, OptionalConfig, ReadonlyConfig, UserConfig} from \"@typing/config\";\nimport {Command, Mode, Workspace} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {Plugin} from \"@typing/plugin\";\nimport {ManifestVersion} from \"@typing/manifest\";\nimport {Language, LanguageCodes} from \"@typing/locale\";\nimport {DefaultIconGroupName} from \"@typing/icon\";\n\nconst resolveLanguage = (lang?: `${Language}` | Language): Language => {\n if (!lang) {\n return Language.English;\n }\n\n if (LanguageCodes.has(lang)) {\n return lang as Language;\n }\n\n throw new Error(`Invalid language \"${lang}\" provided by config`);\n};\n\nconst resolveWorkspace = (workspace?: Workspace | `${Workspace}`): Workspace => {\n if (!workspace) {\n return Workspace.Single;\n }\n\n if (Object.values(Workspace).includes(workspace as Workspace)) {\n return workspace as Workspace;\n }\n\n throw new Error(`Invalid workspace \"${workspace}\" provided by config`);\n};\n\nconst resolveSharedDir = (workspace: Workspace, sharedDir: string): string => {\n return workspace === Workspace.Multi ? sharedDir : \".\";\n};\n\nconst getUserConfig = async (config: ReadonlyConfig): Promise<UserConfig> => {\n const configFilePath = getConfigFile(config);\n\n if (existsSync(configFilePath)) {\n const {config: userConfig} = await loadConfig<UserConfig>({\n configFile: configFilePath,\n dotenv: true,\n });\n\n if (config.debug) {\n console.log(\"Loaded user config:\", configFilePath);\n }\n\n return userConfig || {};\n } else if (config.debug) {\n console.warn(\"Config file not found:\", configFilePath);\n }\n\n return {};\n};\n\nconst validateConfig = (config: ReadonlyConfig): ReadonlyConfig => {\n const {\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n htmlDir,\n publicDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n } = config;\n\n if (\n [\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n htmlDir,\n publicDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n ]\n .filter(dir => _.isString(dir))\n .some(dir => dir.includes(\"..\"))\n ) {\n throw new Error('Directory paths cannot contain relative paths (\"..\") for security reasons.');\n }\n\n if (appsDir === sharedDir) {\n throw new Error(\"Apps directory (appsDir) and shared directory (sharedDir) cannot be the same.\");\n }\n\n if (srcDir === outDir) {\n throw new Error(\"Source directory (srcDir) and destination directory (outputDir) cannot be the same.\");\n }\n\n if (srcDir === \".\") {\n throw new Error('Source directory cannot be the root directory (\".\") for security reasons.');\n }\n\n if (publicDir === \".\" || [srcDir, outDir, appSrcDir].includes(publicDir)) {\n throw new Error(\n 'Public directory cannot be the root directory (\".\") or intersect with other root directories for security reasons.'\n );\n }\n\n return config;\n};\n\nconst updateLocalDotenv = (config: ReadonlyConfig): DotenvParseOutput => {\n const {mode, app, browser, manifestVersion} = config;\n\n const localVars: DotenvParseOutput = {\n APP: app,\n BROWSER: browser,\n MODE: mode,\n MANIFEST_VERSION: String(manifestVersion),\n };\n\n Object.assign(process.env, localVars);\n\n return localVars;\n};\n\nconst loadDotenv = (config: ReadonlyConfig): DotenvParseOutput => {\n const {mode, browser, debug} = config;\n\n const preset = [\n `.env.${mode}.${browser}.local`,\n `.env.${mode}.${browser}`,\n `.env.${browser}.local`,\n `.env.${browser}`,\n `.env.${mode}.local`,\n `.env.${mode}`,\n `.env.local`,\n `.env`,\n ];\n\n const appSourcePaths = preset.map(file => getAppSourcePath(config, file));\n const appPaths = preset.map(file => getAppPath(config, file));\n const rootPaths = preset.map(file => fromRootPath(config, file));\n\n const paths = [...appSourcePaths, ...appPaths, ...rootPaths];\n\n const {parsed: fileVars = {}} = dotenv.config({path: paths, quiet: !debug});\n\n return {...fileVars, ...updateLocalDotenv(config)};\n};\n\nexport default async (config: OptionalConfig): Promise<Config> => {\n let {\n command = Command.Build,\n debug = false,\n configFile = \"adnbn.config.ts\",\n browser = Browser.Chrome,\n app = \"myapp\",\n name = app,\n description,\n shortName,\n version = \"VERSION\",\n minimumVersion = \"MINIMUM_VERSION\",\n author = undefined,\n homepage = \"HOMEPAGE\",\n icon = DefaultIconGroupName,\n lang = Language.English,\n incognito,\n specific,\n workspace = Workspace.Single,\n rootDir = \".\",\n outDir = \"dist\",\n srcDir = \"src\",\n sharedDir = \"shared\",\n appsDir = \"apps\",\n appSrcDir = \".\",\n localeDir = \"locales\",\n iconSrcDir = \"icons\",\n iconOutDir = \"icons\",\n jsDir = \"js\",\n cssDir = \"css\",\n assetsDir = \"assets\",\n publicDir = \"public\",\n htmlDir = \".\",\n html = [],\n bundler = {},\n env = {},\n manifest,\n manifestVersion = (new Set<Browser>([Browser.Safari]).has(browser) ? 2 : 3) as ManifestVersion,\n mode = Mode.Development,\n analyze = false,\n plugins = [],\n mergeBackground = false,\n mergeCommands = false,\n mergeContentScripts = false,\n concatContentScripts = true,\n mergeStyles = true,\n mergeIcons = false,\n mergeLocales = true,\n mergePages = false,\n mergePopup = false,\n mergePublic = false,\n multiplePopup = false,\n mergeSidebar = false,\n multipleSidebar = false,\n mergeRelay = false,\n mergeService = false,\n mergeOffscreen = false,\n mergeSandbox = false,\n commonChunks = true,\n artifactName = \"[name]-[browser]-[mv]\",\n assetsFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:4][ext]\"\n : \"[name]-[contenthash:4][ext]\",\n jsFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:5].js\"\n : \"[name].js\",\n cssFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:5].css\"\n : \"[name].css\",\n cssIdentName = mode === Mode.Production && command === Command.Build && !debug\n ? \"[app]-[hash:base64:5]\"\n : \"[local]-[hash:base64:5]\",\n } = config;\n\n let resolvedConfig: Config = {\n command,\n debug,\n mode,\n browser,\n app,\n name,\n description,\n shortName,\n version,\n minimumVersion,\n author,\n homepage,\n lang: resolveLanguage(lang),\n icon,\n incognito,\n specific,\n manifest,\n manifestVersion,\n workspace: resolveWorkspace(workspace),\n rootDir,\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n publicDir,\n htmlDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n html,\n bundler,\n env,\n plugins,\n analyze,\n configFile,\n mergeBackground,\n mergeCommands,\n mergeContentScripts,\n concatContentScripts,\n mergeStyles,\n mergeIcons,\n mergeLocales,\n mergePages,\n mergePopup,\n mergePublic,\n multiplePopup,\n mergeSidebar,\n multipleSidebar,\n mergeRelay,\n mergeService,\n mergeOffscreen,\n mergeSandbox,\n commonChunks,\n artifactName,\n assetsFilename,\n jsFilename,\n cssFilename,\n cssIdentName,\n };\n\n let vars = loadDotenv(resolvedConfig);\n\n const {\n plugins: userPlugins = [],\n lang: userLang,\n workspace: userWorkspace,\n ...userConfig\n } = await getUserConfig(resolvedConfig);\n\n resolvedConfig = {\n ...resolvedConfig,\n ...userConfig,\n lang: resolveLanguage(userLang ?? resolvedConfig.lang),\n workspace: resolveWorkspace(userWorkspace ?? resolvedConfig.workspace),\n };\n\n resolvedConfig.sharedDir = resolveSharedDir(resolvedConfig.workspace, resolvedConfig.sharedDir);\n\n resolvedConfig = validateConfig(resolvedConfig);\n\n vars = {...vars, ...loadDotenv(resolvedConfig)};\n\n /**\n * IMPORTANT: the order of plugins matters. Early plugins prepare the environment and artifacts for the following ones\n * (e.g., environment variables/output/transpilation/assets → page/version generation → bundling).\n * Reordering may result in missing artifacts, incorrect configuration, or build failures.\n */\n const corePlugins: Plugin[] = [\n pluginDotenv(vars),\n pluginOutput(),\n pluginOptimization(),\n pluginTypescript(),\n pluginReact(),\n pluginIcon(),\n pluginAsset(),\n pluginStyle(),\n pluginLocale(),\n pluginMeta(),\n pluginContent(),\n pluginBackground(),\n pluginPopup(),\n pluginPublic(),\n pluginSidebar(),\n pluginOffscreen(),\n pluginSandbox(),\n pluginPage(),\n pluginView(),\n pluginHtml(),\n pluginVersion(),\n pluginBundler(),\n pluginManifest(),\n ];\n\n return {\n ...resolvedConfig,\n plugins: [...plugins, ...userPlugins, ...corePlugins],\n };\n};\n"],"mappings":"AAAA,SAAQ,kBAAiB;AACzB,OAAO,YAAsC;AAC7C,SAAQ,kBAAiB;AACzB,OAAO,OAAO;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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AAA,IACH,SAAS,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW;AAAA,EACxD;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/resolvers/config.ts"],"sourcesContent":["import {existsSync} from \"fs\";\nimport dotenv, {type DotenvParseOutput} from \"dotenv\";\nimport {loadConfig} from \"c12\";\nimport _ from \"lodash\";\n\nimport {\n pluginAsset,\n pluginBackground,\n pluginBundler,\n pluginContent,\n pluginDotenv,\n pluginHtml,\n pluginIcon,\n pluginLocale,\n pluginMeta,\n pluginOffscreen,\n pluginManifest,\n pluginOptimization,\n pluginOptions,\n pluginOutput,\n pluginPage,\n pluginPopup,\n pluginPublic,\n pluginReact,\n pluginSandbox,\n pluginSidebar,\n pluginStyle,\n pluginTypescript,\n pluginVersion,\n pluginView,\n} from \"../plugins\";\n\nimport {fromRootPath, getAppPath, getAppSourcePath, getConfigFile} from \"../resolvers/path\";\nimport {isContentLayer} from \"@cli/bundler/utils/layers\";\n\nimport type {Config, OptionalConfig, ReadonlyConfig, UserConfig} from \"@typing/config\";\nimport {Command, Mode, Workspace} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {Plugin} from \"@typing/plugin\";\nimport {ManifestVersion} from \"@typing/manifest\";\nimport {Language, LanguageCodes} from \"@typing/locale\";\nimport {DefaultIconGroupName} from \"@typing/icon\";\n\nconst resolveLanguage = (lang?: `${Language}` | Language): Language => {\n if (!lang) {\n return Language.English;\n }\n\n if (LanguageCodes.has(lang)) {\n return lang as Language;\n }\n\n throw new Error(`Invalid language \"${lang}\" provided by config`);\n};\n\nconst resolveWorkspace = (workspace?: Workspace | `${Workspace}`): Workspace => {\n if (!workspace) {\n return Workspace.Single;\n }\n\n if (Object.values(Workspace).includes(workspace as Workspace)) {\n return workspace as Workspace;\n }\n\n throw new Error(`Invalid workspace \"${workspace}\" provided by config`);\n};\n\nconst resolveSharedDir = (workspace: Workspace, sharedDir: string): string => {\n return workspace === Workspace.Multi ? sharedDir : \".\";\n};\n\nconst getUserConfig = async (config: ReadonlyConfig): Promise<UserConfig> => {\n const configFilePath = getConfigFile(config);\n\n if (existsSync(configFilePath)) {\n const {config: userConfig} = await loadConfig<UserConfig>({\n configFile: configFilePath,\n dotenv: true,\n });\n\n if (config.debug) {\n console.log(\"Loaded user config:\", configFilePath);\n }\n\n return userConfig || {};\n } else if (config.debug) {\n console.warn(\"Config file not found:\", configFilePath);\n }\n\n return {};\n};\n\nconst validateConfig = (config: ReadonlyConfig): ReadonlyConfig => {\n const {\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n htmlDir,\n publicDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n } = config;\n\n if (\n [\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n htmlDir,\n publicDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n ]\n .filter(dir => _.isString(dir))\n .some(dir => dir.includes(\"..\"))\n ) {\n throw new Error('Directory paths cannot contain relative paths (\"..\") for security reasons.');\n }\n\n if (appsDir === sharedDir) {\n throw new Error(\"Apps directory (appsDir) and shared directory (sharedDir) cannot be the same.\");\n }\n\n if (srcDir === outDir) {\n throw new Error(\"Source directory (srcDir) and destination directory (outputDir) cannot be the same.\");\n }\n\n if (srcDir === \".\") {\n throw new Error('Source directory cannot be the root directory (\".\") for security reasons.');\n }\n\n if (publicDir === \".\" || [srcDir, outDir, appSrcDir].includes(publicDir)) {\n throw new Error(\n 'Public directory cannot be the root directory (\".\") or intersect with other root directories for security reasons.'\n );\n }\n\n return config;\n};\n\nconst updateLocalDotenv = (config: ReadonlyConfig): DotenvParseOutput => {\n const {mode, app, browser, manifestVersion} = config;\n\n const localVars: DotenvParseOutput = {\n APP: app,\n BROWSER: browser,\n MODE: mode,\n MANIFEST_VERSION: String(manifestVersion),\n };\n\n Object.assign(process.env, localVars);\n\n return localVars;\n};\n\nconst loadDotenv = (config: ReadonlyConfig): DotenvParseOutput => {\n const {mode, browser, debug} = config;\n\n const preset = [\n `.env.${mode}.${browser}.local`,\n `.env.${mode}.${browser}`,\n `.env.${browser}.local`,\n `.env.${browser}`,\n `.env.${mode}.local`,\n `.env.${mode}`,\n `.env.local`,\n `.env`,\n ];\n\n const appSourcePaths = preset.map(file => getAppSourcePath(config, file));\n const appPaths = preset.map(file => getAppPath(config, file));\n const rootPaths = preset.map(file => fromRootPath(config, file));\n\n const paths = [...appSourcePaths, ...appPaths, ...rootPaths];\n\n const {parsed: fileVars = {}} = dotenv.config({path: paths, quiet: !debug});\n\n return {...fileVars, ...updateLocalDotenv(config)};\n};\n\nexport default async (config: OptionalConfig): Promise<Config> => {\n let {\n command = Command.Build,\n debug = false,\n configFile = \"adnbn.config.ts\",\n browser = Browser.Chrome,\n app = \"myapp\",\n name = app,\n description,\n shortName,\n version = \"VERSION\",\n minimumVersion = \"MINIMUM_VERSION\",\n author = undefined,\n homepage = \"HOMEPAGE\",\n icon = DefaultIconGroupName,\n lang = Language.English,\n incognito,\n specific,\n workspace = Workspace.Single,\n rootDir = \".\",\n outDir = \"dist\",\n srcDir = \"src\",\n sharedDir = \"shared\",\n appsDir = \"apps\",\n appSrcDir = \".\",\n localeDir = \"locales\",\n iconSrcDir = \"icons\",\n iconOutDir = \"icons\",\n jsDir = \"js\",\n cssDir = \"css\",\n assetsDir = \"assets\",\n publicDir = \"public\",\n htmlDir = \".\",\n html = [],\n bundler = {},\n env = {},\n manifest,\n manifestVersion = (new Set<Browser>([Browser.Safari]).has(browser) ? 2 : 3) as ManifestVersion,\n mode = Mode.Development,\n analyze = false,\n plugins = [],\n mergeBackground = false,\n mergeCommands = false,\n mergeContentScripts = false,\n concatContentScripts = true,\n mergeStyles = true,\n mergeIcons = false,\n mergeLocales = true,\n mergePages = false,\n mergePopup = false,\n mergePublic = false,\n multiplePopup = false,\n mergeSidebar = false,\n multipleSidebar = false,\n mergeRelay = false,\n mergeService = false,\n mergeOffscreen = false,\n mergeSandbox = false,\n commonChunks = true,\n artifactName = \"[name]-[browser]-[mv]\",\n assetsFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:4][ext]\"\n : \"[name]-[contenthash:4][ext]\",\n jsFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:5].js\"\n : \"[name].js\",\n cssFilename = mode === Mode.Production && command === Command.Build && !debug\n ? \"[contenthash:5].css\"\n : \"[name].css\",\n cssIdentName = mode === Mode.Production && command === Command.Build && !debug\n ? \"[app]-[hash:base64:5]\"\n : \"[local]-[hash:base64:5]\",\n } = config;\n\n let resolvedConfig: Config = {\n command,\n debug,\n mode,\n browser,\n app,\n name,\n description,\n shortName,\n version,\n minimumVersion,\n author,\n homepage,\n lang: resolveLanguage(lang),\n icon,\n incognito,\n specific,\n manifest,\n manifestVersion,\n workspace: resolveWorkspace(workspace),\n rootDir,\n outDir,\n srcDir,\n sharedDir,\n appsDir,\n appSrcDir,\n jsDir,\n cssDir,\n assetsDir,\n publicDir,\n htmlDir,\n localeDir,\n iconSrcDir,\n iconOutDir,\n html,\n bundler,\n env,\n plugins,\n analyze,\n configFile,\n mergeBackground,\n mergeCommands,\n mergeContentScripts,\n concatContentScripts,\n mergeStyles,\n mergeIcons,\n mergeLocales,\n mergePages,\n mergePopup,\n mergePublic,\n multiplePopup,\n mergeSidebar,\n multipleSidebar,\n mergeRelay,\n mergeService,\n mergeOffscreen,\n mergeSandbox,\n commonChunks,\n artifactName,\n assetsFilename,\n jsFilename,\n cssFilename,\n cssIdentName,\n };\n\n let vars = loadDotenv(resolvedConfig);\n\n const {\n plugins: userPlugins = [],\n lang: userLang,\n workspace: userWorkspace,\n ...userConfig\n } = await getUserConfig(resolvedConfig);\n\n resolvedConfig = {\n ...resolvedConfig,\n ...userConfig,\n lang: resolveLanguage(userLang ?? resolvedConfig.lang),\n workspace: resolveWorkspace(userWorkspace ?? resolvedConfig.workspace),\n };\n\n resolvedConfig.sharedDir = resolveSharedDir(resolvedConfig.workspace, resolvedConfig.sharedDir);\n\n resolvedConfig = validateConfig(resolvedConfig);\n\n vars = {...vars, ...loadDotenv(resolvedConfig)};\n\n /**\n * IMPORTANT: the order of plugins matters. Early plugins prepare the environment and artifacts for the following ones\n * (e.g., environment variables/output/transpilation/assets → page/version generation → bundling).\n * Reordering may result in missing artifacts, incorrect configuration, or build failures.\n */\n const corePlugins: Plugin[] = [\n pluginDotenv(vars),\n pluginOutput(),\n pluginOptimization(),\n pluginTypescript(),\n pluginReact(),\n pluginIcon(),\n pluginAsset(),\n pluginStyle({isolationIssuerLayer: isContentLayer}),\n pluginLocale(),\n pluginMeta(),\n pluginContent(),\n pluginBackground(),\n pluginOptions(),\n pluginPopup(),\n pluginPublic(),\n pluginSidebar(),\n pluginOffscreen(),\n pluginSandbox(),\n pluginPage(),\n pluginView(),\n pluginHtml(),\n pluginVersion(),\n pluginBundler(),\n pluginManifest(),\n ];\n\n return {\n ...resolvedConfig,\n plugins: [...plugins, ...userPlugins, ...corePlugins],\n };\n};\n"],"mappings":"AAAA,SAAQ,kBAAiB;AACzB,OAAO,YAAsC;AAC7C,SAAQ,kBAAiB;AACzB,OAAO,OAAO;AAEd;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AAEP,SAAQ,cAAc,YAAY,kBAAkB,qBAAoB;AACxE,SAAQ,sBAAqB;AAG7B,SAAQ,SAAS,MAAM,iBAAgB;AACvC,SAAQ,eAAc;AAGtB,SAAQ,UAAU,qBAAoB;AACtC,SAAQ,4BAA2B;AAEnC,MAAM,kBAAkB,CAAC,SAA8C;AACnE,MAAI,CA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I,OAAO,WAAW,cAAc;AAEpC,QAAM;AAAA,IACF,SAAS,cAAc,CAAC;AAAA,IACxB,MAAM;AAAA,IACN,WAAW;AAAA,IACX,GAAG;AAAA,EACP,IAAI,MAAM,cAAc,cAAc;AAEtC,mBAAiB;AAAA,IACb,GAAG;AAAA,IACH,GAAG;AAAA,IACH,MAAM,gBAAgB,YAAY,eAAe,IAAI;AAAA,IACrD,WAAW,iBAAiB,iBAAiB,eAAe,SAAS;AAAA,EACzE;AAEA,iBAAe,YAAY,iBAAiB,eAAe,WAAW,eAAe,SAAS;AAE9F,mBAAiB,eAAe,cAAc;AAE9C,SAAO,EAAC,GAAG,MAAM,GAAG,WAAW,cAAc,EAAC;AAO9C,QAAM,cAAwB;AAAA,IAC1B,aAAa,IAAI;AAAA,IACjB,aAAa;AAAA,IACb,mBAAmB;AAAA,IACnB,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,YAAY,EAAC,sBAAsB,eAAc,CAAC;AAAA,IAClD,aAAa;AAAA,IACb,WAAW;AAAA,IACX,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,cAAc;AAAA,IACd,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,WAAW;AAAA,IACX,WAAW;AAAA,IACX,WAAW;AAAA,IACX,cAAc;AAAA,IACd,cAAc;AAAA,IACd,eAAe;AAAA,EACnB;AAEA,SAAO;AAAA,IACH,GAAG;AAAA,IACH,SAAS,CAAC,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW;AAAA,EACxD;AACJ;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EntrypointFile } from "../../types/entrypoint.js";
|
|
2
2
|
export declare const virtualBackgroundModule: (file: EntrypointFile) => string;
|
|
3
3
|
export declare const virtualCommandModule: (file: EntrypointFile, name: string) => string;
|
|
4
|
-
export declare const virtualContentScriptModule: (file: EntrypointFile) => string;
|
|
4
|
+
export declare const virtualContentScriptModule: (file: EntrypointFile, navigation?: boolean) => string;
|
|
5
5
|
export declare const virtualOffscreenModule: (file: EntrypointFile, name: string) => string;
|
|
6
6
|
export declare const virtualOffscreenBackgroundModule: () => string;
|
|
7
|
-
export declare const virtualRelayModule: (file: EntrypointFile, name: string) => string;
|
|
7
|
+
export declare const virtualRelayModule: (file: EntrypointFile, name: string, navigation?: boolean) => string;
|
|
8
8
|
export declare const virtualSandboxModule: (file: EntrypointFile, name: string) => string;
|
|
9
9
|
export declare const virtualServiceModule: (file: EntrypointFile, name: string) => string;
|
|
10
10
|
export declare const virtualViewModule: (file: EntrypointFile) => string;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
var background_default = 'import type {BackgroundDefinition} from "adnbn";\nimport background, {isValidBackgroundDefinition, isValidBackgroundMainHandler} from "adnbn/entry/background";\n\nimport * as module from "virtual:background-entrypoint";\n\ntry {\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: BackgroundDefinition = otherDefinition;\n\n if (isValidBackgroundDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidBackgroundMainHandler(defaultDefinition)) {\n definition = {...definition, main: defaultDefinition};\n }\n\n const {main, ...options} = definition;\n\n background({main, ...options});\n} catch (e) {\n console.error("The background crashed on startup:", e);\n}\n';
|
|
3
3
|
|
|
4
4
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/command.ts?raw
|
|
5
|
-
var command_default = 'import type {CommandUnresolvedDefinition} from "adnbn";\nimport
|
|
5
|
+
var command_default = 'import type {CommandUnresolvedDefinition} from "adnbn";\nimport command, {isValidCommandDefinition, isValidCommandExecuteFunction} from "adnbn/entry/command";\n\nimport * as module from "virtual:command-entrypoint";\n\ntry {\n const commandName = "virtual:command-name";\n\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: CommandUnresolvedDefinition = otherDefinition;\n\n if (isValidCommandDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidCommandExecuteFunction(defaultDefinition)) {\n definition = {...definition, execute: defaultDefinition};\n }\n\n const {execute, name = commandName, ...options} = definition;\n\n command({\n name,\n execute,\n ...options,\n });\n} catch (e) {\n console.error("The command crashed on startup:", e);\n}\n';
|
|
6
6
|
|
|
7
7
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/content.ts?raw
|
|
8
|
-
var content_default = 'import type {ContentScriptDefinition} from "adnbn";\nimport {isContentScriptDefinition, isValidContentScriptDefinitionRenderValue} from "adnbn/entry/content";\n\nimport contentScript from "virtual:content-
|
|
8
|
+
var content_default = 'import type {ContentScriptDefinition} from "adnbn";\nimport {isContentScriptDefinition, isValidContentScriptDefinitionRenderValue} from "adnbn/entry/content";\n\nimport contentScript from "virtual:content-builder";\n\nimport * as module from "virtual:content-entrypoint";\n\ntry {\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: object = otherDefinition;\n\n if (isContentScriptDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidContentScriptDefinitionRenderValue(defaultDefinition)) {\n definition = {...definition, render: defaultDefinition} as ContentScriptDefinition;\n }\n\n contentScript(definition as ContentScriptDefinition);\n} catch (e) {\n console.error("The content script crashed on startup:", e);\n}\n';
|
|
9
9
|
|
|
10
10
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/transport.ts?raw
|
|
11
11
|
var transport_default = 'import type {TransportOptions, TransportType, TransportUnresolvedDefinition} from "adnbn/transport";\nimport {isValidTransportDefinition, isValidTransportInitFunction} from "adnbn/entry/transport";\n\n//@ts-ignore\nimport transport from "adnbn/entry/:entry";\n\nimport * as module from "virtual:transport-entrypoint";\n\ntry {\n const transportName = "virtual:transport-name";\n\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: TransportUnresolvedDefinition<TransportOptions, TransportType> = otherDefinition;\n\n if (isValidTransportDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidTransportInitFunction(defaultDefinition)) {\n definition = {...definition, init: defaultDefinition};\n }\n\n const {init, name, ...options} = definition;\n\n transport({name: transportName, init, ...options});\n} catch (e) {\n console.error("The :entry crashed on startup:", e);\n}\n';
|
|
@@ -17,13 +17,13 @@ var offscreen_default = 'import type {OffscreenUnresolvedDefinition} from "adnbn
|
|
|
17
17
|
var offscreen_background_default = 'import {OffscreenBackground} from "adnbn/offscreen";\n\ntry {\n new OffscreenBackground().build();\n} catch (e) {\n console.error("Failed to build offscreen layer on background:", e);\n}\n';
|
|
18
18
|
|
|
19
19
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/relay.ts?raw
|
|
20
|
-
var relay_default = 'import type {TransportType} from "adnbn/transport";\nimport {isValidTransportDefinition, isValidTransportInitFunction} from "adnbn/entry/transport";\nimport {Builder as RelayBuilder, type RelayUnresolvedDefinition} from "adnbn/entry/relay";\n\nimport {Builder as ContentScriptBuilder} from "virtual:content-
|
|
20
|
+
var relay_default = 'import type {ContentScriptDefinition} from "adnbn";\nimport type {TransportType} from "adnbn/transport";\nimport {isValidTransportDefinition, isValidTransportInitFunction} from "adnbn/entry/transport";\nimport {Builder as RelayBuilder, type RelayUnresolvedDefinition} from "adnbn/entry/relay";\n\nimport {Builder as ContentScriptBuilder} from "virtual:content-builder";\n\nimport * as module from "virtual:relay-entrypoint";\n\ntry {\n const relayName = "virtual:relay-name";\n\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: RelayUnresolvedDefinition<TransportType> = otherDefinition;\n\n if (isValidTransportDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidTransportInitFunction(defaultDefinition)) {\n definition = {...definition, init: defaultDefinition};\n }\n\n const {init, main, name, ...options} = definition;\n const {method, allFrames, ...contentOptions} = options;\n\n new RelayBuilder({\n name: relayName,\n init,\n main,\n ...options,\n })\n .content(\n new ContentScriptBuilder({\n ...contentOptions,\n ...(allFrames === undefined ? {} : {allFrames: allFrames !== false}),\n } as ContentScriptDefinition)\n )\n .build()\n .catch(e => {\n console.error("Failed to build relay: ", e);\n });\n} catch (e) {\n console.error("The relay crashed on startup:", e);\n}\n';
|
|
21
21
|
|
|
22
22
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/sandbox.ts?raw
|
|
23
23
|
var sandbox_default = 'import type {SandboxUnresolvedDefinition} from "adnbn";\nimport type {TransportType} from "adnbn/transport";\nimport {isValidTransportDefinition, isValidTransportInitFunction} from "adnbn/entry/transport";\nimport {Builder as SandboxBuilder} from "adnbn/entry/sandbox";\n\nimport {Builder as ViewBuilder} from "virtual:view-framework";\n\nimport * as module from "virtual:sandbox-entrypoint";\n\ntry {\n const sandboxName = "virtual:sandbox-name";\n\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: SandboxUnresolvedDefinition<TransportType> = otherDefinition;\n\n if (isValidTransportDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidTransportInitFunction(defaultDefinition)) {\n definition = {...definition, init: defaultDefinition};\n }\n\n const {init, main, name, ...options} = definition;\n\n new SandboxBuilder({\n name: sandboxName,\n init,\n main,\n ...options,\n })\n .view(new ViewBuilder(options))\n .build()\n .catch(e => {\n console.error("Failed to build sandbox: ", e);\n });\n} catch (e) {\n console.error("The sandbox crashed on startup:", e);\n}\n';
|
|
24
24
|
|
|
25
25
|
// raw-loader:/home/runner/work/addon-bone/addon-bone/src/cli/virtual/view.ts?raw
|
|
26
|
-
var view_default = 'import type {ViewDefinition, ViewOptions} from "adnbn";\nimport {
|
|
26
|
+
var view_default = 'import type {ViewDefinition, ViewOptions} from "adnbn";\nimport {isViewDefinition, isValidViewDefinitionRenderValue} from "adnbn/entry/view";\n\nimport view from "virtual:view-framework";\n\nimport * as module from "virtual:view-entrypoint";\n\ntry {\n const {default: defaultDefinition, ...otherDefinition} = module;\n\n let definition: ViewDefinition<ViewOptions> = otherDefinition;\n\n if (isViewDefinition(defaultDefinition)) {\n definition = {...definition, ...defaultDefinition};\n } else if (isValidViewDefinitionRenderValue(defaultDefinition)) {\n definition = {...definition, render: defaultDefinition};\n }\n\n view(definition);\n} catch (e) {\n console.error("The view crashed on startup:", e);\n}\n';
|
|
27
27
|
|
|
28
28
|
// src/cli/virtual/index.ts
|
|
29
29
|
import { inferEntrypointFramework } from "../entrypoint/index.js";
|
|
@@ -48,8 +48,8 @@ var virtualBackgroundModule = (file) => {
|
|
|
48
48
|
var virtualCommandModule = (file, name) => {
|
|
49
49
|
return getVirtualModule(file, "command").replace("virtual:command-name", name);
|
|
50
50
|
};
|
|
51
|
-
var virtualContentScriptModule = (file) => {
|
|
52
|
-
return getVirtualModule(file, "content").replace(`virtual:content-
|
|
51
|
+
var virtualContentScriptModule = (file, navigation = false) => {
|
|
52
|
+
return getVirtualModule(file, "content").replace(`virtual:content-builder`, navigation ? `${PackageName}/entry/content/frame` : getEntryFramework(file, "content"));
|
|
53
53
|
};
|
|
54
54
|
var virtualOffscreenModule = (file, name) => {
|
|
55
55
|
return getVirtualModule(file, "offscreen").replace("virtual:offscreen-name", name).replace(`virtual:view-framework`, getEntryFramework(file, "view"));
|
|
@@ -57,8 +57,11 @@ var virtualOffscreenModule = (file, name) => {
|
|
|
57
57
|
var virtualOffscreenBackgroundModule = () => {
|
|
58
58
|
return offscreen_background_default;
|
|
59
59
|
};
|
|
60
|
-
var virtualRelayModule = (file, name) => {
|
|
61
|
-
return getVirtualModule(file, "relay").replace("virtual:relay-name", name).replace(
|
|
60
|
+
var virtualRelayModule = (file, name, navigation = false) => {
|
|
61
|
+
return getVirtualModule(file, "relay").replace("virtual:relay-name", name).replace(
|
|
62
|
+
`virtual:content-builder`,
|
|
63
|
+
navigation ? `${PackageName}/entry/content/frame` : getEntryFramework(file, "content")
|
|
64
|
+
);
|
|
62
65
|
};
|
|
63
66
|
var virtualSandboxModule = (file, name) => {
|
|
64
67
|
return getVirtualModule(file, "sandbox").replace("virtual:sandbox-name", name).replace(`virtual:view-framework`, getEntryFramework(file, "view"));
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
// Only placeholders belong here; real adnbn imports resolve to their source modules via tsconfig.json.
|
|
2
|
-
declare module "*?raw" {
|
|
3
|
-
const content: string;
|
|
4
|
-
export default content;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
1
|
declare module "virtual:background-entrypoint" {
|
|
8
2
|
type BackgroundDefinition = import("../../types/background.js").BackgroundDefinition;
|
|
9
3
|
|
|
@@ -29,7 +23,8 @@ declare module "virtual:command-entrypoint" {
|
|
|
29
23
|
declare module "virtual:content-entrypoint" {
|
|
30
24
|
type ContentScriptDefinition = import("../../types/content.js").ContentScriptDefinition;
|
|
31
25
|
|
|
32
|
-
interface ModuleType
|
|
26
|
+
interface ModuleType {
|
|
27
|
+
[name: string]: unknown;
|
|
33
28
|
default: ContentScriptDefinition | ContentScriptDefinition["render"] | undefined;
|
|
34
29
|
}
|
|
35
30
|
|
|
@@ -37,14 +32,16 @@ declare module "virtual:content-entrypoint" {
|
|
|
37
32
|
export = module;
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
declare module "virtual:content-
|
|
35
|
+
declare module "virtual:content-builder" {
|
|
41
36
|
export const Builder:
|
|
42
37
|
| typeof import("../../entry/content/adapters/vanilla/index.js").Builder
|
|
43
|
-
| typeof import("../../entry/content/adapters/react/index.js").Builder
|
|
38
|
+
| typeof import("../../entry/content/adapters/react/index.js").Builder
|
|
39
|
+
| typeof import("../../entry/content/frame/index.js").Builder;
|
|
44
40
|
|
|
45
41
|
const content:
|
|
46
42
|
| typeof import("../../entry/content/adapters/vanilla/index.js").default
|
|
47
|
-
| typeof import("../../entry/content/adapters/react/index.js").default
|
|
43
|
+
| typeof import("../../entry/content/adapters/react/index.js").default
|
|
44
|
+
| typeof import("../../entry/content/frame/index.js").default;
|
|
48
45
|
export default content;
|
|
49
46
|
}
|
|
50
47
|
|
|
@@ -69,6 +66,7 @@ declare module "virtual:relay-entrypoint" {
|
|
|
69
66
|
main,
|
|
70
67
|
name,
|
|
71
68
|
method,
|
|
69
|
+
isolation,
|
|
72
70
|
allFrames,
|
|
73
71
|
matches,
|
|
74
72
|
excludeMatches,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isValidElement } from "react";
|
|
2
2
|
import MountBuilder from "../../core/MountBuilder.js";
|
|
3
|
-
import EventNode from "../../core/EventNode.js";
|
|
3
|
+
import EventNode from "../../core/nodes/EventNode.js";
|
|
4
4
|
import ReactNode from "./Node.js";
|
|
5
5
|
import { contentScriptReactRenderResolver } from "./resolvers/index.js";
|
|
6
6
|
class Builder_default extends MountBuilder {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/entry/content/adapters/react/Builder.ts"],"sourcesContent":["import {isValidElement} from \"react\";\n\nimport MountBuilder from \"../../core/MountBuilder\";\nimport EventNode from \"../../core/EventNode\";\nimport ReactNode from \"./Node\";\n\nimport {contentScriptReactRenderResolver} from \"./resolvers\";\n\nimport {\n ContentScriptDefinition,\n ContentScriptNode,\n ContentScriptRenderHandler,\n ContentScriptRenderValue,\n} from \"@typing/content\";\n\nexport default class extends MountBuilder {\n constructor(definition: ContentScriptDefinition) {\n super(definition);\n }\n\n protected resolveRender(render?: ContentScriptRenderValue): ContentScriptRenderHandler | undefined {\n if (render === undefined) {\n return;\n }\n\n return contentScriptReactRenderResolver(render);\n }\n\n protected async createNode(anchor: Element): Promise<ContentScriptNode> {\n let value = await this.getValue(anchor);\n\n if (!isValidElement(value)) {\n value = undefined;\n\n console.warn(\"Content script react value is not a valid React element\");\n }\n\n return new EventNode(new ReactNode(await super.createNode(anchor), value), this.emitter);\n }\n}\n"],"mappings":"AAAA,SAAQ,sBAAqB;AAE7B,OAAO,kBAAkB;AACzB,OAAO,eAAe;AACtB,OAAO,eAAe;AAEtB,SAAQ,wCAAuC;AAS/C,MAAO,wBAAsB,aAAa;AAAA,EACtC,YAAY,YAAqC;AAC7C,UAAM,UAAU;AAAA,EACpB;AAAA,EAEU,cAAc,QAA2E;AAC/F,QAAI,WAAW,QAAW;AACtB;AAAA,IACJ;AAEA,WAAO,iCAAiC,MAAM;AAAA,EAClD;AAAA,EAEA,MAAgB,WAAW,QAA6C;AACpE,QAAI,QAAQ,MAAM,KAAK,SAAS,MAAM;AAEtC,QAAI,CAAC,eAAe,KAAK,GAAG;AACxB,cAAQ;AAER,cAAQ,KAAK,yDAAyD;AAAA,IAC1E;AAEA,WAAO,IAAI,UAAU,IAAI,UAAU,MAAM,MAAM,WAAW,MAAM,GAAG,KAAK,GAAG,KAAK,OAAO;AAAA,EAC3F;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/adapters/react/Builder.ts"],"sourcesContent":["import {isValidElement} from \"react\";\n\nimport MountBuilder from \"../../core/MountBuilder\";\nimport EventNode from \"../../core/nodes/EventNode\";\nimport ReactNode from \"./Node\";\n\nimport {contentScriptReactRenderResolver} from \"./resolvers\";\n\nimport {\n ContentScriptDefinition,\n ContentScriptNode,\n ContentScriptRenderHandler,\n ContentScriptRenderValue,\n} from \"@typing/content\";\n\nexport default class extends MountBuilder {\n constructor(definition: ContentScriptDefinition) {\n super(definition);\n }\n\n protected resolveRender(render?: ContentScriptRenderValue): ContentScriptRenderHandler | undefined {\n if (render === undefined) {\n return;\n }\n\n return contentScriptReactRenderResolver(render);\n }\n\n protected async createNode(anchor: Element): Promise<ContentScriptNode> {\n let value = await this.getValue(anchor);\n\n if (!isValidElement(value)) {\n value = undefined;\n\n console.warn(\"Content script react value is not a valid React element\");\n }\n\n return new EventNode(new ReactNode(await super.createNode(anchor), value), this.emitter);\n }\n}\n"],"mappings":"AAAA,SAAQ,sBAAqB;AAE7B,OAAO,kBAAkB;AACzB,OAAO,eAAe;AACtB,OAAO,eAAe;AAEtB,SAAQ,wCAAuC;AAS/C,MAAO,wBAAsB,aAAa;AAAA,EACtC,YAAY,YAAqC;AAC7C,UAAM,UAAU;AAAA,EACpB;AAAA,EAEU,cAAc,QAA2E;AAC/F,QAAI,WAAW,QAAW;AACtB;AAAA,IACJ;AAEA,WAAO,iCAAiC,MAAM;AAAA,EAClD;AAAA,EAEA,MAAgB,WAAW,QAA6C;AACpE,QAAI,QAAQ,MAAM,KAAK,SAAS,MAAM;AAEtC,QAAI,CAAC,eAAe,KAAK,GAAG;AACxB,cAAQ;AAER,cAAQ,KAAK,yDAAyD;AAAA,IAC1E;AAEA,WAAO,IAAI,UAAU,IAAI,UAAU,MAAM,MAAM,WAAW,MAAM,GAAG,KAAK,GAAG,KAAK,OAAO;AAAA,EAC3F;AACJ;","names":[]}
|
|
@@ -5,9 +5,11 @@ export default class implements ContentScriptNode {
|
|
|
5
5
|
protected readonly node: ContentScriptNode;
|
|
6
6
|
protected readonly component?: ReactComponent;
|
|
7
7
|
protected root?: Root;
|
|
8
|
+
private renderedTarget?;
|
|
8
9
|
constructor(node: ContentScriptNode, component?: ReactComponent);
|
|
9
10
|
get anchor(): Element;
|
|
10
11
|
get container(): Element | undefined;
|
|
12
|
+
get target(): Element | undefined;
|
|
11
13
|
mount(): boolean;
|
|
12
14
|
unmount(): boolean;
|
|
13
15
|
}
|
|
@@ -7,22 +7,29 @@ class Node_default {
|
|
|
7
7
|
node;
|
|
8
8
|
component;
|
|
9
9
|
root;
|
|
10
|
+
renderedTarget;
|
|
10
11
|
get anchor() {
|
|
11
12
|
return this.node.anchor;
|
|
12
13
|
}
|
|
13
14
|
get container() {
|
|
14
15
|
return this.node.container;
|
|
15
16
|
}
|
|
17
|
+
get target() {
|
|
18
|
+
return this.node.target;
|
|
19
|
+
}
|
|
16
20
|
mount() {
|
|
21
|
+
var _a;
|
|
17
22
|
this.node.mount();
|
|
18
|
-
if (!this.
|
|
23
|
+
if (!this.target || this.root && this.renderedTarget === this.target) {
|
|
19
24
|
return false;
|
|
20
25
|
}
|
|
21
26
|
if (!this.component) {
|
|
22
27
|
console.warn("Content script react component is empty");
|
|
23
28
|
return false;
|
|
24
29
|
}
|
|
25
|
-
this.root
|
|
30
|
+
(_a = this.root) == null ? void 0 : _a.unmount();
|
|
31
|
+
this.renderedTarget = this.target;
|
|
32
|
+
this.root = createRoot(this.target);
|
|
26
33
|
this.root.render(this.component);
|
|
27
34
|
return true;
|
|
28
35
|
}
|
|
@@ -30,6 +37,7 @@ class Node_default {
|
|
|
30
37
|
var _a;
|
|
31
38
|
(_a = this.root) == null ? void 0 : _a.unmount();
|
|
32
39
|
this.root = void 0;
|
|
40
|
+
this.renderedTarget = void 0;
|
|
33
41
|
return !!this.node.unmount();
|
|
34
42
|
}
|
|
35
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/entry/content/adapters/react/Node.ts"],"sourcesContent":["import {ReactNode as ReactComponent} from \"react\";\nimport {createRoot, Root} from \"react-dom/client\";\n\nimport {ContentScriptNode} from \"@typing/content\";\n\nexport default class implements ContentScriptNode {\n protected root?: Root;\n\n constructor(\n protected readonly node: ContentScriptNode,\n protected readonly component?: ReactComponent\n ) {}\n\n public get anchor(): Element {\n return this.node.anchor;\n }\n\n public get container(): Element | undefined {\n return this.node.container;\n }\n\n public mount(): boolean {\n this.node.mount();\n\n if (!this.
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/adapters/react/Node.ts"],"sourcesContent":["import {ReactNode as ReactComponent} from \"react\";\nimport {createRoot, Root} from \"react-dom/client\";\n\nimport {ContentScriptNode} from \"@typing/content\";\n\nexport default class implements ContentScriptNode {\n protected root?: Root;\n\n private renderedTarget?: Element;\n\n constructor(\n protected readonly node: ContentScriptNode,\n protected readonly component?: ReactComponent\n ) {}\n\n public get anchor(): Element {\n return this.node.anchor;\n }\n\n public get container(): Element | undefined {\n return this.node.container;\n }\n\n public get target(): Element | undefined {\n return this.node.target;\n }\n\n public mount(): boolean {\n this.node.mount();\n\n if (!this.target || (this.root && this.renderedTarget === this.target)) {\n return false;\n }\n\n if (!this.component) {\n console.warn(\"Content script react component is empty\");\n\n return false;\n }\n\n this.root?.unmount();\n this.renderedTarget = this.target;\n this.root = createRoot(this.target);\n\n this.root.render(this.component);\n\n return true;\n }\n\n public unmount(): boolean {\n this.root?.unmount();\n this.root = undefined;\n this.renderedTarget = undefined;\n\n return !!this.node.unmount();\n }\n}\n"],"mappings":"AACA,SAAQ,kBAAuB;AAI/B,MAAO,aAA2C;AAAA,EAK9C,YACuB,MACA,WACrB;AAFqB;AACA;AAAA,EACpB;AAAA,EAFoB;AAAA,EACA;AAAA,EANb;AAAA,EAEF;AAAA,EAOR,IAAW,SAAkB;AACzB,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,IAAW,YAAiC;AACxC,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEA,IAAW,SAA8B;AACrC,WAAO,KAAK,KAAK;AAAA,EACrB;AAAA,EAEO,QAAiB;AA3B5B;AA4BQ,SAAK,KAAK,MAAM;AAEhB,QAAI,CAAC,KAAK,UAAW,KAAK,QAAQ,KAAK,mBAAmB,KAAK,QAAS;AACpE,aAAO;AAAA,IACX;AAEA,QAAI,CAAC,KAAK,WAAW;AACjB,cAAQ,KAAK,yCAAyC;AAEtD,aAAO;AAAA,IACX;AAEA,eAAK,SAAL,mBAAW;AACX,SAAK,iBAAiB,KAAK;AAC3B,SAAK,OAAO,WAAW,KAAK,MAAM;AAElC,SAAK,KAAK,OAAO,KAAK,SAAS;AAE/B,WAAO;AAAA,EACX;AAAA,EAEO,UAAmB;AAjD9B;AAkDQ,eAAK,SAAL,mBAAW;AACX,SAAK,OAAO;AACZ,SAAK,iBAAiB;AAEtB,WAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;AAAA,EAC/B;AACJ;","names":[]}
|