@nativescript/vite 8.0.0-alpha.6 → 8.0.0-alpha.61
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 +51 -11
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +390 -165
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +244 -53
- 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 +12 -93
- package/configuration/typescript.js.map +1 -1
- package/helpers/app-components.d.ts +2 -1
- package/helpers/app-components.js.map +1 -1
- package/helpers/app-css-state.d.ts +8 -0
- package/helpers/app-css-state.js +8 -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.js +9 -4
- 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/global-defines.d.ts +100 -13
- package/helpers/global-defines.js +165 -28
- 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 +0 -18
- package/helpers/init.js.map +1 -1
- package/helpers/logging.js +29 -1
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +4 -1
- package/helpers/main-entry.js +368 -53
- 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.d.ts +9 -2
- package/helpers/nativeclass-transformer-plugin.js +163 -15
- 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-url.d.ts +29 -7
- package/helpers/ns-core-url.js +69 -12
- 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/project.d.ts +35 -0
- package/helpers/project.js +120 -2
- package/helpers/project.js.map +1 -1
- package/helpers/resolve-main-field-platform.d.ts +20 -0
- package/helpers/resolve-main-field-platform.js +49 -0
- package/helpers/resolve-main-field-platform.js.map +1 -0
- package/helpers/resolver.js +17 -2
- package/helpers/resolver.js.map +1 -1
- package/helpers/theme-core-plugins.js +1 -1
- package/helpers/theme-core-plugins.js.map +1 -1
- package/helpers/ts-config-paths.d.ts +32 -0
- package/helpers/ts-config-paths.js +156 -27
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +2 -1
- package/helpers/typescript-check.js +2 -2
- 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 +48 -19
- package/helpers/workers.js +662 -13
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +50 -26
- 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 +79 -0
- package/hmr/client/framework-client-strategy.js +19 -0
- package/hmr/client/framework-client-strategy.js.map +1 -0
- package/hmr/client/hmr-pending-overlay.d.ts +0 -14
- package/hmr/client/hmr-pending-overlay.js +14 -4
- package/hmr/client/hmr-pending-overlay.js.map +1 -1
- package/hmr/client/hot-context.d.ts +67 -0
- package/hmr/client/hot-context.js +284 -0
- package/hmr/client/hot-context.js.map +1 -0
- package/hmr/client/index.js +922 -273
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/utils.d.ts +2 -1
- package/hmr/client/utils.js +111 -99
- package/hmr/client/utils.js.map +1 -1
- package/hmr/entry-runtime.d.ts +2 -1
- package/hmr/entry-runtime.js +279 -71
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
- package/hmr/frameworks/angular/build/angular-linker.js +109 -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/{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/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/{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/client/index.js +542 -175
- 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 +1 -4
- package/hmr/frameworks/angular/server/linker.js.map +1 -1
- package/hmr/frameworks/angular/server/strategy.js +458 -12
- 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 +14 -11
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +108 -111
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.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 +246 -0
- package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
- package/hmr/frameworks/solid/server/strategy.js +291 -16
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/server/strategy.js +38 -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 +9 -0
- package/hmr/frameworks/vue/client/index.js +251 -247
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
- package/hmr/frameworks/vue/client/strategy.js +157 -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 +142 -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 +286 -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 +77 -10
- 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-archive-route.d.ts +40 -0
- package/hmr/server/boot-archive-route.js +154 -0
- package/hmr/server/boot-archive-route.js.map +1 -0
- package/hmr/server/boot-closure-route.d.ts +49 -0
- package/hmr/server/boot-closure-route.js +144 -0
- package/hmr/server/boot-closure-route.js.map +1 -0
- package/hmr/server/boot-recording.d.ts +58 -0
- package/hmr/server/boot-recording.js +228 -0
- package/hmr/server/boot-recording.js.map +1 -0
- package/hmr/server/constants.js +20 -5
- package/hmr/server/constants.js.map +1 -1
- 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 +170 -45
- package/hmr/server/core-sanitize.js.map +1 -1
- 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/deps-bundle.d.ts +218 -0
- package/hmr/server/deps-bundle.js +998 -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 +113 -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 +13 -4
- package/hmr/server/import-map.js +94 -47
- 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/ns-core-cjs-shape.d.ts +2 -4
- package/hmr/server/ns-core-cjs-shape.js +4 -6
- package/hmr/server/ns-core-cjs-shape.js.map +1 -1
- 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 +6 -10
- package/hmr/server/perf-instrumentation.js +5 -6
- package/hmr/server/perf-instrumentation.js.map +1 -1
- package/hmr/server/process-code-for-device.d.ts +30 -0
- package/hmr/server/process-code-for-device.js +791 -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 +638 -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/server-origin.d.ts +2 -0
- package/hmr/server/server-origin.js +83 -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/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 +180 -54
- 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 -54
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- package/hmr/server/websocket-css-hot-update.d.ts +33 -0
- package/hmr/server/websocket-css-hot-update.js +65 -0
- package/hmr/server/websocket-css-hot-update.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-hmr-pending.d.ts +3 -9
- package/hmr/server/websocket-hmr-pending.js +1 -1
- package/hmr/server/websocket-hmr-pending.js.map +1 -1
- package/hmr/server/websocket-hot-update.d.ts +77 -0
- package/hmr/server/websocket-hot-update.js +360 -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 +50 -0
- package/hmr/server/websocket-import-map-route.js.map +1 -0
- package/hmr/server/websocket-module-bindings.js +3 -3
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-module-specifiers.d.ts +66 -2
- package/hmr/server/websocket-module-specifiers.js +191 -20
- 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 +164 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +1 -3
- package/hmr/server/websocket-ns-m-paths.js +25 -82
- package/hmr/server/websocket-ns-m-paths.js.map +1 -1
- package/hmr/server/websocket-ns-m-request.d.ts +11 -1
- package/hmr/server/websocket-ns-m-request.js +17 -9
- 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 +835 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +50 -4
- package/hmr/server/websocket-served-module-helpers.js +384 -86
- 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 +7 -39
- package/hmr/server/websocket.js +643 -6716
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +108 -0
- package/hmr/shared/ns-globals.js +28 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/protocol.d.ts +145 -0
- package/hmr/shared/protocol.js +28 -0
- package/hmr/shared/protocol.js.map +1 -0
- package/hmr/shared/runtime/boot-archive-format.d.ts +16 -0
- package/hmr/shared/runtime/boot-archive-format.js +31 -0
- package/hmr/shared/runtime/boot-archive-format.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 +2 -1
- package/hmr/shared/runtime/boot-timeline.js +9 -22
- package/hmr/shared/runtime/boot-timeline.js.map +1 -1
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +53 -22
- package/hmr/shared/runtime/browser-runtime-contract.js +6 -9
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
- 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.d.ts +76 -30
- package/hmr/shared/runtime/dev-overlay.js +767 -408
- 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/http-only-boot.js +7 -6
- package/hmr/shared/runtime/http-only-boot.js.map +1 -1
- package/hmr/shared/runtime/module-provenance.js +4 -6
- package/hmr/shared/runtime/module-provenance.js.map +1 -1
- 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 +398 -204
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +274 -55
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +3 -10
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
- package/hmr/shared/vendor/manifest-collect.js +549 -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 +1 -7
- package/hmr/shared/vendor/manifest.js +136 -825
- 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 +76 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +401 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
- package/hmr/vendor-bootstrap.d.ts +1 -3
- package/hmr/vendor-bootstrap.js +4 -6
- package/hmr/vendor-bootstrap.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +65 -11
- package/runtime/core-aliases-early.js +25 -55
- 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 -194
- package/helpers/angular/angular-linker.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 +0 -67
- package/helpers/angular/util.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/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 -286
- 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 -1114
- package/hmr/server/websocket-vue-sfc.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}/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/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { deriveHttpOrigin, getCore, getCurrentApp,
|
|
1
|
+
import { deriveHttpOrigin, getCore, getCurrentApp, getHMRWsUrl, getHttpOriginForVite, graph, invalidateModulesByUrls, normalizeSpec, safeDynImport, safeReadDefault, setCurrentApp } from '../../../client/utils.js';
|
|
2
|
+
import { getGlobalScope } from '../../../shared/runtime/global-scope.js';
|
|
3
|
+
import { findSfcAncestors } from './dep-propagation.js';
|
|
2
4
|
const APP_VIRTUAL_WITH_SLASH = (() => {
|
|
3
|
-
|
|
5
|
+
// Define substitution does not reach this raw-served file; prefer the
|
|
6
|
+
// globalThis seed from the entry's defines-seed module ('app/'-rooted
|
|
7
|
+
// projects would otherwise get the wrong '/src' default).
|
|
8
|
+
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
9
|
return root.replace(/\/+$/, '') + '/';
|
|
5
10
|
})();
|
|
6
11
|
// Optional runtime knob: allow disabling assembler path in favor of variant-only flow
|
|
@@ -16,7 +21,7 @@ export const sfcArtifactMap = new Map();
|
|
|
16
21
|
// Install dev shims for nativescript-vue navigation to observe and (optionally) rescue
|
|
17
22
|
export function installNsVueDevShims() {
|
|
18
23
|
try {
|
|
19
|
-
const g =
|
|
24
|
+
const g = getGlobalScope();
|
|
20
25
|
const reg = g.__nsVendorRegistry;
|
|
21
26
|
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
22
27
|
const getMod = (id) => {
|
|
@@ -48,13 +53,11 @@ export function installNsVueDevShims() {
|
|
|
48
53
|
paramKeys: Object.keys(params || {}),
|
|
49
54
|
});
|
|
50
55
|
}
|
|
56
|
+
// eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
|
|
51
57
|
return orig.apply(this, arguments);
|
|
52
58
|
}
|
|
53
59
|
catch (e) {
|
|
54
|
-
|
|
55
|
-
console.warn('[diag][nv][navigateTo][error]', (e && e.message) || e);
|
|
56
|
-
}
|
|
57
|
-
catch { }
|
|
60
|
+
console.warn('[diag][nv][navigateTo][error]', (e && e.message) || e);
|
|
58
61
|
try {
|
|
59
62
|
// Rescue path: attempt navigation via authoritative app Frame
|
|
60
63
|
return globalThis.__nsNavigateUsingApp?.(component, params);
|
|
@@ -89,13 +92,13 @@ export function installNsVueDevShims() {
|
|
|
89
92
|
catch { }
|
|
90
93
|
}
|
|
91
94
|
// initial root component for back fallback
|
|
92
|
-
|
|
95
|
+
const ORIG_ROOT_COMPONENT = null;
|
|
93
96
|
// Ensure Vue runtime global functions exist before evaluating SFC artifacts that rely on globalThis.* indirections.
|
|
94
97
|
export function ensureVueGlobals() {
|
|
95
98
|
try {
|
|
96
99
|
const g = globalThis;
|
|
97
100
|
const vueAlready = g.defineComponent && g.resolveComponent && g.createVNode;
|
|
98
|
-
const req =
|
|
101
|
+
const req = getGlobalScope().__nsVendorRegistry?.get ? getGlobalScope().__nsVendorRequire || getGlobalScope().__nsRequire || getGlobalScope().require : getGlobalScope().__nsRequire || getGlobalScope().require;
|
|
99
102
|
const registry = globalThis.__nsVendorRegistry;
|
|
100
103
|
let nvMod = null;
|
|
101
104
|
let vueMod = null;
|
|
@@ -321,7 +324,7 @@ export function ensurePiniaOnApp(app) {
|
|
|
321
324
|
try {
|
|
322
325
|
if (!app || typeof app.use !== 'function')
|
|
323
326
|
return;
|
|
324
|
-
const g =
|
|
327
|
+
const g = getGlobalScope();
|
|
325
328
|
// If this app already has a Pinia provide, skip
|
|
326
329
|
try {
|
|
327
330
|
const prov = app?._context?.provides;
|
|
@@ -438,7 +441,7 @@ function installBuiltInComponentsOnApp(app) {
|
|
|
438
441
|
try {
|
|
439
442
|
if (!app || typeof app.component !== 'function')
|
|
440
443
|
return;
|
|
441
|
-
const g =
|
|
444
|
+
const g = getGlobalScope();
|
|
442
445
|
const reg = g.__nsVendorRegistry;
|
|
443
446
|
const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
|
|
444
447
|
if (typeof req !== 'function')
|
|
@@ -519,7 +522,7 @@ async function syncPiniaAcrossEsm(app) {
|
|
|
519
522
|
}
|
|
520
523
|
function bridgePiniaProvides(app, existingApp) {
|
|
521
524
|
try {
|
|
522
|
-
const g =
|
|
525
|
+
const g = getGlobalScope();
|
|
523
526
|
if (!app || !app._context)
|
|
524
527
|
return;
|
|
525
528
|
const newProv = app._context.provides || (app._context.provides = {});
|
|
@@ -633,6 +636,131 @@ export function handleVueSfcRegistry(msg) {
|
|
|
633
636
|
console.warn('[hmr-client][sfc-registry] install failed', e);
|
|
634
637
|
}
|
|
635
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* A component that declares required props can't be mounted as a standalone HMR
|
|
641
|
+
* root — nothing supplies them, so its render throws (white screen). Detects the
|
|
642
|
+
* object-form `props` Vue itself reads for the "Missing required prop" warning.
|
|
643
|
+
*/
|
|
644
|
+
function hmrComponentHasRequiredProps(comp) {
|
|
645
|
+
try {
|
|
646
|
+
const props = comp && comp.props;
|
|
647
|
+
if (!props || typeof props !== 'object' || Array.isArray(props))
|
|
648
|
+
return false;
|
|
649
|
+
for (const key of Object.keys(props)) {
|
|
650
|
+
const def = props[key];
|
|
651
|
+
if (def && typeof def === 'object' && def.required === true)
|
|
652
|
+
return true;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
catch { }
|
|
656
|
+
return false;
|
|
657
|
+
}
|
|
658
|
+
// ── HMR replace-navigation window ────────────────────────────────────────────
|
|
659
|
+
// An in-place SFC reload (`__VUE_HMR_RUNTIME__.reload`) unmounts the old
|
|
660
|
+
// component subtree and mounts the fresh one. When the component's root is a
|
|
661
|
+
// `<Page>` hosted by a `<Frame>`, nativescript-vue's Frame nodeOps `insert`
|
|
662
|
+
// calls `frame.navigate({ create })` — a forward navigation that PUSHES a new
|
|
663
|
+
// backstack entry. Every HMR apply would grow the backstack and surface a Back
|
|
664
|
+
// button in the ActionBar (tapping it walks back through stale pre-edit
|
|
665
|
+
// renders). While a reload flush is in flight, convert those page navigations
|
|
666
|
+
// into `replacePage` (core's replace-navigation, the same primitive LiveSync
|
|
667
|
+
// uses) so the fresh Page takes the current entry's place and the user's real
|
|
668
|
+
// backstack is preserved untouched.
|
|
669
|
+
let hmrReplaceNavInstalled = false;
|
|
670
|
+
let hmrReplaceNavWindowDepth = 0;
|
|
671
|
+
function installHmrFrameReplaceNavigation() {
|
|
672
|
+
if (hmrReplaceNavInstalled)
|
|
673
|
+
return true;
|
|
674
|
+
try {
|
|
675
|
+
const FrameCtor = getCore('Frame');
|
|
676
|
+
const proto = FrameCtor?.prototype;
|
|
677
|
+
if (!proto || typeof proto.navigate !== 'function' || typeof proto.replacePage !== 'function')
|
|
678
|
+
return false;
|
|
679
|
+
const originalNavigate = proto.navigate;
|
|
680
|
+
proto.navigate = function (entry) {
|
|
681
|
+
// Only page-entry navigations on a frame that is already showing a
|
|
682
|
+
// page are rewritten — first mounts and user-driven navigations
|
|
683
|
+
// (outside the window) flow through untouched.
|
|
684
|
+
if (hmrReplaceNavWindowDepth > 0 && entry && typeof entry === 'object' && typeof entry.create === 'function' && this.currentPage) {
|
|
685
|
+
try {
|
|
686
|
+
if (__NS_ENV_VERBOSE__)
|
|
687
|
+
console.log('[hmr][vue] reload window: replacePage instead of forward navigate');
|
|
688
|
+
this.replacePage({ create: entry.create, animated: false });
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
catch (e) {
|
|
692
|
+
console.warn('[hmr][vue] replacePage during reload failed; falling back to navigate', e);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
// eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
|
|
696
|
+
return originalNavigate.apply(this, arguments);
|
|
697
|
+
};
|
|
698
|
+
hmrReplaceNavInstalled = true;
|
|
699
|
+
return true;
|
|
700
|
+
}
|
|
701
|
+
catch {
|
|
702
|
+
return false;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function openHmrReplaceNavWindow() {
|
|
706
|
+
if (!installHmrFrameReplaceNavigation())
|
|
707
|
+
return () => { };
|
|
708
|
+
hmrReplaceNavWindowDepth++;
|
|
709
|
+
let closed = false;
|
|
710
|
+
return () => {
|
|
711
|
+
if (closed)
|
|
712
|
+
return;
|
|
713
|
+
closed = true;
|
|
714
|
+
hmrReplaceNavWindowDepth = Math.max(0, hmrReplaceNavWindowDepth - 1);
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* In-place Vue HMR. The assembled SFC stamps a stable `comp.__hmrId`, so Vue's
|
|
719
|
+
* registerHMR has a record for every mounted instance. Calling the real
|
|
720
|
+
* `__VUE_HMR_RUNTIME__.reload(id, newComp)` re-renders just those instances in
|
|
721
|
+
* place — preserving the App.vue shell (drawer, nav, router), current route, and
|
|
722
|
+
* scroll — instead of a whole-tree resetRootView. Returns false (→ resetRoot
|
|
723
|
+
* fallback) when the real runtime is absent (stub/prod build), the component has
|
|
724
|
+
* no id, or reload throws. A reload that matches no live instances is a no-op
|
|
725
|
+
* (component not currently displayed); the caller treats that as handled.
|
|
726
|
+
*/
|
|
727
|
+
function tryInPlaceVueReload(comp) {
|
|
728
|
+
try {
|
|
729
|
+
const rt = getGlobalScope().__VUE_HMR_RUNTIME__;
|
|
730
|
+
const id = comp && comp.__hmrId;
|
|
731
|
+
if (!rt || typeof rt.reload !== 'function' || !id)
|
|
732
|
+
return false;
|
|
733
|
+
// Vue queues the remount on its scheduler (microtask flush) — the
|
|
734
|
+
// Frame navigation happens inside that flush, not synchronously in
|
|
735
|
+
// reload(). Hold the replace-navigation window through the flush:
|
|
736
|
+
// nextTick resolves after the job queue drains; the timeout is a
|
|
737
|
+
// safety net when nextTick is unavailable.
|
|
738
|
+
const closeWindow = openHmrReplaceNavWindow();
|
|
739
|
+
try {
|
|
740
|
+
rt.reload(id, comp);
|
|
741
|
+
}
|
|
742
|
+
catch (e) {
|
|
743
|
+
closeWindow();
|
|
744
|
+
throw e;
|
|
745
|
+
}
|
|
746
|
+
try {
|
|
747
|
+
const nextTick = getGlobalScope().nextTick;
|
|
748
|
+
if (typeof nextTick === 'function') {
|
|
749
|
+
nextTick(() => closeWindow());
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
catch { }
|
|
753
|
+
setTimeout(closeWindow, 500);
|
|
754
|
+
if (__NS_ENV_VERBOSE__)
|
|
755
|
+
console.log('[hmr][vue] in-place reload', id);
|
|
756
|
+
return true;
|
|
757
|
+
}
|
|
758
|
+
catch (e) {
|
|
759
|
+
if (__NS_ENV_VERBOSE__)
|
|
760
|
+
console.warn('[hmr][vue] in-place reload failed; resetRoot fallback', e);
|
|
761
|
+
return false;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
636
764
|
export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
|
|
637
765
|
try {
|
|
638
766
|
if (typeof msg.path === 'string' && /\.vue$/i.test(msg.path)) {
|
|
@@ -659,11 +787,33 @@ export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
|
|
|
659
787
|
try {
|
|
660
788
|
ensureVueGlobals();
|
|
661
789
|
const changedPath = String(msg.path);
|
|
662
|
-
//
|
|
663
|
-
//
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
790
|
+
// Default: remount the SFC that changed, so editing a page reflects
|
|
791
|
+
// immediately even if a different page is displayed.
|
|
792
|
+
let comp = await loadSfcComponent(changedPath, 'sfc_update');
|
|
793
|
+
// Preferred path: patch the changed component's mounted instances in
|
|
794
|
+
// place (App.vue shell, route, scroll all survive). Returning null tells
|
|
795
|
+
// the overlay no resetRootView is needed.
|
|
796
|
+
if (tryInPlaceVueReload(comp)) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
// Fallback (real Vue HMR runtime unavailable): a child SFC with required
|
|
800
|
+
// props cannot be a standalone root — mounting it bare crashes (missing
|
|
801
|
+
// props → white screen). Walk up to the nearest mountable ancestor (its
|
|
802
|
+
// hosting page) and remount that; the child's artifact set was evicted
|
|
803
|
+
// above, so the ancestor's re-assembly links the edited child and it
|
|
804
|
+
// re-renders with props.
|
|
805
|
+
if (comp && hmrComponentHasRequiredProps(comp)) {
|
|
806
|
+
const ancestors = findSfcAncestors(changedPath, graph);
|
|
807
|
+
for (const ancestor of ancestors) {
|
|
808
|
+
const ancestorComp = await loadSfcComponent(ancestor, 'sfc_update_ancestor');
|
|
809
|
+
if (ancestorComp && !hmrComponentHasRequiredProps(ancestorComp)) {
|
|
810
|
+
if (__NS_ENV_VERBOSE__)
|
|
811
|
+
console.log('[hmr][vue] child SFC needs props; remounting nearest mountable ancestor', { changed: changedPath, ancestor });
|
|
812
|
+
comp = ancestorComp;
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
}
|
|
667
817
|
return comp;
|
|
668
818
|
}
|
|
669
819
|
catch (e) {
|
|
@@ -688,6 +838,16 @@ export function recordVuePayloadChanges(changed, graphVersion) {
|
|
|
688
838
|
if (sawVue)
|
|
689
839
|
sfcChangedVersion = graphVersion;
|
|
690
840
|
}
|
|
841
|
+
/**
|
|
842
|
+
* True when the delta for `version` included a `.vue` change. The dep-change
|
|
843
|
+
* propagation in `refreshAfterBatch` uses this to stand down for mixed batches:
|
|
844
|
+
* the SFC registry-update path will already remount with a freshly assembled
|
|
845
|
+
* artifact at this version, which links against the re-imported deps — a second
|
|
846
|
+
* resetRoot from propagation would just double the work (and the flash).
|
|
847
|
+
*/
|
|
848
|
+
export function sfcChangedInVersion(version) {
|
|
849
|
+
return sfcChangedVersion != null && sfcChangedVersion === version && sfcChangedIds.size > 0;
|
|
850
|
+
}
|
|
691
851
|
async function waitForSfcMapping(id, timeoutMs = 350) {
|
|
692
852
|
if (!/\.vue$/i.test(id))
|
|
693
853
|
return true;
|
|
@@ -722,26 +882,25 @@ export function addSfcMapping(originalPath, fileName) {
|
|
|
722
882
|
}
|
|
723
883
|
catch { }
|
|
724
884
|
}
|
|
725
|
-
// Build explicit SFC variant URL (script/template). Always preserves the
|
|
885
|
+
// Build explicit SFC variant URL (script/template). Always preserves the
|
|
886
|
+
// variant query. CANONICAL (unversioned): module identity is the URL;
|
|
887
|
+
// freshness comes from the eviction in `evictSfcArtifacts` below.
|
|
726
888
|
function resolveSfcVariantSpec(id, type, cacheBustTag) {
|
|
727
889
|
const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
|
|
728
890
|
const base = id.split('?')[0];
|
|
729
891
|
if (!origin)
|
|
730
892
|
return base + `?vue&type=${type}`;
|
|
731
893
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
732
|
-
|
|
733
|
-
let url = origin + `/ns/sfc/${ver}` + safePath + `?vue&type=${type}`;
|
|
734
|
-
return url;
|
|
894
|
+
return origin + '/ns/sfc' + safePath + `?vue&type=${type}`;
|
|
735
895
|
}
|
|
736
|
-
// Resolve deterministic SFC assembler ESM module
|
|
896
|
+
// Resolve deterministic SFC assembler ESM module (canonical, unversioned).
|
|
737
897
|
function resolveSfcAssemblerSpec(id, cacheBustTag) {
|
|
738
898
|
const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
|
|
739
899
|
const base = id.split('?')[0];
|
|
740
900
|
if (!origin)
|
|
741
901
|
return base; // fallback: device will likely fail; origin should be available in dev
|
|
742
902
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
743
|
-
|
|
744
|
-
let url = origin + `/ns/asm/${ver}` + `?path=${encodeURIComponent(safePath)}`;
|
|
903
|
+
let url = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
|
|
745
904
|
try {
|
|
746
905
|
if (globalThis.__NS_HMR_ASM_DIAG__) {
|
|
747
906
|
url += '&diag=1';
|
|
@@ -750,28 +909,42 @@ function resolveSfcAssemblerSpec(id, cacheBustTag) {
|
|
|
750
909
|
catch { }
|
|
751
910
|
return url;
|
|
752
911
|
}
|
|
753
|
-
//
|
|
754
|
-
|
|
912
|
+
// The full SFC artifact URL set for one `.vue` path — every URL shape the
|
|
913
|
+
// device may hold a module record under for this component:
|
|
914
|
+
// - the assembler module (dynamic loads + full-SFC delegation target)
|
|
915
|
+
// - the assembler's `mode=inline` twin (static child imports inside a
|
|
916
|
+
// parent's assembled module)
|
|
917
|
+
// - the script/template variants (variant assembly + asm fallbacks)
|
|
918
|
+
// - the full `/ns/sfc<path>` delegation module (static `.vue` imports
|
|
919
|
+
// rewritten by the server inside `/ns/m` modules)
|
|
920
|
+
export function buildSfcEvictionUrls(id) {
|
|
755
921
|
const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
|
|
756
|
-
const base = id.split('?')[0];
|
|
757
922
|
if (!origin)
|
|
758
|
-
return
|
|
923
|
+
return [];
|
|
924
|
+
const base = id.split('?')[0];
|
|
759
925
|
const safePath = base.startsWith('/') ? base : '/' + base;
|
|
760
|
-
const
|
|
761
|
-
|
|
762
|
-
return url;
|
|
926
|
+
const asmUrl = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
|
|
927
|
+
return [asmUrl, asmUrl + '&mode=inline', origin + '/ns/sfc' + safePath + '?vue&type=script', origin + '/ns/sfc' + safePath + '?vue&type=template', origin + '/ns/sfc' + safePath];
|
|
763
928
|
}
|
|
764
|
-
|
|
929
|
+
// Evict every module record for this SFC's artifact set so the re-imports in
|
|
930
|
+
// `loadSfcComponent` fetch fresh content. `__NS_DEV__.invalidateModules` drops the
|
|
931
|
+
// V8 registry entries + the runtime's prewarm cache AND arms the
|
|
932
|
+
// bust-next-fetch nonce that defeats the OS HTTP cache — the same freshness
|
|
933
|
+
// protocol `/ns/m` modules use (URLs never vary; eviction drives updates).
|
|
934
|
+
// Soft-fail: on runtimes without the eviction primitive we still re-import
|
|
935
|
+
// (worst case the device serves the cached artifact — same as any other
|
|
936
|
+
// module type on such a runtime).
|
|
937
|
+
function evictSfcArtifacts(id) {
|
|
765
938
|
try {
|
|
766
|
-
const
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return null;
|
|
770
|
-
const json = await res.json();
|
|
771
|
-
return json;
|
|
939
|
+
const urls = buildSfcEvictionUrls(id);
|
|
940
|
+
if (urls.length)
|
|
941
|
+
invalidateModulesByUrls(urls);
|
|
772
942
|
}
|
|
773
|
-
catch {
|
|
774
|
-
|
|
943
|
+
catch (e) {
|
|
944
|
+
try {
|
|
945
|
+
console.warn('[hmr][vue] SFC artifact eviction failed for', id, e);
|
|
946
|
+
}
|
|
947
|
+
catch { }
|
|
775
948
|
}
|
|
776
949
|
}
|
|
777
950
|
// Safely load a component for a .vue SFC. Prefer deterministic assembler first to avoid
|
|
@@ -780,18 +953,12 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
780
953
|
// Minimal mode removed: always go through deterministic assembler + device reset
|
|
781
954
|
// Ensure Vue globals exist BEFORE evaluating variant modules; their top-level aliasing reads globalThis.* once.
|
|
782
955
|
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
|
-
}
|
|
956
|
+
// Evict this SFC's artifact URL set BEFORE any import below. Every load
|
|
957
|
+
// through here happens because fresh content is wanted (a `.vue` edit, an
|
|
958
|
+
// ancestor remount, or a dep-change boundary re-assembly), and the URLs
|
|
959
|
+
// are stable across saves — without the eviction, `import()` would return
|
|
960
|
+
// the cached (pre-edit) module records.
|
|
961
|
+
evictSfcArtifacts(targetVuePath);
|
|
795
962
|
// Prefer deterministic assembler first so AST normalization (including nav helpers) always applies.
|
|
796
963
|
try {
|
|
797
964
|
if (!DISABLE_ASM) {
|
|
@@ -817,22 +984,13 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
817
984
|
// Now import the template render implementation
|
|
818
985
|
const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template', tag + '_template'));
|
|
819
986
|
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 { }
|
|
987
|
+
const sKeys = scriptMod ? Object.keys(scriptMod).join(',') : '<none>';
|
|
988
|
+
const tKeys = templateMod ? Object.keys(templateMod).join(',') : '<none>';
|
|
989
|
+
console.log('[hmr][vue-reset][diag] variant-imports', targetVuePath, 'script.keys=', sKeys, 'template.keys=', tKeys);
|
|
990
|
+
console.log('[hmr][vue-reset][diag] scriptMod:', scriptMod);
|
|
991
|
+
console.log('[hmr][vue-reset][diag] templateMod:', {
|
|
992
|
+
render: typeof templateMod?.render,
|
|
993
|
+
});
|
|
836
994
|
}
|
|
837
995
|
// Only use variant assembly when the script provides a real component options object.
|
|
838
996
|
const render = templateMod?.render;
|
|
@@ -878,10 +1036,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
878
1036
|
catch { }
|
|
879
1037
|
}
|
|
880
1038
|
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 { }
|
|
1039
|
+
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
1040
|
}
|
|
886
1041
|
return base;
|
|
887
1042
|
}
|
|
@@ -909,8 +1064,8 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
909
1064
|
// Synthesize a minimal component and attach named exports as local components so template resolveComponent works.
|
|
910
1065
|
try {
|
|
911
1066
|
ensureVueGlobals();
|
|
912
|
-
const comp =
|
|
913
|
-
?
|
|
1067
|
+
const comp = getGlobalScope().defineComponent
|
|
1068
|
+
? getGlobalScope().defineComponent({
|
|
914
1069
|
name: targetVuePath.split('/').pop() || 'AnonymousSFC',
|
|
915
1070
|
render,
|
|
916
1071
|
})
|
|
@@ -931,10 +1086,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
|
|
|
931
1086
|
catch { }
|
|
932
1087
|
}
|
|
933
1088
|
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 { }
|
|
1089
|
+
console.log('[hmr][vue-reset][diag] synthesized.component keys=', Object.keys(comp).join(','), 'components=', Object.keys(comp.components || {}).join(','));
|
|
938
1090
|
}
|
|
939
1091
|
return comp;
|
|
940
1092
|
}
|
|
@@ -977,7 +1129,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
977
1129
|
if (__NS_ENV_VERBOSE__)
|
|
978
1130
|
console.log('[hmr-client] [createRoot] begin');
|
|
979
1131
|
ensureVueGlobals();
|
|
980
|
-
const g =
|
|
1132
|
+
const g = getGlobalScope();
|
|
981
1133
|
const AppFactory = g.createApp;
|
|
982
1134
|
let RootCtor = g.NSVRoot;
|
|
983
1135
|
// Hygiene: unmount any existing app instance to avoid duplicate lifecycle hooks
|
|
@@ -1160,16 +1312,13 @@ export function getRootForVue(newComponent, state) {
|
|
|
1160
1312
|
const vm = typeof app.runWithContext === 'function' ? app.runWithContext(() => app.mount(root)) : app.mount(root);
|
|
1161
1313
|
setCurrentApp(app);
|
|
1162
1314
|
if (__NS_ENV_VERBOSE__) {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
catch { }
|
|
1315
|
+
console.log('[hmr-client] [createRoot] mount result', {
|
|
1316
|
+
hasEl: !!vm?.$el,
|
|
1317
|
+
elType: vm?.$el?.constructor?.name,
|
|
1318
|
+
hasNativeView: !!vm?.$el?.nativeView,
|
|
1319
|
+
nativeViewType: vm?.$el?.nativeView?.constructor?.name,
|
|
1320
|
+
elapsedMs: Date.now() - t0,
|
|
1321
|
+
});
|
|
1173
1322
|
}
|
|
1174
1323
|
const findNativeView = (element) => {
|
|
1175
1324
|
if (element?.nativeView)
|
|
@@ -1216,9 +1365,18 @@ export function getRootForVue(newComponent, state) {
|
|
|
1216
1365
|
}
|
|
1217
1366
|
return null;
|
|
1218
1367
|
};
|
|
1219
|
-
//
|
|
1220
|
-
//
|
|
1221
|
-
|
|
1368
|
+
// Resolve the top-level native view from the component output. The previous logic
|
|
1369
|
+
// preferred ANY Frame found anywhere in the tree via depth-first recursion, which
|
|
1370
|
+
// is wrong when the component root is a Page that contains nested Frames (e.g.
|
|
1371
|
+
// a TabView whose TabViewItems each wrap their content in a <Frame>). That picked
|
|
1372
|
+
// the FIRST nested Frame and set it as the app root via resetRootView, severing
|
|
1373
|
+
// it from its TabViewItem parent and leaving a white screen on HMR reload.
|
|
1374
|
+
// Only fall back to the deep Frame/Page lookups when the top-level view is neither
|
|
1375
|
+
// (e.g., a raw Layout that the user intends to host an inner Frame for navigation).
|
|
1376
|
+
const topLevelNativeView = findNativeView(vm?.$el);
|
|
1377
|
+
const topCtorName = topLevelNativeView ? String(topLevelNativeView?.constructor?.name || '').replace(/^_+/, '') : '';
|
|
1378
|
+
const topIsPageOrFrame = /^(Page|Frame)(\$\d+)?$/.test(topCtorName);
|
|
1379
|
+
const nativeView = topIsPageOrFrame ? topLevelNativeView : findFrameNativeView(vm?.$el) || findPageNativeView(vm?.$el) || topLevelNativeView;
|
|
1222
1380
|
const GPage = getCore('Page');
|
|
1223
1381
|
// Decide root type and cache it
|
|
1224
1382
|
if (nativeView) {
|
|
@@ -1243,160 +1401,6 @@ export function getRootForVue(newComponent, state) {
|
|
|
1243
1401
|
state.setCachedRoot(nativeView);
|
|
1244
1402
|
return state.getCachedRoot();
|
|
1245
1403
|
}
|
|
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
1404
|
if (GPage) {
|
|
1401
1405
|
const page = new GPage();
|
|
1402
1406
|
page.content = nativeView;
|
|
@@ -1431,7 +1435,7 @@ export function getRootForVue(newComponent, state) {
|
|
|
1431
1435
|
*/
|
|
1432
1436
|
export function ensureBackWrapperInstalled(performResetRoot, getCore) {
|
|
1433
1437
|
try {
|
|
1434
|
-
const g =
|
|
1438
|
+
const g = getGlobalScope();
|
|
1435
1439
|
// Provide global back-remount hooks for bridges to call
|
|
1436
1440
|
if (!g.__nsAttemptBackRemount) {
|
|
1437
1441
|
g.__nsAttemptBackRemount = () => {
|