adnbn 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.d.ts +4 -1
- package/dist/cli/builders/manifest/ManifestBase.js +35 -6
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.js +1 -1
- package/dist/cli/builders/manifest/ManifestV3.js +12 -5
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
- package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
- package/dist/cli/builders/manifest/utils/index.js +19 -0
- package/dist/cli/builders/manifest/utils/index.js.map +1 -0
- package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
- package/dist/cli/builders/manifest/utils/permissions.js +34 -0
- package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +523 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.d.ts +13 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js +16 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +8 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +12 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +28 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
- package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
- package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
- package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
- package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
- package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
- package/dist/cli/bundler/plugins/index.d.ts +11 -5
- package/dist/cli/bundler/plugins/index.js +32 -10
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +55 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/manifest/index.js +6 -0
- package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/replace/index.js +5 -0
- package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
- package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
- package/dist/cli/bundler/plugins/types.d.ts +4 -0
- package/dist/cli/bundler/plugins/types.js +1 -0
- package/dist/cli/bundler/plugins/types.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/index.js +9 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/watch/index.js +5 -0
- package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
- package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
- package/dist/cli/bundler/utils/chunk-filename.js +93 -0
- package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -0
- package/dist/cli/bundler/utils/index.js +2 -0
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/bundler/utils/layers.d.ts +4 -0
- package/dist/cli/bundler/utils/layers.js +10 -0
- package/dist/cli/bundler/utils/layers.js.map +1 -0
- package/dist/cli/bundler/utils/output.d.ts +6 -2
- package/dist/cli/bundler/utils/output.js +165 -7
- package/dist/cli/bundler/utils/output.js.map +1 -1
- package/dist/cli/bundler/utils/styles.d.ts +5 -0
- package/dist/cli/bundler/utils/styles.js +30 -0
- package/dist/cli/bundler/utils/styles.js.map +1 -0
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.js → AbstractParsedFinder.js} +3 -3
- package/dist/cli/entrypoint/finder/AbstractParsedFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.d.ts +13 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js +33 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/PluginFinder.d.ts +4 -4
- package/dist/cli/entrypoint/finder/PluginFinder.js +2 -2
- package/dist/cli/entrypoint/finder/PluginFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/index.d.ts +2 -1
- package/dist/cli/entrypoint/finder/index.js +20 -18
- package/dist/cli/entrypoint/finder/index.js.map +1 -1
- package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
- package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
- package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +5 -1
- package/dist/cli/entrypoint/parser/ContentParser.js +55 -3
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/OptionsParser.d.ts +6 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js +16 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js.map +1 -0
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +4 -0
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/index.d.ts +1 -0
- package/dist/cli/entrypoint/parser/index.js +16 -14
- package/dist/cli/entrypoint/parser/index.js.map +1 -1
- package/dist/cli/plugins/asset.js +9 -4
- package/dist/cli/plugins/asset.js.map +1 -1
- package/dist/cli/plugins/background/index.js +1 -1
- package/dist/cli/plugins/background/index.js.map +1 -1
- package/dist/cli/plugins/content/Content.d.ts +1 -1
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
- package/dist/cli/plugins/content/ContentManager.js +79 -28
- package/dist/cli/plugins/content/ContentManager.js.map +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +1 -1
- package/dist/cli/plugins/content/ContentName.js +8 -7
- package/dist/cli/plugins/content/ContentName.js.map +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +1 -1
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +7 -0
- package/dist/cli/plugins/content/bundler.js +47 -0
- package/dist/cli/plugins/content/bundler.js.map +1 -0
- package/dist/cli/plugins/content/index.js +121 -62
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/relay-module.d.ts +3 -0
- package/dist/cli/plugins/content/relay-module.js +11 -0
- package/dist/cli/plugins/content/relay-module.js.map +1 -0
- package/dist/cli/plugins/content/types.d.ts +1 -1
- package/dist/cli/plugins/content/utils.d.ts +2 -0
- package/dist/cli/plugins/content/utils.js +8 -1
- package/dist/cli/plugins/content/utils.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
- package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
- package/dist/cli/plugins/icon/icon-module.js +11 -0
- package/dist/cli/plugins/icon/icon-module.js.map +1 -0
- package/dist/cli/plugins/icon/index.js +5 -3
- package/dist/cli/plugins/icon/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +1 -0
- package/dist/cli/plugins/index.js +22 -20
- package/dist/cli/plugins/index.js.map +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/options/Options.d.ts +10 -0
- package/dist/cli/plugins/options/Options.js +24 -0
- package/dist/cli/plugins/options/Options.js.map +1 -0
- package/dist/cli/plugins/options/index.d.ts +2 -0
- package/dist/cli/plugins/options/index.js +41 -0
- package/dist/cli/plugins/options/index.js.map +1 -0
- package/dist/cli/plugins/output.js +33 -3
- package/dist/cli/plugins/output.js.map +1 -1
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/plugins/view/index.js +1 -1
- package/dist/cli/plugins/view/index.js.map +1 -1
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +4 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +8 -10
- package/dist/entry/content/adapters/react/Builder.js +1 -1
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +2 -0
- package/dist/entry/content/adapters/react/Node.js +10 -2
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/Node.js +10 -7
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/core/Builder.d.ts +1 -2
- package/dist/entry/content/core/Builder.js +9 -5
- package/dist/entry/content/core/Builder.js.map +1 -1
- package/dist/entry/content/core/MountBuilder.js +14 -6
- package/dist/entry/content/core/MountBuilder.js.map +1 -1
- package/dist/entry/content/core/{Context.d.ts → context/Context.d.ts} +2 -1
- package/dist/entry/content/core/{Context.js → context/Context.js} +7 -0
- package/dist/entry/content/core/context/Context.js.map +1 -0
- package/dist/entry/content/core/{EventEmitter.d.ts → context/EventEmitter.d.ts} +1 -1
- package/dist/entry/content/core/{EventEmitter.js → context/EventEmitter.js} +1 -1
- package/dist/entry/content/core/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/core/{ManagedContext.d.ts → context/ManagedContext.d.ts} +1 -1
- package/dist/entry/content/core/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/core/context/index.d.ts +3 -0
- package/dist/entry/content/core/context/index.js +9 -0
- package/dist/entry/content/core/context/index.js.map +1 -0
- package/dist/entry/content/core/{AbstractMarker.d.ts → markers/AbstractMarker.d.ts} +1 -1
- package/dist/entry/content/core/{AbstractMarker.js → markers/AbstractMarker.js} +1 -1
- package/dist/entry/content/core/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/core/{AttributeMarker.d.ts → markers/AttributeMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/core/{WeakMarker.d.ts → markers/WeakMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/core/markers/index.d.ts +3 -0
- package/dist/entry/content/core/markers/index.js +9 -0
- package/dist/entry/content/core/markers/index.js.map +1 -0
- package/dist/entry/content/core/{EventNode.d.ts → nodes/EventNode.d.ts} +2 -1
- package/dist/entry/content/core/{EventNode.js → nodes/EventNode.js} +3 -0
- package/dist/entry/content/core/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/core/nodes/FrameNode.d.ts +23 -0
- package/dist/entry/content/core/nodes/FrameNode.js +125 -0
- package/dist/entry/content/core/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/core/{MarkerNode.d.ts → nodes/MarkerNode.d.ts} +2 -1
- package/dist/entry/content/core/{MarkerNode.js → nodes/MarkerNode.js} +3 -0
- package/dist/entry/content/core/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/core/{MountNode.d.ts → nodes/MountNode.d.ts} +2 -1
- package/dist/entry/content/core/{MountNode.js → nodes/MountNode.js} +3 -0
- package/dist/entry/content/core/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/core/{Node.d.ts → nodes/Node.d.ts} +2 -1
- package/dist/entry/content/core/{Node.js → nodes/Node.js} +3 -0
- package/dist/entry/content/core/nodes/Node.js.map +1 -0
- package/dist/entry/content/core/nodes/ShadowNode.d.ts +14 -0
- package/dist/entry/content/core/nodes/ShadowNode.js +67 -0
- package/dist/entry/content/core/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/core/nodes/index.d.ts +6 -0
- package/dist/entry/content/core/nodes/index.js +15 -0
- package/dist/entry/content/core/nodes/index.js.map +1 -0
- package/dist/entry/content/core/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/core/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/core/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/core/resolvers/watch.js +1 -1
- package/dist/entry/content/core/resolvers/watch.js.map +1 -1
- package/dist/entry/content/frame/Builder.d.ts +7 -0
- package/dist/entry/content/frame/Builder.js +14 -0
- package/dist/entry/content/frame/Builder.js.map +1 -0
- package/dist/entry/content/frame/index.d.ts +4 -0
- package/dist/entry/content/frame/index.js +7 -0
- package/dist/entry/content/frame/index.js.map +1 -0
- package/dist/entry/relay/Builder.js +5 -1
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +1 -1
- package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
- package/dist/locale/adapters/react/ReactLocale.js +41 -0
- package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
- package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
- package/dist/locale/adapters/react/index.d.ts +4 -2
- package/dist/locale/adapters/react/index.js +6 -4
- package/dist/locale/adapters/react/index.js.map +1 -1
- package/dist/locale/adapters/react/types.d.ts +22 -0
- package/dist/locale/adapters/react/types.js +1 -0
- package/dist/locale/adapters/react/types.js.map +1 -0
- package/dist/locale/helpers.d.ts +4 -5
- package/dist/locale/helpers.js +1 -1
- package/dist/locale/helpers.js.map +1 -1
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +1 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/providers/AbstractLocale.d.ts +4 -4
- package/dist/locale/providers/AbstractLocale.js +13 -94
- package/dist/locale/providers/AbstractLocale.js.map +1 -1
- package/dist/locale/providers/CustomLocale.d.ts +3 -3
- package/dist/locale/providers/CustomLocale.js +6 -5
- package/dist/locale/providers/CustomLocale.js.map +1 -1
- package/dist/locale/providers/DynamicLocale.d.ts +18 -11
- package/dist/locale/providers/DynamicLocale.js +60 -47
- package/dist/locale/providers/DynamicLocale.js.map +1 -1
- package/dist/locale/providers/NativeLocale.d.ts +4 -7
- package/dist/locale/providers/NativeLocale.js +5 -14
- package/dist/locale/providers/NativeLocale.js.map +1 -1
- package/dist/locale/providers/ObservableLocale.d.ts +35 -0
- package/dist/locale/providers/ObservableLocale.js +179 -0
- package/dist/locale/providers/ObservableLocale.js.map +1 -0
- package/dist/locale/providers/index.d.ts +2 -1
- package/dist/locale/providers/index.js +3 -1
- package/dist/locale/providers/index.js.map +1 -1
- package/dist/locale/storage/LocaleStorage.d.ts +11 -0
- package/dist/locale/storage/LocaleStorage.js +40 -0
- package/dist/locale/storage/LocaleStorage.js.map +1 -0
- package/dist/locale/storage/index.d.ts +1 -0
- package/dist/locale/storage/index.js +5 -0
- package/dist/locale/storage/index.js.map +1 -0
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/options.d.ts +3 -0
- package/dist/main/options.js +7 -0
- package/dist/main/options.js.map +1 -0
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +1 -2
- package/dist/main/relay.js +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +1 -4
- package/dist/main/sandbox.js +2 -1
- package/dist/main/sandbox.js.map +1 -1
- package/dist/main/service.d.ts +1 -2
- package/dist/main/service.js.map +1 -1
- package/dist/main/sidebar.d.ts +2 -5
- package/dist/main/sidebar.js +3 -3
- package/dist/main/sidebar.js.map +1 -1
- package/dist/message/index.d.ts +2 -4
- package/dist/message/index.js.map +1 -1
- package/dist/offscreen/index.d.ts +2 -6
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/index.d.ts +2 -5
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/service/index.d.ts +2 -6
- package/dist/service/index.js.map +1 -1
- package/dist/shared/content/index.d.ts +1 -0
- package/dist/shared/content/index.js +6 -0
- package/dist/shared/content/index.js.map +1 -0
- package/dist/shared/content/isolation.d.ts +4 -0
- package/dist/shared/content/isolation.js +70 -0
- package/dist/shared/content/isolation.js.map +1 -0
- package/dist/shared/locale/index.d.ts +5 -0
- package/dist/shared/locale/index.js +21 -0
- package/dist/shared/locale/index.js.map +1 -0
- package/dist/shared/locale/keys.d.ts +5 -0
- package/dist/shared/locale/keys.js +33 -0
- package/dist/shared/locale/keys.js.map +1 -0
- package/dist/shared/locale/language.d.ts +4 -0
- package/dist/shared/locale/language.js +23 -0
- package/dist/shared/locale/language.js.map +1 -0
- package/dist/shared/locale/messages.d.ts +3 -0
- package/dist/shared/locale/messages.js +9 -0
- package/dist/shared/locale/messages.js.map +1 -0
- package/dist/shared/locale/plural.d.ts +2 -0
- package/dist/shared/locale/plural.js +81 -0
- package/dist/shared/locale/plural.js.map +1 -0
- package/dist/shared/locale/substitutions.d.ts +10 -0
- package/dist/shared/locale/substitutions.js +32 -0
- package/dist/shared/locale/substitutions.js.map +1 -0
- package/dist/types/background.d.ts +1 -1
- package/dist/types/background.js.map +1 -1
- package/dist/types/command.d.ts +1 -1
- package/dist/types/command.js.map +1 -1
- package/dist/types/content.d.ts +120 -31
- package/dist/types/content.js +22 -1
- package/dist/types/content.js.map +1 -1
- package/dist/types/entrypoint.d.ts +20 -0
- package/dist/types/entrypoint.js +4 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js.map +1 -1
- package/dist/types/language.d.ts +57 -0
- package/dist/types/language.js +62 -0
- package/dist/types/language.js.map +1 -0
- package/dist/types/locale.d.ts +34 -63
- package/dist/types/locale.js +62 -119
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +24 -7
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/options.d.ts +9 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/page.d.ts +8 -0
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +16 -7
- package/dist/types/relay.js.map +1 -1
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/sandbox.js.map +1 -1
- package/dist/types/service.d.ts +10 -1
- package/dist/types/service.js.map +1 -1
- package/dist/types/sidebar.d.ts +9 -0
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/virtual/entrypoint.d.ts +5 -0
- package/dist/virtual/entrypoint.js +7 -0
- package/dist/virtual/entrypoint.js.map +1 -0
- package/dist/virtual/icon.d.ts +2 -0
- package/dist/virtual/icon.js +5 -0
- package/dist/virtual/icon.js.map +1 -0
- package/dist/virtual/locale.d.ts +7 -0
- package/dist/virtual/locale.js +13 -0
- package/dist/virtual/locale.js.map +1 -0
- package/dist/virtual/modules.d.ts +40 -0
- package/dist/virtual/offscreen.d.ts +3 -0
- package/dist/virtual/offscreen.js +5 -0
- package/dist/virtual/offscreen.js.map +1 -0
- package/dist/virtual/page.d.ts +2 -0
- package/dist/virtual/page.js +5 -0
- package/dist/virtual/page.js.map +1 -0
- package/dist/virtual/popup.d.ts +3 -0
- package/dist/virtual/popup.js +5 -0
- package/dist/virtual/popup.js.map +1 -0
- package/dist/virtual/relay.d.ts +3 -0
- package/dist/virtual/relay.js +5 -0
- package/dist/virtual/relay.js.map +1 -0
- package/dist/virtual/sandbox.d.ts +3 -0
- package/dist/virtual/sandbox.js +5 -0
- package/dist/virtual/sandbox.js.map +1 -0
- package/dist/virtual/sidebar.d.ts +3 -0
- package/dist/virtual/sidebar.js +5 -0
- package/dist/virtual/sidebar.js.map +1 -0
- package/package.json +31 -10
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/types/client.d.ts +15 -0
- package/dist/cli/builders/manifest/utils.d.ts +0 -32
- package/dist/cli/builders/manifest/utils.js +0 -209
- package/dist/cli/builders/manifest/utils.js.map +0 -1
- package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
- package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
- package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
- package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
- package/dist/cli/entrypoint/finder/AbstractOptionsFinder.js.map +0 -1
- package/dist/entry/content/core/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/Context.js.map +0 -1
- package/dist/entry/content/core/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/EventNode.js.map +0 -1
- package/dist/entry/content/core/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/MountNode.js.map +0 -1
- package/dist/entry/content/core/Node.js.map +0 -1
- package/dist/entry/content/core/WeakMarker.js.map +0 -1
- package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
- package/dist/locale/adapters/react/LocaleProvider.js +0 -58
- package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
- package/dist/locale/adapters/react/context.d.ts +0 -14
- package/dist/locale/adapters/react/context.js +0 -25
- package/dist/locale/adapters/react/context.js.map +0 -1
- package/dist/locale/utils.d.ts +0 -11
- package/dist/locale/utils.js +0 -67
- package/dist/locale/utils.js.map +0 -1
- /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
- /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
- /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
- /package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.d.ts → AbstractParsedFinder.d.ts} +0 -0
- /package/dist/entry/content/core/{ManagedContext.js → context/ManagedContext.js} +0 -0
- /package/dist/entry/content/core/{AttributeMarker.js → markers/AttributeMarker.js} +0 -0
- /package/dist/entry/content/core/{WeakMarker.js → markers/WeakMarker.js} +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
|
-
import { DefinePlugin } from "@rspack/core";
|
|
3
2
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
4
|
-
import { GenerateJsonPlugin } from "./../../../cli/bundler/index.js";
|
|
5
|
-
import {
|
|
3
|
+
import { GenerateJsonPlugin, GenerateModulePlugin, WatchPlugin } from "./../../../cli/bundler/index.js";
|
|
4
|
+
import { getContentLayer } from "./../../../cli/bundler/utils/layers.js";
|
|
5
|
+
import { extractLocaleKey, modifyLocaleMessageKey } from "./../../../shared/locale/index.js";
|
|
6
6
|
import Locale from "./Locale.js";
|
|
7
7
|
import { LocaleDeclaration } from "./declaration/index.js";
|
|
8
|
+
import { createLocaleModule, LocaleModuleLayer, LocaleModuleName } from "./locale-module.js";
|
|
8
9
|
import { Command } from "./../../../types/app.js";
|
|
9
10
|
import { Browser } from "./../../../types/browser.js";
|
|
11
|
+
import { ContentScriptWorld } from "./../../../types/content.js";
|
|
10
12
|
var locale_default = definePlugin(() => {
|
|
11
13
|
let locale;
|
|
12
14
|
let declaration;
|
|
@@ -18,25 +20,58 @@ var locale_default = definePlugin(() => {
|
|
|
18
20
|
},
|
|
19
21
|
locale: () => locale.files(),
|
|
20
22
|
bundler: async ({ config }) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const prepareLocale = async () => {
|
|
24
|
+
await locale.validate();
|
|
25
|
+
declaration.structure(await locale.structure()).build();
|
|
26
|
+
};
|
|
27
|
+
const getModules = async () => ({
|
|
28
|
+
[LocaleModuleName]: createLocaleModule(await locale.catalogue(), await locale.keys(), config.lang)
|
|
29
|
+
});
|
|
30
|
+
await prepareLocale();
|
|
31
|
+
const jsonPlugin = new GenerateJsonPlugin(await locale.json());
|
|
32
|
+
const modulePlugin = new GenerateModulePlugin(await getModules()).layer(LocaleModuleLayer, {
|
|
33
|
+
not: [getContentLayer(ContentScriptWorld.Main)]
|
|
34
|
+
});
|
|
35
|
+
const plugins = [];
|
|
24
36
|
if (config.command === Command.Watch) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
plugins.push(
|
|
38
|
+
new WatchPlugin(async () => {
|
|
39
|
+
locale.clear();
|
|
40
|
+
await prepareLocale();
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
jsonPlugin.watch(() => locale.json());
|
|
44
|
+
modulePlugin.watch(getModules, () => locale.dependencies());
|
|
31
45
|
}
|
|
46
|
+
plugins.push(jsonPlugin, modulePlugin);
|
|
32
47
|
return {
|
|
33
|
-
plugins
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
plugins,
|
|
49
|
+
optimization: {
|
|
50
|
+
emitOnErrors: false,
|
|
51
|
+
splitChunks: config.commonChunks ? {
|
|
52
|
+
cacheGroups: {
|
|
53
|
+
adnbnLocaleShared: {
|
|
54
|
+
layer: LocaleModuleLayer,
|
|
55
|
+
name: "locale",
|
|
56
|
+
// Share the module across consumers of different exports.
|
|
57
|
+
usedExports: false,
|
|
58
|
+
minChunks: 2,
|
|
59
|
+
minSize: 0,
|
|
60
|
+
enforce: true,
|
|
61
|
+
priority: 60
|
|
62
|
+
},
|
|
63
|
+
adnbnLocaleLarge: {
|
|
64
|
+
layer: LocaleModuleLayer,
|
|
65
|
+
name: "locale",
|
|
66
|
+
usedExports: false,
|
|
67
|
+
minChunks: 1,
|
|
68
|
+
minSize: 1e5,
|
|
69
|
+
enforce: true,
|
|
70
|
+
priority: 70
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} : void 0
|
|
74
|
+
}
|
|
40
75
|
};
|
|
41
76
|
},
|
|
42
77
|
manifest: async ({ config, manifest }) => {
|
|
@@ -69,11 +104,11 @@ var locale_default = definePlugin(() => {
|
|
|
69
104
|
const shortNameKey = extractLocaleKey(shortName);
|
|
70
105
|
assertLocaleKey(shortName, "short name");
|
|
71
106
|
if (shortNameKey && (browser === Browser.Opera || browser === Browser.Edge)) {
|
|
72
|
-
const
|
|
73
|
-
if (!
|
|
107
|
+
const defaultBuilder = builders.get(language);
|
|
108
|
+
if (!defaultBuilder) {
|
|
74
109
|
throw new Error(`Locale not found for "${language}"`);
|
|
75
110
|
}
|
|
76
|
-
manifestShortName =
|
|
111
|
+
manifestShortName = defaultBuilder.get().get(shortNameKey) ?? manifestShortName;
|
|
77
112
|
}
|
|
78
113
|
manifest.setShortName(manifestShortName);
|
|
79
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/locale/index.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {Configuration as RspackConfig,
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/locale/index.ts"],"sourcesContent":["import _ from \"lodash\";\nimport type {Configuration as RspackConfig, RspackPluginInstance} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {GenerateJsonPlugin, GenerateModulePlugin, WatchPlugin} from \"@cli/bundler\";\nimport {getContentLayer} from \"@cli/bundler/utils/layers\";\nimport {extractLocaleKey, modifyLocaleMessageKey} from \"@shared/locale\";\n\nimport Locale from \"./Locale\";\nimport {LocaleDeclaration} from \"./declaration\";\nimport {createLocaleModule, LocaleModuleLayer, LocaleModuleName} from \"./locale-module\";\n\nimport {Command} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ContentScriptWorld} from \"@typing/content\";\n\nexport default definePlugin(() => {\n let locale: Locale;\n let declaration: LocaleDeclaration;\n\n return {\n name: \"adnbn:locale\",\n startup: ({config}) => {\n locale = new Locale(config);\n declaration = new LocaleDeclaration(config);\n },\n locale: () => locale.files(),\n bundler: async ({config}) => {\n const prepareLocale = async () => {\n await locale.validate();\n declaration.structure(await locale.structure()).build();\n };\n\n const getModules = async () => ({\n [LocaleModuleName]: createLocaleModule(await locale.catalogue(), await locale.keys(), config.lang),\n });\n\n await prepareLocale();\n\n const jsonPlugin = new GenerateJsonPlugin(await locale.json());\n // MAIN keeps its content layer and uses the regular common-main.content group.\n const modulePlugin = new GenerateModulePlugin(await getModules()).layer(LocaleModuleLayer, {\n not: [getContentLayer(ContentScriptWorld.Main)],\n });\n const plugins: RspackPluginInstance[] = [];\n\n if (config.command === Command.Watch) {\n plugins.push(\n new WatchPlugin(async () => {\n locale.clear();\n await prepareLocale();\n })\n );\n\n jsonPlugin.watch(() => locale.json());\n modulePlugin.watch(getModules, () => locale.dependencies());\n }\n\n plugins.push(jsonPlugin, modulePlugin);\n\n return {\n plugins,\n optimization: {\n emitOnErrors: false,\n splitChunks: config.commonChunks\n ? {\n cacheGroups: {\n adnbnLocaleShared: {\n layer: LocaleModuleLayer,\n name: \"locale\",\n // Share the module across consumers of different exports.\n usedExports: false,\n minChunks: 2,\n minSize: 0,\n enforce: true,\n priority: 60,\n },\n adnbnLocaleLarge: {\n layer: LocaleModuleLayer,\n name: \"locale\",\n usedExports: false,\n minChunks: 1,\n minSize: 100_000,\n enforce: true,\n priority: 70,\n },\n },\n }\n : undefined,\n },\n } satisfies RspackConfig;\n },\n manifest: async ({config, manifest}) => {\n const {lang: language, name, shortName, description, browser} = config;\n const availableLanguages = await locale.languages();\n const builders = await locale.builders();\n const hasLocales = builders.size > 0;\n\n if (availableLanguages.size > 0 && !availableLanguages.has(language)) {\n throw new Error(\n `Language \"${language}\" not found in available translations. Available languages: ${[...availableLanguages].join(\", \")}`\n );\n }\n\n await locale.validate();\n\n const keys = await locale.keys();\n\n const assertLocaleKey = (value: string, label: string): void => {\n const key = extractLocaleKey(value);\n\n if (!key) {\n return;\n }\n\n if (!hasLocales) {\n throw new Error(`Locale ${label} key \"${key}\" provided but no translations were found`);\n }\n\n if (!keys.has(key)) {\n throw new Error(`Locale ${label} key \"${key}\" not found in translation`);\n }\n };\n\n manifest.setLocale(hasLocales ? language : undefined);\n\n if (shortName) {\n let manifestShortName = modifyLocaleMessageKey(shortName) ?? shortName;\n const shortNameKey = extractLocaleKey(shortName);\n\n assertLocaleKey(shortName, \"short name\");\n\n /** Opera/Edge do not support localization in manifest's short_name field */\n if (shortNameKey && (browser === Browser.Opera || browser === Browser.Edge)) {\n const defaultBuilder = builders.get(language);\n\n if (!defaultBuilder) {\n throw new Error(`Locale not found for \"${language}\"`);\n }\n\n manifestShortName = defaultBuilder.get().get(shortNameKey) ?? manifestShortName;\n }\n\n manifest.setShortName(manifestShortName);\n }\n\n if (description) {\n assertLocaleKey(description, \"description\");\n manifest.setDescription(modifyLocaleMessageKey(description));\n }\n\n if (name) {\n assertLocaleKey(name, \"name\");\n\n const manifestName = modifyLocaleMessageKey(name);\n\n if (manifestName) {\n manifest.setName(manifestName);\n\n return;\n }\n }\n\n manifest.setName(_.startCase(config.app));\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AAGd,SAAQ,oBAAmB;AAC3B,SAAQ,oBAAoB,sBAAsB,mBAAkB;AACpE,SAAQ,uBAAsB;AAC9B,SAAQ,kBAAkB,8BAA6B;AAEvD,OAAO,YAAY;AACnB,SAAQ,yBAAwB;AAChC,SAAQ,oBAAoB,mBAAmB,wBAAuB;AAEtE,SAAQ,eAAc;AACtB,SAAQ,eAAc;AACtB,SAAQ,0BAAyB;AAEjC,IAAO,iBAAQ,aAAa,MAAM;AAC9B,MAAI;AACJ,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,eAAS,IAAI,OAAO,MAAM;AAC1B,oBAAc,IAAI,kBAAkB,MAAM;AAAA,IAC9C;AAAA,IACA,QAAQ,MAAM,OAAO,MAAM;AAAA,IAC3B,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,YAAM,gBAAgB,YAAY;AAC9B,cAAM,OAAO,SAAS;AACtB,oBAAY,UAAU,MAAM,OAAO,UAAU,CAAC,EAAE,MAAM;AAAA,MAC1D;AAEA,YAAM,aAAa,aAAa;AAAA,QAC5B,CAAC,gBAAgB,GAAG,mBAAmB,MAAM,OAAO,UAAU,GAAG,MAAM,OAAO,KAAK,GAAG,OAAO,IAAI;AAAA,MACrG;AAEA,YAAM,cAAc;AAEpB,YAAM,aAAa,IAAI,mBAAmB,MAAM,OAAO,KAAK,CAAC;AAE7D,YAAM,eAAe,IAAI,qBAAqB,MAAM,WAAW,CAAC,EAAE,MAAM,mBAAmB;AAAA,QACvF,KAAK,CAAC,gBAAgB,mBAAmB,IAAI,CAAC;AAAA,MAClD,CAAC;AACD,YAAM,UAAkC,CAAC;AAEzC,UAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,gBAAQ;AAAA,UACJ,IAAI,YAAY,YAAY;AACxB,mBAAO,MAAM;AACb,kBAAM,cAAc;AAAA,UACxB,CAAC;AAAA,QACL;AAEA,mBAAW,MAAM,MAAM,OAAO,KAAK,CAAC;AACpC,qBAAa,MAAM,YAAY,MAAM,OAAO,aAAa,CAAC;AAAA,MAC9D;AAEA,cAAQ,KAAK,YAAY,YAAY;AAErC,aAAO;AAAA,QACH;AAAA,QACA,cAAc;AAAA,UACV,cAAc;AAAA,UACd,aAAa,OAAO,eACd;AAAA,YACI,aAAa;AAAA,cACT,mBAAmB;AAAA,gBACf,OAAO;AAAA,gBACP,MAAM;AAAA;AAAA,gBAEN,aAAa;AAAA,gBACb,WAAW;AAAA,gBACX,SAAS;AAAA,gBACT,SAAS;AAAA,gBACT,UAAU;AAAA,cACd;AAAA,cACA,kBAAkB;AAAA,gBACd,OAAO;AAAA,gBACP,MAAM;AAAA,gBACN,aAAa;AAAA,gBACb,WAAW;AAAA,gBACX,SAAS;AAAA,gBACT,SAAS;AAAA,gBACT,UAAU;AAAA,cACd;AAAA,YACJ;AAAA,UACJ,IACA;AAAA,QACV;AAAA,MACJ;AAAA,IACJ;AAAA,IACA,UAAU,OAAO,EAAC,QAAQ,SAAQ,MAAM;AACpC,YAAM,EAAC,MAAM,UAAU,MAAM,WAAW,aAAa,QAAO,IAAI;AAChE,YAAM,qBAAqB,MAAM,OAAO,UAAU;AAClD,YAAM,WAAW,MAAM,OAAO,SAAS;AACvC,YAAM,aAAa,SAAS,OAAO;AAEnC,UAAI,mBAAmB,OAAO,KAAK,CAAC,mBAAmB,IAAI,QAAQ,GAAG;AAClE,cAAM,IAAI;AAAA,UACN,aAAa,QAAQ,+DAA+D,CAAC,GAAG,kBAAkB,EAAE,KAAK,IAAI,CAAC;AAAA,QAC1H;AAAA,MACJ;AAEA,YAAM,OAAO,SAAS;AAEtB,YAAM,OAAO,MAAM,OAAO,KAAK;AAE/B,YAAM,kBAAkB,CAAC,OAAe,UAAwB;AAC5D,cAAM,MAAM,iBAAiB,KAAK;AAElC,YAAI,CAAC,KAAK;AACN;AAAA,QACJ;AAEA,YAAI,CAAC,YAAY;AACb,gBAAM,IAAI,MAAM,UAAU,KAAK,SAAS,GAAG,2CAA2C;AAAA,QAC1F;AAEA,YAAI,CAAC,KAAK,IAAI,GAAG,GAAG;AAChB,gBAAM,IAAI,MAAM,UAAU,KAAK,SAAS,GAAG,4BAA4B;AAAA,QAC3E;AAAA,MACJ;AAEA,eAAS,UAAU,aAAa,WAAW,MAAS;AAEpD,UAAI,WAAW;AACX,YAAI,oBAAoB,uBAAuB,SAAS,KAAK;AAC7D,cAAM,eAAe,iBAAiB,SAAS;AAE/C,wBAAgB,WAAW,YAAY;AAGvC,YAAI,iBAAiB,YAAY,QAAQ,SAAS,YAAY,QAAQ,OAAO;AACzE,gBAAM,iBAAiB,SAAS,IAAI,QAAQ;AAE5C,cAAI,CAAC,gBAAgB;AACjB,kBAAM,IAAI,MAAM,yBAAyB,QAAQ,GAAG;AAAA,UACxD;AAEA,8BAAoB,eAAe,IAAI,EAAE,IAAI,YAAY,KAAK;AAAA,QAClE;AAEA,iBAAS,aAAa,iBAAiB;AAAA,MAC3C;AAEA,UAAI,aAAa;AACb,wBAAgB,aAAa,aAAa;AAC1C,iBAAS,eAAe,uBAAuB,WAAW,CAAC;AAAA,MAC/D;AAEA,UAAI,MAAM;AACN,wBAAgB,MAAM,MAAM;AAE5B,cAAM,eAAe,uBAAuB,IAAI;AAEhD,YAAI,cAAc;AACd,mBAAS,QAAQ,YAAY;AAE7B;AAAA,QACJ;AAAA,MACJ;AAEA,eAAS,QAAQ,EAAE,UAAU,OAAO,GAAG,CAAC;AAAA,IAC5C;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Language, LocaleCatalogue } from "../../../types/locale.js";
|
|
2
|
+
export declare const LocaleModuleName = "#adnbn/locale";
|
|
3
|
+
export declare const LocaleModuleLayer = "adnbn:locale";
|
|
4
|
+
export declare const createLocaleModule: (catalogue: LocaleCatalogue, keys: ReadonlySet<string>, lang: Language) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const LocaleModuleName = "#adnbn/locale";
|
|
2
|
+
const LocaleModuleLayer = "adnbn:locale";
|
|
3
|
+
const createLocaleModule = (catalogue, keys, lang) => (
|
|
4
|
+
// JSON.parse preserves own __proto__ keys; the pure annotation lets native consumers omit the catalogue.
|
|
5
|
+
`export const lang = ${JSON.stringify(lang)};
|
|
6
|
+
export const keys = ${JSON.stringify([...keys])};
|
|
7
|
+
export const languages = ${JSON.stringify(Object.keys(catalogue))};
|
|
8
|
+
export default /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(catalogue))});
|
|
9
|
+
`
|
|
10
|
+
);
|
|
11
|
+
export {
|
|
12
|
+
LocaleModuleLayer,
|
|
13
|
+
LocaleModuleName,
|
|
14
|
+
createLocaleModule
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=locale-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/locale/locale-module.ts"],"sourcesContent":["import type {Language, LocaleCatalogue} from \"@typing/locale\";\n\nexport const LocaleModuleName = \"#adnbn/locale\";\nexport const LocaleModuleLayer = \"adnbn:locale\";\n\nexport const createLocaleModule = (catalogue: LocaleCatalogue, keys: ReadonlySet<string>, lang: Language): string =>\n // JSON.parse preserves own __proto__ keys; the pure annotation lets native consumers omit the catalogue.\n `export const lang = ${JSON.stringify(lang)};\\n` +\n `export const keys = ${JSON.stringify([...keys])};\\n` +\n `export const languages = ${JSON.stringify(Object.keys(catalogue))};\\n` +\n `export default /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(catalogue))});\\n`;\n"],"mappings":"AAEO,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAE1B,MAAM,qBAAqB,CAAC,WAA4B,MAA2B;AAAA;AAAA,EAEtF,uBAAuB,KAAK,UAAU,IAAI,CAAC;AAAA,sBACpB,KAAK,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;AAAA,2BACpB,KAAK,UAAU,OAAO,KAAK,SAAS,CAAC,CAAC;AAAA,0CACvB,KAAK,UAAU,KAAK,UAAU,SAAS,CAAC,CAAC;AAAA;AAAA;","names":[]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { View } from "../view/index.js";
|
|
2
2
|
import { OffscreenFinder, OffscreenViewFinder } from "../../entrypoint/index.js";
|
|
3
3
|
import { ReadonlyConfig } from "../../../types/config.js";
|
|
4
|
-
import { OffscreenEntrypointOptions } from "../../../types/offscreen.js";
|
|
4
|
+
import { OffscreenEntrypointOptions, OffscreenParametersMap } from "../../../types/offscreen.js";
|
|
5
5
|
import { EntrypointFile } from "../../../types/entrypoint.js";
|
|
6
|
-
export type OffscreenParameters = Record<string, chrome.offscreen.CreateParameters>;
|
|
7
6
|
export default class extends OffscreenFinder {
|
|
8
7
|
protected _view?: View<OffscreenEntrypointOptions>;
|
|
9
8
|
protected _views?: OffscreenViewFinder;
|
|
@@ -17,6 +16,6 @@ export default class extends OffscreenFinder {
|
|
|
17
16
|
* This command is executed during the type declaration generation stage for the Offscreens.
|
|
18
17
|
*/
|
|
19
18
|
virtual(file: EntrypointFile): string;
|
|
20
|
-
parameters(): Promise<
|
|
19
|
+
parameters(): Promise<OffscreenParametersMap>;
|
|
21
20
|
clear(): this;
|
|
22
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/offscreen/Offscreen.ts"],"sourcesContent":["import _ from \"lodash\";\n\nimport {View} from \"../view\";\n\nimport {OffscreenFinder, OffscreenViewFinder} from \"@cli/entrypoint/index.js\";\n\nimport {virtualOffscreenModule} from \"@cli/virtual/index.js\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {OffscreenEntrypointOptions} from \"@typing/offscreen\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/offscreen/Offscreen.ts"],"sourcesContent":["import _ from \"lodash\";\n\nimport {View} from \"../view\";\n\nimport {OffscreenFinder, OffscreenViewFinder} from \"@cli/entrypoint/index.js\";\n\nimport {virtualOffscreenModule} from \"@cli/virtual/index.js\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {OffscreenEntrypointOptions, OffscreenParametersMap} from \"@typing/offscreen\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends OffscreenFinder {\n protected _view?: View<OffscreenEntrypointOptions>;\n\n protected _views?: OffscreenViewFinder;\n\n constructor(config: ReadonlyConfig) {\n super(config);\n\n this.names.reserve(this.chunkName());\n }\n\n public chunkName(): string {\n return \"common.\" + this.type();\n }\n\n public likely(name?: string): boolean {\n return this.names.likely(name);\n }\n\n public view(): View<OffscreenEntrypointOptions> {\n return (this._view ??= new View(this.config, this.views()));\n }\n\n public views(): OffscreenViewFinder {\n return (this._views ??= new OffscreenViewFinder(this.config, this));\n }\n\n /**\n * Before creating the virtual module, it is necessary to run a command `await this.transport()` that caches the Offscreens.\n * This command is executed during the type declaration generation stage for the Offscreens.\n */\n public virtual(file: EntrypointFile): string {\n const options = this._transport?.get(file)?.options;\n\n if (!options) {\n throw new Error(`Offscreen options not found for \"${file}\"`);\n }\n\n return virtualOffscreenModule(file, options.name);\n }\n\n public async parameters(): Promise<OffscreenParametersMap> {\n const offscreens: OffscreenParametersMap = {};\n\n const files = await this.transport();\n const filenames = await this.views().getFilenames();\n\n for (const [file, transport] of files) {\n const url = filenames.get(file);\n\n if (!url) {\n throw new Error(`Offscreen filename not found for \"${file.file}\"`);\n }\n\n let {name, reasons = \"DOM_PARSER\", justification = \"Just for testing\"} = transport.options;\n\n if (_.isString(reasons)) {\n reasons = [reasons];\n }\n\n offscreens[name] = {\n url,\n reasons,\n justification,\n };\n }\n\n return offscreens;\n }\n\n public clear(): this {\n this._view = undefined;\n this._views = undefined;\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,OAAO;AAEd,SAAQ,YAAW;AAEnB,SAAQ,iBAAiB,2BAA0B;AAEnD,SAAQ,8BAA6B;AAMrC,MAAO,0BAAsB,gBAAgB;AAAA,EAC/B;AAAA,EAEA;AAAA,EAEV,YAAY,QAAwB;AAChC,UAAM,MAAM;AAEZ,SAAK,MAAM,QAAQ,KAAK,UAAU,CAAC;AAAA,EACvC;AAAA,EAEO,YAAoB;AACvB,WAAO,YAAY,KAAK,KAAK;AAAA,EACjC;AAAA,EAEO,OAAO,MAAwB;AAClC,WAAO,KAAK,MAAM,OAAO,IAAI;AAAA,EACjC;AAAA,EAEO,OAAyC;AAC5C,WAAQ,KAAK,UAAL,KAAK,QAAU,IAAI,KAAK,KAAK,QAAQ,KAAK,MAAM,CAAC;AAAA,EAC7D;AAAA,EAEO,QAA6B;AAChC,WAAQ,KAAK,WAAL,KAAK,SAAW,IAAI,oBAAoB,KAAK,QAAQ,IAAI;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA;AAAA,EAMO,QAAQ,MAA8B;AA3CjD;AA4CQ,UAAM,WAAU,gBAAK,eAAL,mBAAiB,IAAI,UAArB,mBAA4B;AAE5C,QAAI,CAAC,SAAS;AACV,YAAM,IAAI,MAAM,oCAAoC,IAAI,GAAG;AAAA,IAC/D;AAEA,WAAO,uBAAuB,MAAM,QAAQ,IAAI;AAAA,EACpD;AAAA,EAEA,MAAa,aAA8C;AACvD,UAAM,aAAqC,CAAC;AAE5C,UAAM,QAAQ,MAAM,KAAK,UAAU;AACnC,UAAM,YAAY,MAAM,KAAK,MAAM,EAAE,aAAa;AAElD,eAAW,CAAC,MAAM,SAAS,KAAK,OAAO;AACnC,YAAM,MAAM,UAAU,IAAI,IAAI;AAE9B,UAAI,CAAC,KAAK;AACN,cAAM,IAAI,MAAM,qCAAqC,KAAK,IAAI,GAAG;AAAA,MACrE;AAEA,UAAI,EAAC,MAAM,UAAU,cAAc,gBAAgB,mBAAkB,IAAI,UAAU;AAEnF,UAAI,EAAE,SAAS,OAAO,GAAG;AACrB,kBAAU,CAAC,OAAO;AAAA,MACtB;AAEA,iBAAW,IAAI,IAAI;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA,EAEO,QAAc;AACjB,SAAK,QAAQ;AACb,SAAK,SAAS;AAEd,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import {
|
|
2
|
+
import { HtmlRspackPlugin } from "@rspack/core";
|
|
3
3
|
import { RspackVirtualModulePlugin } from "rspack-plugin-virtual-module";
|
|
4
4
|
import HtmlRspackTagsPlugin from "html-rspack-tags-plugin";
|
|
5
5
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
6
|
-
import { EntrypointPlugin } from "./../../../cli/bundler/index.js";
|
|
6
|
+
import { EntrypointPlugin, GenerateModulePlugin } from "./../../../cli/bundler/index.js";
|
|
7
7
|
import { virtualOffscreenBackgroundModule } from "./../../../cli/virtual/index.js";
|
|
8
8
|
import Offscreen from "./Offscreen.js";
|
|
9
9
|
import OffscreenDeclaration from "./OffscreenDeclaration.js";
|
|
10
|
+
import { createOffscreenModule, OffscreenModuleName } from "./offscreen-module.js";
|
|
10
11
|
import { Command } from "./../../../types/app.js";
|
|
11
12
|
import { Browser } from "./../../../types/browser.js";
|
|
12
13
|
import { BackgroundEntryName } from "./../../../types/background.js";
|
|
@@ -67,8 +68,8 @@ var offscreen_default = definePlugin(() => {
|
|
|
67
68
|
return {
|
|
68
69
|
...rspack,
|
|
69
70
|
plugins: [
|
|
70
|
-
new
|
|
71
|
-
|
|
71
|
+
new GenerateModulePlugin({
|
|
72
|
+
[OffscreenModuleName]: createOffscreenModule(parameters)
|
|
72
73
|
}),
|
|
73
74
|
...plugins
|
|
74
75
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/offscreen/index.ts"],"sourcesContent":["import path from \"path\";\nimport {Configuration as RspackConfig,
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/offscreen/index.ts"],"sourcesContent":["import path from \"path\";\nimport {Configuration as RspackConfig, HtmlRspackPlugin, Plugins} from \"@rspack/core\";\nimport {RspackVirtualModulePlugin} from \"rspack-plugin-virtual-module\";\nimport HtmlRspackTagsPlugin from \"html-rspack-tags-plugin\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {EntrypointPlugin, GenerateModulePlugin} from \"@cli/bundler\";\nimport {virtualOffscreenBackgroundModule} from \"@cli/virtual/index.js\";\n\nimport Offscreen from \"./Offscreen\";\nimport OffscreenDeclaration from \"./OffscreenDeclaration\";\nimport {createOffscreenModule, OffscreenModuleName} from \"./offscreen-module\";\n\nimport {Command} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {BackgroundEntryName} from \"@typing/background\";\nimport type {OffscreenParametersMap} from \"@typing/offscreen\";\n\nconst OffscreenTempDir = \"virtual\";\nconst OffscreenBackgroundModule = \"offscreen.background.ts\";\n\nexport default definePlugin(() => {\n let offscreen: Offscreen;\n let declaration: OffscreenDeclaration;\n\n return {\n name: \"adnbn:offscreen\",\n startup: ({config}) => {\n offscreen = new Offscreen(config);\n declaration = new OffscreenDeclaration(config);\n },\n offscreen: () => offscreen.files(),\n bundler: async ({config}) => {\n declaration.dictionary(await offscreen.dictionary()).build();\n\n let build: boolean = true;\n let rspack: RspackConfig = {};\n\n if (await offscreen.empty()) {\n if (config.debug) {\n console.info(\"Offscreen entries not found\");\n }\n\n build = false;\n }\n\n const plugins: Plugins = [];\n\n let parameters: OffscreenParametersMap = {};\n\n if (build) {\n parameters = await offscreen.parameters();\n\n // prettier-ignore\n const plugin = EntrypointPlugin.from(await offscreen.view().entries())\n .virtual(file => offscreen.virtual(file));\n\n if (config.command === Command.Watch) {\n plugin.watch(async () => {\n declaration.dictionary(await offscreen.clear().dictionary()).build();\n\n return offscreen.view().entries();\n });\n }\n\n const htmlPlugins = (await offscreen.view().html()).map(options => new HtmlRspackPlugin(options));\n const tagsPlugins = (await offscreen.view().tags()).map(options => new HtmlRspackTagsPlugin(options));\n\n plugins.push(plugin, ...htmlPlugins, ...tagsPlugins);\n\n if (config.manifestVersion === 2 || config.browser === Browser.Firefox) {\n plugins.push(\n new RspackVirtualModulePlugin(\n {\n [OffscreenBackgroundModule]: virtualOffscreenBackgroundModule(),\n },\n OffscreenTempDir\n )\n );\n\n rspack = {\n entry: {\n [BackgroundEntryName]: {\n import: [path.join(OffscreenTempDir, OffscreenBackgroundModule)],\n },\n },\n };\n }\n }\n\n return {\n ...rspack,\n plugins: [\n new GenerateModulePlugin({\n [OffscreenModuleName]: createOffscreenModule(parameters),\n }),\n ...plugins,\n ],\n } satisfies RspackConfig;\n },\n manifest: async ({manifest, config}) => {\n manifest.appendCsp(await offscreen.views().csp());\n\n if (config.manifestVersion !== 2 && config.browser !== Browser.Firefox && (await offscreen.exists())) {\n manifest.addPermission(\"offscreen\");\n }\n },\n };\n});\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAuC,wBAAgC;AACvE,SAAQ,iCAAgC;AACxC,OAAO,0BAA0B;AAEjC,SAAQ,oBAAmB;AAE3B,SAAQ,kBAAkB,4BAA2B;AACrD,SAAQ,wCAAuC;AAE/C,OAAO,eAAe;AACtB,OAAO,0BAA0B;AACjC,SAAQ,uBAAuB,2BAA0B;AAEzD,SAAQ,eAAc;AACtB,SAAQ,eAAc;AACtB,SAAQ,2BAA0B;AAGlC,MAAM,mBAAmB;AACzB,MAAM,4BAA4B;AAElC,IAAO,oBAAQ,aAAa,MAAM;AAC9B,MAAI;AACJ,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,kBAAY,IAAI,UAAU,MAAM;AAChC,oBAAc,IAAI,qBAAqB,MAAM;AAAA,IACjD;AAAA,IACA,WAAW,MAAM,UAAU,MAAM;AAAA,IACjC,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,kBAAY,WAAW,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM;AAE3D,UAAI,QAAiB;AACrB,UAAI,SAAuB,CAAC;AAE5B,UAAI,MAAM,UAAU,MAAM,GAAG;AACzB,YAAI,OAAO,OAAO;AACd,kBAAQ,KAAK,6BAA6B;AAAA,QAC9C;AAEA,gBAAQ;AAAA,MACZ;AAEA,YAAM,UAAmB,CAAC;AAE1B,UAAI,aAAqC,CAAC;AAE1C,UAAI,OAAO;AACP,qBAAa,MAAM,UAAU,WAAW;AAGxC,cAAM,SAAS,iBAAiB,KAAK,MAAM,UAAU,KAAK,EAAE,QAAQ,CAAC,EAChE,QAAQ,UAAQ,UAAU,QAAQ,IAAI,CAAC;AAE5C,YAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,iBAAO,MAAM,YAAY;AACrB,wBAAY,WAAW,MAAM,UAAU,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;AAEnE,mBAAO,UAAU,KAAK,EAAE,QAAQ;AAAA,UACpC,CAAC;AAAA,QACL;AAEA,cAAM,eAAe,MAAM,UAAU,KAAK,EAAE,KAAK,GAAG,IAAI,aAAW,IAAI,iBAAiB,OAAO,CAAC;AAChG,cAAM,eAAe,MAAM,UAAU,KAAK,EAAE,KAAK,GAAG,IAAI,aAAW,IAAI,qBAAqB,OAAO,CAAC;AAEpG,gBAAQ,KAAK,QAAQ,GAAG,aAAa,GAAG,WAAW;AAEnD,YAAI,OAAO,oBAAoB,KAAK,OAAO,YAAY,QAAQ,SAAS;AACpE,kBAAQ;AAAA,YACJ,IAAI;AAAA,cACA;AAAA,gBACI,CAAC,yBAAyB,GAAG,iCAAiC;AAAA,cAClE;AAAA,cACA;AAAA,YACJ;AAAA,UACJ;AAEA,mBAAS;AAAA,YACL,OAAO;AAAA,cACH,CAAC,mBAAmB,GAAG;AAAA,gBACnB,QAAQ,CAAC,KAAK,KAAK,kBAAkB,yBAAyB,CAAC;AAAA,cACnE;AAAA,YACJ;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAEA,aAAO;AAAA,QACH,GAAG;AAAA,QACH,SAAS;AAAA,UACL,IAAI,qBAAqB;AAAA,YACrB,CAAC,mBAAmB,GAAG,sBAAsB,UAAU;AAAA,UAC3D,CAAC;AAAA,UACD,GAAG;AAAA,QACP;AAAA,MACJ;AAAA,IACJ;AAAA,IACA,UAAU,OAAO,EAAC,UAAU,OAAM,MAAM;AACpC,eAAS,UAAU,MAAM,UAAU,MAAM,EAAE,IAAI,CAAC;AAEhD,UAAI,OAAO,oBAAoB,KAAK,OAAO,YAAY,QAAQ,WAAY,MAAM,UAAU,OAAO,GAAI;AAClG,iBAAS,cAAc,WAAW;AAAA,MACtC;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const OffscreenModuleName = "#adnbn/offscreen";
|
|
2
|
+
const createOffscreenModule = (parameters) => (
|
|
3
|
+
// Preserve the JSON payload without retaining unused data.
|
|
4
|
+
`export const parameters = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(parameters))});
|
|
5
|
+
`
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
OffscreenModuleName,
|
|
9
|
+
createOffscreenModule
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=offscreen-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/offscreen/offscreen-module.ts"],"sourcesContent":["import type {OffscreenParametersMap} from \"@typing/offscreen\";\n\nexport const OffscreenModuleName = \"#adnbn/offscreen\";\n\nexport const createOffscreenModule = (parameters: OffscreenParametersMap): string =>\n // Preserve the JSON payload without retaining unused data.\n `export const parameters = /*#__PURE__*/ JSON.parse(${JSON.stringify(JSON.stringify(parameters))});\\n`;\n"],"mappings":"AAEO,MAAM,sBAAsB;AAE5B,MAAM,wBAAwB,CAAC;AAAA;AAAA,EAElC,sDAAsD,KAAK,UAAU,KAAK,UAAU,UAAU,CAAC,CAAC;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import View from "../view/View.js";
|
|
2
|
+
import OptionsFinder from "../../entrypoint/finder/OptionsFinder.js";
|
|
3
|
+
import type { OptionsEntrypointOptions } from "../../../types/options.js";
|
|
4
|
+
import type { ManifestOptions } from "../../../types/manifest.js";
|
|
5
|
+
export default class extends OptionsFinder {
|
|
6
|
+
protected _view?: View<OptionsEntrypointOptions>;
|
|
7
|
+
view(): View<OptionsEntrypointOptions>;
|
|
8
|
+
manifest(): Promise<ManifestOptions | undefined>;
|
|
9
|
+
clear(): this;
|
|
10
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import View from "../view/View.js";
|
|
2
|
+
import OptionsFinder from "./../../../cli/entrypoint/finder/OptionsFinder.js";
|
|
3
|
+
class Options_default extends OptionsFinder {
|
|
4
|
+
_view;
|
|
5
|
+
view() {
|
|
6
|
+
return this._view ?? (this._view = new View(this.config, this));
|
|
7
|
+
}
|
|
8
|
+
async manifest() {
|
|
9
|
+
const [view] = (await this.views()).values();
|
|
10
|
+
if (!view) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const { openInTab } = (await this.plugin().options()).get(view.file) ?? {};
|
|
14
|
+
return { path: view.filename, openInTab };
|
|
15
|
+
}
|
|
16
|
+
clear() {
|
|
17
|
+
this._view = void 0;
|
|
18
|
+
return super.clear();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
Options_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/options/Options.ts"],"sourcesContent":["import View from \"../view/View\";\nimport OptionsFinder from \"@cli/entrypoint/finder/OptionsFinder\";\n\nimport type {OptionsEntrypointOptions} from \"@typing/options\";\nimport type {ManifestOptions} from \"@typing/manifest\";\n\nexport default class extends OptionsFinder {\n protected _view?: View<OptionsEntrypointOptions>;\n\n public view(): View<OptionsEntrypointOptions> {\n return (this._view ??= new View(this.config, this));\n }\n\n public async manifest(): Promise<ManifestOptions | undefined> {\n const [view] = (await this.views()).values();\n\n if (!view) {\n return;\n }\n\n const {openInTab} = (await this.plugin().options()).get(view.file) ?? {};\n\n return {path: view.filename, openInTab};\n }\n\n public clear(): this {\n this._view = undefined;\n\n return super.clear();\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAK1B,MAAO,wBAAsB,cAAc;AAAA,EAC7B;AAAA,EAEH,OAAuC;AAC1C,WAAQ,KAAK,UAAL,KAAK,QAAU,IAAI,KAAK,KAAK,QAAQ,IAAI;AAAA,EACrD;AAAA,EAEA,MAAa,WAAiD;AAC1D,UAAM,CAAC,IAAI,KAAK,MAAM,KAAK,MAAM,GAAG,OAAO;AAE3C,QAAI,CAAC,MAAM;AACP;AAAA,IACJ;AAEA,UAAM,EAAC,UAAS,KAAK,MAAM,KAAK,OAAO,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,KAAK,CAAC;AAEvE,WAAO,EAAC,MAAM,KAAK,UAAU,UAAS;AAAA,EAC1C;AAAA,EAEO,QAAc;AACjB,SAAK,QAAQ;AAEb,WAAO,MAAM,MAAM;AAAA,EACvB;AACJ;","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HtmlRspackPlugin } from "@rspack/core";
|
|
2
|
+
import HtmlRspackTagsPlugin from "html-rspack-tags-plugin";
|
|
3
|
+
import Options from "./Options.js";
|
|
4
|
+
import { definePlugin } from "./../../../main/plugin.js";
|
|
5
|
+
import { EntrypointPlugin } from "./../../../cli/bundler/index.js";
|
|
6
|
+
import { virtualViewModule } from "./../../../cli/virtual/index.js";
|
|
7
|
+
import { Command } from "./../../../types/app.js";
|
|
8
|
+
var options_default = definePlugin(() => {
|
|
9
|
+
let options;
|
|
10
|
+
return {
|
|
11
|
+
name: "adnbn:options",
|
|
12
|
+
startup: ({ config }) => {
|
|
13
|
+
options = new Options(config);
|
|
14
|
+
},
|
|
15
|
+
options: () => options.files(),
|
|
16
|
+
bundler: async ({ config }) => {
|
|
17
|
+
if (await options.empty()) {
|
|
18
|
+
if (config.debug) {
|
|
19
|
+
console.info("Options entry not found");
|
|
20
|
+
}
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
const plugin = EntrypointPlugin.from(await options.view().entries()).virtual(virtualViewModule);
|
|
24
|
+
if (config.command === Command.Watch) {
|
|
25
|
+
plugin.watch(async () => options.clear().view().entries());
|
|
26
|
+
}
|
|
27
|
+
const htmlPlugins = (await options.view().html()).map((options2) => new HtmlRspackPlugin(options2));
|
|
28
|
+
const tagsPlugins = (await options.view().tags()).map((options2) => new HtmlRspackTagsPlugin(options2));
|
|
29
|
+
return {
|
|
30
|
+
plugins: [plugin, ...htmlPlugins, ...tagsPlugins]
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
manifest: async ({ manifest }) => {
|
|
34
|
+
manifest.setOptions(await options.manifest()).appendCsp(await options.csp());
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
options_default as default
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/options/index.ts"],"sourcesContent":["import {Configuration as RspackConfig, HtmlRspackPlugin} from \"@rspack/core\";\nimport HtmlRspackTagsPlugin from \"html-rspack-tags-plugin\";\n\nimport Options from \"./Options\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {EntrypointPlugin} from \"@cli/bundler\";\nimport {virtualViewModule} from \"@cli/virtual/index.js\";\n\nimport {Command} from \"@typing/app\";\n\nexport default definePlugin(() => {\n let options: Options;\n\n return {\n name: \"adnbn:options\",\n startup: ({config}) => {\n options = new Options(config);\n },\n options: () => options.files(),\n bundler: async ({config}) => {\n if (await options.empty()) {\n if (config.debug) {\n console.info(\"Options entry not found\");\n }\n\n return {};\n }\n\n const plugin = EntrypointPlugin.from(await options.view().entries()).virtual(virtualViewModule);\n\n if (config.command === Command.Watch) {\n plugin.watch(async () => options.clear().view().entries());\n }\n\n const htmlPlugins = (await options.view().html()).map(options => new HtmlRspackPlugin(options));\n const tagsPlugins = (await options.view().tags()).map(options => new HtmlRspackTagsPlugin(options));\n\n return {\n plugins: [plugin, ...htmlPlugins, ...tagsPlugins],\n } satisfies RspackConfig;\n },\n manifest: async ({manifest}) => {\n manifest.setOptions(await options.manifest()).appendCsp(await options.csp());\n },\n };\n});\n"],"mappings":"AAAA,SAAuC,wBAAuB;AAC9D,OAAO,0BAA0B;AAEjC,OAAO,aAAa;AAEpB,SAAQ,oBAAmB;AAC3B,SAAQ,wBAAuB;AAC/B,SAAQ,yBAAwB;AAEhC,SAAQ,eAAc;AAEtB,IAAO,kBAAQ,aAAa,MAAM;AAC9B,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,gBAAU,IAAI,QAAQ,MAAM;AAAA,IAChC;AAAA,IACA,SAAS,MAAM,QAAQ,MAAM;AAAA,IAC7B,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,UAAI,MAAM,QAAQ,MAAM,GAAG;AACvB,YAAI,OAAO,OAAO;AACd,kBAAQ,KAAK,yBAAyB;AAAA,QAC1C;AAEA,eAAO,CAAC;AAAA,MACZ;AAEA,YAAM,SAAS,iBAAiB,KAAK,MAAM,QAAQ,KAAK,EAAE,QAAQ,CAAC,EAAE,QAAQ,iBAAiB;AAE9F,UAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,eAAO,MAAM,YAAY,QAAQ,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC;AAAA,MAC7D;AAEA,YAAM,eAAe,MAAM,QAAQ,KAAK,EAAE,KAAK,GAAG,IAAI,CAAAA,aAAW,IAAI,iBAAiBA,QAAO,CAAC;AAC9F,YAAM,eAAe,MAAM,QAAQ,KAAK,EAAE,KAAK,GAAG,IAAI,CAAAA,aAAW,IAAI,qBAAqBA,QAAO,CAAC;AAElG,aAAO;AAAA,QACH,SAAS,CAAC,QAAQ,GAAG,aAAa,GAAG,WAAW;AAAA,MACpD;AAAA,IACJ;AAAA,IACA,UAAU,OAAO,EAAC,SAAQ,MAAM;AAC5B,eAAS,WAAW,MAAM,QAAQ,SAAS,CAAC,EAAE,UAAU,MAAM,QAAQ,IAAI,CAAC;AAAA,IAC/E;AAAA,EACJ;AACJ,CAAC;","names":["options"]}
|
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
import _ from "lodash";
|
|
2
2
|
import { definePlugin } from "./../../main/plugin.js";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
appFilenameResolver,
|
|
5
|
+
BuildAssetsMapPlugin,
|
|
6
|
+
GenerateModulePlugin,
|
|
7
|
+
createEntrypointModule,
|
|
8
|
+
EntrypointAssetsModule
|
|
9
|
+
} from "./../../cli/bundler/index.js";
|
|
4
10
|
import { getOutputPath, getResolvePath } from "./../../cli/resolvers/path.js";
|
|
5
11
|
import { Command } from "./../../types/app.js";
|
|
12
|
+
import { BackgroundEntryName } from "./../../types/background.js";
|
|
13
|
+
const serializeFilename = (filename) => {
|
|
14
|
+
return typeof filename === "function" ? filename.toString() : String(filename ?? "");
|
|
15
|
+
};
|
|
6
16
|
var output_default = definePlugin(() => {
|
|
7
17
|
return {
|
|
8
18
|
name: "adnbn:output",
|
|
9
19
|
bundler: ({ config }) => {
|
|
10
|
-
const { app, jsDir, jsFilename } = config;
|
|
20
|
+
const { app, assetsDir, assetsFilename, cssDir, cssFilename, jsDir, jsFilename } = config;
|
|
11
21
|
const kebabApp = _.kebabCase(app);
|
|
12
22
|
const camelApp = _.camelCase(app);
|
|
13
23
|
const filename = appFilenameResolver(app, jsFilename, jsDir);
|
|
24
|
+
const cssOutputFilename = appFilenameResolver(app, cssFilename, cssDir);
|
|
25
|
+
const buildHashSalt = JSON.stringify({
|
|
26
|
+
app,
|
|
27
|
+
assetsDir,
|
|
28
|
+
assetsFilename: serializeFilename(assetsFilename),
|
|
29
|
+
cssDir,
|
|
30
|
+
cssFilename: serializeFilename(cssFilename),
|
|
31
|
+
jsDir,
|
|
32
|
+
jsFilename: serializeFilename(jsFilename)
|
|
33
|
+
});
|
|
14
34
|
return {
|
|
15
35
|
output: {
|
|
16
36
|
path: getResolvePath(getOutputPath(config)),
|
|
@@ -21,7 +41,17 @@ var output_default = definePlugin(() => {
|
|
|
21
41
|
chunkLoadingGlobal: camelApp + "ChunkLoading",
|
|
22
42
|
uniqueName: kebabApp,
|
|
23
43
|
clean: config.command === Command.Build
|
|
24
|
-
}
|
|
44
|
+
},
|
|
45
|
+
plugins: [
|
|
46
|
+
new GenerateModulePlugin({ [EntrypointAssetsModule.request]: createEntrypointModule() }),
|
|
47
|
+
new BuildAssetsMapPlugin({
|
|
48
|
+
module: EntrypointAssetsModule,
|
|
49
|
+
buildHashSalt,
|
|
50
|
+
cssChunkFilename: cssOutputFilename,
|
|
51
|
+
cssFilename: cssOutputFilename,
|
|
52
|
+
fullMapEntrypoint: BackgroundEntryName
|
|
53
|
+
})
|
|
54
|
+
]
|
|
25
55
|
};
|
|
26
56
|
}
|
|
27
57
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/plugins/output.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {Configuration as RspackConfig} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {appFilenameResolver} from \"@cli/bundler\";\nimport {getOutputPath, getResolvePath} from \"@cli/resolvers/path\";\n\nimport {Command} from \"@typing/app\";\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:output\",\n bundler: ({config}) => {\n const {app, jsDir, jsFilename} = config;\n\n const kebabApp = _.kebabCase(app);\n const camelApp = _.camelCase(app);\n\n const filename = appFilenameResolver(app, jsFilename, jsDir);\n\n return {\n output: {\n path: getResolvePath(getOutputPath(config)),\n filename,\n chunkFilename: filename,\n hashSalt: kebabApp,\n hotUpdateGlobal: camelApp + \"HotUpdate\",\n chunkLoadingGlobal: camelApp + \"ChunkLoading\",\n uniqueName: kebabApp,\n clean: config.command === Command.Build,\n },\n } satisfies RspackConfig;\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AAGd,SAAQ,oBAAmB;AAE3B,
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/plugins/output.ts"],"sourcesContent":["import _ from \"lodash\";\nimport {Configuration as RspackConfig} from \"@rspack/core\";\n\nimport {definePlugin} from \"@main/plugin\";\n\nimport {\n appFilenameResolver,\n BuildAssetsMapPlugin,\n GenerateModulePlugin,\n createEntrypointModule,\n EntrypointAssetsModule,\n} from \"@cli/bundler\";\nimport {getOutputPath, getResolvePath} from \"@cli/resolvers/path\";\n\nimport {Command} from \"@typing/app\";\nimport {BackgroundEntryName} from \"@typing/background\";\n\nconst serializeFilename = (filename: unknown): string => {\n return typeof filename === \"function\" ? filename.toString() : String(filename ?? \"\");\n};\n\nexport default definePlugin(() => {\n return {\n name: \"adnbn:output\",\n bundler: ({config}) => {\n const {app, assetsDir, assetsFilename, cssDir, cssFilename, jsDir, jsFilename} = config;\n\n const kebabApp = _.kebabCase(app);\n const camelApp = _.camelCase(app);\n\n const filename = appFilenameResolver(app, jsFilename, jsDir);\n const cssOutputFilename = appFilenameResolver(app, cssFilename, cssDir);\n const buildHashSalt = JSON.stringify({\n app,\n assetsDir,\n assetsFilename: serializeFilename(assetsFilename),\n cssDir,\n cssFilename: serializeFilename(cssFilename),\n jsDir,\n jsFilename: serializeFilename(jsFilename),\n });\n\n return {\n output: {\n path: getResolvePath(getOutputPath(config)),\n filename,\n chunkFilename: filename,\n hashSalt: kebabApp,\n hotUpdateGlobal: camelApp + \"HotUpdate\",\n chunkLoadingGlobal: camelApp + \"ChunkLoading\",\n uniqueName: kebabApp,\n clean: config.command === Command.Build,\n },\n plugins: [\n new GenerateModulePlugin({[EntrypointAssetsModule.request]: createEntrypointModule()}),\n new BuildAssetsMapPlugin({\n module: EntrypointAssetsModule,\n buildHashSalt,\n cssChunkFilename: cssOutputFilename,\n cssFilename: cssOutputFilename,\n fullMapEntrypoint: BackgroundEntryName,\n }),\n ],\n } satisfies RspackConfig;\n },\n };\n});\n"],"mappings":"AAAA,OAAO,OAAO;AAGd,SAAQ,oBAAmB;AAE3B;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAQ,eAAe,sBAAqB;AAE5C,SAAQ,eAAc;AACtB,SAAQ,2BAA0B;AAElC,MAAM,oBAAoB,CAAC,aAA8B;AACrD,SAAO,OAAO,aAAa,aAAa,SAAS,SAAS,IAAI,OAAO,YAAY,EAAE;AACvF;AAEA,IAAO,iBAAQ,aAAa,MAAM;AAC9B,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,YAAM,EAAC,KAAK,WAAW,gBAAgB,QAAQ,aAAa,OAAO,WAAU,IAAI;AAEjF,YAAM,WAAW,EAAE,UAAU,GAAG;AAChC,YAAM,WAAW,EAAE,UAAU,GAAG;AAEhC,YAAM,WAAW,oBAAoB,KAAK,YAAY,KAAK;AAC3D,YAAM,oBAAoB,oBAAoB,KAAK,aAAa,MAAM;AACtE,YAAM,gBAAgB,KAAK,UAAU;AAAA,QACjC;AAAA,QACA;AAAA,QACA,gBAAgB,kBAAkB,cAAc;AAAA,QAChD;AAAA,QACA,aAAa,kBAAkB,WAAW;AAAA,QAC1C;AAAA,QACA,YAAY,kBAAkB,UAAU;AAAA,MAC5C,CAAC;AAED,aAAO;AAAA,QACH,QAAQ;AAAA,UACJ,MAAM,eAAe,cAAc,MAAM,CAAC;AAAA,UAC1C;AAAA,UACA,eAAe;AAAA,UACf,UAAU;AAAA,UACV,iBAAiB,WAAW;AAAA,UAC5B,oBAAoB,WAAW;AAAA,UAC/B,YAAY;AAAA,UACZ,OAAO,OAAO,YAAY,QAAQ;AAAA,QACtC;AAAA,QACA,SAAS;AAAA,UACL,IAAI,qBAAqB,EAAC,CAAC,uBAAuB,OAAO,GAAG,uBAAuB,EAAC,CAAC;AAAA,UACrF,IAAI,qBAAqB;AAAA,YACrB,QAAQ;AAAA,YACR;AAAA,YACA,kBAAkB;AAAA,YAClB,aAAa;AAAA,YACb,mBAAmB;AAAA,UACvB,CAAC;AAAA,QACL;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AACJ,CAAC;","names":[]}
|
|
@@ -12,10 +12,10 @@ class PageDeclaration_default extends FileBuilder {
|
|
|
12
12
|
}
|
|
13
13
|
template() {
|
|
14
14
|
let content = this.readFile();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
content = content.replace(
|
|
16
|
+
"// :page-aliases",
|
|
17
|
+
Array.from(this.alias, (alias) => `${JSON.stringify(alias)}: true;`).join("\n ")
|
|
18
|
+
);
|
|
19
19
|
return content;
|
|
20
20
|
}
|
|
21
21
|
setAlias(alias) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/plugins/page/declaration/PageDeclaration.ts"],"sourcesContent":["import {FileBuilder} from \"@cli/plugins/typescript\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default class extends FileBuilder {\n protected alias = new Set<string>();\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n protected filename(): string {\n return \"page.d.ts\";\n }\n\n protected url(): string {\n return import.meta.url;\n }\n\n protected template(): string {\n let content = this.readFile();\n\n
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/plugins/page/declaration/PageDeclaration.ts"],"sourcesContent":["import {FileBuilder} from \"@cli/plugins/typescript\";\n\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default class extends FileBuilder {\n protected alias = new Set<string>();\n\n constructor(config: ReadonlyConfig) {\n super(config);\n }\n\n protected filename(): string {\n return \"page.d.ts\";\n }\n\n protected url(): string {\n return import.meta.url;\n }\n\n protected template(): string {\n let content = this.readFile();\n\n content = content.replace(\n \"// :page-aliases\",\n Array.from(this.alias, alias => `${JSON.stringify(alias)}: true;`).join(\"\\n \")\n );\n\n return content;\n }\n\n public setAlias(alias: Set<string>): this {\n this.alias = alias;\n\n return this;\n }\n}\n"],"mappings":"AAAA,SAAQ,mBAAkB;AAI1B,MAAO,gCAAsB,YAAY;AAAA,EAC3B,QAAQ,oBAAI,IAAY;AAAA,EAElC,YAAY,QAAwB;AAChC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,WAAmB;AACzB,WAAO;AAAA,EACX;AAAA,EAEU,MAAc;AACpB,WAAO,YAAY;AAAA,EACvB;AAAA,EAEU,WAAmB;AACzB,QAAI,UAAU,KAAK,SAAS;AAE5B,cAAU,QAAQ;AAAA,MACd;AAAA,MACA,MAAM,KAAK,KAAK,OAAO,WAAS,GAAG,KAAK,UAAU,KAAK,CAAC,SAAS,EAAE,KAAK,YAAY;AAAA,IACxF;AAEA,WAAO;AAAA,EACX;AAAA,EAEO,SAAS,OAA0B;AACtC,SAAK,QAAQ;AAEb,WAAO;AAAA,EACX;AACJ;","names":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HtmlRspackPlugin } from "@rspack/core";
|
|
2
2
|
import HtmlRspackTagsPlugin from "html-rspack-tags-plugin";
|
|
3
3
|
import Page from "./Page.js";
|
|
4
4
|
import { PageDeclaration } from "./declaration/index.js";
|
|
5
|
+
import { createPageModule, PageModuleName } from "./page-module.js";
|
|
5
6
|
import { definePlugin } from "./../../../main/plugin.js";
|
|
6
7
|
import { virtualViewModule } from "./../../../cli/virtual/index.js";
|
|
7
|
-
import { EntrypointPlugin } from "./../../../cli/bundler/index.js";
|
|
8
|
+
import { EntrypointPlugin, GenerateModulePlugin } from "./../../../cli/bundler/index.js";
|
|
8
9
|
import { Command } from "./../../../types/app.js";
|
|
9
10
|
var page_default = definePlugin(() => {
|
|
10
11
|
let page;
|
|
@@ -18,14 +19,21 @@ var page_default = definePlugin(() => {
|
|
|
18
19
|
page: () => page.files(),
|
|
19
20
|
bundler: async ({ config }) => {
|
|
20
21
|
declaration.setAlias(await page.getAlias()).build();
|
|
22
|
+
const getModules = async () => ({
|
|
23
|
+
[PageModuleName]: createPageModule(
|
|
24
|
+
Object.fromEntries(Array.from((await page.views()).values(), (item) => [item.alias, item.filename]))
|
|
25
|
+
)
|
|
26
|
+
});
|
|
27
|
+
const modulePlugin = new GenerateModulePlugin(await getModules());
|
|
28
|
+
if (config.command === Command.Watch) {
|
|
29
|
+
modulePlugin.watch(getModules);
|
|
30
|
+
}
|
|
21
31
|
const plugins = [];
|
|
22
|
-
let alias = /* @__PURE__ */ new Map();
|
|
23
32
|
if (await page.empty()) {
|
|
24
33
|
if (config.debug) {
|
|
25
34
|
console.info("Page entries not found");
|
|
26
35
|
}
|
|
27
36
|
} else {
|
|
28
|
-
alias = await page.getAliasToFilename();
|
|
29
37
|
const plugin = EntrypointPlugin.from(await page.view().entries()).virtual((file) => virtualViewModule(file));
|
|
30
38
|
if (config.command === Command.Watch) {
|
|
31
39
|
plugin.watch(async () => {
|
|
@@ -38,12 +46,8 @@ var page_default = definePlugin(() => {
|
|
|
38
46
|
plugins.push(plugin, ...htmlPlugins, ...tagsPlugins);
|
|
39
47
|
}
|
|
40
48
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
__ADNBN_PAGE_ALIAS__: JSON.stringify(alias)
|
|
44
|
-
}),
|
|
45
|
-
...plugins
|
|
46
|
-
]
|
|
49
|
+
// Entrypoint watch refreshes the finder and declarations before generating the module.
|
|
50
|
+
plugins: [...plugins, modulePlugin]
|
|
47
51
|
};
|
|
48
52
|
},
|
|
49
53
|
manifest: async ({ manifest }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/plugins/page/index.ts"],"sourcesContent":["import {Configuration as RspackConfig,
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/plugins/page/index.ts"],"sourcesContent":["import {Configuration as RspackConfig, HtmlRspackPlugin, Plugins} from \"@rspack/core\";\nimport HtmlRspackTagsPlugin from \"html-rspack-tags-plugin\";\n\nimport Page from \"./Page\";\n\nimport {PageDeclaration} from \"./declaration\";\nimport {createPageModule, PageModuleName} from \"./page-module\";\n\nimport {definePlugin} from \"@main/plugin\";\nimport {virtualViewModule} from \"@cli/virtual/index.js\";\nimport {EntrypointPlugin, GenerateModulePlugin} from \"@cli/bundler\";\n\nimport {Command} from \"@typing/app\";\n\nexport default definePlugin(() => {\n let page: Page;\n let declaration: PageDeclaration;\n\n return {\n name: \"adnbn:page\",\n startup: ({config}) => {\n page = new Page(config);\n declaration = new PageDeclaration(config);\n },\n page: () => page.files(),\n bundler: async ({config}) => {\n declaration.setAlias(await page.getAlias()).build();\n\n const getModules = async () => ({\n [PageModuleName]: createPageModule(\n Object.fromEntries(Array.from((await page.views()).values(), item => [item.alias, item.filename]))\n ),\n });\n const modulePlugin = new GenerateModulePlugin(await getModules());\n\n if (config.command === Command.Watch) {\n modulePlugin.watch(getModules);\n }\n\n const plugins: Plugins = [];\n\n if (await page.empty()) {\n if (config.debug) {\n console.info(\"Page entries not found\");\n }\n } else {\n // prettier-ignore\n const plugin = EntrypointPlugin.from(await page.view().entries())\n .virtual(file => virtualViewModule(file));\n\n if (config.command === Command.Watch) {\n plugin.watch(async () => {\n declaration.setAlias(await page.clear().getAlias()).build();\n\n return page.view().entries();\n });\n }\n\n const htmlPlugins = (await page.view().html()).map(options => new HtmlRspackPlugin(options));\n const tagsPlugins = (await page.view().tags()).map(options => new HtmlRspackTagsPlugin(options));\n\n plugins.push(plugin, ...htmlPlugins, ...tagsPlugins);\n }\n\n return {\n // Entrypoint watch refreshes the finder and declarations before generating the module.\n plugins: [...plugins, modulePlugin],\n } satisfies RspackConfig;\n },\n manifest: async ({manifest}) => {\n manifest.appendAccessibleResources(await page.accessibleResources()).appendCsp(await page.csp());\n },\n };\n});\n"],"mappings":"AAAA,SAAuC,wBAAgC;AACvE,OAAO,0BAA0B;AAEjC,OAAO,UAAU;AAEjB,SAAQ,uBAAsB;AAC9B,SAAQ,kBAAkB,sBAAqB;AAE/C,SAAQ,oBAAmB;AAC3B,SAAQ,yBAAwB;AAChC,SAAQ,kBAAkB,4BAA2B;AAErD,SAAQ,eAAc;AAEtB,IAAO,eAAQ,aAAa,MAAM;AAC9B,MAAI;AACJ,MAAI;AAEJ,SAAO;AAAA,IACH,MAAM;AAAA,IACN,SAAS,CAAC,EAAC,OAAM,MAAM;AACnB,aAAO,IAAI,KAAK,MAAM;AACtB,oBAAc,IAAI,gBAAgB,MAAM;AAAA,IAC5C;AAAA,IACA,MAAM,MAAM,KAAK,MAAM;AAAA,IACvB,SAAS,OAAO,EAAC,OAAM,MAAM;AACzB,kBAAY,SAAS,MAAM,KAAK,SAAS,CAAC,EAAE,MAAM;AAElD,YAAM,aAAa,aAAa;AAAA,QAC5B,CAAC,cAAc,GAAG;AAAA,UACd,OAAO,YAAY,MAAM,MAAM,MAAM,KAAK,MAAM,GAAG,OAAO,GAAG,UAAQ,CAAC,KAAK,OAAO,KAAK,QAAQ,CAAC,CAAC;AAAA,QACrG;AAAA,MACJ;AACA,YAAM,eAAe,IAAI,qBAAqB,MAAM,WAAW,CAAC;AAEhE,UAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,qBAAa,MAAM,UAAU;AAAA,MACjC;AAEA,YAAM,UAAmB,CAAC;AAE1B,UAAI,MAAM,KAAK,MAAM,GAAG;AACpB,YAAI,OAAO,OAAO;AACd,kBAAQ,KAAK,wBAAwB;AAAA,QACzC;AAAA,MACJ,OAAO;AAEH,cAAM,SAAS,iBAAiB,KAAK,MAAM,KAAK,KAAK,EAAE,QAAQ,CAAC,EAC3D,QAAQ,UAAQ,kBAAkB,IAAI,CAAC;AAE5C,YAAI,OAAO,YAAY,QAAQ,OAAO;AAClC,iBAAO,MAAM,YAAY;AACrB,wBAAY,SAAS,MAAM,KAAK,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;AAE1D,mBAAO,KAAK,KAAK,EAAE,QAAQ;AAAA,UAC/B,CAAC;AAAA,QACL;AAEA,cAAM,eAAe,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG,IAAI,aAAW,IAAI,iBAAiB,OAAO,CAAC;AAC3F,cAAM,eAAe,MAAM,KAAK,KAAK,EAAE,KAAK,GAAG,IAAI,aAAW,IAAI,qBAAqB,OAAO,CAAC;AAE/F,gBAAQ,KAAK,QAAQ,GAAG,aAAa,GAAG,WAAW;AAAA,MACvD;AAEA,aAAO;AAAA;AAAA,QAEH,SAAS,CAAC,GAAG,SAAS,YAAY;AAAA,MACtC;AAAA,IACJ;AAAA,IACA,UAAU,OAAO,EAAC,SAAQ,MAAM;AAC5B,eAAS,0BAA0B,MAAM,KAAK,oBAAoB,CAAC,EAAE,UAAU,MAAM,KAAK,IAAI,CAAC;AAAA,IACnG;AAAA,EACJ;AACJ,CAAC;","names":[]}
|