@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,32 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { Platform } from './platform-types.js';
|
|
3
|
+
export interface NsCoreExternalUrlsPluginOptions {
|
|
4
|
+
platform: Platform;
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
/** Resolved @nativescript/core root (workspace source or node_modules install). */
|
|
7
|
+
nsCoreRoot: string;
|
|
8
|
+
hmrPort: number;
|
|
9
|
+
useHttps: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* HMR builds only: rewrite every bare `@nativescript/core*` specifier to the
|
|
13
|
+
* full /ns/core HTTP URL so bundle.mjs contains NO bundled copy of the core
|
|
14
|
+
* runtime. The plugin runs with enforce:'pre' so it fires BEFORE Vite's alias
|
|
15
|
+
* resolution converts bare specifiers to absolute filesystem paths, and
|
|
16
|
+
* apply:'build' so the dev-server transform pipeline (which has its own
|
|
17
|
+
* import-map) is unaffected.
|
|
18
|
+
*
|
|
19
|
+
* Why this is necessary: core's transitively-bundled helpers (e.g.
|
|
20
|
+
* `@nativescript/zone-js` patches) write `import '@nativescript/core/globals'`
|
|
21
|
+
* in their source. Without this interception, rolldown leaves those as bare
|
|
22
|
+
* specifiers in the emitted bundle.mjs output, iOS's ESM loader can't resolve
|
|
23
|
+
* bare specifiers at module-instantiation time (the runtime import map is
|
|
24
|
+
* installed later by the HMR client), and it falls back to a filesystem
|
|
25
|
+
* lookup that crashes with
|
|
26
|
+
* "Module not found: Cannot find module @nativescript/core/globals".
|
|
27
|
+
*
|
|
28
|
+
* The broader architecture: Vite is the single source of truth for every
|
|
29
|
+
* `@nativescript/core` URL on the device, so this build-time pre-resolver
|
|
30
|
+
* routes every reference into the runtime bridge.
|
|
31
|
+
*/
|
|
32
|
+
export declare function nsCoreExternalUrlsPlugin(opts: NsCoreExternalUrlsPluginOptions): Plugin;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { buildCoreUrl, corePathToSub, specToCoreSub } from './ns-core-url.js';
|
|
2
|
+
import { resolveDeviceReachableOrigin } from './dev-host.js';
|
|
3
|
+
import { getMonorepoWorkspaceRoot } from './project.js';
|
|
4
|
+
import { normalizeModuleId } from './normalize-id.js';
|
|
5
|
+
/**
|
|
6
|
+
* HMR builds only: rewrite every bare `@nativescript/core*` specifier to the
|
|
7
|
+
* full /ns/core HTTP URL so bundle.mjs contains NO bundled copy of the core
|
|
8
|
+
* runtime. The plugin runs with enforce:'pre' so it fires BEFORE Vite's alias
|
|
9
|
+
* resolution converts bare specifiers to absolute filesystem paths, and
|
|
10
|
+
* apply:'build' so the dev-server transform pipeline (which has its own
|
|
11
|
+
* import-map) is unaffected.
|
|
12
|
+
*
|
|
13
|
+
* Why this is necessary: core's transitively-bundled helpers (e.g.
|
|
14
|
+
* `@nativescript/zone-js` patches) write `import '@nativescript/core/globals'`
|
|
15
|
+
* in their source. Without this interception, rolldown leaves those as bare
|
|
16
|
+
* specifiers in the emitted bundle.mjs output, iOS's ESM loader can't resolve
|
|
17
|
+
* bare specifiers at module-instantiation time (the runtime import map is
|
|
18
|
+
* installed later by the HMR client), and it falls back to a filesystem
|
|
19
|
+
* lookup that crashes with
|
|
20
|
+
* "Module not found: Cannot find module @nativescript/core/globals".
|
|
21
|
+
*
|
|
22
|
+
* The broader architecture: Vite is the single source of truth for every
|
|
23
|
+
* `@nativescript/core` URL on the device, so this build-time pre-resolver
|
|
24
|
+
* routes every reference into the runtime bridge.
|
|
25
|
+
*/
|
|
26
|
+
export function nsCoreExternalUrlsPlugin(opts) {
|
|
27
|
+
const { platform, projectRoot, nsCoreRoot, hmrPort, useHttps } = opts;
|
|
28
|
+
// Routes through `resolveDeviceReachableOrigin` so the origin baked into
|
|
29
|
+
// externalized `@nativescript/core*` URLs is something the DEVICE can
|
|
30
|
+
// reach. Wildcard binds (`0.0.0.0`) and Android loopback get remapped to
|
|
31
|
+
// a real LAN IP (preferred) or `10.0.2.2` (Android emulator). Same helper
|
|
32
|
+
// used by `main-entry.ts` so both code paths produce byte-identical URL
|
|
33
|
+
// strings — required by the iOS HTTP ESM cache identity rule.
|
|
34
|
+
//
|
|
35
|
+
// Protocol baked into externalized @nativescript/core URLs must match the
|
|
36
|
+
// dev server's protocol. `NS_HTTPS` is the single switch (it also drives
|
|
37
|
+
// the server TLS + `wss` HMR socket); `NS_HMR_PROTO` remains an explicit
|
|
38
|
+
// override when set.
|
|
39
|
+
const proto = (process.env.NS_HMR_PROTO ? process.env.NS_HMR_PROTO === 'https' : useHttps) ? 'https' : 'http';
|
|
40
|
+
const { origin } = resolveDeviceReachableOrigin({
|
|
41
|
+
host: process.env.NS_HMR_HOST,
|
|
42
|
+
platform,
|
|
43
|
+
protocol: proto,
|
|
44
|
+
port: hmrPort,
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
name: 'ns-core-external-urls',
|
|
48
|
+
enforce: 'pre',
|
|
49
|
+
apply: 'build',
|
|
50
|
+
async resolveId(source, importer) {
|
|
51
|
+
// Route every `@nativescript/core*` reference (bare specifier OR
|
|
52
|
+
// absolute path into the installed @nativescript/core package OR
|
|
53
|
+
// its subpath import-map aliases) through the ONE canonical URL
|
|
54
|
+
// generator. URL proliferation (`?p=`, versioned, mixed query vs
|
|
55
|
+
// path forms) produces distinct iOS HTTP ESM cache entries for
|
|
56
|
+
// the same module, yielding double evaluation.
|
|
57
|
+
const sub = specToCoreSub(source);
|
|
58
|
+
if (sub !== null) {
|
|
59
|
+
if (process.env.NS_CORE_EXTERNAL_DEBUG) {
|
|
60
|
+
console.log('[ns-core-external]', 'source=', source, 'sub=', sub, 'importer=', importer?.slice(-80));
|
|
61
|
+
}
|
|
62
|
+
const url = buildCoreUrl(origin, sub);
|
|
63
|
+
return { id: url, external: 'absolute' };
|
|
64
|
+
}
|
|
65
|
+
// Monorepo-source core (`<workspace>/packages/core` via a file:
|
|
66
|
+
// dependency). The resolve-alias step runs BEFORE this hook and
|
|
67
|
+
// rewrites bare `@nativescript/core[/sub]` specifiers to absolute
|
|
68
|
+
// paths under NS_CORE_ROOT; for a node_modules install those
|
|
69
|
+
// still match specToCoreSub above, but workspace-source paths do
|
|
70
|
+
// not — without this branch the entire core library is silently
|
|
71
|
+
// inlined into bundle.mjs as a dead second realm
|
|
72
|
+
// (`Frame.topmost()` undefined on tap while the served realm owns
|
|
73
|
+
// the live UI).
|
|
74
|
+
//
|
|
75
|
+
// These must NOT map to `/ns/core/<sub>`: in the monorepo, the
|
|
76
|
+
// served core graph's internal imports resolve to
|
|
77
|
+
// workspace-relative `/ns/m/packages/core/<file>` URLs (Vite
|
|
78
|
+
// emits `/@fs/`-style ids for files outside the app root; see
|
|
79
|
+
// rewriteFsAbsoluteToNsM). A `/ns/core/<sub>` URL would serve a
|
|
80
|
+
// SECOND body for the same file in the same realm — its
|
|
81
|
+
// side-effect registrations re-run against shared classes and
|
|
82
|
+
// crash (`Cannot redefine property: default:width` from
|
|
83
|
+
// CssAnimationProperty.register). Resolve to the concrete file
|
|
84
|
+
// and emit the same `/ns/m/<workspace-rel>` spelling the served
|
|
85
|
+
// graph uses so the bundle joins the live realm.
|
|
86
|
+
if (corePathToSub(source, nsCoreRoot) === null)
|
|
87
|
+
return null;
|
|
88
|
+
const wsRoot = getMonorepoWorkspaceRoot(projectRoot);
|
|
89
|
+
const wsRootNorm = wsRoot ? normalizeModuleId(wsRoot).replace(/\/+$/, '') : '';
|
|
90
|
+
const resolved = await this.resolve(source, importer, { skipSelf: true });
|
|
91
|
+
const fileAbs = normalizeModuleId(((resolved && resolved.id) || source).split('?')[0]);
|
|
92
|
+
if (process.env.NS_CORE_EXTERNAL_DEBUG) {
|
|
93
|
+
console.log('[ns-core-external:workspace]', 'source=', source, 'file=', fileAbs, 'importer=', importer?.slice(-80));
|
|
94
|
+
}
|
|
95
|
+
if (wsRootNorm && fileAbs.startsWith(wsRootNorm + '/')) {
|
|
96
|
+
return { id: `${origin}/ns/m/${fileAbs.slice(wsRootNorm.length + 1)}`, external: 'absolute' };
|
|
97
|
+
}
|
|
98
|
+
// Could not anchor the resolved file under the workspace root —
|
|
99
|
+
// fall back to the canonical bridge URL rather than inlining a
|
|
100
|
+
// core copy.
|
|
101
|
+
const fallbackSub = corePathToSub(fileAbs, nsCoreRoot) ?? corePathToSub(source, nsCoreRoot);
|
|
102
|
+
console.warn('[ns-core-external] workspace-core path could not be anchored under the workspace root; using /ns/core bridge URL for', source);
|
|
103
|
+
return { id: buildCoreUrl(origin, fallbackSub), external: 'absolute' };
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=ns-core-external-urls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns-core-external-urls.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/ns-core-external-urls.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAYtD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAqC;IAC7E,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACtE,yEAAyE;IACzE,sEAAsE;IACtE,yEAAyE;IACzE,0EAA0E;IAC1E,wE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AAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,QAAQ,EAAE,UAAmB,EAAE,CAAC;YACxG,CAAC;YACD,gEAAgE;YAChE,+DAA+D;YAC/D,aAAa;YACb,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAC5F,OAAO,CAAC,IAAI,CAAC,sHAAsH,EAAE,MAAM,CAAC,CAAC;YAC7I,OAAO,EAAE,EAAE,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,EAAE,UAAmB,EAAE,CAAC;QACjF,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single canonical URL generator for `@nativescript/core` under HMR.
|
|
3
|
+
*
|
|
4
|
+
* Every public-facing reference to `@nativescript/core[/sub]` resolves to
|
|
5
|
+
* exactly one URL string — byte-for-byte identical across every emitter
|
|
6
|
+
* (bundle entry, external-urls plugin, rewriter, import map, runtime
|
|
7
|
+
* require). The only valid shapes are:
|
|
8
|
+
*
|
|
9
|
+
* - `/ns/core` — package main
|
|
10
|
+
* - `/ns/core/<sub>` — subpath form
|
|
11
|
+
*
|
|
12
|
+
* with `<sub>` always run through `normalizeCoreSub` (extensionless, no
|
|
13
|
+
* `/index` tail, no platform suffix). There is no version segment, no
|
|
14
|
+
* `?p=` query form, no `.js` tail.
|
|
15
|
+
*
|
|
16
|
+
* This module is the ONE site that constructs those URLs. Every caller in
|
|
17
|
+
* the repo should use `buildCoreUrl()` (or `buildCoreUrlPath()` when origin
|
|
18
|
+
* is not known yet). A single violation of canonical form produces a
|
|
19
|
+
* distinct iOS HTTP ESM cache entry for the same file — re-evaluating the
|
|
20
|
+
* module body, re-running `CssAnimationProperty.register(...)` side
|
|
21
|
+
* effects, and crashing with `Cannot redefine property`.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Normalize a user-provided subpath into the canonical form used by the
|
|
25
|
+
* /ns/core bridge. Strips:
|
|
26
|
+
* - Query and hash (`?v=…`, `#…`)
|
|
27
|
+
* - Leading / trailing slashes
|
|
28
|
+
* - Trailing `.js`/`.mjs`/`.cjs` extension (platform-suffixed forms are
|
|
29
|
+
* preserved: `.ios.js` → `.ios`)
|
|
30
|
+
* - Trailing `/index` segment (package-main sibling: `globals/index` →
|
|
31
|
+
* `globals`; `ui/core/view/index` → `ui/core/view`)
|
|
32
|
+
* - Canonical index forms (`index`, `index.js`, empty) → empty string
|
|
33
|
+
*
|
|
34
|
+
* Returns empty string for the main module (`@nativescript/core` itself).
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeCoreSub(sub?: string | null): string;
|
|
37
|
+
/**
|
|
38
|
+
* Canonical PATH (no origin) for a core module.
|
|
39
|
+
* Used by middleware/redirects where we don't have the dev-server origin.
|
|
40
|
+
*
|
|
41
|
+
* '' → '/ns/core'
|
|
42
|
+
* 'application' → '/ns/core/application'
|
|
43
|
+
* 'ui/core/view' → '/ns/core/ui/core/view'
|
|
44
|
+
* 'globals/index' → '/ns/core/globals'
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildCoreUrlPath(sub?: string | null): string;
|
|
47
|
+
/**
|
|
48
|
+
* Canonical FULL URL for a core module.
|
|
49
|
+
*
|
|
50
|
+
* origin='http://localhost:5173', sub='application'
|
|
51
|
+
* → 'http://localhost:5173/ns/core/application'
|
|
52
|
+
*
|
|
53
|
+
* Throws if origin is empty — callers that may not have origin should use
|
|
54
|
+
* `buildCoreUrlPath()` instead.
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildCoreUrl(origin: string, sub?: string | null): string;
|
|
57
|
+
/**
|
|
58
|
+
* Detect whether a URL or path references the /ns/core bridge.
|
|
59
|
+
* Accepts both relative `/ns/core/...` and absolute `http(s)://.../ns/core/...`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isCoreBridgeUrl(input: string): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Extract the canonical sub path from a /ns/core URL.
|
|
64
|
+
* 'http://localhost:5173/ns/core' → ''
|
|
65
|
+
* 'http://localhost:5173/ns/core/application' → 'application'
|
|
66
|
+
* '/ns/core/ui/core/view' → 'ui/core/view'
|
|
67
|
+
* 'http://example.com/other' → null
|
|
68
|
+
*/
|
|
69
|
+
export declare function extractCoreSub(input: string): string | null;
|
|
70
|
+
/**
|
|
71
|
+
* Convert a bare `@nativescript/core[/sub]` specifier or an absolute path
|
|
72
|
+
* pointing into `@nativescript/core`'s node_modules install into the
|
|
73
|
+
* canonical sub path. Returns null for anything else.
|
|
74
|
+
*
|
|
75
|
+
* '@nativescript/core' → ''
|
|
76
|
+
* '@nativescript/core/application' → 'application'
|
|
77
|
+
* '/node_modules/@nativescript/core/ui/core/view.js' → 'ui/core/view'
|
|
78
|
+
* '/foo/bar/baz' → null
|
|
79
|
+
*/
|
|
80
|
+
export declare function specToCoreSub(spec: string): string | null;
|
|
81
|
+
/**
|
|
82
|
+
* Convert an absolute path INSIDE a known @nativescript/core root directory
|
|
83
|
+
* into the canonical sub path. Complements {@link specToCoreSub}, which only
|
|
84
|
+
* recognizes bare specifiers and `node_modules` installs: in a monorepo where
|
|
85
|
+
* core is consumed from source (`<workspace>/packages/core` via a `file:`
|
|
86
|
+
* dependency), the resolve-alias step rewrites bare `@nativescript/core[/sub]`
|
|
87
|
+
* specifiers to absolute paths under that source root BEFORE the
|
|
88
|
+
* `ns-core-external-urls` build plugin sees them. Without this mapping those
|
|
89
|
+
* paths escape externalization and the entire core library is inlined into
|
|
90
|
+
* bundle.mjs — a dead second realm whose `Frame.topmost()` is undefined while
|
|
91
|
+
* the dev-server-served realm owns the live UI.
|
|
92
|
+
*
|
|
93
|
+
* corePathToSub('/ws/packages/core', '/ws/packages/core') → ''
|
|
94
|
+
* corePathToSub('/ws/packages/core/ui/frame', '/ws/packages/core') → 'ui/frame'
|
|
95
|
+
* corePathToSub('/ws/packages/core/ui/frame/index.ios.ts', same root) → 'ui/frame'
|
|
96
|
+
* corePathToSub('/elsewhere/file.ts', '/ws/packages/core') → null
|
|
97
|
+
*/
|
|
98
|
+
export declare function corePathToSub(spec: string, coreRoot: string | null | undefined): string | null;
|
|
99
|
+
/**
|
|
100
|
+
* Produce the set of "runtime module id" strings we expose in
|
|
101
|
+
* `globalThis.__NS_CORE_MODULES__` for a given sub. Callers of the vendor
|
|
102
|
+
* CJS shim may request any of these forms for the same module; we register
|
|
103
|
+
* all of them to the one namespace so lookups are never ambiguous.
|
|
104
|
+
*/
|
|
105
|
+
export declare function moduleRegistrationKeys(sub?: string | null): string[];
|
|
106
|
+
export declare const CORE_SCOPE = "@nativescript/core";
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single canonical URL generator for `@nativescript/core` under HMR.
|
|
3
|
+
*
|
|
4
|
+
* Every public-facing reference to `@nativescript/core[/sub]` resolves to
|
|
5
|
+
* exactly one URL string — byte-for-byte identical across every emitter
|
|
6
|
+
* (bundle entry, external-urls plugin, rewriter, import map, runtime
|
|
7
|
+
* require). The only valid shapes are:
|
|
8
|
+
*
|
|
9
|
+
* - `/ns/core` — package main
|
|
10
|
+
* - `/ns/core/<sub>` — subpath form
|
|
11
|
+
*
|
|
12
|
+
* with `<sub>` always run through `normalizeCoreSub` (extensionless, no
|
|
13
|
+
* `/index` tail, no platform suffix). There is no version segment, no
|
|
14
|
+
* `?p=` query form, no `.js` tail.
|
|
15
|
+
*
|
|
16
|
+
* This module is the ONE site that constructs those URLs. Every caller in
|
|
17
|
+
* the repo should use `buildCoreUrl()` (or `buildCoreUrlPath()` when origin
|
|
18
|
+
* is not known yet). A single violation of canonical form produces a
|
|
19
|
+
* distinct iOS HTTP ESM cache entry for the same file — re-evaluating the
|
|
20
|
+
* module body, re-running `CssAnimationProperty.register(...)` side
|
|
21
|
+
* effects, and crashing with `Cannot redefine property`.
|
|
22
|
+
*/
|
|
23
|
+
const CORE_SCOPE_PREFIX = '@nativescript/core';
|
|
24
|
+
/**
|
|
25
|
+
* Normalize a user-provided subpath into the canonical form used by the
|
|
26
|
+
* /ns/core bridge. Strips:
|
|
27
|
+
* - Query and hash (`?v=…`, `#…`)
|
|
28
|
+
* - Leading / trailing slashes
|
|
29
|
+
* - Trailing `.js`/`.mjs`/`.cjs` extension (platform-suffixed forms are
|
|
30
|
+
* preserved: `.ios.js` → `.ios`)
|
|
31
|
+
* - Trailing `/index` segment (package-main sibling: `globals/index` →
|
|
32
|
+
* `globals`; `ui/core/view/index` → `ui/core/view`)
|
|
33
|
+
* - Canonical index forms (`index`, `index.js`, empty) → empty string
|
|
34
|
+
*
|
|
35
|
+
* Returns empty string for the main module (`@nativescript/core` itself).
|
|
36
|
+
*/
|
|
37
|
+
export function normalizeCoreSub(sub) {
|
|
38
|
+
if (!sub)
|
|
39
|
+
return '';
|
|
40
|
+
let s = String(sub).split('?')[0].split('#')[0].trim();
|
|
41
|
+
s = s.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
42
|
+
s = s.replace(/\.(?:mjs|cjs|js)$/, '');
|
|
43
|
+
// Strip a trailing platform suffix (`.ios` / `.android` / `.visionos`)
|
|
44
|
+
// so Vite-resolved platform-specific file paths canonicalize to the
|
|
45
|
+
// same form the runtime import map uses for the bare subpath.
|
|
46
|
+
//
|
|
47
|
+
// Why this matters: when the app source has
|
|
48
|
+
// `import { TextBase } from '@nativescript/core/ui/text-base'`, Vite's
|
|
49
|
+
// alias + extension resolver picks `ui/text-base/index.ios.js`. After
|
|
50
|
+
// `.js` is stripped above we have `ui/text-base/index.ios`. Vendor
|
|
51
|
+
// code, by contrast, takes the bare specifier path: the runtime
|
|
52
|
+
// import map's `@nativescript/core/` prefix maps it to
|
|
53
|
+
// `/ns/core/ui/text-base` directly (no `.ios`). The iOS HTTP ESM
|
|
54
|
+
// loader caches by URL string, so two spellings of the same file
|
|
55
|
+
// would produce two distinct V8 module records, re-evaluate
|
|
56
|
+
// `TextBase`, and create a realm split that leaves the
|
|
57
|
+
// `@nativescript-community` plugin's `setTextDecorationAndTransform`
|
|
58
|
+
// override visible to vendor code but invisible to the app.
|
|
59
|
+
//
|
|
60
|
+
// Stripping the suffix here normalises both shapes — `ui/text-base/`
|
|
61
|
+
// `index.ios` and `runtime/runtime.ios` — to the bare form. The
|
|
62
|
+
// trailing `/index` handler below then collapses
|
|
63
|
+
// `ui/text-base/index` → `ui/text-base`, and the final `index`
|
|
64
|
+
// guard collapses the package-main case to ''.
|
|
65
|
+
s = s.replace(/\.(?:ios|android|visionos)$/, '');
|
|
66
|
+
// Strip trailing `/index` so that `globals/index` → `globals`, matching
|
|
67
|
+
// the bare import form that consumers spell as `@nativescript/core/globals`.
|
|
68
|
+
// The main module case (`index` alone) is handled below.
|
|
69
|
+
if (s.endsWith('/index')) {
|
|
70
|
+
s = s.slice(0, -'/index'.length);
|
|
71
|
+
}
|
|
72
|
+
if (!s || s === 'index')
|
|
73
|
+
return '';
|
|
74
|
+
return s;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Canonical PATH (no origin) for a core module.
|
|
78
|
+
* Used by middleware/redirects where we don't have the dev-server origin.
|
|
79
|
+
*
|
|
80
|
+
* '' → '/ns/core'
|
|
81
|
+
* 'application' → '/ns/core/application'
|
|
82
|
+
* 'ui/core/view' → '/ns/core/ui/core/view'
|
|
83
|
+
* 'globals/index' → '/ns/core/globals'
|
|
84
|
+
*/
|
|
85
|
+
export function buildCoreUrlPath(sub) {
|
|
86
|
+
const s = normalizeCoreSub(sub);
|
|
87
|
+
return s ? `/ns/core/${s}` : '/ns/core';
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Canonical FULL URL for a core module.
|
|
91
|
+
*
|
|
92
|
+
* origin='http://localhost:5173', sub='application'
|
|
93
|
+
* → 'http://localhost:5173/ns/core/application'
|
|
94
|
+
*
|
|
95
|
+
* Throws if origin is empty — callers that may not have origin should use
|
|
96
|
+
* `buildCoreUrlPath()` instead.
|
|
97
|
+
*/
|
|
98
|
+
export function buildCoreUrl(origin, sub) {
|
|
99
|
+
if (!origin) {
|
|
100
|
+
throw new Error('[ns-core-url] buildCoreUrl requires a non-empty origin. Use buildCoreUrlPath() when origin is not yet known.');
|
|
101
|
+
}
|
|
102
|
+
const trimmedOrigin = origin.replace(/\/+$/, '');
|
|
103
|
+
return `${trimmedOrigin}${buildCoreUrlPath(sub)}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Detect whether a URL or path references the /ns/core bridge.
|
|
107
|
+
* Accepts both relative `/ns/core/...` and absolute `http(s)://.../ns/core/...`.
|
|
108
|
+
*/
|
|
109
|
+
export function isCoreBridgeUrl(input) {
|
|
110
|
+
if (!input)
|
|
111
|
+
return false;
|
|
112
|
+
return /\/ns\/core(?:\/|$)/.test(input);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Extract the canonical sub path from a /ns/core URL.
|
|
116
|
+
* 'http://localhost:5173/ns/core' → ''
|
|
117
|
+
* 'http://localhost:5173/ns/core/application' → 'application'
|
|
118
|
+
* '/ns/core/ui/core/view' → 'ui/core/view'
|
|
119
|
+
* 'http://example.com/other' → null
|
|
120
|
+
*/
|
|
121
|
+
export function extractCoreSub(input) {
|
|
122
|
+
if (!isCoreBridgeUrl(input))
|
|
123
|
+
return null;
|
|
124
|
+
try {
|
|
125
|
+
const u = new URL(input, 'http://placeholder.invalid');
|
|
126
|
+
const pathname = u.pathname;
|
|
127
|
+
const afterCore = pathname.replace(/^.*\/ns\/core(?:\/|$)/, '');
|
|
128
|
+
return normalizeCoreSub(afterCore);
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
const m = input.match(/\/ns\/core(?:\/([^?#]*))?/);
|
|
132
|
+
if (!m)
|
|
133
|
+
return null;
|
|
134
|
+
return normalizeCoreSub(m[1] || '');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Convert a bare `@nativescript/core[/sub]` specifier or an absolute path
|
|
139
|
+
* pointing into `@nativescript/core`'s node_modules install into the
|
|
140
|
+
* canonical sub path. Returns null for anything else.
|
|
141
|
+
*
|
|
142
|
+
* '@nativescript/core' → ''
|
|
143
|
+
* '@nativescript/core/application' → 'application'
|
|
144
|
+
* '/node_modules/@nativescript/core/ui/core/view.js' → 'ui/core/view'
|
|
145
|
+
* '/foo/bar/baz' → null
|
|
146
|
+
*/
|
|
147
|
+
export function specToCoreSub(spec) {
|
|
148
|
+
if (!spec)
|
|
149
|
+
return null;
|
|
150
|
+
const cleaned = spec.split('?')[0].split('#')[0];
|
|
151
|
+
if (cleaned === CORE_SCOPE_PREFIX)
|
|
152
|
+
return '';
|
|
153
|
+
if (cleaned.startsWith(CORE_SCOPE_PREFIX + '/')) {
|
|
154
|
+
return normalizeCoreSub(cleaned.slice(CORE_SCOPE_PREFIX.length + 1));
|
|
155
|
+
}
|
|
156
|
+
const abs = cleaned.replace(/\\/g, '/').match(/\/node_modules\/@nativescript\/core\/(.+?)$/);
|
|
157
|
+
if (abs)
|
|
158
|
+
return normalizeCoreSub(abs[1]);
|
|
159
|
+
// Case: the path ENDS at the core root (no subpath).
|
|
160
|
+
if (/\/node_modules\/@nativescript\/core\/?$/.test(cleaned.replace(/\\/g, '/'))) {
|
|
161
|
+
return '';
|
|
162
|
+
}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Convert an absolute path INSIDE a known @nativescript/core root directory
|
|
167
|
+
* into the canonical sub path. Complements {@link specToCoreSub}, which only
|
|
168
|
+
* recognizes bare specifiers and `node_modules` installs: in a monorepo where
|
|
169
|
+
* core is consumed from source (`<workspace>/packages/core` via a `file:`
|
|
170
|
+
* dependency), the resolve-alias step rewrites bare `@nativescript/core[/sub]`
|
|
171
|
+
* specifiers to absolute paths under that source root BEFORE the
|
|
172
|
+
* `ns-core-external-urls` build plugin sees them. Without this mapping those
|
|
173
|
+
* paths escape externalization and the entire core library is inlined into
|
|
174
|
+
* bundle.mjs — a dead second realm whose `Frame.topmost()` is undefined while
|
|
175
|
+
* the dev-server-served realm owns the live UI.
|
|
176
|
+
*
|
|
177
|
+
* corePathToSub('/ws/packages/core', '/ws/packages/core') → ''
|
|
178
|
+
* corePathToSub('/ws/packages/core/ui/frame', '/ws/packages/core') → 'ui/frame'
|
|
179
|
+
* corePathToSub('/ws/packages/core/ui/frame/index.ios.ts', same root) → 'ui/frame'
|
|
180
|
+
* corePathToSub('/elsewhere/file.ts', '/ws/packages/core') → null
|
|
181
|
+
*/
|
|
182
|
+
export function corePathToSub(spec, coreRoot) {
|
|
183
|
+
if (!spec || !coreRoot)
|
|
184
|
+
return null;
|
|
185
|
+
const cleaned = spec.split('?')[0].split('#')[0].replace(/\\/g, '/');
|
|
186
|
+
const root = String(coreRoot).replace(/\\/g, '/').replace(/\/+$/, '');
|
|
187
|
+
if (!root)
|
|
188
|
+
return null;
|
|
189
|
+
if (cleaned === root)
|
|
190
|
+
return '';
|
|
191
|
+
if (!cleaned.startsWith(root + '/'))
|
|
192
|
+
return null;
|
|
193
|
+
// Monorepo core is TypeScript source; strip TS extensions before the
|
|
194
|
+
// canonical normalizer (which handles .js/.mjs/.cjs, platform suffixes
|
|
195
|
+
// and trailing /index).
|
|
196
|
+
const rel = cleaned.slice(root.length + 1).replace(/\.(?:ts|tsx|mts|cts)$/, '');
|
|
197
|
+
return normalizeCoreSub(rel);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Produce the set of "runtime module id" strings we expose in
|
|
201
|
+
* `globalThis.__NS_CORE_MODULES__` for a given sub. Callers of the vendor
|
|
202
|
+
* CJS shim may request any of these forms for the same module; we register
|
|
203
|
+
* all of them to the one namespace so lookups are never ambiguous.
|
|
204
|
+
*/
|
|
205
|
+
export function moduleRegistrationKeys(sub) {
|
|
206
|
+
const s = normalizeCoreSub(sub);
|
|
207
|
+
const keys = new Set();
|
|
208
|
+
if (!s) {
|
|
209
|
+
keys.add(CORE_SCOPE_PREFIX);
|
|
210
|
+
keys.add('');
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
keys.add(`${CORE_SCOPE_PREFIX}/${s}`);
|
|
214
|
+
keys.add(s);
|
|
215
|
+
// Tolerate `.js` tail on the key (some consumers spell it out).
|
|
216
|
+
keys.add(`${CORE_SCOPE_PREFIX}/${s}.js`);
|
|
217
|
+
keys.add(`${s}.js`);
|
|
218
|
+
// Tolerate `/index` / `/index.js` suffix.
|
|
219
|
+
keys.add(`${CORE_SCOPE_PREFIX}/${s}/index`);
|
|
220
|
+
keys.add(`${CORE_SCOPE_PREFIX}/${s}/index.js`);
|
|
221
|
+
}
|
|
222
|
+
return Array.from(keys);
|
|
223
|
+
}
|
|
224
|
+
export const CORE_SCOPE = CORE_SCOPE_PREFIX;
|
|
225
|
+
//# sourceMappingURL=ns-core-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns-core-url.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/ns-core-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAE/C;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAmB;IACnD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9C,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;IACvC,uEAAuE;IACvE,oEAAoE;IACpE,8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;IAChF,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,GAAmB;IACzD,MAAM,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,CAAC,CAAC,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;SAAM,CAAC;QACP,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACZ,gEAAgE;QAChE,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpB,0CAA0C;QAC1C,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,iBAAiB,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical list of packages that must NEVER be pre-bundled by Vite's
|
|
3
|
+
* dependency scanner.
|
|
4
|
+
*
|
|
5
|
+
* The most load-bearing entries are `module` / `node:module`: they are aliased
|
|
6
|
+
* to local polyfills/shims (see `helpers/css-tree.ts` and the `node:module`
|
|
7
|
+
* alias in `configuration/base.ts`). Vite's depscanner has no awareness of those
|
|
8
|
+
* aliases and, if allowed to pre-bundle them, the HMR `/ns/m/` pipeline can't map
|
|
9
|
+
* the pre-bundle URL back to a real package — dropping the
|
|
10
|
+
* `import { createRequire } from 'module'` line and crashing on device with
|
|
11
|
+
* `ReferenceError: createRequire is not defined` inside `css-tree`.
|
|
12
|
+
*
|
|
13
|
+
* Centralized here so base/angular configs share one source of truth instead of
|
|
14
|
+
* hand-maintaining divergent copies.
|
|
15
|
+
*/
|
|
16
|
+
export declare const NS_OPTIMIZE_DEPS_EXCLUDE: readonly ["@nativescript/core", "@valor/nativescript-websockets", "set-value", "react", "react-reconciler", "react-nativescript", "module", "node:module"];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical list of packages that must NEVER be pre-bundled by Vite's
|
|
3
|
+
* dependency scanner.
|
|
4
|
+
*
|
|
5
|
+
* The most load-bearing entries are `module` / `node:module`: they are aliased
|
|
6
|
+
* to local polyfills/shims (see `helpers/css-tree.ts` and the `node:module`
|
|
7
|
+
* alias in `configuration/base.ts`). Vite's depscanner has no awareness of those
|
|
8
|
+
* aliases and, if allowed to pre-bundle them, the HMR `/ns/m/` pipeline can't map
|
|
9
|
+
* the pre-bundle URL back to a real package — dropping the
|
|
10
|
+
* `import { createRequire } from 'module'` line and crashing on device with
|
|
11
|
+
* `ReferenceError: createRequire is not defined` inside `css-tree`.
|
|
12
|
+
*
|
|
13
|
+
* Centralized here so base/angular configs share one source of truth instead of
|
|
14
|
+
* hand-maintaining divergent copies.
|
|
15
|
+
*/
|
|
16
|
+
export const NS_OPTIMIZE_DEPS_EXCLUDE = ['@nativescript/core', '@valor/nativescript-websockets', 'set-value', 'react', 'react-reconciler', 'react-nativescript', 'module', 'node:module'];
|
|
17
|
+
//# sourceMappingURL=optimize-deps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"optimize-deps.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/optimize-deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,oBAAoB,EAAE,gCAAgC,EAAE,WAAW,EAAE,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,QAAQ,EAAE,aAAa,CAAU,CAAC"}
|
|
@@ -2,10 +2,19 @@ import path from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { findPackageInNodeModules } from './module-resolution.js';
|
|
4
4
|
import { getProjectRootPath } from './project.js';
|
|
5
|
+
import { resolveMainFieldPlatformVariant } from './resolve-main-field-platform.js';
|
|
5
6
|
const projectRoot = getProjectRootPath();
|
|
6
7
|
export function packagePlatformResolverPlugin(opts) {
|
|
7
8
|
// packages used via core transient dependencies and other vite support
|
|
8
9
|
const commonSkips = ['source-map-js', 'html-entities', 'fast-xml-parser', '@valor/nativescript-websockets'];
|
|
10
|
+
// Memoize the resolved id (or null) per bare package name. This runs on the
|
|
11
|
+
// hot `enforce:'pre'` path for EVERY bare specifier; without a cache it does
|
|
12
|
+
// a full `findPackageInNodeModules` fs-walk + `package.json` read/parse on
|
|
13
|
+
// every resolve. The platform is fixed for this plugin instance (a fresh
|
|
14
|
+
// instance is created per worker build via the `worker.plugins` factory), so
|
|
15
|
+
// the package name is a sufficient key. Mirrors the cache in
|
|
16
|
+
// `nativescript-package-resolver.ts`.
|
|
17
|
+
const resolveCache = new Map();
|
|
9
18
|
return {
|
|
10
19
|
name: 'ns-package-platform-resolver',
|
|
11
20
|
enforce: 'pre',
|
|
@@ -24,58 +33,34 @@ export function packagePlatformResolverPlugin(opts) {
|
|
|
24
33
|
}
|
|
25
34
|
// Only handle packages that exist in node_modules (real npm packages)
|
|
26
35
|
const packageName = id;
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
if (resolveCache.has(packageName)) {
|
|
37
|
+
return resolveCache.get(packageName);
|
|
38
|
+
}
|
|
39
|
+
// Compute once, then memoize (incl. the null "no rewrite" result so a
|
|
40
|
+
// known package short-circuits on the next resolve).
|
|
41
|
+
const resolved = (() => {
|
|
42
|
+
const packagePath = findPackageInNodeModules(packageName, projectRoot);
|
|
43
|
+
if (!packagePath)
|
|
44
|
+
return null;
|
|
29
45
|
const packageJsonPath = path.join(packagePath, 'package.json');
|
|
30
|
-
if (fs.existsSync(packageJsonPath))
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Try platform-specific file first
|
|
39
|
-
const platformFile = path.join(packagePath, `${mainField}.${opts.platform}.js`);
|
|
40
|
-
if (fs.existsSync(platformFile)) {
|
|
41
|
-
if (opts.verbose) {
|
|
42
|
-
console.log(`✅ Alias resolver: ${packageName} -> ${mainField}.${opts.platform}.js (extensionless)`);
|
|
43
|
-
}
|
|
44
|
-
return platformFile;
|
|
45
|
-
}
|
|
46
|
-
// Fallback to .js
|
|
47
|
-
const jsFile = path.join(packagePath, `${mainField}.js`);
|
|
48
|
-
if (fs.existsSync(jsFile)) {
|
|
49
|
-
if (opts.verbose) {
|
|
50
|
-
console.log(`✅ Alias resolver: ${packageName} -> ${mainField}.js (extensionless)`);
|
|
51
|
-
}
|
|
52
|
-
return jsFile;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// Case 2: Main field has extension but file doesn't exist - look for platform variants
|
|
56
|
-
else if (!fs.existsSync(mainFilePath)) {
|
|
57
|
-
// Extract base name and extension
|
|
58
|
-
const ext = path.extname(mainField);
|
|
59
|
-
const baseName = mainField.slice(0, -ext.length);
|
|
60
|
-
// Try platform-specific file first
|
|
61
|
-
const platformFile = path.join(packagePath, `${baseName}.${opts.platform}${ext}`);
|
|
62
|
-
if (fs.existsSync(platformFile)) {
|
|
63
|
-
if (opts.verbose) {
|
|
64
|
-
console.log(`✅ Alias resolver: ${packageName} -> ${baseName}.${opts.platform}${ext} (missing main)`);
|
|
65
|
-
}
|
|
66
|
-
return platformFile;
|
|
67
|
-
}
|
|
68
|
-
// If main file exists, let normal resolution handle it
|
|
69
|
-
// If it doesn't exist and no platform variant found, let it fail naturally
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
// Ignore parse errors and fall through
|
|
46
|
+
if (!fs.existsSync(packageJsonPath))
|
|
47
|
+
return null;
|
|
48
|
+
try {
|
|
49
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
50
|
+
// Shared main-field platform-variant rules (Case 1/2).
|
|
51
|
+
const out = resolveMainFieldPlatformVariant(packagePath, packageJson.main, opts.platform);
|
|
52
|
+
if (out && opts.verbose) {
|
|
53
|
+
console.log(`✅ Alias resolver: ${packageName} -> ${out}`);
|
|
75
54
|
}
|
|
55
|
+
return out;
|
|
76
56
|
}
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
catch {
|
|
58
|
+
// Ignore parse errors and fall through.
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
})();
|
|
62
|
+
resolveCache.set(packageName, resolved);
|
|
63
|
+
return resolved;
|
|
79
64
|
},
|
|
80
65
|
};
|
|
81
66
|
}
|