@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
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { ViteDevServer } from 'vite';
|
|
1
|
+
import type { HmrContext, ViteDevServer } from 'vite';
|
|
2
2
|
import type { WebSocketServer } from 'ws';
|
|
3
|
+
import type { NsHotUpdateContext } from './websocket-hot-update.js';
|
|
3
4
|
export interface FrameworkProcessFileContext {
|
|
4
5
|
filePath: string;
|
|
5
6
|
server: ViteDevServer;
|
|
@@ -39,29 +40,130 @@ export interface FrameworkRegistryContext {
|
|
|
39
40
|
export interface FrameworkCleanContext {
|
|
40
41
|
code: string;
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Inputs for {@link FrameworkServerStrategy.rewriteServedModule}, mirroring the
|
|
45
|
+
* arguments the `/ns/m` served-module pipeline passes to `rewriteImports` /
|
|
46
|
+
* `prepareAngularEntryForDevice` today (the angular/else fork in
|
|
47
|
+
* `websocket-ns-m.ts`).
|
|
48
|
+
*/
|
|
49
|
+
export interface FrameworkServedModuleContext {
|
|
50
|
+
/** Resolved module specifier / URL being served (`resolvedCandidate || spec`). */
|
|
51
|
+
moduleId: string;
|
|
52
|
+
sfcFileMap: Map<string, string>;
|
|
53
|
+
depFileMap: Map<string, string>;
|
|
54
|
+
projectRoot: string;
|
|
55
|
+
serverOrigin: string;
|
|
56
|
+
verbose: boolean;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Inputs for {@link FrameworkServerStrategy.registerRoutes}. A framework that
|
|
60
|
+
* owns dev-only HTTP endpoints (e.g. Vue's `/ns/sfc*`) registers them here;
|
|
61
|
+
* frameworks without extra endpoints leave the hook undefined (no-op default).
|
|
62
|
+
*
|
|
63
|
+
* Carries everything Vue's `registerSfcHandlers` needs (its
|
|
64
|
+
* `RegisterSfcHandlersOptions` shape): the dev server, plugin state
|
|
65
|
+
* (`sfcFileMap`/`depFileMap`/`appVirtualWithSlash`), the live graph-version
|
|
66
|
+
* accessor, and the active strategy. `wss` is included for parity with the
|
|
67
|
+
* other route registrars (the SFC handlers don't consult it today).
|
|
68
|
+
*/
|
|
69
|
+
export interface FrameworkRouteContext {
|
|
70
|
+
server: ViteDevServer;
|
|
71
|
+
wss: WebSocketServer | null;
|
|
72
|
+
sfcFileMap: Map<string, string>;
|
|
73
|
+
depFileMap: Map<string, string>;
|
|
74
|
+
verbose: boolean;
|
|
75
|
+
appVirtualWithSlash: string;
|
|
76
|
+
getGraphVersion(): number;
|
|
77
|
+
getStrategy(): FrameworkServerStrategy;
|
|
78
|
+
}
|
|
42
79
|
export interface FrameworkServerStrategy {
|
|
43
80
|
readonly flavor: string;
|
|
44
81
|
matchesFile(id: string): boolean;
|
|
82
|
+
/** Framework-specific pre-clean phase (remove virtual style imports, etc.). */
|
|
83
|
+
preClean?(code: string): string;
|
|
84
|
+
/** Rewrite framework runtime imports to vendor bundle. */
|
|
85
|
+
rewriteFrameworkImports?(code: string): string;
|
|
86
|
+
/** Framework-specific post-clean phase (strip HMR helpers, etc.). */
|
|
87
|
+
postClean?(code: string): string;
|
|
45
88
|
/**
|
|
46
|
-
*
|
|
89
|
+
* Collapse framework-specific HTTP endpoint imports to their canonical
|
|
90
|
+
* (unversioned) URLs. Module identity is the URL; freshness is driven by
|
|
91
|
+
* explicit eviction, never URL variation. Versioned inbound shapes from
|
|
92
|
+
* stale cached device code (e.g. `/ns/sfc/<ver>/…`) are stripped here.
|
|
47
93
|
*/
|
|
48
|
-
|
|
94
|
+
canonicalizeFrameworkImports?(code: string, origin: string): string;
|
|
95
|
+
/** Optional vendor rewrite hook (e.g. map framework helper imports to vendor). */
|
|
96
|
+
rewriteVendorSpec?(code: string, origin: string, version: number): string;
|
|
49
97
|
/**
|
|
50
|
-
*
|
|
98
|
+
* Full per-framework `handleHotUpdate` implementation. Every flavor owns one:
|
|
99
|
+
* the WebSocket plugin's `handleHotUpdate` Vite hook calls it directly, and
|
|
100
|
+
* the implementation runs the shared {@link NsHotUpdateContext}-driven
|
|
101
|
+
* `runHotUpdatePrologue` followed by its own framework tail.
|
|
51
102
|
*/
|
|
52
|
-
|
|
103
|
+
handleHotUpdate?(ctx: HmrContext, deps: NsHotUpdateContext): Promise<HmrContext['modules'] | void>;
|
|
53
104
|
/**
|
|
54
|
-
*
|
|
105
|
+
* When `true`, the per-module graph delta is NOT broadcast inline during a
|
|
106
|
+
* hot update (the framework drives its own re-fetch/patch instead — Angular
|
|
107
|
+
* & Solid). Defaults to `false` → delta is broadcast (today's TS/Vue path).
|
|
55
108
|
*/
|
|
56
|
-
|
|
109
|
+
readonly deferDeltaBroadcast?: boolean;
|
|
57
110
|
/**
|
|
58
|
-
*
|
|
111
|
+
* When this returns `true` for the changed file, the shared prologue SKIPS
|
|
112
|
+
* its default module-graph delta upsert — the framework's own
|
|
113
|
+
* `handleHotUpdate` tail re-queries the graph and drives the update itself
|
|
114
|
+
* (Angular HTML templates: Analog's in-place swap or the NS reboot path).
|
|
115
|
+
* Defaults to no-skip (the prologue always upserts).
|
|
59
116
|
*/
|
|
60
|
-
|
|
117
|
+
skipDefaultGraphUpdate?(file: string): boolean;
|
|
61
118
|
/**
|
|
62
|
-
*
|
|
119
|
+
* When `true`, the shared prologue does NOT broadcast `ns:css-updates` for a
|
|
120
|
+
* component-scoped style edit (a non-global `.css`) — the framework's own
|
|
121
|
+
* `handleHotUpdate` drives the in-place component update instead. For
|
|
122
|
+
* Angular with Analog `liveReload` active this is essential: Analog emits
|
|
123
|
+
* `angular:component-update` only while the css's `?direct` module is absent
|
|
124
|
+
* from the graph, and the prologue's broadcast makes the device fetch
|
|
125
|
+
* `…?direct=1`, which creates that module and flips Analog to its
|
|
126
|
+
* (NativeScript-inert) Vite css-update branch on every subsequent edit. The
|
|
127
|
+
* global app-entry CSS path is unaffected (it is not component-scoped).
|
|
128
|
+
* Defaults to `false` (every flavor keeps the component-style broadcast).
|
|
63
129
|
*/
|
|
64
|
-
|
|
130
|
+
ownsComponentStyleHmr?(server: ViteDevServer): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Override the `/ns/m` served-module import rewrite. Defaults to the shared
|
|
133
|
+
* `rewriteImports` (today's non-Angular path); Angular overrides with its
|
|
134
|
+
* entry-preparation pass. Returns the rewritten code.
|
|
135
|
+
*/
|
|
136
|
+
rewriteServedModule?(code: string, ctx: FrameworkServedModuleContext): string;
|
|
137
|
+
/**
|
|
138
|
+
* Patch a served `node_modules` module before device delivery (e.g. Solid's
|
|
139
|
+
* inline `@solid-refresh` patch). Defaults to identity (code unchanged).
|
|
140
|
+
* `verbose` mirrors the `/ns/m` plugin's `verbose` option and gates the
|
|
141
|
+
* server-side diagnostics the inline patch emitted today (the device process
|
|
142
|
+
* sets `globalThis.__NS_ENV_VERBOSE__`, but the Node server never does).
|
|
143
|
+
*/
|
|
144
|
+
transformNodeModule?(code: string, moduleId: string, verbose?: boolean): string;
|
|
145
|
+
/**
|
|
146
|
+
* Framework SFC post-processing (Vue). Defaults to identity. Mirrors the
|
|
147
|
+
* `processSfcCode` helper currently injected via the registry context.
|
|
148
|
+
*/
|
|
149
|
+
processSfcCode?(code: string): string;
|
|
150
|
+
/**
|
|
151
|
+
* Register framework-owned dev HTTP endpoints (Vue: `/ns/sfc*`). Defaults to
|
|
152
|
+
* no-op for frameworks without extra routes.
|
|
153
|
+
*/
|
|
154
|
+
registerRoutes?(ctx: FrameworkRouteContext): void;
|
|
155
|
+
/**
|
|
156
|
+
* Extra import-map entries for this framework (e.g. Vue → `vue` /
|
|
157
|
+
* `nativescript-vue`; Solid → `solid-js`). Defaults to none. Replaces the
|
|
158
|
+
* `addFrameworkEntries` switch in `import-map.ts`.
|
|
159
|
+
*/
|
|
160
|
+
importMapEntries?(origin: string): Record<string, string>;
|
|
161
|
+
/**
|
|
162
|
+
* Extra volatile URL patterns the device runtime must always re-fetch.
|
|
163
|
+
* Defaults to none — no built-in strategy needs any (freshness is
|
|
164
|
+
* eviction-driven), but the hook stays for custom strategies.
|
|
165
|
+
*/
|
|
166
|
+
volatilePatterns?(): string[];
|
|
65
167
|
processFile(ctx: FrameworkProcessFileContext): Promise<void>;
|
|
66
168
|
buildRegistry(ctx: FrameworkRegistryContext): Promise<void>;
|
|
67
169
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { WebSocket, WebSocketServer } from 'ws';
|
|
2
|
+
import type { FrameworkServerStrategy } from './framework-strategy.js';
|
|
3
|
+
export interface GraphModule {
|
|
4
|
+
id: string;
|
|
5
|
+
deps: string[];
|
|
6
|
+
hash: string;
|
|
7
|
+
}
|
|
8
|
+
export interface UpsertOptions {
|
|
9
|
+
emitDeltaOnInsert?: boolean;
|
|
10
|
+
broadcastDelta?: boolean;
|
|
11
|
+
bumpVersion?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface HmrModuleGraphDeps {
|
|
14
|
+
verbose: boolean;
|
|
15
|
+
strategy: FrameworkServerStrategy;
|
|
16
|
+
getWss: () => WebSocketServer | null;
|
|
17
|
+
getPluginRoot: () => string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare class HmrModuleGraph {
|
|
20
|
+
private readonly deps;
|
|
21
|
+
readonly modules: Map<string, GraphModule>;
|
|
22
|
+
private readonly txnBatches;
|
|
23
|
+
private _version;
|
|
24
|
+
constructor(deps: HmrModuleGraphDeps);
|
|
25
|
+
get version(): number;
|
|
26
|
+
get size(): number;
|
|
27
|
+
get(id: string): GraphModule | undefined;
|
|
28
|
+
getTxnBatch(version: number): string[];
|
|
29
|
+
computeHash(content: string): string;
|
|
30
|
+
normalizeGraphId(raw: string): string;
|
|
31
|
+
computeTxnOrderForChanged(changedIds: string[]): string[];
|
|
32
|
+
private fullGraphPayload;
|
|
33
|
+
emitFullGraph(ws: WebSocket): void;
|
|
34
|
+
emitDelta(changed: GraphModule[], removed: string[]): void;
|
|
35
|
+
upsert(rawId: string, code: string, deps: string[], options?: UpsertOptions): GraphModule | undefined;
|
|
36
|
+
remove(id: string): void;
|
|
37
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { matchesRuntimeGraphModuleId } from './runtime-graph-filter.js';
|
|
2
|
+
import { classifyGraphUpsert, shouldBroadcastGraphUpsertDelta, shouldBumpGraphVersion } from './websocket-graph-upsert.js';
|
|
3
|
+
import { getProjectAppVirtualPath } from '../../helpers/utils.js';
|
|
4
|
+
const APP_VIRTUAL_WITH_SLASH = `${getProjectAppVirtualPath()}/`;
|
|
5
|
+
// The HMR module graph: spec -> { deps, hash } plus a monotonically increasing
|
|
6
|
+
// version that sequences graph broadcasts and transactional HMR batches.
|
|
7
|
+
// Owns delta/full-graph broadcasts to connected clients and the per-version
|
|
8
|
+
// txn batch ordering. The version never appears in served module URLs —
|
|
9
|
+
// module identity is the canonical URL (see CLAUDE.md invariant 4).
|
|
10
|
+
//
|
|
11
|
+
// version starts at 1 and stays stable during cold boot (bulk warm-ups pass
|
|
12
|
+
// bumpVersion:false); it only advances on live edits, so the graph filling in
|
|
13
|
+
// lazily never churns the version.
|
|
14
|
+
export class HmrModuleGraph {
|
|
15
|
+
constructor(deps) {
|
|
16
|
+
this.deps = deps;
|
|
17
|
+
this.modules = new Map();
|
|
18
|
+
// Transactional HMR batches: version -> ordered list of changed ids for that version.
|
|
19
|
+
this.txnBatches = new Map();
|
|
20
|
+
this._version = 1;
|
|
21
|
+
}
|
|
22
|
+
get version() {
|
|
23
|
+
return this._version;
|
|
24
|
+
}
|
|
25
|
+
get size() {
|
|
26
|
+
return this.modules.size;
|
|
27
|
+
}
|
|
28
|
+
get(id) {
|
|
29
|
+
return this.modules.get(id);
|
|
30
|
+
}
|
|
31
|
+
getTxnBatch(version) {
|
|
32
|
+
return this.txnBatches.get(version) || [];
|
|
33
|
+
}
|
|
34
|
+
computeHash(content) {
|
|
35
|
+
let h = 0;
|
|
36
|
+
for (let i = 0; i < content.length; i++) {
|
|
37
|
+
h = (h * 31 + content.charCodeAt(i)) | 0;
|
|
38
|
+
}
|
|
39
|
+
return ('00000000' + (h >>> 0).toString(16)).slice(-8);
|
|
40
|
+
}
|
|
41
|
+
normalizeGraphId(raw) {
|
|
42
|
+
if (!raw)
|
|
43
|
+
return raw;
|
|
44
|
+
let id = raw.split('?')[0].replace(/\\/g, '/');
|
|
45
|
+
id = id.replace(/^file:\/\//, '');
|
|
46
|
+
const pluginRoot = this.deps.getPluginRoot();
|
|
47
|
+
if (pluginRoot) {
|
|
48
|
+
const rootNorm = pluginRoot.replace(/\\/g, '/');
|
|
49
|
+
if (id.startsWith(rootNorm)) {
|
|
50
|
+
id = id.slice(rootNorm.length);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (!id.startsWith('/'))
|
|
54
|
+
id = '/' + id;
|
|
55
|
+
// Collapse nested app root indicators when present (defensive)
|
|
56
|
+
const idx = id.indexOf(APP_VIRTUAL_WITH_SLASH);
|
|
57
|
+
if (idx !== -1)
|
|
58
|
+
id = id.slice(idx);
|
|
59
|
+
return id;
|
|
60
|
+
}
|
|
61
|
+
// Dependency-closed, topologically sorted list of modules for a set of
|
|
62
|
+
// changed ids. Only includes application modules we can serve (under the
|
|
63
|
+
// app virtual root and known framework/.ts/.js entries already in the graph).
|
|
64
|
+
computeTxnOrderForChanged(changedIds) {
|
|
65
|
+
const { strategy } = this.deps;
|
|
66
|
+
const includeAppModule = (id) => matchesRuntimeGraphModuleId(id, APP_VIRTUAL_WITH_SLASH, /\.(ts|js|mjs|tsx|jsx)$/i);
|
|
67
|
+
const includeExt = (id) => strategy.matchesFile(id) || includeAppModule(id);
|
|
68
|
+
const isApp = (id) => id.startsWith(APP_VIRTUAL_WITH_SLASH);
|
|
69
|
+
const roots = changedIds.map((id) => this.normalizeGraphId(id)).filter((id) => this.modules.has(id) && (isApp(id) || strategy.matchesFile(id)) && includeExt(id));
|
|
70
|
+
const toVisit = new Set();
|
|
71
|
+
const stack = [...roots];
|
|
72
|
+
while (stack.length) {
|
|
73
|
+
const id = stack.pop();
|
|
74
|
+
if (toVisit.has(id))
|
|
75
|
+
continue;
|
|
76
|
+
toVisit.add(id);
|
|
77
|
+
const m = this.modules.get(id);
|
|
78
|
+
if (m) {
|
|
79
|
+
for (const d of m.deps) {
|
|
80
|
+
if (!this.modules.has(d))
|
|
81
|
+
continue;
|
|
82
|
+
if ((isApp(d) || strategy.matchesFile(d)) && includeExt(d) && !toVisit.has(d)) {
|
|
83
|
+
stack.push(d);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Topological order: deps first (post-order DFS)
|
|
89
|
+
const ordered = [];
|
|
90
|
+
const temp = new Set();
|
|
91
|
+
const perm = new Set();
|
|
92
|
+
const visit = (id) => {
|
|
93
|
+
if (perm.has(id))
|
|
94
|
+
return;
|
|
95
|
+
if (temp.has(id)) {
|
|
96
|
+
perm.add(id);
|
|
97
|
+
return;
|
|
98
|
+
} // cycle: bail out
|
|
99
|
+
temp.add(id);
|
|
100
|
+
const m = this.modules.get(id);
|
|
101
|
+
if (m) {
|
|
102
|
+
for (const d of m.deps) {
|
|
103
|
+
if (toVisit.has(d))
|
|
104
|
+
visit(d);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
temp.delete(id);
|
|
108
|
+
perm.add(id);
|
|
109
|
+
ordered.push(id);
|
|
110
|
+
};
|
|
111
|
+
for (const id of toVisit)
|
|
112
|
+
visit(id);
|
|
113
|
+
return ordered;
|
|
114
|
+
}
|
|
115
|
+
fullGraphPayload() {
|
|
116
|
+
return {
|
|
117
|
+
type: 'ns:hmr-full-graph',
|
|
118
|
+
version: this._version,
|
|
119
|
+
modules: Array.from(this.modules.values()).map((m) => ({
|
|
120
|
+
id: m.id,
|
|
121
|
+
deps: m.deps,
|
|
122
|
+
hash: m.hash,
|
|
123
|
+
})),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
emitFullGraph(ws) {
|
|
127
|
+
try {
|
|
128
|
+
if (this.deps.verbose) {
|
|
129
|
+
try {
|
|
130
|
+
const payload = this.fullGraphPayload();
|
|
131
|
+
console.log('[hmr-ws][graph] emitFullGraph version', payload.version, 'modules=', payload.modules.length);
|
|
132
|
+
if (payload.modules.length) {
|
|
133
|
+
console.log('[hmr-ws][graph] sample module ids', payload.modules.slice(0, 5).map((m) => m.id));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch { }
|
|
137
|
+
}
|
|
138
|
+
ws.send(JSON.stringify(this.fullGraphPayload()));
|
|
139
|
+
}
|
|
140
|
+
catch { }
|
|
141
|
+
}
|
|
142
|
+
emitDelta(changed, removed) {
|
|
143
|
+
const wss = this.deps.getWss();
|
|
144
|
+
if (!wss)
|
|
145
|
+
return;
|
|
146
|
+
// Record this version's txn batch order
|
|
147
|
+
try {
|
|
148
|
+
const changedIds = changed.map((m) => m.id);
|
|
149
|
+
if (changedIds.length) {
|
|
150
|
+
const ordered = this.computeTxnOrderForChanged(changedIds);
|
|
151
|
+
this.txnBatches.set(this._version, ordered);
|
|
152
|
+
// Keep only the last ~20 versions
|
|
153
|
+
if (this.txnBatches.size > 20) {
|
|
154
|
+
const drop = Array.from(this.txnBatches.keys())
|
|
155
|
+
.sort((a, b) => a - b)
|
|
156
|
+
.slice(0, this.txnBatches.size - 20);
|
|
157
|
+
for (const k of drop)
|
|
158
|
+
this.txnBatches.delete(k);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch { }
|
|
163
|
+
const payload = {
|
|
164
|
+
type: 'ns:hmr-delta',
|
|
165
|
+
baseVersion: this._version - 1,
|
|
166
|
+
newVersion: this._version,
|
|
167
|
+
changed: changed.map((m) => ({ id: m.id, deps: m.deps, hash: m.hash })),
|
|
168
|
+
removed,
|
|
169
|
+
};
|
|
170
|
+
const json = JSON.stringify(payload);
|
|
171
|
+
wss.clients.forEach((c) => {
|
|
172
|
+
try {
|
|
173
|
+
c.send(json);
|
|
174
|
+
}
|
|
175
|
+
catch { }
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
upsert(rawId, code, deps, options) {
|
|
179
|
+
const id = this.normalizeGraphId(rawId);
|
|
180
|
+
const normDeps = deps
|
|
181
|
+
.map((d) => this.normalizeGraphId(d))
|
|
182
|
+
.filter(Boolean)
|
|
183
|
+
.slice()
|
|
184
|
+
.sort();
|
|
185
|
+
const hash = this.computeHash(code);
|
|
186
|
+
const existing = this.modules.get(id);
|
|
187
|
+
const classification = classifyGraphUpsert(existing, hash, normDeps);
|
|
188
|
+
if (classification === 'unchanged')
|
|
189
|
+
return existing;
|
|
190
|
+
// Version bumps are only meaningful for live edits — serve-time graph
|
|
191
|
+
// warm-ups and the initial bulk walk should leave the version stable.
|
|
192
|
+
const bumpVersion = shouldBumpGraphVersion(classification, options?.bumpVersion !== false);
|
|
193
|
+
if (bumpVersion) {
|
|
194
|
+
this._version++;
|
|
195
|
+
}
|
|
196
|
+
const gm = { id, deps: normDeps, hash };
|
|
197
|
+
this.modules.set(id, gm);
|
|
198
|
+
if (this.deps.verbose) {
|
|
199
|
+
console.log('[hmr-ws][graph] upsert', { id, deps: normDeps, hash, graphVersion: this._version, classification, bumpVersion });
|
|
200
|
+
console.log('[hmr-ws][graph] size', this.modules.size);
|
|
201
|
+
}
|
|
202
|
+
if (shouldBroadcastGraphUpsertDelta(classification, options?.emitDeltaOnInsert === true, options?.broadcastDelta !== false)) {
|
|
203
|
+
this.emitDelta([gm], []);
|
|
204
|
+
}
|
|
205
|
+
return gm;
|
|
206
|
+
}
|
|
207
|
+
remove(id) {
|
|
208
|
+
if (!this.modules.has(id))
|
|
209
|
+
return;
|
|
210
|
+
this.modules.delete(id);
|
|
211
|
+
this._version++;
|
|
212
|
+
this.emitDelta([], [id]);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
//# sourceMappingURL=hmr-module-graph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hmr-module-graph.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/hmr-module-graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3H,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,sBAAsB,GAAG,GAAG,wBAAwB,EAAE,GAAG,CAAC;AAwBhE,+EAA+E;AAC/E,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,mCAAmC;AACnC,MAAM,OAAO,cAAc;IAM1B,YAA6B,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;QAL5C,YAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;QAClD,sFAAsF;QACrE,eAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;QAClD,aAAQ,GAAG,CAAC,CAAC;IAEmC,CAAC;IAEzD,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,GAAG,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,WAAW,CAAC,OAAe;QAC1B,OAAO,IAAI,CAAC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S,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Import Map Generator for NativeScript HMR
|
|
3
3
|
*
|
|
4
4
|
* Generates an import map that the iOS/Android runtime consumes via
|
|
5
|
-
*
|
|
5
|
+
* __NS_DEV__.configureRuntime(). This is the single source of truth for module
|
|
6
6
|
* resolution on the device.
|
|
7
7
|
*
|
|
8
8
|
* Resolution strategy:
|
|
@@ -20,14 +20,23 @@
|
|
|
20
20
|
* then looks them up in this map. This ensures ALL imports — regardless of
|
|
21
21
|
* how Vite rewrites them — resolve through a single deterministic path.
|
|
22
22
|
*/
|
|
23
|
+
import type { FrameworkServerStrategy } from './framework-strategy.js';
|
|
23
24
|
export interface ImportMap {
|
|
24
25
|
imports: Record<string, string>;
|
|
25
26
|
}
|
|
26
27
|
export interface ImportMapOptions {
|
|
27
28
|
/** Origin of the Vite dev server (e.g. "http://192.168.1.5:5173") */
|
|
28
29
|
origin: string;
|
|
29
|
-
/** Framework flavor (vue, angular, solid, typescript) */
|
|
30
|
+
/** Framework flavor (vue, angular, solid, typescript) — framework identity. */
|
|
30
31
|
flavor: string;
|
|
32
|
+
/**
|
|
33
|
+
* Active framework strategy. Its `importMapEntries(origin)` +
|
|
34
|
+
* `volatilePatterns()` hooks supply the framework-specific pieces of the
|
|
35
|
+
* import map and volatile-pattern list.
|
|
36
|
+
* Optional: when omitted, the map/patterns carry only the shared
|
|
37
|
+
* vendor/core/HTTP entries.
|
|
38
|
+
*/
|
|
39
|
+
strategy?: FrameworkServerStrategy;
|
|
31
40
|
/** Additional entries to add to the import map */
|
|
32
41
|
extraEntries?: Record<string, string>;
|
|
33
42
|
}
|
|
@@ -54,10 +63,10 @@ export declare function generateImportMap(options: ImportMapOptions): ImportMap;
|
|
|
54
63
|
* These patterns tell the runtime to always re-fetch matching URLs
|
|
55
64
|
* instead of using cached modules.
|
|
56
65
|
*/
|
|
57
|
-
export declare function getVolatilePatterns(
|
|
66
|
+
export declare function getVolatilePatterns(strategy?: FrameworkServerStrategy): string[];
|
|
58
67
|
/**
|
|
59
68
|
* Serialize the import map + volatile patterns into the config object
|
|
60
|
-
* that
|
|
69
|
+
* that __NS_DEV__.configureRuntime() expects.
|
|
61
70
|
*/
|
|
62
71
|
export declare function buildRuntimeConfig(options: ImportMapOptions): {
|
|
63
72
|
importMap: string;
|