@nativescript/vite 8.0.0-alpha.9 → 8.0.0-dev.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 +89 -14
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +196 -217
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +152 -104
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +14 -93
- package/configuration/javascript.js.map +1 -1
- package/configuration/react.js +41 -73
- package/configuration/react.js.map +1 -1
- package/configuration/solid.js +51 -6
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +11 -92
- package/configuration/typescript.js.map +1 -1
- package/framework.d.ts +22 -0
- package/framework.js +18 -0
- package/framework.js.map +1 -0
- 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/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 +4 -1
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +10 -12
- package/helpers/external-configs.js +58 -35
- package/helpers/external-configs.js.map +1 -1
- package/helpers/flavor.d.ts +31 -0
- package/helpers/flavor.js +53 -2
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +100 -33
- package/helpers/global-defines.js +192 -66
- 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/init.js +24 -26
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +11 -1
- package/helpers/logging.js +45 -2
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +4 -1
- package/helpers/main-entry.js +293 -40
- 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 +37 -7
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.js +8 -3
- 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 +26 -3
- package/helpers/ns-core-url.js +66 -8
- package/helpers/ns-core-url.js.map +1 -1
- 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/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 +143 -62
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +3 -3
- 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 +33 -0
- package/helpers/workers.js +237 -10
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +63 -32
- 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 +117 -0
- package/hmr/client/framework-client-strategy.js +18 -0
- package/hmr/client/framework-client-strategy.js.map +1 -0
- package/hmr/client/framework.d.ts +31 -0
- package/hmr/client/framework.js +17 -0
- package/hmr/client/framework.js.map +1 -0
- package/hmr/client/hmr-pending-overlay.d.ts +0 -14
- package/hmr/client/hmr-pending-overlay.js +2 -11
- package/hmr/client/hmr-pending-overlay.js.map +1 -1
- package/hmr/client/hot-context.d.ts +89 -0
- package/hmr/client/hot-context.js +404 -0
- package/hmr/client/hot-context.js.map +1 -0
- package/hmr/client/index.d.ts +9 -1
- package/hmr/client/index.js +70 -1970
- 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 +136 -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 +489 -0
- package/hmr/client/update-pipeline.js.map +1 -0
- package/hmr/client/utils.d.ts +9 -1
- package/hmr/client/utils.js +117 -97
- 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 +2 -1
- package/hmr/entry-runtime.js +279 -44
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/framework-flavors.d.ts +59 -0
- package/hmr/framework-flavors.js +108 -0
- package/hmr/framework-flavors.js.map +1 -0
- 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/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.js +2 -70
- 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/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
- 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/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
- 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.js +88 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
- 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/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 +0 -1
- package/hmr/frameworks/angular/client/index.js +360 -194
- 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/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 +668 -13
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
- package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +27 -11
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +179 -107
- 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 +40 -14
- 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 +270 -521
- 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 +109 -14
- package/hmr/helpers/ast-normalizer.js.map +1 -1
- 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.js +7 -1
- 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 +86 -7
- package/hmr/server/core-sanitize.js +155 -37
- 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 +57 -23
- package/hmr/server/import-map.js +142 -70
- package/hmr/server/import-map.js.map +1 -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-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 +1 -1
- package/hmr/server/perf-instrumentation.js +3 -1
- package/hmr/server/perf-instrumentation.js.map +1 -1
- package/hmr/server/process-code-for-device.d.ts +54 -0
- package/hmr/server/process-code-for-device.js +832 -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.js +8 -1
- package/hmr/server/runtime-graph-filter.js.map +1 -1
- 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.js +1 -2
- package/hmr/server/shared-transform-request.js.map +1 -1
- 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 +1 -0
- package/hmr/server/vite-plugin.js +211 -53
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +51 -4
- package/hmr/server/websocket-core-bridge.js +62 -49
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- 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-hmr-pending.d.ts +2 -16
- package/hmr/server/websocket-hmr-pending.js +0 -22
- package/hmr/server/websocket-hmr-pending.js.map +1 -1
- package/hmr/server/websocket-hot-update.d.ts +80 -0
- package/hmr/server/websocket-hot-update.js +299 -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 +15 -0
- package/hmr/server/websocket-module-bindings.js +36 -3
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-module-specifiers.d.ts +2 -5
- package/hmr/server/websocket-module-specifiers.js +42 -30
- package/hmr/server/websocket-module-specifiers.js.map +1 -1
- 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 -3
- package/hmr/server/websocket-ns-m-paths.js +98 -75
- package/hmr/server/websocket-ns-m-paths.js.map +1 -1
- package/hmr/server/websocket-ns-m-request.d.ts +2 -1
- package/hmr/server/websocket-ns-m-request.js +3 -2
- package/hmr/server/websocket-ns-m-request.js.map +1 -1
- package/hmr/server/websocket-ns-m.d.ts +52 -0
- package/hmr/server/websocket-ns-m.js +592 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +65 -3
- package/hmr/server/websocket-served-module-helpers.js +457 -140
- package/hmr/server/websocket-served-module-helpers.js.map +1 -1
- package/hmr/server/websocket-txn.js +6 -9
- package/hmr/server/websocket-txn.js.map +1 -1
- package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
- package/hmr/server/websocket-vendor-unifier.js +4 -9
- package/hmr/server/websocket-vendor-unifier.js.map +1 -1
- package/hmr/server/websocket.d.ts +6 -40
- package/hmr/server/websocket.js +661 -6751
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +108 -0
- package/hmr/shared/ns-globals.js +29 -0
- package/hmr/shared/ns-globals.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 +1 -1
- package/hmr/shared/runtime/boot-timeline.js +8 -19
- package/hmr/shared/runtime/boot-timeline.js.map +1 -1
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +58 -25
- package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
- 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 +23 -69
- package/hmr/shared/runtime/dev-overlay.js +67 -1011
- package/hmr/shared/runtime/dev-overlay.js.map +1 -1
- 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.js +3 -2
- package/hmr/shared/runtime/module-provenance.js.map +1 -1
- 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/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.js +382 -157
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +209 -54
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +2 -1
- 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 +10 -35
- package/hmr/shared/vendor/manifest.js +154 -978
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/hmr/shared/vendor/registry.d.ts +2 -0
- package/hmr/shared/vendor/registry.js +14 -0
- 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/package.json +70 -13
- package/runtime/core-aliases-early.js +11 -16
- 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/helpers/angular/angular-linker.d.ts +0 -13
- package/helpers/angular/angular-linker.js +0 -185
- package/helpers/angular/angular-linker.js.map +0 -1
- package/helpers/angular/inject-component-hmr-registration.js.map +0 -1
- package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
- package/helpers/angular/shared-linker.d.ts +0 -11
- package/helpers/angular/shared-linker.js +0 -75
- package/helpers/angular/shared-linker.js.map +0 -1
- package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
- package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
- 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 -114
- package/helpers/prelink-angular.js.map +0 -1
- package/hmr/server/websocket-angular-entry.js.map +0 -1
- package/hmr/server/websocket-angular-hot-update.js.map +0 -1
- package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
- package/hmr/server/websocket-ns-m-finalize.js +0 -88
- package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
- package/hmr/server/websocket-runtime-compat.d.ts +0 -19
- package/hmr/server/websocket-runtime-compat.js +0 -287
- package/hmr/server/websocket-runtime-compat.js.map +0 -1
- package/hmr/server/websocket-vue-sfc.d.ts +0 -27
- package/hmr/server/websocket-vue-sfc.js +0 -1069
- package/hmr/server/websocket-vue-sfc.js.map +0 -1
- package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
- package/hmr/shared/runtime/http-only-boot.js +0 -171
- 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
- /package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/util.js +0 -0
- /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCore, getCurrentApp, graph, invalidateModulesByUrls, normalizeSpec, resolveHmrHttpOrigin, safeDynImport, safeReadDefault, setCurrentApp } from '../../../client/utils.js';
|
|
2
|
+
import { getGlobalScope } from '../../../shared/runtime/global-scope.js';
|
|
3
|
+
import { resolveVendorModule } from '../../../shared/runtime/vendor-resolve.js';
|
|
4
|
+
import { findSfcAncestors } from './dep-propagation.js';
|
|
2
5
|
const APP_VIRTUAL_WITH_SLASH = (() => {
|
|
3
|
-
|
|
6
|
+
// Define substitution does not reach this raw-served file; prefer the
|
|
7
|
+
// globalThis seed from the entry's defines-seed module ('app/'-rooted
|
|
8
|
+
// projects would otherwise get the wrong '/src' default).
|
|
9
|
+
const root = (typeof __NS_APP_ROOT_VIRTUAL__ === 'string' && __NS_APP_ROOT_VIRTUAL__) || (typeof getGlobalScope().__NS_APP_ROOT_VIRTUAL__ === 'string' && getGlobalScope().__NS_APP_ROOT_VIRTUAL__) || '/src';
|
|
4
10
|
return root.replace(/\/+$/, '') + '/';
|
|
5
11
|
})();
|
|
6
12
|
// Optional runtime knob: allow disabling assembler path in favor of variant-only flow
|
|
@@ -16,24 +22,8 @@ export const sfcArtifactMap = new Map();
|
|
|
16
22
|
// Install dev shims for nativescript-vue navigation to observe and (optionally) rescue
|
|
17
23
|
export function installNsVueDevShims() {
|
|
18
24
|
try {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
22
|
-
const getMod = (id) => {
|
|
23
|
-
try {
|
|
24
|
-
if (reg && reg.has(id))
|
|
25
|
-
return reg.get(id);
|
|
26
|
-
}
|
|
27
|
-
catch { }
|
|
28
|
-
try {
|
|
29
|
-
if (typeof req === 'function')
|
|
30
|
-
return req(id);
|
|
31
|
-
}
|
|
32
|
-
catch { }
|
|
33
|
-
return null;
|
|
34
|
-
};
|
|
35
|
-
const nv = getMod('nativescript-vue');
|
|
36
|
-
const rh = getMod('nativescript-vue/dist/runtimeHelpers');
|
|
25
|
+
const nv = resolveVendorModule('nativescript-vue');
|
|
26
|
+
const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
|
|
37
27
|
const wrap = (orig, label) => {
|
|
38
28
|
if (typeof orig !== 'function')
|
|
39
29
|
return orig;
|
|
@@ -48,6 +38,7 @@ export function installNsVueDevShims() {
|
|
|
48
38
|
paramKeys: Object.keys(params || {}),
|
|
49
39
|
});
|
|
50
40
|
}
|
|
41
|
+
// eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
|
|
51
42
|
return orig.apply(this, arguments);
|
|
52
43
|
}
|
|
53
44
|
catch (e) {
|
|
@@ -85,74 +76,20 @@ export function installNsVueDevShims() {
|
|
|
85
76
|
}
|
|
86
77
|
catch { }
|
|
87
78
|
}
|
|
88
|
-
// initial root component for back fallback
|
|
89
|
-
let ORIG_ROOT_COMPONENT = null;
|
|
90
79
|
// Ensure Vue runtime global functions exist before evaluating SFC artifacts that rely on globalThis.* indirections.
|
|
91
80
|
export function ensureVueGlobals() {
|
|
92
81
|
try {
|
|
93
82
|
const g = globalThis;
|
|
94
83
|
const vueAlready = g.defineComponent && g.resolveComponent && g.createVNode;
|
|
95
|
-
const req = globalThis.__nsVendorRegistry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
|
|
96
|
-
const registry = globalThis.__nsVendorRegistry;
|
|
97
|
-
let nvMod = null;
|
|
98
|
-
let vueMod = null;
|
|
99
84
|
// Prefer nativescript-vue first so createApp has .start and NSVRoot is available
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (!
|
|
107
|
-
|
|
108
|
-
nvMod = req('nativescript-vue');
|
|
109
|
-
}
|
|
110
|
-
catch { }
|
|
111
|
-
}
|
|
112
|
-
if (!vueMod && typeof req === 'function') {
|
|
113
|
-
try {
|
|
114
|
-
vueMod = req('vue');
|
|
115
|
-
}
|
|
116
|
-
catch { }
|
|
117
|
-
if (!vueMod) {
|
|
118
|
-
try {
|
|
119
|
-
vueMod = req('@vue/runtime-core');
|
|
120
|
-
}
|
|
121
|
-
catch { }
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
const baseMod = nvMod || vueMod;
|
|
125
|
-
let chosenMod = baseMod;
|
|
126
|
-
if (!chosenMod) {
|
|
127
|
-
// Last-ditch attempts on known ids
|
|
128
|
-
try {
|
|
129
|
-
chosenMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
|
|
130
|
-
}
|
|
131
|
-
catch { }
|
|
132
|
-
if (!chosenMod) {
|
|
133
|
-
try {
|
|
134
|
-
chosenMod = req && typeof req === 'function' ? req('vue') : null;
|
|
135
|
-
}
|
|
136
|
-
catch { }
|
|
137
|
-
}
|
|
138
|
-
if (!chosenMod)
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
if (!vueMod) {
|
|
142
|
-
// Last-ditch attempts on known ids
|
|
143
|
-
try {
|
|
144
|
-
vueMod = req && typeof req === 'function' ? req('vue') : null;
|
|
145
|
-
}
|
|
146
|
-
catch { }
|
|
147
|
-
if (!vueMod) {
|
|
148
|
-
try {
|
|
149
|
-
vueMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
|
|
150
|
-
}
|
|
151
|
-
catch { }
|
|
152
|
-
}
|
|
153
|
-
if (!vueMod)
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
85
|
+
const nvMod = resolveVendorModule('nativescript-vue');
|
|
86
|
+
let vueMod = resolveVendorModule('vue') ?? resolveVendorModule('@vue/runtime-core');
|
|
87
|
+
const chosenMod = nvMod || vueMod;
|
|
88
|
+
if (!chosenMod)
|
|
89
|
+
return;
|
|
90
|
+
// No standalone vue realm available: nativescript-vue re-exports the runtime API.
|
|
91
|
+
if (!vueMod)
|
|
92
|
+
vueMod = nvMod;
|
|
156
93
|
// Polyfill essential runtime helpers often imported from 'vue' by compiled SFC render code
|
|
157
94
|
try {
|
|
158
95
|
const polyNormalizeClass = (val) => {
|
|
@@ -318,7 +255,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
318
255
|
try {
|
|
319
256
|
if (!app || typeof app.use !== 'function')
|
|
320
257
|
return;
|
|
321
|
-
const g =
|
|
258
|
+
const g = getGlobalScope();
|
|
322
259
|
// If this app already has a Pinia provide, skip
|
|
323
260
|
try {
|
|
324
261
|
const prov = app?._context?.provides;
|
|
@@ -340,17 +277,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
340
277
|
catch { }
|
|
341
278
|
// Attempt to set active pinia if API is available
|
|
342
279
|
try {
|
|
343
|
-
const
|
|
344
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
345
|
-
let piniaMod = null;
|
|
346
|
-
if (registry && registry.has('pinia'))
|
|
347
|
-
piniaMod = registry.get('pinia');
|
|
348
|
-
if (!piniaMod && typeof req === 'function') {
|
|
349
|
-
try {
|
|
350
|
-
piniaMod = req('pinia');
|
|
351
|
-
}
|
|
352
|
-
catch { }
|
|
353
|
-
}
|
|
280
|
+
const piniaMod = resolveVendorModule('pinia');
|
|
354
281
|
const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
|
|
355
282
|
const setActivePinia = resolved?.setActivePinia;
|
|
356
283
|
if (typeof setActivePinia === 'function')
|
|
@@ -360,18 +287,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
360
287
|
return;
|
|
361
288
|
}
|
|
362
289
|
// Prefer vendor registry/require to load 'pinia'
|
|
363
|
-
const
|
|
364
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
365
|
-
let piniaMod = null;
|
|
366
|
-
if (registry && registry.has('pinia')) {
|
|
367
|
-
piniaMod = registry.get('pinia');
|
|
368
|
-
}
|
|
369
|
-
if (!piniaMod && typeof req === 'function') {
|
|
370
|
-
try {
|
|
371
|
-
piniaMod = req('pinia');
|
|
372
|
-
}
|
|
373
|
-
catch { }
|
|
374
|
-
}
|
|
290
|
+
const piniaMod = resolveVendorModule('pinia');
|
|
375
291
|
if (!piniaMod)
|
|
376
292
|
return;
|
|
377
293
|
const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
|
|
@@ -396,16 +312,11 @@ export function ensurePiniaOnApp(app) {
|
|
|
396
312
|
// Prefer nativescript-vue's own bootstrap to set up element registry and built-ins
|
|
397
313
|
export function ensureNsVueBootstrap() {
|
|
398
314
|
try {
|
|
399
|
-
const g = globalThis;
|
|
400
315
|
if (nsVueInitDone)
|
|
401
316
|
return;
|
|
402
|
-
const reg = g.__nsVendorRegistry;
|
|
403
|
-
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
404
|
-
if (typeof req !== 'function')
|
|
405
|
-
return;
|
|
406
317
|
// Try full init, which should register core elements and built-in components
|
|
407
318
|
try {
|
|
408
|
-
const nv =
|
|
319
|
+
const nv = resolveVendorModule('nativescript-vue/dist/nativescript');
|
|
409
320
|
const init = (nv && (nv.init || nv.default?.init)) || undefined;
|
|
410
321
|
if (typeof init === 'function') {
|
|
411
322
|
init();
|
|
@@ -418,7 +329,7 @@ export function ensureNsVueBootstrap() {
|
|
|
418
329
|
catch { }
|
|
419
330
|
// Fallback: register core elements only
|
|
420
331
|
try {
|
|
421
|
-
const elems =
|
|
332
|
+
const elems = resolveVendorModule('nativescript-vue/dist/nativescript/elements');
|
|
422
333
|
const fn = (elems && (elems.registerCoreElements || elems.default?.registerCoreElements)) || undefined;
|
|
423
334
|
if (typeof fn === 'function') {
|
|
424
335
|
fn();
|
|
@@ -435,19 +346,7 @@ function installBuiltInComponentsOnApp(app) {
|
|
|
435
346
|
try {
|
|
436
347
|
if (!app || typeof app.component !== 'function')
|
|
437
348
|
return;
|
|
438
|
-
const
|
|
439
|
-
const reg = g.__nsVendorRegistry;
|
|
440
|
-
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
441
|
-
if (typeof req !== 'function')
|
|
442
|
-
return;
|
|
443
|
-
const comps = (() => {
|
|
444
|
-
try {
|
|
445
|
-
return req('nativescript-vue/dist/components');
|
|
446
|
-
}
|
|
447
|
-
catch {
|
|
448
|
-
return null;
|
|
449
|
-
}
|
|
450
|
-
})();
|
|
349
|
+
const comps = resolveVendorModule('nativescript-vue/dist/components');
|
|
451
350
|
const built = comps && (comps.BUILT_IN_COMPONENTS || comps.default?.BUILT_IN_COMPONENTS);
|
|
452
351
|
if (!built || typeof built !== 'object')
|
|
453
352
|
return;
|
|
@@ -468,55 +367,9 @@ function installBuiltInComponentsOnApp(app) {
|
|
|
468
367
|
}
|
|
469
368
|
catch { }
|
|
470
369
|
}
|
|
471
|
-
// Ensure the Pinia instance is also active in the HTTP ESM module world and that we provide
|
|
472
|
-
// the exact piniaSymbol exported by that module, so getActivePinia() and inject() both succeed
|
|
473
|
-
// regardless of which module copy a component imports.
|
|
474
|
-
async function syncPiniaAcrossEsm(app) {
|
|
475
|
-
try {
|
|
476
|
-
const g = globalThis;
|
|
477
|
-
const piniaInst = g.__NS_HMR_PINIA__ || app?._context?.provides?.pinia;
|
|
478
|
-
if (!piniaInst)
|
|
479
|
-
return;
|
|
480
|
-
// Resolve Pinia from ESM world and set active
|
|
481
|
-
let esmUrl = null;
|
|
482
|
-
try {
|
|
483
|
-
esmUrl = await requestModuleFromServer('pinia');
|
|
484
|
-
}
|
|
485
|
-
catch { }
|
|
486
|
-
if (esmUrl) {
|
|
487
|
-
try {
|
|
488
|
-
const mod = await safeDynImport(esmUrl);
|
|
489
|
-
const resolved = (mod && (mod.default ?? mod)) || mod;
|
|
490
|
-
const setActivePinia = resolved?.setActivePinia || mod?.setActivePinia;
|
|
491
|
-
const piniaSymbol = resolved?.piniaSymbol || mod?.piniaSymbol;
|
|
492
|
-
if (typeof setActivePinia === 'function') {
|
|
493
|
-
try {
|
|
494
|
-
setActivePinia(piniaInst);
|
|
495
|
-
}
|
|
496
|
-
catch { }
|
|
497
|
-
}
|
|
498
|
-
if (piniaSymbol && app?._context?.provides && !app._context.provides[piniaSymbol]) {
|
|
499
|
-
try {
|
|
500
|
-
app._context.provides[piniaSymbol] = piniaInst;
|
|
501
|
-
}
|
|
502
|
-
catch { }
|
|
503
|
-
try {
|
|
504
|
-
g.__NS_PINIA_SYMBOL__ = piniaSymbol;
|
|
505
|
-
}
|
|
506
|
-
catch { }
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
catch (e) {
|
|
510
|
-
if (__NS_ENV_VERBOSE__)
|
|
511
|
-
console.warn('[hmr-client] syncPiniaAcrossEsm failed import', e);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
catch { }
|
|
516
|
-
}
|
|
517
370
|
function bridgePiniaProvides(app, existingApp) {
|
|
518
371
|
try {
|
|
519
|
-
const g =
|
|
372
|
+
const g = getGlobalScope();
|
|
520
373
|
if (!app || !app._context)
|
|
521
374
|
return;
|
|
522
375
|
const newProv = app._context.provides || (app._context.provides = {});
|
|
@@ -546,17 +399,7 @@ function bridgePiniaProvides(app, existingApp) {
|
|
|
546
399
|
}
|
|
547
400
|
catch { }
|
|
548
401
|
try {
|
|
549
|
-
const
|
|
550
|
-
const req = vendorReg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
551
|
-
let vmod = null;
|
|
552
|
-
if (vendorReg && vendorReg.has('pinia'))
|
|
553
|
-
vmod = vendorReg.get('pinia');
|
|
554
|
-
else if (typeof req === 'function') {
|
|
555
|
-
try {
|
|
556
|
-
vmod = req('pinia');
|
|
557
|
-
}
|
|
558
|
-
catch { }
|
|
559
|
-
}
|
|
402
|
+
const vmod = resolveVendorModule('pinia');
|
|
560
403
|
const resolved = (vmod && (vmod.default ?? vmod)) || vmod;
|
|
561
404
|
const vendorSym = resolved?.piniaSymbol || vmod?.piniaSymbol;
|
|
562
405
|
if (vendorSym && typeof vendorSym === 'symbol')
|
|
@@ -630,37 +473,172 @@ export function handleVueSfcRegistry(msg) {
|
|
|
630
473
|
console.warn('[hmr-client][sfc-registry] install failed', e);
|
|
631
474
|
}
|
|
632
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* A component that declares required props can't be mounted as a standalone HMR
|
|
478
|
+
* root — nothing supplies them, so its render throws (white screen). Detects the
|
|
479
|
+
* object-form `props` Vue itself reads for the "Missing required prop" warning.
|
|
480
|
+
*/
|
|
481
|
+
function hmrComponentHasRequiredProps(comp) {
|
|
482
|
+
try {
|
|
483
|
+
const props = comp && comp.props;
|
|
484
|
+
if (!props || typeof props !== 'object' || Array.isArray(props))
|
|
485
|
+
return false;
|
|
486
|
+
for (const key of Object.keys(props)) {
|
|
487
|
+
const def = props[key];
|
|
488
|
+
if (def && typeof def === 'object' && def.required === true)
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
catch { }
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
// ── HMR replace-navigation window ────────────────────────────────────────────
|
|
496
|
+
// An in-place SFC reload (`__VUE_HMR_RUNTIME__.reload`) unmounts the old
|
|
497
|
+
// component subtree and mounts the fresh one. When the component's root is a
|
|
498
|
+
// `<Page>` hosted by a `<Frame>`, nativescript-vue's Frame nodeOps `insert`
|
|
499
|
+
// calls `frame.navigate({ create })` — a forward navigation that PUSHES a new
|
|
500
|
+
// backstack entry. Every HMR apply would grow the backstack and surface a Back
|
|
501
|
+
// button in the ActionBar (tapping it walks back through stale pre-edit
|
|
502
|
+
// renders). While a reload flush is in flight, convert those page navigations
|
|
503
|
+
// into `replacePage` (core's replace-navigation, the same primitive LiveSync
|
|
504
|
+
// uses) so the fresh Page takes the current entry's place and the user's real
|
|
505
|
+
// backstack is preserved untouched.
|
|
506
|
+
let hmrReplaceNavInstalled = false;
|
|
507
|
+
let hmrReplaceNavWindowDepth = 0;
|
|
508
|
+
function installHmrFrameReplaceNavigation() {
|
|
509
|
+
if (hmrReplaceNavInstalled)
|
|
510
|
+
return true;
|
|
511
|
+
try {
|
|
512
|
+
const FrameCtor = getCore('Frame');
|
|
513
|
+
const proto = FrameCtor?.prototype;
|
|
514
|
+
if (!proto || typeof proto.navigate !== 'function' || typeof proto.replacePage !== 'function')
|
|
515
|
+
return false;
|
|
516
|
+
const originalNavigate = proto.navigate;
|
|
517
|
+
proto.navigate = function (entry) {
|
|
518
|
+
// Only page-entry navigations on a frame that is already showing a
|
|
519
|
+
// page are rewritten — first mounts and user-driven navigations
|
|
520
|
+
// (outside the window) flow through untouched.
|
|
521
|
+
if (hmrReplaceNavWindowDepth > 0 && entry && typeof entry === 'object' && typeof entry.create === 'function' && this.currentPage) {
|
|
522
|
+
try {
|
|
523
|
+
if (__NS_ENV_VERBOSE__)
|
|
524
|
+
console.log('[hmr][vue] reload window: replacePage instead of forward navigate');
|
|
525
|
+
this.replacePage({ create: entry.create, animated: false });
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
catch (e) {
|
|
529
|
+
console.warn('[hmr][vue] replacePage during reload failed; falling back to navigate', e);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
// eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
|
|
533
|
+
return originalNavigate.apply(this, arguments);
|
|
534
|
+
};
|
|
535
|
+
hmrReplaceNavInstalled = true;
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
catch {
|
|
539
|
+
return false;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
function openHmrReplaceNavWindow() {
|
|
543
|
+
if (!installHmrFrameReplaceNavigation())
|
|
544
|
+
return () => { };
|
|
545
|
+
hmrReplaceNavWindowDepth++;
|
|
546
|
+
let closed = false;
|
|
547
|
+
return () => {
|
|
548
|
+
if (closed)
|
|
549
|
+
return;
|
|
550
|
+
closed = true;
|
|
551
|
+
hmrReplaceNavWindowDepth = Math.max(0, hmrReplaceNavWindowDepth - 1);
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* In-place Vue HMR. The assembled SFC stamps a stable `comp.__hmrId`, so Vue's
|
|
556
|
+
* registerHMR has a record for every mounted instance. Calling the real
|
|
557
|
+
* `__VUE_HMR_RUNTIME__.reload(id, newComp)` re-renders just those instances in
|
|
558
|
+
* place — preserving the App.vue shell (drawer, nav, router), current route, and
|
|
559
|
+
* scroll — instead of a whole-tree resetRootView. Returns false (→ resetRoot
|
|
560
|
+
* fallback) when the real runtime is absent (stub/prod build), the component has
|
|
561
|
+
* no id, or reload throws. A reload that matches no live instances is a no-op
|
|
562
|
+
* (component not currently displayed); the caller treats that as handled.
|
|
563
|
+
*/
|
|
564
|
+
function tryInPlaceVueReload(comp) {
|
|
565
|
+
try {
|
|
566
|
+
const rt = getGlobalScope().__VUE_HMR_RUNTIME__;
|
|
567
|
+
const id = comp && comp.__hmrId;
|
|
568
|
+
if (!rt || typeof rt.reload !== 'function' || !id)
|
|
569
|
+
return false;
|
|
570
|
+
// Vue queues the remount on its scheduler (microtask flush) — the
|
|
571
|
+
// Frame navigation happens inside that flush, not synchronously in
|
|
572
|
+
// reload(). Hold the replace-navigation window through the flush:
|
|
573
|
+
// nextTick resolves after the job queue drains; the timeout is a
|
|
574
|
+
// safety net when nextTick is unavailable.
|
|
575
|
+
const closeWindow = openHmrReplaceNavWindow();
|
|
576
|
+
try {
|
|
577
|
+
rt.reload(id, comp);
|
|
578
|
+
}
|
|
579
|
+
catch (e) {
|
|
580
|
+
closeWindow();
|
|
581
|
+
throw e;
|
|
582
|
+
}
|
|
583
|
+
try {
|
|
584
|
+
const nextTick = getGlobalScope().nextTick;
|
|
585
|
+
if (typeof nextTick === 'function') {
|
|
586
|
+
nextTick(() => closeWindow());
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
catch { }
|
|
590
|
+
setTimeout(closeWindow, 500);
|
|
591
|
+
if (__NS_ENV_VERBOSE__)
|
|
592
|
+
console.log('[hmr][vue] in-place reload', id);
|
|
593
|
+
return true;
|
|
594
|
+
}
|
|
595
|
+
catch (e) {
|
|
596
|
+
if (__NS_ENV_VERBOSE__)
|
|
597
|
+
console.warn('[hmr][vue] in-place reload failed; resetRoot fallback', e);
|
|
598
|
+
return false;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
633
601
|
export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
|
|
634
602
|
try {
|
|
635
603
|
if (typeof msg.path === 'string' && /\.vue$/i.test(msg.path)) {
|
|
636
|
-
//
|
|
604
|
+
// The registry update is the authoritative signal that this SFC changed
|
|
605
|
+
// for the announced version — record it unconditionally so remounts are
|
|
606
|
+
// resilient to out-of-order or dropped delta delivery.
|
|
637
607
|
try {
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
const versionsMatch = sfcChangedVersion != null && sfcChangedVersion === graphVersion;
|
|
641
|
-
if (!inChanged || !versionsMatch) {
|
|
642
|
-
// Be resilient to out-of-order delivery: treat the registry update itself
|
|
643
|
-
// as authoritative signal that this SFC changed for the announced version.
|
|
644
|
-
// This unblocks remounts when the delta was dropped or applied earlier than we recorded.
|
|
645
|
-
try {
|
|
646
|
-
const effectiveVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
|
|
647
|
-
sfcChangedVersion = effectiveVersion;
|
|
648
|
-
sfcChangedIds.add(base);
|
|
649
|
-
if (__NS_ENV_VERBOSE__)
|
|
650
|
-
console.log('[hmr][sfc-registry-update] accepting as change (out-of-order)', { path: msg.path, graphVersion, sfcChangedVersion });
|
|
651
|
-
}
|
|
652
|
-
catch { }
|
|
653
|
-
}
|
|
608
|
+
sfcChangedVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
|
|
609
|
+
sfcChangedIds.add(String(msg.path).split('?')[0]);
|
|
654
610
|
}
|
|
655
611
|
catch { }
|
|
656
612
|
try {
|
|
657
613
|
ensureVueGlobals();
|
|
658
614
|
const changedPath = String(msg.path);
|
|
659
|
-
//
|
|
660
|
-
//
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
615
|
+
// Default: remount the SFC that changed, so editing a page reflects
|
|
616
|
+
// immediately even if a different page is displayed.
|
|
617
|
+
let comp = await loadSfcComponent(changedPath);
|
|
618
|
+
// Preferred path: patch the changed component's mounted instances in
|
|
619
|
+
// place (App.vue shell, route, scroll all survive). Returning null tells
|
|
620
|
+
// the overlay no resetRootView is needed.
|
|
621
|
+
if (tryInPlaceVueReload(comp)) {
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
// Fallback (real Vue HMR runtime unavailable): a child SFC with required
|
|
625
|
+
// props cannot be a standalone root — mounting it bare crashes (missing
|
|
626
|
+
// props → white screen). Walk up to the nearest mountable ancestor (its
|
|
627
|
+
// hosting page) and remount that; the child's artifact set was evicted
|
|
628
|
+
// above, so the ancestor's re-assembly links the edited child and it
|
|
629
|
+
// re-renders with props.
|
|
630
|
+
if (comp && hmrComponentHasRequiredProps(comp)) {
|
|
631
|
+
const ancestors = findSfcAncestors(changedPath, graph);
|
|
632
|
+
for (const ancestor of ancestors) {
|
|
633
|
+
const ancestorComp = await loadSfcComponent(ancestor);
|
|
634
|
+
if (ancestorComp && !hmrComponentHasRequiredProps(ancestorComp)) {
|
|
635
|
+
if (__NS_ENV_VERBOSE__)
|
|
636
|
+
console.log('[hmr][vue] child SFC needs props; remounting nearest mountable ancestor', { changed: changedPath, ancestor });
|
|
637
|
+
comp = ancestorComp;
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
664
642
|
return comp;
|
|
665
643
|
}
|
|
666
644
|
catch (e) {
|
|
@@ -685,21 +663,15 @@ export function recordVuePayloadChanges(changed, graphVersion) {
|
|
|
685
663
|
if (sawVue)
|
|
686
664
|
sfcChangedVersion = graphVersion;
|
|
687
665
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
while (Date.now() - start < timeoutMs) {
|
|
698
|
-
await new Promise((r) => setTimeout(r, 30));
|
|
699
|
-
if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
|
|
700
|
-
return true;
|
|
701
|
-
}
|
|
702
|
-
return false;
|
|
666
|
+
/**
|
|
667
|
+
* True when the delta for `version` included a `.vue` change. The dep-change
|
|
668
|
+
* propagation in `refreshAfterBatch` uses this to stand down for mixed batches:
|
|
669
|
+
* the SFC registry-update path will already remount with a freshly assembled
|
|
670
|
+
* artifact at this version, which links against the re-imported deps — a second
|
|
671
|
+
* resetRoot from propagation would just double the work (and the flash).
|
|
672
|
+
*/
|
|
673
|
+
export function sfcChangedInVersion(version) {
|
|
674
|
+
return sfcChangedVersion != null && sfcChangedVersion === version && sfcChangedIds.size > 0;
|
|
703
675
|
}
|
|
704
676
|
// Map a graph id (possibly a .vue source path) to actual import spec
|
|
705
677
|
export function addSfcMapping(originalPath, fileName) {
|
|
@@ -719,26 +691,25 @@ export function addSfcMapping(originalPath, fileName) {
|
|
|
719
691
|
}
|
|
720
692
|
catch { }
|
|
721
693
|
}
|
|
722
|
-
// Build explicit SFC variant URL (script/template). Always preserves the
|
|
723
|
-
|
|
724
|
-
|
|
694
|
+
// Build explicit SFC variant URL (script/template). Always preserves the
|
|
695
|
+
// variant query. CANONICAL (unversioned): module identity is the URL;
|
|
696
|
+
// freshness comes from the eviction in `evictSfcArtifacts` below.
|
|
697
|
+
function resolveSfcVariantSpec(id, type) {
|
|
698
|
+
const origin = resolveHmrHttpOrigin();
|
|
725
699
|
const base = id.split('?')[0];
|
|
726
700
|
if (!origin)
|
|
727
701
|
return base + `?vue&type=${type}`;
|
|
728
702
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
729
|
-
|
|
730
|
-
let url = origin + `/ns/sfc/${ver}` + safePath + `?vue&type=${type}`;
|
|
731
|
-
return url;
|
|
703
|
+
return origin + '/ns/sfc' + safePath + `?vue&type=${type}`;
|
|
732
704
|
}
|
|
733
|
-
// Resolve deterministic SFC assembler ESM module
|
|
734
|
-
function resolveSfcAssemblerSpec(id
|
|
735
|
-
const origin =
|
|
705
|
+
// Resolve deterministic SFC assembler ESM module (canonical, unversioned).
|
|
706
|
+
function resolveSfcAssemblerSpec(id) {
|
|
707
|
+
const origin = resolveHmrHttpOrigin();
|
|
736
708
|
const base = id.split('?')[0];
|
|
737
709
|
if (!origin)
|
|
738
710
|
return base; // fallback: device will likely fail; origin should be available in dev
|
|
739
711
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
740
|
-
|
|
741
|
-
let url = origin + `/ns/asm/${ver}` + `?path=${encodeURIComponent(safePath)}`;
|
|
712
|
+
let url = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
|
|
742
713
|
try {
|
|
743
714
|
if (globalThis.__NS_HMR_ASM_DIAG__) {
|
|
744
715
|
url += '&diag=1';
|
|
@@ -747,49 +718,60 @@ function resolveSfcAssemblerSpec(id, cacheBustTag) {
|
|
|
747
718
|
catch { }
|
|
748
719
|
return url;
|
|
749
720
|
}
|
|
750
|
-
//
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
721
|
+
// The full SFC artifact URL set for one `.vue` path — every URL shape the
|
|
722
|
+
// device may hold a module record under for this component:
|
|
723
|
+
// - the assembler module (dynamic loads + full-SFC delegation target)
|
|
724
|
+
// - the assembler's `mode=inline` twin (static child imports inside a
|
|
725
|
+
// parent's assembled module)
|
|
726
|
+
// - the script/template variants (variant assembly + asm fallbacks)
|
|
727
|
+
// - the full `/ns/sfc<path>` delegation module (static `.vue` imports
|
|
728
|
+
// rewritten by the server inside `/ns/m` modules)
|
|
729
|
+
export function buildSfcEvictionUrls(id) {
|
|
730
|
+
const origin = resolveHmrHttpOrigin();
|
|
754
731
|
if (!origin)
|
|
755
|
-
return
|
|
732
|
+
return [];
|
|
733
|
+
const base = id.split('?')[0];
|
|
756
734
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
757
|
-
const
|
|
758
|
-
|
|
759
|
-
return url;
|
|
735
|
+
const asmUrl = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
|
|
736
|
+
return [asmUrl, asmUrl + '&mode=inline', origin + '/ns/sfc' + safePath + '?vue&type=script', origin + '/ns/sfc' + safePath + '?vue&type=template', origin + '/ns/sfc' + safePath];
|
|
760
737
|
}
|
|
761
|
-
|
|
738
|
+
// Evict every module record for this SFC's artifact set so the re-imports in
|
|
739
|
+
// `loadSfcComponent` fetch fresh content. ns:module `invalidateModules` drops the
|
|
740
|
+
// V8 registry entries AND arms the
|
|
741
|
+
// bust-next-fetch nonce that defeats the OS HTTP cache — the same freshness
|
|
742
|
+
// protocol `/ns/m` modules use (URLs never vary; eviction drives updates).
|
|
743
|
+
// Soft-fail: on runtimes without the eviction primitive we still re-import
|
|
744
|
+
// (worst case the device serves the cached artifact — same as any other
|
|
745
|
+
// module type on such a runtime).
|
|
746
|
+
function evictSfcArtifacts(id) {
|
|
762
747
|
try {
|
|
763
|
-
const
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
return null;
|
|
767
|
-
const json = await res.json();
|
|
768
|
-
return json;
|
|
748
|
+
const urls = buildSfcEvictionUrls(id);
|
|
749
|
+
if (urls.length)
|
|
750
|
+
invalidateModulesByUrls(urls);
|
|
769
751
|
}
|
|
770
|
-
catch {
|
|
771
|
-
|
|
752
|
+
catch (e) {
|
|
753
|
+
try {
|
|
754
|
+
console.warn('[hmr][vue] SFC artifact eviction failed for', id, e);
|
|
755
|
+
}
|
|
756
|
+
catch { }
|
|
772
757
|
}
|
|
773
758
|
}
|
|
774
759
|
// Safely load a component for a .vue SFC. Prefer deterministic assembler first to avoid
|
|
775
760
|
// any variant-compile or TDZ flakiness; only fall back to variant assembly if needed.
|
|
776
|
-
export async function loadSfcComponent(targetVuePath
|
|
761
|
+
export async function loadSfcComponent(targetVuePath) {
|
|
777
762
|
// Minimal mode removed: always go through deterministic assembler + device reset
|
|
778
763
|
// Ensure Vue globals exist BEFORE evaluating variant modules; their top-level aliasing reads globalThis.* once.
|
|
779
764
|
ensureVueGlobals();
|
|
780
|
-
//
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
if (__NS_ENV_VERBOSE__ && meta) {
|
|
787
|
-
console.log('[hmr][vue-reset][meta]', targetVuePath, meta);
|
|
788
|
-
}
|
|
765
|
+
// Evict this SFC's artifact URL set BEFORE any import below. Every load
|
|
766
|
+
// through here happens because fresh content is wanted (a `.vue` edit, an
|
|
767
|
+
// ancestor remount, or a dep-change boundary re-assembly), and the URLs
|
|
768
|
+
// are stable across saves — without the eviction, `import()` would return
|
|
769
|
+
// the cached (pre-edit) module records.
|
|
770
|
+
evictSfcArtifacts(targetVuePath);
|
|
789
771
|
// Prefer deterministic assembler first so AST normalization (including nav helpers) always applies.
|
|
790
772
|
try {
|
|
791
773
|
if (!DISABLE_ASM) {
|
|
792
|
-
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
774
|
+
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
793
775
|
const asmComp = asmMod?.default ?? asmMod;
|
|
794
776
|
if (asmComp && typeof asmComp === 'object') {
|
|
795
777
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -805,11 +787,11 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
805
787
|
// 1) Variant assembly (script then template) – closest to browser behavior
|
|
806
788
|
try {
|
|
807
789
|
// Import script variant FIRST to avoid TDZ due to cyclic evaluation between script/template.
|
|
808
|
-
const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'
|
|
790
|
+
const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'));
|
|
809
791
|
// Ensure script default is readable before importing the template; this enforces a stable order.
|
|
810
792
|
const base = await safeReadDefault(scriptMod);
|
|
811
793
|
// Now import the template render implementation
|
|
812
|
-
const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'
|
|
794
|
+
const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'));
|
|
813
795
|
if (__NS_ENV_VERBOSE__) {
|
|
814
796
|
const sKeys = scriptMod ? Object.keys(scriptMod).join(',') : '<none>';
|
|
815
797
|
const tKeys = templateMod ? Object.keys(templateMod).join(',') : '<none>';
|
|
@@ -829,7 +811,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
829
811
|
try {
|
|
830
812
|
if (__NS_ENV_VERBOSE__)
|
|
831
813
|
console.log('[hmr][vue-reset][diag] no render from template variant; attempting assembler for', targetVuePath);
|
|
832
|
-
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
814
|
+
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
833
815
|
const asmComp = asmMod?.default ?? asmMod;
|
|
834
816
|
if (asmComp && typeof asmComp === 'object' && typeof asmComp.render === 'function') {
|
|
835
817
|
try {
|
|
@@ -875,7 +857,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
875
857
|
if (__NS_ENV_VERBOSE__)
|
|
876
858
|
console.log('[hmr][vue-reset][diag] no script exports detected; attempting assembler import for', targetVuePath);
|
|
877
859
|
try {
|
|
878
|
-
const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
860
|
+
const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
879
861
|
const compAsm = asm?.default ?? asm;
|
|
880
862
|
if (compAsm && typeof compAsm === 'object') {
|
|
881
863
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -891,8 +873,8 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
891
873
|
// Synthesize a minimal component and attach named exports as local components so template resolveComponent works.
|
|
892
874
|
try {
|
|
893
875
|
ensureVueGlobals();
|
|
894
|
-
const comp =
|
|
895
|
-
?
|
|
876
|
+
const comp = getGlobalScope().defineComponent
|
|
877
|
+
? getGlobalScope().defineComponent({
|
|
896
878
|
name: targetVuePath.split('/').pop() || 'AnonymousSFC',
|
|
897
879
|
render,
|
|
898
880
|
})
|
|
@@ -933,7 +915,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
933
915
|
if (DISABLE_ASM)
|
|
934
916
|
throw new Error('asm disabled by __NS_HMR_DISABLE_ASM__');
|
|
935
917
|
await new Promise((r) => setTimeout(r, 10));
|
|
936
|
-
const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
918
|
+
const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
937
919
|
try {
|
|
938
920
|
const comp = await safeReadDefault(mod);
|
|
939
921
|
if (comp)
|
|
@@ -956,7 +938,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
956
938
|
if (__NS_ENV_VERBOSE__)
|
|
957
939
|
console.log('[hmr-client] [createRoot] begin');
|
|
958
940
|
ensureVueGlobals();
|
|
959
|
-
const g =
|
|
941
|
+
const g = getGlobalScope();
|
|
960
942
|
const AppFactory = g.createApp;
|
|
961
943
|
let RootCtor = g.NSVRoot;
|
|
962
944
|
// Hygiene: unmount any existing app instance to avoid duplicate lifecycle hooks
|
|
@@ -974,25 +956,9 @@ export function getRootForVue(newComponent, state) {
|
|
|
974
956
|
catch { }
|
|
975
957
|
try {
|
|
976
958
|
if (!RootCtor) {
|
|
977
|
-
const
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
if (registry && registry.has('nativescript-vue/dist/dom')) {
|
|
981
|
-
domMod = registry.get('nativescript-vue/dist/dom');
|
|
982
|
-
if (__NS_ENV_VERBOSE__)
|
|
983
|
-
console.log('[hmr-client] [createRoot] NS DOM from vendor registry');
|
|
984
|
-
}
|
|
985
|
-
else if (typeof req === 'function') {
|
|
986
|
-
try {
|
|
987
|
-
domMod = req('nativescript-vue/dist/dom');
|
|
988
|
-
if (__NS_ENV_VERBOSE__)
|
|
989
|
-
console.log('[hmr-client] [createRoot] NS DOM via require');
|
|
990
|
-
}
|
|
991
|
-
catch (e) {
|
|
992
|
-
if (__NS_ENV_VERBOSE__)
|
|
993
|
-
console.warn('[hmr-client] [createRoot] NS DOM require failed', e);
|
|
994
|
-
}
|
|
995
|
-
}
|
|
959
|
+
const domMod = resolveVendorModule('nativescript-vue/dist/dom');
|
|
960
|
+
if (__NS_ENV_VERBOSE__)
|
|
961
|
+
console.log('[hmr-client] [createRoot] NS DOM', domMod ? 'resolved from vendor chain' : 'unresolved');
|
|
996
962
|
if (domMod) {
|
|
997
963
|
const nsDom = (domMod && (domMod.default ?? domMod)) || domMod;
|
|
998
964
|
const ctor = nsDom?.NSVRoot || (nsDom?.default && nsDom.default.NSVRoot) || domMod?.NSVRoot;
|
|
@@ -1045,17 +1011,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
1045
1011
|
console.log('[hmr-client] [createRoot] app created via createApp');
|
|
1046
1012
|
}
|
|
1047
1013
|
try {
|
|
1048
|
-
const
|
|
1049
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
1050
|
-
let rh = null;
|
|
1051
|
-
if (registry && registry.has('nativescript-vue/dist/runtimeHelpers'))
|
|
1052
|
-
rh = registry.get('nativescript-vue/dist/runtimeHelpers');
|
|
1053
|
-
if (!rh && typeof req === 'function') {
|
|
1054
|
-
try {
|
|
1055
|
-
rh = req('nativescript-vue/dist/runtimeHelpers');
|
|
1056
|
-
}
|
|
1057
|
-
catch { }
|
|
1058
|
-
}
|
|
1014
|
+
const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
|
|
1059
1015
|
const setRootApp = rh && (rh.setRootApp || rh.default?.setRootApp);
|
|
1060
1016
|
if (typeof setRootApp === 'function') {
|
|
1061
1017
|
setRootApp(app);
|
|
@@ -1063,15 +1019,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
1063
1019
|
console.log('[hmr-client] [createRoot] runtimeHelpers.setRootApp applied');
|
|
1064
1020
|
}
|
|
1065
1021
|
try {
|
|
1066
|
-
|
|
1067
|
-
if (registry && registry.has('nativescript-vue'))
|
|
1068
|
-
nv = registry.get('nativescript-vue');
|
|
1069
|
-
if (!nv && typeof req === 'function') {
|
|
1070
|
-
try {
|
|
1071
|
-
nv = req('nativescript-vue');
|
|
1072
|
-
}
|
|
1073
|
-
catch { }
|
|
1074
|
-
}
|
|
1022
|
+
const nv = resolveVendorModule('nativescript-vue');
|
|
1075
1023
|
const setRootApp2 = nv && (nv.setRootApp || nv.default?.setRootApp);
|
|
1076
1024
|
if (typeof setRootApp2 === 'function') {
|
|
1077
1025
|
setRootApp2(app);
|
|
@@ -1103,20 +1051,6 @@ export function getRootForVue(newComponent, state) {
|
|
|
1103
1051
|
if (__NS_ENV_VERBOSE__)
|
|
1104
1052
|
console.warn('[hmr-client] [createRoot] ensurePiniaOnApp failed', e);
|
|
1105
1053
|
}
|
|
1106
|
-
try {
|
|
1107
|
-
(async () => {
|
|
1108
|
-
try {
|
|
1109
|
-
await syncPiniaAcrossEsm(app);
|
|
1110
|
-
if (__NS_ENV_VERBOSE__)
|
|
1111
|
-
console.log('[hmr-client] [createRoot] Pinia state sync requested');
|
|
1112
|
-
}
|
|
1113
|
-
catch (e) {
|
|
1114
|
-
if (__NS_ENV_VERBOSE__)
|
|
1115
|
-
console.warn('[hmr-client] [createRoot] syncPiniaAcrossEsm failed', e);
|
|
1116
|
-
}
|
|
1117
|
-
})();
|
|
1118
|
-
}
|
|
1119
|
-
catch { }
|
|
1120
1054
|
try {
|
|
1121
1055
|
bridgePiniaProvides(app, existingApp);
|
|
1122
1056
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -1192,9 +1126,18 @@ export function getRootForVue(newComponent, state) {
|
|
|
1192
1126
|
}
|
|
1193
1127
|
return null;
|
|
1194
1128
|
};
|
|
1195
|
-
//
|
|
1196
|
-
//
|
|
1197
|
-
|
|
1129
|
+
// Resolve the top-level native view from the component output. The previous logic
|
|
1130
|
+
// preferred ANY Frame found anywhere in the tree via depth-first recursion, which
|
|
1131
|
+
// is wrong when the component root is a Page that contains nested Frames (e.g.
|
|
1132
|
+
// a TabView whose TabViewItems each wrap their content in a <Frame>). That picked
|
|
1133
|
+
// the FIRST nested Frame and set it as the app root via resetRootView, severing
|
|
1134
|
+
// it from its TabViewItem parent and leaving a white screen on HMR reload.
|
|
1135
|
+
// Only fall back to the deep Frame/Page lookups when the top-level view is neither
|
|
1136
|
+
// (e.g., a raw Layout that the user intends to host an inner Frame for navigation).
|
|
1137
|
+
const topLevelNativeView = findNativeView(vm?.$el);
|
|
1138
|
+
const topCtorName = topLevelNativeView ? String(topLevelNativeView?.constructor?.name || '').replace(/^_+/, '') : '';
|
|
1139
|
+
const topIsPageOrFrame = /^(Page|Frame)(\$\d+)?$/.test(topCtorName);
|
|
1140
|
+
const nativeView = topIsPageOrFrame ? topLevelNativeView : findFrameNativeView(vm?.$el) || findPageNativeView(vm?.$el) || topLevelNativeView;
|
|
1198
1141
|
const GPage = getCore('Page');
|
|
1199
1142
|
// Decide root type and cache it
|
|
1200
1143
|
if (nativeView) {
|
|
@@ -1219,160 +1162,6 @@ export function getRootForVue(newComponent, state) {
|
|
|
1219
1162
|
state.setCachedRoot(nativeView);
|
|
1220
1163
|
return state.getCachedRoot();
|
|
1221
1164
|
}
|
|
1222
|
-
// Treat Frame$N as Frame as well
|
|
1223
|
-
if (ctorName === 'Frame_OLD_NEVER_REACHED') {
|
|
1224
|
-
// If a Frame is produced, prefer adopting the Frame as the new root to ensure a single authoritative Frame.
|
|
1225
|
-
// Extracting the Page and navigating a placeholder Frame can split realms and break app-controlled navigation.
|
|
1226
|
-
let pageCandidate = undefined;
|
|
1227
|
-
try {
|
|
1228
|
-
pageCandidate = nativeView.currentPage || nativeView._currentEntry?.resolvedPage;
|
|
1229
|
-
}
|
|
1230
|
-
catch { }
|
|
1231
|
-
if (pageCandidate) {
|
|
1232
|
-
if (__NS_ENV_VERBOSE__)
|
|
1233
|
-
console.log('[hmr-client] [createRoot] Frame root with currentPage detected; adopting Frame as root');
|
|
1234
|
-
state.setRootKind('frame');
|
|
1235
|
-
state.setCachedRoot(nativeView);
|
|
1236
|
-
return state.getCachedRoot();
|
|
1237
|
-
}
|
|
1238
|
-
// No currentPage yet; construct a Page wrapper and mount the component inside it
|
|
1239
|
-
try {
|
|
1240
|
-
if (__NS_ENV_VERBOSE__)
|
|
1241
|
-
console.log('[hmr-client] [createRoot] no currentPage; creating Page wrapper for navigation-first');
|
|
1242
|
-
const registry = globalThis.__nsVendorRegistry;
|
|
1243
|
-
const req = registry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
|
|
1244
|
-
let vueMod = null;
|
|
1245
|
-
if (registry && registry.has('vue'))
|
|
1246
|
-
vueMod = registry.get('vue');
|
|
1247
|
-
if (!vueMod && typeof req === 'function') {
|
|
1248
|
-
try {
|
|
1249
|
-
vueMod = req('vue');
|
|
1250
|
-
}
|
|
1251
|
-
catch { }
|
|
1252
|
-
}
|
|
1253
|
-
const h = vueMod?.h;
|
|
1254
|
-
const WrappedRoot = h
|
|
1255
|
-
? {
|
|
1256
|
-
name: 'HMRPageWrapper',
|
|
1257
|
-
setup() {
|
|
1258
|
-
return () => h('Page', null, [h(newComponent)]);
|
|
1259
|
-
},
|
|
1260
|
-
}
|
|
1261
|
-
: null;
|
|
1262
|
-
if (WrappedRoot) {
|
|
1263
|
-
const g = globalThis;
|
|
1264
|
-
const AppFactory = g.createApp;
|
|
1265
|
-
let app2 = AppFactory(WrappedRoot);
|
|
1266
|
-
try {
|
|
1267
|
-
const reg2 = g.__nsVendorRegistry;
|
|
1268
|
-
const req2 = reg2?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
1269
|
-
let rh2 = null;
|
|
1270
|
-
if (reg2 && reg2.has('nativescript-vue/dist/runtimeHelpers'))
|
|
1271
|
-
rh2 = reg2.get('nativescript-vue/dist/runtimeHelpers');
|
|
1272
|
-
if (!rh2 && typeof req2 === 'function') {
|
|
1273
|
-
try {
|
|
1274
|
-
rh2 = req2('nativescript-vue/dist/runtimeHelpers');
|
|
1275
|
-
}
|
|
1276
|
-
catch { }
|
|
1277
|
-
}
|
|
1278
|
-
const setRootApp2a = rh2 && (rh2.setRootApp || rh2.default?.setRootApp);
|
|
1279
|
-
if (typeof setRootApp2a === 'function')
|
|
1280
|
-
setRootApp2a(app2);
|
|
1281
|
-
try {
|
|
1282
|
-
let nv2 = null;
|
|
1283
|
-
if (reg2 && reg2.has('nativescript-vue'))
|
|
1284
|
-
nv2 = reg2.get('nativescript-vue');
|
|
1285
|
-
if (!nv2 && typeof req2 === 'function') {
|
|
1286
|
-
try {
|
|
1287
|
-
nv2 = req2('nativescript-vue');
|
|
1288
|
-
}
|
|
1289
|
-
catch { }
|
|
1290
|
-
}
|
|
1291
|
-
const setRootApp2b = nv2 && (nv2.setRootApp || nv2.default?.setRootApp);
|
|
1292
|
-
if (typeof setRootApp2b === 'function')
|
|
1293
|
-
setRootApp2b(app2);
|
|
1294
|
-
}
|
|
1295
|
-
catch { }
|
|
1296
|
-
}
|
|
1297
|
-
catch { }
|
|
1298
|
-
try {
|
|
1299
|
-
const hook = globalThis.__NS_HMR_INSTALL_PLUGINS__;
|
|
1300
|
-
if (typeof hook === 'function')
|
|
1301
|
-
hook(app2);
|
|
1302
|
-
}
|
|
1303
|
-
catch { }
|
|
1304
|
-
try {
|
|
1305
|
-
ensurePiniaOnApp(app2);
|
|
1306
|
-
}
|
|
1307
|
-
catch { }
|
|
1308
|
-
try {
|
|
1309
|
-
bridgePiniaProvides(app2, getCurrentApp() || globalThis.__NS_VUE_APP__);
|
|
1310
|
-
}
|
|
1311
|
-
catch { }
|
|
1312
|
-
try {
|
|
1313
|
-
installBuiltInComponentsOnApp(app2);
|
|
1314
|
-
}
|
|
1315
|
-
catch { }
|
|
1316
|
-
const RootCtor2 = globalThis.NSVRoot || RootCtor;
|
|
1317
|
-
const root2 = new RootCtor2();
|
|
1318
|
-
const vm2 = typeof app2.runWithContext === 'function' ? app2.runWithContext(() => app2.mount(root2)) : app2.mount(root2);
|
|
1319
|
-
setCurrentApp(app2);
|
|
1320
|
-
const findNativeView2 = (element) => {
|
|
1321
|
-
if (element?.nativeView)
|
|
1322
|
-
return element.nativeView;
|
|
1323
|
-
const kids = element?.childNodes || element?.children || [];
|
|
1324
|
-
for (const c of kids) {
|
|
1325
|
-
const r = findNativeView2(c);
|
|
1326
|
-
if (r)
|
|
1327
|
-
return r;
|
|
1328
|
-
}
|
|
1329
|
-
return null;
|
|
1330
|
-
};
|
|
1331
|
-
const findPageNativeView2 = (element) => {
|
|
1332
|
-
if (!element)
|
|
1333
|
-
return null;
|
|
1334
|
-
const nv = element.nativeView;
|
|
1335
|
-
if (nv) {
|
|
1336
|
-
const ctorName = String(nv?.constructor?.name || '').replace(/^_+/, '');
|
|
1337
|
-
if (ctorName === 'Page' || /^Page(\$\d+)?$/.test(ctorName))
|
|
1338
|
-
return nv;
|
|
1339
|
-
}
|
|
1340
|
-
const kids = element?.childNodes || element?.children || [];
|
|
1341
|
-
for (const k of kids) {
|
|
1342
|
-
const r = findPageNativeView2(k);
|
|
1343
|
-
if (r)
|
|
1344
|
-
return r;
|
|
1345
|
-
}
|
|
1346
|
-
return null;
|
|
1347
|
-
};
|
|
1348
|
-
const nv2 = findPageNativeView2(vm2?.$el) || findNativeView2(vm2?.$el);
|
|
1349
|
-
const ctor2 = String(nv2?.constructor?.name || '').replace(/^_+/, '');
|
|
1350
|
-
if (ctor2 === 'Page' || /^Page(\$\d+)?$/.test(ctor2)) {
|
|
1351
|
-
// Hide wrapper ActionBar to avoid double bars when a Frame is nested inside
|
|
1352
|
-
try {
|
|
1353
|
-
nv2.actionBarHidden = true;
|
|
1354
|
-
}
|
|
1355
|
-
catch { }
|
|
1356
|
-
if (__NS_ENV_VERBOSE__)
|
|
1357
|
-
console.log('[hmr-client] [createRoot] Page wrapper created successfully');
|
|
1358
|
-
state.setRootKind('page');
|
|
1359
|
-
state.setCachedRoot(nv2);
|
|
1360
|
-
return state.getCachedRoot();
|
|
1361
|
-
}
|
|
1362
|
-
if (__NS_ENV_VERBOSE__)
|
|
1363
|
-
console.warn('[hmr-client] [createRoot] Page wrapper did not yield Page; got', ctor2);
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
catch (e) {
|
|
1367
|
-
if (__NS_ENV_VERBOSE__)
|
|
1368
|
-
console.warn('[hmr-client] [createRoot] Page wrapper attempt failed', e);
|
|
1369
|
-
}
|
|
1370
|
-
if (__NS_ENV_VERBOSE__)
|
|
1371
|
-
console.log('[hmr-client] [createRoot] root kind=frame (no currentPage)');
|
|
1372
|
-
state.setRootKind('frame');
|
|
1373
|
-
state.setCachedRoot(nativeView);
|
|
1374
|
-
return state.getCachedRoot();
|
|
1375
|
-
}
|
|
1376
1165
|
if (GPage) {
|
|
1377
1166
|
const page = new GPage();
|
|
1378
1167
|
page.content = nativeView;
|
|
@@ -1407,12 +1196,12 @@ export function getRootForVue(newComponent, state) {
|
|
|
1407
1196
|
*/
|
|
1408
1197
|
export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
1409
1198
|
try {
|
|
1410
|
-
const g =
|
|
1199
|
+
const g = getGlobalScope();
|
|
1411
1200
|
// Provide global back-remount hooks for bridges to call
|
|
1412
1201
|
if (!g.__nsAttemptBackRemount) {
|
|
1413
1202
|
g.__nsAttemptBackRemount = () => {
|
|
1414
1203
|
try {
|
|
1415
|
-
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__
|
|
1204
|
+
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
|
|
1416
1205
|
if (orig) {
|
|
1417
1206
|
performResetRoot(orig);
|
|
1418
1207
|
return true;
|
|
@@ -1454,7 +1243,7 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
|
1454
1243
|
// fall through to fallback
|
|
1455
1244
|
}
|
|
1456
1245
|
// Fallback: reset to original root component if available
|
|
1457
|
-
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__
|
|
1246
|
+
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
|
|
1458
1247
|
if (orig) {
|
|
1459
1248
|
try {
|
|
1460
1249
|
// Reuse the proven remount pipeline for consistency
|
|
@@ -1470,44 +1259,4 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
|
1470
1259
|
}
|
|
1471
1260
|
catch { }
|
|
1472
1261
|
}
|
|
1473
|
-
async function requestModuleFromServer(name) {
|
|
1474
|
-
try {
|
|
1475
|
-
// Derive the dev-server origin (mirrors other resolver helpers in this file)
|
|
1476
|
-
const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
|
|
1477
|
-
if (!origin)
|
|
1478
|
-
return null;
|
|
1479
|
-
// Candidate URL patterns that a Vite-like server might expose for resolving modules to importable URLs.
|
|
1480
|
-
const candidates = [
|
|
1481
|
-
// Vite serves bare imports under /@modules/<name>
|
|
1482
|
-
`${origin.replace(/\/$/, '')}/@modules/${encodeURIComponent(name)}`,
|
|
1483
|
-
// Some setups use @id for resolved module ids
|
|
1484
|
-
`${origin.replace(/\/$/, '')}/@id/${encodeURIComponent(name)}`,
|
|
1485
|
-
// Custom-ish endpoint pattern used elsewhere in this project style
|
|
1486
|
-
`${origin.replace(/\/$/, '')}/ns/esmmod?name=${encodeURIComponent(name)}`,
|
|
1487
|
-
];
|
|
1488
|
-
// Probe each candidate with a lightweight HEAD request first; if allowed, return the candidate URL.
|
|
1489
|
-
for (const url of candidates) {
|
|
1490
|
-
try {
|
|
1491
|
-
const res = await fetch(url, { method: 'HEAD' });
|
|
1492
|
-
if (res && (res.ok || res.status === 200))
|
|
1493
|
-
return url;
|
|
1494
|
-
}
|
|
1495
|
-
catch {
|
|
1496
|
-
// ignore and try next
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
// As a final attempt, try GET on the first candidate and return if we get a module-like response.
|
|
1500
|
-
try {
|
|
1501
|
-
const url = candidates[0];
|
|
1502
|
-
const res = await fetch(url, { method: 'GET' });
|
|
1503
|
-
if (res && res.ok)
|
|
1504
|
-
return url;
|
|
1505
|
-
}
|
|
1506
|
-
catch { }
|
|
1507
|
-
return null;
|
|
1508
|
-
}
|
|
1509
|
-
catch {
|
|
1510
|
-
return null;
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
1262
|
//# sourceMappingURL=index.js.map
|