@nativescript/vite 8.0.0-alpha.7 → 8.0.0-alpha.70
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 +293 -172
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +177 -110
- 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-refresh.d.ts +31 -0
- package/helpers/app-css-refresh.js +43 -0
- package/helpers/app-css-refresh.js.map +1 -0
- package/helpers/app-css-state.d.ts +17 -0
- package/helpers/app-css-state.js +51 -0
- package/helpers/app-css-state.js.map +1 -0
- package/helpers/bundler-context.d.ts +11 -0
- package/helpers/bundler-context.js +71 -0
- package/helpers/bundler-context.js.map +1 -0
- package/helpers/cli-flags.d.ts +12 -0
- package/helpers/cli-flags.js +34 -0
- package/helpers/cli-flags.js.map +1 -1
- package/helpers/css-platform-plugin.d.ts +14 -0
- package/helpers/css-platform-plugin.js +43 -25
- package/helpers/css-platform-plugin.js.map +1 -1
- package/helpers/dev-host.d.ts +360 -0
- package/helpers/dev-host.js +694 -0
- package/helpers/dev-host.js.map +1 -0
- package/helpers/dynamic-import-plugin.js +9 -4
- package/helpers/dynamic-import-plugin.js.map +1 -1
- package/helpers/esbuild-platform-resolver.js +4 -1
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +10 -12
- package/helpers/external-configs.js +58 -35
- package/helpers/external-configs.js.map +1 -1
- package/helpers/flavor.d.ts +13 -0
- package/helpers/flavor.js +17 -0
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +101 -33
- package/helpers/global-defines.js +187 -64
- 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 +366 -47
- package/helpers/main-entry.js.map +1 -1
- package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
- package/helpers/nativeclass-esbuild-plugin.js +6 -1
- package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
- package/helpers/nativeclass-transform.d.ts +13 -0
- package/helpers/nativeclass-transform.js +37 -7
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
- package/helpers/nativeclass-transformer-plugin.js +163 -15
- package/helpers/nativeclass-transformer-plugin.js.map +1 -1
- package/helpers/nativescript-package-resolver.js +10 -62
- package/helpers/nativescript-package-resolver.js.map +1 -1
- package/helpers/normalize-id.d.ts +42 -0
- package/helpers/normalize-id.js +60 -0
- package/helpers/normalize-id.js.map +1 -0
- package/helpers/ns-core-external-urls.d.ts +32 -0
- package/helpers/ns-core-external-urls.js +107 -0
- package/helpers/ns-core-external-urls.js.map +1 -0
- package/helpers/ns-core-url.d.ts +26 -3
- package/helpers/ns-core-url.js +66 -8
- 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 +4 -4
- package/helpers/typescript-check.js.map +1 -1
- package/helpers/ui-registration.d.ts +21 -0
- package/helpers/ui-registration.js +156 -0
- package/helpers/ui-registration.js.map +1 -0
- package/helpers/utils.d.ts +9 -0
- package/helpers/utils.js +22 -2
- package/helpers/utils.js.map +1 -1
- package/helpers/vite-package-version.d.ts +7 -0
- package/helpers/vite-package-version.js +44 -0
- package/helpers/vite-package-version.js.map +1 -0
- package/helpers/workers.d.ts +40 -19
- package/helpers/workers.js +324 -13
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +63 -32
- 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 +87 -0
- package/hmr/client/framework-client-strategy.js +18 -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 +2 -11
- 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 +307 -0
- package/hmr/client/hot-context.js.map +1 -0
- package/hmr/client/index.d.ts +9 -1
- package/hmr/client/index.js +70 -1970
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/overlay-driver.d.ts +10 -0
- package/hmr/client/overlay-driver.js +33 -0
- package/hmr/client/overlay-driver.js.map +1 -0
- package/hmr/client/protocol-dispatch.d.ts +8 -0
- package/hmr/client/protocol-dispatch.js +308 -0
- package/hmr/client/protocol-dispatch.js.map +1 -0
- package/hmr/client/root-reset.d.ts +15 -0
- package/hmr/client/root-reset.js +358 -0
- package/hmr/client/root-reset.js.map +1 -0
- package/hmr/client/strategy-loader.d.ts +24 -0
- package/hmr/client/strategy-loader.js +83 -0
- package/hmr/client/strategy-loader.js.map +1 -0
- package/hmr/client/update-pipeline.d.ts +27 -0
- package/hmr/client/update-pipeline.js +464 -0
- package/hmr/client/update-pipeline.js.map +1 -0
- package/hmr/client/utils.d.ts +9 -1
- package/hmr/client/utils.js +117 -97
- package/hmr/client/utils.js.map +1 -1
- package/hmr/client/ws-transport.d.ts +21 -0
- package/hmr/client/ws-transport.js +323 -0
- package/hmr/client/ws-transport.js.map +1 -0
- package/hmr/entry-runtime.d.ts +2 -1
- package/hmr/entry-runtime.js +282 -71
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
- package/hmr/frameworks/angular/build/angular-linker.js +113 -0
- package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
- package/{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/linker-stats.d.ts +18 -0
- package/hmr/frameworks/angular/build/linker-stats.js +29 -0
- package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
- package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
- package/hmr/frameworks/angular/build/shared-linker.js +128 -0
- package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.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/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
- package/hmr/frameworks/angular/build/util.js +155 -0
- package/hmr/frameworks/angular/build/util.js.map +1 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
- package/hmr/frameworks/angular/client/index.d.ts +0 -1
- package/hmr/frameworks/angular/client/index.js +459 -223
- 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/ng-component-route.d.ts +43 -0
- package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
- package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
- package/hmr/frameworks/angular/server/strategy.js +677 -13
- 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 +28 -11
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +191 -105
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
- package/hmr/frameworks/react/client/strategy.d.ts +12 -0
- package/hmr/frameworks/react/client/strategy.js +27 -0
- package/hmr/frameworks/react/client/strategy.js.map +1 -0
- package/hmr/frameworks/react/server/strategy.d.ts +2 -0
- package/hmr/frameworks/react/server/strategy.js +230 -0
- package/hmr/frameworks/react/server/strategy.js.map +1 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
- package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
- package/hmr/frameworks/solid/client/app-runtime.js +252 -0
- package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
- package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
- package/hmr/frameworks/solid/client/strategy.js +391 -0
- package/hmr/frameworks/solid/client/strategy.js.map +1 -0
- package/hmr/frameworks/solid/server/strategy.js +293 -16
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
- package/hmr/frameworks/typescript/client/strategy.js +418 -0
- package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
- package/hmr/frameworks/typescript/server/strategy.js +40 -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 +10 -1
- package/hmr/frameworks/vue/client/index.js +287 -562
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
- package/hmr/frameworks/vue/client/navigate-app.js +178 -0
- package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
- package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
- package/hmr/frameworks/vue/client/strategy.js +152 -0
- package/hmr/frameworks/vue/client/strategy.js.map +1 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
- package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
- package/hmr/frameworks/vue/server/compiler.js +3 -1
- package/hmr/frameworks/vue/server/compiler.js.map +1 -1
- package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
- package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
- package/hmr/frameworks/vue/server/strategy.js +291 -7
- package/hmr/frameworks/vue/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
- package/hmr/helpers/ast-normalizer.d.ts +3 -1
- package/hmr/helpers/ast-normalizer.js +109 -14
- package/hmr/helpers/ast-normalizer.js.map +1 -1
- package/hmr/helpers/cjs-named-exports.d.ts +23 -0
- package/hmr/helpers/cjs-named-exports.js +152 -0
- package/hmr/helpers/cjs-named-exports.js.map +1 -0
- package/hmr/helpers/package-exports.d.ts +16 -0
- package/hmr/helpers/package-exports.js +396 -0
- package/hmr/helpers/package-exports.js.map +1 -0
- package/hmr/helpers/vendor-rewrite.d.ts +1 -1
- package/hmr/helpers/vendor-rewrite.js +5 -3
- package/hmr/helpers/vendor-rewrite.js.map +1 -1
- package/hmr/server/boot-recording.d.ts +51 -0
- package/hmr/server/boot-recording.js +214 -0
- package/hmr/server/boot-recording.js.map +1 -0
- package/hmr/server/constants.js +20 -5
- package/hmr/server/constants.js.map +1 -1
- package/hmr/server/content-css-update.d.ts +54 -0
- package/hmr/server/content-css-update.js +78 -0
- package/hmr/server/content-css-update.js.map +1 -0
- package/hmr/server/core-bundle.d.ts +140 -0
- package/hmr/server/core-bundle.js +614 -0
- package/hmr/server/core-bundle.js.map +1 -0
- package/hmr/server/core-sanitize.d.ts +86 -7
- package/hmr/server/core-sanitize.js +164 -39
- package/hmr/server/core-sanitize.js.map +1 -1
- package/hmr/server/css-connect-sync.d.ts +28 -0
- package/hmr/server/css-connect-sync.js +59 -0
- package/hmr/server/css-connect-sync.js.map +1 -0
- package/hmr/server/css-device-module.d.ts +28 -0
- package/hmr/server/css-device-module.js +44 -0
- package/hmr/server/css-device-module.js.map +1 -0
- package/hmr/server/css-update-message.d.ts +23 -0
- package/hmr/server/css-update-message.js +41 -0
- package/hmr/server/css-update-message.js.map +1 -0
- package/hmr/server/deps-bundle.d.ts +233 -0
- package/hmr/server/deps-bundle.js +1022 -0
- package/hmr/server/deps-bundle.js.map +1 -0
- package/hmr/server/device-transform-helpers.d.ts +24 -0
- package/hmr/server/device-transform-helpers.js +408 -0
- package/hmr/server/device-transform-helpers.js.map +1 -0
- package/hmr/server/framework-strategy.d.ts +182 -11
- package/hmr/server/hmr-module-graph.d.ts +37 -0
- package/hmr/server/hmr-module-graph.js +215 -0
- package/hmr/server/hmr-module-graph.js.map +1 -0
- package/hmr/server/import-map.d.ts +51 -19
- package/hmr/server/import-map.js +136 -66
- 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/node-builtins-route.d.ts +12 -0
- package/hmr/server/node-builtins-route.js +86 -0
- package/hmr/server/node-builtins-route.js.map +1 -0
- package/hmr/server/ns-core-cjs-shape.js +1 -1
- 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 +1 -1
- package/hmr/server/perf-instrumentation.js +3 -1
- package/hmr/server/perf-instrumentation.js.map +1 -1
- package/hmr/server/process-code-for-device.d.ts +44 -0
- package/hmr/server/process-code-for-device.js +834 -0
- package/hmr/server/process-code-for-device.js.map +1 -0
- package/hmr/server/require-guard.d.ts +1 -0
- package/hmr/server/require-guard.js +12 -0
- package/hmr/server/require-guard.js.map +1 -0
- package/hmr/server/rewrite-imports.d.ts +2 -0
- package/hmr/server/rewrite-imports.js +631 -0
- package/hmr/server/rewrite-imports.js.map +1 -0
- package/hmr/server/route-helpers.d.ts +7 -0
- package/hmr/server/route-helpers.js +13 -0
- package/hmr/server/route-helpers.js.map +1 -0
- package/hmr/server/runtime-graph-filter.js +8 -1
- package/hmr/server/runtime-graph-filter.js.map +1 -1
- package/hmr/server/server-origin.d.ts +2 -0
- package/hmr/server/server-origin.js +88 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/shared-transform-request.js +1 -2
- package/hmr/server/shared-transform-request.js.map +1 -1
- package/hmr/server/socket-utils.d.ts +10 -0
- package/hmr/server/socket-utils.js +14 -0
- package/hmr/server/socket-utils.js.map +1 -0
- package/hmr/server/transform-cache-invalidation.d.ts +37 -0
- package/hmr/server/transform-cache-invalidation.js +156 -0
- package/hmr/server/transform-cache-invalidation.js.map +1 -0
- package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
- package/hmr/server/vendor-bare-module-shims.js +80 -0
- package/hmr/server/vendor-bare-module-shims.js.map +1 -0
- package/hmr/server/vite-plugin.d.ts +1 -0
- package/hmr/server/vite-plugin.js +227 -53
- 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 -49
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- 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 +2 -16
- package/hmr/server/websocket-hmr-pending.js +0 -22
- package/hmr/server/websocket-hmr-pending.js.map +1 -1
- package/hmr/server/websocket-hot-update.d.ts +80 -0
- package/hmr/server/websocket-hot-update.js +295 -0
- package/hmr/server/websocket-hot-update.js.map +1 -0
- package/hmr/server/websocket-import-map-route.d.ts +15 -0
- package/hmr/server/websocket-import-map-route.js +51 -0
- package/hmr/server/websocket-import-map-route.js.map +1 -0
- package/hmr/server/websocket-module-bindings.d.ts +15 -0
- package/hmr/server/websocket-module-bindings.js +38 -5
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-module-specifiers.d.ts +66 -7
- package/hmr/server/websocket-module-specifiers.js +219 -49
- 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 +19 -3
- package/hmr/server/websocket-ns-m-paths.js +98 -75
- package/hmr/server/websocket-ns-m-paths.js.map +1 -1
- package/hmr/server/websocket-ns-m-request.d.ts +13 -2
- package/hmr/server/websocket-ns-m-request.js +20 -11
- 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 +590 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +57 -4
- package/hmr/server/websocket-served-module-helpers.js +462 -141
- 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 -40
- package/hmr/server/websocket.js +653 -6734
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +106 -0
- package/hmr/shared/ns-globals.js +29 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/protocol.d.ts +157 -0
- package/hmr/shared/protocol.js +28 -0
- package/hmr/shared/protocol.js.map +1 -0
- package/hmr/shared/runtime/boot-complete.d.ts +14 -0
- package/hmr/shared/runtime/boot-complete.js +32 -0
- package/hmr/shared/runtime/boot-complete.js.map +1 -0
- package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
- package/hmr/shared/runtime/boot-progress.d.ts +44 -0
- package/hmr/shared/runtime/boot-progress.js +134 -0
- package/hmr/shared/runtime/boot-progress.js.map +1 -0
- package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
- package/hmr/shared/runtime/boot-timeline.js +8 -19
- package/hmr/shared/runtime/boot-timeline.js.map +1 -1
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +43 -24
- package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
- package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
- package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
- package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
- package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
- package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
- package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
- package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay.d.ts +23 -69
- package/hmr/shared/runtime/dev-overlay.js +67 -1023
- 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/launch-bridge.d.ts +9 -0
- package/hmr/shared/runtime/launch-bridge.js +98 -0
- package/hmr/shared/runtime/launch-bridge.js.map +1 -0
- package/hmr/shared/runtime/module-provenance.js +4 -6
- package/hmr/shared/runtime/module-provenance.js.map +1 -1
- package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
- package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
- package/hmr/shared/runtime/overlay-flag.js +34 -0
- package/hmr/shared/runtime/overlay-flag.js.map +1 -0
- package/hmr/shared/runtime/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 +401 -206
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +203 -58
- 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/runtime/vendor-resolve.d.ts +22 -0
- package/hmr/shared/runtime/vendor-resolve.js +45 -0
- package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
- package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
- package/hmr/shared/vendor/manifest-collect.js +909 -0
- package/hmr/shared/vendor/manifest-collect.js.map +1 -0
- package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
- package/hmr/shared/vendor/manifest-loader.js +5 -3
- package/hmr/shared/vendor/manifest-loader.js.map +1 -1
- package/hmr/shared/vendor/manifest.d.ts +12 -7
- package/hmr/shared/vendor/manifest.js +180 -826
- 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 +107 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +5 -0
- package/index.js.map +1 -1
- package/package.json +65 -13
- package/runtime/core-aliases-early.js +28 -57
- 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/module-runner-patch.d.ts +0 -3
- package/helpers/module-runner-patch.js +0 -63
- package/helpers/module-runner-patch.js.map +0 -1
- package/helpers/prelink-angular.d.ts +0 -2
- package/helpers/prelink-angular.js +0 -117
- package/helpers/prelink-angular.js.map +0 -1
- package/hmr/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 -287
- 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/hmr/shared/runtime/http-only-boot.d.ts +0 -2
- package/hmr/shared/runtime/http-only-boot.js +0 -171
- package/hmr/shared/runtime/http-only-boot.js.map +0 -1
- package/hmr/vendor-bootstrap.d.ts +0 -3
- package/hmr/vendor-bootstrap.js +0 -32
- package/hmr/vendor-bootstrap.js.map +0 -1
- package/shims/react-reconciler-constants.d.ts +0 -14
- package/shims/react-reconciler-constants.js +0 -21
- package/shims/react-reconciler-constants.js.map +0 -1
- package/shims/react-reconciler.d.ts +0 -8
- package/shims/react-reconciler.js +0 -15
- package/shims/react-reconciler.js.map +0 -1
- package/transformers/NativeClass/index.d.ts +0 -2
- package/transformers/NativeClass/index.js +0 -222
- package/transformers/NativeClass/index.js.map +0 -1
- /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
package/hmr/server/import-map.js
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
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:runtime configureRuntime(). This is the single source of truth for module
|
|
6
6
|
* resolution on the device.
|
|
7
7
|
*
|
|
8
8
|
* Resolution strategy:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Every bare npm specifier → HTTP URL (`/ns/m/node_modules/<pkg>`).
|
|
10
|
+
* Package roots in the vendor collection get EXACT entries whose served
|
|
11
|
+
* body is a deps-bundle shim (see deps-bundle.ts), so "many specifiers,
|
|
12
|
+
* one instance" holds via the single bundle realm — no custom URL scheme.
|
|
13
13
|
* @nativescript/core → HTTP bridge URL (/ns/core)
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* like @nativescript/tanstack-router/solid resolve correctly via HTTP.
|
|
14
|
+
* Trailing-slash prefix entries cover subpath imports
|
|
15
|
+
* (e.g. @nativescript/tanstack-router/solid) for every package.
|
|
17
16
|
*
|
|
18
17
|
* The runtime's NormalizeViteSpecifier() extracts bare package names from
|
|
19
18
|
* Vite-rewritten paths (e.g. /node_modules/.vite/deps/solid-js.js → solid-js),
|
|
@@ -21,10 +20,11 @@
|
|
|
21
20
|
* how Vite rewrites them — resolve through a single deterministic path.
|
|
22
21
|
*/
|
|
23
22
|
import { getVendorManifest, listVendorModules } from '../shared/vendor/registry.js';
|
|
24
|
-
import { readFileSync, readdirSync, existsSync } from 'fs';
|
|
23
|
+
import { readFileSync, readdirSync, existsSync, statSync } from 'fs';
|
|
25
24
|
import { resolve, join } from 'path';
|
|
26
25
|
import { getProjectRootPath } from '../../helpers/project.js';
|
|
27
26
|
import { buildCoreUrl } from '../../helpers/ns-core-url.js';
|
|
27
|
+
import { getNodeBuiltinImportMapEntries } from './node-builtins-route.js';
|
|
28
28
|
const OMIT_DEVICE_IMPORT_MAP_PACKAGES = new Set(['typescript', 'ts-node', 'esbuild', 'prettier', 'webpack', 'vite', '@nativescript/android', '@nativescript/ios', '@nativescript/visionos', '@nativescript/webpack', '@nativescript/types']);
|
|
29
29
|
const OMIT_DEVICE_IMPORT_MAP_PREFIXES = ['@types/', '@babel/', 'babel-', '@rollup/', '@vitejs/', 'vite-plugin-', '@angular-devkit/', '@angular/build', '@analogjs/'];
|
|
30
30
|
const PREFIX_ONLY_DEVICE_IMPORT_MAP_PACKAGES = new Set(['@nativescript/vite']);
|
|
@@ -45,34 +45,55 @@ function getDeviceImportMapExposure(name) {
|
|
|
45
45
|
/**
|
|
46
46
|
* Generate an import map from the current vendor manifest.
|
|
47
47
|
*
|
|
48
|
-
* Vendor
|
|
49
|
-
*
|
|
50
|
-
*
|
|
48
|
+
* Vendor package roots map to `${origin}/ns/m/node_modules/<pkg>` — served
|
|
49
|
+
* as deps-bundle shims (thin re-exports out of `__NS_DEPS_MODULES__`, the
|
|
50
|
+
* single-evaluation bundle realm), so every specifier of a package resolves
|
|
51
|
+
* to one instance. Manifest aliases collapse onto their canonical package's
|
|
52
|
+
* URL, preserving the "many specifiers, one instance" semantics.
|
|
51
53
|
*
|
|
52
54
|
* IMPORTANT: Vendor entries are EXACT only (no trailing-slash prefixes).
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* module. Instead, they fall through to the HTTP trailing-slash prefix
|
|
55
|
+
* Subpath imports like solid-js/store or @nativescript/tanstack-router/solid
|
|
56
|
+
* are separate entry points with different exports — they must NOT resolve
|
|
57
|
+
* to the package root. They fall through to the HTTP trailing-slash prefix
|
|
57
58
|
* entries from discoverInstalledPackages().
|
|
58
59
|
*
|
|
59
60
|
* @nativescript/core is mapped to the HTTP bridge endpoint.
|
|
60
61
|
* Everything else falls through to the runtime's normal resolution.
|
|
61
62
|
*/
|
|
62
63
|
export function generateImportMap(options) {
|
|
63
|
-
const { origin,
|
|
64
|
+
const { origin, strategy, extraEntries } = options;
|
|
64
65
|
const manifest = getVendorManifest();
|
|
65
66
|
const imports = {};
|
|
66
67
|
if (manifest) {
|
|
67
|
-
//
|
|
68
|
-
//
|
|
68
|
+
// EXACT entries only for vendor roots — subpaths resolve via the
|
|
69
|
+
// trailing-slash HTTP prefixes added below.
|
|
70
|
+
//
|
|
71
|
+
// IMPORTANT: `@nativescript/core` and any `@nativescript/core/<sub>` are
|
|
72
|
+
// deliberately routed through the HTTP bridge (`${origin}/ns/core/...`),
|
|
73
|
+
// never through `/ns/m/node_modules/`. The core bridge is the canonical
|
|
74
|
+
// source for every `Application`, `View`, `Frame`, etc. instance —
|
|
75
|
+
// a second copy of core produces the classic
|
|
76
|
+
// `vendorApplicationSame: false` realm split (different
|
|
77
|
+
// `globalThis.Application` than the one the iOS/Android hooks patched)
|
|
78
|
+
// and HMR placeholder finalize stalls. The dev server normalizes
|
|
79
|
+
// platform suffixes (see `normalizeCoreSub` in `ns-core-url.ts`) so
|
|
80
|
+
// `@nativescript/core/ui/frame/activity.android` → bridge URL
|
|
81
|
+
// `/ns/core/ui/frame/activity.android` → served from the
|
|
82
|
+
// platform-specific `.android.ts` source.
|
|
69
83
|
const vendorModules = listVendorModules();
|
|
70
84
|
for (const specifier of vendorModules) {
|
|
71
|
-
|
|
85
|
+
if (specifier === '@nativescript/core' || specifier.startsWith('@nativescript/core/')) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
imports[specifier] = `${origin}/ns/m/node_modules/${specifier}`;
|
|
72
89
|
}
|
|
73
|
-
// Map aliases from the manifest (e.g., "solid-js/web" →
|
|
90
|
+
// Map aliases from the manifest (e.g., "solid-js/web" → solid-js's URL)
|
|
74
91
|
if (manifest.aliases) {
|
|
75
92
|
for (const [alias, canonical] of Object.entries(manifest.aliases)) {
|
|
93
|
+
// Same single-realm reason as above.
|
|
94
|
+
if (alias === '@nativescript/core' || alias.startsWith('@nativescript/core/')) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
76
97
|
if (!imports[alias] && imports[canonical]) {
|
|
77
98
|
imports[alias] = imports[canonical];
|
|
78
99
|
}
|
|
@@ -84,8 +105,25 @@ export function generateImportMap(options) {
|
|
|
84
105
|
// subpath imports resolve via `${origin}/ns/core/<sub>`.
|
|
85
106
|
imports['@nativescript/core'] = buildCoreUrl(origin);
|
|
86
107
|
imports['@nativescript/core/'] = `${buildCoreUrl(origin)}/`;
|
|
87
|
-
//
|
|
88
|
-
|
|
108
|
+
// `node:` builtins → dev-served shims (`/ns/node/<name>`, see
|
|
109
|
+
// node-builtins-route.ts). During a dev session these map entries
|
|
110
|
+
// shadow the runtime's baked-in polyfill branch, keeping the shim
|
|
111
|
+
// vocabulary server-owned; outside dev sessions the native fallback
|
|
112
|
+
// still applies.
|
|
113
|
+
Object.assign(imports, getNodeBuiltinImportMapEntries(origin));
|
|
114
|
+
// Add framework-specific entries (owned by the active strategy). Merge
|
|
115
|
+
// CONDITIONALLY (existing entries win) so Vue's vendor entries (set above)
|
|
116
|
+
// take precedence over the hook's fallback targets, while Solid's
|
|
117
|
+
// `solid-js` (externalized from vendor, so unset here) is added.
|
|
118
|
+
// Insertion order is significant for the generated map.
|
|
119
|
+
const frameworkEntries = strategy?.importMapEntries?.(origin);
|
|
120
|
+
if (frameworkEntries) {
|
|
121
|
+
for (const [specifier, target] of Object.entries(frameworkEntries)) {
|
|
122
|
+
if (!imports[specifier]) {
|
|
123
|
+
imports[specifier] = target;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
89
127
|
// Scan installed packages and add HTTP URL entries for ALL packages
|
|
90
128
|
// (including vendor ones for their subpath imports).
|
|
91
129
|
discoverInstalledPackages(imports, origin);
|
|
@@ -100,67 +138,67 @@ export function generateImportMap(options) {
|
|
|
100
138
|
* These patterns tell the runtime to always re-fetch matching URLs
|
|
101
139
|
* instead of using cached modules.
|
|
102
140
|
*/
|
|
103
|
-
export function getVolatilePatterns(
|
|
141
|
+
export function getVolatilePatterns(strategy) {
|
|
104
142
|
const patterns = [];
|
|
105
143
|
// Version query params (used by HMR for cache busting)
|
|
106
144
|
patterns.push('?v=');
|
|
107
145
|
patterns.push('&v=');
|
|
108
|
-
// Framework-specific volatile patterns
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
break;
|
|
115
|
-
case 'angular':
|
|
116
|
-
// Angular template/style URLs may change on edit
|
|
117
|
-
patterns.push('/@ns/asm/');
|
|
118
|
-
break;
|
|
146
|
+
// Framework-specific volatile patterns (owned by the active strategy —
|
|
147
|
+
// e.g. Angular's `/@ng/component`, whose per-save `t` param would
|
|
148
|
+
// otherwise leave one stale registry entry behind per save).
|
|
149
|
+
const frameworkPatterns = strategy?.volatilePatterns?.();
|
|
150
|
+
if (frameworkPatterns) {
|
|
151
|
+
patterns.push(...frameworkPatterns);
|
|
119
152
|
}
|
|
120
153
|
return patterns;
|
|
121
154
|
}
|
|
122
155
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
156
|
+
* The URL canonicalization vocabulary handed to the runtime via
|
|
157
|
+
* `configureRuntime({ canonicalization })`. The runtime owns the *mechanism*
|
|
158
|
+
* (fragment strip, cache-buster param drop, param sort — it keys the module
|
|
159
|
+
* registry inside the engine's synchronous resolve walk); this server owns
|
|
160
|
+
* the *vocabulary*, because every name in it is a route this server defines:
|
|
161
|
+
*
|
|
162
|
+
* - `stripParams`: Vite's `import` marker and `t`/`v` cache stamps — pure
|
|
163
|
+
* cache busters that must not create distinct module identities.
|
|
164
|
+
* - `forPathPrefixes`: the dev endpoints under which query normalization is
|
|
165
|
+
* safe. Everything else (public/remote URLs) keeps its query verbatim,
|
|
166
|
+
* since for general HTTP modules the query can be identity (auth,
|
|
167
|
+
* content versioning, routing).
|
|
168
|
+
* - `preserveQueryFor`: strategy-owned paths whose query IS the module
|
|
169
|
+
* identity (e.g. Angular's `/@ng/component?c=<id>&t=<ts>` — each `t` is a
|
|
170
|
+
* distinct metadata recompile).
|
|
171
|
+
*/
|
|
172
|
+
export function getCanonicalization(strategy) {
|
|
173
|
+
return {
|
|
174
|
+
stripParams: ['t', 'v', 'import'],
|
|
175
|
+
forPathPrefixes: ['/ns/', '/node_modules/.vite/', '/@id/', '/@fs/'],
|
|
176
|
+
preserveQueryFor: strategy?.preserveQueryPaths?.() ?? [],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Serialize the import map + volatile patterns + canonicalization vocabulary
|
|
181
|
+
* into the config object that ns:runtime configureRuntime() expects.
|
|
125
182
|
*/
|
|
126
183
|
export function buildRuntimeConfig(options) {
|
|
127
184
|
const importMap = generateImportMap(options);
|
|
128
|
-
const volatilePatterns = getVolatilePatterns(options.
|
|
185
|
+
const volatilePatterns = getVolatilePatterns(options.strategy);
|
|
186
|
+
const canonicalization = getCanonicalization(options.strategy);
|
|
129
187
|
return {
|
|
130
188
|
importMap: JSON.stringify(importMap),
|
|
131
189
|
volatilePatterns,
|
|
190
|
+
canonicalization,
|
|
132
191
|
};
|
|
133
192
|
}
|
|
134
|
-
function addFrameworkEntries(imports, _origin, flavor) {
|
|
135
|
-
switch (flavor) {
|
|
136
|
-
case 'vue':
|
|
137
|
-
// nativescript-vue should resolve from vendor if available
|
|
138
|
-
if (!imports['nativescript-vue']) {
|
|
139
|
-
imports['nativescript-vue'] = `ns-vendor://nativescript-vue`;
|
|
140
|
-
}
|
|
141
|
-
if (!imports['vue']) {
|
|
142
|
-
imports['vue'] = `ns-vendor://vue`;
|
|
143
|
-
}
|
|
144
|
-
break;
|
|
145
|
-
case 'solid':
|
|
146
|
-
// Solid runtime root should resolve from vendor
|
|
147
|
-
if (!imports['solid-js']) {
|
|
148
|
-
imports['solid-js'] = `ns-vendor://solid-js`;
|
|
149
|
-
}
|
|
150
|
-
// No trailing-slash prefix — subpaths like solid-js/store,
|
|
151
|
-
// solid-js/jsx-runtime resolve via HTTP from discoverInstalledPackages()
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
193
|
/**
|
|
156
194
|
* Scan the project's node_modules to discover ALL installed packages and
|
|
157
195
|
* add import map entries. Vendor packages get only trailing-slash prefix
|
|
158
|
-
* entries (their exact entries
|
|
159
|
-
*
|
|
196
|
+
* entries (their exact entries were set above). Non-vendor packages get
|
|
197
|
+
* both exact and trailing-slash entries.
|
|
160
198
|
*
|
|
161
199
|
* The trailing-slash prefix entries are critical: they enable subpath imports
|
|
162
200
|
* like solid-js/store or @nativescript/tanstack-router/solid to resolve via
|
|
163
|
-
* HTTP, even when the root package
|
|
201
|
+
* HTTP, even when the root package has a deps-shim exact entry.
|
|
164
202
|
*/
|
|
165
203
|
function discoverInstalledPackages(imports, origin) {
|
|
166
204
|
let projectRoot;
|
|
@@ -177,7 +215,7 @@ function discoverInstalledPackages(imports, origin) {
|
|
|
177
215
|
const exposure = getDeviceImportMapExposure(name);
|
|
178
216
|
if (exposure === 'omit')
|
|
179
217
|
return;
|
|
180
|
-
// Add exact entry only if not already mapped (vendor packages already have
|
|
218
|
+
// Add exact entry only if not already mapped (vendor packages already have exact entries)
|
|
181
219
|
if (exposure === 'full' && !imports[name]) {
|
|
182
220
|
imports[name] = `${origin}/ns/m/node_modules/${name}`;
|
|
183
221
|
}
|
|
@@ -189,6 +227,32 @@ function discoverInstalledPackages(imports, origin) {
|
|
|
189
227
|
imports[name + '/'] = `${origin}/ns/m/node_modules/${name}/`;
|
|
190
228
|
}
|
|
191
229
|
};
|
|
230
|
+
// Replay the (cheap, in-memory) addPackage step for every installed package
|
|
231
|
+
// name. The names themselves come from a per-session cache so the directory
|
|
232
|
+
// sweep below runs once per dev server, not on every `/ns/import-map.json`
|
|
233
|
+
// request (a hot, per-boot route).
|
|
234
|
+
for (const name of getInstalledPackageNames(nodeModulesDir)) {
|
|
235
|
+
addPackage(name);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// Cache the discovered package-name list per node_modules dir, invalidated when
|
|
239
|
+
// the directory's mtime changes (an install/remove of a top-level entry). Avoids
|
|
240
|
+
// a full `readdirSync` sweep (+ per-scope readdir) on every import-map request.
|
|
241
|
+
let installedPackageNamesCache = null;
|
|
242
|
+
function getInstalledPackageNames(nodeModulesDir) {
|
|
243
|
+
// mtime guards the cache; if it can't be read (e.g. a mocked fs in tests),
|
|
244
|
+
// fall back to sweeping every call (original behavior) rather than caching.
|
|
245
|
+
let mtimeMs = null;
|
|
246
|
+
try {
|
|
247
|
+
mtimeMs = statSync(nodeModulesDir).mtimeMs;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
mtimeMs = null;
|
|
251
|
+
}
|
|
252
|
+
if (mtimeMs !== null && installedPackageNamesCache && installedPackageNamesCache.dir === nodeModulesDir && installedPackageNamesCache.mtimeMs === mtimeMs) {
|
|
253
|
+
return installedPackageNamesCache.names;
|
|
254
|
+
}
|
|
255
|
+
const names = [];
|
|
192
256
|
try {
|
|
193
257
|
const entries = readdirSync(nodeModulesDir, { withFileTypes: true });
|
|
194
258
|
for (const entry of entries) {
|
|
@@ -207,16 +271,22 @@ function discoverInstalledPackages(imports, origin) {
|
|
|
207
271
|
continue;
|
|
208
272
|
if (scopeEntry.name.startsWith('.'))
|
|
209
273
|
continue;
|
|
210
|
-
|
|
274
|
+
names.push(`${name}/${scopeEntry.name}`);
|
|
211
275
|
}
|
|
212
276
|
}
|
|
213
277
|
catch { }
|
|
214
278
|
}
|
|
215
279
|
else {
|
|
216
|
-
|
|
280
|
+
names.push(name);
|
|
217
281
|
}
|
|
218
282
|
}
|
|
219
283
|
}
|
|
220
|
-
catch {
|
|
284
|
+
catch {
|
|
285
|
+
return [];
|
|
286
|
+
}
|
|
287
|
+
if (mtimeMs !== null) {
|
|
288
|
+
installedPackageNamesCache = { dir: nodeModulesDir, mtimeMs, names };
|
|
289
|
+
}
|
|
290
|
+
return names;
|
|
221
291
|
}
|
|
222
292
|
//# sourceMappingURL=import-map.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-map.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/import-map.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"import-map.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/import-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE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D,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACtB,0BAA0B,GAAG,EAAE,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
|
package/hmr/server/index.js
CHANGED
|
@@ -1,22 +1,13 @@
|
|
|
1
1
|
import { nsHmrClientVitePlugin } from './vite-plugin.js';
|
|
2
|
-
import {
|
|
2
|
+
import { hmrWebSocketPluginForFlavor } from './websocket.js';
|
|
3
3
|
export function getHMRPlugins(opts) {
|
|
4
4
|
const plugins = [nsHmrClientVitePlugin(opts)];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
case 'angular':
|
|
12
|
-
plugins.push(hmrWebSocketAngular(opts));
|
|
13
|
-
break;
|
|
14
|
-
case 'typescript':
|
|
15
|
-
plugins.push(hmrWebSocketTypescript(opts));
|
|
16
|
-
break;
|
|
17
|
-
case 'solid':
|
|
18
|
-
plugins.push(hmrWebSocketSolid(opts));
|
|
19
|
-
break;
|
|
5
|
+
// The server-side HMR WebSocket plugin is selected from STRATEGY_REGISTRY by
|
|
6
|
+
// flavor. Flavors without a registered server strategy (e.g. `react`) ship
|
|
7
|
+
// only the client plugin above — no per-flavor switch or no-op special case.
|
|
8
|
+
const frameworkPlugin = hmrWebSocketPluginForFlavor(opts.flavor, opts);
|
|
9
|
+
if (frameworkPlugin) {
|
|
10
|
+
plugins.push(frameworkPlugin);
|
|
20
11
|
}
|
|
21
12
|
return plugins;
|
|
22
13
|
}
|
package/hmr/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,UAAU,aAAa,CAAC,IAAmE;IAChG,MAAM,OAAO,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,6EAA6E;IAC7E,2EAA2E;IAC3E,6EAA6E;IAC7E,MAAM,eAAe,GAAG,2BAA2B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvE,IAAI,eAAe,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ViteDevServer } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Exact import-map entries mapping every `node:<name>` specifier to this
|
|
4
|
+
* route. Exact (not trailing-slash prefix) entries for two reasons: the
|
|
5
|
+
* import-map spec reserves trailing-slash keys for path prefixes, and the
|
|
6
|
+
* native resolver only intercepts `node:`-prefixed specifiers — bare 'url'
|
|
7
|
+
* must keep resolving to the npm package of that name.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getNodeBuiltinImportMapEntries(origin: string): Record<string, string>;
|
|
10
|
+
/** The module body served for `node:<name>` during a dev session. */
|
|
11
|
+
export declare function buildNodeBuiltinShimModule(name: string): string;
|
|
12
|
+
export declare function registerNodeBuiltinsRoute(server: ViteDevServer): void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { builtinModules } from 'node:module';
|
|
2
|
+
import { setDeviceModuleHeaders } from './route-helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* Dev-session shims for Node.js builtins: `GET /ns/node/<name>`.
|
|
5
|
+
*
|
|
6
|
+
* The device import map carries an exact entry for every `node:<name>`
|
|
7
|
+
* specifier (see `getNodeBuiltinImportMapEntries`), so during a dev session
|
|
8
|
+
* imports like `node:url` resolve through the map to this route BEFORE the
|
|
9
|
+
* native runtime's baked-in polyfill branch is reached. That keeps the
|
|
10
|
+
* shim *vocabulary and bodies* on the server (one place to grow/fix them)
|
|
11
|
+
* and leaves the native branch as the non-dev fallback only.
|
|
12
|
+
*
|
|
13
|
+
* Two shim shapes, mirroring the native fallback's semantics:
|
|
14
|
+
* - `node:url` — a real shim: `fileURLToPath`/`pathToFileURL` plus
|
|
15
|
+
* re-exports of the runtime's global `URL`/`URLSearchParams`.
|
|
16
|
+
* - every other builtin — a warn-stub default export, so an accidental
|
|
17
|
+
* `node:fs` import surfaces loudly in the console instead of crashing
|
|
18
|
+
* resolution.
|
|
19
|
+
*/
|
|
20
|
+
const NODE_BUILTIN_ROUTE_PREFIX = '/ns/node/';
|
|
21
|
+
// `builtinModules` lists unprefixed names ('url', 'fs', 'fs/promises', ...).
|
|
22
|
+
// A Set for O(1) route validation.
|
|
23
|
+
const nodeBuiltinNames = new Set(builtinModules.filter((name) => !name.startsWith('node:')));
|
|
24
|
+
/**
|
|
25
|
+
* Exact import-map entries mapping every `node:<name>` specifier to this
|
|
26
|
+
* route. Exact (not trailing-slash prefix) entries for two reasons: the
|
|
27
|
+
* import-map spec reserves trailing-slash keys for path prefixes, and the
|
|
28
|
+
* native resolver only intercepts `node:`-prefixed specifiers — bare 'url'
|
|
29
|
+
* must keep resolving to the npm package of that name.
|
|
30
|
+
*/
|
|
31
|
+
export function getNodeBuiltinImportMapEntries(origin) {
|
|
32
|
+
const entries = {};
|
|
33
|
+
for (const name of nodeBuiltinNames) {
|
|
34
|
+
entries[`node:${name}`] = `${origin}${NODE_BUILTIN_ROUTE_PREFIX}${name}`;
|
|
35
|
+
}
|
|
36
|
+
return entries;
|
|
37
|
+
}
|
|
38
|
+
const URL_SHIM = `// Dev-session shim for node:url — served by the @nativescript/vite dev server.
|
|
39
|
+
const _URL = globalThis.URL;
|
|
40
|
+
const _URLSearchParams = globalThis.URLSearchParams;
|
|
41
|
+
export { _URL as URL, _URLSearchParams as URLSearchParams };
|
|
42
|
+
export function fileURLToPath(url) {
|
|
43
|
+
if (typeof url === 'string') {
|
|
44
|
+
if (url.startsWith('file://')) {
|
|
45
|
+
return decodeURIComponent(url.slice(7));
|
|
46
|
+
}
|
|
47
|
+
return url;
|
|
48
|
+
}
|
|
49
|
+
if (url && typeof url.href === 'string') {
|
|
50
|
+
return fileURLToPath(url.href);
|
|
51
|
+
}
|
|
52
|
+
throw new Error('Invalid URL');
|
|
53
|
+
}
|
|
54
|
+
export function pathToFileURL(path) {
|
|
55
|
+
const encoded = encodeURIComponent(path).replace(/%2F/g, '/');
|
|
56
|
+
return new _URL('file://' + encoded);
|
|
57
|
+
}
|
|
58
|
+
export default { URL: _URL, URLSearchParams: _URLSearchParams, fileURLToPath, pathToFileURL };
|
|
59
|
+
`;
|
|
60
|
+
/** The module body served for `node:<name>` during a dev session. */
|
|
61
|
+
export function buildNodeBuiltinShimModule(name) {
|
|
62
|
+
if (name === 'url') {
|
|
63
|
+
return URL_SHIM;
|
|
64
|
+
}
|
|
65
|
+
const label = JSON.stringify(`node:${name}`);
|
|
66
|
+
return `// Dev-session warn-stub for ${name} — served by the @nativescript/vite dev server.\n` + `console.warn('[ns-vite] Node.js builtin ' + ${label} + ' is not available in the NativeScript runtime; serving an empty stub.');\n` + `export default {};\n`;
|
|
67
|
+
}
|
|
68
|
+
export function registerNodeBuiltinsRoute(server) {
|
|
69
|
+
server.middlewares.use((req, res, next) => {
|
|
70
|
+
const urlObj = new URL(req.url || '', 'http://localhost');
|
|
71
|
+
if (!urlObj.pathname.startsWith(NODE_BUILTIN_ROUTE_PREFIX))
|
|
72
|
+
return next();
|
|
73
|
+
const name = decodeURIComponent(urlObj.pathname.slice(NODE_BUILTIN_ROUTE_PREFIX.length));
|
|
74
|
+
if (!nodeBuiltinNames.has(name)) {
|
|
75
|
+
// Unknown name under /ns/node/ — not ours to serve; a 404 is more
|
|
76
|
+
// honest than a stub for a typo'd or future builtin.
|
|
77
|
+
res.statusCode = 404;
|
|
78
|
+
res.end(`// Unknown Node.js builtin: ${JSON.stringify(name)}\n`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
setDeviceModuleHeaders(res);
|
|
82
|
+
res.statusCode = 200;
|
|
83
|
+
res.end(buildNodeBuiltinShimModule(name));
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=node-builtins-route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-builtins-route.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/node-builtins-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,yBAAyB,GAAG,WAAW,CAAC;AAE9C,6EAA6E;AAC7E,mCAAmC;AACnC,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAS,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAErG;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAc;IAC5D,MAAM,OAAO,GAA2B,EAAE,CAAC;IAC3C,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACrC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC,GAAG,GAAG,MAAM,GAAG,yBAAyB,GAAG,IAAI,EAAE,CAAC;IAC1E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBhB,CAAC;AAEF,qEAAqE;AACrE,MAAM,UAAU,0BAA0B,CAAC,IAA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|
|
106
106
|
` }`,
|
|
107
|
-
`} } catch (e) {
|
|
107
|
+
`} } catch (e) { console.warn('[ns-core] shape installer failed:', (e && e.message) || e); }`,
|
|
108
108
|
].join('\n');
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ns-core-cjs-shape.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-core-cjs-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,oDAAoD;QACpD,gDAAgD;QAChD,oHAAoH;QACpH,4DAA4D;QAC5D,6DAA6D;QAC7D,wDAAwD;QACxD,+BAA+B;QAC/B,+EAA+E;QAC/E,iDAAiD;QACjD,sDAAsD;QACtD,oEAAoE;QACpE,uBAAuB;QACvB,qCAAqC;QACrC,aAAa;QACb,wCAAwC;QACxC,iDAAiD;QACjD,8BAA8B;QAC9B,oFAAoF;QACpF,WAAW;QACX,sBAAsB;QACtB,mBAAmB;QACnB,QAAQ;QACR,KAAK;QACL,
|
|
1
|
+
{"version":3,"file":"ns-core-cjs-shape.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-core-cjs-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,oDAAoD;QACpD,gDAAgD;QAChD,oHAAoH;QACpH,4DAA4D;QAC5D,6DAA6D;QAC7D,wDAAwD;QACxD,+BAA+B;QAC/B,+EAA+E;QAC/E,iDAAiD;QACjD,sDAAsD;QACtD,oEAAoE;QACpE,uBAAuB;QACvB,qCAAqC;Q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CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAChD,OAAO,oDAAoD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC7D,IAAI,wBAAwB,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,CAAC;IACvD,OAAO,CAAC,oDAAoD,EAAE,qCAAqC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACpD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnE,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type NsMResponseMemo = {
|
|
2
|
+
buildKey(spec: string, inputCode: string, context: string): string;
|
|
3
|
+
get(key: string): string | undefined;
|
|
4
|
+
set(key: string, body: string): void;
|
|
5
|
+
size(): number;
|
|
6
|
+
clear(): void;
|
|
7
|
+
};
|
|
8
|
+
export declare function createNsMResponseMemo(options?: {
|
|
9
|
+
maxEntries?: number;
|
|
10
|
+
}): NsMResponseMemo;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
export function createNsMResponseMemo(options) {
|
|
3
|
+
const maxEntries = Math.max(1, Math.floor(options?.maxEntries ?? 2000));
|
|
4
|
+
const entries = new Map();
|
|
5
|
+
return {
|
|
6
|
+
buildKey(spec, inputCode, context) {
|
|
7
|
+
const inputHash = createHash('sha1').update(inputCode).digest('hex');
|
|
8
|
+
return `${spec}\u0000${context}\u0000${inputHash}`;
|
|
9
|
+
},
|
|
10
|
+
get(key) {
|
|
11
|
+
const value = entries.get(key);
|
|
12
|
+
if (value !== undefined) {
|
|
13
|
+
// LRU touch: re-insert so iteration order tracks recency.
|
|
14
|
+
entries.delete(key);
|
|
15
|
+
entries.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
},
|
|
19
|
+
set(key, body) {
|
|
20
|
+
if (entries.has(key))
|
|
21
|
+
entries.delete(key);
|
|
22
|
+
entries.set(key, body);
|
|
23
|
+
if (entries.size > maxEntries) {
|
|
24
|
+
const oldest = entries.keys().next().value;
|
|
25
|
+
if (oldest !== undefined)
|
|
26
|
+
entries.delete(oldest);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
size: () => entries.size,
|
|
30
|
+
clear: () => entries.clear(),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ns-m-response-memo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ns-m-response-memo.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-m-response-memo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA+BzC,MAAM,UAAU,qBAAqB,CAAC,OAAiC;IACtE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,OAAO;QACN,QAAQ,CAAC,IAAY,EAAE,SAAiB,EAAE,OAAe;YACxD,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACrE,OAAO,GAAG,IAAI,SAAS,OAAO,SAAS,SAAS,EAAE,CAAC;QACpD,CAAC;QACD,GAAG,CAAC,GAAW;YACd,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC/B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzB,0DAA0D;gBAC1D,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACpB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACzB,CAAC;YACD,OAAO,KAAK,CAAC;QACd,CAAC;QACD,GAAG,CAAC,GAAW,EAAE,IAAY;YAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvB,IAAI,OAAO,CAAC,IAAI,GAAG,UAAU,EAAE,CAAC;gBAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC;gBAC3C,IAAI,MAAM,KAAK,SAAS;oBAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAClD,CAAC;QACF,CAAC;QACD,IAAI,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI;QACxB,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE;KAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface NsRtBridgeOptions {
|
|
2
|
+
/** Version segment from `/ns/rt/<ver>`. Retained for the URL dispatcher; the bridge body intentionally ignores it. */
|
|
3
|
+
rtVer: string;
|
|
4
|
+
/** Prologue installed verbatim before the bridge body (typically the require URL guard). */
|
|
5
|
+
requireGuardSnippet: string;
|
|
6
|
+
/**
|
|
7
|
+
* The discovered ESM export names of the underlying vendor package
|
|
8
|
+
* (`nativescript-vue`, including its `@vue/runtime-core` re-export
|
|
9
|
+
* chain). Each name becomes `export const <name> = (__ensure().<name>);` —
|
|
10
|
+
* a single canonical specifier (`/ns/rt`) forwards *every* symbol the
|
|
11
|
+
* vendor publishes.
|
|
12
|
+
*
|
|
13
|
+
* Required: discovery is the only source of truth. There is no hand-curated
|
|
14
|
+
* fallback — if discovery cannot see the package, the bridge serves no
|
|
15
|
+
* passthroughs and the call site is expected to surface that as a config
|
|
16
|
+
* error rather than silently degrade.
|
|
17
|
+
*/
|
|
18
|
+
vendorExports: Iterable<string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the `/ns/rt` runtime bridge module text.
|
|
22
|
+
*
|
|
23
|
+
* Single-realm policy: every named export the vendor package publishes
|
|
24
|
+
* appears as `export const X = (__ensure().X);` — a constant binding, not a
|
|
25
|
+
* function wrapper. Constant bindings preserve identity for Vue's Symbol
|
|
26
|
+
* markers (`Fragment`, `Teleport`, …) AND work transparently for functions
|
|
27
|
+
* (`ref`, `createApp`, …) since the user code calls the underlying value
|
|
28
|
+
* directly. Calling `__ensure()` at module evaluation time is safe because
|
|
29
|
+
* the vendor bundle is registered earlier in the boot graph (vendor.mjs →
|
|
30
|
+
* `__nsVendorRegistry`), and the bridge resolves the same `nativescript-vue`
|
|
31
|
+
* record everyone else uses.
|
|
32
|
+
*
|
|
33
|
+
* HMR-specific shims (`$navigateTo`, `$navigateBack`, `$showModal`) and the
|
|
34
|
+
* Vite client polyfill (`vite__injectQuery`) are emitted as overrides that
|
|
35
|
+
* replace the would-be passthrough — those exports route through the HMR
|
|
36
|
+
* navigator instead of the vendor's native version, so the bridge must
|
|
37
|
+
* provide the override, not the discovered original.
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildNsRtBridgeModule(options: NsRtBridgeOptions): string;
|
|
40
|
+
/**
|
|
41
|
+
* Resolve the set of names the bridge should re-export for `nativescript-vue`
|
|
42
|
+
* given a project root. Static discovery via `enumeratePackageExports` is the
|
|
43
|
+
* only source — there is no curated fallback. If `nativescript-vue` is not
|
|
44
|
+
* resolvable from `projectRoot`, the returned set is empty and the bridge
|
|
45
|
+
* built from it will not emit passthroughs; the caller should treat that as
|
|
46
|
+
* the misconfiguration it is rather than mask it with a stale baseline.
|
|
47
|
+
*
|
|
48
|
+
* Caching lives inside `enumeratePackageExports`, so repeated calls in a dev
|
|
49
|
+
* session are effectively free.
|
|
50
|
+
*/
|
|
51
|
+
export declare function discoverNsvBridgeExports(projectRoot: string): Set<string>;
|