@nativescript/vite 8.0.0-beta.0 → 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 +35 -2
- package/configuration/angular.js +541 -216
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +228 -78
- 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/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/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 +31 -0
- package/helpers/flavor.js +53 -2
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +118 -0
- package/helpers/global-defines.js +214 -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 +24 -26
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +12 -1
- package/helpers/logging.js +81 -5
- 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 +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 +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 +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 +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 +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 +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 +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 +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/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/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 +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.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 +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 +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 +98 -0
- package/hmr/server/websocket-module-specifiers.js +832 -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 +592 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +98 -0
- package/hmr/server/websocket-served-module-helpers.js +948 -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 +6 -17
- package/hmr/server/websocket.js +723 -5376
- 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/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 +83 -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
|
@@ -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,13 +38,11 @@ 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) {
|
|
54
|
-
|
|
55
|
-
console.warn('[diag][nv][navigateTo][error]', (e && e.message) || e);
|
|
56
|
-
}
|
|
57
|
-
catch { }
|
|
45
|
+
console.warn('[diag][nv][navigateTo][error]', (e && e.message) || e);
|
|
58
46
|
try {
|
|
59
47
|
// Rescue path: attempt navigation via authoritative app Frame
|
|
60
48
|
return globalThis.__nsNavigateUsingApp?.(component, params);
|
|
@@ -88,74 +76,20 @@ export function installNsVueDevShims() {
|
|
|
88
76
|
}
|
|
89
77
|
catch { }
|
|
90
78
|
}
|
|
91
|
-
// initial root component for back fallback
|
|
92
|
-
let ORIG_ROOT_COMPONENT = null;
|
|
93
79
|
// Ensure Vue runtime global functions exist before evaluating SFC artifacts that rely on globalThis.* indirections.
|
|
94
80
|
export function ensureVueGlobals() {
|
|
95
81
|
try {
|
|
96
82
|
const g = globalThis;
|
|
97
83
|
const vueAlready = g.defineComponent && g.resolveComponent && g.createVNode;
|
|
98
|
-
const req = globalThis.__nsVendorRegistry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
|
|
99
|
-
const registry = globalThis.__nsVendorRegistry;
|
|
100
|
-
let nvMod = null;
|
|
101
|
-
let vueMod = null;
|
|
102
84
|
// Prefer nativescript-vue first so createApp has .start and NSVRoot is available
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if (!
|
|
110
|
-
|
|
111
|
-
nvMod = req('nativescript-vue');
|
|
112
|
-
}
|
|
113
|
-
catch { }
|
|
114
|
-
}
|
|
115
|
-
if (!vueMod && typeof req === 'function') {
|
|
116
|
-
try {
|
|
117
|
-
vueMod = req('vue');
|
|
118
|
-
}
|
|
119
|
-
catch { }
|
|
120
|
-
if (!vueMod) {
|
|
121
|
-
try {
|
|
122
|
-
vueMod = req('@vue/runtime-core');
|
|
123
|
-
}
|
|
124
|
-
catch { }
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
const baseMod = nvMod || vueMod;
|
|
128
|
-
let chosenMod = baseMod;
|
|
129
|
-
if (!chosenMod) {
|
|
130
|
-
// Last-ditch attempts on known ids
|
|
131
|
-
try {
|
|
132
|
-
chosenMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
|
|
133
|
-
}
|
|
134
|
-
catch { }
|
|
135
|
-
if (!chosenMod) {
|
|
136
|
-
try {
|
|
137
|
-
chosenMod = req && typeof req === 'function' ? req('vue') : null;
|
|
138
|
-
}
|
|
139
|
-
catch { }
|
|
140
|
-
}
|
|
141
|
-
if (!chosenMod)
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (!vueMod) {
|
|
145
|
-
// Last-ditch attempts on known ids
|
|
146
|
-
try {
|
|
147
|
-
vueMod = req && typeof req === 'function' ? req('vue') : null;
|
|
148
|
-
}
|
|
149
|
-
catch { }
|
|
150
|
-
if (!vueMod) {
|
|
151
|
-
try {
|
|
152
|
-
vueMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
|
|
153
|
-
}
|
|
154
|
-
catch { }
|
|
155
|
-
}
|
|
156
|
-
if (!vueMod)
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
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;
|
|
159
93
|
// Polyfill essential runtime helpers often imported from 'vue' by compiled SFC render code
|
|
160
94
|
try {
|
|
161
95
|
const polyNormalizeClass = (val) => {
|
|
@@ -321,7 +255,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
321
255
|
try {
|
|
322
256
|
if (!app || typeof app.use !== 'function')
|
|
323
257
|
return;
|
|
324
|
-
const g =
|
|
258
|
+
const g = getGlobalScope();
|
|
325
259
|
// If this app already has a Pinia provide, skip
|
|
326
260
|
try {
|
|
327
261
|
const prov = app?._context?.provides;
|
|
@@ -343,17 +277,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
343
277
|
catch { }
|
|
344
278
|
// Attempt to set active pinia if API is available
|
|
345
279
|
try {
|
|
346
|
-
const
|
|
347
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
348
|
-
let piniaMod = null;
|
|
349
|
-
if (registry && registry.has('pinia'))
|
|
350
|
-
piniaMod = registry.get('pinia');
|
|
351
|
-
if (!piniaMod && typeof req === 'function') {
|
|
352
|
-
try {
|
|
353
|
-
piniaMod = req('pinia');
|
|
354
|
-
}
|
|
355
|
-
catch { }
|
|
356
|
-
}
|
|
280
|
+
const piniaMod = resolveVendorModule('pinia');
|
|
357
281
|
const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
|
|
358
282
|
const setActivePinia = resolved?.setActivePinia;
|
|
359
283
|
if (typeof setActivePinia === 'function')
|
|
@@ -363,18 +287,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
363
287
|
return;
|
|
364
288
|
}
|
|
365
289
|
// Prefer vendor registry/require to load 'pinia'
|
|
366
|
-
const
|
|
367
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
368
|
-
let piniaMod = null;
|
|
369
|
-
if (registry && registry.has('pinia')) {
|
|
370
|
-
piniaMod = registry.get('pinia');
|
|
371
|
-
}
|
|
372
|
-
if (!piniaMod && typeof req === 'function') {
|
|
373
|
-
try {
|
|
374
|
-
piniaMod = req('pinia');
|
|
375
|
-
}
|
|
376
|
-
catch { }
|
|
377
|
-
}
|
|
290
|
+
const piniaMod = resolveVendorModule('pinia');
|
|
378
291
|
if (!piniaMod)
|
|
379
292
|
return;
|
|
380
293
|
const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
|
|
@@ -399,16 +312,11 @@ export function ensurePiniaOnApp(app) {
|
|
|
399
312
|
// Prefer nativescript-vue's own bootstrap to set up element registry and built-ins
|
|
400
313
|
export function ensureNsVueBootstrap() {
|
|
401
314
|
try {
|
|
402
|
-
const g = globalThis;
|
|
403
315
|
if (nsVueInitDone)
|
|
404
316
|
return;
|
|
405
|
-
const reg = g.__nsVendorRegistry;
|
|
406
|
-
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
407
|
-
if (typeof req !== 'function')
|
|
408
|
-
return;
|
|
409
317
|
// Try full init, which should register core elements and built-in components
|
|
410
318
|
try {
|
|
411
|
-
const nv =
|
|
319
|
+
const nv = resolveVendorModule('nativescript-vue/dist/nativescript');
|
|
412
320
|
const init = (nv && (nv.init || nv.default?.init)) || undefined;
|
|
413
321
|
if (typeof init === 'function') {
|
|
414
322
|
init();
|
|
@@ -421,7 +329,7 @@ export function ensureNsVueBootstrap() {
|
|
|
421
329
|
catch { }
|
|
422
330
|
// Fallback: register core elements only
|
|
423
331
|
try {
|
|
424
|
-
const elems =
|
|
332
|
+
const elems = resolveVendorModule('nativescript-vue/dist/nativescript/elements');
|
|
425
333
|
const fn = (elems && (elems.registerCoreElements || elems.default?.registerCoreElements)) || undefined;
|
|
426
334
|
if (typeof fn === 'function') {
|
|
427
335
|
fn();
|
|
@@ -438,19 +346,7 @@ function installBuiltInComponentsOnApp(app) {
|
|
|
438
346
|
try {
|
|
439
347
|
if (!app || typeof app.component !== 'function')
|
|
440
348
|
return;
|
|
441
|
-
const
|
|
442
|
-
const reg = g.__nsVendorRegistry;
|
|
443
|
-
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
444
|
-
if (typeof req !== 'function')
|
|
445
|
-
return;
|
|
446
|
-
const comps = (() => {
|
|
447
|
-
try {
|
|
448
|
-
return req('nativescript-vue/dist/components');
|
|
449
|
-
}
|
|
450
|
-
catch {
|
|
451
|
-
return null;
|
|
452
|
-
}
|
|
453
|
-
})();
|
|
349
|
+
const comps = resolveVendorModule('nativescript-vue/dist/components');
|
|
454
350
|
const built = comps && (comps.BUILT_IN_COMPONENTS || comps.default?.BUILT_IN_COMPONENTS);
|
|
455
351
|
if (!built || typeof built !== 'object')
|
|
456
352
|
return;
|
|
@@ -471,55 +367,9 @@ function installBuiltInComponentsOnApp(app) {
|
|
|
471
367
|
}
|
|
472
368
|
catch { }
|
|
473
369
|
}
|
|
474
|
-
// Ensure the Pinia instance is also active in the HTTP ESM module world and that we provide
|
|
475
|
-
// the exact piniaSymbol exported by that module, so getActivePinia() and inject() both succeed
|
|
476
|
-
// regardless of which module copy a component imports.
|
|
477
|
-
async function syncPiniaAcrossEsm(app) {
|
|
478
|
-
try {
|
|
479
|
-
const g = globalThis;
|
|
480
|
-
const piniaInst = g.__NS_HMR_PINIA__ || app?._context?.provides?.pinia;
|
|
481
|
-
if (!piniaInst)
|
|
482
|
-
return;
|
|
483
|
-
// Resolve Pinia from ESM world and set active
|
|
484
|
-
let esmUrl = null;
|
|
485
|
-
try {
|
|
486
|
-
esmUrl = await requestModuleFromServer('pinia');
|
|
487
|
-
}
|
|
488
|
-
catch { }
|
|
489
|
-
if (esmUrl) {
|
|
490
|
-
try {
|
|
491
|
-
const mod = await safeDynImport(esmUrl);
|
|
492
|
-
const resolved = (mod && (mod.default ?? mod)) || mod;
|
|
493
|
-
const setActivePinia = resolved?.setActivePinia || mod?.setActivePinia;
|
|
494
|
-
const piniaSymbol = resolved?.piniaSymbol || mod?.piniaSymbol;
|
|
495
|
-
if (typeof setActivePinia === 'function') {
|
|
496
|
-
try {
|
|
497
|
-
setActivePinia(piniaInst);
|
|
498
|
-
}
|
|
499
|
-
catch { }
|
|
500
|
-
}
|
|
501
|
-
if (piniaSymbol && app?._context?.provides && !app._context.provides[piniaSymbol]) {
|
|
502
|
-
try {
|
|
503
|
-
app._context.provides[piniaSymbol] = piniaInst;
|
|
504
|
-
}
|
|
505
|
-
catch { }
|
|
506
|
-
try {
|
|
507
|
-
g.__NS_PINIA_SYMBOL__ = piniaSymbol;
|
|
508
|
-
}
|
|
509
|
-
catch { }
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
catch (e) {
|
|
513
|
-
if (__NS_ENV_VERBOSE__)
|
|
514
|
-
console.warn('[hmr-client] syncPiniaAcrossEsm failed import', e);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
catch { }
|
|
519
|
-
}
|
|
520
370
|
function bridgePiniaProvides(app, existingApp) {
|
|
521
371
|
try {
|
|
522
|
-
const g =
|
|
372
|
+
const g = getGlobalScope();
|
|
523
373
|
if (!app || !app._context)
|
|
524
374
|
return;
|
|
525
375
|
const newProv = app._context.provides || (app._context.provides = {});
|
|
@@ -549,17 +399,7 @@ function bridgePiniaProvides(app, existingApp) {
|
|
|
549
399
|
}
|
|
550
400
|
catch { }
|
|
551
401
|
try {
|
|
552
|
-
const
|
|
553
|
-
const req = vendorReg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
554
|
-
let vmod = null;
|
|
555
|
-
if (vendorReg && vendorReg.has('pinia'))
|
|
556
|
-
vmod = vendorReg.get('pinia');
|
|
557
|
-
else if (typeof req === 'function') {
|
|
558
|
-
try {
|
|
559
|
-
vmod = req('pinia');
|
|
560
|
-
}
|
|
561
|
-
catch { }
|
|
562
|
-
}
|
|
402
|
+
const vmod = resolveVendorModule('pinia');
|
|
563
403
|
const resolved = (vmod && (vmod.default ?? vmod)) || vmod;
|
|
564
404
|
const vendorSym = resolved?.piniaSymbol || vmod?.piniaSymbol;
|
|
565
405
|
if (vendorSym && typeof vendorSym === 'symbol')
|
|
@@ -633,37 +473,172 @@ export function handleVueSfcRegistry(msg) {
|
|
|
633
473
|
console.warn('[hmr-client][sfc-registry] install failed', e);
|
|
634
474
|
}
|
|
635
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
|
+
}
|
|
636
601
|
export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
|
|
637
602
|
try {
|
|
638
603
|
if (typeof msg.path === 'string' && /\.vue$/i.test(msg.path)) {
|
|
639
|
-
//
|
|
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.
|
|
640
607
|
try {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
const versionsMatch = sfcChangedVersion != null && sfcChangedVersion === graphVersion;
|
|
644
|
-
if (!inChanged || !versionsMatch) {
|
|
645
|
-
// Be resilient to out-of-order delivery: treat the registry update itself
|
|
646
|
-
// as authoritative signal that this SFC changed for the announced version.
|
|
647
|
-
// This unblocks remounts when the delta was dropped or applied earlier than we recorded.
|
|
648
|
-
try {
|
|
649
|
-
const effectiveVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
|
|
650
|
-
sfcChangedVersion = effectiveVersion;
|
|
651
|
-
sfcChangedIds.add(base);
|
|
652
|
-
if (__NS_ENV_VERBOSE__)
|
|
653
|
-
console.log('[hmr][sfc-registry-update] accepting as change (out-of-order)', { path: msg.path, graphVersion, sfcChangedVersion });
|
|
654
|
-
}
|
|
655
|
-
catch { }
|
|
656
|
-
}
|
|
608
|
+
sfcChangedVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
|
|
609
|
+
sfcChangedIds.add(String(msg.path).split('?')[0]);
|
|
657
610
|
}
|
|
658
611
|
catch { }
|
|
659
612
|
try {
|
|
660
613
|
ensureVueGlobals();
|
|
661
614
|
const changedPath = String(msg.path);
|
|
662
|
-
//
|
|
663
|
-
//
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
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
|
+
}
|
|
667
642
|
return comp;
|
|
668
643
|
}
|
|
669
644
|
catch (e) {
|
|
@@ -688,21 +663,15 @@ export function recordVuePayloadChanges(changed, graphVersion) {
|
|
|
688
663
|
if (sawVue)
|
|
689
664
|
sfcChangedVersion = graphVersion;
|
|
690
665
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
while (Date.now() - start < timeoutMs) {
|
|
701
|
-
await new Promise((r) => setTimeout(r, 30));
|
|
702
|
-
if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
|
|
703
|
-
return true;
|
|
704
|
-
}
|
|
705
|
-
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;
|
|
706
675
|
}
|
|
707
676
|
// Map a graph id (possibly a .vue source path) to actual import spec
|
|
708
677
|
export function addSfcMapping(originalPath, fileName) {
|
|
@@ -722,26 +691,25 @@ export function addSfcMapping(originalPath, fileName) {
|
|
|
722
691
|
}
|
|
723
692
|
catch { }
|
|
724
693
|
}
|
|
725
|
-
// Build explicit SFC variant URL (script/template). Always preserves the
|
|
726
|
-
|
|
727
|
-
|
|
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();
|
|
728
699
|
const base = id.split('?')[0];
|
|
729
700
|
if (!origin)
|
|
730
701
|
return base + `?vue&type=${type}`;
|
|
731
702
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
732
|
-
|
|
733
|
-
let url = origin + `/ns/sfc/${ver}` + safePath + `?vue&type=${type}`;
|
|
734
|
-
return url;
|
|
703
|
+
return origin + '/ns/sfc' + safePath + `?vue&type=${type}`;
|
|
735
704
|
}
|
|
736
|
-
// Resolve deterministic SFC assembler ESM module
|
|
737
|
-
function resolveSfcAssemblerSpec(id
|
|
738
|
-
const origin =
|
|
705
|
+
// Resolve deterministic SFC assembler ESM module (canonical, unversioned).
|
|
706
|
+
function resolveSfcAssemblerSpec(id) {
|
|
707
|
+
const origin = resolveHmrHttpOrigin();
|
|
739
708
|
const base = id.split('?')[0];
|
|
740
709
|
if (!origin)
|
|
741
710
|
return base; // fallback: device will likely fail; origin should be available in dev
|
|
742
711
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
743
|
-
|
|
744
|
-
let url = origin + `/ns/asm/${ver}` + `?path=${encodeURIComponent(safePath)}`;
|
|
712
|
+
let url = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
|
|
745
713
|
try {
|
|
746
714
|
if (globalThis.__NS_HMR_ASM_DIAG__) {
|
|
747
715
|
url += '&diag=1';
|
|
@@ -750,52 +718,60 @@ function resolveSfcAssemblerSpec(id, cacheBustTag) {
|
|
|
750
718
|
catch { }
|
|
751
719
|
return url;
|
|
752
720
|
}
|
|
753
|
-
//
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
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();
|
|
757
731
|
if (!origin)
|
|
758
|
-
return
|
|
732
|
+
return [];
|
|
733
|
+
const base = id.split('?')[0];
|
|
759
734
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
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];
|
|
763
737
|
}
|
|
764
|
-
|
|
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) {
|
|
765
747
|
try {
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return null;
|
|
770
|
-
const json = await res.json();
|
|
771
|
-
return json;
|
|
748
|
+
const urls = buildSfcEvictionUrls(id);
|
|
749
|
+
if (urls.length)
|
|
750
|
+
invalidateModulesByUrls(urls);
|
|
772
751
|
}
|
|
773
|
-
catch {
|
|
774
|
-
|
|
752
|
+
catch (e) {
|
|
753
|
+
try {
|
|
754
|
+
console.warn('[hmr][vue] SFC artifact eviction failed for', id, e);
|
|
755
|
+
}
|
|
756
|
+
catch { }
|
|
775
757
|
}
|
|
776
758
|
}
|
|
777
759
|
// Safely load a component for a .vue SFC. Prefer deterministic assembler first to avoid
|
|
778
760
|
// any variant-compile or TDZ flakiness; only fall back to variant assembly if needed.
|
|
779
|
-
export async function loadSfcComponent(targetVuePath
|
|
761
|
+
export async function loadSfcComponent(targetVuePath) {
|
|
780
762
|
// Minimal mode removed: always go through deterministic assembler + device reset
|
|
781
763
|
// Ensure Vue globals exist BEFORE evaluating variant modules; their top-level aliasing reads globalThis.* once.
|
|
782
764
|
ensureVueGlobals();
|
|
783
|
-
//
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
if (__NS_ENV_VERBOSE__ && meta) {
|
|
790
|
-
try {
|
|
791
|
-
console.log('[hmr][vue-reset][meta]', targetVuePath, meta);
|
|
792
|
-
}
|
|
793
|
-
catch { }
|
|
794
|
-
}
|
|
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);
|
|
795
771
|
// Prefer deterministic assembler first so AST normalization (including nav helpers) always applies.
|
|
796
772
|
try {
|
|
797
773
|
if (!DISABLE_ASM) {
|
|
798
|
-
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
774
|
+
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
799
775
|
const asmComp = asmMod?.default ?? asmMod;
|
|
800
776
|
if (asmComp && typeof asmComp === 'object') {
|
|
801
777
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -811,28 +787,19 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
811
787
|
// 1) Variant assembly (script then template) – closest to browser behavior
|
|
812
788
|
try {
|
|
813
789
|
// Import script variant FIRST to avoid TDZ due to cyclic evaluation between script/template.
|
|
814
|
-
const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'
|
|
790
|
+
const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'));
|
|
815
791
|
// Ensure script default is readable before importing the template; this enforces a stable order.
|
|
816
792
|
const base = await safeReadDefault(scriptMod);
|
|
817
793
|
// Now import the template render implementation
|
|
818
|
-
const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'
|
|
794
|
+
const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'));
|
|
819
795
|
if (__NS_ENV_VERBOSE__) {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
catch { }
|
|
828
|
-
try {
|
|
829
|
-
console.log('[hmr][vue-reset][diag] templateMod:', {
|
|
830
|
-
render: typeof templateMod?.render,
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
catch { }
|
|
834
|
-
}
|
|
835
|
-
catch { }
|
|
796
|
+
const sKeys = scriptMod ? Object.keys(scriptMod).join(',') : '<none>';
|
|
797
|
+
const tKeys = templateMod ? Object.keys(templateMod).join(',') : '<none>';
|
|
798
|
+
console.log('[hmr][vue-reset][diag] variant-imports', targetVuePath, 'script.keys=', sKeys, 'template.keys=', tKeys);
|
|
799
|
+
console.log('[hmr][vue-reset][diag] scriptMod:', scriptMod);
|
|
800
|
+
console.log('[hmr][vue-reset][diag] templateMod:', {
|
|
801
|
+
render: typeof templateMod?.render,
|
|
802
|
+
});
|
|
836
803
|
}
|
|
837
804
|
// Only use variant assembly when the script provides a real component options object.
|
|
838
805
|
const render = templateMod?.render;
|
|
@@ -844,7 +811,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
844
811
|
try {
|
|
845
812
|
if (__NS_ENV_VERBOSE__)
|
|
846
813
|
console.log('[hmr][vue-reset][diag] no render from template variant; attempting assembler for', targetVuePath);
|
|
847
|
-
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
814
|
+
const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
848
815
|
const asmComp = asmMod?.default ?? asmMod;
|
|
849
816
|
if (asmComp && typeof asmComp === 'object' && typeof asmComp.render === 'function') {
|
|
850
817
|
try {
|
|
@@ -878,10 +845,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
878
845
|
catch { }
|
|
879
846
|
}
|
|
880
847
|
if (__NS_ENV_VERBOSE__) {
|
|
881
|
-
|
|
882
|
-
console.log('[hmr][vue-reset][diag] assembled.component (from script default) keys=', Object.keys(base).join(','), 'has.render=', !!base.render, 'components=', Object.keys(base.components || {}).join(','));
|
|
883
|
-
}
|
|
884
|
-
catch { }
|
|
848
|
+
console.log('[hmr][vue-reset][diag] assembled.component (from script default) keys=', Object.keys(base).join(','), 'has.render=', !!base.render, 'components=', Object.keys(base.components || {}).join(','));
|
|
885
849
|
}
|
|
886
850
|
return base;
|
|
887
851
|
}
|
|
@@ -893,7 +857,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
893
857
|
if (__NS_ENV_VERBOSE__)
|
|
894
858
|
console.log('[hmr][vue-reset][diag] no script exports detected; attempting assembler import for', targetVuePath);
|
|
895
859
|
try {
|
|
896
|
-
const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
860
|
+
const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
897
861
|
const compAsm = asm?.default ?? asm;
|
|
898
862
|
if (compAsm && typeof compAsm === 'object') {
|
|
899
863
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -909,8 +873,8 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
909
873
|
// Synthesize a minimal component and attach named exports as local components so template resolveComponent works.
|
|
910
874
|
try {
|
|
911
875
|
ensureVueGlobals();
|
|
912
|
-
const comp =
|
|
913
|
-
?
|
|
876
|
+
const comp = getGlobalScope().defineComponent
|
|
877
|
+
? getGlobalScope().defineComponent({
|
|
914
878
|
name: targetVuePath.split('/').pop() || 'AnonymousSFC',
|
|
915
879
|
render,
|
|
916
880
|
})
|
|
@@ -931,10 +895,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
931
895
|
catch { }
|
|
932
896
|
}
|
|
933
897
|
if (__NS_ENV_VERBOSE__) {
|
|
934
|
-
|
|
935
|
-
console.log('[hmr][vue-reset][diag] synthesized.component keys=', Object.keys(comp).join(','), 'components=', Object.keys(comp.components || {}).join(','));
|
|
936
|
-
}
|
|
937
|
-
catch { }
|
|
898
|
+
console.log('[hmr][vue-reset][diag] synthesized.component keys=', Object.keys(comp).join(','), 'components=', Object.keys(comp.components || {}).join(','));
|
|
938
899
|
}
|
|
939
900
|
return comp;
|
|
940
901
|
}
|
|
@@ -954,7 +915,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
954
915
|
if (DISABLE_ASM)
|
|
955
916
|
throw new Error('asm disabled by __NS_HMR_DISABLE_ASM__');
|
|
956
917
|
await new Promise((r) => setTimeout(r, 10));
|
|
957
|
-
const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath
|
|
918
|
+
const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
|
|
958
919
|
try {
|
|
959
920
|
const comp = await safeReadDefault(mod);
|
|
960
921
|
if (comp)
|
|
@@ -977,7 +938,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
977
938
|
if (__NS_ENV_VERBOSE__)
|
|
978
939
|
console.log('[hmr-client] [createRoot] begin');
|
|
979
940
|
ensureVueGlobals();
|
|
980
|
-
const g =
|
|
941
|
+
const g = getGlobalScope();
|
|
981
942
|
const AppFactory = g.createApp;
|
|
982
943
|
let RootCtor = g.NSVRoot;
|
|
983
944
|
// Hygiene: unmount any existing app instance to avoid duplicate lifecycle hooks
|
|
@@ -995,25 +956,9 @@ export function getRootForVue(newComponent, state) {
|
|
|
995
956
|
catch { }
|
|
996
957
|
try {
|
|
997
958
|
if (!RootCtor) {
|
|
998
|
-
const
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
if (registry && registry.has('nativescript-vue/dist/dom')) {
|
|
1002
|
-
domMod = registry.get('nativescript-vue/dist/dom');
|
|
1003
|
-
if (__NS_ENV_VERBOSE__)
|
|
1004
|
-
console.log('[hmr-client] [createRoot] NS DOM from vendor registry');
|
|
1005
|
-
}
|
|
1006
|
-
else if (typeof req === 'function') {
|
|
1007
|
-
try {
|
|
1008
|
-
domMod = req('nativescript-vue/dist/dom');
|
|
1009
|
-
if (__NS_ENV_VERBOSE__)
|
|
1010
|
-
console.log('[hmr-client] [createRoot] NS DOM via require');
|
|
1011
|
-
}
|
|
1012
|
-
catch (e) {
|
|
1013
|
-
if (__NS_ENV_VERBOSE__)
|
|
1014
|
-
console.warn('[hmr-client] [createRoot] NS DOM require failed', e);
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
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');
|
|
1017
962
|
if (domMod) {
|
|
1018
963
|
const nsDom = (domMod && (domMod.default ?? domMod)) || domMod;
|
|
1019
964
|
const ctor = nsDom?.NSVRoot || (nsDom?.default && nsDom.default.NSVRoot) || domMod?.NSVRoot;
|
|
@@ -1066,17 +1011,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
1066
1011
|
console.log('[hmr-client] [createRoot] app created via createApp');
|
|
1067
1012
|
}
|
|
1068
1013
|
try {
|
|
1069
|
-
const
|
|
1070
|
-
const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
1071
|
-
let rh = null;
|
|
1072
|
-
if (registry && registry.has('nativescript-vue/dist/runtimeHelpers'))
|
|
1073
|
-
rh = registry.get('nativescript-vue/dist/runtimeHelpers');
|
|
1074
|
-
if (!rh && typeof req === 'function') {
|
|
1075
|
-
try {
|
|
1076
|
-
rh = req('nativescript-vue/dist/runtimeHelpers');
|
|
1077
|
-
}
|
|
1078
|
-
catch { }
|
|
1079
|
-
}
|
|
1014
|
+
const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
|
|
1080
1015
|
const setRootApp = rh && (rh.setRootApp || rh.default?.setRootApp);
|
|
1081
1016
|
if (typeof setRootApp === 'function') {
|
|
1082
1017
|
setRootApp(app);
|
|
@@ -1084,15 +1019,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
1084
1019
|
console.log('[hmr-client] [createRoot] runtimeHelpers.setRootApp applied');
|
|
1085
1020
|
}
|
|
1086
1021
|
try {
|
|
1087
|
-
|
|
1088
|
-
if (registry && registry.has('nativescript-vue'))
|
|
1089
|
-
nv = registry.get('nativescript-vue');
|
|
1090
|
-
if (!nv && typeof req === 'function') {
|
|
1091
|
-
try {
|
|
1092
|
-
nv = req('nativescript-vue');
|
|
1093
|
-
}
|
|
1094
|
-
catch { }
|
|
1095
|
-
}
|
|
1022
|
+
const nv = resolveVendorModule('nativescript-vue');
|
|
1096
1023
|
const setRootApp2 = nv && (nv.setRootApp || nv.default?.setRootApp);
|
|
1097
1024
|
if (typeof setRootApp2 === 'function') {
|
|
1098
1025
|
setRootApp2(app);
|
|
@@ -1124,20 +1051,6 @@ export function getRootForVue(newComponent, state) {
|
|
|
1124
1051
|
if (__NS_ENV_VERBOSE__)
|
|
1125
1052
|
console.warn('[hmr-client] [createRoot] ensurePiniaOnApp failed', e);
|
|
1126
1053
|
}
|
|
1127
|
-
try {
|
|
1128
|
-
(async () => {
|
|
1129
|
-
try {
|
|
1130
|
-
await syncPiniaAcrossEsm(app);
|
|
1131
|
-
if (__NS_ENV_VERBOSE__)
|
|
1132
|
-
console.log('[hmr-client] [createRoot] Pinia state sync requested');
|
|
1133
|
-
}
|
|
1134
|
-
catch (e) {
|
|
1135
|
-
if (__NS_ENV_VERBOSE__)
|
|
1136
|
-
console.warn('[hmr-client] [createRoot] syncPiniaAcrossEsm failed', e);
|
|
1137
|
-
}
|
|
1138
|
-
})();
|
|
1139
|
-
}
|
|
1140
|
-
catch { }
|
|
1141
1054
|
try {
|
|
1142
1055
|
bridgePiniaProvides(app, existingApp);
|
|
1143
1056
|
if (__NS_ENV_VERBOSE__)
|
|
@@ -1160,16 +1073,13 @@ export function getRootForVue(newComponent, state) {
|
|
|
1160
1073
|
const vm = typeof app.runWithContext === 'function' ? app.runWithContext(() => app.mount(root)) : app.mount(root);
|
|
1161
1074
|
setCurrentApp(app);
|
|
1162
1075
|
if (__NS_ENV_VERBOSE__) {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
catch { }
|
|
1076
|
+
console.log('[hmr-client] [createRoot] mount result', {
|
|
1077
|
+
hasEl: !!vm?.$el,
|
|
1078
|
+
elType: vm?.$el?.constructor?.name,
|
|
1079
|
+
hasNativeView: !!vm?.$el?.nativeView,
|
|
1080
|
+
nativeViewType: vm?.$el?.nativeView?.constructor?.name,
|
|
1081
|
+
elapsedMs: Date.now() - t0,
|
|
1082
|
+
});
|
|
1173
1083
|
}
|
|
1174
1084
|
const findNativeView = (element) => {
|
|
1175
1085
|
if (element?.nativeView)
|
|
@@ -1216,9 +1126,18 @@ export function getRootForVue(newComponent, state) {
|
|
|
1216
1126
|
}
|
|
1217
1127
|
return null;
|
|
1218
1128
|
};
|
|
1219
|
-
//
|
|
1220
|
-
//
|
|
1221
|
-
|
|
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;
|
|
1222
1141
|
const GPage = getCore('Page');
|
|
1223
1142
|
// Decide root type and cache it
|
|
1224
1143
|
if (nativeView) {
|
|
@@ -1243,160 +1162,6 @@ export function getRootForVue(newComponent, state) {
|
|
|
1243
1162
|
state.setCachedRoot(nativeView);
|
|
1244
1163
|
return state.getCachedRoot();
|
|
1245
1164
|
}
|
|
1246
|
-
// Treat Frame$N as Frame as well
|
|
1247
|
-
if (ctorName === 'Frame_OLD_NEVER_REACHED') {
|
|
1248
|
-
// If a Frame is produced, prefer adopting the Frame as the new root to ensure a single authoritative Frame.
|
|
1249
|
-
// Extracting the Page and navigating a placeholder Frame can split realms and break app-controlled navigation.
|
|
1250
|
-
let pageCandidate = undefined;
|
|
1251
|
-
try {
|
|
1252
|
-
pageCandidate = nativeView.currentPage || nativeView._currentEntry?.resolvedPage;
|
|
1253
|
-
}
|
|
1254
|
-
catch { }
|
|
1255
|
-
if (pageCandidate) {
|
|
1256
|
-
if (__NS_ENV_VERBOSE__)
|
|
1257
|
-
console.log('[hmr-client] [createRoot] Frame root with currentPage detected; adopting Frame as root');
|
|
1258
|
-
state.setRootKind('frame');
|
|
1259
|
-
state.setCachedRoot(nativeView);
|
|
1260
|
-
return state.getCachedRoot();
|
|
1261
|
-
}
|
|
1262
|
-
// No currentPage yet; construct a Page wrapper and mount the component inside it
|
|
1263
|
-
try {
|
|
1264
|
-
if (__NS_ENV_VERBOSE__)
|
|
1265
|
-
console.log('[hmr-client] [createRoot] no currentPage; creating Page wrapper for navigation-first');
|
|
1266
|
-
const registry = globalThis.__nsVendorRegistry;
|
|
1267
|
-
const req = registry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
|
|
1268
|
-
let vueMod = null;
|
|
1269
|
-
if (registry && registry.has('vue'))
|
|
1270
|
-
vueMod = registry.get('vue');
|
|
1271
|
-
if (!vueMod && typeof req === 'function') {
|
|
1272
|
-
try {
|
|
1273
|
-
vueMod = req('vue');
|
|
1274
|
-
}
|
|
1275
|
-
catch { }
|
|
1276
|
-
}
|
|
1277
|
-
const h = vueMod?.h;
|
|
1278
|
-
const WrappedRoot = h
|
|
1279
|
-
? {
|
|
1280
|
-
name: 'HMRPageWrapper',
|
|
1281
|
-
setup() {
|
|
1282
|
-
return () => h('Page', null, [h(newComponent)]);
|
|
1283
|
-
},
|
|
1284
|
-
}
|
|
1285
|
-
: null;
|
|
1286
|
-
if (WrappedRoot) {
|
|
1287
|
-
const g = globalThis;
|
|
1288
|
-
const AppFactory = g.createApp;
|
|
1289
|
-
let app2 = AppFactory(WrappedRoot);
|
|
1290
|
-
try {
|
|
1291
|
-
const reg2 = g.__nsVendorRegistry;
|
|
1292
|
-
const req2 = reg2?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
1293
|
-
let rh2 = null;
|
|
1294
|
-
if (reg2 && reg2.has('nativescript-vue/dist/runtimeHelpers'))
|
|
1295
|
-
rh2 = reg2.get('nativescript-vue/dist/runtimeHelpers');
|
|
1296
|
-
if (!rh2 && typeof req2 === 'function') {
|
|
1297
|
-
try {
|
|
1298
|
-
rh2 = req2('nativescript-vue/dist/runtimeHelpers');
|
|
1299
|
-
}
|
|
1300
|
-
catch { }
|
|
1301
|
-
}
|
|
1302
|
-
const setRootApp2a = rh2 && (rh2.setRootApp || rh2.default?.setRootApp);
|
|
1303
|
-
if (typeof setRootApp2a === 'function')
|
|
1304
|
-
setRootApp2a(app2);
|
|
1305
|
-
try {
|
|
1306
|
-
let nv2 = null;
|
|
1307
|
-
if (reg2 && reg2.has('nativescript-vue'))
|
|
1308
|
-
nv2 = reg2.get('nativescript-vue');
|
|
1309
|
-
if (!nv2 && typeof req2 === 'function') {
|
|
1310
|
-
try {
|
|
1311
|
-
nv2 = req2('nativescript-vue');
|
|
1312
|
-
}
|
|
1313
|
-
catch { }
|
|
1314
|
-
}
|
|
1315
|
-
const setRootApp2b = nv2 && (nv2.setRootApp || nv2.default?.setRootApp);
|
|
1316
|
-
if (typeof setRootApp2b === 'function')
|
|
1317
|
-
setRootApp2b(app2);
|
|
1318
|
-
}
|
|
1319
|
-
catch { }
|
|
1320
|
-
}
|
|
1321
|
-
catch { }
|
|
1322
|
-
try {
|
|
1323
|
-
const hook = globalThis.__NS_HMR_INSTALL_PLUGINS__;
|
|
1324
|
-
if (typeof hook === 'function')
|
|
1325
|
-
hook(app2);
|
|
1326
|
-
}
|
|
1327
|
-
catch { }
|
|
1328
|
-
try {
|
|
1329
|
-
ensurePiniaOnApp(app2);
|
|
1330
|
-
}
|
|
1331
|
-
catch { }
|
|
1332
|
-
try {
|
|
1333
|
-
bridgePiniaProvides(app2, getCurrentApp() || globalThis.__NS_VUE_APP__);
|
|
1334
|
-
}
|
|
1335
|
-
catch { }
|
|
1336
|
-
try {
|
|
1337
|
-
installBuiltInComponentsOnApp(app2);
|
|
1338
|
-
}
|
|
1339
|
-
catch { }
|
|
1340
|
-
const RootCtor2 = globalThis.NSVRoot || RootCtor;
|
|
1341
|
-
const root2 = new RootCtor2();
|
|
1342
|
-
const vm2 = typeof app2.runWithContext === 'function' ? app2.runWithContext(() => app2.mount(root2)) : app2.mount(root2);
|
|
1343
|
-
setCurrentApp(app2);
|
|
1344
|
-
const findNativeView2 = (element) => {
|
|
1345
|
-
if (element?.nativeView)
|
|
1346
|
-
return element.nativeView;
|
|
1347
|
-
const kids = element?.childNodes || element?.children || [];
|
|
1348
|
-
for (const c of kids) {
|
|
1349
|
-
const r = findNativeView2(c);
|
|
1350
|
-
if (r)
|
|
1351
|
-
return r;
|
|
1352
|
-
}
|
|
1353
|
-
return null;
|
|
1354
|
-
};
|
|
1355
|
-
const findPageNativeView2 = (element) => {
|
|
1356
|
-
if (!element)
|
|
1357
|
-
return null;
|
|
1358
|
-
const nv = element.nativeView;
|
|
1359
|
-
if (nv) {
|
|
1360
|
-
const ctorName = String(nv?.constructor?.name || '').replace(/^_+/, '');
|
|
1361
|
-
if (ctorName === 'Page' || /^Page(\$\d+)?$/.test(ctorName))
|
|
1362
|
-
return nv;
|
|
1363
|
-
}
|
|
1364
|
-
const kids = element?.childNodes || element?.children || [];
|
|
1365
|
-
for (const k of kids) {
|
|
1366
|
-
const r = findPageNativeView2(k);
|
|
1367
|
-
if (r)
|
|
1368
|
-
return r;
|
|
1369
|
-
}
|
|
1370
|
-
return null;
|
|
1371
|
-
};
|
|
1372
|
-
const nv2 = findPageNativeView2(vm2?.$el) || findNativeView2(vm2?.$el);
|
|
1373
|
-
const ctor2 = String(nv2?.constructor?.name || '').replace(/^_+/, '');
|
|
1374
|
-
if (ctor2 === 'Page' || /^Page(\$\d+)?$/.test(ctor2)) {
|
|
1375
|
-
// Hide wrapper ActionBar to avoid double bars when a Frame is nested inside
|
|
1376
|
-
try {
|
|
1377
|
-
nv2.actionBarHidden = true;
|
|
1378
|
-
}
|
|
1379
|
-
catch { }
|
|
1380
|
-
if (__NS_ENV_VERBOSE__)
|
|
1381
|
-
console.log('[hmr-client] [createRoot] Page wrapper created successfully');
|
|
1382
|
-
state.setRootKind('page');
|
|
1383
|
-
state.setCachedRoot(nv2);
|
|
1384
|
-
return state.getCachedRoot();
|
|
1385
|
-
}
|
|
1386
|
-
if (__NS_ENV_VERBOSE__)
|
|
1387
|
-
console.warn('[hmr-client] [createRoot] Page wrapper did not yield Page; got', ctor2);
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
catch (e) {
|
|
1391
|
-
if (__NS_ENV_VERBOSE__)
|
|
1392
|
-
console.warn('[hmr-client] [createRoot] Page wrapper attempt failed', e);
|
|
1393
|
-
}
|
|
1394
|
-
if (__NS_ENV_VERBOSE__)
|
|
1395
|
-
console.log('[hmr-client] [createRoot] root kind=frame (no currentPage)');
|
|
1396
|
-
state.setRootKind('frame');
|
|
1397
|
-
state.setCachedRoot(nativeView);
|
|
1398
|
-
return state.getCachedRoot();
|
|
1399
|
-
}
|
|
1400
1165
|
if (GPage) {
|
|
1401
1166
|
const page = new GPage();
|
|
1402
1167
|
page.content = nativeView;
|
|
@@ -1431,12 +1196,12 @@ export function getRootForVue(newComponent, state) {
|
|
|
1431
1196
|
*/
|
|
1432
1197
|
export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
1433
1198
|
try {
|
|
1434
|
-
const g =
|
|
1199
|
+
const g = getGlobalScope();
|
|
1435
1200
|
// Provide global back-remount hooks for bridges to call
|
|
1436
1201
|
if (!g.__nsAttemptBackRemount) {
|
|
1437
1202
|
g.__nsAttemptBackRemount = () => {
|
|
1438
1203
|
try {
|
|
1439
|
-
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__
|
|
1204
|
+
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
|
|
1440
1205
|
if (orig) {
|
|
1441
1206
|
performResetRoot(orig);
|
|
1442
1207
|
return true;
|
|
@@ -1478,7 +1243,7 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
|
1478
1243
|
// fall through to fallback
|
|
1479
1244
|
}
|
|
1480
1245
|
// Fallback: reset to original root component if available
|
|
1481
|
-
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__
|
|
1246
|
+
const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
|
|
1482
1247
|
if (orig) {
|
|
1483
1248
|
try {
|
|
1484
1249
|
// Reuse the proven remount pipeline for consistency
|
|
@@ -1494,44 +1259,4 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
|
1494
1259
|
}
|
|
1495
1260
|
catch { }
|
|
1496
1261
|
}
|
|
1497
|
-
async function requestModuleFromServer(name) {
|
|
1498
|
-
try {
|
|
1499
|
-
// Derive the dev-server origin (mirrors other resolver helpers in this file)
|
|
1500
|
-
const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
|
|
1501
|
-
if (!origin)
|
|
1502
|
-
return null;
|
|
1503
|
-
// Candidate URL patterns that a Vite-like server might expose for resolving modules to importable URLs.
|
|
1504
|
-
const candidates = [
|
|
1505
|
-
// Vite serves bare imports under /@modules/<name>
|
|
1506
|
-
`${origin.replace(/\/$/, '')}/@modules/${encodeURIComponent(name)}`,
|
|
1507
|
-
// Some setups use @id for resolved module ids
|
|
1508
|
-
`${origin.replace(/\/$/, '')}/@id/${encodeURIComponent(name)}`,
|
|
1509
|
-
// Custom-ish endpoint pattern used elsewhere in this project style
|
|
1510
|
-
`${origin.replace(/\/$/, '')}/ns/esmmod?name=${encodeURIComponent(name)}`,
|
|
1511
|
-
];
|
|
1512
|
-
// Probe each candidate with a lightweight HEAD request first; if allowed, return the candidate URL.
|
|
1513
|
-
for (const url of candidates) {
|
|
1514
|
-
try {
|
|
1515
|
-
const res = await fetch(url, { method: 'HEAD' });
|
|
1516
|
-
if (res && (res.ok || res.status === 200))
|
|
1517
|
-
return url;
|
|
1518
|
-
}
|
|
1519
|
-
catch {
|
|
1520
|
-
// ignore and try next
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
// As a final attempt, try GET on the first candidate and return if we get a module-like response.
|
|
1524
|
-
try {
|
|
1525
|
-
const url = candidates[0];
|
|
1526
|
-
const res = await fetch(url, { method: 'GET' });
|
|
1527
|
-
if (res && res.ok)
|
|
1528
|
-
return url;
|
|
1529
|
-
}
|
|
1530
|
-
catch { }
|
|
1531
|
-
return null;
|
|
1532
|
-
}
|
|
1533
|
-
catch {
|
|
1534
|
-
return null;
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
1262
|
//# sourceMappingURL=index.js.map
|