adnbn 0.10.0 → 0.12.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/README.md +3 -0
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.js +17 -7
- 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/index.d.ts +1 -0
- package/dist/cli/bundler/index.js +1 -0
- package/dist/cli/bundler/index.js.map +1 -1
- package/dist/cli/bundler/layers.d.ts +5 -0
- package/dist/cli/bundler/layers.js +12 -0
- package/dist/cli/bundler/layers.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 +524 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +2 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +5 -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 +9 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +31 -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 +28 -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/chunks.d.ts +3 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js +32 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.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 +54 -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 +8 -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/compilation-assets.d.ts +4 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js +12 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +5 -0
- package/dist/cli/bundler/plugins/utils/index.js +14 -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-module.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js +11 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.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/app-filename.d.ts +2 -0
- package/dist/cli/bundler/utils/app-filename.js +19 -0
- package/dist/cli/bundler/utils/app-filename.js.map +1 -0
- package/dist/cli/bundler/utils/assets.d.ts +3 -0
- package/dist/cli/bundler/utils/assets.js +162 -0
- package/dist/cli/bundler/utils/assets.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 -1
- package/dist/cli/bundler/utils/index.js +2 -1
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/ContentFinder.d.ts +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 +7 -3
- package/dist/cli/entrypoint/parser/ContentParser.js +42 -6
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +5 -1
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/utils/content/default-render.d.ts +3 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js +21 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js.map +1 -0
- 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 +2 -2
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentDriver.d.ts +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 +2 -2
- 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 +2 -2
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/RelayDriver.d.ts +1 -1
- package/dist/cli/plugins/content/RelayDriver.js +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 +2 -2
- package/dist/cli/plugins/content/utils.d.ts +3 -1
- 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 -1
- package/dist/cli/plugins/index.js +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/output/index.d.ts +2 -0
- package/dist/cli/plugins/output/index.js +60 -0
- package/dist/cli/plugins/output/index.js.map +1 -0
- package/dist/cli/plugins/output/runtime.d.ts +26 -0
- package/dist/cli/plugins/output/runtime.js +19 -0
- package/dist/cli/plugins/output/runtime.js.map +1 -0
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +2 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +14 -11
- package/dist/content/index.d.ts +3 -0
- package/dist/content/index.js +8 -0
- package/dist/content/index.js.map +1 -0
- package/dist/entry/content/adapters/react/Builder.d.ts +5 -6
- package/dist/entry/content/adapters/react/Builder.js +8 -21
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +6 -12
- package/dist/entry/content/adapters/react/Node.js +9 -25
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/react/index.d.ts +2 -1
- package/dist/entry/content/adapters/react/index.js +3 -1
- package/dist/entry/content/adapters/react/index.js.map +1 -1
- package/dist/entry/content/adapters/react/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js +12 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/react/resolvers/render.d.ts +2 -2
- package/dist/entry/content/adapters/react/resolvers/render.js +4 -6
- package/dist/entry/content/adapters/react/resolvers/render.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.d.ts +5 -5
- package/dist/entry/content/adapters/vanilla/Builder.js +9 -15
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +5 -10
- package/dist/entry/content/adapters/vanilla/Node.js +11 -34
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/index.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/index.js +3 -1
- package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js +9 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.d.ts +3 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js +15 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js.map +1 -0
- package/dist/entry/content/index.d.ts +5 -1
- package/dist/entry/content/index.js +8 -1
- package/dist/entry/content/index.js.map +1 -1
- package/dist/entry/content/lifecycle/Builder.d.ts +26 -0
- package/dist/entry/content/lifecycle/Builder.js +212 -0
- package/dist/entry/content/lifecycle/Builder.js.map +1 -0
- package/dist/entry/content/lifecycle/IsolationSetup.d.ts +16 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js +37 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js.map +1 -0
- package/dist/entry/content/lifecycle/MountBuilder.d.ts +8 -0
- package/dist/entry/content/lifecycle/MountBuilder.js +57 -0
- package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/Context.d.ts +5 -2
- package/dist/entry/content/lifecycle/context/Context.js +73 -0
- package/dist/entry/content/lifecycle/context/Context.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.js +3 -3
- package/dist/entry/content/lifecycle/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +5 -0
- package/dist/entry/content/{core → lifecycle/context}/ManagedContext.js +2 -2
- package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/lifecycle/context/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/context/index.js +9 -0
- package/dist/entry/content/lifecycle/context/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.js +3 -3
- package/dist/entry/content/lifecycle/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/lifecycle/markers/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/markers/index.js +9 -0
- package/dist/entry/content/lifecycle/markers/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.d.ts +5 -2
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.js +14 -2
- package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +29 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js +187 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/Node.d.ts +3 -2
- package/dist/entry/content/{core → lifecycle/nodes}/Node.js +5 -2
- package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +19 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js +75 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +21 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js +121 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/index.d.ts +7 -0
- package/dist/entry/content/lifecycle/nodes/index.js +17 -0
- package/dist/entry/content/lifecycle/nodes/index.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/resolvers/anchor.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/anchor.js +2 -2
- package/dist/entry/content/resolvers/anchor.js.map +1 -0
- package/dist/entry/content/resolvers/container.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/container.js +2 -2
- package/dist/entry/content/resolvers/container.js.map +1 -0
- package/dist/entry/content/resolvers/definition.d.ts +5 -0
- package/dist/entry/content/resolvers/definition.js +24 -0
- package/dist/entry/content/resolvers/definition.js.map +1 -0
- package/dist/entry/content/{core/resolvers → resolvers}/index.d.ts +1 -1
- package/dist/entry/content/{core/resolvers → resolvers}/index.js +1 -1
- package/dist/entry/content/resolvers/index.js.map +1 -0
- package/dist/entry/content/resolvers/mount.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/mount.js +3 -3
- package/dist/entry/content/resolvers/mount.js.map +1 -0
- package/dist/entry/content/resolvers/target.d.ts +3 -0
- package/dist/entry/content/resolvers/target.js +34 -0
- package/dist/entry/content/resolvers/target.js.map +1 -0
- package/dist/entry/content/resolvers/watch.d.ts +6 -0
- package/dist/entry/content/{core/resolvers → resolvers}/watch.js +15 -11
- package/dist/entry/content/resolvers/watch.js.map +1 -0
- package/dist/entry/relay/Builder.d.ts +8 -8
- package/dist/entry/relay/Builder.js +32 -19
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/TransportBuilder.d.ts +3 -2
- package/dist/entry/relay/TransportBuilder.js +3 -3
- package/dist/entry/relay/TransportBuilder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +5 -2
- package/dist/entry/relay/index.js +8 -2
- package/dist/entry/relay/index.js.map +1 -1
- package/dist/entry/relay/resolvers/definition.d.ts +4 -0
- package/dist/entry/relay/resolvers/definition.js +16 -0
- package/dist/entry/relay/resolvers/definition.js.map +1 -0
- 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/content.d.ts +4 -6
- package/dist/main/content.js +3 -16
- package/dist/main/content.js.map +1 -1
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +1 -0
- package/dist/main/index.js +1 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +3 -3
- 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/RelayPermission.js +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 +63 -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/adapters/index.d.ts +2 -0
- package/dist/types/content/adapters/index.js +1 -0
- package/dist/types/content/adapters/index.js.map +1 -0
- package/dist/types/content/adapters/react.d.ts +4 -0
- package/dist/types/content/adapters/react.js +1 -0
- package/dist/types/content/adapters/react.js.map +1 -0
- package/dist/types/content/adapters/vanilla.d.ts +1 -0
- package/dist/types/content/adapters/vanilla.js +1 -0
- package/dist/types/content/adapters/vanilla.js.map +1 -0
- package/dist/types/content/boundary.d.ts +17 -0
- package/dist/types/content/boundary.js +1 -0
- package/dist/types/content/boundary.js.map +1 -0
- package/dist/types/{content.d.ts → content/common.d.ts} +119 -59
- package/dist/types/{content.js → content/common.js} +23 -2
- package/dist/types/content/common.js.map +1 -0
- package/dist/types/content/definition.d.ts +61 -0
- package/dist/types/content/definition.js +1 -0
- package/dist/types/content/definition.js.map +1 -0
- package/dist/types/content/index.d.ts +7 -0
- package/dist/types/content/index.js +2 -0
- package/dist/types/content/index.js.map +1 -0
- package/dist/types/content/prepare.d.ts +9 -0
- package/dist/types/content/prepare.js +1 -0
- package/dist/types/content/prepare.js.map +1 -0
- package/dist/types/content/render.d.ts +6 -0
- package/dist/types/content/render.js +1 -0
- package/dist/types/content/render.js.map +1 -0
- package/dist/types/content/target.d.ts +13 -0
- package/dist/types/content/target.js +1 -0
- package/dist/types/content/target.js.map +1 -0
- 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 +11 -8
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/page.d.ts +8 -0
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +15 -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/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 +41 -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/runtime.d.ts +8 -0
- package/dist/virtual/runtime.js +9 -0
- package/dist/virtual/runtime.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 +53 -23
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/scripts/merge-coverage.mjs +12 -0
- package/scripts/pre-commit.mjs +22 -0
- package/scripts/test-inventory.mjs +38 -0
- package/scripts/test-run.mjs +25 -0
- 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/bundler/utils/output.d.ts +0 -2
- package/dist/cli/bundler/utils/output.js +0 -15
- package/dist/cli/bundler/utils/output.js.map +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/account.options.d.ts +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/advanced.options/index.d.ts +0 -1
- package/dist/cli/plugins/output.d.ts +0 -2
- package/dist/cli/plugins/output.js +0 -32
- package/dist/cli/plugins/output.js.map +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.d.ts +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.js +0 -2
- package/dist/entry/content/adapters/react/resolvers/index.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/Builder.d.ts +0 -27
- package/dist/entry/content/core/Builder.js +0 -124
- package/dist/entry/content/core/Builder.js.map +0 -1
- package/dist/entry/content/core/Context.js +0 -43
- 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.d.ts +0 -5
- 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/MountBuilder.d.ts +0 -10
- package/dist/entry/content/core/MountBuilder.js +0 -40
- package/dist/entry/content/core/MountBuilder.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/entry/content/core/resolvers/anchor.d.ts +0 -2
- package/dist/entry/content/core/resolvers/anchor.js.map +0 -1
- package/dist/entry/content/core/resolvers/container.d.ts +0 -2
- package/dist/entry/content/core/resolvers/container.js.map +0 -1
- package/dist/entry/content/core/resolvers/definition.d.ts +0 -3
- package/dist/entry/content/core/resolvers/definition.js +0 -12
- package/dist/entry/content/core/resolvers/definition.js.map +0 -1
- package/dist/entry/content/core/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/resolvers/mount.d.ts +0 -2
- package/dist/entry/content/core/resolvers/mount.js.map +0 -1
- package/dist/entry/content/core/resolvers/render.d.ts +0 -3
- package/dist/entry/content/core/resolvers/render.js +0 -18
- package/dist/entry/content/core/resolvers/render.js.map +0 -1
- package/dist/entry/content/core/resolvers/watch.d.ts +0 -4
- package/dist/entry/content/core/resolvers/watch.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/types/content.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
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { isContentScriptFrameNavigation, resolveContentScriptIsolation } from "./../../../shared/content/index.js";
|
|
2
|
+
import AwaitLock from "await-lock";
|
|
3
|
+
import EntrypointBuilder from "./../../../entry/core/Builder.js";
|
|
4
|
+
import {
|
|
5
|
+
createAnchorResolver,
|
|
6
|
+
createAwaitFirstStrategy,
|
|
7
|
+
createContainerResolver,
|
|
8
|
+
createTargetResolver,
|
|
9
|
+
withLocationTracking,
|
|
10
|
+
createAppendMountHandler,
|
|
11
|
+
createMutationObserverStrategy
|
|
12
|
+
} from "../resolvers/index.js";
|
|
13
|
+
import { ManagedContext, EventEmitter } from "./context/index.js";
|
|
14
|
+
import { AttributeMarker, WeakMarker } from "./markers/index.js";
|
|
15
|
+
import { EventNode } from "./nodes/index.js";
|
|
16
|
+
import {
|
|
17
|
+
ContentScriptMarker
|
|
18
|
+
} from "./../../../types/content/index.js";
|
|
19
|
+
class Builder extends EntrypointBuilder {
|
|
20
|
+
lock = new AwaitLock();
|
|
21
|
+
generation = 0;
|
|
22
|
+
definition;
|
|
23
|
+
emitter = new EventEmitter();
|
|
24
|
+
context = new ManagedContext(this.emitter);
|
|
25
|
+
marker = new AttributeMarker();
|
|
26
|
+
unwatch;
|
|
27
|
+
constructor(input) {
|
|
28
|
+
super();
|
|
29
|
+
const definition = input;
|
|
30
|
+
const isolation = resolveContentScriptIsolation(definition.isolation, "render" in definition);
|
|
31
|
+
if (definition.boundary !== void 0) {
|
|
32
|
+
if (typeof definition.boundary !== "function") {
|
|
33
|
+
throw new Error("Content script boundary must be a synchronous setup handler");
|
|
34
|
+
}
|
|
35
|
+
if (isolation.type === "none") {
|
|
36
|
+
throw new Error("Content script boundary requires Shadow DOM or an iframe");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (definition.target !== void 0 && (isolation.type === "none" || isContentScriptFrameNavigation(isolation))) {
|
|
40
|
+
throw new Error("Content script target requires Shadow DOM or an iframe with local rendering");
|
|
41
|
+
}
|
|
42
|
+
this.definition = {
|
|
43
|
+
...definition,
|
|
44
|
+
marker: this.resolveMarker(definition.marker),
|
|
45
|
+
anchor: this.resolveAnchor(definition.anchor),
|
|
46
|
+
mount: this.resolveMount(definition.mount),
|
|
47
|
+
container: this.resolveContainer(definition.container),
|
|
48
|
+
target: createTargetResolver(definition.target),
|
|
49
|
+
render: definition.render === true ? true : this.resolveRender(definition.render),
|
|
50
|
+
isolation,
|
|
51
|
+
watch: this.resolveWatch(definition.watch)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
resolveMarker(marker) {
|
|
55
|
+
return async (options) => {
|
|
56
|
+
if (typeof marker === "function") {
|
|
57
|
+
marker = await marker(options);
|
|
58
|
+
}
|
|
59
|
+
if (!marker) {
|
|
60
|
+
marker = ContentScriptMarker.Attribute;
|
|
61
|
+
}
|
|
62
|
+
if (typeof marker === "string") {
|
|
63
|
+
switch (marker) {
|
|
64
|
+
case ContentScriptMarker.Weak:
|
|
65
|
+
return new WeakMarker();
|
|
66
|
+
case ContentScriptMarker.Attribute:
|
|
67
|
+
default:
|
|
68
|
+
return new AttributeMarker();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return marker;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
resolveAnchor(anchor) {
|
|
75
|
+
return createAnchorResolver(anchor);
|
|
76
|
+
}
|
|
77
|
+
resolveMount(mount) {
|
|
78
|
+
return mount || createAppendMountHandler();
|
|
79
|
+
}
|
|
80
|
+
resolveContainer(container) {
|
|
81
|
+
return createContainerResolver(container);
|
|
82
|
+
}
|
|
83
|
+
resolveRender(render) {
|
|
84
|
+
if (render !== void 0) {
|
|
85
|
+
throw new Error("Content script rendering requires a renderer adapter");
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
resolveWatch(watch) {
|
|
90
|
+
if (watch === void 0) {
|
|
91
|
+
watch = createAwaitFirstStrategy();
|
|
92
|
+
} else if (watch === true) {
|
|
93
|
+
watch = createMutationObserverStrategy();
|
|
94
|
+
}
|
|
95
|
+
return withLocationTracking(watch);
|
|
96
|
+
}
|
|
97
|
+
getContext() {
|
|
98
|
+
return this.context;
|
|
99
|
+
}
|
|
100
|
+
async build() {
|
|
101
|
+
const destroying = this.destroy();
|
|
102
|
+
const generation = this.generation;
|
|
103
|
+
await destroying;
|
|
104
|
+
if (generation !== this.generation) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const { render, prepare, main, anchor, marker, container, boundary, target, watch, mount, ...options } = this.definition;
|
|
108
|
+
const resolvedMarker = await marker(options);
|
|
109
|
+
if (generation !== this.generation) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
this.marker = resolvedMarker;
|
|
113
|
+
await (main == null ? void 0 : main(this.context, options));
|
|
114
|
+
if (generation !== this.generation) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (render !== void 0 || prepare !== void 0 || isContentScriptFrameNavigation(this.definition.isolation)) {
|
|
118
|
+
await this.processing(generation);
|
|
119
|
+
if (generation !== this.generation) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.unwatch = watch(async () => {
|
|
123
|
+
if (generation !== this.generation) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
try {
|
|
127
|
+
this.context.mount();
|
|
128
|
+
await this.processing(generation);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
console.error("Content script processing on watch error", error);
|
|
131
|
+
}
|
|
132
|
+
}, this.context);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async destroy() {
|
|
136
|
+
var _a;
|
|
137
|
+
this.generation++;
|
|
138
|
+
this.lock = new AwaitLock();
|
|
139
|
+
(_a = this.unwatch) == null ? void 0 : _a.call(this);
|
|
140
|
+
this.unwatch = void 0;
|
|
141
|
+
this.context.clear();
|
|
142
|
+
this.context.unwatch();
|
|
143
|
+
this.marker.reset();
|
|
144
|
+
}
|
|
145
|
+
getPrepareProps(anchor) {
|
|
146
|
+
const {
|
|
147
|
+
anchor: _,
|
|
148
|
+
marker,
|
|
149
|
+
mount,
|
|
150
|
+
watch,
|
|
151
|
+
prepare,
|
|
152
|
+
render,
|
|
153
|
+
container,
|
|
154
|
+
boundary,
|
|
155
|
+
target,
|
|
156
|
+
main,
|
|
157
|
+
...options
|
|
158
|
+
} = this.definition;
|
|
159
|
+
return { ...options, anchor };
|
|
160
|
+
}
|
|
161
|
+
async processing(generation) {
|
|
162
|
+
const lock = this.lock;
|
|
163
|
+
await lock.acquireAsync();
|
|
164
|
+
try {
|
|
165
|
+
if (generation !== this.generation) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const anchor = await this.definition.anchor();
|
|
169
|
+
if (generation !== this.generation) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const anchors = this.marker.for(anchor).unmarked().filter((anchor2) => anchor2.isConnected);
|
|
173
|
+
const results = await Promise.allSettled(anchors.map((anchor2) => this.processAnchor(anchor2, generation)));
|
|
174
|
+
const errors = results.flatMap((result) => result.status === "rejected" ? [result.reason] : []);
|
|
175
|
+
if (errors.length && generation === this.generation) {
|
|
176
|
+
console.error(new AggregateError(errors, "Content script anchor processing failed"));
|
|
177
|
+
}
|
|
178
|
+
} finally {
|
|
179
|
+
lock.release();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
async processAnchor(anchor, generation) {
|
|
183
|
+
var _a, _b, _c;
|
|
184
|
+
const current = () => generation === this.generation && anchor.isConnected;
|
|
185
|
+
const data = await ((_b = (_a = this.definition).prepare) == null ? void 0 : _b.call(_a, this.getPrepareProps(anchor)));
|
|
186
|
+
if (!current()) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const node = new EventNode(await this.createNode(anchor, data, data !== false), this.emitter);
|
|
190
|
+
if (!current()) {
|
|
191
|
+
node.unmount();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.context.add(node);
|
|
195
|
+
if (generation !== this.generation) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
try {
|
|
199
|
+
node.mount();
|
|
200
|
+
if (!current() && !((_c = node.container) == null ? void 0 : _c.isConnected)) {
|
|
201
|
+
this.context.remove(node);
|
|
202
|
+
}
|
|
203
|
+
} catch (error) {
|
|
204
|
+
this.context.remove(node);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export {
|
|
210
|
+
Builder as default
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=Builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/lifecycle/Builder.ts"],"sourcesContent":["import {isContentScriptFrameNavigation, resolveContentScriptIsolation} from \"@shared/content\";\nimport AwaitLock from \"await-lock\";\n\nimport EntrypointBuilder from \"@entry/core/Builder\";\n\nimport {\n createAnchorResolver,\n createAwaitFirstStrategy,\n createContainerResolver,\n createTargetResolver,\n withLocationTracking,\n createAppendMountHandler,\n createMutationObserverStrategy,\n} from \"../resolvers\";\n\nimport {ManagedContext, EventEmitter} from \"./context\";\nimport {AttributeMarker, WeakMarker} from \"./markers\";\nimport {EventNode} from \"./nodes\";\n\nimport {\n ContentScriptAnchor,\n ContentScriptAnchorGetter,\n ContentScriptBuilder,\n ContentScriptContainerCreator,\n ContentScriptContainerFactory,\n ContentScriptContainerOptions,\n ContentScriptContainerTag,\n ContentScriptContext,\n ContentScriptDefinition,\n ContentScriptIsolation,\n ContentScriptMarker,\n ContentScriptMarkerContract,\n ContentScriptMarkerGetter,\n ContentScriptMarkerResolver,\n ContentScriptMarkerType,\n ContentScriptMountFunction,\n ContentScriptNode,\n ContentScriptPrepareProps,\n ContentScriptOptions,\n ContentScriptRenderHandler,\n ContentScriptRenderValue,\n ContentScriptResolvedDefinition,\n ContentScriptWatchStrategy,\n} from \"@typing/content\";\n\nexport default abstract class Builder<\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n>\n extends EntrypointBuilder\n implements ContentScriptBuilder\n{\n private lock = new AwaitLock();\n\n protected generation = 0;\n\n protected readonly definition: ContentScriptResolvedDefinition<Data>;\n\n protected readonly emitter = new EventEmitter();\n\n protected readonly context = new ManagedContext(this.emitter);\n\n protected marker: ContentScriptMarkerContract = new AttributeMarker();\n\n protected unwatch?: () => void;\n\n protected abstract createNode(anchor: Element, data: Data, enabled: boolean): Promise<ContentScriptNode>;\n\n protected constructor(input: ContentScriptDefinition<Data, Isolation>) {\n super();\n\n // Normalization selects the isolation at runtime; its node supplies the matching callback props.\n const definition = input as ContentScriptDefinition<Data>;\n const isolation = resolveContentScriptIsolation(definition.isolation, \"render\" in definition);\n\n if (definition.boundary !== undefined) {\n if (typeof definition.boundary !== \"function\") {\n throw new Error(\"Content script boundary must be a synchronous setup handler\");\n }\n\n if (isolation.type === \"none\") {\n throw new Error(\"Content script boundary requires Shadow DOM or an iframe\");\n }\n }\n\n if (\n definition.target !== undefined &&\n (isolation.type === \"none\" || isContentScriptFrameNavigation(isolation))\n ) {\n throw new Error(\"Content script target requires Shadow DOM or an iframe with local rendering\");\n }\n\n this.definition = {\n ...definition,\n marker: this.resolveMarker(definition.marker),\n anchor: this.resolveAnchor(definition.anchor),\n mount: this.resolveMount(definition.mount),\n container: this.resolveContainer(definition.container),\n target: createTargetResolver(definition.target),\n render: definition.render === true ? true : this.resolveRender(definition.render),\n isolation,\n watch: this.resolveWatch(definition.watch),\n };\n }\n\n protected resolveMarker(marker: ContentScriptMarkerType | ContentScriptMarkerGetter): ContentScriptMarkerResolver {\n return async (options: ContentScriptOptions) => {\n if (typeof marker === \"function\") {\n marker = await marker(options);\n }\n\n if (!marker) {\n marker = ContentScriptMarker.Attribute;\n }\n\n if (typeof marker === \"string\") {\n switch (marker) {\n case ContentScriptMarker.Weak:\n return new WeakMarker();\n\n case ContentScriptMarker.Attribute:\n default:\n return new AttributeMarker();\n }\n }\n\n return marker;\n };\n }\n\n protected resolveAnchor(anchor?: ContentScriptAnchor | ContentScriptAnchorGetter): ContentScriptAnchorGetter {\n return createAnchorResolver(anchor);\n }\n\n protected resolveMount(mount?: ContentScriptMountFunction): ContentScriptMountFunction {\n return mount || createAppendMountHandler();\n }\n\n protected resolveContainer(\n container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory<Data>\n ): ContentScriptContainerCreator<Data> {\n return createContainerResolver(container);\n }\n\n protected resolveRender(\n render?: ContentScriptRenderValue<Data> | ContentScriptRenderHandler<Data>\n ): ContentScriptRenderHandler<Data> | undefined {\n if (render !== undefined) {\n throw new Error(\"Content script rendering requires a renderer adapter\");\n }\n\n return undefined;\n }\n\n protected resolveWatch(watch?: true | ContentScriptWatchStrategy): ContentScriptWatchStrategy {\n if (watch === undefined) {\n watch = createAwaitFirstStrategy();\n } else if (watch === true) {\n watch = createMutationObserverStrategy();\n }\n\n return withLocationTracking(watch);\n }\n\n public getContext(): ContentScriptContext {\n return this.context;\n }\n\n public async build(): Promise<void> {\n const destroying = this.destroy();\n const generation = this.generation;\n await destroying;\n\n if (generation !== this.generation) {\n return;\n }\n\n const {render, prepare, main, anchor, marker, container, boundary, target, watch, mount, ...options} =\n this.definition;\n\n const resolvedMarker = await marker(options);\n\n if (generation !== this.generation) {\n return;\n }\n\n this.marker = resolvedMarker;\n\n await main?.(this.context, options);\n\n if (generation !== this.generation) {\n return;\n }\n\n if (\n render !== undefined ||\n prepare !== undefined ||\n isContentScriptFrameNavigation(this.definition.isolation)\n ) {\n await this.processing(generation);\n\n if (generation !== this.generation) {\n return;\n }\n\n this.unwatch = watch(async () => {\n if (generation !== this.generation) {\n return;\n }\n\n try {\n this.context.mount();\n await this.processing(generation);\n } catch (error) {\n console.error(\"Content script processing on watch error\", error);\n }\n }, this.context);\n }\n }\n\n public async destroy(): Promise<void> {\n this.generation++;\n this.lock = new AwaitLock();\n\n this.unwatch?.();\n this.unwatch = undefined;\n\n this.context.clear();\n this.context.unwatch();\n this.marker.reset();\n }\n\n protected getPrepareProps(anchor: Element): ContentScriptPrepareProps {\n const {\n anchor: _,\n marker,\n mount,\n watch,\n prepare,\n render,\n container,\n boundary,\n target,\n main,\n ...options\n } = this.definition;\n\n return {...options, anchor};\n }\n\n protected async processing(generation: number): Promise<void> {\n const lock = this.lock;\n await lock.acquireAsync();\n\n try {\n if (generation !== this.generation) {\n return;\n }\n\n const anchor = await this.definition.anchor();\n\n if (generation !== this.generation) {\n return;\n }\n\n const anchors = this.marker\n .for(anchor)\n .unmarked()\n .filter(anchor => anchor.isConnected);\n\n const results = await Promise.allSettled(anchors.map(anchor => this.processAnchor(anchor, generation)));\n const errors = results.flatMap(result => (result.status === \"rejected\" ? [result.reason] : []));\n\n if (errors.length && generation === this.generation) {\n console.error(new AggregateError(errors, \"Content script anchor processing failed\"));\n }\n } finally {\n lock.release();\n }\n }\n\n protected async processAnchor(anchor: Element, generation: number): Promise<void> {\n const current = () => generation === this.generation && anchor.isConnected;\n const data = await this.definition.prepare?.(this.getPrepareProps(anchor));\n\n if (!current()) {\n return;\n }\n\n const node = new EventNode(await this.createNode(anchor, data as Data, data !== false), this.emitter);\n\n if (!current()) {\n node.unmount();\n\n return;\n }\n\n this.context.add(node);\n\n if (generation !== this.generation) {\n return;\n }\n\n try {\n node.mount();\n\n if (!current() && !node.container?.isConnected) {\n this.context.remove(node);\n }\n } catch (error) {\n this.context.remove(node);\n throw error;\n }\n }\n}\n"],"mappings":"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","names":["anchor"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ContentScriptBoundary, ContentScriptBoundaryCleanup, ContentScriptBoundaryHandler, ContentScriptContainerProps, ContentScriptTargetProps } from "../../../types/content/index.js";
|
|
2
|
+
interface IsolationSetupOptions<Data, Isolation extends "shadow" | "iframe"> {
|
|
3
|
+
props: () => ContentScriptContainerProps<Data>;
|
|
4
|
+
container: () => Element | undefined;
|
|
5
|
+
boundary?: ContentScriptBoundaryHandler<Data, Isolation>;
|
|
6
|
+
target: (props: ContentScriptTargetProps<Data, Isolation>) => Element;
|
|
7
|
+
}
|
|
8
|
+
/** Applies user configuration; isolation nodes own DOM, cleanup timing, and recovery. */
|
|
9
|
+
export default class IsolationSetup<Data = unknown, Isolation extends "shadow" | "iframe" = "shadow" | "iframe"> {
|
|
10
|
+
private readonly options;
|
|
11
|
+
constructor(options: IsolationSetupOptions<Data, Isolation>);
|
|
12
|
+
setup(boundary: Exclude<ContentScriptBoundary<Isolation>, undefined>): ContentScriptBoundaryCleanup | undefined;
|
|
13
|
+
createTarget(boundary: Exclude<ContentScriptBoundary<Isolation>, undefined>, document: Document): Element;
|
|
14
|
+
private getProps;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
class IsolationSetup {
|
|
2
|
+
constructor(options) {
|
|
3
|
+
this.options = options;
|
|
4
|
+
}
|
|
5
|
+
options;
|
|
6
|
+
setup(boundary) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const props = this.getProps("boundary");
|
|
9
|
+
const cleanup = (_b = (_a = this.options).boundary) == null ? void 0 : _b.call(_a, { ...props, boundary });
|
|
10
|
+
if (cleanup !== void 0 && typeof cleanup !== "function") {
|
|
11
|
+
throw new Error("Content script boundary must return synchronously with a cleanup function or undefined");
|
|
12
|
+
}
|
|
13
|
+
if (cleanup) {
|
|
14
|
+
return () => {
|
|
15
|
+
try {
|
|
16
|
+
cleanup();
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error("Content script boundary cleanup failed", error);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
createTarget(boundary, document) {
|
|
24
|
+
return this.options.target({ ...this.getProps("target"), boundary, document });
|
|
25
|
+
}
|
|
26
|
+
getProps(stage) {
|
|
27
|
+
const container = this.options.container();
|
|
28
|
+
if (!container) {
|
|
29
|
+
throw new Error(`Content script ${stage} requires a mounted container`);
|
|
30
|
+
}
|
|
31
|
+
return { ...this.options.props(), container };
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
IsolationSetup as default
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=IsolationSetup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/lifecycle/IsolationSetup.ts"],"sourcesContent":["import type {\n ContentScriptBoundary,\n ContentScriptBoundaryCleanup,\n ContentScriptBoundaryHandler,\n ContentScriptContainerProps,\n ContentScriptTargetProps,\n} from \"@typing/content\";\n\ninterface IsolationSetupOptions<Data, Isolation extends \"shadow\" | \"iframe\"> {\n props: () => ContentScriptContainerProps<Data>;\n container: () => Element | undefined;\n boundary?: ContentScriptBoundaryHandler<Data, Isolation>;\n target: (props: ContentScriptTargetProps<Data, Isolation>) => Element;\n}\n\n/** Applies user configuration; isolation nodes own DOM, cleanup timing, and recovery. */\nexport default class IsolationSetup<Data = unknown, Isolation extends \"shadow\" | \"iframe\" = \"shadow\" | \"iframe\"> {\n public constructor(private readonly options: IsolationSetupOptions<Data, Isolation>) {}\n\n public setup(\n boundary: Exclude<ContentScriptBoundary<Isolation>, undefined>\n ): ContentScriptBoundaryCleanup | undefined {\n const props = this.getProps(\"boundary\");\n const cleanup = this.options.boundary?.({...props, boundary});\n\n if (cleanup !== undefined && typeof cleanup !== \"function\") {\n throw new Error(\"Content script boundary must return synchronously with a cleanup function or undefined\");\n }\n\n if (cleanup) {\n return () => {\n try {\n cleanup();\n } catch (error) {\n console.error(\"Content script boundary cleanup failed\", error);\n }\n };\n }\n }\n\n public createTarget(boundary: Exclude<ContentScriptBoundary<Isolation>, undefined>, document: Document): Element {\n return this.options.target({...this.getProps(\"target\"), boundary, document});\n }\n\n private getProps(stage: \"boundary\" | \"target\"): ContentScriptContainerProps<Data> & {container: Element} {\n const container = this.options.container();\n\n if (!container) {\n throw new Error(`Content script ${stage} requires a mounted container`);\n }\n\n return {...this.options.props(), container};\n }\n}\n"],"mappings":"AAgBA,MAAO,eAA0G;AAAA,EACtG,YAA6B,SAAiD;AAAjD;AAAA,EAAkD;AAAA,EAAlD;AAAA,EAE7B,MACH,UACwC;AArBhD;AAsBQ,UAAM,QAAQ,KAAK,SAAS,UAAU;AACtC,UAAM,WAAU,gBAAK,SAAQ,aAAb,4BAAwB,EAAC,GAAG,OAAO,SAAQ;AAE3D,QAAI,YAAY,UAAa,OAAO,YAAY,YAAY;AACxD,YAAM,IAAI,MAAM,wFAAwF;AAAA,IAC5G;AAEA,QAAI,SAAS;AACT,aAAO,MAAM;AACT,YAAI;AACA,kBAAQ;AAAA,QACZ,SAAS,OAAO;AACZ,kBAAQ,MAAM,0CAA0C,KAAK;AAAA,QACjE;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAEO,aAAa,UAAgE,UAA6B;AAC7G,WAAO,KAAK,QAAQ,OAAO,EAAC,GAAG,KAAK,SAAS,QAAQ,GAAG,UAAU,SAAQ,CAAC;AAAA,EAC/E;AAAA,EAEQ,SAAS,OAAwF;AACrG,UAAM,YAAY,KAAK,QAAQ,UAAU;AAEzC,QAAI,CAAC,WAAW;AACZ,YAAM,IAAI,MAAM,kBAAkB,KAAK,+BAA+B;AAAA,IAC1E;AAEA,WAAO,EAAC,GAAG,KAAK,QAAQ,MAAM,GAAG,UAAS;AAAA,EAC9C;AACJ;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Builder from "./Builder.js";
|
|
2
|
+
import { ContentScriptDefinition, ContentScriptIsolation, ContentScriptNode, ContentScriptProps, ContentScriptRenderHandler } from "../../../types/content/index.js";
|
|
3
|
+
export default class MountBuilder<Data = unknown, Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`> extends Builder<Data, Isolation> {
|
|
4
|
+
constructor(definition: ContentScriptDefinition<Data, Isolation>);
|
|
5
|
+
protected getProps(node: ContentScriptNode, data: Data): ContentScriptProps<Data>;
|
|
6
|
+
protected createNode(anchor: Element, data: Data, enabled: boolean): Promise<ContentScriptNode>;
|
|
7
|
+
protected createRenderer(node: ContentScriptNode, render: ContentScriptRenderHandler<Data>, props: () => ContentScriptProps<Data>): ContentScriptNode;
|
|
8
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Builder from "./Builder.js";
|
|
2
|
+
import IsolationSetup from "./IsolationSetup.js";
|
|
3
|
+
import { FrameNode, MountNode, MarkerNode, ShadowNode, Node } from "./nodes/index.js";
|
|
4
|
+
import { isContentScriptFrameNavigation } from "./../../../shared/content/index.js";
|
|
5
|
+
import {
|
|
6
|
+
ContentScriptIsolation
|
|
7
|
+
} from "./../../../types/content/index.js";
|
|
8
|
+
class MountBuilder extends Builder {
|
|
9
|
+
constructor(definition) {
|
|
10
|
+
super(definition);
|
|
11
|
+
}
|
|
12
|
+
getProps(node, data) {
|
|
13
|
+
if (!node.container || !node.target) {
|
|
14
|
+
throw new Error("Content script render requires a container and target");
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
...this.getPrepareProps(node.anchor),
|
|
18
|
+
data,
|
|
19
|
+
container: node.container,
|
|
20
|
+
target: node.target,
|
|
21
|
+
boundary: node.boundary
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async createNode(anchor, data, enabled) {
|
|
25
|
+
const navigation = isContentScriptFrameNavigation(this.definition.isolation);
|
|
26
|
+
const render = this.definition.render;
|
|
27
|
+
if (!enabled || !navigation && (render === void 0 || render === true)) {
|
|
28
|
+
return new MarkerNode(new Node(anchor), this.marker);
|
|
29
|
+
}
|
|
30
|
+
const marker = this.marker;
|
|
31
|
+
const container = await this.definition.container({ ...this.getPrepareProps(anchor), data });
|
|
32
|
+
const mountedNode = new MountNode(new MarkerNode(new Node(anchor, container), marker), this.definition.mount);
|
|
33
|
+
const setup = new IsolationSetup({
|
|
34
|
+
props: () => ({ ...this.getPrepareProps(anchor), data }),
|
|
35
|
+
container: () => mountedNode.container,
|
|
36
|
+
boundary: this.definition.boundary,
|
|
37
|
+
target: this.definition.target
|
|
38
|
+
});
|
|
39
|
+
let node = mountedNode;
|
|
40
|
+
switch (this.definition.isolation.type) {
|
|
41
|
+
case ContentScriptIsolation.Shadow:
|
|
42
|
+
node = new ShadowNode(mountedNode, this.definition.isolation, setup);
|
|
43
|
+
break;
|
|
44
|
+
case ContentScriptIsolation.Iframe:
|
|
45
|
+
node = new FrameNode(mountedNode, this.definition.isolation, () => this.context.mount(), setup);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return navigation || typeof render !== "function" ? node : this.createRenderer(node, render, () => this.getProps(node, data));
|
|
49
|
+
}
|
|
50
|
+
createRenderer(node, render, props) {
|
|
51
|
+
throw new Error("Content script rendering requires a renderer adapter");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
MountBuilder as default
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=MountBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/entry/content/lifecycle/MountBuilder.ts"],"sourcesContent":["import Builder from \"./Builder\";\nimport IsolationSetup from \"./IsolationSetup\";\nimport {FrameNode, MountNode, MarkerNode, ShadowNode, Node} from \"./nodes\";\nimport {isContentScriptFrameNavigation} from \"@shared/content\";\n\nimport {\n ContentScriptDefinition,\n ContentScriptIsolation,\n ContentScriptNode,\n ContentScriptProps,\n ContentScriptRenderHandler,\n} from \"@typing/content\";\n\nexport default class MountBuilder<\n Data = unknown,\n Isolation extends `${ContentScriptIsolation}` = `${ContentScriptIsolation}`,\n> extends Builder<Data, Isolation> {\n public constructor(definition: ContentScriptDefinition<Data, Isolation>) {\n super(definition);\n }\n\n protected getProps(node: ContentScriptNode, data: Data): ContentScriptProps<Data> {\n if (!node.container || !node.target) {\n throw new Error(\"Content script render requires a container and target\");\n }\n\n return {\n ...this.getPrepareProps(node.anchor),\n data,\n container: node.container,\n target: node.target,\n boundary: node.boundary,\n };\n }\n\n protected async createNode(anchor: Element, data: Data, enabled: boolean): Promise<ContentScriptNode> {\n const navigation = isContentScriptFrameNavigation(this.definition.isolation);\n const render = this.definition.render;\n\n if (!enabled || (!navigation && (render === undefined || render === true))) {\n return new MarkerNode(new Node(anchor), this.marker);\n }\n\n const marker = this.marker;\n const container = await this.definition.container({...this.getPrepareProps(anchor), data});\n\n const mountedNode = new MountNode(new MarkerNode(new Node(anchor, container), marker), this.definition.mount);\n\n const setup = new IsolationSetup({\n props: () => ({...this.getPrepareProps(anchor), data}),\n container: () => mountedNode.container,\n boundary: this.definition.boundary,\n target: this.definition.target,\n });\n\n let node: ContentScriptNode = mountedNode;\n\n switch (this.definition.isolation.type) {\n case ContentScriptIsolation.Shadow:\n node = new ShadowNode(mountedNode, this.definition.isolation, setup);\n break;\n case ContentScriptIsolation.Iframe:\n node = new FrameNode(mountedNode, this.definition.isolation, () => this.context.mount(), setup);\n break;\n }\n\n return navigation || typeof render !== \"function\"\n ? node\n : this.createRenderer(node, render, () => this.getProps(node, data));\n }\n\n protected createRenderer(\n node: ContentScriptNode,\n render: ContentScriptRenderHandler<Data>,\n props: () => ContentScriptProps<Data>\n ): ContentScriptNode {\n throw new Error(\"Content script rendering requires a renderer adapter\");\n }\n}\n"],"mappings":"AAAA,OAAO,aAAa;AACpB,OAAO,oBAAoB;AAC3B,SAAQ,WAAW,WAAW,YAAY,YAAY,YAAW;AACjE,SAAQ,sCAAqC;AAE7C;AAAA,EAEI;AAAA,OAIG;AAEP,MAAO,qBAGG,QAAyB;AAAA,EACxB,YAAY,YAAsD;AACrE,UAAM,UAAU;AAAA,EACpB;AAAA,EAEU,SAAS,MAAyB,MAAsC;AAC9E,QAAI,CAAC,KAAK,aAAa,CAAC,KAAK,QAAQ;AACjC,YAAM,IAAI,MAAM,uDAAuD;AAAA,IAC3E;AAEA,WAAO;AAAA,MACH,GAAG,KAAK,gBAAgB,KAAK,MAAM;AAAA,MACnC;AAAA,MACA,WAAW,KAAK;AAAA,MAChB,QAAQ,KAAK;AAAA,MACb,UAAU,KAAK;AAAA,IACnB;AAAA,EACJ;AAAA,EAEA,MAAgB,WAAW,QAAiB,MAAY,SAA8C;AAClG,UAAM,aAAa,+BAA+B,KAAK,WAAW,SAAS;AAC3E,UAAM,SAAS,KAAK,WAAW;AAE/B,QAAI,CAAC,WAAY,CAAC,eAAe,WAAW,UAAa,WAAW,OAAQ;AACxE,aAAO,IAAI,WAAW,IAAI,KAAK,MAAM,GAAG,KAAK,MAAM;AAAA,IACvD;AAEA,UAAM,SAAS,KAAK;AACpB,UAAM,YAAY,MAAM,KAAK,WAAW,UAAU,EAAC,GAAG,KAAK,gBAAgB,MAAM,GAAG,KAAI,CAAC;AAEzF,UAAM,cAAc,IAAI,UAAU,IAAI,WAAW,IAAI,KAAK,QAAQ,SAAS,GAAG,MAAM,GAAG,KAAK,WAAW,KAAK;AAE5G,UAAM,QAAQ,IAAI,eAAe;AAAA,MAC7B,OAAO,OAAO,EAAC,GAAG,KAAK,gBAAgB,MAAM,GAAG,KAAI;AAAA,MACpD,WAAW,MAAM,YAAY;AAAA,MAC7B,UAAU,KAAK,WAAW;AAAA,MAC1B,QAAQ,KAAK,WAAW;AAAA,IAC5B,CAAC;AAED,QAAI,OAA0B;AAE9B,YAAQ,KAAK,WAAW,UAAU,MAAM;AAAA,MACpC,KAAK,uBAAuB;AACxB,eAAO,IAAI,WAAW,aAAa,KAAK,WAAW,WAAW,KAAK;AACnE;AAAA,MACJ,KAAK,uBAAuB;AACxB,eAAO,IAAI,UAAU,aAAa,KAAK,WAAW,WAAW,MAAM,KAAK,QAAQ,MAAM,GAAG,KAAK;AAC9F;AAAA,IACR;AAEA,WAAO,cAAc,OAAO,WAAW,aACjC,OACA,KAAK,eAAe,MAAM,QAAQ,MAAM,KAAK,SAAS,MAAM,IAAI,CAAC;AAAA,EAC3E;AAAA,EAEU,eACN,MACA,QACA,OACiB;AACjB,UAAM,IAAI,MAAM,sDAAsD;AAAA,EAC1E;AACJ;","names":[]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { ContentScriptContext, ContentScriptEventCallback, ContentScriptEventEmitter, ContentScriptNode, ContentScriptNodeSet } from "
|
|
2
|
-
export default class implements ContentScriptContext {
|
|
1
|
+
import { ContentScriptContext, ContentScriptEventCallback, ContentScriptEventEmitter, ContentScriptNode, ContentScriptNodeSet } from "../../../../types/content/index.js";
|
|
2
|
+
export default class Context implements ContentScriptContext {
|
|
3
3
|
protected readonly emitter: ContentScriptEventEmitter;
|
|
4
4
|
protected readonly collection: ContentScriptNodeSet;
|
|
5
|
+
private unmounting;
|
|
5
6
|
constructor(emitter: ContentScriptEventEmitter);
|
|
6
7
|
get nodes(): ReadonlySet<ContentScriptNode>;
|
|
7
8
|
mount(): void;
|
|
8
9
|
unmount(): void;
|
|
10
|
+
remove(node: ContentScriptNode): void;
|
|
11
|
+
clear(): void;
|
|
9
12
|
watch(callback: ContentScriptEventCallback): () => void;
|
|
10
13
|
unwatch(): void;
|
|
11
14
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
class Context {
|
|
2
|
+
constructor(emitter) {
|
|
3
|
+
this.emitter = emitter;
|
|
4
|
+
}
|
|
5
|
+
emitter;
|
|
6
|
+
collection = /* @__PURE__ */ new Set();
|
|
7
|
+
unmounting = false;
|
|
8
|
+
get nodes() {
|
|
9
|
+
return this.collection;
|
|
10
|
+
}
|
|
11
|
+
mount() {
|
|
12
|
+
if (this.unmounting) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (const node of this.collection) {
|
|
16
|
+
if (!node.anchor.isConnected) {
|
|
17
|
+
node.unmount();
|
|
18
|
+
this.collection.delete(node);
|
|
19
|
+
this.emitter.emitRemove(node);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
node.mount();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
unmount() {
|
|
26
|
+
const unmounting = this.unmounting;
|
|
27
|
+
this.unmounting = true;
|
|
28
|
+
try {
|
|
29
|
+
for (const node of this.collection) {
|
|
30
|
+
node.unmount();
|
|
31
|
+
if (!node.anchor.isConnected) {
|
|
32
|
+
this.collection.delete(node);
|
|
33
|
+
this.emitter.emitRemove(node);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
} finally {
|
|
37
|
+
this.unmounting = unmounting;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
remove(node) {
|
|
41
|
+
if (!this.collection.delete(node)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
node.unmount();
|
|
45
|
+
this.emitter.emitRemove(node);
|
|
46
|
+
}
|
|
47
|
+
clear() {
|
|
48
|
+
const unmounting = this.unmounting;
|
|
49
|
+
this.unmounting = true;
|
|
50
|
+
try {
|
|
51
|
+
for (const node of this.collection) {
|
|
52
|
+
node.unmount();
|
|
53
|
+
this.collection.delete(node);
|
|
54
|
+
this.emitter.emitRemove(node);
|
|
55
|
+
}
|
|
56
|
+
} finally {
|
|
57
|
+
this.unmounting = unmounting;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
watch(callback) {
|
|
61
|
+
this.emitter.on(callback);
|
|
62
|
+
return () => {
|
|
63
|
+
this.emitter.off(callback);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
unwatch() {
|
|
67
|
+
this.emitter.removeAllListeners();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
Context as default
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=Context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/context/Context.ts"],"sourcesContent":["import {\n ContentScriptContext,\n ContentScriptEventCallback,\n ContentScriptEventEmitter,\n ContentScriptNode,\n ContentScriptNodeSet,\n} from \"@typing/content\";\n\nexport default class Context implements ContentScriptContext {\n protected readonly collection: ContentScriptNodeSet = new Set();\n private unmounting = false;\n\n constructor(protected readonly emitter: ContentScriptEventEmitter) {}\n\n public get nodes(): ReadonlySet<ContentScriptNode> {\n return this.collection;\n }\n\n public mount(): void {\n if (this.unmounting) {\n return;\n }\n\n for (const node of this.collection) {\n if (!node.anchor.isConnected) {\n node.unmount();\n\n this.collection.delete(node);\n\n this.emitter.emitRemove(node);\n\n continue;\n }\n\n node.mount();\n }\n }\n\n public unmount(): void {\n const unmounting = this.unmounting;\n this.unmounting = true;\n\n try {\n for (const node of this.collection) {\n node.unmount();\n\n if (!node.anchor.isConnected) {\n this.collection.delete(node);\n\n this.emitter.emitRemove(node);\n }\n }\n } finally {\n this.unmounting = unmounting;\n }\n }\n\n public remove(node: ContentScriptNode): void {\n if (!this.collection.delete(node)) {\n return;\n }\n\n node.unmount();\n this.emitter.emitRemove(node);\n }\n\n public clear(): void {\n const unmounting = this.unmounting;\n this.unmounting = true;\n\n try {\n for (const node of this.collection) {\n node.unmount();\n this.collection.delete(node);\n this.emitter.emitRemove(node);\n }\n } finally {\n this.unmounting = unmounting;\n }\n }\n\n public watch(callback: ContentScriptEventCallback): () => void {\n this.emitter.on(callback);\n\n return () => {\n this.emitter.off(callback);\n };\n }\n\n public unwatch(): void {\n this.emitter.removeAllListeners();\n }\n}\n"],"mappings":"AAQA,MAAO,QAAsD;AAAA,EAIzD,YAA+B,SAAoC;AAApC;AAAA,EAAqC;AAAA,EAArC;AAAA,EAHZ,aAAmC,oBAAI,IAAI;AAAA,EACtD,aAAa;AAAA,EAIrB,IAAW,QAAwC;AAC/C,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,QAAc;AACjB,QAAI,KAAK,YAAY;AACjB;AAAA,IACJ;AAEA,eAAW,QAAQ,KAAK,YAAY;AAChC,UAAI,CAAC,KAAK,OAAO,aAAa;AAC1B,aAAK,QAAQ;AAEb,aAAK,WAAW,OAAO,IAAI;AAE3B,aAAK,QAAQ,WAAW,IAAI;AAE5B;AAAA,MACJ;AAEA,WAAK,MAAM;AAAA,IACf;AAAA,EACJ;AAAA,EAEO,UAAgB;AACnB,UAAM,aAAa,KAAK;AACxB,SAAK,aAAa;AAElB,QAAI;AACA,iBAAW,QAAQ,KAAK,YAAY;AAChC,aAAK,QAAQ;AAEb,YAAI,CAAC,KAAK,OAAO,aAAa;AAC1B,eAAK,WAAW,OAAO,IAAI;AAE3B,eAAK,QAAQ,WAAW,IAAI;AAAA,QAChC;AAAA,MACJ;AAAA,IACJ,UAAE;AACE,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AAAA,EAEO,OAAO,MAA+B;AACzC,QAAI,CAAC,KAAK,WAAW,OAAO,IAAI,GAAG;AAC/B;AAAA,IACJ;AAEA,SAAK,QAAQ;AACb,SAAK,QAAQ,WAAW,IAAI;AAAA,EAChC;AAAA,EAEO,QAAc;AACjB,UAAM,aAAa,KAAK;AACxB,SAAK,aAAa;AAElB,QAAI;AACA,iBAAW,QAAQ,KAAK,YAAY;AAChC,aAAK,QAAQ;AACb,aAAK,WAAW,OAAO,IAAI;AAC3B,aAAK,QAAQ,WAAW,IAAI;AAAA,MAChC;AAAA,IACJ,UAAE;AACE,WAAK,aAAa;AAAA,IACtB;AAAA,EACJ;AAAA,EAEO,MAAM,UAAkD;AAC3D,SAAK,QAAQ,GAAG,QAAQ;AAExB,WAAO,MAAM;AACT,WAAK,QAAQ,IAAI,QAAQ;AAAA,IAC7B;AAAA,EACJ;AAAA,EAEO,UAAgB;AACnB,SAAK,QAAQ,mBAAmB;AAAA,EACpC;AACJ;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContentScriptEvent, ContentScriptEventCallback, ContentScriptEventEmitter, ContentScriptNode } from "
|
|
2
|
-
export default class implements ContentScriptEventEmitter {
|
|
1
|
+
import { ContentScriptEvent, ContentScriptEventCallback, ContentScriptEventEmitter, ContentScriptNode } from "../../../../types/content/index.js";
|
|
2
|
+
export default class EventEmitter implements ContentScriptEventEmitter {
|
|
3
3
|
private readonly listeners;
|
|
4
4
|
emit(event: ContentScriptEvent, node: ContentScriptNode): void;
|
|
5
5
|
emitAdd(node: ContentScriptNode): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ContentScriptEvent
|
|
3
|
-
} from "
|
|
4
|
-
class
|
|
3
|
+
} from "./../../../../types/content/index.js";
|
|
4
|
+
class EventEmitter {
|
|
5
5
|
listeners = /* @__PURE__ */ new Set();
|
|
6
6
|
emit(event, node) {
|
|
7
7
|
for (const listener of this.listeners) {
|
|
@@ -37,6 +37,6 @@ class EventEmitter_default {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
export {
|
|
40
|
-
|
|
40
|
+
EventEmitter as default
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=EventEmitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/context/EventEmitter.ts"],"sourcesContent":["import {\n ContentScriptEvent,\n ContentScriptEventCallback,\n ContentScriptEventEmitter,\n ContentScriptNode,\n} from \"@typing/content\";\n\nexport default class EventEmitter implements ContentScriptEventEmitter {\n private readonly listeners: Set<ContentScriptEventCallback> = new Set();\n\n public emit(event: ContentScriptEvent, node: ContentScriptNode): void {\n for (const listener of this.listeners) {\n listener(event, node);\n }\n }\n\n public emitAdd(node: ContentScriptNode): void {\n this.emit(ContentScriptEvent.Add, node);\n }\n\n public emitMount(node: ContentScriptNode): void {\n this.emit(ContentScriptEvent.Mount, node);\n }\n\n public emitRemove(node: ContentScriptNode): void {\n this.emit(ContentScriptEvent.Remove, node);\n }\n\n public emitUnmount(node: ContentScriptNode): void {\n this.emit(ContentScriptEvent.Unmount, node);\n }\n\n public hasListeners(): boolean {\n return this.listenerCount() > 0;\n }\n\n public listenerCount(): number {\n return this.listeners.size;\n }\n\n public off(callback: ContentScriptEventCallback): void {\n this.listeners.delete(callback);\n }\n\n public on(callback: ContentScriptEventCallback): void {\n this.listeners.add(callback);\n }\n\n public removeAllListeners(): void {\n this.listeners.clear();\n }\n}\n"],"mappings":"AAAA;AAAA,EACI;AAAA,OAIG;AAEP,MAAO,aAAgE;AAAA,EAClD,YAA6C,oBAAI,IAAI;AAAA,EAE/D,KAAK,OAA2B,MAA+B;AAClE,eAAW,YAAY,KAAK,WAAW;AACnC,eAAS,OAAO,IAAI;AAAA,IACxB;AAAA,EACJ;AAAA,EAEO,QAAQ,MAA+B;AAC1C,SAAK,KAAK,mBAAmB,KAAK,IAAI;AAAA,EAC1C;AAAA,EAEO,UAAU,MAA+B;AAC5C,SAAK,KAAK,mBAAmB,OAAO,IAAI;AAAA,EAC5C;AAAA,EAEO,WAAW,MAA+B;AAC7C,SAAK,KAAK,mBAAmB,QAAQ,IAAI;AAAA,EAC7C;AAAA,EAEO,YAAY,MAA+B;AAC9C,SAAK,KAAK,mBAAmB,SAAS,IAAI;AAAA,EAC9C;AAAA,EAEO,eAAwB;AAC3B,WAAO,KAAK,cAAc,IAAI;AAAA,EAClC;AAAA,EAEO,gBAAwB;AAC3B,WAAO,KAAK,UAAU;AAAA,EAC1B;AAAA,EAEO,IAAI,UAA4C;AACnD,SAAK,UAAU,OAAO,QAAQ;AAAA,EAClC;AAAA,EAEO,GAAG,UAA4C;AAClD,SAAK,UAAU,IAAI,QAAQ;AAAA,EAC/B;AAAA,EAEO,qBAA2B;AAC9B,SAAK,UAAU,MAAM;AAAA,EACzB;AACJ;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Context from "./Context.js";
|
|
2
|
-
class
|
|
2
|
+
class ManagedContext extends Context {
|
|
3
3
|
add(node) {
|
|
4
4
|
this.collection.add(node);
|
|
5
5
|
this.emitter.emitAdd(node);
|
|
@@ -7,6 +7,6 @@ class ManagedContext_default extends Context {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
ManagedContext as default
|
|
11
11
|
};
|
|
12
12
|
//# sourceMappingURL=ManagedContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/context/ManagedContext.ts"],"sourcesContent":["import Context from \"./Context\";\n\nimport {ContentScriptNode} from \"@typing/content\";\n\nexport default class ManagedContext extends Context {\n public add(node: ContentScriptNode): this {\n this.collection.add(node);\n\n this.emitter.emitAdd(node);\n\n return this;\n }\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAIpB,MAAO,uBAAqC,QAAQ;AAAA,EACzC,IAAI,MAA+B;AACtC,SAAK,WAAW,IAAI,IAAI;AAExB,SAAK,QAAQ,QAAQ,IAAI;AAEzB,WAAO;AAAA,EACX;AACJ;","names":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as default2 } from "./Context.js";
|
|
2
|
+
import { default as default3 } from "./ManagedContext.js";
|
|
3
|
+
import { default as default4 } from "./EventEmitter.js";
|
|
4
|
+
export {
|
|
5
|
+
default2 as Context,
|
|
6
|
+
default4 as EventEmitter,
|
|
7
|
+
default3 as ManagedContext
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/context/index.ts"],"sourcesContent":["export {default as Context} from \"./Context\";\nexport {default as ManagedContext} from \"./ManagedContext\";\nexport {default as EventEmitter} from \"./EventEmitter\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAyB;AACjC,SAAmB,WAAXA,gBAAgC;AACxC,SAAmB,WAAXA,gBAA8B;","names":["default"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContentScriptAnchor, ContentScriptMarkerContract, ContentScriptMarkerValue } from "
|
|
2
|
-
export default abstract class implements ContentScriptMarkerContract {
|
|
1
|
+
import { ContentScriptAnchor, ContentScriptMarkerContract, ContentScriptMarkerValue } from "../../../../types/content/index.js";
|
|
2
|
+
export default abstract class AbstractMarker implements ContentScriptMarkerContract {
|
|
3
3
|
protected anchor: ContentScriptAnchor;
|
|
4
4
|
abstract mark(element: Element, value: ContentScriptMarkerValue): boolean;
|
|
5
5
|
abstract unmark(element: Element): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ContentScriptMarkerValue } from "
|
|
2
|
-
class
|
|
1
|
+
import { ContentScriptMarkerValue } from "./../../../../types/content/index.js";
|
|
2
|
+
class AbstractMarker {
|
|
3
3
|
constructor(anchor) {
|
|
4
4
|
this.anchor = anchor;
|
|
5
5
|
}
|
|
@@ -65,6 +65,6 @@ class AbstractMarker_default {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
68
|
+
AbstractMarker as default
|
|
69
69
|
};
|
|
70
70
|
//# sourceMappingURL=AbstractMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/markers/AbstractMarker.ts"],"sourcesContent":["import {ContentScriptAnchor, ContentScriptMarkerContract, ContentScriptMarkerValue} from \"@typing/content\";\n\nexport default abstract class AbstractMarker implements ContentScriptMarkerContract {\n public abstract mark(element: Element, value: ContentScriptMarkerValue): boolean;\n\n public abstract unmark(element: Element): boolean;\n\n public abstract isMarked(element: Element): boolean;\n\n public abstract value(element: Element): ContentScriptMarkerValue | undefined;\n\n protected constructor(protected anchor: ContentScriptAnchor) {}\n\n public for(anchor: ContentScriptAnchor): ContentScriptMarkerContract {\n this.anchor = anchor;\n\n return this;\n }\n\n public unmarked(): Element[] {\n return this.query(false);\n }\n\n public marked(): Element[] {\n return this.query(true);\n }\n\n public mount(element: Element): boolean {\n return this.mark(element, ContentScriptMarkerValue.Mounted);\n }\n\n public unmount(element: Element): boolean {\n return this.mark(element, ContentScriptMarkerValue.Unmounted);\n }\n\n public reset(): ContentScriptMarkerContract {\n for (const element of this.marked()) {\n this.unmark(element);\n }\n\n return this;\n }\n\n protected query(marked: boolean): Element[] {\n const anchor = this.anchor;\n\n if (anchor instanceof Element) {\n const isMarked = this.isMarked(anchor);\n\n if ((isMarked && marked) || (!isMarked && !marked)) {\n return [anchor];\n }\n } else if (typeof anchor === \"string\") {\n return this.queryAnchor(anchor, marked);\n }\n\n return [];\n }\n\n protected queryAnchor(anchor: string, marked: boolean = false): Element[] {\n try {\n if (anchor.startsWith(\"/\")) {\n return this.queryXpath(anchor, marked);\n }\n\n return this.querySelector(anchor, marked);\n } catch (e) {\n console.error(\"Invalid anchor format. Expected a valid string (CSS selector/XPath)\", e);\n\n return [];\n }\n }\n\n protected querySelector(selector: string, _marked: boolean = false): Element[] {\n return Array.from(document.querySelectorAll(selector));\n }\n\n protected queryXpath(xpath: string, _marked: boolean = false): Element[] {\n const elements: Element[] = [];\n\n const result = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n\n for (let i = 0; i < result.snapshotLength; i++) {\n elements.push(result.snapshotItem(i) as Element);\n }\n\n return elements;\n }\n\n protected isValidValue(value: any): value is ContentScriptMarkerValue {\n return [ContentScriptMarkerValue.Unmounted, ContentScriptMarkerValue.Mounted].includes(value);\n }\n}\n"],"mappings":"AAAA,SAA0D,gCAA+B;AAEzF,MAAO,eAA6E;AAAA,EAStE,YAAsB,QAA6B;AAA7B;AAAA,EAA8B;AAAA,EAA9B;AAAA,EAEzB,IAAI,QAA0D;AACjE,SAAK,SAAS;AAEd,WAAO;AAAA,EACX;AAAA,EAEO,WAAsB;AACzB,WAAO,KAAK,MAAM,KAAK;AAAA,EAC3B;AAAA,EAEO,SAAoB;AACvB,WAAO,KAAK,MAAM,IAAI;AAAA,EAC1B;AAAA,EAEO,MAAM,SAA2B;AACpC,WAAO,KAAK,KAAK,SAAS,yBAAyB,OAAO;AAAA,EAC9D;AAAA,EAEO,QAAQ,SAA2B;AACtC,WAAO,KAAK,KAAK,SAAS,yBAAyB,SAAS;AAAA,EAChE;AAAA,EAEO,QAAqC;AACxC,eAAW,WAAW,KAAK,OAAO,GAAG;AACjC,WAAK,OAAO,OAAO;AAAA,IACvB;AAEA,WAAO;AAAA,EACX;AAAA,EAEU,MAAM,QAA4B;AACxC,UAAM,SAAS,KAAK;AAEpB,QAAI,kBAAkB,SAAS;AAC3B,YAAM,WAAW,KAAK,SAAS,MAAM;AAErC,UAAK,YAAY,UAAY,CAAC,YAAY,CAAC,QAAS;AAChD,eAAO,CAAC,MAAM;AAAA,MAClB;AAAA,IACJ,WAAW,OAAO,WAAW,UAAU;AACnC,aAAO,KAAK,YAAY,QAAQ,MAAM;AAAA,IAC1C;AAEA,WAAO,CAAC;AAAA,EACZ;AAAA,EAEU,YAAY,QAAgB,SAAkB,OAAkB;AACtE,QAAI;AACA,UAAI,OAAO,WAAW,GAAG,GAAG;AACxB,eAAO,KAAK,WAAW,QAAQ,MAAM;AAAA,MACzC;AAEA,aAAO,KAAK,cAAc,QAAQ,MAAM;AAAA,IAC5C,SAAS,GAAG;AACR,cAAQ,MAAM,uEAAuE,CAAC;AAEtF,aAAO,CAAC;AAAA,IACZ;AAAA,EACJ;AAAA,EAEU,cAAc,UAAkB,UAAmB,OAAkB;AAC3E,WAAO,MAAM,KAAK,SAAS,iBAAiB,QAAQ,CAAC;AAAA,EACzD;AAAA,EAEU,WAAW,OAAe,UAAmB,OAAkB;AACrE,UAAM,WAAsB,CAAC;AAE7B,UAAM,SAAS,SAAS,SAAS,OAAO,UAAU,MAAM,YAAY,4BAA4B,IAAI;AAEpG,aAAS,IAAI,GAAG,IAAI,OAAO,gBAAgB,KAAK;AAC5C,eAAS,KAAK,OAAO,aAAa,CAAC,CAAY;AAAA,IACnD;AAEA,WAAO;AAAA,EACX;AAAA,EAEU,aAAa,OAA+C;AAClE,WAAO,CAAC,yBAAyB,WAAW,yBAAyB,OAAO,EAAE,SAAS,KAAK;AAAA,EAChG;AACJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import AbstractMarker from "./AbstractMarker.js";
|
|
2
|
-
import { ContentScriptAnchor, ContentScriptMarkerValue } from "
|
|
3
|
-
export default class extends AbstractMarker {
|
|
2
|
+
import { ContentScriptAnchor, ContentScriptMarkerValue } from "../../../../types/content/index.js";
|
|
3
|
+
export default class AttributeMarker extends AbstractMarker {
|
|
4
4
|
protected readonly attr: string;
|
|
5
5
|
constructor(anchor?: ContentScriptAnchor, attr?: string);
|
|
6
6
|
isMarked(element: Element): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { customAlphabet } from "nanoid";
|
|
2
2
|
import AbstractMarker from "./AbstractMarker.js";
|
|
3
|
-
class
|
|
3
|
+
class AttributeMarker extends AbstractMarker {
|
|
4
4
|
attr;
|
|
5
5
|
constructor(anchor, attr) {
|
|
6
6
|
super(anchor);
|
|
@@ -31,6 +31,6 @@ class AttributeMarker_default extends AbstractMarker {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
AttributeMarker as default
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=AttributeMarker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/entry/content/lifecycle/markers/AttributeMarker.ts"],"sourcesContent":["import {customAlphabet} from \"nanoid\";\n\nimport AbstractMarker from \"./AbstractMarker\";\n\nimport {ContentScriptAnchor, ContentScriptMarkerValue} from \"@typing/content\";\n\nexport default class AttributeMarker extends AbstractMarker {\n protected readonly attr: string;\n\n constructor(anchor?: ContentScriptAnchor, attr?: string) {\n super(anchor);\n\n this.attr = attr ?? `data-${customAlphabet(\"abcdefghijklmnopqrstuvwxyz\", 7)()}`;\n }\n\n public isMarked(element: Element): boolean {\n return element.hasAttribute(this.attr);\n }\n\n public mark(element: Element, value: ContentScriptMarkerValue): boolean {\n element.setAttribute(this.attr, value);\n\n return true;\n }\n\n public unmark(element: Element): boolean {\n element.removeAttribute(this.attr);\n\n return true;\n }\n\n public value(element: Element): ContentScriptMarkerValue | undefined {\n const value = element.getAttribute(this.attr);\n\n return this.isValidValue(value) ? value : undefined;\n }\n\n protected querySelector(selector: string, marked: boolean = false): Element[] {\n const filter = marked ? `[${this.attr}]` : `:not([${this.attr}])`;\n\n return super.querySelector(`:is(${selector})${filter}`, marked);\n }\n\n protected queryXpath(xpath: string, marked: boolean = false): Element[] {\n const filter = marked ? `[@${this.attr}]` : `[not(@${this.attr})]`;\n\n return super.queryXpath(`(${xpath.trim()})${filter}`, marked);\n }\n}\n"],"mappings":"AAAA,SAAQ,sBAAqB;AAE7B,OAAO,oBAAoB;AAI3B,MAAO,wBAAsC,eAAe;AAAA,EACrC;AAAA,EAEnB,YAAY,QAA8B,MAAe;AACrD,UAAM,MAAM;AAEZ,SAAK,OAAO,QAAQ,QAAQ,eAAe,8BAA8B,CAAC,EAAE,CAAC;AAAA,EACjF;AAAA,EAEO,SAAS,SAA2B;AACvC,WAAO,QAAQ,aAAa,KAAK,IAAI;AAAA,EACzC;AAAA,EAEO,KAAK,SAAkB,OAA0C;AACpE,YAAQ,aAAa,KAAK,MAAM,KAAK;AAErC,WAAO;AAAA,EACX;AAAA,EAEO,OAAO,SAA2B;AACrC,YAAQ,gBAAgB,KAAK,IAAI;AAEjC,WAAO;AAAA,EACX;AAAA,EAEO,MAAM,SAAwD;AACjE,UAAM,QAAQ,QAAQ,aAAa,KAAK,IAAI;AAE5C,WAAO,KAAK,aAAa,KAAK,IAAI,QAAQ;AAAA,EAC9C;AAAA,EAEU,cAAc,UAAkB,SAAkB,OAAkB;AAC1E,UAAM,SAAS,SAAS,IAAI,KAAK,IAAI,MAAM,SAAS,KAAK,IAAI;AAE7D,WAAO,MAAM,cAAc,OAAO,QAAQ,IAAI,MAAM,IAAI,MAAM;AAAA,EAClE;AAAA,EAEU,WAAW,OAAe,SAAkB,OAAkB;AACpE,UAAM,SAAS,SAAS,KAAK,KAAK,IAAI,MAAM,SAAS,KAAK,IAAI;AAE9D,WAAO,MAAM,WAAW,IAAI,MAAM,KAAK,CAAC,IAAI,MAAM,IAAI,MAAM;AAAA,EAChE;AACJ;","names":[]}
|