@nativescript/vite 8.0.0-alpha.6 → 8.0.0-alpha.60
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 +376 -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 +4 -2
- 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 +149 -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.map +1 -1
- package/helpers/nativeclass-transform.js +5 -6
- 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 +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 +20 -19
- package/helpers/workers.js +624 -4
- 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 +271 -69
- 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 +984 -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 +630 -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 +824 -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 +255 -50
- 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 +125 -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 +38 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +296 -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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ViteDevServer } from 'vite';
|
|
2
|
+
export interface BootClosureGraphSource {
|
|
3
|
+
/** Normalized project-relative graph module ids (e.g. `/src/app.ts`). */
|
|
4
|
+
getGraphModuleIds(): string[];
|
|
5
|
+
/** Kick off (or join) the background initial graph population. */
|
|
6
|
+
ensureInitialGraphPopulationStarted(server: ViteDevServer): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Prefetchable request paths recorded from the most recent completed boot
|
|
9
|
+
* (or a persisted recording from a prior session). When present the
|
|
10
|
+
* closure is built from this list instead of the src-tree graph walk —
|
|
11
|
+
* the recording covers `/ns/m/node_modules/...` bodies the graph walk
|
|
12
|
+
* cannot see, which are otherwise fetched serially inside V8's
|
|
13
|
+
* synchronous module walk. See boot-recording.ts.
|
|
14
|
+
*/
|
|
15
|
+
getRecordedBootPaths?(): string[] | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Where the closure body list comes from: a prior boot's recording (the exact
|
|
19
|
+
* request set of a real boot, in V8 walk order — covers node_modules bodies
|
|
20
|
+
* the graph walk cannot see and avoids over-fetching lazily-routed src
|
|
21
|
+
* modules), or the walked graph module ids.
|
|
22
|
+
*/
|
|
23
|
+
export type BootClosureSource = {
|
|
24
|
+
kind: 'recorded';
|
|
25
|
+
paths: readonly string[];
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'graph';
|
|
28
|
+
moduleIds: readonly string[];
|
|
29
|
+
};
|
|
30
|
+
export declare function buildBootClosureUrls(options: {
|
|
31
|
+
origin: string;
|
|
32
|
+
entryPathname: string;
|
|
33
|
+
source: BootClosureSource;
|
|
34
|
+
includeCoreBundle?: boolean;
|
|
35
|
+
includeDepsBundle?: boolean;
|
|
36
|
+
}): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Shared closure resolution for the boot-closure and boot-archive routes:
|
|
39
|
+
* prefer a recorded boot; otherwise wait (bounded) for the background graph
|
|
40
|
+
* walk and expand graph ids. Returns the absolute URL list plus which source
|
|
41
|
+
* produced it (surfaced in the JSON payload for diagnostics).
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolveBootClosureUrls(server: ViteDevServer, source: BootClosureGraphSource, maxWaitMs: number): Promise<{
|
|
44
|
+
urls: string[];
|
|
45
|
+
source: BootClosureSource['kind'];
|
|
46
|
+
}>;
|
|
47
|
+
export declare function registerBootClosureRoute(server: ViteDevServer, source: BootClosureGraphSource, options?: {
|
|
48
|
+
maxWaitMs?: number;
|
|
49
|
+
}): void;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { resolveProjectMainEntryPath } from './vite-plugin.js';
|
|
2
|
+
import { CORE_BUNDLE_PATH, isCorePerModuleServingEnabled } from './core-bundle.js';
|
|
3
|
+
import { DEPS_BUNDLE_PATH, getSharedDepsBundleService } from './deps-bundle.js';
|
|
4
|
+
import { getServerOrigin } from './server-origin.js';
|
|
5
|
+
// `/__ns_dev__/boot-closure` — the server-computed cold-boot module closure.
|
|
6
|
+
//
|
|
7
|
+
// The device bootstrap (`session-bootstrap.ts`) fetches this list and hands
|
|
8
|
+
// it to `__NS_DEV__.kickstartPrefetch(urls)` so the runtime can pre-fill its HTTP
|
|
9
|
+
// body cache in ONE parallel wave before V8's synchronous
|
|
10
|
+
// `ResolveModuleCallback` walks the entry graph. The server owns the module
|
|
11
|
+
// graph, so closure computation lives here — the runtime performs no import
|
|
12
|
+
// scanning of its own; it fetches exactly this list.
|
|
13
|
+
//
|
|
14
|
+
// Watchdog note: the response must come back fast even on a cold Vite
|
|
15
|
+
// process. `populateInitialGraph` starts at `configureServer` time (see
|
|
16
|
+
// websocket.ts) and we only wait for it up to `maxWaitMs`; a PARTIAL list is
|
|
17
|
+
// fine — the kickstart tolerates partial pre-fill and V8 falls back to
|
|
18
|
+
// per-module fetches for anything missing.
|
|
19
|
+
const SCRIPT_EXT_RE = /\.(ts|tsx|js|jsx|mjs|mts|cts)$/i;
|
|
20
|
+
// Pure helper (unit-testable): closure source → ordered, deduped absolute URL
|
|
21
|
+
// list. The entry goes first so the deepest chain starts fetching immediately;
|
|
22
|
+
// the /ns/rt and /ns/core bridges ride along since every app module imports
|
|
23
|
+
// them. In core-bundle mode the single-eval `/ns/core-bundle.mjs` payload is
|
|
24
|
+
// the biggest body in the boot closure, so it goes right after the entry —
|
|
25
|
+
// the kickstart prewarm then downloads it in parallel with everything else
|
|
26
|
+
// instead of V8 discovering it mid-walk through the /ns/core shim.
|
|
27
|
+
export function buildBootClosureUrls(options) {
|
|
28
|
+
const origin = options.origin.replace(/\/$/, '');
|
|
29
|
+
const urls = [];
|
|
30
|
+
const seen = new Set();
|
|
31
|
+
const add = (url) => {
|
|
32
|
+
if (!seen.has(url)) {
|
|
33
|
+
seen.add(url);
|
|
34
|
+
urls.push(url);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const entryPath = options.entryPathname.startsWith('/') ? options.entryPathname : `/${options.entryPathname}`;
|
|
38
|
+
add(`${origin}/ns/m${entryPath.replace(SCRIPT_EXT_RE, '')}`);
|
|
39
|
+
if (options.includeCoreBundle) {
|
|
40
|
+
add(`${origin}${CORE_BUNDLE_PATH}`);
|
|
41
|
+
}
|
|
42
|
+
if (options.includeDepsBundle) {
|
|
43
|
+
add(`${origin}${DEPS_BUNDLE_PATH}`);
|
|
44
|
+
}
|
|
45
|
+
add(`${origin}/ns/rt`);
|
|
46
|
+
add(`${origin}/ns/core`);
|
|
47
|
+
const source = options.source;
|
|
48
|
+
switch (source.kind) {
|
|
49
|
+
case 'recorded':
|
|
50
|
+
for (const p of source.paths) {
|
|
51
|
+
if (typeof p !== 'string' || !p.startsWith('/'))
|
|
52
|
+
continue;
|
|
53
|
+
add(`${origin}${p}`);
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
case 'graph':
|
|
57
|
+
for (const id of source.moduleIds) {
|
|
58
|
+
if (typeof id !== 'string' || !id.startsWith('/'))
|
|
59
|
+
continue;
|
|
60
|
+
// Vue SFCs and other non-script assets are served through their
|
|
61
|
+
// own routes with their own identity; the /ns/m closure is
|
|
62
|
+
// script-only.
|
|
63
|
+
if (!SCRIPT_EXT_RE.test(id))
|
|
64
|
+
continue;
|
|
65
|
+
add(`${origin}/ns/m${id.replace(SCRIPT_EXT_RE, '')}`);
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
default: {
|
|
69
|
+
const exhaustive = source;
|
|
70
|
+
throw new Error(`Unhandled boot closure source: ${JSON.stringify(exhaustive)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return urls;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Shared closure resolution for the boot-closure and boot-archive routes:
|
|
77
|
+
* prefer a recorded boot; otherwise wait (bounded) for the background graph
|
|
78
|
+
* walk and expand graph ids. Returns the absolute URL list plus which source
|
|
79
|
+
* produced it (surfaced in the JSON payload for diagnostics).
|
|
80
|
+
*/
|
|
81
|
+
export async function resolveBootClosureUrls(server, source, maxWaitMs) {
|
|
82
|
+
const recordedPaths = source.getRecordedBootPaths?.() ?? null;
|
|
83
|
+
let closureSource;
|
|
84
|
+
if (recordedPaths?.length) {
|
|
85
|
+
// A recorded closure needs no graph, so it skips the wait entirely
|
|
86
|
+
// (fast restarts).
|
|
87
|
+
closureSource = { kind: 'recorded', paths: recordedPaths };
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// Wait for the background graph walk, but never past the budget —
|
|
91
|
+
// partial closures are acceptable by contract.
|
|
92
|
+
await Promise.race([source.ensureInitialGraphPopulationStarted(server), new Promise((resolve) => setTimeout(resolve, maxWaitMs))]);
|
|
93
|
+
closureSource = { kind: 'graph', moduleIds: source.getGraphModuleIds() };
|
|
94
|
+
}
|
|
95
|
+
const origin = getServerOrigin(server);
|
|
96
|
+
const projectRoot = server.config?.root || process.cwd();
|
|
97
|
+
const urls = buildBootClosureUrls({
|
|
98
|
+
origin,
|
|
99
|
+
entryPathname: resolveProjectMainEntryPath(projectRoot),
|
|
100
|
+
source: closureSource,
|
|
101
|
+
// If the bundle build later fails, the kickstart prefetch of this
|
|
102
|
+
// URL just gets a 503 body — prewarm tolerates failures, and the
|
|
103
|
+
// /ns/core shims never reference the bundle in that case.
|
|
104
|
+
includeCoreBundle: !isCorePerModuleServingEnabled(),
|
|
105
|
+
// The deps bundle is only listed once BUILT (the build is awaited at
|
|
106
|
+
// server start), so every boot is all-shims or all-per-module — a
|
|
107
|
+
// mid-boot flip would evaluate bundled modules twice.
|
|
108
|
+
includeDepsBundle: !!getSharedDepsBundleService(server)?.getState(),
|
|
109
|
+
});
|
|
110
|
+
return { urls, source: closureSource.kind };
|
|
111
|
+
}
|
|
112
|
+
export function registerBootClosureRoute(server, source, options) {
|
|
113
|
+
const maxWaitMs = options?.maxWaitMs ?? 3000;
|
|
114
|
+
server.middlewares.use(async (req, res, next) => {
|
|
115
|
+
try {
|
|
116
|
+
const url = new URL(req.url || '', 'http://localhost');
|
|
117
|
+
if (url.pathname !== '/__ns_dev__/boot-closure')
|
|
118
|
+
return next();
|
|
119
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
120
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
|
|
121
|
+
if (req.method === 'OPTIONS') {
|
|
122
|
+
res.statusCode = 204;
|
|
123
|
+
res.end();
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
// Origin comes from the single trusted resolver inside
|
|
127
|
+
// `resolveBootClosureUrls` — never the client-supplied `Host` header
|
|
128
|
+
// (see the import-map route and CLAUDE.md invariant 6: every
|
|
129
|
+
// device-reachable URL must be byte-identical to the origin baked
|
|
130
|
+
// into bundle.mjs).
|
|
131
|
+
const resolved = await resolveBootClosureUrls(server, source, maxWaitMs);
|
|
132
|
+
const payload = { urls: resolved.urls, source: resolved.source };
|
|
133
|
+
res.setHeader('Content-Type', 'application/json');
|
|
134
|
+
res.statusCode = 200;
|
|
135
|
+
res.end(JSON.stringify(payload));
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
res.statusCode = 500;
|
|
139
|
+
res.setHeader('Content-Type', 'application/json');
|
|
140
|
+
res.end(JSON.stringify({ error: error?.message || 'Failed to compute NativeScript boot closure', urls: [] }));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=boot-closure-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-closure-route.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/boot-closure-route.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,6EAA6E;AAC7E,EAAE;AACF,4EAA4E;AAC5E,kFAAkF;AAClF,0DAA0D;AAC1D,4EAA4E;AAC5E,4EAA4E;AAC5E,qDAAqD;AACrD,EAAE;AACF,sEAAsE;AACtE,wEAAwE;AACxE,6EAA6E;AAC7E,uEAAuE;AACvE,2CAA2C;AAE3C,MAAM,aAAa,GAAG,iCAAiC,CA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AC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const BOOT_RECORDING_VERSION = 1;
|
|
2
|
+
/** Endpoints whose request marks the start of a device boot. */
|
|
3
|
+
export declare const BOOT_SIGNAL_PATHS: ReadonlySet<string>;
|
|
4
|
+
/**
|
|
5
|
+
* True when a request path is served through the device module loader and is
|
|
6
|
+
* therefore worth prefetching on the next boot. Matches the URL spaces the
|
|
7
|
+
* HTTP ESM loader fetches: `/ns/m/**`, the `/ns/rt` + `/ns/core` bridges, the
|
|
8
|
+
* core and deps bundles, Vue SFC artifacts, the served vendor bundle, and the
|
|
9
|
+
* dev client bootstrap.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isPrefetchableBootPath(pathWithSearch: string): boolean;
|
|
12
|
+
export declare function getBootRecordingFilePath(projectRoot: string, platform: string, flavor: string): string;
|
|
13
|
+
/** Load a persisted recording; null when absent, invalid, or mismatched. */
|
|
14
|
+
export declare function loadPersistedBootRecording(projectRoot: string, platform: string, flavor: string): string[] | null;
|
|
15
|
+
export type BootRecorderOptions = {
|
|
16
|
+
platform: string;
|
|
17
|
+
flavor: string;
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
/** Recording window closes after this many ms without boot requests (default 5000). */
|
|
20
|
+
idleWindowMs?: number;
|
|
21
|
+
/** Windows with fewer recorded entries are discarded as non-boots (default 5). */
|
|
22
|
+
minEntries?: number;
|
|
23
|
+
/** Hard cap on the recorded list (default 5000). */
|
|
24
|
+
maxEntries?: number;
|
|
25
|
+
/** Disable disk persistence (tests). */
|
|
26
|
+
persist?: boolean;
|
|
27
|
+
now?: () => number;
|
|
28
|
+
setTimer?: (handler: () => void, ms: number) => unknown;
|
|
29
|
+
clearTimer?: (handle: unknown) => void;
|
|
30
|
+
log?: (line: string) => void;
|
|
31
|
+
};
|
|
32
|
+
export type BootRecorder = {
|
|
33
|
+
/**
|
|
34
|
+
* Feed a request path (pathname + search). Boot-signal paths open a new
|
|
35
|
+
* recording session and return null. Prefetchable paths inside an active
|
|
36
|
+
* session return a finish callback the caller must invoke with the
|
|
37
|
+
* response status code; only 2xx completions are recorded.
|
|
38
|
+
*/
|
|
39
|
+
noteRequest(pathWithSearch: string): ((statusCode: number) => void) | null;
|
|
40
|
+
/**
|
|
41
|
+
* Record paths served out-of-band. The boot archive delivers bodies in
|
|
42
|
+
* one payload (its loopback self-fetches are excluded from organic
|
|
43
|
+
* recording), so the archive route feeds its served paths here; device
|
|
44
|
+
* straggler fetches are still recorded organically on top.
|
|
45
|
+
*/
|
|
46
|
+
seedActiveSession(paths: readonly string[]): void;
|
|
47
|
+
/** Most recent completed (or persisted) recording; null when none. */
|
|
48
|
+
getRecordedPaths(): string[] | null;
|
|
49
|
+
/** Force-close the active session (idle close path; exposed for tests). */
|
|
50
|
+
closeActiveSession(): void;
|
|
51
|
+
};
|
|
52
|
+
export declare function createBootRecorder(options: BootRecorderOptions): BootRecorder;
|
|
53
|
+
/**
|
|
54
|
+
* Standard dev-server construction: resolves platform/flavor from the
|
|
55
|
+
* project, honors `NS_VITE_HMR_DISABLE_BOOT_RECORDING` (returns null) and
|
|
56
|
+
* `NS_VITE_HMR_BOOT_RECORD_IDLE_MS`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function createBootRecorderFromEnv(projectRoot: string, log?: (line: string) => void): BootRecorder | null;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { BOOT_ARCHIVE_PATH } from '../shared/runtime/boot-archive-format.js';
|
|
4
|
+
import { resolvePlatform } from '../../helpers/cli-flags.js';
|
|
5
|
+
import { getProjectFlavor } from '../../helpers/flavor.js';
|
|
6
|
+
// Cold-boot request recording.
|
|
7
|
+
//
|
|
8
|
+
// The graph-walk boot closure (`populateInitialGraph` → `buildBootClosureUrls`)
|
|
9
|
+
// only covers app-source modules under `src/`, but a real cold boot also
|
|
10
|
+
// fetches hundreds of `/ns/m/node_modules/...` bodies (deep ESM packages like
|
|
11
|
+
// rxjs) one-by-one inside V8's synchronous module walk. This recorder captures
|
|
12
|
+
// the EXACT prefetchable URL set served during a boot window so the next boot
|
|
13
|
+
// (`/__ns_dev__/boot-closure` and `/__ns_dev__/boot-archive`) can prewarm all
|
|
14
|
+
// of it up front.
|
|
15
|
+
//
|
|
16
|
+
// Lifecycle: a recording session opens when the device fetches one of the
|
|
17
|
+
// boot-signal endpoints (`/__ns_dev__/session|boot-closure|boot-archive` —
|
|
18
|
+
// each is requested exactly once per boot by the session bootstrap), collects
|
|
19
|
+
// every successfully-served prefetchable request, and closes after an idle
|
|
20
|
+
// window. Closed sessions replace the previous recording and persist to
|
|
21
|
+
// `node_modules/.ns-vite/boot-closure-<platform>-<flavor>.json` so a fresh
|
|
22
|
+
// dev-server start benefits too.
|
|
23
|
+
//
|
|
24
|
+
// Self-healing: only 2xx responses are recorded, so deleted modules (404s)
|
|
25
|
+
// drop out on the next boot. Stale-but-servable entries are harmless — the
|
|
26
|
+
// prewarm cache tolerates unused bodies and the kickstart tolerates misses.
|
|
27
|
+
export const BOOT_RECORDING_VERSION = 1;
|
|
28
|
+
/** Endpoints whose request marks the start of a device boot. */
|
|
29
|
+
export const BOOT_SIGNAL_PATHS = new Set(['/__ns_dev__/session', '/__ns_dev__/boot-closure', BOOT_ARCHIVE_PATH]);
|
|
30
|
+
// Mirrors the native runtime's `LooksLikeJsSourceUrl` filter: the kickstart
|
|
31
|
+
// prewarm (and `seedModuleBodies`) skip non-JS resource types, so recording
|
|
32
|
+
// them would only bloat the closure.
|
|
33
|
+
const NON_JS_EXT_RE = /\.(css|scss|sass|less|json|html|htm|png|jpe?g|gif|svg|webp|ico|woff2?|ttf|otf|eot|mp3|mp4|webm|wav|map)$/i;
|
|
34
|
+
// Volatile cache-buster query param (`?t=169…` / `&t=169…`). URLs carrying it
|
|
35
|
+
// are freshly minted per request (Vite HMR timestamps, the Angular
|
|
36
|
+
// `@ng/component?c=…&t=…` refresh route), so a recorded copy can never be a
|
|
37
|
+
// byte-exact prewarm-cache hit on the next boot — recording them only grows
|
|
38
|
+
// the closure by one dead variant per boot.
|
|
39
|
+
const VOLATILE_T_PARAM_RE = /[?&]t=\d+(?:&|$)/;
|
|
40
|
+
/**
|
|
41
|
+
* True when a request path is served through the device module loader and is
|
|
42
|
+
* therefore worth prefetching on the next boot. Matches the URL spaces the
|
|
43
|
+
* HTTP ESM loader fetches: `/ns/m/**`, the `/ns/rt` + `/ns/core` bridges, the
|
|
44
|
+
* core and deps bundles, Vue SFC artifacts, the served vendor bundle, and the
|
|
45
|
+
* dev client bootstrap.
|
|
46
|
+
*/
|
|
47
|
+
export function isPrefetchableBootPath(pathWithSearch) {
|
|
48
|
+
if (!pathWithSearch || !pathWithSearch.startsWith('/'))
|
|
49
|
+
return false;
|
|
50
|
+
if (VOLATILE_T_PARAM_RE.test(pathWithSearch))
|
|
51
|
+
return false;
|
|
52
|
+
const pathname = pathWithSearch.split('?')[0];
|
|
53
|
+
if (NON_JS_EXT_RE.test(pathname))
|
|
54
|
+
return false;
|
|
55
|
+
if (pathname === '/ns/import-map.json')
|
|
56
|
+
return false;
|
|
57
|
+
if (pathname.startsWith('/ns/m/'))
|
|
58
|
+
return true;
|
|
59
|
+
if (pathname === '/ns/rt' || pathname.startsWith('/ns/rt/'))
|
|
60
|
+
return true;
|
|
61
|
+
if (pathname === '/ns/core' || pathname.startsWith('/ns/core/'))
|
|
62
|
+
return true;
|
|
63
|
+
if (pathname === '/ns/core-bundle.mjs')
|
|
64
|
+
return true;
|
|
65
|
+
if (pathname === '/ns/deps-bundle.mjs')
|
|
66
|
+
return true;
|
|
67
|
+
if (pathname.startsWith('/ns/sfc/') || pathname.startsWith('/ns/asm/'))
|
|
68
|
+
return true;
|
|
69
|
+
if (pathname === '/@nativescript/vendor.mjs')
|
|
70
|
+
return true;
|
|
71
|
+
if (pathname === '/__ns_dev__/client')
|
|
72
|
+
return true;
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
export function getBootRecordingFilePath(projectRoot, platform, flavor) {
|
|
76
|
+
return path.join(projectRoot, 'node_modules', '.ns-vite', `boot-closure-${platform}-${flavor}.json`);
|
|
77
|
+
}
|
|
78
|
+
/** Load a persisted recording; null when absent, invalid, or mismatched. */
|
|
79
|
+
export function loadPersistedBootRecording(projectRoot, platform, flavor) {
|
|
80
|
+
try {
|
|
81
|
+
const file = getBootRecordingFilePath(projectRoot, platform, flavor);
|
|
82
|
+
if (!existsSync(file))
|
|
83
|
+
return null;
|
|
84
|
+
const parsed = JSON.parse(readFileSync(file, 'utf-8'));
|
|
85
|
+
if (!parsed || parsed.version !== BOOT_RECORDING_VERSION)
|
|
86
|
+
return null;
|
|
87
|
+
if (parsed.platform !== platform || parsed.flavor !== flavor)
|
|
88
|
+
return null;
|
|
89
|
+
// Re-apply the prefetchability filter on load so recordings written by
|
|
90
|
+
// an older filter (or hand-edited files) shed dead entries.
|
|
91
|
+
const paths = Array.isArray(parsed.paths) ? parsed.paths.filter((p) => typeof p === 'string' && isPrefetchableBootPath(p)) : [];
|
|
92
|
+
return paths.length ? paths : null;
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function createBootRecorder(options) {
|
|
99
|
+
const idleWindowMs = Math.max(500, Math.floor(options.idleWindowMs ?? 5000));
|
|
100
|
+
const minEntries = Math.max(1, Math.floor(options.minEntries ?? 5));
|
|
101
|
+
const maxEntries = Math.max(minEntries, Math.floor(options.maxEntries ?? 5000));
|
|
102
|
+
const persist = options.persist !== false;
|
|
103
|
+
const now = options.now ?? (() => Date.now());
|
|
104
|
+
const setTimer = options.setTimer ?? ((handler, ms) => setTimeout(handler, ms));
|
|
105
|
+
const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
106
|
+
const log = options.log ?? (() => { });
|
|
107
|
+
let best = persist ? loadPersistedBootRecording(options.projectRoot, options.platform, options.flavor) : null;
|
|
108
|
+
let session = null;
|
|
109
|
+
let idleTimer = null;
|
|
110
|
+
const persistBest = () => {
|
|
111
|
+
if (!persist || !best)
|
|
112
|
+
return;
|
|
113
|
+
try {
|
|
114
|
+
const file = getBootRecordingFilePath(options.projectRoot, options.platform, options.flavor);
|
|
115
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
116
|
+
writeFileSync(file, JSON.stringify({
|
|
117
|
+
version: BOOT_RECORDING_VERSION,
|
|
118
|
+
platform: options.platform,
|
|
119
|
+
flavor: options.flavor,
|
|
120
|
+
recordedAt: now(),
|
|
121
|
+
paths: best,
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
log(`[hmr-ws][boot-record] persist failed: ${error?.message || error}`);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const closeSession = () => {
|
|
129
|
+
if (idleTimer !== null) {
|
|
130
|
+
clearTimer(idleTimer);
|
|
131
|
+
idleTimer = null;
|
|
132
|
+
}
|
|
133
|
+
if (!session)
|
|
134
|
+
return;
|
|
135
|
+
const finished = session;
|
|
136
|
+
session = null;
|
|
137
|
+
if (finished.order.length < minEntries) {
|
|
138
|
+
log(`[hmr-ws][boot-record] discarded window with ${finished.order.length} entries (< ${minEntries})`);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
best = finished.order.slice(0, maxEntries);
|
|
142
|
+
persistBest();
|
|
143
|
+
log(`[hmr-ws][boot-record] captured ${best.length} boot urls in ${Math.max(0, now() - finished.startedAt)}ms`);
|
|
144
|
+
};
|
|
145
|
+
const armIdle = () => {
|
|
146
|
+
if (idleTimer !== null)
|
|
147
|
+
clearTimer(idleTimer);
|
|
148
|
+
idleTimer = setTimer(() => {
|
|
149
|
+
idleTimer = null;
|
|
150
|
+
closeSession();
|
|
151
|
+
}, idleWindowMs);
|
|
152
|
+
};
|
|
153
|
+
const openSession = () => {
|
|
154
|
+
closeSession();
|
|
155
|
+
session = { order: [], seen: new Set(), startedAt: now() };
|
|
156
|
+
armIdle();
|
|
157
|
+
};
|
|
158
|
+
const record = (pathWithSearch) => {
|
|
159
|
+
if (!session || session.order.length >= maxEntries)
|
|
160
|
+
return;
|
|
161
|
+
if (session.seen.has(pathWithSearch))
|
|
162
|
+
return;
|
|
163
|
+
session.seen.add(pathWithSearch);
|
|
164
|
+
session.order.push(pathWithSearch);
|
|
165
|
+
};
|
|
166
|
+
return {
|
|
167
|
+
noteRequest(pathWithSearch) {
|
|
168
|
+
const pathname = pathWithSearch.split('?')[0];
|
|
169
|
+
if (BOOT_SIGNAL_PATHS.has(pathname)) {
|
|
170
|
+
openSession();
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
if (!session)
|
|
174
|
+
return null;
|
|
175
|
+
if (!isPrefetchableBootPath(pathWithSearch))
|
|
176
|
+
return null;
|
|
177
|
+
armIdle();
|
|
178
|
+
let done = false;
|
|
179
|
+
return (statusCode) => {
|
|
180
|
+
if (done)
|
|
181
|
+
return;
|
|
182
|
+
done = true;
|
|
183
|
+
if (!session)
|
|
184
|
+
return;
|
|
185
|
+
if (!(statusCode >= 200 && statusCode < 300))
|
|
186
|
+
return;
|
|
187
|
+
record(pathWithSearch);
|
|
188
|
+
armIdle();
|
|
189
|
+
};
|
|
190
|
+
},
|
|
191
|
+
seedActiveSession(paths) {
|
|
192
|
+
if (!paths?.length)
|
|
193
|
+
return;
|
|
194
|
+
if (!session)
|
|
195
|
+
openSession();
|
|
196
|
+
for (const p of paths) {
|
|
197
|
+
if (typeof p === 'string' && isPrefetchableBootPath(p))
|
|
198
|
+
record(p);
|
|
199
|
+
}
|
|
200
|
+
armIdle();
|
|
201
|
+
},
|
|
202
|
+
getRecordedPaths() {
|
|
203
|
+
return best ? best.slice() : null;
|
|
204
|
+
},
|
|
205
|
+
closeActiveSession() {
|
|
206
|
+
closeSession();
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Standard dev-server construction: resolves platform/flavor from the
|
|
212
|
+
* project, honors `NS_VITE_HMR_DISABLE_BOOT_RECORDING` (returns null) and
|
|
213
|
+
* `NS_VITE_HMR_BOOT_RECORD_IDLE_MS`.
|
|
214
|
+
*/
|
|
215
|
+
export function createBootRecorderFromEnv(projectRoot, log) {
|
|
216
|
+
const disabled = process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === '1' || process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === 'true';
|
|
217
|
+
if (disabled)
|
|
218
|
+
return null;
|
|
219
|
+
const configuredIdleMs = Number.parseInt(process.env.NS_VITE_HMR_BOOT_RECORD_IDLE_MS || '', 10);
|
|
220
|
+
return createBootRecorder({
|
|
221
|
+
platform: resolvePlatform() || 'ios',
|
|
222
|
+
flavor: getProjectFlavor(),
|
|
223
|
+
projectRoot,
|
|
224
|
+
idleWindowMs: Number.isFinite(configuredIdleMs) && configuredIdleMs > 0 ? configuredIdleMs : undefined,
|
|
225
|
+
log,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=boot-recording.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-recording.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/boot-recording.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,+BAA+B;AAC/B,EAAE;AACF,gFAAgF;AAChF,yEAAyE;AACzE,8EAA8E;AAC9E,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;A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;QACD,gBAAgB;YACf,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACnC,CAAC;QACD,kBAAkB;YACjB,YAAY,EAAE,CAAC;QAChB,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,WAAmB,EAAE,GAA4B;IAC1F,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kCAAkC,KAAK,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,kCAAkC,KAAK,MAAM,CAAC;IACrI,IAAI,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,+BAA+B,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAChG,OAAO,kBAAkB,CAAC;QACzB,QAAQ,EAAE,eAAe,EAAE,IAAI,KAAK;QACpC,MAAM,EAAE,gBAAgB,EAAE;QAC1B,WAAW;QACX,YAAY,EAAE,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS;QACtG,GAAG;KACH,CAAC,CAAC;AACJ,CAAC"}
|
package/hmr/server/constants.js
CHANGED
|
@@ -5,17 +5,32 @@ export const QUERY_PATTERN = /\?.*$/;
|
|
|
5
5
|
// Detect whether Vite's variable dynamic import helper is already inlined
|
|
6
6
|
export const VARIABLE_DYNAMIC_IMPORT_HELPER_PATTERN = /__variableDynamicImportRuntimeHelper\s*=/;
|
|
7
7
|
// Import/export matchers (static and dynamic)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
//
|
|
9
|
+
// Each pattern's first capture group includes the optional leading anchor
|
|
10
|
+
// (`^|\n`) so the replacement function preserves the line break that would
|
|
11
|
+
// otherwise be silently consumed by the regex engine. Without this, two
|
|
12
|
+
// concatenated patterns like:
|
|
13
|
+
// `})();\nexport * from "a"\nexport * from "b"`
|
|
14
|
+
// would collapse to:
|
|
15
|
+
// `})();export * from "a"export * from "b"`
|
|
16
|
+
// because each `(?:^|\n)` ate a newline that no replacement string put back.
|
|
17
|
+
export const IMPORT_PATTERN_1 = /((?:^|\n)\s*import\s+[^'";]*?\s+from\s+["'])([^"']+)(["'];?)/g;
|
|
18
|
+
export const IMPORT_PATTERN_2 = /((?:^|\n)\s*export\s+[^'";]*?\s+from\s+["'])([^"']+)(["'];?)/g;
|
|
10
19
|
export const EXPORT_PATTERN = IMPORT_PATTERN_2;
|
|
11
20
|
export const IMPORT_PATTERN_3 = /(import\(\s*["'])([^"']+)(["']\s*\))/g;
|
|
12
21
|
// Side-effect imports: import "spec" / import 'spec' (no `from`, no bindings)
|
|
13
|
-
export const IMPORT_PATTERN_SIDE_EFFECT = /(?:^|\n)
|
|
22
|
+
export const IMPORT_PATTERN_SIDE_EFFECT = /((?:^|\n)\s*import\s+["'])([^"']+)(["'];?)/g;
|
|
14
23
|
// Vue-specific patterns
|
|
15
24
|
export const VUE_FILE_PATTERN = /\.vue(?:\?[^"']*)?$/;
|
|
16
|
-
export const VUE_FILE_IMPORT = /(?:^|\n)
|
|
25
|
+
export const VUE_FILE_IMPORT = /((?:^|\n)\s*import\s+[^'";]*?\s+from\s+["'])([^"']+\.vue(?:\?[^"']*)?)(["'];?)/g;
|
|
17
26
|
// Vite/HMR noise cleanup
|
|
18
|
-
|
|
27
|
+
// Matches BOTH the side-effect form (`import "/@vite/client";`) and the named
|
|
28
|
+
// form Vite 8 emits (`import { injectQuery as __vite__injectQuery } from "/@vite/client";`).
|
|
29
|
+
// NOT line-anchored: Vite 8 concatenates injected imports onto the module's
|
|
30
|
+
// original first line, so an anchored pattern either misses or over-deletes.
|
|
31
|
+
// Group 1 (the preceding `^`/newline/`;` boundary) MUST be preserved by
|
|
32
|
+
// replacements (`replace(..., '$1')`) so the prior statement keeps its terminator.
|
|
33
|
+
export const VITE_CLIENT_IMPORT = /(^|[\n;])\s*import\s+(?:[\w$]+\s*,\s*)?(?:\{[^}]*\}\s+from\s+|[\w$]+\s+from\s+|\*\s+as\s+[\w$]+\s+from\s+)?['"](?:\/@vite\/client|@vite\/client)['"];?/g;
|
|
19
34
|
// Strip Vite's injected `import.meta.hot = __vite__createHotContext(...)` assignment.
|
|
20
35
|
// Important: it may appear mid-line after other tokens/spaces in sanitized HTTP output,
|
|
21
36
|
// so we cannot rely on it starting at BOL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/constants.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,qGAAqG;AAErG,uBAAuB;AACvB,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sCAAsC,GAAG,0CAA0C,CAAC;AAEjG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,+DAA+D,CAAC;AAChG,MAAM,CAAC,MAAM,gBAAgB,GAAG,+DAA+D,CAAC;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AACxE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,6CAA6C,CAAC;AAExF,wBAAwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,iFAAiF,CAAC;AAEjH,yBAAyB;AACzB,MAAM,CAAC,MAAM,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/constants.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,qGAAqG;AAErG,uBAAuB;AACvB,MAAM,CAAC,MAAM,aAAa,GAAG,OAA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