adnbn 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.js +17 -7
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.js +1 -1
- package/dist/cli/builders/manifest/ManifestV3.js +12 -5
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
- package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
- package/dist/cli/builders/manifest/utils/index.js +19 -0
- package/dist/cli/builders/manifest/utils/index.js.map +1 -0
- package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
- package/dist/cli/builders/manifest/utils/permissions.js +34 -0
- package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
- package/dist/cli/bundler/index.d.ts +1 -0
- package/dist/cli/bundler/index.js +1 -0
- package/dist/cli/bundler/index.js.map +1 -1
- package/dist/cli/bundler/layers.d.ts +5 -0
- package/dist/cli/bundler/layers.js +12 -0
- package/dist/cli/bundler/layers.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +524 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +2 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +5 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +9 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +31 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
- package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
- package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
- package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
- package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
- package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
- package/dist/cli/bundler/plugins/index.d.ts +11 -5
- package/dist/cli/bundler/plugins/index.js +28 -10
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.d.ts +3 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js +32 -0
- package/dist/cli/bundler/plugins/isolated-styles/chunks.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +54 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/manifest/index.js +6 -0
- package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/replace/index.js +5 -0
- package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
- package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
- package/dist/cli/bundler/plugins/types.d.ts +8 -0
- package/dist/cli/bundler/plugins/types.js +1 -0
- package/dist/cli/bundler/plugins/types.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.d.ts +4 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js +12 -0
- package/dist/cli/bundler/plugins/utils/compilation-assets.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +5 -0
- package/dist/cli/bundler/plugins/utils/index.js +14 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js +11 -0
- package/dist/cli/bundler/plugins/utils/runtime-module.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/watch/index.js +5 -0
- package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
- package/dist/cli/bundler/utils/app-filename.d.ts +2 -0
- package/dist/cli/bundler/utils/app-filename.js +19 -0
- package/dist/cli/bundler/utils/app-filename.js.map +1 -0
- package/dist/cli/bundler/utils/assets.d.ts +3 -0
- package/dist/cli/bundler/utils/assets.js +162 -0
- package/dist/cli/bundler/utils/assets.js.map +1 -0
- package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
- package/dist/cli/bundler/utils/chunk-filename.js +93 -0
- package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -1
- package/dist/cli/bundler/utils/index.js +2 -1
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/ContentFinder.d.ts +1 -1
- package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
- package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
- package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +7 -3
- package/dist/cli/entrypoint/parser/ContentParser.js +42 -6
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +5 -1
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/utils/content/default-render.d.ts +3 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js +21 -0
- package/dist/cli/entrypoint/parser/utils/content/default-render.js.map +1 -0
- package/dist/cli/plugins/asset.js +9 -4
- package/dist/cli/plugins/asset.js.map +1 -1
- package/dist/cli/plugins/background/index.js +1 -1
- package/dist/cli/plugins/background/index.js.map +1 -1
- package/dist/cli/plugins/content/Content.d.ts +2 -2
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentDriver.d.ts +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
- package/dist/cli/plugins/content/ContentManager.js +79 -28
- package/dist/cli/plugins/content/ContentManager.js.map +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +2 -2
- package/dist/cli/plugins/content/ContentName.js +8 -7
- package/dist/cli/plugins/content/ContentName.js.map +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +2 -2
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/RelayDriver.d.ts +1 -1
- package/dist/cli/plugins/content/RelayDriver.js +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +7 -0
- package/dist/cli/plugins/content/bundler.js +47 -0
- package/dist/cli/plugins/content/bundler.js.map +1 -0
- package/dist/cli/plugins/content/index.js +121 -62
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/relay-module.d.ts +3 -0
- package/dist/cli/plugins/content/relay-module.js +11 -0
- package/dist/cli/plugins/content/relay-module.js.map +1 -0
- package/dist/cli/plugins/content/types.d.ts +2 -2
- package/dist/cli/plugins/content/utils.d.ts +3 -1
- package/dist/cli/plugins/content/utils.js +8 -1
- package/dist/cli/plugins/content/utils.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
- package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
- package/dist/cli/plugins/icon/icon-module.js +11 -0
- package/dist/cli/plugins/icon/icon-module.js.map +1 -0
- package/dist/cli/plugins/icon/index.js +5 -3
- package/dist/cli/plugins/icon/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +1 -1
- package/dist/cli/plugins/index.js +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/output/index.d.ts +2 -0
- package/dist/cli/plugins/output/index.js +60 -0
- package/dist/cli/plugins/output/index.js.map +1 -0
- package/dist/cli/plugins/output/runtime.d.ts +26 -0
- package/dist/cli/plugins/output/runtime.js +19 -0
- package/dist/cli/plugins/output/runtime.js.map +1 -0
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +2 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +14 -11
- package/dist/content/index.d.ts +3 -0
- package/dist/content/index.js +8 -0
- package/dist/content/index.js.map +1 -0
- package/dist/entry/content/adapters/react/Builder.d.ts +5 -6
- package/dist/entry/content/adapters/react/Builder.js +8 -21
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +6 -12
- package/dist/entry/content/adapters/react/Node.js +9 -25
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/react/index.d.ts +2 -1
- package/dist/entry/content/adapters/react/index.js +3 -1
- package/dist/entry/content/adapters/react/index.js.map +1 -1
- package/dist/entry/content/adapters/react/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js +12 -0
- package/dist/entry/content/adapters/react/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/react/resolvers/render.d.ts +2 -2
- package/dist/entry/content/adapters/react/resolvers/render.js +4 -6
- package/dist/entry/content/adapters/react/resolvers/render.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.d.ts +5 -5
- package/dist/entry/content/adapters/vanilla/Builder.js +9 -15
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +5 -10
- package/dist/entry/content/adapters/vanilla/Node.js +11 -34
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/index.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/index.js +3 -1
- package/dist/entry/content/adapters/vanilla/index.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/resolvers/definition.d.ts +2 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js +9 -0
- package/dist/entry/content/adapters/vanilla/resolvers/definition.js.map +1 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.d.ts +3 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js +15 -0
- package/dist/entry/content/adapters/vanilla/resolvers/render.js.map +1 -0
- package/dist/entry/content/index.d.ts +5 -1
- package/dist/entry/content/index.js +8 -1
- package/dist/entry/content/index.js.map +1 -1
- package/dist/entry/content/lifecycle/Builder.d.ts +26 -0
- package/dist/entry/content/lifecycle/Builder.js +212 -0
- package/dist/entry/content/lifecycle/Builder.js.map +1 -0
- package/dist/entry/content/lifecycle/IsolationSetup.d.ts +16 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js +37 -0
- package/dist/entry/content/lifecycle/IsolationSetup.js.map +1 -0
- package/dist/entry/content/lifecycle/MountBuilder.d.ts +8 -0
- package/dist/entry/content/lifecycle/MountBuilder.js +57 -0
- package/dist/entry/content/lifecycle/MountBuilder.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/Context.d.ts +5 -2
- package/dist/entry/content/lifecycle/context/Context.js +73 -0
- package/dist/entry/content/lifecycle/context/Context.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/context}/EventEmitter.js +3 -3
- package/dist/entry/content/lifecycle/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/lifecycle/context/ManagedContext.d.ts +5 -0
- package/dist/entry/content/{core → lifecycle/context}/ManagedContext.js +2 -2
- package/dist/entry/content/lifecycle/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/lifecycle/context/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/context/index.js +9 -0
- package/dist/entry/content/lifecycle/context/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AbstractMarker.js +3 -3
- package/dist/entry/content/lifecycle/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/AttributeMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.d.ts +2 -2
- package/dist/entry/content/{core → lifecycle/markers}/WeakMarker.js +2 -2
- package/dist/entry/content/lifecycle/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/lifecycle/markers/index.d.ts +3 -0
- package/dist/entry/content/lifecycle/markers/index.js +9 -0
- package/dist/entry/content/lifecycle/markers/index.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.d.ts +5 -2
- package/dist/entry/content/{core → lifecycle/nodes}/EventNode.js +14 -2
- package/dist/entry/content/lifecycle/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.d.ts +29 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js +187 -0
- package/dist/entry/content/lifecycle/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MarkerNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.d.ts +4 -2
- package/dist/entry/content/{core → lifecycle/nodes}/MountNode.js +8 -2
- package/dist/entry/content/lifecycle/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/{core → lifecycle/nodes}/Node.d.ts +3 -2
- package/dist/entry/content/{core → lifecycle/nodes}/Node.js +5 -2
- package/dist/entry/content/lifecycle/nodes/Node.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.d.ts +19 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js +75 -0
- package/dist/entry/content/lifecycle/nodes/RenderNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.d.ts +21 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js +121 -0
- package/dist/entry/content/lifecycle/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/index.d.ts +7 -0
- package/dist/entry/content/lifecycle/nodes/index.js +17 -0
- package/dist/entry/content/lifecycle/nodes/index.js.map +1 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/lifecycle/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/resolvers/anchor.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/anchor.js +2 -2
- package/dist/entry/content/resolvers/anchor.js.map +1 -0
- package/dist/entry/content/resolvers/container.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/container.js +2 -2
- package/dist/entry/content/resolvers/container.js.map +1 -0
- package/dist/entry/content/resolvers/definition.d.ts +5 -0
- package/dist/entry/content/resolvers/definition.js +24 -0
- package/dist/entry/content/resolvers/definition.js.map +1 -0
- package/dist/entry/content/{core/resolvers → resolvers}/index.d.ts +1 -1
- package/dist/entry/content/{core/resolvers → resolvers}/index.js +1 -1
- package/dist/entry/content/resolvers/index.js.map +1 -0
- package/dist/entry/content/resolvers/mount.d.ts +2 -0
- package/dist/entry/content/{core/resolvers → resolvers}/mount.js +3 -3
- package/dist/entry/content/resolvers/mount.js.map +1 -0
- package/dist/entry/content/resolvers/target.d.ts +3 -0
- package/dist/entry/content/resolvers/target.js +34 -0
- package/dist/entry/content/resolvers/target.js.map +1 -0
- package/dist/entry/content/resolvers/watch.d.ts +6 -0
- package/dist/entry/content/{core/resolvers → resolvers}/watch.js +15 -11
- package/dist/entry/content/resolvers/watch.js.map +1 -0
- package/dist/entry/relay/Builder.d.ts +8 -8
- package/dist/entry/relay/Builder.js +32 -19
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/TransportBuilder.d.ts +3 -2
- package/dist/entry/relay/TransportBuilder.js +3 -3
- package/dist/entry/relay/TransportBuilder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +5 -2
- package/dist/entry/relay/index.js +8 -2
- package/dist/entry/relay/index.js.map +1 -1
- package/dist/entry/relay/resolvers/definition.d.ts +4 -0
- package/dist/entry/relay/resolvers/definition.js +16 -0
- package/dist/entry/relay/resolvers/definition.js.map +1 -0
- package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
- package/dist/locale/adapters/react/ReactLocale.js +41 -0
- package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
- package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
- package/dist/locale/adapters/react/index.d.ts +4 -2
- package/dist/locale/adapters/react/index.js +6 -4
- package/dist/locale/adapters/react/index.js.map +1 -1
- package/dist/locale/adapters/react/types.d.ts +22 -0
- package/dist/locale/adapters/react/types.js +1 -0
- package/dist/locale/adapters/react/types.js.map +1 -0
- package/dist/locale/helpers.d.ts +4 -5
- package/dist/locale/helpers.js +1 -1
- package/dist/locale/helpers.js.map +1 -1
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +1 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/providers/AbstractLocale.d.ts +4 -4
- package/dist/locale/providers/AbstractLocale.js +13 -94
- package/dist/locale/providers/AbstractLocale.js.map +1 -1
- package/dist/locale/providers/CustomLocale.d.ts +3 -3
- package/dist/locale/providers/CustomLocale.js +6 -5
- package/dist/locale/providers/CustomLocale.js.map +1 -1
- package/dist/locale/providers/DynamicLocale.d.ts +18 -11
- package/dist/locale/providers/DynamicLocale.js +60 -47
- package/dist/locale/providers/DynamicLocale.js.map +1 -1
- package/dist/locale/providers/NativeLocale.d.ts +4 -7
- package/dist/locale/providers/NativeLocale.js +5 -14
- package/dist/locale/providers/NativeLocale.js.map +1 -1
- package/dist/locale/providers/ObservableLocale.d.ts +35 -0
- package/dist/locale/providers/ObservableLocale.js +179 -0
- package/dist/locale/providers/ObservableLocale.js.map +1 -0
- package/dist/locale/providers/index.d.ts +2 -1
- package/dist/locale/providers/index.js +3 -1
- package/dist/locale/providers/index.js.map +1 -1
- package/dist/locale/storage/LocaleStorage.d.ts +11 -0
- package/dist/locale/storage/LocaleStorage.js +40 -0
- package/dist/locale/storage/LocaleStorage.js.map +1 -0
- package/dist/locale/storage/index.d.ts +1 -0
- package/dist/locale/storage/index.js +5 -0
- package/dist/locale/storage/index.js.map +1 -0
- package/dist/main/content.d.ts +4 -6
- package/dist/main/content.js +3 -16
- package/dist/main/content.js.map +1 -1
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +1 -0
- package/dist/main/index.js +1 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +3 -3
- package/dist/main/relay.js +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +1 -4
- package/dist/main/sandbox.js +2 -1
- package/dist/main/sandbox.js.map +1 -1
- package/dist/main/service.d.ts +1 -2
- package/dist/main/service.js.map +1 -1
- package/dist/main/sidebar.d.ts +2 -5
- package/dist/main/sidebar.js +3 -3
- package/dist/main/sidebar.js.map +1 -1
- package/dist/message/index.d.ts +2 -4
- package/dist/message/index.js.map +1 -1
- package/dist/offscreen/index.d.ts +2 -6
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/RelayPermission.js +1 -1
- package/dist/relay/index.d.ts +2 -5
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/service/index.d.ts +2 -6
- package/dist/service/index.js.map +1 -1
- package/dist/shared/content/index.d.ts +1 -0
- package/dist/shared/content/index.js +6 -0
- package/dist/shared/content/index.js.map +1 -0
- package/dist/shared/content/isolation.d.ts +4 -0
- package/dist/shared/content/isolation.js +63 -0
- package/dist/shared/content/isolation.js.map +1 -0
- package/dist/shared/locale/index.d.ts +5 -0
- package/dist/shared/locale/index.js +21 -0
- package/dist/shared/locale/index.js.map +1 -0
- package/dist/shared/locale/keys.d.ts +5 -0
- package/dist/shared/locale/keys.js +33 -0
- package/dist/shared/locale/keys.js.map +1 -0
- package/dist/shared/locale/language.d.ts +4 -0
- package/dist/shared/locale/language.js +23 -0
- package/dist/shared/locale/language.js.map +1 -0
- package/dist/shared/locale/messages.d.ts +3 -0
- package/dist/shared/locale/messages.js +9 -0
- package/dist/shared/locale/messages.js.map +1 -0
- package/dist/shared/locale/plural.d.ts +2 -0
- package/dist/shared/locale/plural.js +81 -0
- package/dist/shared/locale/plural.js.map +1 -0
- package/dist/shared/locale/substitutions.d.ts +10 -0
- package/dist/shared/locale/substitutions.js +32 -0
- package/dist/shared/locale/substitutions.js.map +1 -0
- package/dist/types/background.d.ts +1 -1
- package/dist/types/background.js.map +1 -1
- package/dist/types/command.d.ts +1 -1
- package/dist/types/command.js.map +1 -1
- package/dist/types/content/adapters/index.d.ts +2 -0
- package/dist/types/content/adapters/index.js +1 -0
- package/dist/types/content/adapters/index.js.map +1 -0
- package/dist/types/content/adapters/react.d.ts +4 -0
- package/dist/types/content/adapters/react.js +1 -0
- package/dist/types/content/adapters/react.js.map +1 -0
- package/dist/types/content/adapters/vanilla.d.ts +1 -0
- package/dist/types/content/adapters/vanilla.js +1 -0
- package/dist/types/content/adapters/vanilla.js.map +1 -0
- package/dist/types/content/boundary.d.ts +17 -0
- package/dist/types/content/boundary.js +1 -0
- package/dist/types/content/boundary.js.map +1 -0
- package/dist/types/{content.d.ts → content/common.d.ts} +119 -59
- package/dist/types/{content.js → content/common.js} +23 -2
- package/dist/types/content/common.js.map +1 -0
- package/dist/types/content/definition.d.ts +61 -0
- package/dist/types/content/definition.js +1 -0
- package/dist/types/content/definition.js.map +1 -0
- package/dist/types/content/index.d.ts +7 -0
- package/dist/types/content/index.js +2 -0
- package/dist/types/content/index.js.map +1 -0
- package/dist/types/content/prepare.d.ts +9 -0
- package/dist/types/content/prepare.js +1 -0
- package/dist/types/content/prepare.js.map +1 -0
- package/dist/types/content/render.d.ts +6 -0
- package/dist/types/content/render.js +1 -0
- package/dist/types/content/render.js.map +1 -0
- package/dist/types/content/target.d.ts +13 -0
- package/dist/types/content/target.js +1 -0
- package/dist/types/content/target.js.map +1 -0
- package/dist/types/entrypoint.d.ts +20 -0
- package/dist/types/entrypoint.js +4 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js.map +1 -1
- package/dist/types/language.d.ts +57 -0
- package/dist/types/language.js +62 -0
- package/dist/types/language.js.map +1 -0
- package/dist/types/locale.d.ts +34 -63
- package/dist/types/locale.js +62 -119
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +11 -8
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/page.d.ts +8 -0
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +15 -7
- package/dist/types/relay.js.map +1 -1
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/sandbox.js.map +1 -1
- package/dist/types/service.d.ts +10 -1
- package/dist/types/service.js.map +1 -1
- package/dist/types/sidebar.d.ts +9 -0
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/virtual/icon.d.ts +2 -0
- package/dist/virtual/icon.js +5 -0
- package/dist/virtual/icon.js.map +1 -0
- package/dist/virtual/locale.d.ts +7 -0
- package/dist/virtual/locale.js +13 -0
- package/dist/virtual/locale.js.map +1 -0
- package/dist/virtual/modules.d.ts +41 -0
- package/dist/virtual/offscreen.d.ts +3 -0
- package/dist/virtual/offscreen.js +5 -0
- package/dist/virtual/offscreen.js.map +1 -0
- package/dist/virtual/page.d.ts +2 -0
- package/dist/virtual/page.js +5 -0
- package/dist/virtual/page.js.map +1 -0
- package/dist/virtual/popup.d.ts +3 -0
- package/dist/virtual/popup.js +5 -0
- package/dist/virtual/popup.js.map +1 -0
- package/dist/virtual/relay.d.ts +3 -0
- package/dist/virtual/relay.js +5 -0
- package/dist/virtual/relay.js.map +1 -0
- package/dist/virtual/runtime.d.ts +8 -0
- package/dist/virtual/runtime.js +9 -0
- package/dist/virtual/runtime.js.map +1 -0
- package/dist/virtual/sandbox.d.ts +3 -0
- package/dist/virtual/sandbox.js +5 -0
- package/dist/virtual/sandbox.js.map +1 -0
- package/dist/virtual/sidebar.d.ts +3 -0
- package/dist/virtual/sidebar.js +5 -0
- package/dist/virtual/sidebar.js.map +1 -0
- package/package.json +53 -23
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/scripts/merge-coverage.mjs +12 -0
- package/scripts/pre-commit.mjs +22 -0
- package/scripts/test-inventory.mjs +38 -0
- package/scripts/test-run.mjs +25 -0
- package/types/client.d.ts +15 -0
- package/dist/cli/builders/manifest/utils.d.ts +0 -32
- package/dist/cli/builders/manifest/utils.js +0 -209
- package/dist/cli/builders/manifest/utils.js.map +0 -1
- package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
- package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
- package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
- package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
- package/dist/cli/bundler/utils/output.d.ts +0 -2
- package/dist/cli/bundler/utils/output.js +0 -15
- package/dist/cli/bundler/utils/output.js.map +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/account.options.d.ts +0 -1
- package/dist/cli/entrypoint/finder/tests/fixtures/options/discovery/advanced.options/index.d.ts +0 -1
- package/dist/cli/plugins/output.d.ts +0 -2
- package/dist/cli/plugins/output.js +0 -32
- package/dist/cli/plugins/output.js.map +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.d.ts +0 -1
- package/dist/entry/content/adapters/react/resolvers/index.js +0 -2
- package/dist/entry/content/adapters/react/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/Builder.d.ts +0 -27
- package/dist/entry/content/core/Builder.js +0 -124
- package/dist/entry/content/core/Builder.js.map +0 -1
- package/dist/entry/content/core/Context.js +0 -43
- package/dist/entry/content/core/Context.js.map +0 -1
- package/dist/entry/content/core/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/EventNode.js.map +0 -1
- package/dist/entry/content/core/ManagedContext.d.ts +0 -5
- package/dist/entry/content/core/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/MountBuilder.d.ts +0 -10
- package/dist/entry/content/core/MountBuilder.js +0 -40
- package/dist/entry/content/core/MountBuilder.js.map +0 -1
- package/dist/entry/content/core/MountNode.js.map +0 -1
- package/dist/entry/content/core/Node.js.map +0 -1
- package/dist/entry/content/core/WeakMarker.js.map +0 -1
- package/dist/entry/content/core/resolvers/anchor.d.ts +0 -2
- package/dist/entry/content/core/resolvers/anchor.js.map +0 -1
- package/dist/entry/content/core/resolvers/container.d.ts +0 -2
- package/dist/entry/content/core/resolvers/container.js.map +0 -1
- package/dist/entry/content/core/resolvers/definition.d.ts +0 -3
- package/dist/entry/content/core/resolvers/definition.js +0 -12
- package/dist/entry/content/core/resolvers/definition.js.map +0 -1
- package/dist/entry/content/core/resolvers/index.js.map +0 -1
- package/dist/entry/content/core/resolvers/mount.d.ts +0 -2
- package/dist/entry/content/core/resolvers/mount.js.map +0 -1
- package/dist/entry/content/core/resolvers/render.d.ts +0 -3
- package/dist/entry/content/core/resolvers/render.js +0 -18
- package/dist/entry/content/core/resolvers/render.js.map +0 -1
- package/dist/entry/content/core/resolvers/watch.d.ts +0 -4
- package/dist/entry/content/core/resolvers/watch.js.map +0 -1
- package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
- package/dist/locale/adapters/react/LocaleProvider.js +0 -58
- package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
- package/dist/locale/adapters/react/context.d.ts +0 -14
- package/dist/locale/adapters/react/context.js +0 -25
- package/dist/locale/adapters/react/context.js.map +0 -1
- package/dist/locale/utils.d.ts +0 -11
- package/dist/locale/utils.js +0 -67
- package/dist/locale/utils.js.map +0 -1
- package/dist/types/content.js.map +0 -1
- /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
- /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
- /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { Command, Mode, PackageName } from "./../../../../types/app.js";
|
|
2
2
|
import { Browser } from "./../../../../types/browser.js";
|
|
3
3
|
import { RelayAllFrames, RelayMethod } from "./../../../../types/relay.js";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
ContentScriptIsolation,
|
|
6
|
+
ContentScriptShadowMode,
|
|
7
|
+
ContentScriptAppend,
|
|
8
|
+
ContentScriptDeclarative,
|
|
9
|
+
ContentScriptMarker,
|
|
10
|
+
ContentScriptWorld
|
|
11
|
+
} from "./../../../../types/content/index.js";
|
|
5
12
|
import { OffscreenReason } from "./../../../../types/offscreen.js";
|
|
6
13
|
import { SandboxAllow, SandboxSource } from "./../../../../types/sandbox.js";
|
|
7
14
|
import { CspSource } from "./../../../../types/csp.js";
|
|
@@ -55,6 +62,20 @@ var core_default = () => {
|
|
|
55
62
|
value
|
|
56
63
|
});
|
|
57
64
|
});
|
|
65
|
+
Object.entries(ContentScriptIsolation).forEach(([key, value]) => {
|
|
66
|
+
resolvers.push({ from: PackageName, target: "ContentScriptIsolation", name: key, value });
|
|
67
|
+
});
|
|
68
|
+
Object.entries(ContentScriptShadowMode).forEach(([key, value]) => {
|
|
69
|
+
resolvers.push({ from: PackageName, target: "ContentScriptShadowMode", name: key, value });
|
|
70
|
+
});
|
|
71
|
+
Object.entries(ContentScriptWorld).forEach(([key, value]) => {
|
|
72
|
+
resolvers.push({
|
|
73
|
+
from: PackageName,
|
|
74
|
+
target: "ContentScriptWorld",
|
|
75
|
+
name: key,
|
|
76
|
+
value
|
|
77
|
+
});
|
|
78
|
+
});
|
|
58
79
|
Object.entries(CspSource).forEach(([key, value]) => {
|
|
59
80
|
resolvers.push({
|
|
60
81
|
from: PackageName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/injectors/core.ts"],"sourcesContent":["import {Command, Mode, PackageName} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {RelayAllFrames, RelayMethod} from \"@typing/relay\";\nimport {ContentScriptAppend
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/injectors/core.ts"],"sourcesContent":["import {Command, Mode, PackageName} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {RelayAllFrames, RelayMethod} from \"@typing/relay\";\nimport {\n ContentScriptIsolation,\n ContentScriptShadowMode,\n ContentScriptAppend,\n ContentScriptDeclarative,\n ContentScriptMarker,\n ContentScriptWorld,\n} from \"@typing/content\";\nimport {OffscreenReason} from \"@typing/offscreen\";\nimport {SandboxAllow, SandboxSource} from \"@typing/sandbox\";\nimport {CspSource} from \"@typing/csp\";\n\nimport {Injector} from \"../types\";\n\nexport default (): Injector[] => {\n const resolvers: Injector[] = [];\n\n Object.entries(Browser).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Browser\",\n name: key,\n value,\n });\n });\n\n Object.entries(Mode).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Mode\",\n name: key,\n value,\n });\n });\n\n Object.entries(Command).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"Command\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptDeclarative).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptDeclarative\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptAppend).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptAppend\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptMarker).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptMarker\",\n name: key,\n value,\n });\n });\n\n Object.entries(ContentScriptIsolation).forEach(([key, value]) => {\n resolvers.push({from: PackageName, target: \"ContentScriptIsolation\", name: key, value});\n });\n\n Object.entries(ContentScriptShadowMode).forEach(([key, value]) => {\n resolvers.push({from: PackageName, target: \"ContentScriptShadowMode\", name: key, value});\n });\n\n Object.entries(ContentScriptWorld).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"ContentScriptWorld\",\n name: key,\n value,\n });\n });\n\n Object.entries(CspSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"CspSource\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayMethod).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayMethod\",\n name: key,\n value,\n });\n });\n\n Object.entries(RelayAllFrames).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"RelayAllFrames\",\n name: key,\n value,\n });\n });\n\n Object.entries(OffscreenReason).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"OffscreenReason\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxAllow).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxAllow\",\n name: key,\n value,\n });\n });\n\n Object.entries(SandboxSource).forEach(([key, value]) => {\n resolvers.push({\n from: PackageName,\n target: \"SandboxSource\",\n name: key,\n value,\n });\n });\n\n return resolvers;\n};\n"],"mappings":"AAAA,SAAQ,SAAS,MAAM,mBAAkB;AACzC,SAAQ,eAAc;AACtB,SAAQ,gBAAgB,mBAAkB;AAC1C;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAQ,uBAAsB;AAC9B,SAAQ,cAAc,qBAAoB;AAC1C,SAAQ,iBAAgB;AAIxB,IAAO,eAAQ,MAAkB;AAC7B,QAAM,YAAwB,CAAC;AAE/B,SAAO,QAAQ,OAAO,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,IAAI,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC3C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,OAAO,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC9C,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,wBAAwB,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC/D,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CA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ACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,cAAc,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACrD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,eAAe,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACtD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,YAAY,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACnD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO,QAAQ,aAAa,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpD,cAAU,KAAK;AAAA,MACX,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN;AAAA,IACJ,CAAC;AAAA,EACL,CAAC;AAED,SAAO;AACX;","names":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import SourceFile from "../SourceFile.js";
|
|
3
|
+
import NodeFinder from "./NodeFinder.js";
|
|
4
|
+
import { type ExportValue } from "./types.js";
|
|
5
|
+
/** Describes default exports without assigning them a renderer, initializer or configuration role. */
|
|
6
|
+
export default class ExportParser {
|
|
7
|
+
private readonly sourceFile;
|
|
8
|
+
private readonly nodeFinder;
|
|
9
|
+
private readonly getCompilerOptions;
|
|
10
|
+
constructor(sourceFile: SourceFile, nodeFinder: NodeFinder, getCompilerOptions: () => ts.CompilerOptions);
|
|
11
|
+
parseDefault(): ExportValue | undefined;
|
|
12
|
+
private describeExpression;
|
|
13
|
+
private describeType;
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { ExportValueKind } from "./types.js";
|
|
3
|
+
class ExportParser {
|
|
4
|
+
constructor(sourceFile, nodeFinder, getCompilerOptions) {
|
|
5
|
+
this.sourceFile = sourceFile;
|
|
6
|
+
this.nodeFinder = nodeFinder;
|
|
7
|
+
this.getCompilerOptions = getCompilerOptions;
|
|
8
|
+
}
|
|
9
|
+
sourceFile;
|
|
10
|
+
nodeFinder;
|
|
11
|
+
getCompilerOptions;
|
|
12
|
+
parseDefault() {
|
|
13
|
+
const declaration = this.nodeFinder.findDefaultExport();
|
|
14
|
+
if (!declaration) return void 0;
|
|
15
|
+
if (ts.isFunctionDeclaration(declaration)) return { kind: ExportValueKind.Function, properties: [] };
|
|
16
|
+
if (ts.isClassDeclaration(declaration)) return { kind: ExportValueKind.Class, properties: [] };
|
|
17
|
+
if (ts.isExportAssignment(declaration)) {
|
|
18
|
+
const value = this.describeExpression(declaration.expression);
|
|
19
|
+
if (value) return value;
|
|
20
|
+
}
|
|
21
|
+
return this.describeType();
|
|
22
|
+
}
|
|
23
|
+
describeExpression(expression) {
|
|
24
|
+
while (ts.isParenthesizedExpression(expression) || ts.isAsExpression(expression) || ts.isSatisfiesExpression(expression) || ts.isTypeAssertionExpression(expression) || ts.isNonNullExpression(expression)) {
|
|
25
|
+
expression = expression.expression;
|
|
26
|
+
}
|
|
27
|
+
if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression))
|
|
28
|
+
return { kind: ExportValueKind.Function, properties: [] };
|
|
29
|
+
if (ts.isClassExpression(expression)) return { kind: ExportValueKind.Class, properties: [] };
|
|
30
|
+
if (ts.isJsxElement(expression) || ts.isJsxSelfClosingElement(expression) || ts.isJsxFragment(expression))
|
|
31
|
+
return { kind: ExportValueKind.Jsx, properties: [] };
|
|
32
|
+
if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression))
|
|
33
|
+
return { kind: ExportValueKind.String, properties: [], value: expression.text };
|
|
34
|
+
if (ts.isNumericLiteral(expression))
|
|
35
|
+
return { kind: ExportValueKind.Number, properties: [], value: Number(expression.text) };
|
|
36
|
+
if (ts.isObjectLiteralExpression(expression)) {
|
|
37
|
+
const properties = /* @__PURE__ */ new Set();
|
|
38
|
+
for (const property of expression.properties) {
|
|
39
|
+
if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return void 0;
|
|
40
|
+
properties.add(property.name.text);
|
|
41
|
+
}
|
|
42
|
+
return { kind: ExportValueKind.Object, properties: [...properties] };
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
describeType() {
|
|
47
|
+
const filename = this.sourceFile.getSourceFile().fileName;
|
|
48
|
+
const program = ts.createProgram([filename], { ...this.getCompilerOptions(), noEmit: true });
|
|
49
|
+
const entry = program.getSourceFile(filename);
|
|
50
|
+
if (!entry) return void 0;
|
|
51
|
+
const checker = program.getTypeChecker();
|
|
52
|
+
const module = checker.getSymbolAtLocation(entry);
|
|
53
|
+
const exported = module && checker.getExportsOfModule(module).find((symbol2) => symbol2.name === "default");
|
|
54
|
+
if (!exported) return void 0;
|
|
55
|
+
const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;
|
|
56
|
+
if (!(symbol.flags & ts.SymbolFlags.Value)) return void 0;
|
|
57
|
+
const type = checker.getTypeOfSymbolAtLocation(symbol, entry);
|
|
58
|
+
const properties = type.getProperties().map((property) => property.name);
|
|
59
|
+
if (type.getCallSignatures().length > 0) return { kind: ExportValueKind.Function, properties };
|
|
60
|
+
if (type.getConstructSignatures().length > 0) return { kind: ExportValueKind.Class, properties };
|
|
61
|
+
if (type.flags & ts.TypeFlags.StringLike)
|
|
62
|
+
return { kind: ExportValueKind.String, properties, ...type.isStringLiteral() ? { value: type.value } : {} };
|
|
63
|
+
if (type.flags & ts.TypeFlags.NumberLike)
|
|
64
|
+
return { kind: ExportValueKind.Number, properties, ...type.isNumberLiteral() ? { value: type.value } : {} };
|
|
65
|
+
return { kind: type.flags & ts.TypeFlags.Object ? ExportValueKind.Object : ExportValueKind.Other, properties };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
ExportParser as default
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=ExportParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ExportParser.ts"],"sourcesContent":["import ts from \"typescript\";\n\nimport SourceFile from \"../SourceFile\";\nimport NodeFinder from \"./NodeFinder\";\nimport {ExportValueKind, type ExportValue} from \"./types\";\n\n/** Describes default exports without assigning them a renderer, initializer or configuration role. */\nexport default class ExportParser {\n constructor(\n private readonly sourceFile: SourceFile,\n private readonly nodeFinder: NodeFinder,\n private readonly getCompilerOptions: () => ts.CompilerOptions\n ) {}\n\n public parseDefault(): ExportValue | undefined {\n const declaration = this.nodeFinder.findDefaultExport();\n if (!declaration) return undefined;\n if (ts.isFunctionDeclaration(declaration)) return {kind: ExportValueKind.Function, properties: []};\n if (ts.isClassDeclaration(declaration)) return {kind: ExportValueKind.Class, properties: []};\n if (ts.isExportAssignment(declaration)) {\n const value = this.describeExpression(declaration.expression);\n if (value) return value;\n }\n return this.describeType();\n }\n\n private describeExpression(expression: ts.Expression): ExportValue | undefined {\n while (\n ts.isParenthesizedExpression(expression) ||\n ts.isAsExpression(expression) ||\n ts.isSatisfiesExpression(expression) ||\n ts.isTypeAssertionExpression(expression) ||\n ts.isNonNullExpression(expression)\n ) {\n expression = expression.expression;\n }\n if (ts.isArrowFunction(expression) || ts.isFunctionExpression(expression))\n return {kind: ExportValueKind.Function, properties: []};\n if (ts.isClassExpression(expression)) return {kind: ExportValueKind.Class, properties: []};\n if (ts.isJsxElement(expression) || ts.isJsxSelfClosingElement(expression) || ts.isJsxFragment(expression))\n return {kind: ExportValueKind.Jsx, properties: []};\n if (ts.isStringLiteral(expression) || ts.isNoSubstitutionTemplateLiteral(expression))\n return {kind: ExportValueKind.String, properties: [], value: expression.text};\n if (ts.isNumericLiteral(expression))\n return {kind: ExportValueKind.Number, properties: [], value: Number(expression.text)};\n if (ts.isObjectLiteralExpression(expression)) {\n const properties = new Set<string>();\n for (const property of expression.properties) {\n // Resolve spread/computed properties through the checker, without evaluating their values.\n if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return undefined;\n properties.add(property.name.text);\n }\n return {kind: ExportValueKind.Object, properties: [...properties]};\n }\n return undefined;\n }\n\n private describeType(): ExportValue | undefined {\n const filename = this.sourceFile.getSourceFile().fileName;\n // Keep the program local to this analysis: a watch rebuild must see changed imported exports.\n const program = ts.createProgram([filename], {...this.getCompilerOptions(), noEmit: true});\n const entry = program.getSourceFile(filename);\n if (!entry) return undefined;\n const checker = program.getTypeChecker();\n const module = checker.getSymbolAtLocation(entry);\n const exported = module && checker.getExportsOfModule(module).find(symbol => symbol.name === \"default\");\n if (!exported) return undefined;\n const symbol = exported.flags & ts.SymbolFlags.Alias ? checker.getAliasedSymbol(exported) : exported;\n if (!(symbol.flags & ts.SymbolFlags.Value)) return undefined;\n const type = checker.getTypeOfSymbolAtLocation(symbol, entry);\n const properties = type.getProperties().map(property => property.name);\n if (type.getCallSignatures().length > 0) return {kind: ExportValueKind.Function, properties};\n if (type.getConstructSignatures().length > 0) return {kind: ExportValueKind.Class, properties};\n if (type.flags & ts.TypeFlags.StringLike)\n return {kind: ExportValueKind.String, properties, ...(type.isStringLiteral() ? {value: type.value} : {})};\n if (type.flags & ts.TypeFlags.NumberLike)\n return {kind: ExportValueKind.Number, properties, ...(type.isNumberLiteral() ? {value: type.value} : {})};\n return {kind: type.flags & ts.TypeFlags.Object ? ExportValueKind.Object : ExportValueKind.Other, properties};\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAIf,SAAQ,uBAAwC;AAGhD,MAAO,aAA2B;AAAA,EAC9B,YACqB,YACA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gB,OAAO,WAAU;AAC7F,QAAI,KAAK,QAAQ,GAAG,UAAU;AAC1B,aAAO,EAAC,MAAM,gBAAgB,QAAQ,YAAY,GAAI,KAAK,gBAAgB,IAAI,EAAC,OAAO,KAAK,MAAK,IAAI,CAAC,EAAE;AAC5G,QAAI,KAAK,QAAQ,GAAG,UAAU;AAC1B,aAAO,EAAC,MAAM,gBAAgB,QAAQ,YAAY,GAAI,KAAK,gBAAgB,IAAI,EAAC,OAAO,KAAK,MAAK,IAAI,CAAC,EAAE;AAC5G,WAAO,EAAC,MAAM,KAAK,QAAQ,GAAG,UAAU,SAAS,gBAAgB,SAAS,gBAAgB,OAAO,WAAU;AAAA,EAC/G;AACJ;","names":["symbol"]}
|
|
@@ -11,6 +11,8 @@ export default class NodeFinder {
|
|
|
11
11
|
* @param sourceFile The source file to find nodes in
|
|
12
12
|
*/
|
|
13
13
|
constructor(sourceFile: SourceFile);
|
|
14
|
+
/** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */
|
|
15
|
+
findDefaultExport(): ts.Statement | undefined;
|
|
14
16
|
/**
|
|
15
17
|
* Generic method to find a node of a specific type by name in the AST.
|
|
16
18
|
*
|
|
@@ -9,6 +9,15 @@ class NodeFinder {
|
|
|
9
9
|
this.sourceFile = sourceFile;
|
|
10
10
|
}
|
|
11
11
|
sourceFile;
|
|
12
|
+
/** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */
|
|
13
|
+
findDefaultExport() {
|
|
14
|
+
return this.sourceFile.getSourceFile().statements.find(
|
|
15
|
+
(statement) => {
|
|
16
|
+
var _a;
|
|
17
|
+
return ts.isExportAssignment(statement) && !statement.isExportEquals || ts.canHaveModifiers(statement) && ((_a = ts.getModifiers(statement)) == null ? void 0 : _a.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword)) || ts.isExportDeclaration(statement) && !statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause) && statement.exportClause.elements.some((item) => !item.isTypeOnly && item.name.text === "default");
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
12
21
|
/**
|
|
13
22
|
* Generic method to find a node of a specific type by name in the AST.
|
|
14
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/NodeFinder.ts"],"sourcesContent":["import ts from \"typescript\";\nimport SourceFile from \"../SourceFile\";\n\n/**\n * Finds nodes in the TypeScript AST.\n */\nexport default class NodeFinder {\n /**\n * Constructor for the NodeFinder.\n *\n * @param sourceFile The source file to find nodes in\n */\n constructor(private sourceFile: SourceFile) {}\n\n /**\n * Generic method to find a node of a specific type by name in the AST.\n *\n * @param predicate The predicate to match the node\n * @param name The name to search for\n * @returns The found node or undefined if not found\n */\n public findNodeByName<T extends ts.Node>(\n predicate: (node: ts.Node, name: string) => node is T,\n name: string\n ): T | undefined {\n const sf = this.sourceFile.getSourceFile();\n let found: T | undefined;\n\n const visit = (node: ts.Node) => {\n if (predicate(node, name)) {\n found = node;\n } else {\n ts.forEachChild(node, visit);\n }\n };\n\n ts.forEachChild(sf, visit);\n return found;\n }\n\n /**\n * Searches the AST of this file for a class declaration by name.\n *\n * @param name The name of the class to find\n * @returns The class declaration or undefined if not found\n */\n public findClassDeclaration(name: string): ts.ClassDeclaration | undefined {\n return this.findNodeByName<ts.ClassDeclaration>(\n (node, searchName): node is ts.ClassDeclaration =>\n ts.isClassDeclaration(node) && node.name?.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a type alias declaration by name.\n *\n * @param name The name of the type alias to find\n * @returns The type alias declaration or undefined if not found\n */\n public findTypeAliasDeclaration(name: string): ts.TypeAliasDeclaration | undefined {\n return this.findNodeByName<ts.TypeAliasDeclaration>(\n (node, searchName): node is ts.TypeAliasDeclaration =>\n ts.isTypeAliasDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an interface declaration by name.\n *\n * @param name The name of the interface to find\n * @returns The interface declaration or undefined if not found\n */\n public findInterfaceDeclaration(name: string): ts.InterfaceDeclaration | undefined {\n return this.findNodeByName<ts.InterfaceDeclaration>(\n (node, searchName): node is ts.InterfaceDeclaration =>\n ts.isInterfaceDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a variable declaration by name.\n *\n * @param name The name of the variable to find\n * @returns The variable declaration or undefined if not found\n */\n public findVariableDeclaration(name: string): ts.VariableDeclaration | undefined {\n return this.findNodeByName<ts.VariableDeclaration>(\n (node, searchName): node is ts.VariableDeclaration =>\n ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an import equals declaration by name.\n *\n * @param name The name of the import equals declaration to find\n * @returns The import equals declaration or undefined if not found\n */\n public findImportEqualsDeclaration(name: string): ts.ImportEqualsDeclaration | undefined {\n return this.findNodeByName<ts.ImportEqualsDeclaration>(\n (node, searchName): node is ts.ImportEqualsDeclaration =>\n ts.isImportEqualsDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAMf,MAAO,WAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,YAAoB,YAAwB;AAAxB;AAAA,EAAyB;AAAA,EAAzB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/NodeFinder.ts"],"sourcesContent":["import ts from \"typescript\";\nimport SourceFile from \"../SourceFile\";\n\n/**\n * Finds nodes in the TypeScript AST.\n */\nexport default class NodeFinder {\n /**\n * Constructor for the NodeFinder.\n *\n * @param sourceFile The source file to find nodes in\n */\n constructor(private sourceFile: SourceFile) {}\n\n /** Finds default-export syntax without traversing nested scopes; skips explicitly type-only re-exports. */\n public findDefaultExport(): ts.Statement | undefined {\n return this.sourceFile\n .getSourceFile()\n .statements.find(\n statement =>\n (ts.isExportAssignment(statement) && !statement.isExportEquals) ||\n (ts.canHaveModifiers(statement) &&\n ts.getModifiers(statement)?.some(modifier => modifier.kind === ts.SyntaxKind.DefaultKeyword)) ||\n (ts.isExportDeclaration(statement) &&\n !statement.isTypeOnly &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause) &&\n statement.exportClause.elements.some(item => !item.isTypeOnly && item.name.text === \"default\"))\n );\n }\n\n /**\n * Generic method to find a node of a specific type by name in the AST.\n *\n * @param predicate The predicate to match the node\n * @param name The name to search for\n * @returns The found node or undefined if not found\n */\n public findNodeByName<T extends ts.Node>(\n predicate: (node: ts.Node, name: string) => node is T,\n name: string\n ): T | undefined {\n const sf = this.sourceFile.getSourceFile();\n let found: T | undefined;\n\n const visit = (node: ts.Node) => {\n if (predicate(node, name)) {\n found = node;\n } else {\n ts.forEachChild(node, visit);\n }\n };\n\n ts.forEachChild(sf, visit);\n return found;\n }\n\n /**\n * Searches the AST of this file for a class declaration by name.\n *\n * @param name The name of the class to find\n * @returns The class declaration or undefined if not found\n */\n public findClassDeclaration(name: string): ts.ClassDeclaration | undefined {\n return this.findNodeByName<ts.ClassDeclaration>(\n (node, searchName): node is ts.ClassDeclaration =>\n ts.isClassDeclaration(node) && node.name?.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a type alias declaration by name.\n *\n * @param name The name of the type alias to find\n * @returns The type alias declaration or undefined if not found\n */\n public findTypeAliasDeclaration(name: string): ts.TypeAliasDeclaration | undefined {\n return this.findNodeByName<ts.TypeAliasDeclaration>(\n (node, searchName): node is ts.TypeAliasDeclaration =>\n ts.isTypeAliasDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an interface declaration by name.\n *\n * @param name The name of the interface to find\n * @returns The interface declaration or undefined if not found\n */\n public findInterfaceDeclaration(name: string): ts.InterfaceDeclaration | undefined {\n return this.findNodeByName<ts.InterfaceDeclaration>(\n (node, searchName): node is ts.InterfaceDeclaration =>\n ts.isInterfaceDeclaration(node) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for a variable declaration by name.\n *\n * @param name The name of the variable to find\n * @returns The variable declaration or undefined if not found\n */\n public findVariableDeclaration(name: string): ts.VariableDeclaration | undefined {\n return this.findNodeByName<ts.VariableDeclaration>(\n (node, searchName): node is ts.VariableDeclaration =>\n ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n\n /**\n * Searches the AST of this file for an import equals declaration by name.\n *\n * @param name The name of the import equals declaration to find\n * @returns The import equals declaration or undefined if not found\n */\n public findImportEqualsDeclaration(name: string): ts.ImportEqualsDeclaration | undefined {\n return this.findNodeByName<ts.ImportEqualsDeclaration>(\n (node, searchName): node is ts.ImportEqualsDeclaration =>\n ts.isImportEqualsDeclaration(node) && ts.isIdentifier(node.name) && node.name.text === searchName,\n name\n );\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AAMf,MAAO,WAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM5B,YAAoB,YAAwB;AAAxB;AAAA,EAAyB;AAAA,EAAzB;AAAA;AAAA,EAGb,oBAA8C;AACjD,WAAO,KAAK,WACP,cAAc,EACd,WAAW;AAAA,MACR,eAAU;AAnB1B;AAoBqB,kBAAG,mBAAmB,SAAS,KAAK,CAAC,UAAU,kBAC/C,GAAG,iBAAiB,SAAS,OAC1B,QAAG,aAAa,SAAS,MAAzB,mBAA4B,KAAK,cAAY,SAAS,SAAS,GAAG,WAAW,oBAChF,GAAG,oBAAoB,SAAS,KAC7B,CAAC,UAAU,cACX,UAAU,gBACV,GAAG,eAAe,UAAU,YAAY,KACxC,UAAU,aAAa,SAAS,KAAK,UAAQ,CAAC,KAAK,cAAc,KAAK,KAAK,SAAS,SAAS;AAAA;AAAA,IACzG;AAAA,EACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,eACH,WACA,MACa;AACb,UAAM,KAA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,KAAK,KAAK,KAAK,SAAS;AAAA,MAC3F;AAAA,IACJ;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -74,7 +74,11 @@ class ObjectParser extends AbstractParser {
|
|
|
74
74
|
* @returns The inferred type as a string
|
|
75
75
|
*/
|
|
76
76
|
inferTypeFromExpression(expr) {
|
|
77
|
-
|
|
77
|
+
if (ts.isObjectLiteralExpression(expr)) return "object";
|
|
78
|
+
if (ts.isArrayLiteralExpression(expr)) return "array";
|
|
79
|
+
const result = this.sourceFile.parseNode(expr);
|
|
80
|
+
if (!result.resolved) return "any";
|
|
81
|
+
const val = result.value;
|
|
78
82
|
switch (typeof val) {
|
|
79
83
|
case "string":
|
|
80
84
|
return "string";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ObjectParser.ts"],"sourcesContent":["import ts from \"typescript\";\nimport _ from \"lodash\";\n\nimport SourceFile from \"../SourceFile\";\nimport AbstractParser from \"./AbstractParser\";\nimport SignatureBuilder from \"./SignatureBuilder\";\nimport JSDocParser from \"./JSDocParser\";\n\nimport {shouldIncludeMember} from \"./helpers/memberFilters\";\n\nimport {MemberSignature} from \"./types\";\n\n/**\n * Parses object literal expressions.\n */\nexport default class ObjectParser extends AbstractParser {\n /**\n * Constructor for the ObjectParser.\n *\n * @param sourceFile The source file to parse\n * @param signatureBuilder The signature builder to use for building signatures\n */\n private readonly jsDocParser: JSDocParser;\n\n constructor(\n sourceFile: SourceFile,\n private readonly signatureBuilder: SignatureBuilder\n ) {\n super(sourceFile);\n\n this.jsDocParser = new JSDocParser();\n }\n\n /**\n * Parses an object literal: each property becomes a member signature.\n *\n * @param obj The object literal expression to parse\n * @returns A record of member signatures\n */\n public parse(obj: ts.ObjectLiteralExpression): Record<string, MemberSignature> {\n const result: Record<string, MemberSignature> = {};\n\n for (const prop of obj.properties) {\n // key name helper\n const key = this.getName(prop.name ?? prop);\n\n // Skip members that start with underscore\n if (!shouldIncludeMember(key)) {\n continue;\n }\n\n if (ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n\n if (ts.isFunctionExpression(init) || ts.isArrowFunction(init)) {\n result[key] = this.signatureBuilder.getMethodSignature(init);\n } else {\n // Check for JSDoc @type annotation\n const jsDocType = this.jsDocParser.getJSDocType(prop);\n const tsType = this.inferTypeFromExpression(init);\n\n result[key] = {\n kind: \"property\",\n type: jsDocType || tsType,\n };\n }\n } else if (ts.isMethodDeclaration(prop)) {\n result[key] = this.signatureBuilder.getMethodSignature(prop);\n } else if (ts.isShorthandPropertyAssignment(prop)) {\n const name = prop.name.text;\n const variable = this.sourceFile.getVariables().get(name);\n const val = variable ? variable.value : undefined;\n\n let type = \"any\";\n\n if (!_.isUndefined(val)) {\n if (_.isString(val)) {\n type = \"string\";\n } else if (_.isNumber(val)) {\n type = \"number\";\n } else if (_.isBoolean(val)) {\n type = \"boolean\";\n } else if (_.isArray(val)) {\n type = \"array\";\n } else if (_.isPlainObject(val)) {\n type = \"object\";\n }\n }\n\n result[key] = {kind: \"property\", type};\n }\n }\n\n return result;\n }\n\n /**\n * Infers a type string from an expression.\n *\n * @param expr The expression to infer a type from\n * @returns The inferred type as a string\n */\n public inferTypeFromExpression(expr: ts.Expression): string {\n const
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/ObjectParser.ts"],"sourcesContent":["import ts from \"typescript\";\nimport _ from \"lodash\";\n\nimport SourceFile from \"../SourceFile\";\nimport AbstractParser from \"./AbstractParser\";\nimport SignatureBuilder from \"./SignatureBuilder\";\nimport JSDocParser from \"./JSDocParser\";\n\nimport {shouldIncludeMember} from \"./helpers/memberFilters\";\n\nimport {MemberSignature} from \"./types\";\n\n/**\n * Parses object literal expressions.\n */\nexport default class ObjectParser extends AbstractParser {\n /**\n * Constructor for the ObjectParser.\n *\n * @param sourceFile The source file to parse\n * @param signatureBuilder The signature builder to use for building signatures\n */\n private readonly jsDocParser: JSDocParser;\n\n constructor(\n sourceFile: SourceFile,\n private readonly signatureBuilder: SignatureBuilder\n ) {\n super(sourceFile);\n\n this.jsDocParser = new JSDocParser();\n }\n\n /**\n * Parses an object literal: each property becomes a member signature.\n *\n * @param obj The object literal expression to parse\n * @returns A record of member signatures\n */\n public parse(obj: ts.ObjectLiteralExpression): Record<string, MemberSignature> {\n const result: Record<string, MemberSignature> = {};\n\n for (const prop of obj.properties) {\n // key name helper\n const key = this.getName(prop.name ?? prop);\n\n // Skip members that start with underscore\n if (!shouldIncludeMember(key)) {\n continue;\n }\n\n if (ts.isPropertyAssignment(prop)) {\n const init = prop.initializer;\n\n if (ts.isFunctionExpression(init) || ts.isArrowFunction(init)) {\n result[key] = this.signatureBuilder.getMethodSignature(init);\n } else {\n // Check for JSDoc @type annotation\n const jsDocType = this.jsDocParser.getJSDocType(prop);\n const tsType = this.inferTypeFromExpression(init);\n\n result[key] = {\n kind: \"property\",\n type: jsDocType || tsType,\n };\n }\n } else if (ts.isMethodDeclaration(prop)) {\n result[key] = this.signatureBuilder.getMethodSignature(prop);\n } else if (ts.isShorthandPropertyAssignment(prop)) {\n const name = prop.name.text;\n const variable = this.sourceFile.getVariables().get(name);\n const val = variable ? variable.value : undefined;\n\n let type = \"any\";\n\n if (!_.isUndefined(val)) {\n if (_.isString(val)) {\n type = \"string\";\n } else if (_.isNumber(val)) {\n type = \"number\";\n } else if (_.isBoolean(val)) {\n type = \"boolean\";\n } else if (_.isArray(val)) {\n type = \"array\";\n } else if (_.isPlainObject(val)) {\n type = \"object\";\n }\n }\n\n result[key] = {kind: \"property\", type};\n }\n }\n\n return result;\n }\n\n /**\n * Infers a type string from an expression.\n *\n * @param expr The expression to infer a type from\n * @returns The inferred type as a string\n */\n public inferTypeFromExpression(expr: ts.Expression): string {\n // Shape inference does not require every member to be a statically known value.\n if (ts.isObjectLiteralExpression(expr)) return \"object\";\n if (ts.isArrayLiteralExpression(expr)) return \"array\";\n const result = this.sourceFile.parseNode(expr);\n if (!result.resolved) return \"any\";\n const val = result.value;\n\n switch (typeof val) {\n case \"string\":\n return \"string\";\n case \"number\":\n return \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"object\":\n if (val === null) return \"null\";\n if (_.isArray(val)) return \"array\";\n return \"object\";\n default:\n return \"any\";\n }\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,OAAO;AAGd,OAAO,oBAAoB;AAE3B,OAAO,iBAAiB;AAExB,SAAQ,2BAA0B;AAOlC,MAAO,qBAAmC,eAAe;AAAA,EASrD,YACI,YACiB,kBACnB;AACE,UAAM,UAAU;AAFC;AAIjB,SAAK,cAAc,IAAI,YAAY;AAAA,EACvC;AAAA,EALqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAJJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiBV,MAAM,KAAkE;AAC3E,UAAM,SAA0C,CAAC;AAEjD,eAAW,QAAQ,IAAI,YAAY;AAE/B,YAAM,MAAM,KAAK,QAAQ,KAAK,QAAQ,IAAI;AAG1C,UAAI,CAAC,oBAAoB,GAAG,GAAG;AAC3B;AAAA,MACJ;AAEA,UAAI,GAAG,qBAAqB,IAAI,GAAG;AAC/B,cAAM,OAAO,KAAK;AAElB,YAAI,GAAG,qBAAqB,IAAI,KAAK,GAAG,gBAAgB,IAAI,GAAG;AAC3D,iBAAO,GAAG,IAAI,KAAK,iBAAiB,mBAAmB,IAAI;AAAA,QAC/D,OAAO;AAEH,gBAAM,YAAY,KAAK,YAAY,aAAa,IAAI;AACpD,gBAAM,SAAS,KAAK,wBAAwB,IAAI;AAEhD,iBAAO,GAAG,IAAI;AAAA,YACV,MAAM;AAAA,YACN,MAAM,aAAa;AAAA,UACvB;AAAA,QACJ;AAAA,MACJ,WAAW,GAAG,oBAAoB,IAAI,GAAG;AACrC,eAAO,GAAG,IAAI,KAAK,iBAAiB,mBAAmB,IAAI;AAAA,MAC/D,WAAW,GAAG,8BAA8B,IAAI,GAAG;AAC/C,cAAM,OAAO,KAAK,KAAK;AACvB,cAAM,WAAW,KAAK,WAAW,aAAa,EAAE,IAAI,IAAI;AACxD,cAAM,MAAM,WAAW,SAAS,QAAQ;AAExC,YAAI,OAAO;AAEX,YAAI,CAAC,EAAE,YAAY,GAAG,GAAG;AACrB,cAAI,EAAE,SAAS,GAAG,GAAG;AACjB,mBAAO;AAAA,UACX,WAAW,EAAE,SAAS,GAAG,GAAG;AACxB,mBAAO;AAAA,UACX,WAAW,EAAE,UAAU,GAAG,GAAG;AACzB,mBAAO;AAAA,UACX,WAAW,EAAE,QAAQ,GAAG,GAAG;AACvB,mBAAO;AAAA,UACX,WAAW,EAAE,cAAc,GAAG,GAAG;AAC7B,mBAAO;AAAA,UACX;AAAA,QACJ;AAEA,eAAO,GAAG,IAAI,EAAC,MAAM,YAAY,KAAI;AAAA,MACzC;AAAA,IACJ;AAEA,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQO,wBAAwB,MAA6B;AAExD,QAAI,GAAG,0BAA0B,IAAI,EAAG,QAAO;AAC/C,QAAI,GAAG,yBAAyB,IAAI,EAAG,QAAO;AAC9C,UAAM,SAAS,KAAK,WAAW,UAAU,IAAI;AAC7C,QAAI,CAAC,OAAO,SAAU,QAAO;AAC7B,UAAM,MAAM,OAAO;AAEnB,YAAQ,OAAO,KAAK;AAAA,MAChB,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,eAAO;AAAA,MACX,KAAK;AACD,YAAI,QAAQ,KAAM,QAAO;AACzB,YAAI,EAAE,QAAQ,GAAG,EAAG,QAAO;AAC3B,eAAO;AAAA,MACX;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -5,3 +5,4 @@ export { default as TypeResolver } from "./TypeResolver.js";
|
|
|
5
5
|
export { default as SignatureBuilder } from "./SignatureBuilder.js";
|
|
6
6
|
export { default as NodeFinder } from "./NodeFinder.js";
|
|
7
7
|
export { default as JSDocParser } from "./JSDocParser.js";
|
|
8
|
+
export { default as ExportParser } from "./ExportParser.js";
|
|
@@ -5,8 +5,10 @@ import { default as default5 } from "./TypeResolver.js";
|
|
|
5
5
|
import { default as default6 } from "./SignatureBuilder.js";
|
|
6
6
|
import { default as default7 } from "./NodeFinder.js";
|
|
7
7
|
import { default as default8 } from "./JSDocParser.js";
|
|
8
|
+
import { default as default9 } from "./ExportParser.js";
|
|
8
9
|
export {
|
|
9
10
|
default4 as ClassParser,
|
|
11
|
+
default9 as ExportParser,
|
|
10
12
|
default2 as FunctionParser,
|
|
11
13
|
default8 as JSDocParser,
|
|
12
14
|
default7 as NodeFinder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/index.ts"],"sourcesContent":["export {default as FunctionParser} from \"./FunctionParser\";\nexport {default as ObjectParser} from \"./ObjectParser\";\nexport {default as ClassParser} from \"./ClassParser\";\nexport {default as TypeResolver} from \"./TypeResolver\";\nexport {default as SignatureBuilder} from \"./SignatureBuilder\";\nexport {default as NodeFinder} from \"./NodeFinder\";\nexport {default as JSDocParser} from \"./JSDocParser\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAgC;AACxC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAAkC;AAC1C,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA6B;","names":["default"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/index.ts"],"sourcesContent":["export {default as FunctionParser} from \"./FunctionParser\";\nexport {default as ObjectParser} from \"./ObjectParser\";\nexport {default as ClassParser} from \"./ClassParser\";\nexport {default as TypeResolver} from \"./TypeResolver\";\nexport {default as SignatureBuilder} from \"./SignatureBuilder\";\nexport {default as NodeFinder} from \"./NodeFinder\";\nexport {default as JSDocParser} from \"./JSDocParser\";\nexport {default as ExportParser} from \"./ExportParser\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAAgC;AACxC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;AACtC,SAAmB,WAAXA,gBAAkC;AAC1C,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA6B;AACrC,SAAmB,WAAXA,gBAA8B;","names":["default"]}
|
|
@@ -27,3 +27,19 @@ export interface PropertySignature {
|
|
|
27
27
|
* Member of an interface: either a method or a property.
|
|
28
28
|
*/
|
|
29
29
|
export type MemberSignature = MethodSignature | PropertySignature;
|
|
30
|
+
export declare enum ExportValueKind {
|
|
31
|
+
Function = "function",
|
|
32
|
+
Class = "class",
|
|
33
|
+
Jsx = "jsx",
|
|
34
|
+
Object = "object",
|
|
35
|
+
String = "string",
|
|
36
|
+
Number = "number",
|
|
37
|
+
Other = "other"
|
|
38
|
+
}
|
|
39
|
+
/** Source-level facts about an export, without TypeScript nodes or entrypoint-specific meaning. */
|
|
40
|
+
export interface ExportValue {
|
|
41
|
+
readonly kind: ExportValueKind;
|
|
42
|
+
/** Property names identified statically, without evaluating the exported value. */
|
|
43
|
+
readonly properties: readonly string[];
|
|
44
|
+
readonly value?: string | number;
|
|
45
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
+
var ExportValueKind = /* @__PURE__ */ ((ExportValueKind2) => {
|
|
2
|
+
ExportValueKind2["Function"] = "function";
|
|
3
|
+
ExportValueKind2["Class"] = "class";
|
|
4
|
+
ExportValueKind2["Jsx"] = "jsx";
|
|
5
|
+
ExportValueKind2["Object"] = "object";
|
|
6
|
+
ExportValueKind2["String"] = "string";
|
|
7
|
+
ExportValueKind2["Number"] = "number";
|
|
8
|
+
ExportValueKind2["Other"] = "other";
|
|
9
|
+
return ExportValueKind2;
|
|
10
|
+
})(ExportValueKind || {});
|
|
11
|
+
export {
|
|
12
|
+
ExportValueKind
|
|
13
|
+
};
|
|
1
14
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/parsers/types.ts"],"sourcesContent":["/**\n * Signature of a method parameter.\n */\nexport interface ParameterSignature {\n name: string;\n type: string;\n optional: boolean;\n}\n\n/**\n * Signature of a method.\n */\nexport interface MethodSignature {\n kind: \"method\";\n typeParameters: string[];\n parameters: ParameterSignature[];\n returnType: string;\n}\n\n/**\n * Signature of a property.\n */\nexport interface PropertySignature {\n kind: \"property\";\n type: string;\n optional?: boolean;\n}\n\n/**\n * Member of an interface: either a method or a property.\n */\nexport type MemberSignature = MethodSignature | PropertySignature;\n\nexport enum ExportValueKind {\n Function = \"function\",\n Class = \"class\",\n Jsx = \"jsx\",\n Object = \"object\",\n String = \"string\",\n Number = \"number\",\n Other = \"other\",\n}\n\n/** Source-level facts about an export, without TypeScript nodes or entrypoint-specific meaning. */\nexport interface ExportValue {\n readonly kind: ExportValueKind;\n /** Property names identified statically, without evaluating the exported value. */\n readonly properties: readonly string[];\n readonly value?: string | number;\n}\n"],"mappings":"AAiCO,IAAK,kBAAL,kBAAKA,qBAAL;AACH,EAAAA,iBAAA,cAAW;AACX,EAAAA,iBAAA,WAAQ;AACR,EAAAA,iBAAA,SAAM;AACN,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,YAAS;AACT,EAAAA,iBAAA,WAAQ;AAPA,SAAAA;AAAA,GAAA;","names":["ExportValueKind"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/resolvers/ImportResolver.ts"],"sourcesContent":["import path from \"path\";\nimport {createRequire} from \"module\";\n\nimport TsResolver from \"./TsResolver\";\n\nimport {hasEntrypointPath, resolveEntrypointPath} from \"@cli/entrypoint/utils\";\n\nimport {PackageName} from \"@typing/app\";\n\nexport default class {\n protected baseDir: string;\n\n constructor(protected ts: TsResolver = TsResolver.make()) {\n this.baseDir = process.cwd();\n }\n\n public setTs(ts: TsResolver): this {\n this.ts = ts;\n\n return this;\n }\n\n public setBaseDir(baseDir: string): this {\n this.baseDir = baseDir;\n\n return this;\n }\n\n public get(importPath: string): string {\n if (importPath.startsWith(\".\") || importPath.startsWith(\"/\")) {\n let resolvedLocal: string | undefined = path.resolve(this.baseDir, importPath);\n\n if (hasEntrypointPath(resolvedLocal)) {\n return resolvedLocal;\n }\n\n resolvedLocal = resolveEntrypointPath(resolvedLocal);\n\n if (resolvedLocal) {\n return resolvedLocal;\n }\n\n return importPath;\n }\n\n let aliased = this.ts.matchPath(importPath);\n\n if (aliased) {\n if (hasEntrypointPath(aliased)) {\n return path.resolve(aliased);\n }\n\n aliased = resolveEntrypointPath(aliased);\n\n if (aliased) {\n return path.resolve(aliased);\n }\n }\n\n try {\n if (importPath === PackageName || importPath.startsWith(`${PackageName}/`)) {\n return importPath;\n }\n\n return createRequire(import.meta.url).resolve(importPath, {paths: [this.baseDir]});\n } catch {\n return importPath;\n }\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAQ,qBAAoB;AAE5B,OAAO,gBAAgB;AAEvB,SAAQ,mBAAmB,6BAA4B;AAEvD,SAAQ,mBAAkB;AAE1B,MAAO,uBAAc;AAAA,EAGjB,YAAsB,KAAiB,WAAW,KAAK,GAAG;AAApC;AAClB,SAAK,UAAU,QAAQ,IAAI;AAAA,EAC/B;AAAA,EAFsB;AAAA,EAFZ;AAAA,EAMH,MAAM,IAAsB;AAC/B,SAAK,KAAK;AAEV,WAAO;AAAA,EACX;AAAA,EAEO,WAAW,SAAuB;AACrC,SAAK,UAAU;AAEf,WAAO;AAAA,EACX;AAAA,EAEO,IAAI,YAA4B;AACnC,QAAI,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG,GAAG;AAC1D,UAAI,gBAAoC,KAAK,QAAQ,KAAK,SAAS,UAAU;AAE7E,UAAI,kBAAkB,aAAa,GAAG;AAClC,eAAO;AAAA,MACX;AAEA,sBAAgB,sBAAsB,aAAa;AAEnD,UAAI,eAAe;AACf,eAAO;AAAA,MACX;AAEA,aAAO;AAAA,IACX;AAEA,QAAI,UAAU,KAAK,GAAG,UAAU,UAAU;AAE1C,QAAI,SAAS;AACT,UAAI,kBAAkB,OAAO,GAAG;AAC5B,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAEA,gBAAU,sBAAsB,OAAO;AAEvC,UAAI,SAAS;AACT,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAAA,IACJ;AAEA,QAAI;AACA,UAAI,eAAe,eAAe,WAAW,WAAW,GAAG,WAAW,GAAG,GAAG;AACxE,eAAO;AAAA,MACX;AAEA,aAAO,cAAc,YAAY,GAAG,EAAE,QAAQ,YAAY,EAAC,OAAO,CAAC,KAAK,OAAO,EAAC,CAAC;AAAA,IACrF,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/entrypoint/file/resolvers/ImportResolver.ts"],"sourcesContent":["import path from \"path\";\nimport {createRequire} from \"module\";\n\nimport TsResolver from \"./TsResolver\";\n\nimport {hasEntrypointPath, resolveEntrypointPath} from \"@cli/entrypoint/utils\";\n\nimport {PackageName} from \"@typing/app\";\n\nexport default class {\n protected baseDir: string;\n\n constructor(protected ts: TsResolver = TsResolver.make()) {\n this.baseDir = process.cwd();\n }\n\n public setTs(ts: TsResolver): this {\n this.ts = ts;\n\n return this;\n }\n\n public getTs(): TsResolver {\n return this.ts;\n }\n\n public setBaseDir(baseDir: string): this {\n this.baseDir = baseDir;\n\n return this;\n }\n\n public get(importPath: string): string {\n if (importPath.startsWith(\".\") || importPath.startsWith(\"/\")) {\n let resolvedLocal: string | undefined = path.resolve(this.baseDir, importPath);\n\n if (hasEntrypointPath(resolvedLocal)) {\n return resolvedLocal;\n }\n\n resolvedLocal = resolveEntrypointPath(resolvedLocal);\n\n if (resolvedLocal) {\n return resolvedLocal;\n }\n\n return importPath;\n }\n\n let aliased = this.ts.matchPath(importPath);\n\n if (aliased) {\n if (hasEntrypointPath(aliased)) {\n return path.resolve(aliased);\n }\n\n aliased = resolveEntrypointPath(aliased);\n\n if (aliased) {\n return path.resolve(aliased);\n }\n }\n\n try {\n if (importPath === PackageName || importPath.startsWith(`${PackageName}/`)) {\n return importPath;\n }\n\n return createRequire(import.meta.url).resolve(importPath, {paths: [this.baseDir]});\n } catch {\n return importPath;\n }\n }\n}\n"],"mappings":"AAAA,OAAO,UAAU;AACjB,SAAQ,qBAAoB;AAE5B,OAAO,gBAAgB;AAEvB,SAAQ,mBAAmB,6BAA4B;AAEvD,SAAQ,mBAAkB;AAE1B,MAAO,uBAAc;AAAA,EAGjB,YAAsB,KAAiB,WAAW,KAAK,GAAG;AAApC;AAClB,SAAK,UAAU,QAAQ,IAAI;AAAA,EAC/B;AAAA,EAFsB;AAAA,EAFZ;AAAA,EAMH,MAAM,IAAsB;AAC/B,SAAK,KAAK;AAEV,WAAO;AAAA,EACX;AAAA,EAEO,QAAoB;AACvB,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,WAAW,SAAuB;AACrC,SAAK,UAAU;AAEf,WAAO;AAAA,EACX;AAAA,EAEO,IAAI,YAA4B;AACnC,QAAI,WAAW,WAAW,GAAG,KAAK,WAAW,WAAW,GAAG,GAAG;AAC1D,UAAI,gBAAoC,KAAK,QAAQ,KAAK,SAAS,UAAU;AAE7E,UAAI,kBAAkB,aAAa,GAAG;AAClC,eAAO;AAAA,MACX;AAEA,sBAAgB,sBAAsB,aAAa;AAEnD,UAAI,eAAe;AACf,eAAO;AAAA,MACX;AAEA,aAAO;AAAA,IACX;AAEA,QAAI,UAAU,KAAK,GAAG,UAAU,UAAU;AAE1C,QAAI,SAAS;AACT,UAAI,kBAAkB,OAAO,GAAG;AAC5B,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAEA,gBAAU,sBAAsB,OAAO;AAEvC,UAAI,SAAS;AACT,eAAO,KAAK,QAAQ,OAAO;AAAA,MAC/B;AAAA,IACJ;AAEA,QAAI;AACA,UAAI,eAAe,eAAe,WAAW,WAAW,GAAG,WAAW,GAAG,GAAG;AACxE,eAAO;AAAA,MACX;AAEA,aAAO,cAAc,YAAY,GAAG,EAAE,QAAQ,YAAY,EAAC,OAAO,CAAC,KAAK,OAAO,EAAC,CAAC;AAAA,IACrF,QAAQ;AACJ,aAAO;AAAA,IACX;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type SourceFile from "./SourceFile.js";
|
|
1
3
|
export interface Variable {
|
|
2
4
|
name: string;
|
|
3
5
|
value: any;
|
|
@@ -11,4 +13,27 @@ export interface Injector<T = any> {
|
|
|
11
13
|
}
|
|
12
14
|
export type VariableMap = Map<string, Variable>;
|
|
13
15
|
export type ImportMap = Map<string, string>;
|
|
14
|
-
export type
|
|
16
|
+
export type SourceValue = string | number | boolean | null | undefined | SourceValue[] | {
|
|
17
|
+
[key: string]: SourceValue;
|
|
18
|
+
};
|
|
19
|
+
export type SourceReadResult<T = SourceValue> = {
|
|
20
|
+
resolved: true;
|
|
21
|
+
value: T;
|
|
22
|
+
} | {
|
|
23
|
+
resolved: false;
|
|
24
|
+
file: string;
|
|
25
|
+
path: string;
|
|
26
|
+
reason: string;
|
|
27
|
+
};
|
|
28
|
+
/** An unevaluated expression and the module in which its identifiers are defined. */
|
|
29
|
+
export interface SourceBinding {
|
|
30
|
+
source: SourceFile;
|
|
31
|
+
node: ts.Node;
|
|
32
|
+
}
|
|
33
|
+
export interface SourceReadContext {
|
|
34
|
+
path: string;
|
|
35
|
+
seen: ReadonlySet<string>;
|
|
36
|
+
}
|
|
37
|
+
export interface SourceResolvedBinding extends SourceBinding {
|
|
38
|
+
context: SourceReadContext;
|
|
39
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/entrypoint/finder/AbstractEntrypointFinder.ts"],"sourcesContent":["import fs, {Dirent} from \"fs\";\nimport path from \"path\";\nimport pluralize from \"pluralize\";\n\nimport AbstractParsedFinder from \"./AbstractParsedFinder\";\nimport {FileLayer, setFilePrecedence} from \"./utils/filePrecedence\";\n\nimport {getAppSourcePath, getSharedPath} from \"@cli/resolvers/path\";\n\nimport {EntrypointFile, EntrypointFileExtensions, EntrypointOptions} from \"@typing/entrypoint\";\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default abstract class<O extends EntrypointOptions> extends AbstractParsedFinder<O> {\n protected fileExtensionsPattern: string;\n\n protected possibleIndexFiles: Set<string>;\n\n protected constructor(config: ReadonlyConfig) {\n super(config);\n\n this.fileExtensionsPattern = [...EntrypointFileExtensions].map(ext => ext.replace(\".\", \"\\\\.\")).join(\"|\");\n\n this.possibleIndexFiles = new Set([...EntrypointFileExtensions].map(ext => `index.${ext}`));\n }\n\n public canMerge(): boolean {\n return false;\n }\n\n protected async getFiles(): Promise<Set<EntrypointFile>> {\n const entrypoint = this.type();\n\n let files = new Set<EntrypointFile>();\n\n const appFiles = this.findFiles(getAppSourcePath(this.config));\n\n for (const file of appFiles) {\n setFilePrecedence(file, {layer: FileLayer.AppSource});\n }\n\n if (appFiles.size > 0) {\n files = appFiles;\n\n if (this.config.debug) {\n console.info(`App \"${entrypoint}\" files added:`, appFiles);\n }\n }\n\n if ((appFiles.size > 0 && this.canMerge()) || appFiles.size === 0) {\n const sharedFiles = this.findFiles(getSharedPath(this.config));\n\n for (const file of sharedFiles) {\n setFilePrecedence(file, {layer: FileLayer.Shared});\n }\n\n if (sharedFiles.size > 0) {\n files = new Set([...files, ...sharedFiles]);\n\n if (this.config.debug) {\n console.info(`Shared \"${entrypoint}\" files added:`, sharedFiles);\n }\n }\n }\n\n return files;\n }\n\n protected findFiles(directory: string): Set<EntrypointFile> {\n const entrypoint = this.type();\n const entrypointPluralize = pluralize(entrypoint);\n\n const rootFiles: EntrypointFile[] = [];\n const groupedFiles: EntrypointFile[] = [];\n\n const collect = (dir: string, files: EntrypointFile[], collectGrouped: boolean): void => {\n let entries: Dirent[];\n\n try {\n entries = fs.readdirSync(dir, {withFileTypes: true});\n } catch (e) {\n if (this.config.debug) {\n console.log(`Failed to read ${entrypoint} entrypoint directory: \"${dir}\". Skipping.`);\n }\n\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (this.isValidDirname(entry.name)) {\n for (const indexFile of this.possibleIndexFiles) {\n const indexPath = path.join(fullPath, indexFile);\n\n try {\n const stat = fs.statSync(indexPath);\n\n if (stat.isFile()) {\n files.push(this.file(indexPath));\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\n `Error reading ${entrypoint} entrypoint index file: \"${indexPath}\". Skipping.`\n );\n }\n }\n }\n } else if (collectGrouped && entry.name === entrypointPluralize) {\n collect(fullPath, groupedFiles, false);\n }\n } else if (entry.isFile() && this.isValidFilename(entry.name)) {\n files.push(this.file(fullPath));\n }\n }\n };\n\n collect(directory, rootFiles, true);\n\n if (groupedFiles.length > 0) {\n return new Set(groupedFiles);\n }\n\n if (rootFiles.length > 0) {\n return new Set(rootFiles);\n }\n\n try {\n directory = path.join(directory, entrypoint);\n\n const stat = fs.statSync(directory);\n\n if (stat.isDirectory()) {\n collect(directory, rootFiles, false);\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\"Error reading entrypoint directory:\", directory);\n }\n }\n\n return new Set(rootFiles);\n }\n\n protected isValidFilename(filename: string): boolean {\n const name = this.type().replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n const pattern = new RegExp(`^(?:.*\\\\.)?${name}\\\\.(${this.fileExtensionsPattern})$`);\n\n return pattern.test(filename);\n }\n\n protected isValidDirname(dirname: string): boolean {\n const entrypoint = this.type();\n\n return dirname === entrypoint || dirname.endsWith(`.${entrypoint}`);\n }\n}\n"],"mappings":"AAAA,OAAO,QAAkB;AACzB,OAAO,UAAU;AACjB,OAAO,eAAe;AAEtB,OAAO,0BAA0B;AACjC,SAAQ,WAAW,yBAAwB;AAE3C,SAAQ,kBAAkB,qBAAoB;AAE9C,SAAwB,gCAAkD;AAG1E,MAAO,yCAA4D,qBAAwB;AAAA,EAC7E;AAAA,EAEA;AAAA,EAEA,YAAY,QAAwB;AAC1C,UAAM,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/entrypoint/finder/AbstractEntrypointFinder.ts"],"sourcesContent":["import fs, {Dirent} from \"fs\";\nimport path from \"path\";\nimport pluralize from \"pluralize\";\n\nimport AbstractParsedFinder from \"./AbstractParsedFinder\";\nimport {FileLayer, setFilePrecedence} from \"./utils/filePrecedence\";\n\nimport {getAppSourcePath, getSharedPath} from \"@cli/resolvers/path\";\n\nimport {EntrypointFile, EntrypointFileExtensions, EntrypointOptions} from \"@typing/entrypoint\";\nimport {ReadonlyConfig} from \"@typing/config\";\n\nexport default abstract class<O extends EntrypointOptions> extends AbstractParsedFinder<O> {\n protected fileExtensionsPattern: string;\n\n protected possibleIndexFiles: Set<string>;\n\n protected constructor(config: ReadonlyConfig) {\n super(config);\n\n // prettier-ignore\n this.fileExtensionsPattern = [...EntrypointFileExtensions]\n .map(ext => ext.replace(\".\", \"\\\\.\"))\n .join(\"|\");\n\n // prettier-ignore\n this.possibleIndexFiles = new Set([...EntrypointFileExtensions]\n .map(ext => `index.${ext}`));\n }\n\n public canMerge(): boolean {\n return false;\n }\n\n protected async getFiles(): Promise<Set<EntrypointFile>> {\n const entrypoint = this.type();\n\n let files = new Set<EntrypointFile>();\n\n const appFiles = this.findFiles(getAppSourcePath(this.config));\n\n for (const file of appFiles) {\n setFilePrecedence(file, {layer: FileLayer.AppSource});\n }\n\n if (appFiles.size > 0) {\n files = appFiles;\n\n if (this.config.debug) {\n console.info(`App \"${entrypoint}\" files added:`, appFiles);\n }\n }\n\n if ((appFiles.size > 0 && this.canMerge()) || appFiles.size === 0) {\n const sharedFiles = this.findFiles(getSharedPath(this.config));\n\n for (const file of sharedFiles) {\n setFilePrecedence(file, {layer: FileLayer.Shared});\n }\n\n if (sharedFiles.size > 0) {\n files = new Set([...files, ...sharedFiles]);\n\n if (this.config.debug) {\n console.info(`Shared \"${entrypoint}\" files added:`, sharedFiles);\n }\n }\n }\n\n return files;\n }\n\n protected findFiles(directory: string): Set<EntrypointFile> {\n const entrypoint = this.type();\n const entrypointPluralize = pluralize(entrypoint);\n\n const rootFiles: EntrypointFile[] = [];\n const groupedFiles: EntrypointFile[] = [];\n\n const collect = (dir: string, files: EntrypointFile[], collectGrouped: boolean): void => {\n let entries: Dirent[];\n\n try {\n entries = fs.readdirSync(dir, {withFileTypes: true});\n } catch (e) {\n if (this.config.debug) {\n console.log(`Failed to read ${entrypoint} entrypoint directory: \"${dir}\". Skipping.`);\n }\n\n return;\n }\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n\n if (entry.isDirectory()) {\n if (this.isValidDirname(entry.name)) {\n for (const indexFile of this.possibleIndexFiles) {\n const indexPath = path.join(fullPath, indexFile);\n\n try {\n const stat = fs.statSync(indexPath);\n\n if (stat.isFile()) {\n files.push(this.file(indexPath));\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\n `Error reading ${entrypoint} entrypoint index file: \"${indexPath}\". Skipping.`\n );\n }\n }\n }\n } else if (collectGrouped && entry.name === entrypointPluralize) {\n collect(fullPath, groupedFiles, false);\n }\n } else if (entry.isFile() && this.isValidFilename(entry.name)) {\n files.push(this.file(fullPath));\n }\n }\n };\n\n collect(directory, rootFiles, true);\n\n if (groupedFiles.length > 0) {\n return new Set(groupedFiles);\n }\n\n if (rootFiles.length > 0) {\n return new Set(rootFiles);\n }\n\n try {\n directory = path.join(directory, entrypoint);\n\n const stat = fs.statSync(directory);\n\n if (stat.isDirectory()) {\n collect(directory, rootFiles, false);\n }\n } catch (e) {\n if (this.config.debug) {\n console.log(\"Error reading entrypoint directory:\", directory);\n }\n }\n\n return new Set(rootFiles);\n }\n\n protected isValidFilename(filename: string): boolean {\n const name = this.type().replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n\n const pattern = new RegExp(`^(?:.*\\\\.)?${name}\\\\.(${this.fileExtensionsPattern})$`);\n\n return pattern.test(filename);\n }\n\n protected isValidDirname(dirname: string): boolean {\n const entrypoint = this.type();\n\n return dirname === entrypoint || dirname.endsWith(`.${entrypoint}`);\n }\n}\n"],"mappings":"AAAA,OAAO,QAAkB;AACzB,OAAO,UAAU;AACjB,OAAO,eAAe;AAEtB,OAAO,0BAA0B;AACjC,SAAQ,WAAW,yBAAwB;AAE3C,SAAQ,kBAAkB,qBAAoB;AAE9C,SAAwB,gCAAkD;AAG1E,MAAO,yCAA4D,qBAAwB;AAAA,EAC7E;AAAA,EAEA;AAAA,EAEA,YAAY,QAAwB;AAC1C,UAAM,MAAM;AAGZ,SAAK,wBAAwB,CAAC,GAAG,wBAAwB,EACpD,IAAI,SAAO,IAAI,QAAQ,KAAK,KAAK,CAAC,EAClC,KAAK,GAAG;AAGb,SAAK,qBAAqB,IAAI,IAAI,CAAC,GAAG,wBAAwB,EACzD,IAAI,SAAO,SAAS,GAAG,EAAE,CAAC;AAAA,EACnC;AAAA,EAEO,WAAoB;AACvB,WAAO;AAAA,EACX;AAAA,EAEA,MAAgB,WAAyC;AACrD,UAAM,aAAa,KAAK,KAAK;AAE7B,QAAI,QAAQ,oBAAI,IAAoB;AAEpC,UAAM,WAAW,KAAK,UAAU,iBAAiB,KAAK,MAAM,CAAC;AAE7D,eAAW,QAAQ,UAAU;AACzB,wBAAkB,MAAM,EAAC,OAAO,UAAU,UAAS,CAAC;AAAA,IACxD;AAEA,QAAI,SAAS,OAAO,GAAG;AACnB,cAAQ;AAER,UAAI,KAAK,OAAO,OAAO;AACnB,gBAAQ,KAAK,QAAQ,UAAU,kBAAkB,QAAQ;AAAA,MAC7D;A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@ -1,6 +1,6 @@
|
|
|
1
1
|
import AbstractPluginFinder from "./AbstractPluginFinder.js";
|
|
2
2
|
import { ReadonlyConfig } from "../../../types/config.js";
|
|
3
|
-
import { ContentScriptEntrypointOptions } from "../../../types/content.js";
|
|
3
|
+
import { ContentScriptEntrypointOptions } from "../../../types/content/index.js";
|
|
4
4
|
import { EntrypointOptionsFinder, EntrypointParser, EntrypointType } from "../../../types/entrypoint.js";
|
|
5
5
|
export default class extends AbstractPluginFinder<ContentScriptEntrypointOptions> {
|
|
6
6
|
constructor(config: ReadonlyConfig);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { ImportResolver, OptionFile } from "../file/index.js";
|
|
2
|
+
import { ExpressionFile, ImportResolver, OptionFile } from "../file/index.js";
|
|
3
3
|
import { Mode } from "../../../types/app.js";
|
|
4
4
|
import { Browser } from "../../../types/browser.js";
|
|
5
5
|
import { ReadonlyConfig } from "../../../types/config.js";
|
|
@@ -32,11 +32,12 @@ export default abstract class AbstractParser<O extends EntrypointOptions> implem
|
|
|
32
32
|
manifestVersion?: 2 | 3 | undefined;
|
|
33
33
|
debug?: boolean | undefined;
|
|
34
34
|
}>;
|
|
35
|
-
protected abstract schema():
|
|
35
|
+
protected abstract schema(): z.AnyZodObject;
|
|
36
36
|
protected abstract definition(): string | string[];
|
|
37
37
|
constructor(config: ReadonlyConfig);
|
|
38
38
|
protected optionFile(file: EntrypointFile): OptionFile<Record<string, any>>;
|
|
39
39
|
protected getOptions(file: EntrypointFile): Record<string, any>;
|
|
40
|
+
protected expressionFile(file: EntrypointFile): ExpressionFile;
|
|
40
41
|
protected agreement(): string | undefined;
|
|
41
42
|
options(file: EntrypointFile): O;
|
|
42
43
|
contract(file: EntrypointFile): string | undefined;
|
|
@@ -28,6 +28,11 @@ class AbstractParser {
|
|
|
28
28
|
const instance = this.optionFile(file);
|
|
29
29
|
return instance.getOptions();
|
|
30
30
|
}
|
|
31
|
+
expressionFile(file) {
|
|
32
|
+
const instance = ExpressionFile.make(file.file);
|
|
33
|
+
instance.setImportResolver(this.ir);
|
|
34
|
+
return instance.setDefinition(this.definition());
|
|
35
|
+
}
|
|
31
36
|
agreement() {
|
|
32
37
|
return void 0;
|
|
33
38
|
}
|
|
@@ -48,9 +53,7 @@ class AbstractParser {
|
|
|
48
53
|
if (!agreement) {
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
instance.setImportResolver(this.ir);
|
|
53
|
-
return instance.setDefinition(this.definition()).setProperty(agreement).getType();
|
|
56
|
+
return this.expressionFile(file).setProperty(agreement).getType();
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/entrypoint/parser/AbstractParser.ts"],"sourcesContent":["import {z} from \"zod\";\nimport path from \"path\";\n\nimport {ExpressionFile, ImportResolver, OptionFile, TsResolver} from \"../file\";\n\nimport {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {EntrypointFile, EntrypointOptions, EntrypointParser} from \"@typing/entrypoint\";\n\nexport default abstract class AbstractParser<O extends EntrypointOptions> implements EntrypointParser<O> {\n protected readonly ir: ImportResolver;\n\n protected readonly CommonPropertiesSchema = z.object({\n includeApp: z.array(z.string()).optional(),\n excludeApp: z.array(z.string()).optional(),\n includeBrowser: z.array(z.nativeEnum(Browser)).optional(),\n excludeBrowser: z.array(z.nativeEnum(Browser)).optional(),\n mode: z.nativeEnum(Mode).optional(),\n debug: z.boolean().optional(),\n manifestVersion: z.union([z.literal(2), z.literal(3)]).optional(),\n });\n\n protected abstract schema():
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/entrypoint/parser/AbstractParser.ts"],"sourcesContent":["import {z} from \"zod\";\nimport path from \"path\";\n\nimport {ExpressionFile, ImportResolver, OptionFile, TsResolver} from \"../file\";\n\nimport {Mode} from \"@typing/app\";\nimport {Browser} from \"@typing/browser\";\nimport {ReadonlyConfig} from \"@typing/config\";\nimport {EntrypointFile, EntrypointOptions, EntrypointParser} from \"@typing/entrypoint\";\n\nexport default abstract class AbstractParser<O extends EntrypointOptions> implements EntrypointParser<O> {\n protected readonly ir: ImportResolver;\n\n protected readonly CommonPropertiesSchema = z.object({\n includeApp: z.array(z.string()).optional(),\n excludeApp: z.array(z.string()).optional(),\n includeBrowser: z.array(z.nativeEnum(Browser)).optional(),\n excludeBrowser: z.array(z.nativeEnum(Browser)).optional(),\n mode: z.nativeEnum(Mode).optional(),\n debug: z.boolean().optional(),\n manifestVersion: z.union([z.literal(2), z.literal(3)]).optional(),\n });\n\n protected abstract schema(): z.AnyZodObject;\n\n protected abstract definition(): string | string[];\n\n constructor(protected readonly config: ReadonlyConfig) {\n this.ir = new ImportResolver(TsResolver.make(path.resolve(this.config.rootDir, \"tsconfig.json\")));\n }\n\n protected optionFile(file: EntrypointFile): OptionFile<Record<string, any>> {\n const instance = OptionFile.make(file.file);\n\n instance.setImportResolver(this.ir);\n\n return instance.setProperties(Object.keys(this.schema().shape)).setDefinition(this.definition());\n }\n\n protected getOptions(file: EntrypointFile): Record<string, any> {\n const instance = this.optionFile(file);\n\n return instance.getOptions();\n }\n\n protected expressionFile(file: EntrypointFile): ExpressionFile {\n const instance = ExpressionFile.make(file.file);\n\n instance.setImportResolver(this.ir);\n\n return instance.setDefinition(this.definition());\n }\n\n protected agreement(): string | undefined {\n return undefined;\n }\n\n public options(file: EntrypointFile): O {\n const {success, error, data} = this.schema().safeParse(this.getOptions(file));\n\n if (!success) {\n const e = error?.errors[0];\n\n if (e) {\n throw new Error(`Invalid options ${e.path.join(\", \")} in \"${file.file}\": ${e.message}`);\n } else {\n throw new Error(`Invalid options in \"${file.file}\"`);\n }\n }\n\n return (data || {}) as O;\n }\n\n public contract(file: EntrypointFile): string | undefined {\n const agreement = this.agreement();\n\n if (!agreement) {\n return;\n }\n\n return this.expressionFile(file).setProperty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aAAS,kBAAkB,KAAK,EAAE;AAElC,WAAO,SAAS,cAAc,KAAK,WAAW,CAAC;AAAA,EACnD;AAAA,EAEU,YAAgC;AACtC,WAAO;AAAA,EACX;AAAA,EAEO,QAAQ,MAAyB;AACpC,UAAM,EAAC,SAAS,OAAO,KAAI,IAAI,KAAK,OAAO,EAAE,UAAU,KAAK,WAAW,IAAI,CAAC;AAE5E,QAAI,CAAC,SAAS;AACV,YAAM,IAAI,+BAAO,OAAO;AAExB,UAAI,GAAG;AACH,cAAM,IAAI,MAAM,mBAAmB,EAAE,KAAK,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,MAAM,EAAE,OAAO,EAAE;AAAA,MAC1F,OAAO;AACH,cAAM,IAAI,MAAM,uBAAuB,KAAK,IAAI,GAAG;AAAA,MACvD;AAAA,IACJ;AAEA,WAAQ,QAAQ,CAAC;AAAA,EACrB;AAAA,EAEO,SAAS,MAA0C;AACtD,UAAM,YAAY,KAAK,UAAU;AAEjC,QAAI,CAAC,WAAW;AACZ;AAAA,IACJ;AAEA,WAAO,KAAK,eAAe,IAAI,EAAE,YAAY,SAAS,EAAE,QAAQ;AAAA,EACpE;AACJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import BackgroundParser from "./BackgroundParser.js";
|
|
3
|
-
import { modifyLocaleMessageKey } from "./../../../locale/
|
|
3
|
+
import { modifyLocaleMessageKey } from "./../../../shared/locale/index.js";
|
|
4
4
|
import { CommandExecuteActionName } from "./../../../types/command.js";
|
|
5
5
|
class CommandParser_default extends BackgroundParser {
|
|
6
6
|
definition() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/entrypoint/parser/CommandParser.ts"],"sourcesContent":["import {z} from \"zod\";\n\nimport BackgroundParser from \"./BackgroundParser\";\n\nimport {modifyLocaleMessageKey} from \"@locale
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/entrypoint/parser/CommandParser.ts"],"sourcesContent":["import {z} from \"zod\";\n\nimport BackgroundParser from \"./BackgroundParser\";\n\nimport {modifyLocaleMessageKey} from \"@shared/locale\";\n\nimport {CommandEntrypointOptions, CommandExecuteActionName} from \"@typing/command\";\nimport {EntrypointFile} from \"@typing/entrypoint\";\n\nexport default class extends BackgroundParser<CommandEntrypointOptions> {\n protected definition(): string[] {\n return [\"defineCommand\", \"defineExecuteActionCommand\"];\n }\n\n protected schema(): typeof this.CommonPropertiesSchema {\n const key =\n \"(?:[A-Z0-9]|F(?:[1-9]|1[0-2])|Comma|Period|Home|End|PageUp|PageDown|Space|Insert|Delete|Up|Down|Left|Right)\";\n const mediaKey = \"(?:MediaNextTrack|MediaPlayPause|MediaPrevTrack|MediaStop)\";\n const shortcutMessage =\n \"Invalid shortcut key, expected format like: Ctrl+Shift+K, Alt+Shift+U, or MediaPlayPause\";\n const macShortcutMessage =\n \"Invalid mac shortcut key, expected format like: Command+Shift+P, MacCtrl+K, Option+Shift+U, or MediaPlayPause\";\n\n const ShortcutKeySchema = z\n .string()\n .regex(new RegExp(`^(?:(?:Ctrl|Alt)(?:\\\\+Shift)?\\\\+${key}|${mediaKey})$`), shortcutMessage)\n .optional();\n\n const MacShortcutKeySchema = z\n .string()\n .regex(\n new RegExp(`^(?:(?:Ctrl|Alt|Command|MacCtrl|Option)(?:\\\\+Shift)?\\\\+${key}|${mediaKey})$`),\n macShortcutMessage\n )\n .optional();\n\n return super.schema().extend({\n name: z.string().nonempty().optional(),\n description: z.string().nonempty().optional(),\n global: z.boolean().optional(),\n defaultKey: ShortcutKeySchema,\n windowsKey: ShortcutKeySchema,\n macKey: MacShortcutKeySchema,\n chromeosKey: ShortcutKeySchema,\n linuxKey: ShortcutKeySchema,\n });\n }\n\n public options(file: EntrypointFile): CommandEntrypointOptions {\n const {defaultKey, windowsKey, macKey, chromeosKey, linuxKey, ...options} = super.options(file);\n\n if (!defaultKey && !windowsKey && !macKey && !chromeosKey && !linuxKey) {\n throw new Error(`Invalid command options in \"${file.file}\": At least one suggested key must be defined`);\n }\n\n if (options.global) {\n const globalShortcut = /^Ctrl\\+Shift\\+[0-9]$/;\n const keys = {defaultKey, windowsKey, macKey, chromeosKey, linuxKey};\n const invalidKey = Object.entries(keys).find(([, key]) => key && !globalShortcut.test(key));\n\n if (invalidKey) {\n throw new Error(\n `Invalid command options in \"${file.file}\": Global command shortcut \"${invalidKey[1]}\" in \"${invalidKey[0]}\" must use Ctrl+Shift+[0..9]`\n );\n }\n }\n\n return {\n ...options,\n defaultKey,\n windowsKey,\n macKey,\n chromeosKey,\n linuxKey,\n description: modifyLocaleMessageKey(options.description),\n };\n }\n\n protected getOptions(file: EntrypointFile): Record<string, any> {\n const instance = this.optionFile(file);\n\n const options = instance.getOptions();\n\n if (instance.getDefinition() === \"defineExecuteActionCommand\") {\n return {...options, name: CommandExecuteActionName};\n }\n\n return options;\n }\n}\n"],"mappings":"AAAA,SAAQ,SAAQ;AAEhB,OAAO,sBAAsB;AAE7B,SAAQ,8BAA6B;AAErC,SAAkC,gCAA+B;AAGjE,MAAO,8BAAsB,iBAA2C;AAAA,EAC1D,aAAuB;AAC7B,WAAO,CAAC,iBAAiB,4BAA4B;AAAA,EACzD;AAAA,EAEU,SAA6C;AACnD,UAAM,MACF;AACJ,UAAM,WAAW;AACjB,UAAM,kBACF;AACJ,UAAM,qBACF;AAEJ,UAAM,oBAAoB,EACrB,OAAO,EACP,MAAM,IAAI,OAAO,mCAAmC,GAAG,IAAI,QAAQ,IAAI,GAAG,eAAe,EACzF,SAAS;AAEd,UAAM,uBAAuB,EACxB,OAAO,EACP;AAAA,MACG,IAAI,OAAO,0DAA0D,GAAG,IAAI,QAAQ,IAAI;AAAA,MACxF;AAAA,IACJ,EACC,SAAS;AAEd,WAAO,MAAM,OAAO,EAAE,OAAO;AAAA,MACzB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;AAAA,MACrC,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;A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Parser from "./AbstractParser.js";
|
|
2
|
-
import { ContentScriptEntrypointOptions } from "../../../types/content.js";
|
|
3
|
+
import { ContentScriptEntrypointOptions } from "../../../types/content/index.js";
|
|
3
4
|
import { EntrypointFile, EntrypointOptions } from "../../../types/entrypoint.js";
|
|
4
|
-
export default class<O extends EntrypointOptions = ContentScriptEntrypointOptions> extends AbstractParser<O> {
|
|
5
|
+
export default class ContentParser<O extends EntrypointOptions = ContentScriptEntrypointOptions> extends AbstractParser<O> {
|
|
5
6
|
protected definition(): string | string[];
|
|
6
|
-
protected schema():
|
|
7
|
+
protected schema(): z.AnyZodObject;
|
|
8
|
+
protected getOptions(file: EntrypointFile): Record<string, any>;
|
|
7
9
|
options(file: EntrypointFile): O;
|
|
10
|
+
/** Interprets generic export metadata using content render rules; Relay overrides this policy. */
|
|
11
|
+
protected hasDefaultRender(file: EntrypointFile): boolean;
|
|
8
12
|
}
|