@nativescript/vite 8.0.0-alpha.3 → 8.0.0-alpha.31
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/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +373 -163
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +184 -14
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +5 -72
- package/configuration/javascript.js.map +1 -1
- package/configuration/solid.js +27 -1
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +5 -75
- 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/config-as-json.js +10 -0
- package/helpers/config-as-json.js.map +1 -1
- package/helpers/dev-host.d.ts +341 -0
- package/helpers/dev-host.js +617 -0
- package/helpers/dev-host.js.map +1 -0
- package/helpers/esbuild-platform-resolver.js +4 -1
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/global-defines.d.ts +51 -0
- package/helpers/global-defines.js +77 -0
- 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.d.ts +1 -0
- package/helpers/logging.js +63 -3
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +2 -1
- package/helpers/main-entry.js +430 -47
- package/helpers/main-entry.js.map +1 -1
- package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
- package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
- package/helpers/nativeclass-transformer-plugin.js +157 -14
- package/helpers/nativeclass-transformer-plugin.js.map +1 -1
- package/helpers/nativescript-package-resolver.js +8 -3
- 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 +88 -0
- package/helpers/ns-core-url.js +191 -0
- package/helpers/ns-core-url.js.map +1 -0
- package/helpers/package-platform-aliases.js +4 -3
- 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/project.d.ts +35 -0
- package/helpers/project.js +120 -2
- package/helpers/project.js.map +1 -1
- package/helpers/resolver.js +17 -2
- package/helpers/resolver.js.map +1 -1
- package/helpers/ts-config-paths.d.ts +14 -0
- package/helpers/ts-config-paths.js +89 -8
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +2 -1
- package/helpers/typescript-check.js.map +1 -1
- package/helpers/workers.d.ts +20 -19
- package/helpers/workers.js +624 -4
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +1 -0
- package/hmr/client/css-handler.js +33 -20
- 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 +73 -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 +27 -0
- package/hmr/client/hmr-pending-overlay.js +50 -0
- package/hmr/client/hmr-pending-overlay.js.map +1 -0
- package/hmr/client/index.js +459 -164
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/utils.d.ts +6 -1
- package/hmr/client/utils.js +184 -8
- package/hmr/client/utils.js.map +1 -1
- package/hmr/entry-runtime.d.ts +2 -1
- package/hmr/entry-runtime.js +252 -65
- 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.d.ts +1 -0
- package/hmr/frameworks/angular/client/index.js +778 -20
- 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 +448 -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 +17 -11
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +336 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.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/server/strategy.js +360 -16
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/server/strategy.js +28 -14
- package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/client/index.js +30 -199
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/frameworks/vue/client/strategy.d.ts +7 -0
- package/hmr/frameworks/vue/client/strategy.js +83 -0
- package/hmr/frameworks/vue/client/strategy.js.map +1 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +82 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +133 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js +706 -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 +457 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +19 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js +14 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
- package/hmr/frameworks/vue/server/strategy.js +244 -0
- 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.js +52 -5
- 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/server/constants.js +13 -4
- package/hmr/server/constants.js.map +1 -1
- package/hmr/server/core-sanitize.d.ts +90 -7
- package/hmr/server/core-sanitize.js +211 -56
- package/hmr/server/core-sanitize.js.map +1 -1
- package/hmr/server/device-transform-helpers.d.ts +24 -0
- package/hmr/server/device-transform-helpers.js +327 -0
- package/hmr/server/device-transform-helpers.js.map +1 -0
- package/hmr/server/framework-strategy.d.ts +95 -11
- package/hmr/server/hmr-module-graph.d.ts +37 -0
- package/hmr/server/hmr-module-graph.js +214 -0
- package/hmr/server/hmr-module-graph.js.map +1 -0
- package/hmr/server/import-map.d.ts +11 -2
- package/hmr/server/import-map.js +59 -40
- 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 +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-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 +35 -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 +195 -0
- package/hmr/server/perf-instrumentation.js.map +1 -0
- package/hmr/server/process-code-for-device.d.ts +15 -0
- package/hmr/server/process-code-for-device.js +654 -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 +604 -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 +12 -0
- package/hmr/server/server-origin.js +66 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/shared-transform-request.js +12 -5
- package/hmr/server/shared-transform-request.js.map +1 -1
- package/hmr/server/transform-cache-invalidation.d.ts +11 -0
- package/hmr/server/transform-cache-invalidation.js +84 -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.js +60 -42
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +41 -6
- package/hmr/server/websocket-core-bridge.js +72 -75
- 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-graph-upsert.d.ts +15 -0
- package/hmr/server/websocket-graph-upsert.js +20 -0
- package/hmr/server/websocket-graph-upsert.js.map +1 -1
- package/hmr/server/websocket-hmr-pending.d.ts +37 -0
- package/hmr/server/websocket-hmr-pending.js +55 -0
- package/hmr/server/websocket-hmr-pending.js.map +1 -0
- package/hmr/server/websocket-hot-update.d.ts +77 -0
- package/hmr/server/websocket-hot-update.js +330 -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 +46 -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 +202 -19
- package/hmr/server/websocket-module-specifiers.js.map +1 -1
- package/hmr/server/websocket-ns-core.d.ts +21 -0
- package/hmr/server/websocket-ns-core.js +306 -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 +150 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +3 -0
- package/hmr/server/websocket-ns-m-paths.js +92 -0
- package/hmr/server/websocket-ns-m-paths.js.map +1 -0
- package/hmr/server/websocket-ns-m-request.d.ts +45 -0
- package/hmr/server/websocket-ns-m-request.js +196 -0
- package/hmr/server/websocket-ns-m-request.js.map +1 -0
- package/hmr/server/websocket-ns-m.d.ts +33 -0
- package/hmr/server/websocket-ns-m.js +748 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +39 -0
- package/hmr/server/websocket-served-module-helpers.js +654 -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 +39 -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 +8 -39
- package/hmr/server/websocket.js +602 -6049
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +118 -0
- package/hmr/shared/ns-globals.js +27 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/protocol.d.ts +136 -0
- package/hmr/shared/protocol.js +28 -0
- package/hmr/shared/protocol.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 +40 -0
- package/hmr/shared/runtime/boot-progress.js +128 -0
- package/hmr/shared/runtime/boot-progress.js.map +1 -0
- package/hmr/shared/runtime/boot-timeline.d.ts +18 -0
- package/hmr/shared/runtime/boot-timeline.js +52 -0
- package/hmr/shared/runtime/boot-timeline.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.d.ts +75 -26
- package/hmr/shared/runtime/dev-overlay.js +990 -260
- package/hmr/shared/runtime/dev-overlay.js.map +1 -1
- package/hmr/shared/runtime/module-provenance.js +1 -4
- 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 +310 -0
- package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.js +352 -194
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +164 -1
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
- 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 +512 -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 +3 -2
- 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 +102 -741
- package/hmr/shared/vendor/manifest.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 +16 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +203 -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 +55 -11
- package/runtime/core-aliases-early.js +17 -41
- package/runtime/core-aliases-early.js.map +1 -1
- 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 +0 -239
- package/hmr/server/websocket-angular-hot-update.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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { enumeratePackageExports } from '../helpers/package-exports.js';
|
|
2
|
+
// Exports the bridge replaces with HMR-routed implementations — discovery
|
|
3
|
+
// must not emit a plain passthrough for these names or the override would be
|
|
4
|
+
// shadowed and navigation would silently fall back to the vendor's native
|
|
5
|
+
// version (which doesn't know about the HMR app navigator).
|
|
6
|
+
const NSV_SHIM_OVERRIDES = new Set(['$navigateTo', '$navigateBack', '$showModal', 'vite__injectQuery']);
|
|
7
|
+
// Bridge-internal identifiers that would clash with the emitted preamble if
|
|
8
|
+
// the vendor package happens to publish a colliding name.
|
|
9
|
+
const RESERVED_BRIDGE_LOCALS = new Set(['__realm', '__cached_rt', '__cached_vm', '__ensure', '__get', 'default']);
|
|
10
|
+
const IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
11
|
+
/**
|
|
12
|
+
* Build the `/ns/rt` runtime bridge module text.
|
|
13
|
+
*
|
|
14
|
+
* Single-realm policy: every named export the vendor package publishes
|
|
15
|
+
* appears as `export const X = (__ensure().X);` — a constant binding, not a
|
|
16
|
+
* function wrapper. Constant bindings preserve identity for Vue's Symbol
|
|
17
|
+
* markers (`Fragment`, `Teleport`, …) AND work transparently for functions
|
|
18
|
+
* (`ref`, `createApp`, …) since the user code calls the underlying value
|
|
19
|
+
* directly. Calling `__ensure()` at module evaluation time is safe because
|
|
20
|
+
* the vendor bundle is registered earlier in the boot graph (vendor.mjs →
|
|
21
|
+
* `__nsVendorRegistry`), and the bridge resolves the same `nativescript-vue`
|
|
22
|
+
* record everyone else uses.
|
|
23
|
+
*
|
|
24
|
+
* HMR-specific shims (`$navigateTo`, `$navigateBack`, `$showModal`) and the
|
|
25
|
+
* Vite client polyfill (`vite__injectQuery`) are emitted as overrides that
|
|
26
|
+
* replace the would-be passthrough — those exports route through the HMR
|
|
27
|
+
* navigator instead of the vendor's native version, so the bridge must
|
|
28
|
+
* provide the override, not the discovered original.
|
|
29
|
+
*/
|
|
30
|
+
export function buildNsRtBridgeModule(options) {
|
|
31
|
+
// Sort for stable output — useful for diffing the served bridge across requests.
|
|
32
|
+
const passthrough = new Set();
|
|
33
|
+
for (const name of options.vendorExports) {
|
|
34
|
+
if (typeof name === 'string' && IDENT_RE.test(name) && !NSV_SHIM_OVERRIDES.has(name) && !RESERVED_BRIDGE_LOCALS.has(name)) {
|
|
35
|
+
passthrough.add(name);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const passthroughNames = Array.from(passthrough).sort();
|
|
39
|
+
const passthroughExports = passthroughNames.map((n) => `export const ${n} = (__ensure().${n});`).join('\n');
|
|
40
|
+
const defaultListing = passthroughNames.concat(['$navigateTo', '$navigateBack', '$showModal', 'vite__injectQuery']).join(', ');
|
|
41
|
+
const code = `// [ns-rt][v2.4] NativeScript-Vue runtime bridge (module-scoped cache, no globals)\n` +
|
|
42
|
+
`// Single-realm policy: every export is a constant binding off the vendor module's\n` +
|
|
43
|
+
`// canonical instance, so app code, plugins, and the vendor bundle itself share one\n` +
|
|
44
|
+
`// module record. The set of exports below is derived from the package's static ESM\n` +
|
|
45
|
+
`// shape (see hmr/helpers/package-exports.ts), not a hand-curated list, so any symbol\n` +
|
|
46
|
+
`// the vendor publishes flows through automatically.\n` +
|
|
47
|
+
`const __origin = ((typeof globalThis !== 'undefined' && globalThis && globalThis.__NS_HTTP_ORIGIN__) || (new URL(import.meta.url)).origin);\n` +
|
|
48
|
+
// Use the canonical, unversioned `/ns/core` URL so this dynamic import
|
|
49
|
+
// shares an iOS HTTP-ESM module record (and therefore a single class-
|
|
50
|
+
// identity realm) with vendor `require('@nativescript/core')` lookups
|
|
51
|
+
// resolved via the runtime import map, plus every app-side import that
|
|
52
|
+
// goes through the core bridge. The `rtVer` is intentionally unused.
|
|
53
|
+
`let __ns_core_bridge = null; try { import(__origin + "/ns/core").then(m => { __ns_core_bridge = m; }).catch(() => {}); } catch {}\n` +
|
|
54
|
+
`const g = globalThis;\n` +
|
|
55
|
+
`const reg = (g.__nsVendorRegistry ||= new Map());\n` +
|
|
56
|
+
`const req = reg && reg.get ? (g.__nsVendorRequire || g.__nsRequire || g.require) : (g.__nsRequire || g.require);\n` +
|
|
57
|
+
`let __cached_rt = null;\n` +
|
|
58
|
+
`let __cached_vm = null;\n` +
|
|
59
|
+
`const __RT_REALM_TAG = (globalThis.__NS_RT_REALM__ ||= Math.random().toString(36).slice(2));\n` +
|
|
60
|
+
`try { if (!(globalThis.__NS_RT_ONCE__ && globalThis.__NS_RT_ONCE__.eval)) { (globalThis.__NS_RT_ONCE__ ||= {}).eval = true; if (globalThis.__NS_ENV_VERBOSE__) console.log('[ns-rt] evaluated', { rtRealm: __RT_REALM_TAG }); } } catch {}\n` +
|
|
61
|
+
`function __ensure(){\n` +
|
|
62
|
+
` if (__cached_rt) return __cached_rt;\n` +
|
|
63
|
+
` let vm = null;\n` +
|
|
64
|
+
` try { vm = reg && reg.has && reg.has('nativescript-vue') ? reg.get('nativescript-vue') : (typeof req==='function' ? req('nativescript-vue') : null); } catch {}\n` +
|
|
65
|
+
` if (!vm) { try { vm = reg && reg.has && reg.has('vue') ? reg.get('vue') : (typeof req==='function' ? req('vue') : null); } catch {} }\n` +
|
|
66
|
+
` const rt = (vm && (vm.default ?? vm)) || {};\n` +
|
|
67
|
+
` __cached_vm = vm;\n` +
|
|
68
|
+
` __cached_rt = rt;\n` +
|
|
69
|
+
` return rt;\n` +
|
|
70
|
+
`}\n` +
|
|
71
|
+
// Soft-globals for @nativescript/core when missing (dev-only safety).
|
|
72
|
+
// This stays even with the auto-derived passthrough because Frame /
|
|
73
|
+
// Page / Application aren't `nativescript-vue` exports — they're
|
|
74
|
+
// hoisted onto `globalThis` so the navigation shims (and any legacy
|
|
75
|
+
// `global.Frame.topmost()`-style call site inside the vendor bundle)
|
|
76
|
+
// see the same identities served by `/ns/core`.
|
|
77
|
+
`try {\n` +
|
|
78
|
+
` const dev = typeof __DEV__ !== 'undefined' ? __DEV__ : true;\n` +
|
|
79
|
+
` if (dev) {\n` +
|
|
80
|
+
` const ns = (__ns_core_bridge && (__ns_core_bridge.__esModule && __ns_core_bridge.default ? __ns_core_bridge.default : (__ns_core_bridge.default || __ns_core_bridge))) || __ns_core_bridge || {};\n` +
|
|
81
|
+
` if (ns) {\n` +
|
|
82
|
+
` if (!g.Frame && ns.Frame) g.Frame = ns.Frame;\n` +
|
|
83
|
+
` if (!g.Page && ns.Page) g.Page = ns.Page;\n` +
|
|
84
|
+
` if (!g.Application && (ns.Application||ns.app||ns.application)) g.Application = (ns.Application||ns.app||ns.application);\n` +
|
|
85
|
+
` }\n` +
|
|
86
|
+
` }\n` +
|
|
87
|
+
`} catch {}\n` +
|
|
88
|
+
`export const __realm = __RT_REALM_TAG;\n` +
|
|
89
|
+
// Auto-emitted passthrough exports. Discovery-driven, sorted, dedupe'd.
|
|
90
|
+
passthroughExports +
|
|
91
|
+
`\n` +
|
|
92
|
+
// HMR-routed navigation helpers (replace the would-be passthroughs).
|
|
93
|
+
// These run through `globalThis.__nsNavigateUsingApp` etc. instead of
|
|
94
|
+
// the vendor's native navigation, so HMR can re-route navigation
|
|
95
|
+
// targets after module updates.
|
|
96
|
+
`export const $navigateTo = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); try { if (!(g && g.Frame)) { const ns = (__ns_core_bridge && (__ns_core_bridge.__esModule && __ns_core_bridge.default ? __ns_core_bridge.default : (__ns_core_bridge.default || __ns_core_bridge))) || __ns_core_bridge || {}; if (ns) { if (!g.Frame && ns.Frame) g.Frame = ns.Frame; if (!g.Page && ns.Page) g.Page = ns.Page; if (!g.Application && (ns.Application||ns.app||ns.application)) g.Application = (ns.Application||ns.app||ns.application); } } } catch {} try { const hmrRealm = (g && g.__NS_HMR_REALM__) || 'unknown'; const hasTop = !!(g && g.Frame && g.Frame.topmost && g.Frame.topmost()); const top = hasTop ? g.Frame.topmost() : null; const ctor = top && top.constructor && top.constructor.name; } catch {} if (g && typeof g.__nsNavigateUsingApp === 'function') { try { return g.__nsNavigateUsingApp(...a); } catch (e) { console.error('[ns-rt] $navigateTo app navigator error', e); throw e; } } console.error('[ns-rt] $navigateTo unavailable: app navigator missing'); throw new Error('$navigateTo unavailable: app navigator missing'); } ;\n` +
|
|
97
|
+
`export const $navigateBack = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); const impl = (vm && (vm.$navigateBack || (vm.default && vm.default.$navigateBack))) || (rt && (rt.$navigateBack || (rt.runtimeHelpers && rt.runtimeHelpers.navigateBack))); let res; try { const via = (impl && (impl === (vm && vm.$navigateBack) || impl === (vm && vm.default && vm.default.$navigateBack))) ? 'vm' : (impl ? 'rt' : 'none'); } catch {} try { if (typeof impl === 'function') res = impl(...a); } catch {} try { const top = (g && g.Frame && g.Frame.topmost && g.Frame.topmost()); if (!res && top && top.canGoBack && top.canGoBack()) { res = top.goBack(); } } catch {} try { const hook = g && (g.__NS_HMR_ON_NAVIGATE_BACK || g.__NS_HMR_ON_BACK || g.__nsAttemptBackRemount); if (typeof hook === 'function') hook(); } catch {} return res; }\n` +
|
|
98
|
+
`export const $showModal = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); const impl = (vm && (vm.$showModal || (vm.default && vm.default.$showModal))) || (rt && (rt.$showModal || (rt.runtimeHelpers && rt.runtimeHelpers.showModal))); try { if (typeof impl === 'function') return impl(...a); } catch (e) { } return undefined; }\n` +
|
|
99
|
+
// Vite client polyfill — see the comment in websocket.ts for full rationale.
|
|
100
|
+
`export const vite__injectQuery = (url, queryToInject) => {\n` +
|
|
101
|
+
` if (typeof url !== 'string') return url;\n` +
|
|
102
|
+
` if (url[0] !== '.' && url[0] !== '/') return url;\n` +
|
|
103
|
+
` const pathname = url.replace(/[?#].*$/, '');\n` +
|
|
104
|
+
` let search = '', hash = '';\n` +
|
|
105
|
+
` try { const u = new URL(url, 'http://vite.dev'); search = u.search || ''; hash = u.hash || ''; } catch {}\n` +
|
|
106
|
+
` return pathname + '?' + queryToInject + (search ? '&' + search.slice(1) : '') + (hash || '');\n` +
|
|
107
|
+
`};\n` +
|
|
108
|
+
`export default { ${defaultListing} };\n`;
|
|
109
|
+
return options.requireGuardSnippet + code;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Resolve the set of names the bridge should re-export for `nativescript-vue`
|
|
113
|
+
* given a project root. Static discovery via `enumeratePackageExports` is the
|
|
114
|
+
* only source — there is no curated fallback. If `nativescript-vue` is not
|
|
115
|
+
* resolvable from `projectRoot`, the returned set is empty and the bridge
|
|
116
|
+
* built from it will not emit passthroughs; the caller should treat that as
|
|
117
|
+
* the misconfiguration it is rather than mask it with a stale baseline.
|
|
118
|
+
*
|
|
119
|
+
* Caching lives inside `enumeratePackageExports`, so repeated calls in a dev
|
|
120
|
+
* session are effectively free.
|
|
121
|
+
*/
|
|
122
|
+
export function discoverNsvBridgeExports(projectRoot) {
|
|
123
|
+
const out = new Set();
|
|
124
|
+
const shape = enumeratePackageExports('nativescript-vue', projectRoot);
|
|
125
|
+
for (const n of shape.names) {
|
|
126
|
+
if (typeof n === 'string' && IDENT_RE.test(n))
|
|
127
|
+
out.add(n);
|
|
128
|
+
}
|
|
129
|
+
return out;
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=ns-rt-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns-rt-bridge.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-rt-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,0EAA0E;AAC1E,6EAA6E;AAC7E,0EAA0E;AAC1E,4DAA4D;AAC5D,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,mBAAmB,CAAC,CAAC,CAAC;AAE7H,4EAA4E;AAC5E,0DAA0D;AAC1D,MAAM,sBAAsB,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;AAEvI,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAsB9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA0B;IAC/D,iFAAiF;IACjF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IACtC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,IA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0CAA0C;QAC1C,wEAAwE;QACxE,kBAAkB;QAClB,IAAI;QACJ,qEAAqE;QACrE,sEAAsE;QACtE,iEAAiE;QACjE,gCAAgC;QAChC,kpCAAkpC;QAClpC,02BAA02B;QAC12B,yXAAyX;QACzX,6EAA6E;QAC7E,8DAA8D;QAC9D,8CAA8C;QAC9C,uDAAuD;QACvD,kDAAkD;QAClD,iCAAiC;QACjC,+GAA+G;QAC/G,mGAAmG;QACnG,MAAM;QACN,oBAAoB,cAAc,OAAO,CAAC;IAE3C,OAAO,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CAAC,WAAmB;IAC3D,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,MAAM,KAAK,GAAG,uBAAuB,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IACvE,KAAK,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3D,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getProjectRootPath } from '../../helpers/project.js';
|
|
2
|
+
import { buildNsRtBridgeModule, discoverNsvBridgeExports } from './ns-rt-bridge.js';
|
|
3
|
+
import { REQUIRE_GUARD_SNIPPET } from './require-guard.js';
|
|
4
|
+
import { setDeviceModuleHeaders } from './route-helpers.js';
|
|
5
|
+
// ESM runtime bridge for NativeScript-Vue: `GET /ns/rt[/<ver>]`.
|
|
6
|
+
//
|
|
7
|
+
// Serves a single authoritative source of Vue helpers bound to the
|
|
8
|
+
// NativeScript renderer. The bridge lazily resolves helpers from the vendor
|
|
9
|
+
// registry on first evaluation (it does not statically import `vue`), then
|
|
10
|
+
// re-exports them so SFCs can call them during module evaluation. The shared
|
|
11
|
+
// `buildNsRtBridgeModule` owns the body (preamble, passthroughs, HMR shims,
|
|
12
|
+
// polyfills, default export); discovery is the only source of truth for which
|
|
13
|
+
// vendor symbols are forwarded.
|
|
14
|
+
export function registerNsRtBridgeRoute(server, options) {
|
|
15
|
+
server.middlewares.use(async (req, res, next) => {
|
|
16
|
+
try {
|
|
17
|
+
const urlObj = new URL(req.url || '', 'http://localhost');
|
|
18
|
+
// Accept only /ns/rt and /ns/rt/<ver> for cache-busting semantics
|
|
19
|
+
if (!(urlObj.pathname === '/ns/rt' || /^\/ns\/rt\/[\d]+$/.test(urlObj.pathname)))
|
|
20
|
+
return next();
|
|
21
|
+
setDeviceModuleHeaders(res);
|
|
22
|
+
const rtVerSeg = urlObj.pathname.replace(/^\/ns\/rt\/?/, '');
|
|
23
|
+
const rtVer = /^[0-9]+$/.test(rtVerSeg) ? rtVerSeg : String(options.getGraphVersion() || 0);
|
|
24
|
+
const vendorExports = discoverNsvBridgeExports(getProjectRootPath());
|
|
25
|
+
const code = buildNsRtBridgeModule({ rtVer, requireGuardSnippet: REQUIRE_GUARD_SNIPPET, vendorExports });
|
|
26
|
+
res.statusCode = 200;
|
|
27
|
+
res.end(code);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
res.statusCode = 500;
|
|
31
|
+
res.end('export {}\n');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ns-rt-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns-rt-route.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-rt-route.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,M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AC;YACR,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;YACrB,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QACxB,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export type ServerStartupBannerInput = {
|
|
2
|
+
version: string;
|
|
3
|
+
transformConcurrency: number;
|
|
4
|
+
transformCacheMs: number;
|
|
5
|
+
lazyInitialGraph: boolean;
|
|
6
|
+
graphVersion: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function formatServerStartupBanner(input: ServerStartupBannerInput): string;
|
|
9
|
+
/**
|
|
10
|
+
* Classify a URL path into a coarse route category. Any pathname that
|
|
11
|
+
* doesn't match a known NativeScript dev route is reported as `other`;
|
|
12
|
+
* callers are expected to filter their own irrelevant routes before
|
|
13
|
+
* calling `record()`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function classifyBootRoute(pathname: string): BootRouteCategory;
|
|
16
|
+
export type BootRouteCategory = 'ns/m' | 'ns/rt' | 'ns/core' | 'ns/vendor' | 'ns/import-map' | 'ns/boot' | 'ns/hmr' | 'ns/other' | 'other';
|
|
17
|
+
export type ColdBootRequestCounter = {
|
|
18
|
+
record: (url: string) => RecordHandle;
|
|
19
|
+
finalize: () => void;
|
|
20
|
+
getState: () => ColdBootCounterState;
|
|
21
|
+
};
|
|
22
|
+
export type RecordHandle = {
|
|
23
|
+
finish: () => void;
|
|
24
|
+
};
|
|
25
|
+
export type ColdBootCounterState = {
|
|
26
|
+
active: boolean;
|
|
27
|
+
count: number;
|
|
28
|
+
inFlight: number;
|
|
29
|
+
maxConcurrent: number;
|
|
30
|
+
startedAt: number | null;
|
|
31
|
+
firstRequestUrl: string | null;
|
|
32
|
+
perRoute: Partial<Record<BootRouteCategory, number>>;
|
|
33
|
+
};
|
|
34
|
+
export type ColdBootCounterOptions = {
|
|
35
|
+
/**
|
|
36
|
+
* Emit a rolling summary every N requests (default 100). Lower the
|
|
37
|
+
* threshold in tests to keep them snappy. Set to 0 to disable rolling
|
|
38
|
+
* summaries; a final summary still fires from `finalize()`.
|
|
39
|
+
*/
|
|
40
|
+
summaryEvery?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Cold-boot window closes when no new requests arrive within this
|
|
43
|
+
* idle window (default 5000ms). The HMR edit loop reuses the same
|
|
44
|
+
* handler, but it never bursts as heavily as cold boot. Raise this
|
|
45
|
+
* via `NS_VITE_HMR_BOOT_TRACE_IDLE_MS` when profiling a slow boot
|
|
46
|
+
* so inter-wave pauses don't close the counter prematurely.
|
|
47
|
+
*/
|
|
48
|
+
idleWindowMs?: number;
|
|
49
|
+
/** Defaults to `Date.now`; tests inject a deterministic clock. */
|
|
50
|
+
now?: () => number;
|
|
51
|
+
/** Defaults to `setTimeout`; tests can inject a fake timer. */
|
|
52
|
+
setTimer?: (handler: () => void, ms: number) => unknown;
|
|
53
|
+
/** Defaults to `clearTimeout`; tests can inject a fake timer. */
|
|
54
|
+
clearTimer?: (handle: unknown) => void;
|
|
55
|
+
/** Logger called for every summary line (rolling + final). */
|
|
56
|
+
log: (line: string) => void;
|
|
57
|
+
};
|
|
58
|
+
export declare function createColdBootRequestCounter(options: ColdBootCounterOptions): ColdBootRequestCounter;
|
|
59
|
+
export type PopulateInitialGraphSummary = {
|
|
60
|
+
moduleCount: number;
|
|
61
|
+
durationMs: number;
|
|
62
|
+
graphVersion: number;
|
|
63
|
+
bumpedVersion: boolean;
|
|
64
|
+
};
|
|
65
|
+
export declare function formatPopulateInitialGraphSummary(input: PopulateInitialGraphSummary): string;
|
|
66
|
+
export type HmrUpdateKind = 'ts' | 'html' | 'css' | 'vue' | 'tsx' | 'jsx' | 'js' | 'mjs' | 'unknown';
|
|
67
|
+
/**
|
|
68
|
+
* Classify a file's HMR update kind by extension. Used by the server-side
|
|
69
|
+
* update summary so a quick log line tells us which pipeline ran. Returns
|
|
70
|
+
* `'unknown'` for anything that doesn't match a known dev-time extension —
|
|
71
|
+
* the caller decides whether to log it or skip it entirely.
|
|
72
|
+
*/
|
|
73
|
+
export declare function classifyHmrUpdateKind(file: string): HmrUpdateKind;
|
|
74
|
+
export type HmrUpdateSummary = {
|
|
75
|
+
/** Project-relative or absolute path of the file that triggered HMR. */
|
|
76
|
+
file: string;
|
|
77
|
+
/** File classification. */
|
|
78
|
+
kind: HmrUpdateKind;
|
|
79
|
+
/** Time spent waiting for `populateInitialGraph` to complete (ms). */
|
|
80
|
+
awaitMs: number;
|
|
81
|
+
/** Time spent in framework-specific work (graph updates, invalidation). */
|
|
82
|
+
frameworkMs: number;
|
|
83
|
+
/** Time spent broadcasting the WebSocket message. */
|
|
84
|
+
broadcastMs: number;
|
|
85
|
+
/** End-to-end handler time. */
|
|
86
|
+
totalMs: number;
|
|
87
|
+
/** Number of modules invalidated by the update. */
|
|
88
|
+
invalidated: number;
|
|
89
|
+
/** Number of HMR clients the message was sent to. */
|
|
90
|
+
recipients: number;
|
|
91
|
+
/**
|
|
92
|
+
* Angular-only narrowing decision: whether transitive-importer
|
|
93
|
+
* invalidation was narrowed because the changed file lacks Angular
|
|
94
|
+
* semantic decorators (`@Component`/`@Directive`/`@Pipe`/`@Injectable`/
|
|
95
|
+
* `@NgModule`). `true` means narrow (importers preserved, ESM live
|
|
96
|
+
* bindings carry the change). `false` means broad (importers also
|
|
97
|
+
* invalidated). `null`/`undefined` means the field is not applicable
|
|
98
|
+
* to this update (e.g. CSS, non-Angular flavor) and the field is
|
|
99
|
+
* omitted from the summary line entirely.
|
|
100
|
+
*/
|
|
101
|
+
narrowed?: boolean | null;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Single-line summary for the server side of an HMR update. Always-on so
|
|
105
|
+
* a 6-second `.ts` save is immediately visible without flipping verbose.
|
|
106
|
+
* Format:
|
|
107
|
+
* [hmr-ws][update] kind=ts file=/src/foo.ts await=12ms framework=180ms broadcast=2ms total=194ms invalidated=23 recipients=1
|
|
108
|
+
*
|
|
109
|
+
* For Angular `.ts` updates, `narrowed=yes|no` is appended so the
|
|
110
|
+
* narrowing decision is immediately visible without flipping verbose:
|
|
111
|
+
* [hmr-ws][update] kind=ts file=/src/app/foo.constants.ts ... invalidated=1 recipients=1 narrowed=yes
|
|
112
|
+
* [hmr-ws][update] kind=ts file=/src/app/foo.component.ts ... invalidated=132 recipients=1 narrowed=no
|
|
113
|
+
*/
|
|
114
|
+
export declare function formatHmrUpdateSummary(input: HmrUpdateSummary): string;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Server-side perf instrumentation helpers.
|
|
2
|
+
//
|
|
3
|
+
// All exports are pure so they can be unit-tested without spinning up
|
|
4
|
+
// Vite. The websocket middleware wires them in with its own logger.
|
|
5
|
+
//
|
|
6
|
+
// The three primitives are:
|
|
7
|
+
// 1. `formatServerStartupBanner` — the always-on banner that prints
|
|
8
|
+
// on dev server startup so the user can confirm which build is
|
|
9
|
+
// live and which perf knobs are active.
|
|
10
|
+
// 2. `createColdBootRequestCounter` — a richer counter that tracks
|
|
11
|
+
// the first burst of NativeScript dev routes (`/ns/m/**`, `/ns/rt/**`,
|
|
12
|
+
// `/ns/core/**`, `/__ns_boot__/**`, `/ns/import-map.json`,
|
|
13
|
+
// `/@nativescript/vendor.mjs`). Emits a rolling + final summary so
|
|
14
|
+
// cold-boot traffic is visible without flipping verbose mode.
|
|
15
|
+
// 3. `formatPopulateInitialGraphSummary` — the single line we print
|
|
16
|
+
// when `populateInitialGraph` finishes. Includes module count and
|
|
17
|
+
// duration so it's trivial to spot regressions.
|
|
18
|
+
// Single-line, human-scannable banner. We avoid pretty-printing (no
|
|
19
|
+
// boxes/colors) so it plays well with piped logs and the Vite custom
|
|
20
|
+
// logger. Format:
|
|
21
|
+
// [hmr-ws] @nativescript/vite@<version> — transformConcurrency=8 transformCacheMs=60000ms lazyInitialGraph=on graphVersion=1
|
|
22
|
+
export function formatServerStartupBanner(input) {
|
|
23
|
+
const parts = [`transformConcurrency=${Math.max(1, Math.floor(input.transformConcurrency))}`, `transformCacheMs=${Math.max(0, Math.floor(input.transformCacheMs))}ms`, `lazyInitialGraph=${input.lazyInitialGraph ? 'on' : 'off'}`, `graphVersion=${Math.max(0, Math.floor(input.graphVersion))}`];
|
|
24
|
+
return `[hmr-ws] @nativescript/vite@${input.version} — ${parts.join(' ')}`;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Classify a URL path into a coarse route category. Any pathname that
|
|
28
|
+
* doesn't match a known NativeScript dev route is reported as `other`;
|
|
29
|
+
* callers are expected to filter their own irrelevant routes before
|
|
30
|
+
* calling `record()`.
|
|
31
|
+
*/
|
|
32
|
+
export function classifyBootRoute(pathname) {
|
|
33
|
+
if (!pathname || typeof pathname !== 'string')
|
|
34
|
+
return 'other';
|
|
35
|
+
if (pathname === '/ns/import-map.json')
|
|
36
|
+
return 'ns/import-map';
|
|
37
|
+
if (pathname === '/@nativescript/vendor.mjs' || pathname.startsWith('/@nativescript/'))
|
|
38
|
+
return 'ns/vendor';
|
|
39
|
+
if (pathname.startsWith('/ns/m/'))
|
|
40
|
+
return 'ns/m';
|
|
41
|
+
if (pathname.startsWith('/ns/rt/'))
|
|
42
|
+
return 'ns/rt';
|
|
43
|
+
if (pathname.startsWith('/ns/core/'))
|
|
44
|
+
return 'ns/core';
|
|
45
|
+
if (pathname.startsWith('/__ns_boot__/'))
|
|
46
|
+
return 'ns/boot';
|
|
47
|
+
if (pathname.startsWith('/__ns_hmr__/'))
|
|
48
|
+
return 'ns/hmr';
|
|
49
|
+
if (pathname.startsWith('/ns/'))
|
|
50
|
+
return 'ns/other';
|
|
51
|
+
return 'other';
|
|
52
|
+
}
|
|
53
|
+
// Factory for the cold-boot counter. Encapsulates all state in a closure
|
|
54
|
+
// so the websocket module doesn't have to track timers itself, and so
|
|
55
|
+
// this is trivially testable with a fake clock.
|
|
56
|
+
export function createColdBootRequestCounter(options) {
|
|
57
|
+
const summaryEvery = Math.max(0, Math.floor(options.summaryEvery ?? 100));
|
|
58
|
+
const idleWindowMs = Math.max(100, Math.floor(options.idleWindowMs ?? 5000));
|
|
59
|
+
const now = options.now ?? (() => Date.now());
|
|
60
|
+
const setTimer = options.setTimer ?? ((handler, ms) => setTimeout(handler, ms));
|
|
61
|
+
const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
62
|
+
let active = true;
|
|
63
|
+
let count = 0;
|
|
64
|
+
let inFlight = 0;
|
|
65
|
+
let maxConcurrent = 0;
|
|
66
|
+
let startedAt = null;
|
|
67
|
+
let firstRequestUrl = null;
|
|
68
|
+
let idleTimer = null;
|
|
69
|
+
const perRoute = {};
|
|
70
|
+
const formatPerRoute = () => {
|
|
71
|
+
const entries = Object.entries(perRoute);
|
|
72
|
+
if (entries.length === 0)
|
|
73
|
+
return '';
|
|
74
|
+
entries.sort((a, b) => b[1] - a[1]);
|
|
75
|
+
return entries.map(([k, v]) => `${k}=${v}`).join(',');
|
|
76
|
+
};
|
|
77
|
+
const fireFinal = () => {
|
|
78
|
+
if (!active)
|
|
79
|
+
return;
|
|
80
|
+
active = false;
|
|
81
|
+
// `startedAt` is set the first time `record()` fires. Use an explicit
|
|
82
|
+
// null check — `startedAt` can be 0 on deterministic test clocks and
|
|
83
|
+
// `startedAt ? ... : 0` would mis-treat that as "never started".
|
|
84
|
+
const ms = startedAt !== null ? now() - startedAt : 0;
|
|
85
|
+
const routes = formatPerRoute();
|
|
86
|
+
const routesPart = routes ? ` routes=${routes}` : '';
|
|
87
|
+
options.log(`[hmr-ws][cold-boot] window closed modules=${count} ms=${ms} maxConcurrent=${maxConcurrent}${routesPart}`);
|
|
88
|
+
};
|
|
89
|
+
const scheduleIdleClose = () => {
|
|
90
|
+
if (idleTimer !== null)
|
|
91
|
+
clearTimer(idleTimer);
|
|
92
|
+
idleTimer = setTimer(() => {
|
|
93
|
+
idleTimer = null;
|
|
94
|
+
fireFinal();
|
|
95
|
+
}, idleWindowMs);
|
|
96
|
+
};
|
|
97
|
+
return {
|
|
98
|
+
record(url) {
|
|
99
|
+
if (!active) {
|
|
100
|
+
return { finish: () => { } };
|
|
101
|
+
}
|
|
102
|
+
count += 1;
|
|
103
|
+
inFlight += 1;
|
|
104
|
+
if (inFlight > maxConcurrent)
|
|
105
|
+
maxConcurrent = inFlight;
|
|
106
|
+
if (startedAt === null) {
|
|
107
|
+
startedAt = now();
|
|
108
|
+
firstRequestUrl = url;
|
|
109
|
+
}
|
|
110
|
+
const route = classifyBootRoute(url);
|
|
111
|
+
perRoute[route] = (perRoute[route] ?? 0) + 1;
|
|
112
|
+
if (summaryEvery > 0 && count % summaryEvery === 0) {
|
|
113
|
+
// Same `startedAt === 0` consideration as in fireFinal().
|
|
114
|
+
const ms = startedAt !== null ? now() - startedAt : 0;
|
|
115
|
+
options.log(`[hmr-ws][cold-boot] progress modules=${count} ms=${ms} inFlight=${inFlight} maxConcurrent=${maxConcurrent}`);
|
|
116
|
+
}
|
|
117
|
+
scheduleIdleClose();
|
|
118
|
+
let finished = false;
|
|
119
|
+
return {
|
|
120
|
+
finish() {
|
|
121
|
+
if (finished)
|
|
122
|
+
return;
|
|
123
|
+
finished = true;
|
|
124
|
+
if (inFlight > 0)
|
|
125
|
+
inFlight -= 1;
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
finalize() {
|
|
130
|
+
if (idleTimer !== null) {
|
|
131
|
+
clearTimer(idleTimer);
|
|
132
|
+
idleTimer = null;
|
|
133
|
+
}
|
|
134
|
+
fireFinal();
|
|
135
|
+
},
|
|
136
|
+
getState() {
|
|
137
|
+
return { active, count, inFlight, maxConcurrent, startedAt, firstRequestUrl, perRoute: { ...perRoute } };
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// Summary line for `populateInitialGraph`. Stable shape so CI greps or
|
|
142
|
+
// external dashboards can pick it up without fragile regexes.
|
|
143
|
+
export function formatPopulateInitialGraphSummary(input) {
|
|
144
|
+
return `[hmr-ws][populate] modules=${Math.max(0, Math.floor(input.moduleCount))} ms=${Math.max(0, Math.floor(input.durationMs))} graphVersion=${Math.max(0, Math.floor(input.graphVersion))} bumpedVersion=${input.bumpedVersion ? 'yes' : 'no'}`;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Classify a file's HMR update kind by extension. Used by the server-side
|
|
148
|
+
* update summary so a quick log line tells us which pipeline ran. Returns
|
|
149
|
+
* `'unknown'` for anything that doesn't match a known dev-time extension —
|
|
150
|
+
* the caller decides whether to log it or skip it entirely.
|
|
151
|
+
*/
|
|
152
|
+
export function classifyHmrUpdateKind(file) {
|
|
153
|
+
if (!file || typeof file !== 'string')
|
|
154
|
+
return 'unknown';
|
|
155
|
+
const lower = file.toLowerCase();
|
|
156
|
+
if (lower.endsWith('.ts'))
|
|
157
|
+
return 'ts';
|
|
158
|
+
if (lower.endsWith('.tsx'))
|
|
159
|
+
return 'tsx';
|
|
160
|
+
if (lower.endsWith('.jsx'))
|
|
161
|
+
return 'jsx';
|
|
162
|
+
if (lower.endsWith('.html') || lower.endsWith('.htm'))
|
|
163
|
+
return 'html';
|
|
164
|
+
if (lower.endsWith('.css') || lower.endsWith('.scss') || lower.endsWith('.sass') || lower.endsWith('.less'))
|
|
165
|
+
return 'css';
|
|
166
|
+
if (lower.endsWith('.vue'))
|
|
167
|
+
return 'vue';
|
|
168
|
+
if (lower.endsWith('.mjs'))
|
|
169
|
+
return 'mjs';
|
|
170
|
+
if (lower.endsWith('.js'))
|
|
171
|
+
return 'js';
|
|
172
|
+
return 'unknown';
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Single-line summary for the server side of an HMR update. Always-on so
|
|
176
|
+
* a 6-second `.ts` save is immediately visible without flipping verbose.
|
|
177
|
+
* Format:
|
|
178
|
+
* [hmr-ws][update] kind=ts file=/src/foo.ts await=12ms framework=180ms broadcast=2ms total=194ms invalidated=23 recipients=1
|
|
179
|
+
*
|
|
180
|
+
* For Angular `.ts` updates, `narrowed=yes|no` is appended so the
|
|
181
|
+
* narrowing decision is immediately visible without flipping verbose:
|
|
182
|
+
* [hmr-ws][update] kind=ts file=/src/app/foo.constants.ts ... invalidated=1 recipients=1 narrowed=yes
|
|
183
|
+
* [hmr-ws][update] kind=ts file=/src/app/foo.component.ts ... invalidated=132 recipients=1 narrowed=no
|
|
184
|
+
*/
|
|
185
|
+
export function formatHmrUpdateSummary(input) {
|
|
186
|
+
const parts = [`kind=${input.kind || 'unknown'}`, `file=${input.file || '<unknown>'}`, `await=${Math.max(0, Math.floor(input.awaitMs))}ms`, `framework=${Math.max(0, Math.floor(input.frameworkMs))}ms`, `broadcast=${Math.max(0, Math.floor(input.broadcastMs))}ms`, `total=${Math.max(0, Math.floor(input.totalMs))}ms`, `invalidated=${Math.max(0, Math.floor(input.invalidated))}`, `recipients=${Math.max(0, Math.floor(input.recipients))}`];
|
|
187
|
+
if (input.narrowed === true) {
|
|
188
|
+
parts.push('narrowed=yes');
|
|
189
|
+
}
|
|
190
|
+
else if (input.narrowed === false) {
|
|
191
|
+
parts.push('narrowed=no');
|
|
192
|
+
}
|
|
193
|
+
return `[hmr-ws][update] ${parts.join(' ')}`;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=perf-instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf-instrumentation.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/perf-instrumentation.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,EAAE;AACF,4BAA4B;AAC5B,sEAAsE;AACtE,oEAAoE;AACpE,6CAA6C;AAC7C,qEAAqE;AACrE,4EAA4E;AAC5E,gEAAgE;AAChE,wEAAwE;AACxE,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,qDAAqD;AAUrD,oEAAoE;AACpE,qEAAqE;AACrE,kBAAkB;AAClB,+HAA+H;AAC/H,MAAM,UAAU,yBAAyB,CAAC,KAA+B;IACxE,MA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AAU,CAAC,CAAC,EAAE,CAAC,CAAC;IACnb,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5B,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QACrC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,oBAAoB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FrameworkServerStrategy } from './framework-strategy.js';
|
|
2
|
+
interface ProcessCodeForDeviceOptions {
|
|
3
|
+
resolvedSpecifierOverrides?: Map<string, string>;
|
|
4
|
+
}
|
|
5
|
+
declare const processSfcCode: (code: string) => string;
|
|
6
|
+
declare function collectImportDependencies(code: string, importerPath: string): Set<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Clean code: remove Vite/Vue noise, rewrite to vendor
|
|
9
|
+
*/
|
|
10
|
+
declare function cleanCode(code: string, strategy: FrameworkServerStrategy): string;
|
|
11
|
+
/**
|
|
12
|
+
* Process code for device: inject globals, remove framework imports
|
|
13
|
+
*/
|
|
14
|
+
declare function processCodeForDevice(code: string, isVitePreBundled: boolean, preserveVendorImports?: boolean, isNodeModule?: boolean, sourceId?: string, options?: ProcessCodeForDeviceOptions): string;
|
|
15
|
+
export { processCodeForDevice, cleanCode, collectImportDependencies, processSfcCode };
|