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
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Language, LocaleValuesSeparator } from "./../../types/locale.js";
|
|
2
|
+
const selectPluralForm = (message, lang, count) => {
|
|
3
|
+
const parts = message.split(LocaleValuesSeparator);
|
|
4
|
+
return parts[getPluralIndex(lang, count)] ?? parts[0] ?? message;
|
|
5
|
+
};
|
|
6
|
+
const getPluralIndex = (lang, count) => {
|
|
7
|
+
switch (lang) {
|
|
8
|
+
case Language.Indonesian:
|
|
9
|
+
case Language.Japanese:
|
|
10
|
+
case Language.Kannada:
|
|
11
|
+
case Language.Korean:
|
|
12
|
+
case Language.Malay:
|
|
13
|
+
case Language.Thai:
|
|
14
|
+
case Language.Turkish:
|
|
15
|
+
case Language.Vietnamese:
|
|
16
|
+
return 0;
|
|
17
|
+
case Language.Bengali:
|
|
18
|
+
case Language.Bulgarian:
|
|
19
|
+
case Language.Catalan:
|
|
20
|
+
case Language.Danish:
|
|
21
|
+
case Language.German:
|
|
22
|
+
case Language.Greek:
|
|
23
|
+
case Language.English:
|
|
24
|
+
case Language.EnglishAustralia:
|
|
25
|
+
case Language.EnglishGreatBritain:
|
|
26
|
+
case Language.EnglishUSA:
|
|
27
|
+
case Language.Spanish:
|
|
28
|
+
case Language.SpanishLatinAmericaAndCaribbean:
|
|
29
|
+
case Language.Estonian:
|
|
30
|
+
case Language.Persian:
|
|
31
|
+
case Language.Finnish:
|
|
32
|
+
case Language.Gujarati:
|
|
33
|
+
case Language.Hebrew:
|
|
34
|
+
case Language.Hungarian:
|
|
35
|
+
case Language.Italian:
|
|
36
|
+
case Language.Malayalam:
|
|
37
|
+
case Language.Marathi:
|
|
38
|
+
case Language.Dutch:
|
|
39
|
+
case Language.Norwegian:
|
|
40
|
+
case Language.Swedish:
|
|
41
|
+
case Language.Swahili:
|
|
42
|
+
case Language.Tamil:
|
|
43
|
+
case Language.Telugu:
|
|
44
|
+
case Language.ChineseChina:
|
|
45
|
+
case Language.ChineseTaiwan:
|
|
46
|
+
case Language.PortugueseBrazil:
|
|
47
|
+
case Language.PortuguesePortugal:
|
|
48
|
+
return count == 1 ? 0 : 1;
|
|
49
|
+
case Language.Amharic:
|
|
50
|
+
case Language.Filipino:
|
|
51
|
+
case Language.French:
|
|
52
|
+
case Language.Hindi:
|
|
53
|
+
return count == 0 || count == 1 ? 0 : 1;
|
|
54
|
+
case Language.Croatian:
|
|
55
|
+
case Language.Russian:
|
|
56
|
+
case Language.Serbian:
|
|
57
|
+
case Language.Ukrainian:
|
|
58
|
+
return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
|
|
59
|
+
case Language.Czech:
|
|
60
|
+
case Language.Slovak:
|
|
61
|
+
return count == 1 ? 0 : count >= 2 && count <= 4 ? 1 : 2;
|
|
62
|
+
case Language.Lithuanian:
|
|
63
|
+
return count % 10 == 1 && count % 100 != 11 ? 0 : count % 10 >= 2 && (count % 100 < 10 || count % 100 >= 20) ? 1 : 2;
|
|
64
|
+
case Language.Slovenian:
|
|
65
|
+
return count % 100 == 1 ? 0 : count % 100 == 2 ? 1 : count % 100 == 3 || count % 100 == 4 ? 2 : 3;
|
|
66
|
+
case Language.Latvian:
|
|
67
|
+
return count == 0 ? 0 : count % 10 == 1 && count % 100 != 11 ? 1 : 2;
|
|
68
|
+
case Language.Polish:
|
|
69
|
+
return count == 1 ? 0 : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 12 || count % 100 > 14) ? 1 : 2;
|
|
70
|
+
case Language.Romanian:
|
|
71
|
+
return count == 1 ? 0 : count == 0 || count % 100 > 0 && count % 100 < 20 ? 1 : 2;
|
|
72
|
+
case Language.Arabic:
|
|
73
|
+
return count == 0 ? 0 : count == 1 ? 1 : count == 2 ? 2 : count % 100 >= 3 && count % 100 <= 10 ? 3 : count % 100 >= 11 && count % 100 <= 99 ? 4 : 5;
|
|
74
|
+
default:
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
selectPluralForm
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=plural.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/locale/plural.ts"],"sourcesContent":["import {Language, LocaleValuesSeparator} from \"@typing/locale\";\n\nexport const selectPluralForm = (message: string, lang: Language, count: number): string => {\n const parts = message.split(LocaleValuesSeparator);\n\n return parts[getPluralIndex(lang, count)] ?? parts[0] ?? message;\n};\n\nconst getPluralIndex = (lang: Language, count: number): number => {\n switch (lang) {\n case Language.Indonesian:\n case Language.Japanese:\n case Language.Kannada:\n case Language.Korean:\n case Language.Malay:\n case Language.Thai:\n case Language.Turkish:\n case Language.Vietnamese:\n return 0;\n\n case Language.Bengali:\n case Language.Bulgarian:\n case Language.Catalan:\n case Language.Danish:\n case Language.German:\n case Language.Greek:\n case Language.English:\n case Language.EnglishAustralia:\n case Language.EnglishGreatBritain:\n case Language.EnglishUSA:\n case Language.Spanish:\n case Language.SpanishLatinAmericaAndCaribbean:\n case Language.Estonian:\n case Language.Persian:\n case Language.Finnish:\n case Language.Gujarati:\n case Language.Hebrew:\n case Language.Hungarian:\n case Language.Italian:\n case Language.Malayalam:\n case Language.Marathi:\n case Language.Dutch:\n case Language.Norwegian:\n case Language.Swedish:\n case Language.Swahili:\n case Language.Tamil:\n case Language.Telugu:\n case Language.ChineseChina:\n case Language.ChineseTaiwan:\n case Language.PortugueseBrazil:\n case Language.PortuguesePortugal:\n return count == 1 ? 0 : 1;\n\n case Language.Amharic:\n case Language.Filipino:\n case Language.French:\n case Language.Hindi:\n return count == 0 || count == 1 ? 0 : 1;\n\n case Language.Croatian:\n case Language.Russian:\n case Language.Serbian:\n case Language.Ukrainian:\n return count % 10 == 1 && count % 100 != 11\n ? 0\n : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 10 || count % 100 >= 20)\n ? 1\n : 2;\n\n case Language.Czech:\n case Language.Slovak:\n return count == 1 ? 0 : count >= 2 && count <= 4 ? 1 : 2;\n\n case Language.Lithuanian:\n return count % 10 == 1 && count % 100 != 11\n ? 0\n : count % 10 >= 2 && (count % 100 < 10 || count % 100 >= 20)\n ? 1\n : 2;\n\n case Language.Slovenian:\n return count % 100 == 1 ? 0 : count % 100 == 2 ? 1 : count % 100 == 3 || count % 100 == 4 ? 2 : 3;\n\n case Language.Latvian:\n return count == 0 ? 0 : count % 10 == 1 && count % 100 != 11 ? 1 : 2;\n\n case Language.Polish:\n return count == 1\n ? 0\n : count % 10 >= 2 && count % 10 <= 4 && (count % 100 < 12 || count % 100 > 14)\n ? 1\n : 2;\n\n case Language.Romanian:\n return count == 1 ? 0 : count == 0 || (count % 100 > 0 && count % 100 < 20) ? 1 : 2;\n\n case Language.Arabic:\n return count == 0\n ? 0\n : count == 1\n ? 1\n : count == 2\n ? 2\n : count % 100 >= 3 && count % 100 <= 10\n ? 3\n : count % 100 >= 11 && count % 100 <= 99\n ? 4\n : 5;\n\n default:\n return 0;\n }\n};\n"],"mappings":"AAAA,SAAQ,UAAU,6BAA4B;AAEvC,MAAM,mBAAmB,CAAC,SAAiB,MAAgB,UAA0B;AACxF,QAAM,QAAQ,QAAQ,MAAM,qBAAqB;AAEjD,SAAO,MAAM,eAAe,MAAM,KAAK,CAAC,KAAK,MAAM,CAAC,KAAK;AAC7D;AAEA,MAAM,iBAAiB,CAAC,MAAgB,UAA0B;AAC9D,UAAQ,MAAM;AAAA,IACV,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACV,aAAO;AAAA,IAEX,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACV,aAAO,SAAS,IAAI,IAAI;AAAA,IAE5B,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACV,aAAO,SAAS,KAAK,SAAS,IAAI,IAAI;AAAA,IAE1C,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACV,aAAO,QAAQ,MAAM,KAAK,QAAQ,OAAO,KACnC,IACA,QAAQ,MAAM,KAAK,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,OAAO,MACxE,IACA;AAAA,IAEZ,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACV,aAAO,SAAS,IAAI,IAAI,SAAS,KAAK,SAAS,IAAI,IAAI;AAAA,IAE3D,KAAK,SAAS;AACV,aAAO,QAAQ,MAAM,KAAK,QAAQ,OAAO,KACnC,IACA,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,OAAO,MACrD,IACA;AAAA,IAEZ,KAAK,SAAS;AACV,aAAO,QAAQ,OAAO,IAAI,IAAI,QAAQ,OAAO,IAAI,IAAI,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,IAAI;AAAA,IAEpG,KAAK,SAAS;AACV,aAAO,SAAS,IAAI,IAAI,QAAQ,MAAM,KAAK,QAAQ,OAAO,KAAK,IAAI;AAAA,IAEvE,KAAK,SAAS;AACV,aAAO,SAAS,IACV,IACA,QAAQ,MAAM,KAAK,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM,QAAQ,MAAM,MACvE,IACA;AAAA,IAEZ,KAAK,SAAS;AACV,aAAO,SAAS,IAAI,IAAI,SAAS,KAAM,QAAQ,MAAM,KAAK,QAAQ,MAAM,KAAM,IAAI;AAAA,IAEtF,KAAK,SAAS;AACV,aAAO,SAAS,IACV,IACA,SAAS,IACP,IACA,SAAS,IACP,IACA,QAAQ,OAAO,KAAK,QAAQ,OAAO,KACjC,IACA,QAAQ,OAAO,MAAM,QAAQ,OAAO,KAClC,IACA;AAAA,IAElB;AACI,aAAO;AAAA,EACf;AACJ;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface LocalePlaceholder {
|
|
2
|
+
name: string;
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
}
|
|
6
|
+
/** Empty names and malformed placeholders remain literal message text. */
|
|
7
|
+
export declare const parsePlaceholders: (message: string) => LocalePlaceholder[];
|
|
8
|
+
/** Keeps supplied values intact so each adapter can render them in its own format. */
|
|
9
|
+
export declare const applySubstitutions: <T>(message: string, substitutions: Record<string, T> | undefined, onMissing: (name: string) => void) => (string | T)[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const parsePlaceholders = (message) => {
|
|
2
|
+
const placeholders = [];
|
|
3
|
+
for (const match of message.matchAll(/{{([^{}]+)}}/g)) {
|
|
4
|
+
const name = match[1].trim();
|
|
5
|
+
if (name) {
|
|
6
|
+
placeholders.push({ name, start: match.index, end: match.index + match[0].length });
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return placeholders;
|
|
10
|
+
};
|
|
11
|
+
const applySubstitutions = (message, substitutions, onMissing) => {
|
|
12
|
+
if (!substitutions) return [message];
|
|
13
|
+
const parts = [];
|
|
14
|
+
let offset = 0;
|
|
15
|
+
for (const placeholder of parsePlaceholders(message)) {
|
|
16
|
+
parts.push(message.slice(offset, placeholder.start));
|
|
17
|
+
if (Object.prototype.hasOwnProperty.call(substitutions, placeholder.name)) {
|
|
18
|
+
parts.push(substitutions[placeholder.name]);
|
|
19
|
+
} else {
|
|
20
|
+
onMissing(placeholder.name);
|
|
21
|
+
parts.push(placeholder.name);
|
|
22
|
+
}
|
|
23
|
+
offset = placeholder.end;
|
|
24
|
+
}
|
|
25
|
+
parts.push(message.slice(offset));
|
|
26
|
+
return parts;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
applySubstitutions,
|
|
30
|
+
parsePlaceholders
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=substitutions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/shared/locale/substitutions.ts"],"sourcesContent":["interface LocalePlaceholder {\n name: string;\n start: number;\n end: number;\n}\n\n/** Empty names and malformed placeholders remain literal message text. */\nexport const parsePlaceholders = (message: string): LocalePlaceholder[] => {\n const placeholders: LocalePlaceholder[] = [];\n\n for (const match of message.matchAll(/{{([^{}]+)}}/g)) {\n const name = match[1].trim();\n\n if (name) {\n placeholders.push({name, start: match.index, end: match.index + match[0].length});\n }\n }\n\n return placeholders;\n};\n\n/** Keeps supplied values intact so each adapter can render them in its own format. */\nexport const applySubstitutions = <T>(\n message: string,\n substitutions: Record<string, T> | undefined,\n onMissing: (name: string) => void\n): (string | T)[] => {\n if (!substitutions) return [message];\n\n const parts: (string | T)[] = [];\n let offset = 0;\n\n for (const placeholder of parsePlaceholders(message)) {\n parts.push(message.slice(offset, placeholder.start));\n\n if (Object.prototype.hasOwnProperty.call(substitutions, placeholder.name)) {\n parts.push(substitutions[placeholder.name]);\n } else {\n onMissing(placeholder.name);\n parts.push(placeholder.name);\n }\n\n offset = placeholder.end;\n }\n\n parts.push(message.slice(offset));\n\n return parts;\n};\n"],"mappings":"AAOO,MAAM,oBAAoB,CAAC,YAAyC;AACvE,QAAM,eAAoC,CAAC;AAE3C,aAAW,SAAS,QAAQ,SAAS,eAAe,GAAG;AACnD,UAAM,OAAO,MAAM,CAAC,EAAE,KAAK;AAE3B,QAAI,MAAM;AACN,mBAAa,KAAK,EAAC,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,MAAM,CAAC,EAAE,OAAM,CAAC;AAAA,IACpF;AAAA,EACJ;AAEA,SAAO;AACX;AAGO,MAAM,qBAAqB,CAC9B,SACA,eACA,cACiB;AACjB,MAAI,CAAC,cAAe,QAAO,CAAC,OAAO;AAEnC,QAAM,QAAwB,CAAC;AAC/B,MAAI,SAAS;AAEb,aAAW,eAAe,kBAAkB,OAAO,GAAG;AAClD,UAAM,KAAK,QAAQ,MAAM,QAAQ,YAAY,KAAK,CAAC;AAEnD,QAAI,OAAO,UAAU,eAAe,KAAK,eAAe,YAAY,IAAI,GAAG;AACvE,YAAM,KAAK,cAAc,YAAY,IAAI,CAAC;AAAA,IAC9C,OAAO;AACH,gBAAU,YAAY,IAAI;AAC1B,YAAM,KAAK,YAAY,IAAI;AAAA,IAC/B;AAEA,aAAS,YAAY;AAAA,EACzB;AAEA,QAAM,KAAK,QAAQ,MAAM,MAAM,CAAC;AAEhC,SAAO;AACX;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EntrypointBuilder, EntrypointOptions } from "./entrypoint.js";
|
|
2
2
|
import { Awaiter } from "./helpers.js";
|
|
3
|
+
export declare const BackgroundEntryName = "background";
|
|
3
4
|
type ManifestPermissions = chrome.runtime.ManifestPermission;
|
|
4
5
|
type ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;
|
|
5
|
-
export declare const BackgroundEntryName = "background";
|
|
6
6
|
export interface BackgroundConfig {
|
|
7
7
|
persistent?: boolean;
|
|
8
8
|
permissions?: ManifestPermissions[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/background.ts"],"sourcesContent":["import {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter} from \"@typing/helpers\";\n\ntype ManifestPermissions = chrome.runtime.ManifestPermission;\ntype ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../src/types/background.ts"],"sourcesContent":["import {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter} from \"@typing/helpers\";\n\nexport const BackgroundEntryName = \"background\";\n\ntype ManifestPermissions = chrome.runtime.ManifestPermission;\n\ntype ManifestOptionalPermissions = chrome.runtime.ManifestOptionalPermission;\n\nexport interface BackgroundConfig {\n persistent?: boolean;\n permissions?: ManifestPermissions[];\n optionalPermissions?: ManifestOptionalPermissions[];\n hostPermissions?: string[];\n optionalHostPermissions?: string[];\n}\n\nexport type BackgroundOptions = BackgroundConfig & EntrypointOptions;\n\nexport type BackgroundEntrypointOptions = BackgroundOptions;\n\nexport type BackgroundMainHandler = (options: BackgroundOptions) => Awaiter<void>;\n\nexport interface BackgroundDefinition extends BackgroundEntrypointOptions {\n main?: BackgroundMainHandler;\n}\n\nexport type BackgroundBuilder = EntrypointBuilder;\n"],"mappings":"AAGO,MAAM,sBAAsB;","names":[]}
|
package/dist/types/command.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Required } from "utility-types";
|
|
|
2
2
|
import { EntrypointBuilder, EntrypointOptions } from "./entrypoint.js";
|
|
3
3
|
import { BackgroundConfig } from "./background.js";
|
|
4
4
|
import { Awaiter } from "./helpers.js";
|
|
5
|
-
type Tab = chrome.tabs.Tab;
|
|
6
5
|
export declare const CommandExecuteActionName = "_execute_action";
|
|
6
|
+
type Tab = chrome.tabs.Tab;
|
|
7
7
|
export interface CommandConfig extends BackgroundConfig {
|
|
8
8
|
name: string;
|
|
9
9
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/command.ts"],"sourcesContent":["import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter} from \"@typing/helpers\";\n\
|
|
1
|
+
{"version":3,"sources":["../../src/types/command.ts"],"sourcesContent":["import {Required} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {BackgroundConfig} from \"@typing/background\";\nimport {Awaiter} from \"@typing/helpers\";\n\nexport const CommandExecuteActionName = \"_execute_action\";\n\ntype Tab = chrome.tabs.Tab;\n\nexport interface CommandConfig extends BackgroundConfig {\n name: string;\n description?: string;\n global?: boolean;\n defaultKey?: string;\n windowsKey?: string;\n macKey?: string;\n chromeosKey?: string;\n linuxKey?: string;\n}\n\nexport type CommandOptions = CommandConfig & EntrypointOptions;\n\nexport type CommandEntrypointOptions = Partial<CommandOptions>;\n\nexport type CommandExecute = (tab: Tab | undefined, options: CommandOptions) => Awaiter<void>;\n\nexport interface CommandDefinition extends CommandEntrypointOptions {\n execute: CommandExecute;\n}\n\nexport type ExecuteActionCommandDefinition = Omit<CommandDefinition, \"name\">;\n\nexport type CommandUnresolvedDefinition = Partial<CommandDefinition>;\n\nexport type CommandResolvedDefinition = Required<CommandDefinition, \"name\" | \"execute\">;\n\nexport type CommandBuilder = EntrypointBuilder;\n"],"mappings":"AAMO,MAAM,2BAA2B;","names":[]}
|
package/dist/types/content.d.ts
CHANGED
|
@@ -1,14 +1,61 @@
|
|
|
1
|
+
import type { PageAlias } from "./page.js";
|
|
1
2
|
import type { FC, ReactNode } from "react";
|
|
2
3
|
import { Optional } from "utility-types";
|
|
3
4
|
import { EntrypointBuilder, EntrypointOptions } from "./entrypoint.js";
|
|
4
5
|
import { Awaiter, PickNonFunctionProperties } from "./helpers.js";
|
|
5
|
-
type ExecutionWorld = chrome.scripting.ExecutionWorld;
|
|
6
|
-
type RunAt = chrome.extensionTypes.RunAt;
|
|
7
6
|
export declare const ContentScriptMatches: string[];
|
|
7
|
+
/** Shared property used by the bundler plugin and the content script's style runtime getter. */
|
|
8
|
+
export declare const ContentScriptStylesRuntimeProperty = "__adnbnIsolatedStyles";
|
|
9
|
+
export declare enum ContentScriptWorld {
|
|
10
|
+
Isolated = "ISOLATED",
|
|
11
|
+
Main = "MAIN"
|
|
12
|
+
}
|
|
8
13
|
export declare enum ContentScriptDeclarative {
|
|
9
14
|
Required = "required",
|
|
10
15
|
Optional = "optional"
|
|
11
16
|
}
|
|
17
|
+
export declare enum ContentScriptIsolation {
|
|
18
|
+
None = "none",
|
|
19
|
+
Shadow = "shadow",
|
|
20
|
+
Iframe = "iframe"
|
|
21
|
+
}
|
|
22
|
+
export declare enum ContentScriptShadowMode {
|
|
23
|
+
Open = "open",
|
|
24
|
+
Closed = "closed"
|
|
25
|
+
}
|
|
26
|
+
export declare enum ContentScriptAppend {
|
|
27
|
+
Last = "last",
|
|
28
|
+
First = "first",
|
|
29
|
+
Replace = "replace",
|
|
30
|
+
Before = "before",
|
|
31
|
+
After = "after"
|
|
32
|
+
}
|
|
33
|
+
export declare enum ContentScriptMarker {
|
|
34
|
+
/** In-memory marking (no DOM mutations). */
|
|
35
|
+
Weak = "weak",
|
|
36
|
+
/** DOM attribute-based marking. */
|
|
37
|
+
Attribute = "attribute"
|
|
38
|
+
}
|
|
39
|
+
export declare enum ContentScriptMarkerValue {
|
|
40
|
+
Mounted = "1",
|
|
41
|
+
Unmounted = "0"
|
|
42
|
+
}
|
|
43
|
+
export declare enum ContentScriptEvent {
|
|
44
|
+
Mount = "mount",
|
|
45
|
+
Unmount = "unmount",
|
|
46
|
+
Add = "add",
|
|
47
|
+
Remove = "remove"
|
|
48
|
+
}
|
|
49
|
+
type RunAt = chrome.extensionTypes.RunAt;
|
|
50
|
+
export interface ContentScriptStylesRuntime {
|
|
51
|
+
/** Resolves initial stylesheet URLs once, before the first root is registered. */
|
|
52
|
+
initialize(resolveUrl: (file: string) => string): void;
|
|
53
|
+
/** Retry restored styles once on load error; future loads keep the default failure behavior. */
|
|
54
|
+
add(root: ShadowRoot | HTMLElement, target: Element | null, retry?: boolean): void;
|
|
55
|
+
delete(root: ShadowRoot | HTMLElement): void;
|
|
56
|
+
load(url: string): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
export type ContentScriptWorldValue = ContentScriptWorld | `${chrome.scripting.ExecutionWorld}`;
|
|
12
59
|
export interface ContentScriptConfig {
|
|
13
60
|
matches?: string[];
|
|
14
61
|
/**
|
|
@@ -38,8 +85,13 @@ export interface ContentScriptConfig {
|
|
|
38
85
|
runAt?: RunAt;
|
|
39
86
|
/**
|
|
40
87
|
* See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
|
|
88
|
+
*
|
|
89
|
+
* Dynamic imports keep physical async chunks in ISOLATED. MAIN keeps the same Promise-based
|
|
90
|
+
* execution semantics but includes dynamic dependencies in the initial entrypoint graph.
|
|
91
|
+
* Manifest V2 builds always use ISOLATED. Requesting MAIN emits a build warning and applies
|
|
92
|
+
* ISOLATED grouping and chunk loading rules before generating the manifest.
|
|
41
93
|
*/
|
|
42
|
-
world?:
|
|
94
|
+
world?: ContentScriptWorldValue;
|
|
43
95
|
/**
|
|
44
96
|
* See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
|
|
45
97
|
* @default false
|
|
@@ -68,14 +120,57 @@ export interface ContentScriptConfig {
|
|
|
68
120
|
declarative?: boolean | `${ContentScriptDeclarative}` | ContentScriptDeclarative;
|
|
69
121
|
}
|
|
70
122
|
export type ContentScriptOptions = ContentScriptConfig & EntrypointOptions;
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
123
|
+
export interface ContentScriptShadowOptions {
|
|
124
|
+
/**
|
|
125
|
+
* Controls access through the host's shadowRoot property, not CSS isolation or UI visibility.
|
|
126
|
+
* @default ContentScriptShadowMode.Open
|
|
127
|
+
*/
|
|
128
|
+
mode?: ContentScriptShadowMode | `${ContentScriptShadowMode}`;
|
|
129
|
+
}
|
|
130
|
+
export interface ContentScriptFrameOptions {
|
|
131
|
+
width?: number | string;
|
|
132
|
+
/** Defaults to 150px. Automatic height is not supported yet. */
|
|
133
|
+
height?: number | string;
|
|
134
|
+
}
|
|
135
|
+
export interface ContentScriptFrameRenderOptions extends ContentScriptFrameOptions {
|
|
136
|
+
page?: never;
|
|
137
|
+
src?: never;
|
|
78
138
|
}
|
|
139
|
+
export interface ContentScriptFramePageOptions extends ContentScriptFrameOptions {
|
|
140
|
+
page: PageAlias;
|
|
141
|
+
src?: never;
|
|
142
|
+
}
|
|
143
|
+
export interface ContentScriptFrameSourceOptions extends ContentScriptFrameOptions {
|
|
144
|
+
src: string;
|
|
145
|
+
page?: never;
|
|
146
|
+
}
|
|
147
|
+
export type ContentScriptFrame = ContentScriptFrameRenderOptions | ContentScriptFramePageOptions | ContentScriptFrameSourceOptions;
|
|
148
|
+
export interface ContentScriptIsolationNoneOptions {
|
|
149
|
+
type: ContentScriptIsolation.None | "none";
|
|
150
|
+
mode?: never;
|
|
151
|
+
page?: never;
|
|
152
|
+
src?: never;
|
|
153
|
+
width?: never;
|
|
154
|
+
height?: never;
|
|
155
|
+
}
|
|
156
|
+
export interface ContentScriptIsolationShadowOptions extends ContentScriptShadowOptions {
|
|
157
|
+
type: ContentScriptIsolation.Shadow | "shadow";
|
|
158
|
+
page?: never;
|
|
159
|
+
src?: never;
|
|
160
|
+
width?: never;
|
|
161
|
+
height?: never;
|
|
162
|
+
}
|
|
163
|
+
export type ContentScriptIsolationFrameOptions = ContentScriptFrame & {
|
|
164
|
+
type: ContentScriptIsolation.Iframe | "iframe";
|
|
165
|
+
mode?: never;
|
|
166
|
+
};
|
|
167
|
+
/** Object form of isolation, also used after resolving shorthand values. */
|
|
168
|
+
export type ContentScriptIsolationOptions = ContentScriptIsolationNoneOptions | ContentScriptIsolationShadowOptions | ContentScriptIsolationFrameOptions;
|
|
169
|
+
export type ContentScriptIsolationValue = ContentScriptIsolation | `${ContentScriptIsolation}` | ContentScriptIsolationOptions;
|
|
170
|
+
/** Statically resolved configuration; runtime render values are never retained here. */
|
|
171
|
+
export type ContentScriptEntrypointOptions = Partial<ContentScriptOptions> & {
|
|
172
|
+
isolation?: ContentScriptIsolationOptions;
|
|
173
|
+
};
|
|
79
174
|
export type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);
|
|
80
175
|
export interface ContentScriptMount {
|
|
81
176
|
mount(): boolean | undefined | void;
|
|
@@ -86,16 +181,6 @@ export interface ContentScriptProps extends ContentScriptEntrypointOptions {
|
|
|
86
181
|
}
|
|
87
182
|
export type ContentScriptAnchor = string | Element | null | undefined;
|
|
88
183
|
export type ContentScriptAnchorGetter = () => Awaiter<ContentScriptAnchor>;
|
|
89
|
-
export declare enum ContentScriptMarker {
|
|
90
|
-
/** In-memory marking (no DOM mutations). */
|
|
91
|
-
Weak = "weak",
|
|
92
|
-
/** DOM attribute-based marking. */
|
|
93
|
-
Attribute = "attribute"
|
|
94
|
-
}
|
|
95
|
-
export declare enum ContentScriptMarkerValue {
|
|
96
|
-
Mounted = "1",
|
|
97
|
-
Unmounted = "0"
|
|
98
|
-
}
|
|
99
184
|
export interface ContentScriptMarkerContract {
|
|
100
185
|
for(anchor: ContentScriptAnchor): ContentScriptMarkerContract;
|
|
101
186
|
/**
|
|
@@ -127,12 +212,6 @@ export type ContentScriptContainerOptions = {
|
|
|
127
212
|
export type ContentScriptContainerFactory = (props: ContentScriptProps) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;
|
|
128
213
|
export type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;
|
|
129
214
|
export type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;
|
|
130
|
-
export declare enum ContentScriptEvent {
|
|
131
|
-
Mount = "mount",
|
|
132
|
-
Unmount = "unmount",
|
|
133
|
-
Add = "add",
|
|
134
|
-
Remove = "remove"
|
|
135
|
-
}
|
|
136
215
|
export type ContentScriptEventCallback = (event: ContentScriptEvent, node: ContentScriptNode) => void;
|
|
137
216
|
export interface ContentScriptEventEmitter {
|
|
138
217
|
on(callback: ContentScriptEventCallback): void;
|
|
@@ -167,18 +246,27 @@ export type ContentScriptMainFunction = (context: ContentScriptContext, options:
|
|
|
167
246
|
export interface ContentScriptNode extends ContentScriptMount {
|
|
168
247
|
anchor: Element;
|
|
169
248
|
container?: Element;
|
|
249
|
+
/** Element used by the active adapter as the destination for rendered UI. */
|
|
250
|
+
target?: Element;
|
|
170
251
|
}
|
|
171
252
|
export type ContentScriptNodeSet = Set<ContentScriptNode>;
|
|
172
|
-
export interface
|
|
253
|
+
export interface ContentScriptDefinitionBase extends Partial<ContentScriptOptions> {
|
|
173
254
|
marker?: ContentScriptMarkerType | ContentScriptMarkerGetter;
|
|
174
255
|
anchor?: ContentScriptAnchor | ContentScriptAnchorGetter;
|
|
175
256
|
mount?: ContentScriptMountFunction;
|
|
176
|
-
render?: ContentScriptRenderValue | ContentScriptRenderHandler;
|
|
177
257
|
container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory;
|
|
178
258
|
watch?: true | ContentScriptWatchStrategy;
|
|
179
259
|
main?: ContentScriptMainFunction;
|
|
180
260
|
}
|
|
181
|
-
export
|
|
261
|
+
export type ContentScriptDefinition = ContentScriptDefinitionBase & ({
|
|
262
|
+
isolation?: ContentScriptIsolation | `${ContentScriptIsolation}` | ContentScriptIsolationNoneOptions | ContentScriptIsolationShadowOptions | (ContentScriptIsolationFrameOptions & ContentScriptFrameRenderOptions);
|
|
263
|
+
render?: ContentScriptRenderValue | ContentScriptRenderHandler;
|
|
264
|
+
} | {
|
|
265
|
+
isolation: ContentScriptIsolationFrameOptions & (ContentScriptFramePageOptions | ContentScriptFrameSourceOptions);
|
|
266
|
+
render?: never;
|
|
267
|
+
});
|
|
268
|
+
export interface ContentScriptResolvedDefinition extends Omit<ContentScriptDefinitionBase, "anchor" | "marker" | "mount" | "container" | "watch"> {
|
|
269
|
+
isolation: ContentScriptIsolationOptions;
|
|
182
270
|
marker: ContentScriptMarkerResolver;
|
|
183
271
|
anchor: ContentScriptAnchorGetter;
|
|
184
272
|
mount: ContentScriptMountFunction;
|
|
@@ -186,9 +274,10 @@ export interface ContentScriptResolvedDefinition extends Omit<ContentScriptDefin
|
|
|
186
274
|
container: ContentScriptContainerCreator;
|
|
187
275
|
watch: ContentScriptWatchStrategy;
|
|
188
276
|
}
|
|
189
|
-
|
|
277
|
+
type ContentScriptAppendVariant<T> = T extends unknown ? Omit<T, "mount"> & {
|
|
190
278
|
append?: ContentScriptAppend;
|
|
191
|
-
}
|
|
279
|
+
} : never;
|
|
280
|
+
export type ContentScriptAppendDefinition = ContentScriptAppendVariant<ContentScriptDefinition>;
|
|
192
281
|
export interface ContentScriptBuilder extends EntrypointBuilder {
|
|
193
282
|
getContext(): ContentScriptContext;
|
|
194
283
|
}
|
package/dist/types/content.js
CHANGED
|
@@ -1,9 +1,26 @@
|
|
|
1
1
|
const ContentScriptMatches = ["http://*/*", "https://*/*"];
|
|
2
|
+
const ContentScriptStylesRuntimeProperty = "__adnbnIsolatedStyles";
|
|
3
|
+
var ContentScriptWorld = /* @__PURE__ */ ((ContentScriptWorld2) => {
|
|
4
|
+
ContentScriptWorld2["Isolated"] = "ISOLATED";
|
|
5
|
+
ContentScriptWorld2["Main"] = "MAIN";
|
|
6
|
+
return ContentScriptWorld2;
|
|
7
|
+
})(ContentScriptWorld || {});
|
|
2
8
|
var ContentScriptDeclarative = /* @__PURE__ */ ((ContentScriptDeclarative2) => {
|
|
3
9
|
ContentScriptDeclarative2["Required"] = "required";
|
|
4
10
|
ContentScriptDeclarative2["Optional"] = "optional";
|
|
5
11
|
return ContentScriptDeclarative2;
|
|
6
12
|
})(ContentScriptDeclarative || {});
|
|
13
|
+
var ContentScriptIsolation = /* @__PURE__ */ ((ContentScriptIsolation2) => {
|
|
14
|
+
ContentScriptIsolation2["None"] = "none";
|
|
15
|
+
ContentScriptIsolation2["Shadow"] = "shadow";
|
|
16
|
+
ContentScriptIsolation2["Iframe"] = "iframe";
|
|
17
|
+
return ContentScriptIsolation2;
|
|
18
|
+
})(ContentScriptIsolation || {});
|
|
19
|
+
var ContentScriptShadowMode = /* @__PURE__ */ ((ContentScriptShadowMode2) => {
|
|
20
|
+
ContentScriptShadowMode2["Open"] = "open";
|
|
21
|
+
ContentScriptShadowMode2["Closed"] = "closed";
|
|
22
|
+
return ContentScriptShadowMode2;
|
|
23
|
+
})(ContentScriptShadowMode || {});
|
|
7
24
|
var ContentScriptAppend = /* @__PURE__ */ ((ContentScriptAppend2) => {
|
|
8
25
|
ContentScriptAppend2["Last"] = "last";
|
|
9
26
|
ContentScriptAppend2["First"] = "first";
|
|
@@ -33,8 +50,12 @@ export {
|
|
|
33
50
|
ContentScriptAppend,
|
|
34
51
|
ContentScriptDeclarative,
|
|
35
52
|
ContentScriptEvent,
|
|
53
|
+
ContentScriptIsolation,
|
|
36
54
|
ContentScriptMarker,
|
|
37
55
|
ContentScriptMarkerValue,
|
|
38
|
-
ContentScriptMatches
|
|
56
|
+
ContentScriptMatches,
|
|
57
|
+
ContentScriptShadowMode,
|
|
58
|
+
ContentScriptStylesRuntimeProperty,
|
|
59
|
+
ContentScriptWorld
|
|
39
60
|
};
|
|
40
61
|
//# sourceMappingURL=content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/content.ts"],"sourcesContent":["import type {FC, ReactNode} from \"react\";\nimport {Optional} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter, PickNonFunctionProperties} from \"@typing/helpers\";\n\ntype ExecutionWorld = chrome.scripting.ExecutionWorld;\ntype RunAt = chrome.extensionTypes.RunAt;\n\nexport const ContentScriptMatches = [\"http://*/*\", \"https://*/*\"];\n\nexport enum ContentScriptDeclarative {\n Required = \"required\",\n Optional = \"optional\",\n}\n\nexport interface ContentScriptConfig {\n matches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeMatches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n includeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n allFrames?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default \"documentIdle\"\n */\n runAt?: RunAt;\n /**\n * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world\n */\n world?: ExecutionWorld;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchAboutBlank?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchOriginAsFallback?: boolean;\n /**\n * Whether this content script requires explicit host permission declaration in the extension manifest.\n *\n * Accepted values:\n * - ContentScriptDeclarative.Required — adds the corresponding host patterns to manifest.host_permissions.\n * - ContentScriptDeclarative.Optional — adds the corresponding host patterns to manifest.optional_host_permissions.\n *\n * Backward compatibility:\n * - true ≡ ContentScriptDeclarative.Required\n * - false ≡ undefined (as if the value is not set)\n *\n * @see https://developer.chrome.com/docs/extensions/mv3/declare_permissions/\n *\n * @default undefined\n */\n declarative?: boolean | `${ContentScriptDeclarative}` | ContentScriptDeclarative;\n}\n\nexport type ContentScriptOptions = ContentScriptConfig & EntrypointOptions;\n\nexport type ContentScriptEntrypointOptions = Partial<ContentScriptOptions>;\n\n// Append\nexport enum ContentScriptAppend {\n Last = \"last\",\n First = \"first\",\n Replace = \"replace\",\n Before = \"before\",\n After = \"after\",\n}\n\n// Mount\nexport type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);\n\nexport interface ContentScriptMount {\n mount(): boolean | undefined | void;\n\n unmount(): boolean | undefined | void;\n}\n\n// Props\nexport interface ContentScriptProps extends ContentScriptEntrypointOptions {\n anchor: Element;\n}\n\n// Anchor\nexport type ContentScriptAnchor = string | Element | null | undefined;\nexport type ContentScriptAnchorGetter = () => Awaiter<ContentScriptAnchor>;\n\n// Marker\nexport enum ContentScriptMarker {\n /** In-memory marking (no DOM mutations). */\n Weak = \"weak\",\n /** DOM attribute-based marking. */\n Attribute = \"attribute\",\n}\n\nexport enum ContentScriptMarkerValue {\n Mounted = \"1\",\n Unmounted = \"0\",\n}\n\nexport interface ContentScriptMarkerContract {\n for(anchor: ContentScriptAnchor): ContentScriptMarkerContract;\n\n /**\n * Returns elements that are not tracked yet (no marker attribute present).\n * MUST NOT mutate marker state.\n */\n unmarked(): Element[];\n\n marked(): Element[];\n\n mark(element: Element, value: ContentScriptMarkerValue): boolean;\n\n unmark(element: Element): boolean;\n\n isMarked(element: Element): boolean;\n\n value(element: Element): ContentScriptMarkerValue | undefined;\n\n mount(element: Element): boolean;\n\n unmount(element: Element): boolean;\n\n reset(): ContentScriptMarkerContract;\n}\n\nexport type ContentScriptMarkerType =\n | ContentScriptMarker\n | `${ContentScriptMarker}`\n | ContentScriptMarkerContract\n | undefined;\n\nexport type ContentScriptMarkerGetter = (options: ContentScriptOptions) => Awaiter<ContentScriptMarkerType>;\nexport type ContentScriptMarkerResolver = (options: ContentScriptOptions) => Awaiter<ContentScriptMarkerContract>;\n\n// Render\nexport type ContentScriptRenderReactComponent = FC<ContentScriptProps>;\nexport type ContentScriptRenderValue = Element | ReactNode | ContentScriptRenderReactComponent;\nexport type ContentScriptRenderHandler = (props: ContentScriptProps) => Awaiter<undefined | ContentScriptRenderValue>;\n\n// Container\nexport type ContentScriptContainerTag = Exclude<keyof HTMLElementTagNameMap, \"html\" | \"body\">;\n\nexport type ContentScriptContainerOptions = {\n [Tag in ContentScriptContainerTag]: {\n tagName: Tag;\n } & Exclude<Optional<PickNonFunctionProperties<HTMLElementTagNameMap[Tag]>>, \"id\">;\n}[ContentScriptContainerTag];\n\nexport type ContentScriptContainerFactory = (\n props: ContentScriptProps\n) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;\nexport type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;\n\n// Watch\nexport type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;\n\n// Event\nexport enum ContentScriptEvent {\n Mount = \"mount\",\n Unmount = \"unmount\",\n Add = \"add\",\n Remove = \"remove\",\n}\n\nexport type ContentScriptEventCallback = (event: ContentScriptEvent, node: ContentScriptNode) => void;\n\nexport interface ContentScriptEventEmitter {\n on(callback: ContentScriptEventCallback): void;\n\n off(callback: ContentScriptEventCallback): void;\n\n emit(event: ContentScriptEvent, node: ContentScriptNode): void;\n\n emitMount(node: ContentScriptNode): void;\n\n emitUnmount(node: ContentScriptNode): void;\n\n emitAdd(node: ContentScriptNode): void;\n\n emitRemove(node: ContentScriptNode): void;\n\n removeAllListeners(): void;\n\n listenerCount(): number;\n\n hasListeners(): boolean;\n}\n\n// Context\nexport interface ContentScriptContext extends ContentScriptMount {\n nodes: ReadonlySet<ContentScriptNode>;\n\n /**\n * Registers a callback function that will be invoked when a specific content script context event occurs.\n *\n * @param {ContentScriptEventCallback} callback - The function to be executed when the event is triggered. Receives event-related data as its argument.\n * @return {Function} A function that can be called to unsubscribe the callback from the event.\n */\n watch(callback: ContentScriptEventCallback): () => void;\n\n /**\n * Stops watching for changes or events that were previously being observed.\n * Unsubscribes from all event listeners that were registered through the watch method.\n *\n * @return {void} No return value.\n */\n unwatch(): void;\n}\n\n// Main\nexport type ContentScriptMainFunction = (context: ContentScriptContext, options: ContentScriptOptions) => Awaiter<void>;\n\n// Node\nexport interface ContentScriptNode extends ContentScriptMount {\n anchor: Element;\n container?: Element;\n}\n\nexport type ContentScriptNodeSet = Set<ContentScriptNode>;\n\n// Definition\nexport interface ContentScriptDefinition extends ContentScriptEntrypointOptions {\n marker?: ContentScriptMarkerType | ContentScriptMarkerGetter;\n anchor?: ContentScriptAnchor | ContentScriptAnchorGetter;\n mount?: ContentScriptMountFunction;\n render?: ContentScriptRenderValue | ContentScriptRenderHandler;\n container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory;\n watch?: true | ContentScriptWatchStrategy;\n main?: ContentScriptMainFunction;\n}\n\n// prettier-ignore\nexport interface ContentScriptResolvedDefinition extends Omit<ContentScriptDefinition, \"anchor\" | \"marker\" | \"mount\" | \"container\" | \"render\" | \"watch\"> {\n marker: ContentScriptMarkerResolver;\n anchor: ContentScriptAnchorGetter;\n mount: ContentScriptMountFunction;\n render?: ContentScriptRenderHandler;\n container: ContentScriptContainerCreator;\n watch: ContentScriptWatchStrategy;\n}\n\nexport interface ContentScriptAppendDefinition extends Omit<ContentScriptDefinition, \"mount\"> {\n append?: ContentScriptAppend;\n}\n\n// Builder\nexport interface ContentScriptBuilder extends EntrypointBuilder {\n getContext(): ContentScriptContext;\n}\n"],"mappings":"AASO,MAAM,uBAAuB,CAAC,cAAc,aAAa;AAEzD,IAAK,2BAAL,kBAAKA,8BAAL;AACH,EAAAA,0BAAA,cAAW;AACX,EAAAA,0BAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;AAqEL,IAAK,sBAAL,kBAAKC,yBAAL;AACH,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,WAAQ;AALA,SAAAA;AAAA,GAAA;AA2BL,IAAK,sBAAL,kBAAKC,yBAAL;AAEH,EAAAA,qBAAA,UAAO;AAEP,EAAAA,qBAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA;AAOL,IAAK,2BAAL,kBAAKC,8BAAL;AACH,EAAAA,0BAAA,aAAU;AACV,EAAAA,0BAAA,eAAY;AAFJ,SAAAA;AAAA,GAAA;AA+DL,IAAK,qBAAL,kBAAKC,wBAAL;AACH,EAAAA,oBAAA,WAAQ;AACR,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,YAAS;AAJD,SAAAA;AAAA,GAAA;","names":["ContentScriptDeclarative","ContentScriptAppend","ContentScriptMarker","ContentScriptMarkerValue","ContentScriptEvent"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/content.ts"],"sourcesContent":["import type {PageAlias} from \"@typing/page\";\nimport type {FC, ReactNode} from \"react\";\nimport {Optional} from \"utility-types\";\n\nimport {EntrypointBuilder, EntrypointOptions} from \"@typing/entrypoint\";\nimport {Awaiter, PickNonFunctionProperties} from \"@typing/helpers\";\n\nexport const ContentScriptMatches = [\"http://*/*\", \"https://*/*\"];\n\n/** Shared property used by the bundler plugin and the content script's style runtime getter. */\nexport const ContentScriptStylesRuntimeProperty = \"__adnbnIsolatedStyles\";\n\nexport enum ContentScriptWorld {\n Isolated = \"ISOLATED\",\n Main = \"MAIN\",\n}\n\nexport enum ContentScriptDeclarative {\n Required = \"required\",\n Optional = \"optional\",\n}\n\nexport enum ContentScriptIsolation {\n None = \"none\",\n Shadow = \"shadow\",\n Iframe = \"iframe\",\n}\n\nexport enum ContentScriptShadowMode {\n Open = \"open\",\n Closed = \"closed\",\n}\n\n// Append\nexport enum ContentScriptAppend {\n Last = \"last\",\n First = \"first\",\n Replace = \"replace\",\n Before = \"before\",\n After = \"after\",\n}\n\n// Marker\nexport enum ContentScriptMarker {\n /** In-memory marking (no DOM mutations). */\n Weak = \"weak\",\n /** DOM attribute-based marking. */\n Attribute = \"attribute\",\n}\n\nexport enum ContentScriptMarkerValue {\n Mounted = \"1\",\n Unmounted = \"0\",\n}\n\n// Event\nexport enum ContentScriptEvent {\n Mount = \"mount\",\n Unmount = \"unmount\",\n Add = \"add\",\n Remove = \"remove\",\n}\n\ntype RunAt = chrome.extensionTypes.RunAt;\n\nexport interface ContentScriptStylesRuntime {\n /** Resolves initial stylesheet URLs once, before the first root is registered. */\n initialize(resolveUrl: (file: string) => string): void;\n /** Retry restored styles once on load error; future loads keep the default failure behavior. */\n add(root: ShadowRoot | HTMLElement, target: Element | null, retry?: boolean): void;\n delete(root: ShadowRoot | HTMLElement): void;\n load(url: string): Promise<void>;\n}\n\nexport type ContentScriptWorldValue = ContentScriptWorld | `${chrome.scripting.ExecutionWorld}`;\n\nexport interface ContentScriptConfig {\n matches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeMatches?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n includeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default []\n */\n excludeGlobs?: string[];\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n allFrames?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default \"documentIdle\"\n */\n runAt?: RunAt;\n /**\n * See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world\n *\n * Dynamic imports keep physical async chunks in ISOLATED. MAIN keeps the same Promise-based\n * execution semantics but includes dynamic dependencies in the initial entrypoint graph.\n * Manifest V2 builds always use ISOLATED. Requesting MAIN emits a build warning and applies\n * ISOLATED grouping and chunk loading rules before generating the manifest.\n */\n world?: ContentScriptWorldValue;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchAboutBlank?: boolean;\n /**\n * See https://developer.chrome.com/docs/extensions/mv3/content_scripts/\n * @default false\n */\n matchOriginAsFallback?: boolean;\n /**\n * Whether this content script requires explicit host permission declaration in the extension manifest.\n *\n * Accepted values:\n * - ContentScriptDeclarative.Required — adds the corresponding host patterns to manifest.host_permissions.\n * - ContentScriptDeclarative.Optional — adds the corresponding host patterns to manifest.optional_host_permissions.\n *\n * Backward compatibility:\n * - true ≡ ContentScriptDeclarative.Required\n * - false ≡ undefined (as if the value is not set)\n *\n * @see https://developer.chrome.com/docs/extensions/mv3/declare_permissions/\n *\n * @default undefined\n */\n declarative?: boolean | `${ContentScriptDeclarative}` | ContentScriptDeclarative;\n}\n\nexport type ContentScriptOptions = ContentScriptConfig & EntrypointOptions;\n\nexport interface ContentScriptShadowOptions {\n /**\n * Controls access through the host's shadowRoot property, not CSS isolation or UI visibility.\n * @default ContentScriptShadowMode.Open\n */\n mode?: ContentScriptShadowMode | `${ContentScriptShadowMode}`;\n}\n\nexport interface ContentScriptFrameOptions {\n width?: number | string;\n /** Defaults to 150px. Automatic height is not supported yet. */\n height?: number | string;\n}\n\nexport interface ContentScriptFrameRenderOptions extends ContentScriptFrameOptions {\n page?: never;\n src?: never;\n}\n\nexport interface ContentScriptFramePageOptions extends ContentScriptFrameOptions {\n page: PageAlias;\n src?: never;\n}\n\nexport interface ContentScriptFrameSourceOptions extends ContentScriptFrameOptions {\n src: string;\n page?: never;\n}\n\nexport type ContentScriptFrame =\n | ContentScriptFrameRenderOptions\n | ContentScriptFramePageOptions\n | ContentScriptFrameSourceOptions;\n\nexport interface ContentScriptIsolationNoneOptions {\n type: ContentScriptIsolation.None | \"none\";\n mode?: never;\n page?: never;\n src?: never;\n width?: never;\n height?: never;\n}\n\nexport interface ContentScriptIsolationShadowOptions extends ContentScriptShadowOptions {\n type: ContentScriptIsolation.Shadow | \"shadow\";\n page?: never;\n src?: never;\n width?: never;\n height?: never;\n}\n\nexport type ContentScriptIsolationFrameOptions = ContentScriptFrame & {\n type: ContentScriptIsolation.Iframe | \"iframe\";\n mode?: never;\n};\n\n/** Object form of isolation, also used after resolving shorthand values. */\nexport type ContentScriptIsolationOptions =\n | ContentScriptIsolationNoneOptions\n | ContentScriptIsolationShadowOptions\n | ContentScriptIsolationFrameOptions;\n\nexport type ContentScriptIsolationValue =\n | ContentScriptIsolation\n | `${ContentScriptIsolation}`\n | ContentScriptIsolationOptions;\n\n/** Statically resolved configuration; runtime render values are never retained here. */\nexport type ContentScriptEntrypointOptions = Partial<ContentScriptOptions> & {\n isolation?: ContentScriptIsolationOptions;\n};\n\n// Mount\nexport type ContentScriptMountFunction = (anchor: Element, container: Element) => void | (() => void);\n\nexport interface ContentScriptMount {\n mount(): boolean | undefined | void;\n\n unmount(): boolean | undefined | void;\n}\n\n// Props\nexport interface ContentScriptProps extends ContentScriptEntrypointOptions {\n anchor: Element;\n}\n\n// Anchor\nexport type ContentScriptAnchor = string | Element | null | undefined;\n\nexport type ContentScriptAnchorGetter = () => Awaiter<ContentScriptAnchor>;\n\nexport interface ContentScriptMarkerContract {\n for(anchor: ContentScriptAnchor): ContentScriptMarkerContract;\n\n /**\n * Returns elements that are not tracked yet (no marker attribute present).\n * MUST NOT mutate marker state.\n */\n unmarked(): Element[];\n\n marked(): Element[];\n\n mark(element: Element, value: ContentScriptMarkerValue): boolean;\n\n unmark(element: Element): boolean;\n\n isMarked(element: Element): boolean;\n\n value(element: Element): ContentScriptMarkerValue | undefined;\n\n mount(element: Element): boolean;\n\n unmount(element: Element): boolean;\n\n reset(): ContentScriptMarkerContract;\n}\n\nexport type ContentScriptMarkerType =\n | ContentScriptMarker\n | `${ContentScriptMarker}`\n | ContentScriptMarkerContract\n | undefined;\n\nexport type ContentScriptMarkerGetter = (options: ContentScriptOptions) => Awaiter<ContentScriptMarkerType>;\n\nexport type ContentScriptMarkerResolver = (options: ContentScriptOptions) => Awaiter<ContentScriptMarkerContract>;\n\n// Render\nexport type ContentScriptRenderReactComponent = FC<ContentScriptProps>;\n\nexport type ContentScriptRenderValue = Element | ReactNode | ContentScriptRenderReactComponent;\n\nexport type ContentScriptRenderHandler = (props: ContentScriptProps) => Awaiter<undefined | ContentScriptRenderValue>;\n\n// Container\nexport type ContentScriptContainerTag = Exclude<keyof HTMLElementTagNameMap, \"html\" | \"body\">;\n\nexport type ContentScriptContainerOptions = {\n [Tag in ContentScriptContainerTag]: {\n tagName: Tag;\n } & Exclude<Optional<PickNonFunctionProperties<HTMLElementTagNameMap[Tag]>>, \"id\">;\n}[ContentScriptContainerTag];\n\nexport type ContentScriptContainerFactory = (\n props: ContentScriptProps\n) => Awaiter<Element | ContentScriptContainerTag | ContentScriptContainerOptions>;\n\nexport type ContentScriptContainerCreator = (props: ContentScriptProps) => Awaiter<Element>;\n\n// Watch\nexport type ContentScriptWatchStrategy = (update: () => void, context: ContentScriptContext) => () => void;\n\nexport type ContentScriptEventCallback = (event: ContentScriptEvent, node: ContentScriptNode) => void;\n\nexport interface ContentScriptEventEmitter {\n on(callback: ContentScriptEventCallback): void;\n\n off(callback: ContentScriptEventCallback): void;\n\n emit(event: ContentScriptEvent, node: ContentScriptNode): void;\n\n emitMount(node: ContentScriptNode): void;\n\n emitUnmount(node: ContentScriptNode): void;\n\n emitAdd(node: ContentScriptNode): void;\n\n emitRemove(node: ContentScriptNode): void;\n\n removeAllListeners(): void;\n\n listenerCount(): number;\n\n hasListeners(): boolean;\n}\n\n// Context\nexport interface ContentScriptContext extends ContentScriptMount {\n nodes: ReadonlySet<ContentScriptNode>;\n\n /**\n * Registers a callback function that will be invoked when a specific content script context event occurs.\n *\n * @param {ContentScriptEventCallback} callback - The function to be executed when the event is triggered. Receives event-related data as its argument.\n * @return {Function} A function that can be called to unsubscribe the callback from the event.\n */\n watch(callback: ContentScriptEventCallback): () => void;\n\n /**\n * Stops watching for changes or events that were previously being observed.\n * Unsubscribes from all event listeners that were registered through the watch method.\n *\n * @return {void} No return value.\n */\n unwatch(): void;\n}\n\n// Main\nexport type ContentScriptMainFunction = (context: ContentScriptContext, options: ContentScriptOptions) => Awaiter<void>;\n\n// Node\nexport interface ContentScriptNode extends ContentScriptMount {\n anchor: Element;\n container?: Element;\n\n /** Element used by the active adapter as the destination for rendered UI. */\n target?: Element;\n}\n\nexport type ContentScriptNodeSet = Set<ContentScriptNode>;\n\n// Definition\nexport interface ContentScriptDefinitionBase extends Partial<ContentScriptOptions> {\n marker?: ContentScriptMarkerType | ContentScriptMarkerGetter;\n anchor?: ContentScriptAnchor | ContentScriptAnchorGetter;\n mount?: ContentScriptMountFunction;\n container?: ContentScriptContainerTag | ContentScriptContainerOptions | ContentScriptContainerFactory;\n watch?: true | ContentScriptWatchStrategy;\n main?: ContentScriptMainFunction;\n}\n\nexport type ContentScriptDefinition = ContentScriptDefinitionBase &\n (\n | {\n isolation?:\n | ContentScriptIsolation\n | `${ContentScriptIsolation}`\n | ContentScriptIsolationNoneOptions\n | ContentScriptIsolationShadowOptions\n | (ContentScriptIsolationFrameOptions & ContentScriptFrameRenderOptions);\n render?: ContentScriptRenderValue | ContentScriptRenderHandler;\n }\n | {\n isolation: ContentScriptIsolationFrameOptions &\n (ContentScriptFramePageOptions | ContentScriptFrameSourceOptions);\n render?: never;\n }\n );\n\nexport interface ContentScriptResolvedDefinition extends Omit<\n ContentScriptDefinitionBase,\n \"anchor\" | \"marker\" | \"mount\" | \"container\" | \"watch\"\n> {\n isolation: ContentScriptIsolationOptions;\n marker: ContentScriptMarkerResolver;\n anchor: ContentScriptAnchorGetter;\n mount: ContentScriptMountFunction;\n render?: ContentScriptRenderHandler;\n container: ContentScriptContainerCreator;\n watch: ContentScriptWatchStrategy;\n}\n\ntype ContentScriptAppendVariant<T> = T extends unknown ? Omit<T, \"mount\"> & {append?: ContentScriptAppend} : never;\n\nexport type ContentScriptAppendDefinition = ContentScriptAppendVariant<ContentScriptDefinition>;\n\n// Builder\nexport interface ContentScriptBuilder extends EntrypointBuilder {\n getContext(): ContentScriptContext;\n}\n"],"mappings":"AAOO,MAAM,uBAAuB,CAAC,cAAc,aAAa;AAGzD,MAAM,qCAAqC;AAE3C,IAAK,qBAAL,kBAAKA,wBAAL;AACH,EAAAA,oBAAA,cAAW;AACX,EAAAA,oBAAA,UAAO;AAFC,SAAAA;AAAA,GAAA;AAKL,IAAK,2BAAL,kBAAKC,8BAAL;AACH,EAAAA,0BAAA,cAAW;AACX,EAAAA,0BAAA,cAAW;AAFH,SAAAA;AAAA,GAAA;AAKL,IAAK,yBAAL,kBAAKC,4BAAL;AACH,EAAAA,wBAAA,UAAO;AACP,EAAAA,wBAAA,YAAS;AACT,EAAAA,wBAAA,YAAS;AAHD,SAAAA;AAAA,GAAA;AAML,IAAK,0BAAL,kBAAKC,6BAAL;AACH,EAAAA,yBAAA,UAAO;AACP,EAAAA,yBAAA,YAAS;AAFD,SAAAA;AAAA,GAAA;AAML,IAAK,sBAAL,kBAAKC,yBAAL;AACH,EAAAA,qBAAA,UAAO;AACP,EAAAA,qBAAA,WAAQ;AACR,EAAAA,qBAAA,aAAU;AACV,EAAAA,qBAAA,YAAS;AACT,EAAAA,qBAAA,WAAQ;AALA,SAAAA;AAAA,GAAA;AASL,IAAK,sBAAL,kBAAKC,yBAAL;AAEH,EAAAA,qBAAA,UAAO;AAEP,EAAAA,qBAAA,eAAY;AAJJ,SAAAA;AAAA,GAAA;AAOL,IAAK,2BAAL,kBAAKC,8BAAL;AACH,EAAAA,0BAAA,aAAU;AACV,EAAAA,0BAAA,eAAY;AAFJ,SAAAA;AAAA,GAAA;AAML,IAAK,qBAAL,kBAAKC,wBAAL;AACH,EAAAA,oBAAA,WAAQ;AACR,EAAAA,oBAAA,aAAU;AACV,EAAAA,oBAAA,SAAM;AACN,EAAAA,oBAAA,YAAS;AAJD,SAAAA;AAAA,GAAA;","names":["ContentScriptWorld","ContentScriptDeclarative","ContentScriptIsolation","ContentScriptShadowMode","ContentScriptAppend","ContentScriptMarker","ContentScriptMarkerValue","ContentScriptEvent"]}
|
|
@@ -2,6 +2,8 @@ import { Mode } from "./app.js";
|
|
|
2
2
|
import { Browser } from "./browser.js";
|
|
3
3
|
import { ManifestVersion } from "./manifest.js";
|
|
4
4
|
export declare const EntrypointFileExtensions: ReadonlySet<string>;
|
|
5
|
+
export declare const EntrypointAssetsRuntimeProperty = "__adnbnCurrentEntrypointAssets";
|
|
6
|
+
export declare const EntrypointAssetsMapRuntimeProperty = "__adnbnBuildAssets";
|
|
5
7
|
export declare enum EntrypointType {
|
|
6
8
|
Background = "background",
|
|
7
9
|
Command = "command",
|
|
@@ -76,6 +78,18 @@ export interface EntrypointFile {
|
|
|
76
78
|
* These files will be compiled and bundled together as part of the specified entrypoint.
|
|
77
79
|
*/
|
|
78
80
|
export type EntrypointEntries = Map<string, Set<EntrypointFile>>;
|
|
81
|
+
export interface EntrypointAssetsFiles {
|
|
82
|
+
readonly js: readonly string[];
|
|
83
|
+
readonly css: readonly string[];
|
|
84
|
+
}
|
|
85
|
+
export interface EntrypointAssets {
|
|
86
|
+
readonly initial: EntrypointAssetsFiles;
|
|
87
|
+
readonly async: EntrypointAssetsFiles;
|
|
88
|
+
}
|
|
89
|
+
export interface EntrypointAssetsMapEntry extends EntrypointAssets {
|
|
90
|
+
readonly assets: readonly string[];
|
|
91
|
+
}
|
|
92
|
+
export type EntrypointAssetsMap = Readonly<Record<string, EntrypointAssetsMapEntry>>;
|
|
79
93
|
export interface EntrypointParser<O extends EntrypointOptions> {
|
|
80
94
|
options(file: EntrypointFile): O;
|
|
81
95
|
contract(file: EntrypointFile): string | undefined;
|
|
@@ -85,6 +99,12 @@ export interface EntrypointFinder {
|
|
|
85
99
|
empty(): Promise<boolean>;
|
|
86
100
|
exists(): Promise<boolean>;
|
|
87
101
|
clear(): this;
|
|
102
|
+
/**
|
|
103
|
+
* Determines if the specified file exists within the current set of files.
|
|
104
|
+
*
|
|
105
|
+
* @param {EntrypointFile} file - The file to be checked for existence in the set of files.
|
|
106
|
+
* @return {boolean} Returns true if the file exists in the set, otherwise false.
|
|
107
|
+
*/
|
|
88
108
|
holds(file: EntrypointFile): boolean;
|
|
89
109
|
}
|
|
90
110
|
export interface EntrypointOptionsFinder<O extends EntrypointOptions> extends EntrypointFinder {
|
package/dist/types/entrypoint.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
const EntrypointFileExtensions = /* @__PURE__ */ new Set(["ts", "tsx", "js", "jsx", "vue", "svelte"]);
|
|
2
|
+
const EntrypointAssetsRuntimeProperty = "__adnbnCurrentEntrypointAssets";
|
|
3
|
+
const EntrypointAssetsMapRuntimeProperty = "__adnbnBuildAssets";
|
|
2
4
|
var EntrypointType = /* @__PURE__ */ ((EntrypointType2) => {
|
|
3
5
|
EntrypointType2["Background"] = "background";
|
|
4
6
|
EntrypointType2["Command"] = "command";
|
|
@@ -14,6 +16,8 @@ var EntrypointType = /* @__PURE__ */ ((EntrypointType2) => {
|
|
|
14
16
|
return EntrypointType2;
|
|
15
17
|
})(EntrypointType || {});
|
|
16
18
|
export {
|
|
19
|
+
EntrypointAssetsMapRuntimeProperty,
|
|
20
|
+
EntrypointAssetsRuntimeProperty,
|
|
17
21
|
EntrypointFileExtensions,
|
|
18
22
|
EntrypointType
|
|
19
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/entrypoint.ts"],"sourcesContent":["import {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const EntrypointFileExtensions: ReadonlySet<string> = new Set([\"ts\", \"tsx\", \"js\", \"jsx\", \"vue\", \"svelte\"]);\n\nexport enum EntrypointType {\n Background = \"background\",\n Command = \"command\",\n ContentScript = \"content\",\n Page = \"page\",\n Service = \"service\",\n Relay = \"relay\",\n Options = \"options\",\n Popup = \"popup\",\n Sidebar = \"sidebar\",\n Offscreen = \"offscreen\",\n Sandbox = \"sandbox\",\n}\n\nexport interface EntrypointOptions {\n /**\n * List of target browsers to include this entrypoint in. Defaults to being included in all\n * builds.\n *\n * @default undefined\n */\n includeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target browsers to exclude this entrypoint from.\n *\n * @default undefined\n */\n excludeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target apps to include this entrypoint in. Defaults to being included in all builds.\n *\n * @default undefined\n */\n excludeApp?: string[];\n\n /**\n * List of target apps to exclude this entrypoint from.\n *\n * @default undefined\n */\n includeApp?: string[];\n\n /**\n * Build mode for filtering entry points. Entry point will be included only\n * if it matches the current build mode (Production or Development).\n *\n * @default undefined\n */\n mode?: `${Exclude<Mode, Mode.None>}` | Exclude<Mode, Mode.None>;\n\n /**\n * Manifest version constraint for this entry point. Entry point will be included\n * only if it matches the target manifest version.\n *\n * @default undefined\n */\n manifestVersion?: ManifestVersion;\n\n /**\n * Debug mode flag. If true, entry point will be included only when building\n * with DEBUG flag enabled.\n *\n * @default undefined\n */\n debug?: boolean;\n}\n\nexport interface EntrypointFile {\n file: string;\n import: string;\n external?: string;\n}\n\n/**\n * Dictionary of entrypoint for the build configuration.\n *\n * @key {string} - The name of the entrypoint that will be used in the bundler configuration.\n * @value {EntrypointFile[]} - Array of files that will be included in this entrypoint.\n * These files will be compiled and bundled together as part of the specified entrypoint.\n */\nexport type EntrypointEntries = Map<string, Set<EntrypointFile>>;\n\nexport interface EntrypointParser<O extends EntrypointOptions> {\n options(file: EntrypointFile): O;\n\n contract(file: EntrypointFile): string | undefined;\n}\n\nexport interface EntrypointFinder {\n files(): Promise<Set<EntrypointFile>>;\n\n empty(): Promise<boolean>;\n\n exists(): Promise<boolean>;\n\n clear(): this;\n\n holds(file: EntrypointFile): boolean;\n}\n\nexport interface EntrypointOptionsFinder<O extends EntrypointOptions> extends EntrypointFinder {\n type(): EntrypointType;\n\n options(): Promise<Map<EntrypointFile, O>>;\n\n contracts(): Promise<Map<EntrypointFile, string | undefined>>;\n}\n\nexport interface EntrypointNameGenerator {\n reserve(name: string): this;\n\n name(name: string): string;\n\n file(file: EntrypointFile): string;\n\n likely(name?: string): boolean;\n\n has(name: string): boolean;\n\n reset(): this;\n}\n\nexport interface EntrypointBuilder {\n build(): Promise<void>;\n\n destroy(): Promise<void>;\n}\n\nexport type EntrypointConstructorParameter<T> = T extends new (arg: infer P) => any ? P : never;\n"],"mappings":"AAIO,MAAM,2BAAgD,oBAAI,IAAI,CAAC,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AAEzG,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,mBAAgB;AAChB,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;AAXF,SAAAA;AAAA,GAAA;","names":["EntrypointType"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/entrypoint.ts"],"sourcesContent":["import {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ManifestVersion} from \"@typing/manifest\";\n\nexport const EntrypointFileExtensions: ReadonlySet<string> = new Set([\"ts\", \"tsx\", \"js\", \"jsx\", \"vue\", \"svelte\"]);\n\nexport const EntrypointAssetsRuntimeProperty = \"__adnbnCurrentEntrypointAssets\";\nexport const EntrypointAssetsMapRuntimeProperty = \"__adnbnBuildAssets\";\n\nexport enum EntrypointType {\n Background = \"background\",\n Command = \"command\",\n ContentScript = \"content\",\n Page = \"page\",\n Service = \"service\",\n Relay = \"relay\",\n Options = \"options\",\n Popup = \"popup\",\n Sidebar = \"sidebar\",\n Offscreen = \"offscreen\",\n Sandbox = \"sandbox\",\n}\n\nexport interface EntrypointOptions {\n /**\n * List of target browsers to include this entrypoint in. Defaults to being included in all\n * builds.\n *\n * @default undefined\n */\n includeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target browsers to exclude this entrypoint from.\n *\n * @default undefined\n */\n excludeBrowser?: `${Browser}`[] | Browser[];\n\n /**\n * List of target apps to include this entrypoint in. Defaults to being included in all builds.\n *\n * @default undefined\n */\n excludeApp?: string[];\n\n /**\n * List of target apps to exclude this entrypoint from.\n *\n * @default undefined\n */\n includeApp?: string[];\n\n /**\n * Build mode for filtering entry points. Entry point will be included only\n * if it matches the current build mode (Production or Development).\n *\n * @default undefined\n */\n mode?: `${Exclude<Mode, Mode.None>}` | Exclude<Mode, Mode.None>;\n\n /**\n * Manifest version constraint for this entry point. Entry point will be included\n * only if it matches the target manifest version.\n *\n * @default undefined\n */\n manifestVersion?: ManifestVersion;\n\n /**\n * Debug mode flag. If true, entry point will be included only when building\n * with DEBUG flag enabled.\n *\n * @default undefined\n */\n debug?: boolean;\n}\n\nexport interface EntrypointFile {\n file: string;\n import: string;\n external?: string;\n}\n\n/**\n * Dictionary of entrypoint for the build configuration.\n *\n * @key {string} - The name of the entrypoint that will be used in the bundler configuration.\n * @value {EntrypointFile[]} - Array of files that will be included in this entrypoint.\n * These files will be compiled and bundled together as part of the specified entrypoint.\n */\nexport type EntrypointEntries = Map<string, Set<EntrypointFile>>;\n\nexport interface EntrypointAssetsFiles {\n readonly js: readonly string[];\n readonly css: readonly string[];\n}\n\nexport interface EntrypointAssets {\n readonly initial: EntrypointAssetsFiles;\n readonly async: EntrypointAssetsFiles;\n}\n\nexport interface EntrypointAssetsMapEntry extends EntrypointAssets {\n readonly assets: readonly string[];\n}\n\nexport type EntrypointAssetsMap = Readonly<Record<string, EntrypointAssetsMapEntry>>;\n\nexport interface EntrypointParser<O extends EntrypointOptions> {\n options(file: EntrypointFile): O;\n\n contract(file: EntrypointFile): string | undefined;\n}\n\nexport interface EntrypointFinder {\n files(): Promise<Set<EntrypointFile>>;\n\n empty(): Promise<boolean>;\n\n exists(): Promise<boolean>;\n\n clear(): this;\n\n /**\n * Determines if the specified file exists within the current set of files.\n *\n * @param {EntrypointFile} file - The file to be checked for existence in the set of files.\n * @return {boolean} Returns true if the file exists in the set, otherwise false.\n */\n holds(file: EntrypointFile): boolean;\n}\n\nexport interface EntrypointOptionsFinder<O extends EntrypointOptions> extends EntrypointFinder {\n type(): EntrypointType;\n\n options(): Promise<Map<EntrypointFile, O>>;\n\n contracts(): Promise<Map<EntrypointFile, string | undefined>>;\n}\n\nexport interface EntrypointNameGenerator {\n reserve(name: string): this;\n\n name(name: string): string;\n\n file(file: EntrypointFile): string;\n\n likely(name?: string): boolean;\n\n has(name: string): boolean;\n\n reset(): this;\n}\n\nexport interface EntrypointBuilder {\n build(): Promise<void>;\n\n destroy(): Promise<void>;\n}\n\nexport type EntrypointConstructorParameter<T> = T extends new (arg: infer P) => any ? P : never;\n"],"mappings":"AAIO,MAAM,2BAAgD,oBAAI,IAAI,CAAC,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ,CAAC;AAEzG,MAAM,kCAAkC;AACxC,MAAM,qCAAqC;AAE3C,IAAK,iBAAL,kBAAKA,oBAAL;AACH,EAAAA,gBAAA,gBAAa;AACb,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,mBAAgB;AAChB,EAAAA,gBAAA,UAAO;AACP,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,WAAQ;AACR,EAAAA,gBAAA,aAAU;AACV,EAAAA,gBAAA,eAAY;AACZ,EAAAA,gBAAA,aAAU;AAXF,SAAAA;AAAA,GAAA;","names":["EntrypointType"]}
|
package/dist/types/icon.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export declare const DefaultIconGroupName = "default";
|
|
2
2
|
export declare const IconFileExtensions: ReadonlySet<string>;
|
|
3
3
|
export declare const IconSizes: ReadonlySet<number>;
|
|
4
|
+
/**
|
|
5
|
+
* Empty because icon group names depend on the consuming application's icon files.
|
|
6
|
+
* Generated `.adnbn/icon.d.ts` declarations augment `adnbn`, adding discovered names as keys with value `true`.
|
|
7
|
+
*/
|
|
8
|
+
export interface IconNameRegistry {
|
|
9
|
+
}
|
|
10
|
+
export type IconName = keyof IconNameRegistry extends never ? string : Extract<keyof IconNameRegistry, string>;
|
|
11
|
+
export type IconsMap = Map<IconName, Record<number, string>>;
|
package/dist/types/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/icon.ts"],"sourcesContent":["export const DefaultIconGroupName = \"default\";\n\nexport const IconFileExtensions: ReadonlySet<string> = new Set([\"png\"]);\n\nexport const IconSizes: ReadonlySet<number> = new Set([16, 32, 48, 64, 128, 256, 512]);\n"],"mappings":"AAAO,MAAM,uBAAuB;AAE7B,MAAM,qBAA0C,oBAAI,IAAI,CAAC,KAAK,CAAC;AAE/D,MAAM,YAAiC,oBAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,GAAG,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/icon.ts"],"sourcesContent":["export const DefaultIconGroupName = \"default\";\n\nexport const IconFileExtensions: ReadonlySet<string> = new Set([\"png\"]);\n\nexport const IconSizes: ReadonlySet<number> = new Set([16, 32, 48, 64, 128, 256, 512]);\n\n/**\n * Empty because icon group names depend on the consuming application's icon files.\n * Generated `.adnbn/icon.d.ts` declarations augment `adnbn`, adding discovered names as keys with value `true`.\n */\nexport interface IconNameRegistry {}\n\nexport type IconName = keyof IconNameRegistry extends never ? string : Extract<keyof IconNameRegistry, string>;\n\nexport type IconsMap = Map<IconName, Record<number, string>>;\n"],"mappings":"AAAO,MAAM,uBAAuB;AAE7B,MAAM,qBAA0C,oBAAI,IAAI,CAAC,KAAK,CAAC;AAE/D,MAAM,YAAiC,oBAAI,IAAI,CAAC,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,GAAG,CAAC;","names":[]}
|