@nativescript/vite 8.0.0-beta.0 → 8.0.0-rc.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 +73 -14
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +35 -2
- package/configuration/angular.js +541 -216
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +227 -77
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +17 -96
- package/configuration/javascript.js.map +1 -1
- package/configuration/react.js +41 -73
- package/configuration/react.js.map +1 -1
- package/configuration/solid.js +58 -6
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +15 -96
- package/configuration/typescript.js.map +1 -1
- package/helpers/app-components.d.ts +2 -1
- package/helpers/app-components.js.map +1 -1
- package/helpers/app-css-refresh.d.ts +31 -0
- package/helpers/app-css-refresh.js +43 -0
- package/helpers/app-css-refresh.js.map +1 -0
- package/helpers/app-css-state.d.ts +17 -0
- package/helpers/app-css-state.js +51 -0
- package/helpers/app-css-state.js.map +1 -0
- package/helpers/bundler-context.d.ts +11 -0
- package/helpers/bundler-context.js +71 -0
- package/helpers/bundler-context.js.map +1 -0
- package/helpers/cli-flags.d.ts +12 -0
- package/helpers/cli-flags.js +34 -0
- package/helpers/cli-flags.js.map +1 -1
- package/helpers/commonjs-plugins.d.ts +5 -2
- package/helpers/commonjs-plugins.js +126 -0
- package/helpers/commonjs-plugins.js.map +1 -1
- package/helpers/config-as-json.js +10 -0
- package/helpers/config-as-json.js.map +1 -1
- package/helpers/css-platform-plugin.d.ts +14 -0
- package/helpers/css-platform-plugin.js +43 -25
- package/helpers/css-platform-plugin.js.map +1 -1
- package/helpers/dev-host.d.ts +360 -0
- package/helpers/dev-host.js +694 -0
- package/helpers/dev-host.js.map +1 -0
- package/helpers/dynamic-import-plugin.d.ts +2 -1
- package/helpers/dynamic-import-plugin.js +59 -53
- package/helpers/dynamic-import-plugin.js.map +1 -1
- package/helpers/esbuild-platform-resolver.js +9 -6
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +10 -4
- package/helpers/external-configs.js +63 -15
- package/helpers/external-configs.js.map +1 -1
- package/helpers/flavor.d.ts +13 -0
- package/helpers/flavor.js +18 -1
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +117 -0
- package/helpers/global-defines.js +209 -11
- package/helpers/global-defines.js.map +1 -1
- package/helpers/hmr-scope.d.ts +26 -0
- package/helpers/hmr-scope.js +67 -0
- package/helpers/hmr-scope.js.map +1 -0
- package/helpers/import-meta-path.d.ts +4 -0
- package/helpers/import-meta-path.js +5 -0
- package/helpers/import-meta-path.js.map +1 -0
- package/helpers/import-specifier.d.ts +1 -0
- package/helpers/import-specifier.js +18 -0
- package/helpers/import-specifier.js.map +1 -0
- package/helpers/init.js +6 -20
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +1 -0
- package/helpers/logging.js +65 -4
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +8 -2
- package/helpers/main-entry.js +622 -120
- package/helpers/main-entry.js.map +1 -1
- package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
- package/helpers/nativeclass-esbuild-plugin.js +6 -1
- package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
- package/helpers/nativeclass-transform.d.ts +13 -0
- package/helpers/nativeclass-transform.js +42 -131
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.d.ts +19 -1
- package/helpers/nativeclass-transformer-plugin.js +324 -37
- package/helpers/nativeclass-transformer-plugin.js.map +1 -1
- package/helpers/nativescript-package-resolver.js +10 -62
- package/helpers/nativescript-package-resolver.js.map +1 -1
- package/helpers/normalize-id.d.ts +42 -0
- package/helpers/normalize-id.js +60 -0
- package/helpers/normalize-id.js.map +1 -0
- package/helpers/ns-core-external-urls.d.ts +32 -0
- package/helpers/ns-core-external-urls.js +107 -0
- package/helpers/ns-core-external-urls.js.map +1 -0
- package/helpers/ns-core-url.d.ts +106 -0
- package/helpers/ns-core-url.js +225 -0
- package/helpers/ns-core-url.js.map +1 -0
- package/helpers/optimize-deps.d.ts +16 -0
- package/helpers/optimize-deps.js +17 -0
- package/helpers/optimize-deps.js.map +1 -0
- package/helpers/package-platform-aliases.js +34 -49
- package/helpers/package-platform-aliases.js.map +1 -1
- package/helpers/platform-types.d.ts +2 -0
- package/helpers/platform-types.js +2 -0
- package/helpers/platform-types.js.map +1 -0
- package/helpers/postcss-platform-config.d.ts +17 -1
- package/helpers/postcss-platform-config.js +20 -37
- package/helpers/postcss-platform-config.js.map +1 -1
- package/helpers/project.d.ts +35 -0
- package/helpers/project.js +120 -2
- package/helpers/project.js.map +1 -1
- package/helpers/resolve-main-field-platform.d.ts +20 -0
- package/helpers/resolve-main-field-platform.js +49 -0
- package/helpers/resolve-main-field-platform.js.map +1 -0
- package/helpers/resolver.js +17 -2
- package/helpers/resolver.js.map +1 -1
- package/helpers/theme-core-plugins.js +1 -1
- package/helpers/theme-core-plugins.js.map +1 -1
- package/helpers/ts-config-paths.d.ts +32 -0
- package/helpers/ts-config-paths.js +156 -27
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +2 -1
- package/helpers/typescript-check.js +4 -4
- package/helpers/typescript-check.js.map +1 -1
- package/helpers/ui-registration.d.ts +21 -0
- package/helpers/ui-registration.js +156 -0
- package/helpers/ui-registration.js.map +1 -0
- package/helpers/utils.d.ts +9 -0
- package/helpers/utils.js +22 -2
- package/helpers/utils.js.map +1 -1
- package/helpers/vite-package-version.d.ts +7 -0
- package/helpers/vite-package-version.js +44 -0
- package/helpers/vite-package-version.js.map +1 -0
- package/helpers/workers.d.ts +40 -19
- package/helpers/workers.js +312 -13
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +95 -23
- package/hmr/client/css-handler.js.map +1 -1
- package/hmr/client/css-update-overlay.d.ts +18 -0
- package/hmr/client/css-update-overlay.js +27 -0
- package/hmr/client/css-update-overlay.js.map +1 -0
- package/hmr/client/framework-client-strategy.d.ts +87 -0
- package/hmr/client/framework-client-strategy.js +18 -0
- package/hmr/client/framework-client-strategy.js.map +1 -0
- package/hmr/client/hmr-pending-overlay.d.ts +13 -0
- package/hmr/client/hmr-pending-overlay.js +41 -0
- package/hmr/client/hmr-pending-overlay.js.map +1 -0
- package/hmr/client/hot-context.d.ts +67 -0
- package/hmr/client/hot-context.js +307 -0
- package/hmr/client/hot-context.js.map +1 -0
- package/hmr/client/index.d.ts +9 -1
- package/hmr/client/index.js +91 -1418
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/overlay-driver.d.ts +10 -0
- package/hmr/client/overlay-driver.js +33 -0
- package/hmr/client/overlay-driver.js.map +1 -0
- package/hmr/client/protocol-dispatch.d.ts +8 -0
- package/hmr/client/protocol-dispatch.js +308 -0
- package/hmr/client/protocol-dispatch.js.map +1 -0
- package/hmr/client/root-reset.d.ts +15 -0
- package/hmr/client/root-reset.js +358 -0
- package/hmr/client/root-reset.js.map +1 -0
- package/hmr/client/strategy-loader.d.ts +24 -0
- package/hmr/client/strategy-loader.js +100 -0
- package/hmr/client/strategy-loader.js.map +1 -0
- package/hmr/client/update-pipeline.d.ts +27 -0
- package/hmr/client/update-pipeline.js +464 -0
- package/hmr/client/update-pipeline.js.map +1 -0
- package/hmr/client/utils.d.ts +14 -1
- package/hmr/client/utils.js +265 -54
- package/hmr/client/utils.js.map +1 -1
- package/hmr/client/ws-transport.d.ts +21 -0
- package/hmr/client/ws-transport.js +323 -0
- package/hmr/client/ws-transport.js.map +1 -0
- package/hmr/entry-runtime.d.ts +11 -0
- package/hmr/entry-runtime.js +566 -43
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
- package/hmr/frameworks/angular/build/angular-linker.js +113 -0
- package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
- package/hmr/frameworks/angular/build/inline-decorator-component-templates.d.ts +3 -0
- package/hmr/frameworks/angular/build/inline-decorator-component-templates.js +231 -0
- package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
- package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
- package/hmr/frameworks/angular/build/js-lexer.js +182 -0
- package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
- package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
- package/hmr/frameworks/angular/build/linker-stats.js +29 -0
- package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
- package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
- package/hmr/frameworks/angular/build/shared-linker.js +128 -0
- package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.d.ts +1 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
- package/hmr/frameworks/angular/build/synthesize-injectable-factories.d.ts +3 -0
- package/hmr/frameworks/angular/build/synthesize-injectable-factories.js +241 -0
- package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
- package/hmr/frameworks/angular/build/util.js +155 -0
- package/hmr/frameworks/angular/build/util.js.map +1 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
- package/hmr/frameworks/angular/client/index.d.ts +2 -1
- package/hmr/frameworks/angular/client/index.js +637 -23
- package/hmr/frameworks/angular/client/index.js.map +1 -1
- package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
- package/hmr/frameworks/angular/client/strategy.js +19 -0
- package/hmr/frameworks/angular/client/strategy.js.map +1 -0
- package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
- package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
- package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
- package/hmr/frameworks/angular/server/linker.js +37 -6
- package/hmr/frameworks/angular/server/linker.js.map +1 -1
- package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
- package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
- package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
- package/hmr/frameworks/angular/server/strategy.js +697 -18
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/frameworks/angular/server/websocket-angular-entry.d.ts +2 -0
- package/hmr/frameworks/angular/server/websocket-angular-entry.js +68 -0
- package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.d.ts +94 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +485 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
- package/hmr/frameworks/react/client/strategy.d.ts +12 -0
- package/hmr/frameworks/react/client/strategy.js +27 -0
- package/hmr/frameworks/react/client/strategy.js.map +1 -0
- package/hmr/frameworks/react/server/strategy.d.ts +2 -0
- package/hmr/frameworks/react/server/strategy.js +230 -0
- package/hmr/frameworks/react/server/strategy.js.map +1 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
- package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
- package/hmr/frameworks/solid/client/app-runtime.js +252 -0
- package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
- package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
- package/hmr/frameworks/solid/client/strategy.js +391 -0
- package/hmr/frameworks/solid/client/strategy.js.map +1 -0
- package/hmr/frameworks/solid/server/strategy.js +293 -16
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
- package/hmr/frameworks/typescript/client/strategy.js +418 -0
- package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
- package/hmr/frameworks/typescript/server/strategy.js +48 -16
- package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
- package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
- package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
- package/hmr/frameworks/vue/client/index.d.ts +10 -1
- package/hmr/frameworks/vue/client/index.js +287 -562
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
- package/hmr/frameworks/vue/client/navigate-app.js +178 -0
- package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
- package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
- package/hmr/frameworks/vue/client/strategy.js +152 -0
- package/hmr/frameworks/vue/client/strategy.js.map +1 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
- package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
- package/hmr/frameworks/vue/server/compiler.js +3 -1
- package/hmr/frameworks/vue/server/compiler.js.map +1 -1
- package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
- package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
- package/hmr/frameworks/vue/server/strategy.js +291 -7
- package/hmr/frameworks/vue/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
- package/hmr/helpers/ast-normalizer.d.ts +3 -1
- package/hmr/helpers/ast-normalizer.js +131 -24
- package/hmr/helpers/ast-normalizer.js.map +1 -1
- package/hmr/helpers/cjs-named-exports.d.ts +23 -0
- package/hmr/helpers/cjs-named-exports.js +152 -0
- package/hmr/helpers/cjs-named-exports.js.map +1 -0
- package/hmr/helpers/package-exports.d.ts +16 -0
- package/hmr/helpers/package-exports.js +396 -0
- package/hmr/helpers/package-exports.js.map +1 -0
- package/hmr/helpers/vendor-rewrite.d.ts +1 -1
- package/hmr/helpers/vendor-rewrite.js +5 -3
- package/hmr/helpers/vendor-rewrite.js.map +1 -1
- package/hmr/server/boot-recording.d.ts +51 -0
- package/hmr/server/boot-recording.js +214 -0
- package/hmr/server/boot-recording.js.map +1 -0
- package/hmr/server/constants.d.ts +1 -0
- package/hmr/server/constants.js +21 -4
- package/hmr/server/constants.js.map +1 -1
- package/hmr/server/content-css-update.d.ts +54 -0
- package/hmr/server/content-css-update.js +78 -0
- package/hmr/server/content-css-update.js.map +1 -0
- package/hmr/server/core-bundle.d.ts +140 -0
- package/hmr/server/core-bundle.js +614 -0
- package/hmr/server/core-bundle.js.map +1 -0
- package/hmr/server/core-sanitize.d.ts +130 -4
- package/hmr/server/core-sanitize.js +393 -32
- package/hmr/server/core-sanitize.js.map +1 -1
- package/hmr/server/css-connect-sync.d.ts +28 -0
- package/hmr/server/css-connect-sync.js +59 -0
- package/hmr/server/css-connect-sync.js.map +1 -0
- package/hmr/server/css-device-module.d.ts +28 -0
- package/hmr/server/css-device-module.js +44 -0
- package/hmr/server/css-device-module.js.map +1 -0
- package/hmr/server/css-update-message.d.ts +23 -0
- package/hmr/server/css-update-message.js +41 -0
- package/hmr/server/css-update-message.js.map +1 -0
- package/hmr/server/deps-bundle.d.ts +233 -0
- package/hmr/server/deps-bundle.js +1022 -0
- package/hmr/server/deps-bundle.js.map +1 -0
- package/hmr/server/device-transform-helpers.d.ts +24 -0
- package/hmr/server/device-transform-helpers.js +408 -0
- package/hmr/server/device-transform-helpers.js.map +1 -0
- package/hmr/server/framework-strategy.d.ts +182 -11
- package/hmr/server/hmr-module-graph.d.ts +37 -0
- package/hmr/server/hmr-module-graph.js +215 -0
- package/hmr/server/hmr-module-graph.js.map +1 -0
- package/hmr/server/import-map.d.ts +99 -0
- package/hmr/server/import-map.js +294 -0
- package/hmr/server/import-map.js.map +1 -0
- package/hmr/server/index.d.ts +2 -1
- package/hmr/server/index.js +7 -16
- package/hmr/server/index.js.map +1 -1
- package/hmr/server/node-builtins-route.d.ts +12 -0
- package/hmr/server/node-builtins-route.js +86 -0
- package/hmr/server/node-builtins-route.js.map +1 -0
- package/hmr/server/ns-core-cjs-shape.d.ts +204 -0
- package/hmr/server/ns-core-cjs-shape.js +271 -0
- package/hmr/server/ns-core-cjs-shape.js.map +1 -0
- package/hmr/server/ns-m-response-memo.d.ts +10 -0
- package/hmr/server/ns-m-response-memo.js +33 -0
- package/hmr/server/ns-m-response-memo.js.map +1 -0
- package/hmr/server/ns-rt-bridge.d.ts +51 -0
- package/hmr/server/ns-rt-bridge.js +131 -0
- package/hmr/server/ns-rt-bridge.js.map +1 -0
- package/hmr/server/ns-rt-route.d.ts +5 -0
- package/hmr/server/ns-rt-route.js +39 -0
- package/hmr/server/ns-rt-route.js.map +1 -0
- package/hmr/server/perf-instrumentation.d.ts +114 -0
- package/hmr/server/perf-instrumentation.js +197 -0
- package/hmr/server/perf-instrumentation.js.map +1 -0
- package/hmr/server/process-code-for-device.d.ts +44 -0
- package/hmr/server/process-code-for-device.js +834 -0
- package/hmr/server/process-code-for-device.js.map +1 -0
- package/hmr/server/require-guard.d.ts +1 -0
- package/hmr/server/require-guard.js +12 -0
- package/hmr/server/require-guard.js.map +1 -0
- package/hmr/server/rewrite-imports.d.ts +2 -0
- package/hmr/server/rewrite-imports.js +631 -0
- package/hmr/server/rewrite-imports.js.map +1 -0
- package/hmr/server/route-helpers.d.ts +7 -0
- package/hmr/server/route-helpers.js +13 -0
- package/hmr/server/route-helpers.js.map +1 -0
- package/hmr/server/runtime-graph-filter.d.ts +5 -0
- package/hmr/server/runtime-graph-filter.js +28 -0
- package/hmr/server/runtime-graph-filter.js.map +1 -0
- package/hmr/server/server-origin.d.ts +2 -0
- package/hmr/server/server-origin.js +88 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/shared-transform-request.d.ts +12 -0
- package/hmr/server/shared-transform-request.js +143 -0
- package/hmr/server/shared-transform-request.js.map +1 -0
- package/hmr/server/socket-utils.d.ts +10 -0
- package/hmr/server/socket-utils.js +14 -0
- package/hmr/server/socket-utils.js.map +1 -0
- package/hmr/server/transform-cache-invalidation.d.ts +37 -0
- package/hmr/server/transform-cache-invalidation.js +156 -0
- package/hmr/server/transform-cache-invalidation.js.map +1 -0
- package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
- package/hmr/server/vendor-bare-module-shims.js +80 -0
- package/hmr/server/vendor-bare-module-shims.js.map +1 -0
- package/hmr/server/vite-plugin.d.ts +22 -1
- package/hmr/server/vite-plugin.js +655 -58
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +68 -0
- package/hmr/server/websocket-core-bridge.js +370 -0
- package/hmr/server/websocket-core-bridge.js.map +1 -0
- package/hmr/server/websocket-device-transform.d.ts +3 -0
- package/hmr/server/websocket-device-transform.js +7 -0
- package/hmr/server/websocket-device-transform.js.map +1 -0
- package/hmr/server/websocket-graph-upsert.d.ts +21 -0
- package/hmr/server/websocket-graph-upsert.js +33 -0
- package/hmr/server/websocket-graph-upsert.js.map +1 -0
- package/hmr/server/websocket-hmr-pending.d.ts +29 -0
- package/hmr/server/websocket-hmr-pending.js +33 -0
- package/hmr/server/websocket-hmr-pending.js.map +1 -0
- package/hmr/server/websocket-hot-update.d.ts +80 -0
- package/hmr/server/websocket-hot-update.js +295 -0
- package/hmr/server/websocket-hot-update.js.map +1 -0
- package/hmr/server/websocket-import-map-route.d.ts +15 -0
- package/hmr/server/websocket-import-map-route.js +51 -0
- package/hmr/server/websocket-import-map-route.js.map +1 -0
- package/hmr/server/websocket-module-bindings.d.ts +21 -0
- package/hmr/server/websocket-module-bindings.js +504 -0
- package/hmr/server/websocket-module-bindings.js.map +1 -0
- package/hmr/server/websocket-module-specifiers.d.ts +96 -0
- package/hmr/server/websocket-module-specifiers.js +819 -0
- package/hmr/server/websocket-module-specifiers.js.map +1 -0
- package/hmr/server/websocket-ns-core.d.ts +34 -0
- package/hmr/server/websocket-ns-core.js +414 -0
- package/hmr/server/websocket-ns-core.js.map +1 -0
- package/hmr/server/websocket-ns-entry.d.ts +21 -0
- package/hmr/server/websocket-ns-entry.js +163 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +19 -0
- package/hmr/server/websocket-ns-m-paths.js +115 -0
- package/hmr/server/websocket-ns-m-paths.js.map +1 -0
- package/hmr/server/websocket-ns-m-request.d.ts +46 -0
- package/hmr/server/websocket-ns-m-request.js +197 -0
- package/hmr/server/websocket-ns-m-request.js.map +1 -0
- package/hmr/server/websocket-ns-m.d.ts +52 -0
- package/hmr/server/websocket-ns-m.js +590 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +89 -0
- package/hmr/server/websocket-served-module-helpers.js +935 -0
- package/hmr/server/websocket-served-module-helpers.js.map +1 -0
- package/hmr/server/websocket-txn.d.ts +6 -0
- package/hmr/server/websocket-txn.js +42 -0
- package/hmr/server/websocket-txn.js.map +1 -0
- package/hmr/server/websocket-vendor-unifier.d.ts +9 -0
- package/hmr/server/websocket-vendor-unifier.js +46 -0
- package/hmr/server/websocket-vendor-unifier.js.map +1 -0
- package/hmr/server/websocket.d.ts +7 -17
- package/hmr/server/websocket.js +723 -5376
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +107 -0
- package/hmr/shared/ns-globals.js +29 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/package-classifier.d.ts +9 -0
- package/hmr/shared/package-classifier.js +58 -0
- package/hmr/shared/package-classifier.js.map +1 -0
- package/hmr/shared/protocol.d.ts +157 -0
- package/hmr/shared/protocol.js +28 -0
- package/hmr/shared/protocol.js.map +1 -0
- package/hmr/shared/runtime/boot-complete.d.ts +14 -0
- package/hmr/shared/runtime/boot-complete.js +32 -0
- package/hmr/shared/runtime/boot-complete.js.map +1 -0
- package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
- package/hmr/shared/runtime/boot-progress.d.ts +44 -0
- package/hmr/shared/runtime/boot-progress.js +134 -0
- package/hmr/shared/runtime/boot-progress.js.map +1 -0
- package/hmr/shared/runtime/boot-timeline.d.ts +17 -0
- package/hmr/shared/runtime/boot-timeline.js +40 -0
- package/hmr/shared/runtime/boot-timeline.js.map +1 -0
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +97 -0
- package/hmr/shared/runtime/browser-runtime-contract.js +66 -0
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
- package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
- package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
- package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
- package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
- package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
- package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay.d.ts +39 -0
- package/hmr/shared/runtime/dev-overlay.js +292 -0
- package/hmr/shared/runtime/dev-overlay.js.map +1 -0
- package/hmr/shared/runtime/global-scope.d.ts +18 -0
- package/hmr/shared/runtime/global-scope.js +21 -0
- package/hmr/shared/runtime/global-scope.js.map +1 -0
- package/hmr/shared/runtime/hooks.js +2 -1
- package/hmr/shared/runtime/hooks.js.map +1 -1
- package/hmr/shared/runtime/launch-bridge.d.ts +9 -0
- package/hmr/shared/runtime/launch-bridge.js +98 -0
- package/hmr/shared/runtime/launch-bridge.js.map +1 -0
- package/hmr/shared/runtime/module-provenance.d.ts +1 -0
- package/hmr/shared/runtime/module-provenance.js +64 -0
- package/hmr/shared/runtime/module-provenance.js.map +1 -0
- package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
- package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
- package/hmr/shared/runtime/overlay-flag.js +34 -0
- package/hmr/shared/runtime/overlay-flag.js.map +1 -0
- package/hmr/shared/runtime/platform-polyfills.d.ts +26 -0
- package/hmr/shared/runtime/platform-polyfills.js +122 -0
- package/hmr/shared/runtime/platform-polyfills.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
- package/hmr/shared/runtime/root-placeholder-view.js +311 -0
- package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
- package/hmr/shared/runtime/root-placeholder.js +778 -83
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.d.ts +1 -0
- package/hmr/shared/runtime/session-bootstrap.js +350 -0
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -0
- package/hmr/shared/runtime/vendor-bootstrap.js +54 -16
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
- package/hmr/shared/runtime/vendor-resolve.js +45 -0
- package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
- package/hmr/shared/runtime/worker-tracking.d.ts +28 -0
- package/hmr/shared/runtime/worker-tracking.js +114 -0
- package/hmr/shared/runtime/worker-tracking.js.map +1 -0
- package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
- package/hmr/shared/vendor/manifest-collect.js +909 -0
- package/hmr/shared/vendor/manifest-collect.js.map +1 -0
- package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
- package/hmr/shared/vendor/manifest-loader.js +5 -3
- package/hmr/shared/vendor/manifest-loader.js.map +1 -1
- package/hmr/shared/vendor/manifest.d.ts +12 -0
- package/hmr/shared/vendor/manifest.js +341 -545
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/hmr/shared/vendor/registry.d.ts +2 -0
- package/hmr/shared/vendor/registry.js +118 -7
- package/hmr/shared/vendor/registry.js.map +1 -1
- package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
- package/hmr/shared/vendor/vendor-device-shim.js +208 -0
- package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +107 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +76 -14
- package/runtime/core-aliases-early.js +103 -81
- package/runtime/core-aliases-early.js.map +1 -1
- package/shims/react-jsx-runtime.d.ts +4 -0
- package/shims/react-jsx-runtime.js +61 -0
- package/shims/react-jsx-runtime.js.map +1 -0
- package/shims/solid-jsx-runtime.d.ts +7 -0
- package/shims/solid-jsx-runtime.js +17 -0
- package/shims/solid-jsx-runtime.js.map +1 -0
- package/helpers/angular/angular-linker.d.ts +0 -13
- package/helpers/angular/angular-linker.js +0 -189
- package/helpers/angular/angular-linker.js.map +0 -1
- package/helpers/angular/shared-linker.d.ts +0 -4
- package/helpers/angular/shared-linker.js +0 -39
- package/helpers/angular/shared-linker.js.map +0 -1
- package/helpers/angular/util.js +0 -67
- package/helpers/angular/util.js.map +0 -1
- package/helpers/module-runner-patch.d.ts +0 -3
- package/helpers/module-runner-patch.js +0 -63
- package/helpers/module-runner-patch.js.map +0 -1
- package/helpers/prelink-angular.d.ts +0 -2
- package/helpers/prelink-angular.js +0 -117
- package/helpers/prelink-angular.js.map +0 -1
- package/hmr/shared/runtime/http-only-boot.d.ts +0 -1
- package/hmr/shared/runtime/http-only-boot.js +0 -124
- package/hmr/shared/runtime/http-only-boot.js.map +0 -1
- package/hmr/vendor-bootstrap.d.ts +0 -3
- package/hmr/vendor-bootstrap.js +0 -32
- package/hmr/vendor-bootstrap.js.map +0 -1
- package/shims/react-reconciler-constants.d.ts +0 -14
- package/shims/react-reconciler-constants.js +0 -21
- package/shims/react-reconciler-constants.js.map +0 -1
- package/shims/react-reconciler.d.ts +0 -8
- package/shims/react-reconciler.js +0 -15
- package/shims/react-reconciler.js.map +0 -1
- package/transformers/NativeClass/index.d.ts +0 -2
- package/transformers/NativeClass/index.js +0 -222
- package/transformers/NativeClass/index.js.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version of this @nativescript/vite package (not the app's dependency
|
|
3
|
+
* declaration) — used by the startup banner and disk-cache keys. Resolution
|
|
4
|
+
* prefers the package export map, then walks up from this module to the
|
|
5
|
+
* package root (the export map does not always expose package.json).
|
|
6
|
+
*/
|
|
7
|
+
export declare function getVitePackageVersion(): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
let cachedVersion = null;
|
|
5
|
+
/**
|
|
6
|
+
* Version of this @nativescript/vite package (not the app's dependency
|
|
7
|
+
* declaration) — used by the startup banner and disk-cache keys. Resolution
|
|
8
|
+
* prefers the package export map, then walks up from this module to the
|
|
9
|
+
* package root (the export map does not always expose package.json).
|
|
10
|
+
*/
|
|
11
|
+
export function getVitePackageVersion() {
|
|
12
|
+
if (cachedVersion)
|
|
13
|
+
return cachedVersion;
|
|
14
|
+
try {
|
|
15
|
+
const req = createRequire(import.meta.url);
|
|
16
|
+
const pkg = req('@nativescript/vite/package.json');
|
|
17
|
+
if (typeof pkg?.version === 'string') {
|
|
18
|
+
cachedVersion = pkg.version;
|
|
19
|
+
return cachedVersion;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
catch { }
|
|
23
|
+
try {
|
|
24
|
+
let dir = path.dirname(new URL(import.meta.url).pathname);
|
|
25
|
+
for (let i = 0; i < 6; i++) {
|
|
26
|
+
const candidate = path.join(dir, 'package.json');
|
|
27
|
+
if (existsSync(candidate)) {
|
|
28
|
+
const parsed = JSON.parse(readFileSync(candidate, 'utf-8'));
|
|
29
|
+
if (parsed?.name === '@nativescript/vite' && typeof parsed.version === 'string') {
|
|
30
|
+
cachedVersion = parsed.version;
|
|
31
|
+
return cachedVersion;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const parent = path.dirname(dir);
|
|
35
|
+
if (parent === dir)
|
|
36
|
+
break;
|
|
37
|
+
dir = parent;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch { }
|
|
41
|
+
cachedVersion = 'unknown';
|
|
42
|
+
return cachedVersion;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=vite-package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-package-version.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/vite-package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB;IACpC,IAAI,aAAa;QAAE,OAAO,aAAa,CAAC;IACxC,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACnD,IAAI,OAAO,GAAG,EAAE,OAAO,KAAK,QAAQ,EAAE,CAAC;YACtC,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC;YAC5B,OAAO,aAAa,CAAC;QACtB,CAAC;IACF,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;IACV,IAAI,CAAC;QACJ,IAAI,G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
3
|
+
platform: string;
|
|
4
|
+
verbose?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function nativescriptWorkerLoaderStubPlugin(): Plugin;
|
|
7
|
+
/**
|
|
8
|
+
* Rewrite every code-level `import.meta` usage in a worker module so the
|
|
9
|
+
* emitted classic script can compile.
|
|
10
|
+
*
|
|
11
|
+
* Workers are emitted as classic scripts (the NS worker bootstrap `require()`s
|
|
12
|
+
* them), where ANY code-level `import.meta` token is a compile-time
|
|
13
|
+
* SyntaxError — the runtime reports "Cannot compile script" the moment the
|
|
14
|
+
* worker starts, so the failure looks arbitrary per-worker. Beyond the
|
|
15
|
+
* `.url`/`.dirname` static substitutions, HMR helpers pulled into worker
|
|
16
|
+
* graphs (e.g. @nativescript/angular's hmr view-cache) read `import.meta.hot`
|
|
17
|
+
* / `import.meta["hot"]` / `import.meta["webpackHot"]` defensively behind
|
|
18
|
+
* try/catch — every remaining member access is rewritten to `(undefined)`;
|
|
19
|
+
* workers never have HMR.
|
|
20
|
+
*
|
|
21
|
+
* Bare `import.meta` tokens (no member access) are left alone on purpose:
|
|
22
|
+
* every observed occurrence lives inside string literals (e.g. acorn's parser
|
|
23
|
+
* error messages when a JS parser is bundled into a worker), where they are
|
|
24
|
+
* harmless and rewriting would corrupt library data.
|
|
25
|
+
*
|
|
26
|
+
* Returns `null` when the module contains no `import.meta` at all. None of
|
|
27
|
+
* the replacements add or remove lines, so existing line-level mappings stay
|
|
28
|
+
* valid — the explicit `map: null` also keeps Rolldown from flagging
|
|
29
|
+
* SOURCEMAP_BROKEN on every worker chunk.
|
|
30
|
+
*/
|
|
31
|
+
export declare function neutralizeWorkerImportMeta(code: string): {
|
|
32
|
+
code: string;
|
|
33
|
+
map: null;
|
|
34
|
+
} | null;
|
|
35
|
+
export declare function getWorkerPlugins(platformOrOpts: string | WorkerPluginsOptions): any[];
|
|
36
|
+
export interface WorkerHmrUrlPluginOptions {
|
|
37
|
+
verbose?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare function viteWorkerAssetPathToNsMUrl(assetPath: string, projectRoot: string, workspaceRoot: string | null): string | null;
|
|
40
|
+
export declare function workerHmrUrlPlugin(opts?: WorkerHmrUrlPluginOptions): Plugin;
|
|
20
41
|
export declare function workerUrlPlugin(): {
|
|
21
42
|
name: string;
|
|
22
43
|
generateBundle(options: any, bundle: any): void;
|
package/helpers/workers.js
CHANGED
|
@@ -1,7 +1,96 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { nsConfigToJson, resolveNativeScriptPlatformFile } from './utils.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { createTsConfigPathsResolver, getTsConfigData } from './ts-config-paths.js';
|
|
4
|
+
import { packagePlatformResolverPlugin } from './package-platform-aliases.js';
|
|
5
|
+
import { nativescriptPackageResolver } from './nativescript-package-resolver.js';
|
|
6
|
+
import { findMonorepoWorkspaceRoot, getProjectRootPath } from './project.js';
|
|
7
|
+
import { normalizeModuleId } from './normalize-id.js';
|
|
8
|
+
// Stub out webpack-style `nativescript-worker-loader!./worker.js` imports.
|
|
9
|
+
// Some packages (e.g. `nativescript-sqlite-commercial`) still ship a webpack 4
|
|
10
|
+
// branch like:
|
|
11
|
+
// if (global.TNS_WEBPACK >= 5) { worker = new Worker("./worker.js"); }
|
|
12
|
+
// else { require("nativescript-worker-loader!./worker.js"); }
|
|
13
|
+
// At runtime under @nativescript/vite, `global.TNS_WEBPACK` is undefined so the
|
|
14
|
+
// loader-prefix branch is never executed — but Rolldown still statically scans
|
|
15
|
+
// it and fails to resolve the webpack-only specifier. Returning a virtual stub
|
|
16
|
+
// module satisfies the static graph without touching runtime semantics.
|
|
17
|
+
const NS_WORKER_LOADER_STUB_ID = '\0ns-worker-loader-stub';
|
|
18
|
+
export function nativescriptWorkerLoaderStubPlugin() {
|
|
19
|
+
return {
|
|
20
|
+
name: 'nativescript-worker-loader-stub',
|
|
21
|
+
enforce: 'pre',
|
|
22
|
+
resolveId(id) {
|
|
23
|
+
if (typeof id === 'string' && id.startsWith('nativescript-worker-loader!')) {
|
|
24
|
+
return NS_WORKER_LOADER_STUB_ID;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
},
|
|
28
|
+
load(id) {
|
|
29
|
+
if (id === NS_WORKER_LOADER_STUB_ID) {
|
|
30
|
+
// The default export is a constructor — emulate `new SqliteWorker()`
|
|
31
|
+
// so the legacy code path doesn't crash if it ever runs accidentally.
|
|
32
|
+
return ['const message = "nativescript-worker-loader! is a webpack-only loader prefix and is not supported under Vite. Update the calling package to use `new Worker(new URL(...))` for worker entry points.";', 'function NSWorkerLoaderStub() { throw new Error(message); }', 'export default NSWorkerLoaderStub;'].join('\n');
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Rewrite every code-level `import.meta` usage in a worker module so the
|
|
40
|
+
* emitted classic script can compile.
|
|
41
|
+
*
|
|
42
|
+
* Workers are emitted as classic scripts (the NS worker bootstrap `require()`s
|
|
43
|
+
* them), where ANY code-level `import.meta` token is a compile-time
|
|
44
|
+
* SyntaxError — the runtime reports "Cannot compile script" the moment the
|
|
45
|
+
* worker starts, so the failure looks arbitrary per-worker. Beyond the
|
|
46
|
+
* `.url`/`.dirname` static substitutions, HMR helpers pulled into worker
|
|
47
|
+
* graphs (e.g. @nativescript/angular's hmr view-cache) read `import.meta.hot`
|
|
48
|
+
* / `import.meta["hot"]` / `import.meta["webpackHot"]` defensively behind
|
|
49
|
+
* try/catch — every remaining member access is rewritten to `(undefined)`;
|
|
50
|
+
* workers never have HMR.
|
|
51
|
+
*
|
|
52
|
+
* Bare `import.meta` tokens (no member access) are left alone on purpose:
|
|
53
|
+
* every observed occurrence lives inside string literals (e.g. acorn's parser
|
|
54
|
+
* error messages when a JS parser is bundled into a worker), where they are
|
|
55
|
+
* harmless and rewriting would corrupt library data.
|
|
56
|
+
*
|
|
57
|
+
* Returns `null` when the module contains no `import.meta` at all. None of
|
|
58
|
+
* the replacements add or remove lines, so existing line-level mappings stay
|
|
59
|
+
* valid — the explicit `map: null` also keeps Rolldown from flagging
|
|
60
|
+
* SOURCEMAP_BROKEN on every worker chunk.
|
|
61
|
+
*/
|
|
62
|
+
export function neutralizeWorkerImportMeta(code) {
|
|
63
|
+
if (!code.includes('import.meta')) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const rewritten = code
|
|
67
|
+
.replace(/import\.meta\.dirname/g, '""')
|
|
68
|
+
.replace(/import\.meta\.url/g, '"file:///app/"')
|
|
69
|
+
// import.meta["hot"], import.meta['webpackHot'], ...
|
|
70
|
+
.replace(/import\.meta\s*\[\s*(['"])[^'"\]]*\1\s*\]/g, '(undefined)')
|
|
71
|
+
// import.meta.hot, import.meta.env, ...
|
|
72
|
+
.replace(/import\.meta\.\w+/g, '(undefined)');
|
|
73
|
+
return { code: rewritten, map: null };
|
|
74
|
+
}
|
|
75
|
+
// Worker bundles run as separate Rolldown builds and do NOT inherit `config.plugins`
|
|
76
|
+
// at build time (see https://vite.dev/config/worker-options#worker-plugins). To match
|
|
77
|
+
// the main bundle's module resolution behavior, mirror the bare-specifier resolvers
|
|
78
|
+
// that the main config registers — most importantly the tsconfig `paths` resolver,
|
|
79
|
+
// without which workspace path aliases (e.g. `@scope/lib/util`) fail to resolve in
|
|
80
|
+
// any code reachable from a `new Worker(new URL(...))` entry point.
|
|
81
|
+
export function getWorkerPlugins(platformOrOpts) {
|
|
82
|
+
const opts = typeof platformOrOpts === 'string' ? { platform: platformOrOpts } : platformOrOpts;
|
|
83
|
+
const { platform, verbose } = opts;
|
|
84
|
+
// Reuse the same tsconfig data the main config does. `getTsConfigData` is internally
|
|
85
|
+
// memoized by config path, so this is essentially free on subsequent calls.
|
|
86
|
+
const tsConfig = getTsConfigData({ platform, verbose });
|
|
87
|
+
const tsConfigResolver = createTsConfigPathsResolver({
|
|
88
|
+
paths: tsConfig.paths,
|
|
89
|
+
baseUrl: tsConfig.baseUrl,
|
|
90
|
+
platform,
|
|
91
|
+
verbose,
|
|
92
|
+
});
|
|
93
|
+
const plugins = [
|
|
5
94
|
// Handle ~/package.json virtual module for workers
|
|
6
95
|
{
|
|
7
96
|
name: 'worker-virtual-package-json',
|
|
@@ -37,7 +126,9 @@ export function getWorkerPlugins(platform) {
|
|
|
37
126
|
// Use the existing NativeScript platform file resolver
|
|
38
127
|
const platformResolvedFile = resolveNativeScriptPlatformFile(testPath, platform);
|
|
39
128
|
if (platformResolvedFile) {
|
|
40
|
-
|
|
129
|
+
// Canonicalize so the worker bundle dedupes core the same way
|
|
130
|
+
// the main bundle does (forward slash + uppercase Windows drive).
|
|
131
|
+
return normalizeModuleId(platformResolvedFile);
|
|
41
132
|
}
|
|
42
133
|
}
|
|
43
134
|
return null;
|
|
@@ -49,18 +140,214 @@ export function getWorkerPlugins(platform) {
|
|
|
49
140
|
{
|
|
50
141
|
name: 'worker-import-meta-handler',
|
|
51
142
|
transform(code, id) {
|
|
52
|
-
|
|
53
|
-
if (code.includes('import.meta.dirname')) {
|
|
54
|
-
code = code.replace(/import\.meta\.dirname/g, '""');
|
|
55
|
-
}
|
|
56
|
-
// Replace import.meta.url with a static value for workers
|
|
57
|
-
if (code.includes('import.meta.url')) {
|
|
58
|
-
code = code.replace(/import\.meta\.url/g, '"file:///app/"');
|
|
59
|
-
}
|
|
60
|
-
return code;
|
|
143
|
+
return neutralizeWorkerImportMeta(code);
|
|
61
144
|
},
|
|
62
145
|
},
|
|
63
146
|
];
|
|
147
|
+
// Mirror the main-config bare-specifier resolvers for workers. Without these,
|
|
148
|
+
// workspace tsconfig paths and platform-specific package mains fail to resolve
|
|
149
|
+
// when code is pulled into a worker bundle.
|
|
150
|
+
if (tsConfigResolver) {
|
|
151
|
+
plugins.push(tsConfigResolver);
|
|
152
|
+
}
|
|
153
|
+
plugins.push(packagePlatformResolverPlugin({ tsConfig, platform, verbose }));
|
|
154
|
+
plugins.push(nativescriptPackageResolver(platform));
|
|
155
|
+
plugins.push(nativescriptWorkerLoaderStubPlugin());
|
|
156
|
+
return plugins;
|
|
157
|
+
}
|
|
158
|
+
// In dev/HMR mode, Vite's `workerImportMetaUrlPlugin` rewrites
|
|
159
|
+
// `new Worker(new URL('./foo.worker', import.meta.url))` into
|
|
160
|
+
// `new Worker(new URL(/* @vite-ignore */"/src/.../foo.worker.ts?worker_file&type=classic", '' + import.meta.url))`.
|
|
161
|
+
// That output breaks under NativeScript for two independent reasons:
|
|
162
|
+
//
|
|
163
|
+
// 1. TypeError on `new URL(spec, '' + import.meta.url)`: the iOS V8
|
|
164
|
+
// runtime's `InitializeImportMetaObject` (Runtime.mm) blindly prefixes
|
|
165
|
+
// the module registry key with `file://`, so HTTP-served modules get
|
|
166
|
+
// `import.meta.url = "file://http://localhost:5173/ns/m/..."` — a
|
|
167
|
+
// malformed base URL. The worker creation site (unlike other served
|
|
168
|
+
// `new URL` sites) has no try/catch.
|
|
169
|
+
// 2. Even with a valid base, the URL points at Vite's `?worker_file`
|
|
170
|
+
// middleware, whose bundle's internal `/src/...` and `/@fs/...` imports
|
|
171
|
+
// bypass the `/ns/m/` pipeline — the worker crashes on its first
|
|
172
|
+
// transitive import.
|
|
173
|
+
//
|
|
174
|
+
// The rewrite uses `__NS_HTTP_ORIGIN__` (set by `hmr/entry-runtime.ts`) so
|
|
175
|
+
// non-localhost origins work. Production counterpart: `workerUrlPlugin()`.
|
|
176
|
+
// Matches Vite-emitted dev shape:
|
|
177
|
+
// new Worker(new URL(/* @vite-ignore */ "/src/.../foo.worker.ts?worker_file&type=classic", '' + import.meta.url))
|
|
178
|
+
// The `/* @vite-ignore */` and `'' +` coercion are constants Vite always emits
|
|
179
|
+
// (see `workerImportMetaUrlPlugin` in vite/dist/node/chunks/node.js), so we
|
|
180
|
+
// match them as fixed structure rather than as optional fragments. The asset
|
|
181
|
+
// path can use single, double, or template-literal quotes.
|
|
182
|
+
const WORKER_VITE_DEV_RE = /new\s+Worker\s*\(\s*new\s+URL\s*\(\s*\/\*\s*@vite-ignore\s*\*\/\s*(['"`])([^'"`]+)\1\s*,\s*(?:'\s*'|"\s*"|`\s*`)\s*\+\s*import\.meta\.url\s*\)\s*(,\s*\{[^}]*\})?\s*\)/g;
|
|
183
|
+
const SKIP_TRANSFORM_ID_RE = /(?:^|\/)(?:node_modules|\.vite)\//;
|
|
184
|
+
// Strip Vite's `?worker_file&type=classic` query suffix (and any extension) so
|
|
185
|
+
// the resulting URL matches the canonical `/ns/m/<rel-without-ext>` shape that
|
|
186
|
+
// the NS HMR pipeline serves. Exported for unit testing.
|
|
187
|
+
export function viteWorkerAssetPathToNsMUrl(assetPath, projectRoot, workspaceRoot) {
|
|
188
|
+
if (typeof assetPath !== 'string' || !assetPath) {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
// Vite emits asset paths in two shapes during dev/HMR:
|
|
192
|
+
// 1. Project-relative: "/src/.../foo.worker.ts?worker_file&type=classic"
|
|
193
|
+
// 2. Absolute fs: "/@fs/Users/.../src/.../foo.worker.ts?worker_file&type=classic"
|
|
194
|
+
// We only need to match #1 here — the project-relative form Vite uses for
|
|
195
|
+
// project-local files. Absolute-fs paths come from outside the project root
|
|
196
|
+
// (e.g. workspace libs in a monorepo), and we hand those off to Vite's
|
|
197
|
+
// default behavior rather than try to map them into `/ns/m/`.
|
|
198
|
+
const queryIdx = assetPath.indexOf('?');
|
|
199
|
+
const cleanPath = queryIdx === -1 ? assetPath : assetPath.slice(0, queryIdx);
|
|
200
|
+
const query = queryIdx === -1 ? '' : assetPath.slice(queryIdx);
|
|
201
|
+
// Confirm this is the worker_file query Vite emits — leaves non-worker URLs
|
|
202
|
+
// (e.g. asset URLs from `assetImportMetaUrlPlugin`) alone.
|
|
203
|
+
if (!/[?&]worker_file(?:&|=|$)/.test(query)) {
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
// Project-relative: "/src/..." → "/ns/m/src/..."
|
|
207
|
+
if (cleanPath.startsWith('/') && !cleanPath.startsWith('/@fs/')) {
|
|
208
|
+
// Strip the rewritable extension so the URL matches the canonical
|
|
209
|
+
// `/ns/m/<rel-without-ext>` shape served by the HMR middleware.
|
|
210
|
+
const noExt = cleanPath.replace(/\.(?:ts|tsx|mjs|cjs|js|jsx)$/, '');
|
|
211
|
+
return `/ns/m${noExt}`;
|
|
212
|
+
}
|
|
213
|
+
// Absolute-fs: "/@fs/abs/path/..." — try to map into project or workspace roots.
|
|
214
|
+
if (cleanPath.startsWith('/@fs/')) {
|
|
215
|
+
const absPath = cleanPath.slice('/@fs'.length); // keep leading '/'
|
|
216
|
+
const toPosix = (value) => value.replace(/\\/g, '/');
|
|
217
|
+
const stripTrailing = (value) => value.replace(/\/+$/, '');
|
|
218
|
+
const target = toPosix(absPath);
|
|
219
|
+
const projectPosix = stripTrailing(toPosix(path.resolve(projectRoot)));
|
|
220
|
+
const workspacePosix = workspaceRoot ? stripTrailing(toPosix(path.resolve(workspaceRoot))) : null;
|
|
221
|
+
const tryRoot = (root) => {
|
|
222
|
+
if (!root)
|
|
223
|
+
return null;
|
|
224
|
+
if (target === root)
|
|
225
|
+
return '/ns/m';
|
|
226
|
+
if (target.startsWith(`${root}/`)) {
|
|
227
|
+
const rel = target.slice(root.length); // includes leading '/'
|
|
228
|
+
const noExt = rel.replace(/\.(?:ts|tsx|mjs|cjs|js|jsx)$/, '');
|
|
229
|
+
return `/ns/m${noExt}`;
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
};
|
|
233
|
+
return tryRoot(projectPosix) ?? tryRoot(workspacePosix);
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
// Runtime helper injected (only) into HMR-transformed modules that
|
|
238
|
+
// instantiate a Worker. Wraps each `new Worker(...)` in
|
|
239
|
+
// `__nsHmrTrackWorker(...)`, registering a per-module
|
|
240
|
+
// `import.meta.hot.dispose(cb)` (Vite spec): when the module is replaced,
|
|
241
|
+
// the disposer terminates exactly the workers this module spawned.
|
|
242
|
+
//
|
|
243
|
+
// Session-wide cleanup for spawns that re-run WITHOUT their module being
|
|
244
|
+
// replaced (e.g. an Angular reboot re-running `AppComponent`'s constructor)
|
|
245
|
+
// is NOT this helper's job: the dev session's global `Worker` constructor
|
|
246
|
+
// interception (`hmr/shared/runtime/worker-tracking.ts`) records every
|
|
247
|
+
// construction — including these wrapped ones — in
|
|
248
|
+
// `globalThis.__NS_HMR_WORKERS__`, and the HMR client sweeps that set
|
|
249
|
+
// before framework reboots.
|
|
250
|
+
//
|
|
251
|
+
// `terminate()` is the only cleanup primitive (guarded by try/catch so an
|
|
252
|
+
// already-dead worker can't break the HMR cycle); both paths are idempotent.
|
|
253
|
+
// A `terminated` event listener would be cleaner than a Set of references,
|
|
254
|
+
// but iOS Worker doesn't fire that event reliably.
|
|
255
|
+
const HMR_WORKER_DISPOSE_HELPER = [
|
|
256
|
+
'/* Injected by @nativescript/vite workerHmrUrlPlugin (HMR worker auto-dispose) */',
|
|
257
|
+
'const __nsHmrTrackWorker = /* @__PURE__ */ (function () {',
|
|
258
|
+
// Per-module Set so `import.meta.hot.dispose` only terminates workers
|
|
259
|
+
// SPAWNED BY THIS MODULE (Vite spec semantics).
|
|
260
|
+
'\tconst __nsModuleWorkers = new Set();',
|
|
261
|
+
'\tlet __nsDisposeRegistered = false;',
|
|
262
|
+
'\treturn function __nsHmrTrackWorker(w) {',
|
|
263
|
+
'\t\tif (!w) return w;',
|
|
264
|
+
// Dispose callbacks are consumed when they fire (drained per HMR cycle),
|
|
265
|
+
// so the disposer re-arms itself by resetting `__nsDisposeRegistered` —
|
|
266
|
+
// exactly one registration per cycle, not per spawn.
|
|
267
|
+
'\t\t__nsModuleWorkers.add(w);',
|
|
268
|
+
'\t\tif (!__nsDisposeRegistered && typeof import.meta !== "undefined" && import.meta && import.meta.hot && typeof import.meta.hot.dispose === "function") {',
|
|
269
|
+
'\t\t\t__nsDisposeRegistered = true;',
|
|
270
|
+
'\t\t\timport.meta.hot.dispose(function () {',
|
|
271
|
+
'\t\t\t\tfor (const __nsW of __nsModuleWorkers) {',
|
|
272
|
+
'\t\t\t\t\ttry { typeof __nsW.terminate === "function" && __nsW.terminate(); } catch (_e) {}',
|
|
273
|
+
'\t\t\t\t}',
|
|
274
|
+
'\t\t\t\t__nsModuleWorkers.clear();',
|
|
275
|
+
'\t\t\t\t__nsDisposeRegistered = false;',
|
|
276
|
+
'\t\t\t});',
|
|
277
|
+
'\t\t}',
|
|
278
|
+
'\t\treturn w;',
|
|
279
|
+
'\t};',
|
|
280
|
+
'})();',
|
|
281
|
+
'',
|
|
282
|
+
].join('\n');
|
|
283
|
+
export function workerHmrUrlPlugin(opts) {
|
|
284
|
+
const { verbose } = opts || {};
|
|
285
|
+
let projectRoot = '';
|
|
286
|
+
let workspaceRoot = null;
|
|
287
|
+
return {
|
|
288
|
+
name: 'nativescript-worker-hmr-url-transform',
|
|
289
|
+
// Run AFTER Vite's built-in `workerImportMetaUrlPlugin` (and AFTER
|
|
290
|
+
// the Angular plugin, which discards upstream `code` by re-compiling
|
|
291
|
+
// from disk). At this point Vite has already rewritten the user's
|
|
292
|
+
// `new Worker(new URL('./foo', import.meta.url))` into its dev shape
|
|
293
|
+
// `new Worker(new URL(/* @vite-ignore */"/src/.../foo.worker.ts?worker_file&type=classic", '' + import.meta.url))`.
|
|
294
|
+
// We match that shape and replace it with a plain string URL that
|
|
295
|
+
// routes through `/ns/m/` so the worker's internal imports get the
|
|
296
|
+
// same HMR treatment as the main thread.
|
|
297
|
+
enforce: 'post',
|
|
298
|
+
// Dev/HMR only — `workerUrlPlugin()` below handles the production build.
|
|
299
|
+
apply: 'serve',
|
|
300
|
+
configResolved(config) {
|
|
301
|
+
projectRoot = path.resolve(config.root || getProjectRootPath());
|
|
302
|
+
workspaceRoot = findMonorepoWorkspaceRoot(projectRoot);
|
|
303
|
+
},
|
|
304
|
+
transform(code, id) {
|
|
305
|
+
if (!code || code.indexOf('new Worker') === -1 || code.indexOf('import.meta.url') === -1) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
// `id` may carry a Vite query suffix (`?vue&type=script`, `?used`, …);
|
|
309
|
+
// strip it so path matching works against real fs paths.
|
|
310
|
+
const cleanId = id.split('?', 1)[0];
|
|
311
|
+
if (!cleanId || SKIP_TRANSFORM_ID_RE.test(cleanId)) {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
let modified = false;
|
|
315
|
+
let workerWraps = 0;
|
|
316
|
+
let newCode = code.replace(WORKER_VITE_DEV_RE, (match, _quote, assetPath, options) => {
|
|
317
|
+
const nsmUrl = viteWorkerAssetPathToNsMUrl(assetPath, projectRoot, workspaceRoot);
|
|
318
|
+
if (!nsmUrl) {
|
|
319
|
+
if (verbose) {
|
|
320
|
+
// eslint-disable-next-line no-console
|
|
321
|
+
console.warn(`[ns-worker-hmr] worker asset path ${JSON.stringify(assetPath)} in ${cleanId} can't be mapped to /ns/m/; leaving Vite's default behavior in place`);
|
|
322
|
+
}
|
|
323
|
+
return match;
|
|
324
|
+
}
|
|
325
|
+
modified = true;
|
|
326
|
+
workerWraps++;
|
|
327
|
+
const optionsTail = options ? options : '';
|
|
328
|
+
// `__nsHmrTrackWorker` registers the worker for HMR cleanup and
|
|
329
|
+
// returns the instance unchanged, so the wrap is transparent.
|
|
330
|
+
return `__nsHmrTrackWorker(new Worker((typeof globalThis !== "undefined" && typeof globalThis.__NS_HTTP_ORIGIN__ === "string" ? globalThis.__NS_HTTP_ORIGIN__ : "") + ${JSON.stringify(nsmUrl)}${optionsTail}))`;
|
|
331
|
+
});
|
|
332
|
+
if (!modified) {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
// Inject the helper prelude exactly once at the top of the
|
|
336
|
+
// module. The helper closure self-tracks workers and lazily
|
|
337
|
+
// registers the `import.meta.hot.dispose()` callback on the
|
|
338
|
+
// first wrap, so injecting it unconditionally (whether or not
|
|
339
|
+
// HMR is wired up at module-eval time) is safe.
|
|
340
|
+
newCode = HMR_WORKER_DISPOSE_HELPER + newCode;
|
|
341
|
+
if (verbose) {
|
|
342
|
+
// eslint-disable-next-line no-console
|
|
343
|
+
console.log(`[ns-worker-hmr] rewrote ${workerWraps} Vite worker URL${workerWraps === 1 ? '' : 's'} → /ns/m/ in ${cleanId} (with per-module HMR auto-dispose)`);
|
|
344
|
+
}
|
|
345
|
+
// Returning null for the source map keeps Vite's downstream sourcemap
|
|
346
|
+
// composition simple; the per-Worker line shift is small and the
|
|
347
|
+
// frame is rarely the one a developer is debugging.
|
|
348
|
+
return { code: newCode, map: null };
|
|
349
|
+
},
|
|
350
|
+
};
|
|
64
351
|
}
|
|
65
352
|
export function workerUrlPlugin() {
|
|
66
353
|
return {
|
|
@@ -72,7 +359,19 @@ export function workerUrlPlugin() {
|
|
|
72
359
|
// Transform Vite's worker URL pattern to NativeScript's expected format
|
|
73
360
|
// From: new Worker(new URL(/* @vite-ignore */ "/assets/sample.worker-C6wW8q2-.js", import.meta.url))
|
|
74
361
|
// To: new Worker('~/' + 'assets/sample.worker-C6wW8q2-.js')
|
|
75
|
-
|
|
362
|
+
//
|
|
363
|
+
// Rolldown (Vite's underlying bundler) emits the asset path as a
|
|
364
|
+
// template-literal (backticks) and prefixes the second URL arg
|
|
365
|
+
// with `\`\` +` to coerce it to a string, e.g.:
|
|
366
|
+
// new Worker(new URL(`/assets/foo.js`, `` + import.meta.url))
|
|
367
|
+
// The regex below accepts either single quotes, double quotes,
|
|
368
|
+
// or backticks for the asset path, and an optional
|
|
369
|
+
// `<emptyString> +` coercion prefix before `import.meta.url`. At
|
|
370
|
+
// NS runtime there's no `import.meta.url` in the main bundle and
|
|
371
|
+
// `new URL("/assets/...", ...)` would resolve to a `file:///...`
|
|
372
|
+
// URL that NS Worker can't load, so this rewrite is the last
|
|
373
|
+
// step that makes worker chunks actually loadable.
|
|
374
|
+
const workerUrlRegex = /new\s+Worker\s*\(\s*new\s+URL\s*\(\s*(?:\/\*[^*]*\*\/\s*)?[`"']([^`"']+)[`"']\s*,\s*(?:[`"'][^`"']*[`"']\s*\+\s*)?import\.meta\.url\s*\)\s*\)/g;
|
|
76
375
|
if (workerUrlRegex.test(chunk.code)) {
|
|
77
376
|
chunk.code = chunk.code.replace(workerUrlRegex, (match, assetPath) => {
|
|
78
377
|
// Use the full asset path including assets/ folder
|
package/helpers/workers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/workers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"workers.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/workers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAOtD,2EAA2E;AAC3E,+EAA+E;AAC/E,eAAe;AACf,yEAAyE;AACzE,gEAAgE;AAChE,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,wEAAwE;AACxE,MAAM,wBAAwB,GAAG,yBAAyB,CAAC;AAC3D,MAAM,UAAU,kCAAkC;IACjD,OAAO;QACN,IAAI,EAAE,iCAAiC;QACvC,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,EAAE;YACX,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,6BAA6B,CAAC,EAAE,CAAC;gBAC5E,OAAO,wBA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AAC;wBACrC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;4BACpE,mDAAmD;4BACnD,MAAM,QAAQ,GAAG,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;4BAC5E,OAAO,sBAAsB,QAAQ,IAAI,CAAC;wBAC3C,CAAC,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const APP_CSS_TAG = "app.css";
|
|
2
|
+
export declare function applyCssText(cssText: string, tag?: string): void;
|
|
2
3
|
export declare function fetchText(url: string): Promise<string>;
|
|
3
4
|
export declare function handleCssUpdates(cssUpdates: any[], httpOrigin: string): Promise<void>;
|
|
4
5
|
export declare function handleCustomCss(cssText: string): void;
|