adnbn 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/builders/locale/LocaleBuilder.js +2 -11
- package/dist/cli/builders/locale/LocaleBuilder.js.map +1 -1
- package/dist/cli/builders/locale/index.js +1 -1
- package/dist/cli/builders/locale/index.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestBase.d.ts +4 -1
- package/dist/cli/builders/manifest/ManifestBase.js +35 -6
- package/dist/cli/builders/manifest/ManifestBase.js.map +1 -1
- package/dist/cli/builders/manifest/ManifestV2.js +1 -1
- package/dist/cli/builders/manifest/ManifestV3.js +12 -5
- package/dist/cli/builders/manifest/ManifestV3.js.map +1 -1
- package/dist/cli/builders/manifest/utils/data-collection-permissions.d.ts +15 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js +26 -0
- package/dist/cli/builders/manifest/utils/data-collection-permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.d.ts +1 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js +40 -0
- package/dist/cli/builders/manifest/utils/host-patterns.js.map +1 -0
- package/dist/cli/builders/manifest/utils/index.d.ts +4 -0
- package/dist/cli/builders/manifest/utils/index.js +19 -0
- package/dist/cli/builders/manifest/utils/index.js.map +1 -0
- package/dist/cli/builders/manifest/utils/permissions.d.ts +14 -0
- package/dist/cli/builders/manifest/utils/permissions.js +34 -0
- package/dist/cli/builders/manifest/utils/permissions.js.map +1 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.d.ts +2 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js +92 -0
- package/dist/cli/builders/manifest/utils/web-accessible-resources.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.d.ts +14 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js +523 -0
- package/dist/cli/bundler/plugins/build-assets-map/BuildAssetsMapPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.d.ts +13 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js +16 -0
- package/dist/cli/bundler/plugins/build-assets-map/entrypoint-module.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js +8 -0
- package/dist/cli/bundler/plugins/build-assets-map/index.js.map +1 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.d.ts +12 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js +28 -0
- package/dist/cli/bundler/plugins/build-assets-map/usage.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.d.ts +9 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js +43 -0
- package/dist/cli/bundler/plugins/chunk-loader/ChunkLoaderPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js +5 -0
- package/dist/cli/bundler/plugins/chunk-loader/index.js.map +1 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates/runtime.template.d.ts +2 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.d.ts +7 -0
- package/dist/cli/bundler/plugins/chunk-loader/templates.js +30 -0
- package/dist/cli/bundler/plugins/{EntrypointPlugin.d.ts → entrypoint/EntrypointPlugin.d.ts} +7 -2
- package/dist/cli/bundler/plugins/{EntrypointPlugin.js → entrypoint/EntrypointPlugin.js} +46 -26
- package/dist/cli/bundler/plugins/entrypoint/EntrypointPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js +7 -0
- package/dist/cli/bundler/plugins/entrypoint/index.js.map +1 -0
- package/dist/cli/bundler/plugins/{GenerateJsonPlugin.d.ts → generate-json/GenerateJsonPlugin.d.ts} +1 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js +73 -0
- package/dist/cli/bundler/plugins/generate-json/GenerateJsonPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-json/index.js +5 -0
- package/dist/cli/bundler/plugins/generate-json/index.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.d.ts +23 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js +88 -0
- package/dist/cli/bundler/plugins/generate-module/GenerateModulePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/generate-module/index.js +7 -0
- package/dist/cli/bundler/plugins/generate-module/index.js.map +1 -0
- package/dist/cli/bundler/plugins/index.d.ts +11 -5
- package/dist/cli/bundler/plugins/index.js +32 -10
- package/dist/cli/bundler/plugins/index.js.map +1 -1
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.d.ts +21 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js +174 -0
- package/dist/cli/bundler/plugins/isolated-styles/IsolatedStylesPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js +5 -0
- package/dist/cli/bundler/plugins/isolated-styles/index.js.map +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/css-loader.template.d.ts +1 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates/runtime.template.d.ts +7 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.d.ts +18 -0
- package/dist/cli/bundler/plugins/isolated-styles/templates.js +174 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.d.ts +10 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js +55 -0
- package/dist/cli/bundler/plugins/manifest/ManifestPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/manifest/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/manifest/index.js +6 -0
- package/dist/cli/bundler/plugins/manifest/index.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/ReplacePlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/replace/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/replace/index.js +5 -0
- package/dist/cli/bundler/plugins/replace/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.d.ts +19 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js +20 -0
- package/dist/cli/bundler/plugins/resource-access/ResourceAccessPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/resource-access/index.js +5 -0
- package/dist/cli/bundler/plugins/resource-access/index.js.map +1 -0
- package/dist/cli/bundler/plugins/resource-access/utils.d.ts +8 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js +42 -0
- package/dist/cli/bundler/plugins/resource-access/utils.js.map +1 -0
- package/dist/cli/bundler/plugins/types.d.ts +4 -0
- package/dist/cli/bundler/plugins/types.js +1 -0
- package/dist/cli/bundler/plugins/types.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/index.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/index.js +9 -0
- package/dist/cli/bundler/plugins/utils/index.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.d.ts +13 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js +17 -0
- package/dist/cli/bundler/plugins/utils/manifest-hooks.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.d.ts +1 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js +18 -0
- package/dist/cli/bundler/plugins/utils/runtime-template.js.map +1 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.d.ts +3 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js +18 -0
- package/dist/cli/bundler/plugins/utils/watch-compilation.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js +16 -0
- package/dist/cli/bundler/plugins/watch/WatchPlugin.js.map +1 -0
- package/dist/cli/bundler/plugins/watch/index.d.ts +1 -0
- package/dist/cli/bundler/plugins/watch/index.js +5 -0
- package/dist/cli/bundler/plugins/watch/index.js.map +1 -0
- package/dist/cli/bundler/utils/chunk-filename.d.ts +6 -0
- package/dist/cli/bundler/utils/chunk-filename.js +93 -0
- package/dist/cli/bundler/utils/chunk-filename.js.map +1 -0
- package/dist/cli/bundler/utils/index.d.ts +2 -0
- package/dist/cli/bundler/utils/index.js +2 -0
- package/dist/cli/bundler/utils/index.js.map +1 -1
- package/dist/cli/bundler/utils/layers.d.ts +4 -0
- package/dist/cli/bundler/utils/layers.js +10 -0
- package/dist/cli/bundler/utils/layers.js.map +1 -0
- package/dist/cli/bundler/utils/output.d.ts +6 -2
- package/dist/cli/bundler/utils/output.js +165 -7
- package/dist/cli/bundler/utils/output.js.map +1 -1
- package/dist/cli/bundler/utils/styles.d.ts +5 -0
- package/dist/cli/bundler/utils/styles.js +30 -0
- package/dist/cli/bundler/utils/styles.js.map +1 -0
- package/dist/cli/entrypoint/file/ExpressionFile.d.ts +4 -1
- package/dist/cli/entrypoint/file/ExpressionFile.js +11 -0
- package/dist/cli/entrypoint/file/ExpressionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/OptionFile.d.ts +4 -2
- package/dist/cli/entrypoint/file/OptionFile.js +35 -31
- package/dist/cli/entrypoint/file/OptionFile.js.map +1 -1
- package/dist/cli/entrypoint/file/SourceFile.d.ts +18 -7
- package/dist/cli/entrypoint/file/SourceFile.js +260 -156
- package/dist/cli/entrypoint/file/SourceFile.js.map +1 -1
- package/dist/cli/entrypoint/file/index.d.ts +2 -0
- package/dist/cli/entrypoint/file/index.js +2 -0
- package/dist/cli/entrypoint/file/index.js.map +1 -1
- package/dist/cli/entrypoint/file/injectors/core.js +22 -1
- package/dist/cli/entrypoint/file/injectors/core.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ExportParser.d.ts +14 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js +71 -0
- package/dist/cli/entrypoint/file/parsers/ExportParser.js.map +1 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.d.ts +2 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js +9 -0
- package/dist/cli/entrypoint/file/parsers/NodeFinder.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js +5 -1
- package/dist/cli/entrypoint/file/parsers/ObjectParser.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/index.d.ts +1 -0
- package/dist/cli/entrypoint/file/parsers/index.js +2 -0
- package/dist/cli/entrypoint/file/parsers/index.js.map +1 -1
- package/dist/cli/entrypoint/file/parsers/types.d.ts +16 -0
- package/dist/cli/entrypoint/file/parsers/types.js +13 -0
- package/dist/cli/entrypoint/file/parsers/types.js.map +1 -1
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.d.ts +1 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js +3 -0
- package/dist/cli/entrypoint/file/resolvers/ImportResolver.js.map +1 -1
- package/dist/cli/entrypoint/file/types.d.ts +26 -1
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.d.ts +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js +2 -2
- package/dist/cli/entrypoint/finder/AbstractEntrypointFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.js → AbstractParsedFinder.js} +3 -3
- package/dist/cli/entrypoint/finder/AbstractParsedFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.d.ts +13 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js +33 -0
- package/dist/cli/entrypoint/finder/OptionsFinder.js.map +1 -0
- package/dist/cli/entrypoint/finder/PluginFinder.d.ts +4 -4
- package/dist/cli/entrypoint/finder/PluginFinder.js +2 -2
- package/dist/cli/entrypoint/finder/PluginFinder.js.map +1 -1
- package/dist/cli/entrypoint/finder/index.d.ts +2 -1
- package/dist/cli/entrypoint/finder/index.js +20 -18
- package/dist/cli/entrypoint/finder/index.js.map +1 -1
- package/dist/cli/entrypoint/parser/AbstractParser.d.ts +3 -2
- package/dist/cli/entrypoint/parser/AbstractParser.js +6 -3
- package/dist/cli/entrypoint/parser/AbstractParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js +1 -1
- package/dist/cli/entrypoint/parser/CommandParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/ContentParser.d.ts +5 -1
- package/dist/cli/entrypoint/parser/ContentParser.js +55 -3
- package/dist/cli/entrypoint/parser/ContentParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/OptionsParser.d.ts +6 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js +16 -0
- package/dist/cli/entrypoint/parser/OptionsParser.js.map +1 -0
- package/dist/cli/entrypoint/parser/RelayParser.d.ts +21 -2
- package/dist/cli/entrypoint/parser/RelayParser.js +4 -0
- package/dist/cli/entrypoint/parser/RelayParser.js.map +1 -1
- package/dist/cli/entrypoint/parser/index.d.ts +1 -0
- package/dist/cli/entrypoint/parser/index.js +16 -14
- package/dist/cli/entrypoint/parser/index.js.map +1 -1
- package/dist/cli/plugins/asset.js +9 -4
- package/dist/cli/plugins/asset.js.map +1 -1
- package/dist/cli/plugins/background/index.js +1 -1
- package/dist/cli/plugins/background/index.js.map +1 -1
- package/dist/cli/plugins/content/Content.d.ts +1 -1
- package/dist/cli/plugins/content/Content.js +3 -2
- package/dist/cli/plugins/content/Content.js.map +1 -1
- package/dist/cli/plugins/content/ContentManager.d.ts +8 -5
- package/dist/cli/plugins/content/ContentManager.js +79 -28
- package/dist/cli/plugins/content/ContentManager.js.map +1 -1
- package/dist/cli/plugins/content/ContentName.d.ts +1 -1
- package/dist/cli/plugins/content/ContentName.js +8 -7
- package/dist/cli/plugins/content/ContentName.js.map +1 -1
- package/dist/cli/plugins/content/Relay.d.ts +1 -1
- package/dist/cli/plugins/content/Relay.js +3 -2
- package/dist/cli/plugins/content/Relay.js.map +1 -1
- package/dist/cli/plugins/content/bundler.d.ts +7 -0
- package/dist/cli/plugins/content/bundler.js +47 -0
- package/dist/cli/plugins/content/bundler.js.map +1 -0
- package/dist/cli/plugins/content/index.js +121 -62
- package/dist/cli/plugins/content/index.js.map +1 -1
- package/dist/cli/plugins/content/relay-module.d.ts +3 -0
- package/dist/cli/plugins/content/relay-module.js +11 -0
- package/dist/cli/plugins/content/relay-module.js.map +1 -0
- package/dist/cli/plugins/content/types.d.ts +1 -1
- package/dist/cli/plugins/content/utils.d.ts +2 -0
- package/dist/cli/plugins/content/utils.js +8 -1
- package/dist/cli/plugins/content/utils.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.d.ts +1 -1
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js +6 -6
- package/dist/cli/plugins/icon/declaration/IconDeclaration.js.map +1 -1
- package/dist/cli/plugins/icon/declaration/icon.d.ts +3 -5
- package/dist/cli/plugins/icon/icon-module.d.ts +2 -0
- package/dist/cli/plugins/icon/icon-module.js +11 -0
- package/dist/cli/plugins/icon/icon-module.js.map +1 -0
- package/dist/cli/plugins/icon/index.js +5 -3
- package/dist/cli/plugins/icon/index.js.map +1 -1
- package/dist/cli/plugins/index.d.ts +1 -0
- package/dist/cli/plugins/index.js +22 -20
- package/dist/cli/plugins/index.js.map +1 -1
- package/dist/cli/plugins/locale/Locale.d.ts +9 -2
- package/dist/cli/plugins/locale/Locale.js +37 -5
- package/dist/cli/plugins/locale/Locale.js.map +1 -1
- package/dist/cli/plugins/locale/declaration/locale.d.ts +1 -1
- package/dist/cli/plugins/locale/index.js +57 -22
- package/dist/cli/plugins/locale/index.js.map +1 -1
- package/dist/cli/plugins/locale/locale-module.d.ts +4 -0
- package/dist/cli/plugins/locale/locale-module.js +16 -0
- package/dist/cli/plugins/locale/locale-module.js.map +1 -0
- package/dist/cli/plugins/offscreen/Offscreen.d.ts +2 -3
- package/dist/cli/plugins/offscreen/Offscreen.js.map +1 -1
- package/dist/cli/plugins/offscreen/index.js +5 -4
- package/dist/cli/plugins/offscreen/index.js.map +1 -1
- package/dist/cli/plugins/offscreen/offscreen-module.d.ts +3 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js +11 -0
- package/dist/cli/plugins/offscreen/offscreen-module.js.map +1 -0
- package/dist/cli/plugins/options/Options.d.ts +10 -0
- package/dist/cli/plugins/options/Options.js +24 -0
- package/dist/cli/plugins/options/Options.js.map +1 -0
- package/dist/cli/plugins/options/index.d.ts +2 -0
- package/dist/cli/plugins/options/index.js +41 -0
- package/dist/cli/plugins/options/index.js.map +1 -0
- package/dist/cli/plugins/output.js +33 -3
- package/dist/cli/plugins/output.js.map +1 -1
- package/dist/cli/plugins/page/declaration/PageDeclaration.js +4 -4
- package/dist/cli/plugins/page/declaration/PageDeclaration.js.map +1 -1
- package/dist/cli/plugins/page/declaration/page.d.ts +3 -3
- package/dist/cli/plugins/page/index.js +14 -10
- package/dist/cli/plugins/page/index.js.map +1 -1
- package/dist/cli/plugins/page/page-module.d.ts +2 -0
- package/dist/cli/plugins/page/page-module.js +11 -0
- package/dist/cli/plugins/page/page-module.js.map +1 -0
- package/dist/cli/plugins/popup/Popup.d.ts +1 -1
- package/dist/cli/plugins/popup/Popup.js +2 -2
- package/dist/cli/plugins/popup/Popup.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.d.ts +1 -1
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js +6 -6
- package/dist/cli/plugins/popup/declaration/PopupDeclaration.js.map +1 -1
- package/dist/cli/plugins/popup/declaration/popup.d.ts +3 -3
- package/dist/cli/plugins/popup/index.js +6 -5
- package/dist/cli/plugins/popup/index.js.map +1 -1
- package/dist/cli/plugins/popup/popup-module.d.ts +3 -0
- package/dist/cli/plugins/popup/popup-module.js +11 -0
- package/dist/cli/plugins/popup/popup-module.js.map +1 -0
- package/dist/cli/plugins/sandbox/Sandbox.d.ts +1 -2
- package/dist/cli/plugins/sandbox/Sandbox.js.map +1 -1
- package/dist/cli/plugins/sandbox/index.js +5 -4
- package/dist/cli/plugins/sandbox/index.js.map +1 -1
- package/dist/cli/plugins/sandbox/sandbox-module.d.ts +3 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js +11 -0
- package/dist/cli/plugins/sandbox/sandbox-module.js.map +1 -0
- package/dist/cli/plugins/sidebar/Sidebar.d.ts +1 -1
- package/dist/cli/plugins/sidebar/Sidebar.js +2 -2
- package/dist/cli/plugins/sidebar/Sidebar.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.d.ts +1 -1
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js +6 -6
- package/dist/cli/plugins/sidebar/declaration/SidebarDeclaration.js.map +1 -1
- package/dist/cli/plugins/sidebar/declaration/sidebar.d.ts +3 -3
- package/dist/cli/plugins/sidebar/index.js +6 -5
- package/dist/cli/plugins/sidebar/index.js.map +1 -1
- package/dist/cli/plugins/sidebar/sidebar-module.d.ts +3 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js +11 -0
- package/dist/cli/plugins/sidebar/sidebar-module.js.map +1 -0
- package/dist/cli/plugins/style/index.d.ts +2 -1
- package/dist/cli/plugins/style/index.js +52 -25
- package/dist/cli/plugins/style/index.js.map +1 -1
- package/dist/cli/plugins/style/types.d.ts +5 -0
- package/dist/cli/plugins/style/types.js +1 -0
- package/dist/cli/plugins/style/types.js.map +1 -0
- package/dist/cli/plugins/view/index.js +1 -1
- package/dist/cli/plugins/view/index.js.map +1 -1
- package/dist/cli/raw.d.ts +4 -0
- package/dist/cli/resolvers/bundler.js +9 -7
- package/dist/cli/resolvers/bundler.js.map +1 -1
- package/dist/cli/resolvers/config.js +4 -1
- package/dist/cli/resolvers/config.js.map +1 -1
- package/dist/cli/virtual/index.d.ts +2 -2
- package/dist/cli/virtual/index.js +11 -8
- package/dist/cli/virtual/virtual.d.ts +8 -10
- package/dist/entry/content/adapters/react/Builder.js +1 -1
- package/dist/entry/content/adapters/react/Builder.js.map +1 -1
- package/dist/entry/content/adapters/react/Node.d.ts +2 -0
- package/dist/entry/content/adapters/react/Node.js +10 -2
- package/dist/entry/content/adapters/react/Node.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js +1 -1
- package/dist/entry/content/adapters/vanilla/Builder.js.map +1 -1
- package/dist/entry/content/adapters/vanilla/Node.d.ts +2 -1
- package/dist/entry/content/adapters/vanilla/Node.js +10 -7
- package/dist/entry/content/adapters/vanilla/Node.js.map +1 -1
- package/dist/entry/content/core/Builder.d.ts +1 -2
- package/dist/entry/content/core/Builder.js +9 -5
- package/dist/entry/content/core/Builder.js.map +1 -1
- package/dist/entry/content/core/MountBuilder.js +14 -6
- package/dist/entry/content/core/MountBuilder.js.map +1 -1
- package/dist/entry/content/core/{Context.d.ts → context/Context.d.ts} +2 -1
- package/dist/entry/content/core/{Context.js → context/Context.js} +7 -0
- package/dist/entry/content/core/context/Context.js.map +1 -0
- package/dist/entry/content/core/{EventEmitter.d.ts → context/EventEmitter.d.ts} +1 -1
- package/dist/entry/content/core/{EventEmitter.js → context/EventEmitter.js} +1 -1
- package/dist/entry/content/core/context/EventEmitter.js.map +1 -0
- package/dist/entry/content/core/{ManagedContext.d.ts → context/ManagedContext.d.ts} +1 -1
- package/dist/entry/content/core/context/ManagedContext.js.map +1 -0
- package/dist/entry/content/core/context/index.d.ts +3 -0
- package/dist/entry/content/core/context/index.js +9 -0
- package/dist/entry/content/core/context/index.js.map +1 -0
- package/dist/entry/content/core/{AbstractMarker.d.ts → markers/AbstractMarker.d.ts} +1 -1
- package/dist/entry/content/core/{AbstractMarker.js → markers/AbstractMarker.js} +1 -1
- package/dist/entry/content/core/markers/AbstractMarker.js.map +1 -0
- package/dist/entry/content/core/{AttributeMarker.d.ts → markers/AttributeMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/AttributeMarker.js.map +1 -0
- package/dist/entry/content/core/{WeakMarker.d.ts → markers/WeakMarker.d.ts} +1 -1
- package/dist/entry/content/core/markers/WeakMarker.js.map +1 -0
- package/dist/entry/content/core/markers/index.d.ts +3 -0
- package/dist/entry/content/core/markers/index.js +9 -0
- package/dist/entry/content/core/markers/index.js.map +1 -0
- package/dist/entry/content/core/{EventNode.d.ts → nodes/EventNode.d.ts} +2 -1
- package/dist/entry/content/core/{EventNode.js → nodes/EventNode.js} +3 -0
- package/dist/entry/content/core/nodes/EventNode.js.map +1 -0
- package/dist/entry/content/core/nodes/FrameNode.d.ts +23 -0
- package/dist/entry/content/core/nodes/FrameNode.js +125 -0
- package/dist/entry/content/core/nodes/FrameNode.js.map +1 -0
- package/dist/entry/content/core/{MarkerNode.d.ts → nodes/MarkerNode.d.ts} +2 -1
- package/dist/entry/content/core/{MarkerNode.js → nodes/MarkerNode.js} +3 -0
- package/dist/entry/content/core/nodes/MarkerNode.js.map +1 -0
- package/dist/entry/content/core/{MountNode.d.ts → nodes/MountNode.d.ts} +2 -1
- package/dist/entry/content/core/{MountNode.js → nodes/MountNode.js} +3 -0
- package/dist/entry/content/core/nodes/MountNode.js.map +1 -0
- package/dist/entry/content/core/{Node.d.ts → nodes/Node.d.ts} +2 -1
- package/dist/entry/content/core/{Node.js → nodes/Node.js} +3 -0
- package/dist/entry/content/core/nodes/Node.js.map +1 -0
- package/dist/entry/content/core/nodes/ShadowNode.d.ts +14 -0
- package/dist/entry/content/core/nodes/ShadowNode.js +67 -0
- package/dist/entry/content/core/nodes/ShadowNode.js.map +1 -0
- package/dist/entry/content/core/nodes/index.d.ts +6 -0
- package/dist/entry/content/core/nodes/index.js +15 -0
- package/dist/entry/content/core/nodes/index.js.map +1 -0
- package/dist/entry/content/core/nodes/isolated-styles.d.ts +2 -0
- package/dist/entry/content/core/nodes/isolated-styles.js +14 -0
- package/dist/entry/content/core/nodes/isolated-styles.js.map +1 -0
- package/dist/entry/content/core/resolvers/watch.js +1 -1
- package/dist/entry/content/core/resolvers/watch.js.map +1 -1
- package/dist/entry/content/frame/Builder.d.ts +7 -0
- package/dist/entry/content/frame/Builder.js +14 -0
- package/dist/entry/content/frame/Builder.js.map +1 -0
- package/dist/entry/content/frame/index.d.ts +4 -0
- package/dist/entry/content/frame/index.js +7 -0
- package/dist/entry/content/frame/index.js.map +1 -0
- package/dist/entry/relay/Builder.js +5 -1
- package/dist/entry/relay/Builder.js.map +1 -1
- package/dist/entry/relay/index.d.ts +1 -1
- package/dist/locale/adapters/react/ReactLocale.d.ts +18 -0
- package/dist/locale/adapters/react/ReactLocale.js +41 -0
- package/dist/locale/adapters/react/ReactLocale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.d.ts +7 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js +30 -0
- package/dist/locale/adapters/react/hooks/use-locale-attributes.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-locale.js +17 -0
- package/dist/locale/adapters/react/hooks/use-locale.js.map +1 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.d.ts +3 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js +10 -0
- package/dist/locale/adapters/react/hooks/use-native-locale.js.map +1 -0
- package/dist/locale/adapters/react/index.d.ts +4 -2
- package/dist/locale/adapters/react/index.js +6 -4
- package/dist/locale/adapters/react/index.js.map +1 -1
- package/dist/locale/adapters/react/types.d.ts +22 -0
- package/dist/locale/adapters/react/types.js +1 -0
- package/dist/locale/adapters/react/types.js.map +1 -0
- package/dist/locale/helpers.d.ts +4 -5
- package/dist/locale/helpers.js +1 -1
- package/dist/locale/helpers.js.map +1 -1
- package/dist/locale/index.d.ts +2 -1
- package/dist/locale/index.js +1 -0
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/providers/AbstractLocale.d.ts +4 -4
- package/dist/locale/providers/AbstractLocale.js +13 -94
- package/dist/locale/providers/AbstractLocale.js.map +1 -1
- package/dist/locale/providers/CustomLocale.d.ts +3 -3
- package/dist/locale/providers/CustomLocale.js +6 -5
- package/dist/locale/providers/CustomLocale.js.map +1 -1
- package/dist/locale/providers/DynamicLocale.d.ts +18 -11
- package/dist/locale/providers/DynamicLocale.js +60 -47
- package/dist/locale/providers/DynamicLocale.js.map +1 -1
- package/dist/locale/providers/NativeLocale.d.ts +4 -7
- package/dist/locale/providers/NativeLocale.js +5 -14
- package/dist/locale/providers/NativeLocale.js.map +1 -1
- package/dist/locale/providers/ObservableLocale.d.ts +35 -0
- package/dist/locale/providers/ObservableLocale.js +179 -0
- package/dist/locale/providers/ObservableLocale.js.map +1 -0
- package/dist/locale/providers/index.d.ts +2 -1
- package/dist/locale/providers/index.js +3 -1
- package/dist/locale/providers/index.js.map +1 -1
- package/dist/locale/storage/LocaleStorage.d.ts +11 -0
- package/dist/locale/storage/LocaleStorage.js +40 -0
- package/dist/locale/storage/LocaleStorage.js.map +1 -0
- package/dist/locale/storage/index.d.ts +1 -0
- package/dist/locale/storage/index.js +5 -0
- package/dist/locale/storage/index.js.map +1 -0
- package/dist/main/entrypoint.d.ts +4 -0
- package/dist/main/entrypoint.js +20 -0
- package/dist/main/entrypoint.js.map +1 -0
- package/dist/main/icon.d.ts +2 -3
- package/dist/main/icon.js +2 -1
- package/dist/main/icon.js.map +1 -1
- package/dist/main/index.d.ts +2 -0
- package/dist/main/index.js +2 -0
- package/dist/main/index.js.map +1 -1
- package/dist/main/offscreen.d.ts +2 -5
- package/dist/main/offscreen.js +5 -2
- package/dist/main/offscreen.js.map +1 -1
- package/dist/main/options.d.ts +3 -0
- package/dist/main/options.js +7 -0
- package/dist/main/options.js.map +1 -0
- package/dist/main/page.d.ts +2 -4
- package/dist/main/page.js +2 -1
- package/dist/main/page.js.map +1 -1
- package/dist/main/popup.d.ts +2 -5
- package/dist/main/popup.js +3 -3
- package/dist/main/popup.js.map +1 -1
- package/dist/main/relay.d.ts +1 -2
- package/dist/main/relay.js +2 -1
- package/dist/main/relay.js.map +1 -1
- package/dist/main/sandbox.d.ts +1 -4
- package/dist/main/sandbox.js +2 -1
- package/dist/main/sandbox.js.map +1 -1
- package/dist/main/service.d.ts +1 -2
- package/dist/main/service.js.map +1 -1
- package/dist/main/sidebar.d.ts +2 -5
- package/dist/main/sidebar.js +3 -3
- package/dist/main/sidebar.js.map +1 -1
- package/dist/message/index.d.ts +2 -4
- package/dist/message/index.js.map +1 -1
- package/dist/offscreen/index.d.ts +2 -6
- package/dist/offscreen/index.js.map +1 -1
- package/dist/relay/index.d.ts +2 -5
- package/dist/relay/index.js.map +1 -1
- package/dist/sandbox/index.d.ts +1 -5
- package/dist/sandbox/index.js.map +1 -1
- package/dist/service/index.d.ts +2 -6
- package/dist/service/index.js.map +1 -1
- package/dist/shared/content/index.d.ts +1 -0
- package/dist/shared/content/index.js +6 -0
- package/dist/shared/content/index.js.map +1 -0
- package/dist/shared/content/isolation.d.ts +4 -0
- package/dist/shared/content/isolation.js +70 -0
- package/dist/shared/content/isolation.js.map +1 -0
- package/dist/shared/locale/index.d.ts +5 -0
- package/dist/shared/locale/index.js +21 -0
- package/dist/shared/locale/index.js.map +1 -0
- package/dist/shared/locale/keys.d.ts +5 -0
- package/dist/shared/locale/keys.js +33 -0
- package/dist/shared/locale/keys.js.map +1 -0
- package/dist/shared/locale/language.d.ts +4 -0
- package/dist/shared/locale/language.js +23 -0
- package/dist/shared/locale/language.js.map +1 -0
- package/dist/shared/locale/messages.d.ts +3 -0
- package/dist/shared/locale/messages.js +9 -0
- package/dist/shared/locale/messages.js.map +1 -0
- package/dist/shared/locale/plural.d.ts +2 -0
- package/dist/shared/locale/plural.js +81 -0
- package/dist/shared/locale/plural.js.map +1 -0
- package/dist/shared/locale/substitutions.d.ts +10 -0
- package/dist/shared/locale/substitutions.js +32 -0
- package/dist/shared/locale/substitutions.js.map +1 -0
- package/dist/types/background.d.ts +1 -1
- package/dist/types/background.js.map +1 -1
- package/dist/types/command.d.ts +1 -1
- package/dist/types/command.js.map +1 -1
- package/dist/types/content.d.ts +120 -31
- package/dist/types/content.js +22 -1
- package/dist/types/content.js.map +1 -1
- package/dist/types/entrypoint.d.ts +20 -0
- package/dist/types/entrypoint.js +4 -0
- package/dist/types/entrypoint.js.map +1 -1
- package/dist/types/icon.d.ts +8 -0
- package/dist/types/icon.js.map +1 -1
- package/dist/types/language.d.ts +57 -0
- package/dist/types/language.js +62 -0
- package/dist/types/language.js.map +1 -0
- package/dist/types/locale.d.ts +34 -63
- package/dist/types/locale.js +62 -119
- package/dist/types/locale.js.map +1 -1
- package/dist/types/manifest.d.ts +24 -7
- package/dist/types/manifest.js.map +1 -1
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js.map +1 -1
- package/dist/types/offscreen.d.ts +14 -1
- package/dist/types/offscreen.js.map +1 -1
- package/dist/types/options.d.ts +9 -0
- package/dist/types/options.js +1 -0
- package/dist/types/options.js.map +1 -0
- package/dist/types/page.d.ts +8 -0
- package/dist/types/plugin.d.ts +2 -1
- package/dist/types/popup.d.ts +9 -0
- package/dist/types/relay.d.ts +16 -7
- package/dist/types/relay.js.map +1 -1
- package/dist/types/sandbox.d.ts +12 -0
- package/dist/types/sandbox.js.map +1 -1
- package/dist/types/service.d.ts +10 -1
- package/dist/types/service.js.map +1 -1
- package/dist/types/sidebar.d.ts +9 -0
- package/dist/types/sidebar.js.map +1 -1
- package/dist/types/transport.d.ts +4 -0
- package/dist/virtual/entrypoint.d.ts +5 -0
- package/dist/virtual/entrypoint.js +7 -0
- package/dist/virtual/entrypoint.js.map +1 -0
- package/dist/virtual/icon.d.ts +2 -0
- package/dist/virtual/icon.js +5 -0
- package/dist/virtual/icon.js.map +1 -0
- package/dist/virtual/locale.d.ts +7 -0
- package/dist/virtual/locale.js +13 -0
- package/dist/virtual/locale.js.map +1 -0
- package/dist/virtual/modules.d.ts +40 -0
- package/dist/virtual/offscreen.d.ts +3 -0
- package/dist/virtual/offscreen.js +5 -0
- package/dist/virtual/offscreen.js.map +1 -0
- package/dist/virtual/page.d.ts +2 -0
- package/dist/virtual/page.js +5 -0
- package/dist/virtual/page.js.map +1 -0
- package/dist/virtual/popup.d.ts +3 -0
- package/dist/virtual/popup.js +5 -0
- package/dist/virtual/popup.js.map +1 -0
- package/dist/virtual/relay.d.ts +3 -0
- package/dist/virtual/relay.js +5 -0
- package/dist/virtual/relay.js.map +1 -0
- package/dist/virtual/sandbox.d.ts +3 -0
- package/dist/virtual/sandbox.js +5 -0
- package/dist/virtual/sandbox.js.map +1 -0
- package/dist/virtual/sidebar.d.ts +3 -0
- package/dist/virtual/sidebar.js +5 -0
- package/dist/virtual/sidebar.js.map +1 -0
- package/package.json +31 -10
- package/scripts/clean-dist.js +7 -0
- package/scripts/copy-dts.js +11 -1
- package/types/client.d.ts +15 -0
- package/dist/cli/builders/manifest/utils.d.ts +0 -32
- package/dist/cli/builders/manifest/utils.js +0 -209
- package/dist/cli/builders/manifest/utils.js.map +0 -1
- package/dist/cli/bundler/plugins/EntrypointPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js +0 -40
- package/dist/cli/bundler/plugins/GenerateJsonPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ManifestPlugin.d.ts +0 -10
- package/dist/cli/bundler/plugins/ManifestPlugin.js +0 -78
- package/dist/cli/bundler/plugins/ManifestPlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/ReplacePlugin.js.map +0 -1
- package/dist/cli/bundler/plugins/WatchPlugin.js +0 -21
- package/dist/cli/bundler/plugins/WatchPlugin.js.map +0 -1
- package/dist/cli/entrypoint/finder/AbstractOptionsFinder.js.map +0 -1
- package/dist/entry/content/core/AbstractMarker.js.map +0 -1
- package/dist/entry/content/core/AttributeMarker.js.map +0 -1
- package/dist/entry/content/core/Context.js.map +0 -1
- package/dist/entry/content/core/EventEmitter.js.map +0 -1
- package/dist/entry/content/core/EventNode.js.map +0 -1
- package/dist/entry/content/core/ManagedContext.js.map +0 -1
- package/dist/entry/content/core/MarkerNode.js.map +0 -1
- package/dist/entry/content/core/MountNode.js.map +0 -1
- package/dist/entry/content/core/Node.js.map +0 -1
- package/dist/entry/content/core/WeakMarker.js.map +0 -1
- package/dist/locale/adapters/react/LocaleProvider.d.ts +0 -7
- package/dist/locale/adapters/react/LocaleProvider.js +0 -58
- package/dist/locale/adapters/react/LocaleProvider.js.map +0 -1
- package/dist/locale/adapters/react/context.d.ts +0 -14
- package/dist/locale/adapters/react/context.js +0 -25
- package/dist/locale/adapters/react/context.js.map +0 -1
- package/dist/locale/utils.d.ts +0 -11
- package/dist/locale/utils.js +0 -67
- package/dist/locale/utils.js.map +0 -1
- /package/dist/cli/bundler/plugins/{ReplacePlugin.d.ts → replace/ReplacePlugin.d.ts} +0 -0
- /package/dist/cli/bundler/plugins/{ReplacePlugin.js → replace/ReplacePlugin.js} +0 -0
- /package/dist/cli/bundler/plugins/{WatchPlugin.d.ts → watch/WatchPlugin.d.ts} +0 -0
- /package/dist/cli/entrypoint/finder/{AbstractOptionsFinder.d.ts → AbstractParsedFinder.d.ts} +0 -0
- /package/dist/entry/content/core/{ManagedContext.js → context/ManagedContext.js} +0 -0
- /package/dist/entry/content/core/{AttributeMarker.js → markers/AttributeMarker.js} +0 -0
- /package/dist/entry/content/core/{WeakMarker.js → markers/WeakMarker.js} +0 -0
|
@@ -3,7 +3,7 @@ import fs from "fs";
|
|
|
3
3
|
import path from "path";
|
|
4
4
|
import { ImportResolver } from "./resolvers/index.js";
|
|
5
5
|
import injectors from "./injectors/index.js";
|
|
6
|
-
class
|
|
6
|
+
class SourceFile {
|
|
7
7
|
constructor(file) {
|
|
8
8
|
this.file = file;
|
|
9
9
|
}
|
|
@@ -11,17 +11,17 @@ class EntryFile {
|
|
|
11
11
|
sourceFile;
|
|
12
12
|
variables;
|
|
13
13
|
imports;
|
|
14
|
-
|
|
14
|
+
sources = /* @__PURE__ */ new Map();
|
|
15
15
|
importResolver;
|
|
16
16
|
static make(file) {
|
|
17
17
|
return new this(file);
|
|
18
18
|
}
|
|
19
19
|
getSourceFile() {
|
|
20
|
-
if (this.sourceFile) {
|
|
21
|
-
|
|
20
|
+
if (!this.sourceFile) {
|
|
21
|
+
const sourceCode = fs.readFileSync(this.file, "utf8");
|
|
22
|
+
this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
return this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);
|
|
24
|
+
return this.sourceFile;
|
|
25
25
|
}
|
|
26
26
|
getImports() {
|
|
27
27
|
if (this.imports) {
|
|
@@ -29,7 +29,7 @@ class EntryFile {
|
|
|
29
29
|
}
|
|
30
30
|
this.imports = /* @__PURE__ */ new Map();
|
|
31
31
|
const parse = (node) => {
|
|
32
|
-
var _a, _b, _c;
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
33
|
if (ts.isImportDeclaration(node) && node.moduleSpecifier) {
|
|
34
34
|
const importPath = node.moduleSpecifier.text;
|
|
35
35
|
if (node.importClause) {
|
|
@@ -42,196 +42,300 @@ class EntryFile {
|
|
|
42
42
|
(_a2 = this.imports) == null ? void 0 : _a2.set(el.name.text, this.getInputResolver().get(importPath));
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
+
if (node.importClause.namedBindings && ts.isNamespaceImport(node.importClause.namedBindings)) {
|
|
46
|
+
(_b = this.imports) == null ? void 0 : _b.set(
|
|
47
|
+
node.importClause.namedBindings.name.text,
|
|
48
|
+
this.getInputResolver().get(importPath)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
45
51
|
}
|
|
46
52
|
} else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {
|
|
47
53
|
if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {
|
|
48
54
|
const importPath = node.moduleReference.expression.text;
|
|
49
|
-
(
|
|
55
|
+
(_c = this.imports) == null ? void 0 : _c.set(node.name.text, this.getInputResolver().get(importPath));
|
|
50
56
|
}
|
|
51
57
|
} else if (ts.isImportEqualsDeclaration(node)) {
|
|
52
58
|
const qualifiedName = node.moduleReference.getText();
|
|
53
|
-
(
|
|
59
|
+
(_d = this.imports) == null ? void 0 : _d.set(node.name.text, qualifiedName);
|
|
54
60
|
}
|
|
55
61
|
ts.forEachChild(node, parse);
|
|
56
62
|
};
|
|
57
63
|
parse(this.getSourceFile());
|
|
58
64
|
return this.imports;
|
|
59
65
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
if (ts.
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
ts.forEachChild(node, parse);
|
|
78
|
-
};
|
|
79
|
-
parse(this.getSourceFile());
|
|
80
|
-
return this.enums;
|
|
81
|
-
}
|
|
82
|
-
getVariables() {
|
|
83
|
-
if (this.variables) {
|
|
84
|
-
return this.variables;
|
|
85
|
-
}
|
|
86
|
-
this.variables = /* @__PURE__ */ new Map();
|
|
87
|
-
const parse = (node) => {
|
|
88
|
-
var _a, _b, _c, _d;
|
|
89
|
-
if (ts.isVariableStatement(node)) {
|
|
90
|
-
const isExported = (_a = node.modifiers) == null ? void 0 : _a.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword);
|
|
91
|
-
node.declarationList.declarations.forEach((declaration) => {
|
|
92
|
-
var _a2;
|
|
93
|
-
if (ts.isIdentifier(declaration.name) && declaration.initializer) {
|
|
94
|
-
const name = declaration.name.text;
|
|
95
|
-
const value = this.parseNode(declaration.initializer);
|
|
96
|
-
(_a2 = this.variables) == null ? void 0 : _a2.set(name, {
|
|
97
|
-
name,
|
|
98
|
-
value,
|
|
99
|
-
exported: isExported || false
|
|
100
|
-
});
|
|
66
|
+
/** Collect declarations without evaluating runtime functions or unrelated initializers. */
|
|
67
|
+
getBindings(exportedOnly = false) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
70
|
+
const bind = (name, node) => bindings.set(name, { source: this, node });
|
|
71
|
+
for (const statement of this.getSourceFile().statements) {
|
|
72
|
+
const exported = ts.canHaveModifiers(statement) && ((_a = ts.getModifiers(statement)) == null ? void 0 : _a.some((item) => item.kind === ts.SyntaxKind.ExportKeyword));
|
|
73
|
+
if (ts.isVariableStatement(statement) && (!exportedOnly || exported)) {
|
|
74
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
75
|
+
if (ts.isIdentifier(declaration.name)) bind(declaration.name.text, declaration);
|
|
76
|
+
else {
|
|
77
|
+
const collect = (node) => {
|
|
78
|
+
if (ts.isBindingElement(node) && ts.isIdentifier(node.name)) bind(node.name.text, node);
|
|
79
|
+
else ts.forEachChild(node, collect);
|
|
80
|
+
};
|
|
81
|
+
collect(declaration.name);
|
|
101
82
|
}
|
|
102
|
-
}
|
|
83
|
+
}
|
|
84
|
+
} else if ((ts.isEnumDeclaration(statement) || ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && (!exportedOnly || exported) && statement.name) {
|
|
85
|
+
const isDefault = (_b = ts.getModifiers(statement)) == null ? void 0 : _b.some((item) => item.kind === ts.SyntaxKind.DefaultKeyword);
|
|
86
|
+
bind(exportedOnly && isDefault ? "default" : statement.name.text, statement);
|
|
103
87
|
}
|
|
104
|
-
if (ts.
|
|
105
|
-
|
|
106
|
-
var _a2, _b2, _c2;
|
|
107
|
-
const name = el.name.text;
|
|
108
|
-
if ((_a2 = this.variables) == null ? void 0 : _a2.has(name)) {
|
|
109
|
-
const variable = (_b2 = this.variables) == null ? void 0 : _b2.get(name);
|
|
110
|
-
(_c2 = this.variables) == null ? void 0 : _c2.set(name, {
|
|
111
|
-
name,
|
|
112
|
-
value: variable.value,
|
|
113
|
-
exported: true
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
});
|
|
88
|
+
if (exportedOnly && ts.isExportAssignment(statement) && !statement.isExportEquals) {
|
|
89
|
+
bind("default", statement.expression);
|
|
117
90
|
}
|
|
118
|
-
if (ts.
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const name = "default";
|
|
123
|
-
(_d = this.variables) == null ? void 0 : _d.set(name, {
|
|
124
|
-
name,
|
|
125
|
-
value: variable.value,
|
|
126
|
-
exported: true
|
|
127
|
-
});
|
|
91
|
+
if (exportedOnly && ts.isExportDeclaration(statement) && !statement.isTypeOnly && statement.exportClause && ts.isNamedExports(statement.exportClause)) {
|
|
92
|
+
for (const item of statement.exportClause.elements) {
|
|
93
|
+
if (!item.isTypeOnly)
|
|
94
|
+
bind(item.name.text, statement.moduleSpecifier ? item : item.propertyName ?? item.name);
|
|
128
95
|
}
|
|
129
96
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
97
|
+
}
|
|
98
|
+
return bindings;
|
|
99
|
+
}
|
|
100
|
+
getVariables() {
|
|
101
|
+
if (this.variables) return this.variables;
|
|
102
|
+
const locals = this.getBindings();
|
|
103
|
+
const exported = this.getBindings(true);
|
|
104
|
+
this.variables = /* @__PURE__ */ new Map();
|
|
105
|
+
for (const [name, binding] of new Map([...locals, ...exported])) {
|
|
106
|
+
const result = this.parseNode(binding.node, name);
|
|
107
|
+
this.variables.set(name, {
|
|
108
|
+
name,
|
|
109
|
+
value: result.resolved ? result.value : void 0,
|
|
110
|
+
exported: exported.has(name)
|
|
111
|
+
});
|
|
112
|
+
}
|
|
133
113
|
return this.variables;
|
|
134
114
|
}
|
|
135
115
|
resolveValue(from, target, name) {
|
|
136
116
|
return injectors([])(from, target, name);
|
|
137
117
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
118
|
+
getImportBinding(name) {
|
|
119
|
+
var _a;
|
|
120
|
+
for (const statement of this.getSourceFile().statements) {
|
|
121
|
+
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
122
|
+
const clause = statement.importClause;
|
|
123
|
+
const from = statement.moduleSpecifier.text;
|
|
124
|
+
if (((_a = clause == null ? void 0 : clause.name) == null ? void 0 : _a.text) === name) return { from, name: "default" };
|
|
125
|
+
if ((clause == null ? void 0 : clause.namedBindings) && ts.isNamedImports(clause.namedBindings)) {
|
|
126
|
+
const item = clause.namedBindings.elements.find((item2) => item2.name.text === name);
|
|
127
|
+
if (item) return { from, name: (item.propertyName ?? item.name).text };
|
|
145
128
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
129
|
+
if ((clause == null ? void 0 : clause.namedBindings) && ts.isNamespaceImport(clause.namedBindings) && clause.namedBindings.name.text === name)
|
|
130
|
+
return { from, name: "*" };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
getImportedSource(from) {
|
|
134
|
+
const filename = this.getInputResolver().get(from);
|
|
135
|
+
if (!filename || !path.isAbsolute(filename) || !/\.[cm]?[jt]sx?$/.test(filename) || !fs.existsSync(filename))
|
|
136
|
+
return;
|
|
137
|
+
let source = this.sources.get(filename);
|
|
138
|
+
if (!source) {
|
|
139
|
+
source = new SourceFile(filename);
|
|
140
|
+
source.setImportResolver(this.getInputResolver());
|
|
141
|
+
source.sources = this.sources;
|
|
142
|
+
this.sources.set(filename, source);
|
|
143
|
+
}
|
|
144
|
+
return source;
|
|
145
|
+
}
|
|
146
|
+
failure(context, reason) {
|
|
147
|
+
return { resolved: false, file: this.file, path: context.path, reason };
|
|
148
|
+
}
|
|
149
|
+
/** Follow static bindings, retaining their source module and detecting reference cycles. */
|
|
150
|
+
resolveNode(node, context) {
|
|
151
|
+
var _a;
|
|
152
|
+
if (!node) return this.failure(context, "missing initializer");
|
|
153
|
+
const key = `${this.file}:${node.pos}:${node.end}`;
|
|
154
|
+
if (context.seen.has(key)) return this.failure(context, "circular reference");
|
|
155
|
+
context = { ...context, seen: /* @__PURE__ */ new Set([...context.seen, key]) };
|
|
156
|
+
if (ts.isAsExpression(node) || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node) || ts.isParenthesizedExpression(node) || ts.isNonNullExpression(node)) {
|
|
157
|
+
return this.resolveNode(node.expression, context);
|
|
158
|
+
}
|
|
159
|
+
if (ts.isVariableDeclaration(node)) {
|
|
160
|
+
if (!ts.isVariableDeclarationList(node.parent) || !(node.parent.flags & ts.NodeFlags.Const))
|
|
161
|
+
return this.failure(context, "use a const declaration for build options");
|
|
162
|
+
return this.resolveNode(node.initializer, context);
|
|
163
|
+
}
|
|
164
|
+
if (ts.isExportSpecifier(node) && ts.isExportDeclaration(node.parent.parent)) {
|
|
165
|
+
const from = node.parent.parent.moduleSpecifier;
|
|
166
|
+
const name = (node.propertyName ?? node.name).text;
|
|
167
|
+
const binding = from && ts.isStringLiteral(from) ? (_a = this.getImportedSource(from.text)) == null ? void 0 : _a.getBindings(true).get(name) : void 0;
|
|
168
|
+
if (binding) return binding.source.resolveNode(binding.node, context);
|
|
169
|
+
return this.failure(context, `cannot resolve re-exported value ${name}`);
|
|
170
|
+
}
|
|
171
|
+
if (ts.isIdentifier(node)) {
|
|
172
|
+
const local = this.getBindings().get(node.text);
|
|
173
|
+
if (local) return local.source.resolveNode(local.node, context);
|
|
174
|
+
const imported = this.getImportBinding(node.text);
|
|
175
|
+
if (imported) {
|
|
176
|
+
const source = this.getImportedSource(imported.from);
|
|
177
|
+
const binding = source == null ? void 0 : source.getBindings(true).get(imported.name);
|
|
178
|
+
if (binding) return binding.source.resolveNode(binding.node, context);
|
|
179
|
+
return this.failure(context, `cannot resolve imported value ${node.text}`);
|
|
149
180
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
181
|
+
if (node.text !== "undefined") return this.failure(context, `unresolved identifier ${node.text}`);
|
|
182
|
+
}
|
|
183
|
+
return { resolved: true, value: { source: this, node, context } };
|
|
184
|
+
}
|
|
185
|
+
parseNode(node, property = "") {
|
|
186
|
+
return this.readValue(node, { path: property, seen: /* @__PURE__ */ new Set() });
|
|
187
|
+
}
|
|
188
|
+
/** Read an object's shape first so callers can select build fields before evaluating values. */
|
|
189
|
+
getProperties(node, property = "") {
|
|
190
|
+
return this.readProperties(node, { path: property, seen: /* @__PURE__ */ new Set() });
|
|
191
|
+
}
|
|
192
|
+
readProperties(node, context) {
|
|
193
|
+
const result = this.resolveNode(node, context);
|
|
194
|
+
if (!result.resolved) return result;
|
|
195
|
+
const binding = result.value;
|
|
196
|
+
if (!ts.isObjectLiteralExpression(binding.node))
|
|
197
|
+
return binding.source.failure(binding.context, "expected a static object");
|
|
198
|
+
return binding.source.objectProperties(binding.node, binding.context);
|
|
199
|
+
}
|
|
200
|
+
objectProperties(node, context) {
|
|
201
|
+
const properties = /* @__PURE__ */ new Map();
|
|
202
|
+
for (const property of node.properties) {
|
|
203
|
+
if (ts.isSpreadAssignment(property)) {
|
|
204
|
+
const spread = this.readProperties(property.expression, context);
|
|
205
|
+
if (!spread.resolved) return spread;
|
|
206
|
+
for (const [key2, binding] of spread.value) properties.set(key2, binding);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
let key;
|
|
210
|
+
if (ts.isComputedPropertyName(property.name)) {
|
|
211
|
+
const result = this.readValue(property.name.expression, context);
|
|
212
|
+
if (!result.resolved) return result;
|
|
213
|
+
if (typeof result.value !== "string" && typeof result.value !== "number")
|
|
214
|
+
return this.failure(context, "object keys must be strings or numbers");
|
|
215
|
+
key = String(result.value);
|
|
216
|
+
} else {
|
|
217
|
+
key = property.name.text;
|
|
157
218
|
}
|
|
158
|
-
|
|
219
|
+
properties.set(key, {
|
|
220
|
+
source: this,
|
|
221
|
+
node: ts.isPropertyAssignment(property) ? property.initializer : ts.isShorthandPropertyAssignment(property) ? property.name : property
|
|
222
|
+
});
|
|
159
223
|
}
|
|
160
|
-
return
|
|
224
|
+
return { resolved: true, value: properties };
|
|
161
225
|
}
|
|
162
|
-
|
|
226
|
+
readValue(node, context) {
|
|
227
|
+
const resolved = this.resolveNode(node, context);
|
|
228
|
+
if (!resolved.resolved) return resolved;
|
|
229
|
+
const binding = resolved.value;
|
|
230
|
+
return binding.source.readResolvedValue(binding.node, binding.context);
|
|
231
|
+
}
|
|
232
|
+
readResolvedValue(node, context) {
|
|
163
233
|
var _a;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
234
|
+
const success = (value) => ({ resolved: true, value });
|
|
235
|
+
if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return success(node.text);
|
|
236
|
+
if (ts.isNumericLiteral(node)) return success(Number(node.text));
|
|
237
|
+
if (node.kind === ts.SyntaxKind.TrueKeyword) return success(true);
|
|
238
|
+
if (node.kind === ts.SyntaxKind.FalseKeyword) return success(false);
|
|
239
|
+
if (node.kind === ts.SyntaxKind.NullKeyword) return success(null);
|
|
240
|
+
if (ts.isIdentifier(node) && node.text === "undefined") return success(void 0);
|
|
241
|
+
if (ts.isPrefixUnaryExpression(node)) {
|
|
242
|
+
const operand = this.readValue(node.operand, context);
|
|
243
|
+
if (!operand.resolved) return operand;
|
|
244
|
+
if (typeof operand.value === "number" && (node.operator === ts.SyntaxKind.MinusToken || node.operator === ts.SyntaxKind.PlusToken))
|
|
245
|
+
return success(node.operator === ts.SyntaxKind.MinusToken ? -operand.value : operand.value);
|
|
246
|
+
return this.failure(context, "unsupported unary expression");
|
|
247
|
+
}
|
|
248
|
+
if (ts.isArrayLiteralExpression(node)) {
|
|
249
|
+
const values = [];
|
|
250
|
+
for (const [index, element] of node.elements.entries()) {
|
|
251
|
+
const result = this.readValue(ts.isSpreadElement(element) ? element.expression : element, {
|
|
252
|
+
...context,
|
|
253
|
+
path: `${context.path}[${index}]`
|
|
254
|
+
});
|
|
255
|
+
if (!result.resolved) return result;
|
|
256
|
+
if (ts.isSpreadElement(element)) {
|
|
257
|
+
if (!Array.isArray(result.value))
|
|
258
|
+
return this.failure(context, "array spread must reference a static array");
|
|
259
|
+
values.push(...result.value);
|
|
260
|
+
} else values.push(result.value);
|
|
261
|
+
}
|
|
262
|
+
return success(values);
|
|
263
|
+
}
|
|
264
|
+
if (ts.isObjectLiteralExpression(node)) {
|
|
265
|
+
const properties = this.objectProperties(node, context);
|
|
266
|
+
if (!properties.resolved) return properties;
|
|
267
|
+
const values = [];
|
|
268
|
+
for (const [key, binding] of properties.value) {
|
|
269
|
+
const result = binding.source.readValue(binding.node, {
|
|
270
|
+
...context,
|
|
271
|
+
path: context.path ? `${context.path}.${key}` : key
|
|
272
|
+
});
|
|
273
|
+
if (!result.resolved) return result;
|
|
274
|
+
values.push([key, result.value]);
|
|
275
|
+
}
|
|
276
|
+
return success(Object.fromEntries(values));
|
|
277
|
+
}
|
|
278
|
+
if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {
|
|
279
|
+
const property = ts.isPropertyAccessExpression(node) ? success(node.name.text) : this.readValue(node.argumentExpression, context);
|
|
280
|
+
if (!property.resolved) return property;
|
|
281
|
+
if (typeof property.value !== "string" && typeof property.value !== "number")
|
|
282
|
+
return this.failure(context, "member name must be a string or number");
|
|
283
|
+
const name = String(property.value);
|
|
284
|
+
if (ts.isIdentifier(node.expression) && !this.getBindings().has(node.expression.text)) {
|
|
285
|
+
const imported = this.getImportBinding(node.expression.text);
|
|
286
|
+
if (imported) {
|
|
287
|
+
const value = this.resolveValue(imported.from, imported.name, name);
|
|
288
|
+
if (value !== void 0) return success(value);
|
|
289
|
+
if (imported.name === "*") {
|
|
290
|
+
const binding2 = (_a = this.getImportedSource(imported.from)) == null ? void 0 : _a.getBindings(true).get(name);
|
|
291
|
+
if (binding2) return binding2.source.readValue(binding2.node, context);
|
|
191
292
|
}
|
|
192
293
|
}
|
|
193
|
-
return name;
|
|
194
294
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return acc;
|
|
205
|
-
}
|
|
206
|
-
const key = property.name.text;
|
|
207
|
-
const initNode = ts.isShorthandPropertyAssignment(property) ? property.name : property.initializer;
|
|
208
|
-
let value = this.parseNode(initNode);
|
|
209
|
-
if (typeof value === "string" && ((_a2 = this.variables) == null ? void 0 : _a2.has(value))) {
|
|
210
|
-
value = (_c = (_b = this.variables) == null ? void 0 : _b.get(value)) == null ? void 0 : _c.value;
|
|
211
|
-
}
|
|
212
|
-
acc[key] = value;
|
|
213
|
-
return acc;
|
|
214
|
-
},
|
|
215
|
-
{}
|
|
216
|
-
);
|
|
217
|
-
case ts.SyntaxKind.PropertyAccessExpression: {
|
|
218
|
-
return this.findPropertyAccessValue(node);
|
|
295
|
+
const resolved = this.resolveNode(node.expression, context);
|
|
296
|
+
if (!resolved.resolved) return resolved;
|
|
297
|
+
const binding = resolved.value;
|
|
298
|
+
if (ts.isObjectLiteralExpression(binding.node)) {
|
|
299
|
+
const properties = binding.source.objectProperties(binding.node, binding.context);
|
|
300
|
+
if (!properties.resolved) return properties;
|
|
301
|
+
const member = properties.value.get(name);
|
|
302
|
+
if (member) return member.source.readValue(member.node, binding.context);
|
|
303
|
+
return this.failure(context, `unknown member ${name}`);
|
|
219
304
|
}
|
|
220
|
-
|
|
221
|
-
|
|
305
|
+
const object = binding.source.readResolvedValue(binding.node, binding.context);
|
|
306
|
+
if (!object.resolved) return object;
|
|
307
|
+
if (object.value !== null && typeof object.value === "object" && Object.hasOwn(object.value, name))
|
|
308
|
+
return success(object.value[name]);
|
|
309
|
+
return this.failure(context, `unknown member ${name}`);
|
|
222
310
|
}
|
|
311
|
+
if (ts.isEnumDeclaration(node)) {
|
|
312
|
+
const values = {};
|
|
313
|
+
let previous = -1;
|
|
314
|
+
for (const member of node.members) {
|
|
315
|
+
const result = member.initializer ? this.readValue(member.initializer, context) : typeof previous === "number" ? success(previous + 1) : this.failure(context, "enum member needs a static initializer");
|
|
316
|
+
if (!result.resolved) return result;
|
|
317
|
+
if (typeof result.value !== "string" && typeof result.value !== "number")
|
|
318
|
+
return this.failure(context, "enum values must be strings or numbers");
|
|
319
|
+
if (ts.isComputedPropertyName(member.name))
|
|
320
|
+
return this.failure(context, "computed enum names are not supported");
|
|
321
|
+
values[member.name.text] = previous = result.value;
|
|
322
|
+
}
|
|
323
|
+
return success(values);
|
|
324
|
+
}
|
|
325
|
+
return this.failure(
|
|
326
|
+
context,
|
|
327
|
+
`unsupported ${ts.SyntaxKind[node.kind]}; use literals, constants or supported enum members`
|
|
328
|
+
);
|
|
223
329
|
}
|
|
224
330
|
getInputResolver() {
|
|
225
|
-
if (this.importResolver)
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
return this.setImportResolver(new ImportResolver());
|
|
331
|
+
if (!this.importResolver) this.importResolver = new ImportResolver();
|
|
332
|
+
return this.importResolver.setBaseDir(path.dirname(this.file));
|
|
229
333
|
}
|
|
230
334
|
setImportResolver(resolver) {
|
|
231
335
|
return this.importResolver = resolver.setBaseDir(path.dirname(this.file));
|
|
232
336
|
}
|
|
233
337
|
}
|
|
234
338
|
export {
|
|
235
|
-
|
|
339
|
+
SourceFile as default
|
|
236
340
|
};
|
|
237
341
|
//# sourceMappingURL=SourceFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/entrypoint/file/SourceFile.ts"],"sourcesContent":["import ts from \"typescript\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport {ImportResolver} from \"./resolvers\";\n\nimport injectors from \"./injectors\";\n\nimport {EnumMap, ImportMap, Variable, VariableMap} from \"./types\";\n\nexport default class EntryFile {\n private sourceFile?: ts.SourceFile;\n\n private variables?: VariableMap;\n\n private imports?: ImportMap;\n\n private enums?: EnumMap;\n\n protected importResolver?: ImportResolver;\n\n static make<T extends EntryFile>(this: new (file: string) => T, file: string): T {\n return new this(file);\n }\n\n constructor(protected readonly file: string) {}\n\n public getSourceFile(): ts.SourceFile {\n if (this.sourceFile) {\n return this.sourceFile;\n }\n\n const sourceCode = fs.readFileSync(this.file, \"utf8\");\n\n return (this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true));\n }\n\n public getImports(): ImportMap {\n if (this.imports) {\n return this.imports;\n }\n\n this.imports = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isImportDeclaration(node) && node.moduleSpecifier) {\n const importPath = (node.moduleSpecifier as ts.StringLiteral).text;\n if (node.importClause) {\n // default import: import X from '...'\n if (node.importClause.name) {\n this.imports?.set(node.importClause.name.text, this.getInputResolver().get(importPath));\n }\n // named imports: import { A, B } from '...'\n if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach(el => {\n this.imports?.set(el.name.text, this.getInputResolver().get(importPath));\n });\n }\n }\n }\n // import equals: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {\n if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {\n const importPath = node.moduleReference.expression.text;\n this.imports?.set(node.name.text, this.getInputResolver().get(importPath));\n }\n }\n // import equals with qualified name: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node)) {\n // For qualified names like chrome.tabs.Tab, we don't need to resolve a path\n // Just store the full qualified name as the \"import path\"\n const qualifiedName = node.moduleReference.getText();\n this.imports?.set(node.name.text, qualifiedName);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.imports;\n }\n\n public getEnums(): EnumMap {\n if (this.enums) {\n return this.enums;\n }\n\n this.enums = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isEnumDeclaration(node)) {\n const enumName = node.name.text;\n const enumProperties: Map<string, string | number> = new Map();\n\n node.members.forEach(member => {\n const key = member.name.getText();\n const value = member.initializer ? member.initializer.getText().replace(/['\"]/g, \"\") : key;\n\n enumProperties.set(key, value);\n });\n\n this.enums?.set(enumName, enumProperties);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.enums;\n }\n\n public getVariables(): VariableMap {\n if (this.variables) {\n return this.variables;\n }\n\n this.variables = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isVariableStatement(node)) {\n const isExported = node.modifiers?.some(modifier => modifier.kind === ts.SyntaxKind.ExportKeyword);\n\n node.declarationList.declarations.forEach(declaration => {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n const name = declaration.name.text;\n const value = this.parseNode(declaration.initializer);\n\n this.variables?.set(name, {\n name,\n value,\n exported: isExported || false,\n });\n }\n });\n }\n\n if (ts.isExportDeclaration(node) && node.exportClause && ts.isNamedExports(node.exportClause)) {\n node.exportClause.elements.forEach(el => {\n const name = el.name.text;\n\n if (this.variables?.has(name)) {\n const variable = this.variables?.get(name) as Variable;\n\n this.variables?.set(name, {\n name,\n value: variable.value,\n exported: true,\n });\n }\n });\n }\n\n if (ts.isExportAssignment(node)) {\n const expr = node.expression;\n if (ts.isIdentifier(expr) && this.variables?.has(expr.text)) {\n const variable = this.variables?.get(expr.text) as Variable;\n const name = \"default\";\n\n this.variables?.set(name, {\n name,\n value: variable.value,\n exported: true,\n });\n }\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.variables;\n }\n\n protected resolveValue(from: string, target: string, name: string): any {\n return injectors([])(from, target, name);\n }\n\n protected findPropertyAccessValue(property: ts.Node): any {\n if (ts.isPropertyAccessExpression(property)) {\n const objectName = property.expression.getText();\n const propertyName = property.name.getText();\n\n const varItem = this.getVariables().get(objectName);\n\n if (varItem) {\n return varItem.value;\n }\n\n const enumItem = this.getEnums().get(objectName);\n\n if (enumItem) {\n return enumItem.get(propertyName);\n }\n\n const importItem = this.getImports().get(objectName);\n\n if (importItem) {\n const resolverItem = this.resolveValue(importItem, objectName, propertyName);\n\n if (resolverItem) {\n return resolverItem;\n }\n\n return EntryFile.make(importItem).findPropertyAccessValue(property);\n }\n\n return `${objectName}.${propertyName}`;\n }\n\n return undefined;\n }\n\n public parseNode(node?: ts.Node): any {\n if (!node) {\n return undefined;\n }\n\n switch (node.kind) {\n case ts.SyntaxKind.StringLiteral:\n return (node as ts.StringLiteral).text;\n case ts.SyntaxKind.TrueKeyword:\n return true;\n case ts.SyntaxKind.FalseKeyword:\n return false;\n case ts.SyntaxKind.NullKeyword:\n return null;\n case ts.SyntaxKind.NumericLiteral:\n return parseFloat((node as ts.NumericLiteral).text);\n case ts.SyntaxKind.Identifier: {\n const id = node as ts.Identifier;\n const name = id.text;\n // local variable\n const local = this.variables?.get(name);\n if (local && local.value !== undefined) {\n return local.value;\n }\n // imported constant: try to resolve its value from source file\n const importPath = this.getImports().get(name);\n if (importPath) {\n // load imported file and check its variables\n const parser = EntryFile.make(importPath);\n const imported = parser.getVariables().get(name);\n if (imported && imported.value !== undefined) {\n return imported.value;\n }\n }\n return name;\n }\n case ts.SyntaxKind.ArrayLiteralExpression:\n return (node as ts.ArrayLiteralExpression).elements.map(element => this.parseNode(element));\n case ts.SyntaxKind.ObjectLiteralExpression:\n return (node as ts.ObjectLiteralExpression).properties\n .filter(\n (property): property is ts.PropertyAssignment | ts.ShorthandPropertyAssignment =>\n ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)\n )\n .reduce(\n (acc, property) => {\n if (ts.isComputedPropertyName(property.name)) {\n return acc;\n }\n\n const key = (property.name as ts.Identifier | ts.StringLiteral).text;\n\n // Determine the initializer node: for shorthand, use the identifier itself\n const initNode = ts.isShorthandPropertyAssignment(property)\n ? (property.name as ts.Identifier)\n : (property.initializer as ts.Expression | undefined);\n\n let value = this.parseNode(initNode);\n\n // If value is still just an identifier name, resolve from collected variables\n if (typeof value === \"string\" && this.variables?.has(value)) {\n value = this.variables?.get(value)?.value;\n }\n\n acc[key] = value;\n\n return acc;\n },\n {} as Record<string, any>\n );\n case ts.SyntaxKind.PropertyAccessExpression: {\n return this.findPropertyAccessValue(node);\n }\n default:\n return undefined;\n }\n }\n\n protected getInputResolver(): ImportResolver {\n if (this.importResolver) {\n return this.importResolver;\n }\n\n return this.setImportResolver(new ImportResolver());\n }\n\n public setImportResolver(resolver: ImportResolver): ImportResolver {\n return (this.importResolver = resolver.setBaseDir(path.dirname(this.file)));\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,sBAAqB;AAE7B,OAAO,eAAe;AAItB,MAAO,UAAwB;AAAA,EAe3B,YAA+B,MAAc;AAAd;AAAA,EAAe;AAAA,EAAf;AAAA,EAdvB;AAAA,EAEA;AAAA,EAEA;AAAA,EAEA;AAAA,EAEE;AAAA,EAEV,OAAO,KAAyD,MAAiB;AAC7E,WAAO,IAAI,KAAK,IAAI;AAAA,EACxB;AAAA,EAIO,gBAA+B;AAClC,QAAI,KAAK,YAAY;AACjB,aAAO,KAAK;AAAA,IAChB;AAEA,UAAM,aAAa,GAAG,aAAa,KAAK,MAAM,MAAM;AAEpD,WAAQ,KAAK,aAAa,GAAG,iBAAiB,KAAK,MAAM,YAAY,GAAG,aAAa,QAAQ,IAAI;AAAA,EACrG;AAAA,EAEO,aAAwB;AAC3B,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,SAAK,UAAU,oBAAI,IAAI;AAEvB,UAAM,QAAQ,CAAC,SAAkB;AA5CzC;AA6CY,UAAI,GAAG,oBAAoB,IAAI,KAAK,KAAK,iBAAiB;AACtD,cAAM,a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aAAa;AApQ3C,gBAAAF,KAAA;AAqQ4B,gBAAI,GAAG,uBAAuB,SAAS,IAAI,GAAG;AAC1C,qBAAO;AAAA,YACX;AAEA,kBAAM,MAAO,SAAS,KAA0C;AAGhE,kBAAM,WAAW,GAAG,8BAA8B,QAAQ,IACnD,SAAS,OACT,SAAS;AAEhB,gBAAI,QAAQ,KAAK,UAAU,QAAQ;AAGnC,gBAAI,OAAO,UAAU,cAAYA,MAAA,KAAK,cAAL,gBAAAA,IAAgB,IAAI,SAAQ;AACzD,uBAAQ,gBAAK,cAAL,mBAAgB,IAAI,WAApB,mBAA4B;AAAA,YACxC;AAEA,gBAAI,GAAG,IAAI;AAEX,mBAAO;AAAA,UACX;AAAA,UACA,CAAC;AAAA,QACL;AAAA,MACR,KAAK,GAAG,WAAW,0BAA0B;AACzC,eAAO,KAAK,wBAAwB,IAAI;AAAA,MAC5C;AAAA,MACA;AACI,eAAO;AAAA,IACf;AAAA,EACJ;AAAA,EAEU,mBAAmC;AACzC,QAAI,KAAK,gBAAgB;AACrB,aAAO,KAAK;AAAA,IAChB;AAEA,WAAO,KAAK,kBAAkB,IAAI,eAAe,CAAC;AAAA,EACtD;AAAA,EAEO,kBAAkB,UAA0C;AAC/D,WAAQ,KAAK,iBAAiB,SAAS,WAAW,KAAK,QAAQ,KAAK,IAAI,CAAC;AAAA,EAC7E;AACJ;","names":["_a","_b","_c"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/entrypoint/file/SourceFile.ts"],"sourcesContent":["import ts from \"typescript\";\nimport fs from \"fs\";\nimport path from \"path\";\n\nimport {ImportResolver} from \"./resolvers\";\nimport injectors from \"./injectors\";\nimport type {\n ImportMap,\n VariableMap,\n SourceValue,\n SourceReadResult,\n SourceBinding,\n SourceReadContext,\n SourceResolvedBinding,\n} from \"./types\";\n\nexport default class SourceFile {\n private sourceFile?: ts.SourceFile;\n private variables?: VariableMap;\n private imports?: ImportMap;\n private sources = new Map<string, SourceFile>();\n protected importResolver?: ImportResolver;\n\n static make<T extends SourceFile>(this: new (file: string) => T, file: string): T {\n return new this(file);\n }\n\n constructor(protected readonly file: string) {}\n\n public getSourceFile(): ts.SourceFile {\n if (!this.sourceFile) {\n const sourceCode = fs.readFileSync(this.file, \"utf8\");\n this.sourceFile = ts.createSourceFile(this.file, sourceCode, ts.ScriptTarget.ESNext, true);\n }\n return this.sourceFile;\n }\n\n public getImports(): ImportMap {\n if (this.imports) {\n return this.imports;\n }\n\n this.imports = new Map();\n\n const parse = (node: ts.Node) => {\n if (ts.isImportDeclaration(node) && node.moduleSpecifier) {\n const importPath = (node.moduleSpecifier as ts.StringLiteral).text;\n if (node.importClause) {\n // default import: import X from '...'\n if (node.importClause.name) {\n this.imports?.set(node.importClause.name.text, this.getInputResolver().get(importPath));\n }\n // named imports: import { A, B } from '...'\n if (node.importClause.namedBindings && ts.isNamedImports(node.importClause.namedBindings)) {\n node.importClause.namedBindings.elements.forEach(el => {\n this.imports?.set(el.name.text, this.getInputResolver().get(importPath));\n });\n }\n if (node.importClause.namedBindings && ts.isNamespaceImport(node.importClause.namedBindings)) {\n this.imports?.set(\n node.importClause.namedBindings.name.text,\n this.getInputResolver().get(importPath)\n );\n }\n }\n }\n // import equals: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node) && ts.isExternalModuleReference(node.moduleReference)) {\n if (node.moduleReference.expression && ts.isStringLiteral(node.moduleReference.expression)) {\n const importPath = node.moduleReference.expression.text;\n this.imports?.set(node.name.text, this.getInputResolver().get(importPath));\n }\n }\n // import equals with qualified name: import X = Y.Z\n else if (ts.isImportEqualsDeclaration(node)) {\n // For qualified names like chrome.tabs.Tab, we don't need to resolve a path\n // Just store the full qualified name as the \"import path\"\n const qualifiedName = node.moduleReference.getText();\n this.imports?.set(node.name.text, qualifiedName);\n }\n\n ts.forEachChild(node, parse);\n };\n\n parse(this.getSourceFile());\n\n return this.imports;\n }\n\n /** Collect declarations without evaluating runtime functions or unrelated initializers. */\n protected getBindings(exportedOnly = false): Map<string, SourceBinding> {\n const bindings = new Map<string, SourceBinding>();\n const bind = (name: string, node: ts.Node) => bindings.set(name, {source: this, node});\n for (const statement of this.getSourceFile().statements) {\n const exported =\n ts.canHaveModifiers(statement) &&\n ts.getModifiers(statement)?.some(item => item.kind === ts.SyntaxKind.ExportKeyword);\n if (ts.isVariableStatement(statement) && (!exportedOnly || exported)) {\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name)) bind(declaration.name.text, declaration);\n else {\n const collect = (node: ts.Node) => {\n if (ts.isBindingElement(node) && ts.isIdentifier(node.name)) bind(node.name.text, node);\n else ts.forEachChild(node, collect);\n };\n collect(declaration.name);\n }\n }\n } else if (\n (ts.isEnumDeclaration(statement) ||\n ts.isFunctionDeclaration(statement) ||\n ts.isClassDeclaration(statement)) &&\n (!exportedOnly || exported) &&\n statement.name\n ) {\n const isDefault = ts.getModifiers(statement)?.some(item => item.kind === ts.SyntaxKind.DefaultKeyword);\n bind(exportedOnly && isDefault ? \"default\" : statement.name.text, statement);\n }\n if (exportedOnly && ts.isExportAssignment(statement) && !statement.isExportEquals) {\n bind(\"default\", statement.expression);\n }\n if (\n exportedOnly &&\n ts.isExportDeclaration(statement) &&\n !statement.isTypeOnly &&\n statement.exportClause &&\n ts.isNamedExports(statement.exportClause)\n ) {\n for (const item of statement.exportClause.elements) {\n if (!item.isTypeOnly)\n bind(item.name.text, statement.moduleSpecifier ? item : (item.propertyName ?? item.name));\n }\n }\n }\n return bindings;\n }\n\n public getVariables(): VariableMap {\n if (this.variables) return this.variables;\n const locals = this.getBindings();\n const exported = this.getBindings(true);\n this.variables = new Map();\n for (const [name, binding] of new Map([...locals, ...exported])) {\n const result = this.parseNode(binding.node, name);\n // Signature inference can use known values without requiring executable code to be static.\n this.variables.set(name, {\n name,\n value: result.resolved ? result.value : undefined,\n exported: exported.has(name),\n });\n }\n return this.variables;\n }\n\n protected resolveValue(from: string, target: string, name: string): any {\n return injectors([])(from, target, name);\n }\n\n private getImportBinding(name: string): {from: string; name: string} | undefined {\n for (const statement of this.getSourceFile().statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;\n const clause = statement.importClause;\n const from = statement.moduleSpecifier.text;\n if (clause?.name?.text === name) return {from, name: \"default\"};\n if (clause?.namedBindings && ts.isNamedImports(clause.namedBindings)) {\n const item = clause.namedBindings.elements.find(item => item.name.text === name);\n if (item) return {from, name: (item.propertyName ?? item.name).text};\n }\n if (\n clause?.namedBindings &&\n ts.isNamespaceImport(clause.namedBindings) &&\n clause.namedBindings.name.text === name\n )\n return {from, name: \"*\"};\n }\n }\n\n private getImportedSource(from: string): SourceFile | undefined {\n const filename = this.getInputResolver().get(from);\n if (!filename || !path.isAbsolute(filename) || !/\\.[cm]?[jt]sx?$/.test(filename) || !fs.existsSync(filename))\n return;\n let source = this.sources.get(filename);\n if (!source) {\n source = new SourceFile(filename);\n source.setImportResolver(this.getInputResolver());\n source.sources = this.sources;\n this.sources.set(filename, source);\n }\n return source;\n }\n\n private failure(context: SourceReadContext, reason: string): SourceReadResult<never> {\n return {resolved: false, file: this.file, path: context.path, reason};\n }\n\n /** Follow static bindings, retaining their source module and detecting reference cycles. */\n private resolveNode(\n node: ts.Node | undefined,\n context: SourceReadContext\n ): SourceReadResult<SourceResolvedBinding> {\n if (!node) return this.failure(context, \"missing initializer\");\n const key = `${this.file}:${node.pos}:${node.end}`;\n if (context.seen.has(key)) return this.failure(context, \"circular reference\");\n context = {...context, seen: new Set([...context.seen, key])};\n if (\n ts.isAsExpression(node) ||\n ts.isTypeAssertionExpression(node) ||\n ts.isSatisfiesExpression(node) ||\n ts.isParenthesizedExpression(node) ||\n ts.isNonNullExpression(node)\n ) {\n return this.resolveNode(node.expression, context);\n }\n if (ts.isVariableDeclaration(node)) {\n if (!ts.isVariableDeclarationList(node.parent) || !(node.parent.flags & ts.NodeFlags.Const))\n return this.failure(context, \"use a const declaration for build options\");\n return this.resolveNode(node.initializer, context);\n }\n if (ts.isExportSpecifier(node) && ts.isExportDeclaration(node.parent.parent)) {\n const from = node.parent.parent.moduleSpecifier;\n const name = (node.propertyName ?? node.name).text;\n const binding =\n from && ts.isStringLiteral(from)\n ? this.getImportedSource(from.text)?.getBindings(true).get(name)\n : undefined;\n if (binding) return binding.source.resolveNode(binding.node, context);\n return this.failure(context, `cannot resolve re-exported value ${name}`);\n }\n if (ts.isIdentifier(node)) {\n const local = this.getBindings().get(node.text);\n if (local) return local.source.resolveNode(local.node, context);\n const imported = this.getImportBinding(node.text);\n if (imported) {\n const source = this.getImportedSource(imported.from);\n const binding = source?.getBindings(true).get(imported.name);\n if (binding) return binding.source.resolveNode(binding.node, context);\n return this.failure(context, `cannot resolve imported value ${node.text}`);\n }\n if (node.text !== \"undefined\") return this.failure(context, `unresolved identifier ${node.text}`);\n }\n return {resolved: true, value: {source: this, node, context}};\n }\n\n public parseNode(node?: ts.Node, property = \"\"): SourceReadResult {\n return this.readValue(node, {path: property, seen: new Set()});\n }\n\n /** Read an object's shape first so callers can select build fields before evaluating values. */\n protected getProperties(node: ts.Node, property = \"\"): SourceReadResult<Map<string, SourceBinding>> {\n return this.readProperties(node, {path: property, seen: new Set()});\n }\n\n private readProperties(node: ts.Node, context: SourceReadContext): SourceReadResult<Map<string, SourceBinding>> {\n const result = this.resolveNode(node, context);\n if (!result.resolved) return result;\n const binding = result.value;\n if (!ts.isObjectLiteralExpression(binding.node))\n return binding.source.failure(binding.context, \"expected a static object\");\n return binding.source.objectProperties(binding.node, binding.context);\n }\n\n private objectProperties(\n node: ts.ObjectLiteralExpression,\n context: SourceReadContext\n ): SourceReadResult<Map<string, SourceBinding>> {\n const properties = new Map<string, SourceBinding>();\n for (const property of node.properties) {\n if (ts.isSpreadAssignment(property)) {\n const spread = this.readProperties(property.expression, context);\n if (!spread.resolved) return spread;\n for (const [key, binding] of spread.value) properties.set(key, binding);\n continue;\n }\n let key: string;\n if (ts.isComputedPropertyName(property.name)) {\n const result = this.readValue(property.name.expression, context);\n if (!result.resolved) return result;\n if (typeof result.value !== \"string\" && typeof result.value !== \"number\")\n return this.failure(context, \"object keys must be strings or numbers\");\n key = String(result.value);\n } else {\n key = property.name.text;\n }\n properties.set(key, {\n source: this,\n node: ts.isPropertyAssignment(property)\n ? property.initializer\n : ts.isShorthandPropertyAssignment(property)\n ? property.name\n : property,\n });\n }\n return {resolved: true, value: properties};\n }\n\n private readValue(node: ts.Node | undefined, context: SourceReadContext): SourceReadResult {\n const resolved = this.resolveNode(node, context);\n if (!resolved.resolved) return resolved;\n const binding = resolved.value;\n return binding.source.readResolvedValue(binding.node, binding.context);\n }\n\n private readResolvedValue(node: ts.Node, context: SourceReadContext): SourceReadResult {\n const success = (value: SourceValue): SourceReadResult => ({resolved: true, value});\n if (ts.isStringLiteral(node) || ts.isNoSubstitutionTemplateLiteral(node)) return success(node.text);\n if (ts.isNumericLiteral(node)) return success(Number(node.text));\n if (node.kind === ts.SyntaxKind.TrueKeyword) return success(true);\n if (node.kind === ts.SyntaxKind.FalseKeyword) return success(false);\n if (node.kind === ts.SyntaxKind.NullKeyword) return success(null);\n if (ts.isIdentifier(node) && node.text === \"undefined\") return success(undefined);\n if (ts.isPrefixUnaryExpression(node)) {\n const operand = this.readValue(node.operand, context);\n if (!operand.resolved) return operand;\n if (\n typeof operand.value === \"number\" &&\n (node.operator === ts.SyntaxKind.MinusToken || node.operator === ts.SyntaxKind.PlusToken)\n )\n return success(node.operator === ts.SyntaxKind.MinusToken ? -operand.value : operand.value);\n return this.failure(context, \"unsupported unary expression\");\n }\n if (ts.isArrayLiteralExpression(node)) {\n const values: SourceValue[] = [];\n for (const [index, element] of node.elements.entries()) {\n const result = this.readValue(ts.isSpreadElement(element) ? element.expression : element, {\n ...context,\n path: `${context.path}[${index}]`,\n });\n if (!result.resolved) return result;\n if (ts.isSpreadElement(element)) {\n if (!Array.isArray(result.value))\n return this.failure(context, \"array spread must reference a static array\");\n values.push(...result.value);\n } else values.push(result.value);\n }\n return success(values);\n }\n if (ts.isObjectLiteralExpression(node)) {\n const properties = this.objectProperties(node, context);\n if (!properties.resolved) return properties;\n const values: [string, SourceValue][] = [];\n for (const [key, binding] of properties.value) {\n const result = binding.source.readValue(binding.node, {\n ...context,\n path: context.path ? `${context.path}.${key}` : key,\n });\n if (!result.resolved) return result;\n values.push([key, result.value]);\n }\n return success(Object.fromEntries(values));\n }\n if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) {\n const property = ts.isPropertyAccessExpression(node)\n ? success(node.name.text)\n : this.readValue(node.argumentExpression, context);\n if (!property.resolved) return property;\n if (typeof property.value !== \"string\" && typeof property.value !== \"number\")\n return this.failure(context, \"member name must be a string or number\");\n const name = String(property.value);\n if (ts.isIdentifier(node.expression) && !this.getBindings().has(node.expression.text)) {\n const imported = this.getImportBinding(node.expression.text);\n if (imported) {\n const value = this.resolveValue(imported.from, imported.name, name);\n if (value !== undefined) return success(value);\n if (imported.name === \"*\") {\n const binding = this.getImportedSource(imported.from)?.getBindings(true).get(name);\n if (binding) return binding.source.readValue(binding.node, context);\n }\n }\n }\n const resolved = this.resolveNode(node.expression, context);\n if (!resolved.resolved) return resolved;\n const binding = resolved.value;\n if (ts.isObjectLiteralExpression(binding.node)) {\n const properties = binding.source.objectProperties(binding.node, binding.context);\n if (!properties.resolved) return properties;\n const member = properties.value.get(name);\n if (member) return member.source.readValue(member.node, binding.context);\n return this.failure(context, `unknown member ${name}`);\n }\n const object = binding.source.readResolvedValue(binding.node, binding.context);\n if (!object.resolved) return object;\n if (object.value !== null && typeof object.value === \"object\" && Object.hasOwn(object.value, name))\n return success((object.value as Record<string, SourceValue>)[name]);\n return this.failure(context, `unknown member ${name}`);\n }\n if (ts.isEnumDeclaration(node)) {\n const values: Record<string, SourceValue> = {};\n let previous: SourceValue = -1;\n for (const member of node.members) {\n const result = member.initializer\n ? this.readValue(member.initializer, context)\n : typeof previous === \"number\"\n ? success(previous + 1)\n : this.failure(context, \"enum member needs a static initializer\");\n if (!result.resolved) return result;\n if (typeof result.value !== \"string\" && typeof result.value !== \"number\")\n return this.failure(context, \"enum values must be strings or numbers\");\n if (ts.isComputedPropertyName(member.name))\n return this.failure(context, \"computed enum names are not supported\");\n values[member.name.text] = previous = result.value;\n }\n return success(values);\n }\n return this.failure(\n context,\n `unsupported ${ts.SyntaxKind[node.kind]}; use literals, constants or supported enum members`\n );\n }\n\n protected getInputResolver(): ImportResolver {\n if (!this.importResolver) this.importResolver = new ImportResolver();\n return this.importResolver.setBaseDir(path.dirname(this.file));\n }\n\n public setImportResolver(resolver: ImportResolver): ImportResolver {\n return (this.importResolver = resolver.setBaseDir(path.dirname(this.file)));\n }\n}\n"],"mappings":"AAAA,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAQ,sBAAqB;AAC7B,OAAO,eAAe;AAWtB,MAAO,WAAyB;AAAA,EAW5B,YAA+B,MAAc;AAAd;AAAA,EAAe;AAAA,EAAf;AAAA,EAVvB;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU,oBAAI,IAAwB;AAAA,EACpC;AAAA,EAEV,OAAO,KAA0D,MAAiB;AAC9E,WAAO,IAAI,KAAK,IAAI;AAAA,EACxB;AAAA,EAIO,gBAA+B;AAClC,QAAI,CAAC,KAAK,YAAY;AAClB,YAAM,aAAa,GAAG,aAAa,KAAK,MAAM,MAAM;AACpD,WAAK,aAAa,GAAG,iBAAiB,KAAK,MAAM,YAAY,GAAG,aAAa,QAAQ,IAAI;AAAA,IAC7F;AACA,WAAO,KAAK;AAAA,EAChB;AAAA,EAEO,aAAwB;AAC3B,QAAI,KAAK,SAAS;AACd,aAAO,KAAK;AAAA,IAChB;AAEA,SAAK,UAAU,oBAAI,IAAI;AAEvB,UAAM,QAAQ,CAAC,SAAkB;AA5CzC;AA6CY,UAAI,GAAG,oBAAoB,IAAI,KAAK,KAAK,iBAAiB;AACtD,cAAM,aAAc,KAAK,gBAAqC;AAC9D,YAAI,KAAK,cAAc;AAEnB,cAA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@ export { default as OptionFile } from "./OptionFile.js";
|
|
|
2
2
|
export { default as SourceFile } from "./SourceFile.js";
|
|
3
3
|
export { default as ExpressionFile } from "./ExpressionFile.js";
|
|
4
4
|
export * from "./resolvers/index.js";
|
|
5
|
+
export { ExportValueKind } from "./parsers/types.js";
|
|
6
|
+
export type { ExportValue } from "./parsers/types.js";
|
|
@@ -2,7 +2,9 @@ import { default as default2 } from "./OptionFile.js";
|
|
|
2
2
|
import { default as default3 } from "./SourceFile.js";
|
|
3
3
|
import { default as default4 } from "./ExpressionFile.js";
|
|
4
4
|
export * from "./resolvers/index.js";
|
|
5
|
+
import { ExportValueKind } from "./parsers/types.js";
|
|
5
6
|
export {
|
|
7
|
+
ExportValueKind,
|
|
6
8
|
default4 as ExpressionFile,
|
|
7
9
|
default2 as OptionFile,
|
|
8
10
|
default3 as SourceFile
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/cli/entrypoint/file/index.ts"],"sourcesContent":["export {default as OptionFile} from \"./OptionFile\";\nexport {default as SourceFile} from \"./SourceFile\";\nexport {default as ExpressionFile} from \"./ExpressionFile\";\nexport * from \"./resolvers\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAAgC;AACxC,cAAc;","names":["default"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/cli/entrypoint/file/index.ts"],"sourcesContent":["export {default as OptionFile} from \"./OptionFile\";\nexport {default as SourceFile} from \"./SourceFile\";\nexport {default as ExpressionFile} from \"./ExpressionFile\";\nexport * from \"./resolvers\";\nexport {ExportValueKind} from \"./parsers/types\";\nexport type {ExportValue} from \"./parsers/types\";\n"],"mappings":"AAAA,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAA4B;AACpC,SAAmB,WAAXA,gBAAgC;AACxC,cAAc;AACd,SAAQ,uBAAsB;","names":["default"]}
|