@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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type { ViteDevServer } from 'vite';
|
|
1
|
+
import type { HmrContext, ViteDevServer } from 'vite';
|
|
2
|
+
import type { ServerResponse } from 'node:http';
|
|
2
3
|
import type { WebSocketServer } from 'ws';
|
|
4
|
+
import type { NsHotUpdateContext } from './websocket-hot-update.js';
|
|
3
5
|
export interface FrameworkProcessFileContext {
|
|
4
6
|
filePath: string;
|
|
5
7
|
server: ViteDevServer;
|
|
@@ -39,29 +41,198 @@ export interface FrameworkRegistryContext {
|
|
|
39
41
|
export interface FrameworkCleanContext {
|
|
40
42
|
code: string;
|
|
41
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Inputs for {@link FrameworkServerStrategy.rewriteServedModule}, mirroring the
|
|
46
|
+
* arguments the `/ns/m` served-module pipeline passes to `rewriteImports` /
|
|
47
|
+
* `prepareAngularEntryForDevice` today (the angular/else fork in
|
|
48
|
+
* `websocket-ns-m.ts`).
|
|
49
|
+
*/
|
|
50
|
+
export interface FrameworkServedModuleContext {
|
|
51
|
+
/** Resolved module specifier / URL being served (`resolvedCandidate || spec`). */
|
|
52
|
+
moduleId: string;
|
|
53
|
+
sfcFileMap: Map<string, string>;
|
|
54
|
+
depFileMap: Map<string, string>;
|
|
55
|
+
projectRoot: string;
|
|
56
|
+
serverOrigin: string;
|
|
57
|
+
verbose: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Inputs for {@link FrameworkServerStrategy.interceptModuleRequest}: the raw
|
|
61
|
+
* `/ns/m` request BEFORE spec resolution. `isLiveComponentUpdateFetch` is the
|
|
62
|
+
* live-broadcast gate injected from the WebSocket plugin's component-update
|
|
63
|
+
* ledger (Angular; undefined for other flavors).
|
|
64
|
+
*/
|
|
65
|
+
export interface FrameworkModuleRequestContext {
|
|
66
|
+
urlObj: URL;
|
|
67
|
+
res: ServerResponse;
|
|
68
|
+
next: () => void;
|
|
69
|
+
isLiveComponentUpdateFetch?: (componentId: string, timestamp: number) => boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Inputs for {@link FrameworkServerStrategy.registerRoutes}. A framework that
|
|
73
|
+
* owns dev-only HTTP endpoints (e.g. Vue's `/ns/sfc*`) registers them here;
|
|
74
|
+
* frameworks without extra endpoints leave the hook undefined (no-op default).
|
|
75
|
+
*
|
|
76
|
+
* Carries everything Vue's `registerSfcHandlers` needs (its
|
|
77
|
+
* `RegisterSfcHandlersOptions` shape): the dev server, plugin state
|
|
78
|
+
* (`sfcFileMap`/`depFileMap`/`appVirtualWithSlash`), the live graph-version
|
|
79
|
+
* accessor, and the active strategy. `wss` is included for parity with the
|
|
80
|
+
* other route registrars (the SFC handlers don't consult it today).
|
|
81
|
+
*/
|
|
82
|
+
export interface FrameworkRouteContext {
|
|
83
|
+
server: ViteDevServer;
|
|
84
|
+
wss: WebSocketServer | null;
|
|
85
|
+
sfcFileMap: Map<string, string>;
|
|
86
|
+
depFileMap: Map<string, string>;
|
|
87
|
+
verbose: boolean;
|
|
88
|
+
appVirtualWithSlash: string;
|
|
89
|
+
getGraphVersion(): number;
|
|
90
|
+
getStrategy(): FrameworkServerStrategy;
|
|
91
|
+
}
|
|
42
92
|
export interface FrameworkServerStrategy {
|
|
43
93
|
readonly flavor: string;
|
|
44
94
|
matchesFile(id: string): boolean;
|
|
95
|
+
/** Framework-specific pre-clean phase (remove virtual style imports, etc.). */
|
|
96
|
+
preClean?(code: string): string;
|
|
97
|
+
/** Rewrite framework runtime imports to vendor bundle. */
|
|
98
|
+
rewriteFrameworkImports?(code: string): string;
|
|
99
|
+
/** Framework-specific post-clean phase (strip HMR helpers, etc.). */
|
|
100
|
+
postClean?(code: string): string;
|
|
45
101
|
/**
|
|
46
|
-
*
|
|
102
|
+
* Collapse framework-specific HTTP endpoint imports to their canonical
|
|
103
|
+
* (unversioned) URLs. Module identity is the URL; freshness is driven by
|
|
104
|
+
* explicit eviction, never URL variation. Versioned inbound shapes from
|
|
105
|
+
* stale cached device code (e.g. `/ns/sfc/<ver>/…`) are stripped here.
|
|
47
106
|
*/
|
|
48
|
-
|
|
107
|
+
canonicalizeFrameworkImports?(code: string, origin: string): string;
|
|
108
|
+
/** Optional vendor rewrite hook (e.g. map framework helper imports to vendor). */
|
|
109
|
+
rewriteVendorSpec?(code: string, origin: string, version: number): string;
|
|
49
110
|
/**
|
|
50
|
-
*
|
|
111
|
+
* Full per-framework `handleHotUpdate` implementation. Every flavor owns one:
|
|
112
|
+
* the WebSocket plugin's `handleHotUpdate` Vite hook calls it directly, and
|
|
113
|
+
* the implementation runs the shared {@link NsHotUpdateContext}-driven
|
|
114
|
+
* `runHotUpdatePrologue` followed by its own framework tail.
|
|
51
115
|
*/
|
|
52
|
-
|
|
116
|
+
handleHotUpdate?(ctx: HmrContext, deps: NsHotUpdateContext): Promise<HmrContext['modules'] | void>;
|
|
53
117
|
/**
|
|
54
|
-
*
|
|
118
|
+
* Handle a Vite custom event sent FROM the device (`import.meta.hot.send`
|
|
119
|
+
* arrives on the `/ns-hmr` socket as `{ type: 'custom', event, data }`).
|
|
120
|
+
* Frameworks use this for runtime→server recovery signals the shared
|
|
121
|
+
* message pump has no business interpreting. Angular implements it for
|
|
122
|
+
* `angular:invalidate` — Angular core sends that when an in-place
|
|
123
|
+
* `ɵɵreplaceMetadata` apply THROWS (see `executeWithInvalidateFallback`),
|
|
124
|
+
* expecting the dev server to force a full reload the way
|
|
125
|
+
* `@angular/build`'s Vite server does on web. Defaults to ignore.
|
|
55
126
|
*/
|
|
56
|
-
|
|
127
|
+
handleClientCustomEvent?(ctx: {
|
|
128
|
+
event: string;
|
|
129
|
+
data: unknown;
|
|
130
|
+
server: ViteDevServer;
|
|
131
|
+
}, deps: NsHotUpdateContext): Promise<void> | void;
|
|
57
132
|
/**
|
|
58
|
-
*
|
|
133
|
+
* When `true`, the per-module graph delta is NOT broadcast inline during a
|
|
134
|
+
* hot update (the framework drives its own re-fetch/patch instead — Angular
|
|
135
|
+
* & Solid). Defaults to `false` → delta is broadcast (today's TS/Vue path).
|
|
59
136
|
*/
|
|
60
|
-
|
|
137
|
+
readonly deferDeltaBroadcast?: boolean;
|
|
61
138
|
/**
|
|
62
|
-
*
|
|
139
|
+
* When this returns `true` for the changed file, the shared prologue SKIPS
|
|
140
|
+
* its default module-graph delta upsert — the framework's own
|
|
141
|
+
* `handleHotUpdate` tail re-queries the graph and drives the update itself
|
|
142
|
+
* (Angular HTML templates: Analog's in-place swap or the NS reboot path).
|
|
143
|
+
* Defaults to no-skip (the prologue always upserts).
|
|
63
144
|
*/
|
|
64
|
-
|
|
145
|
+
skipDefaultGraphUpdate?(file: string): boolean;
|
|
146
|
+
/**
|
|
147
|
+
* When `true`, the shared prologue does NOT broadcast `ns:css-updates` for a
|
|
148
|
+
* component-scoped style edit (a non-global `.css`) — the framework's own
|
|
149
|
+
* `handleHotUpdate` drives the in-place component update instead. For
|
|
150
|
+
* Angular with Analog `liveReload` active this is essential: Analog emits
|
|
151
|
+
* `angular:component-update` only while the css's `?direct` module is absent
|
|
152
|
+
* from the graph, and the prologue's broadcast makes the device fetch
|
|
153
|
+
* `…?direct=1`, which creates that module and flips Analog to its
|
|
154
|
+
* (NativeScript-inert) Vite css-update branch on every subsequent edit. The
|
|
155
|
+
* global app-entry CSS path is unaffected (it is not component-scoped).
|
|
156
|
+
* Defaults to `false` (every flavor keeps the component-style broadcast).
|
|
157
|
+
*/
|
|
158
|
+
ownsComponentStyleHmr?(server: ViteDevServer): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Content-file edits (Tailwind scans) that change the generated `app.css`
|
|
161
|
+
* are normally broadcast as a standalone `ns:css-updates`. Return `true`
|
|
162
|
+
* when the framework's own update message must carry them instead — the
|
|
163
|
+
* prologue then hands them to the tail via
|
|
164
|
+
* {@link HotUpdatePrologueState.deferredCssUpdates} so the device
|
|
165
|
+
* serializes the CSS with the framework's update cycle instead of racing
|
|
166
|
+
* it (Angular: a TS edit reboots the root, and the CSS must land inside
|
|
167
|
+
* that reboot, not against a view tree mid-teardown). Defaults to `false`
|
|
168
|
+
* (standalone broadcast).
|
|
169
|
+
*/
|
|
170
|
+
defersContentCssToFrameworkUpdate?(file: string): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Intercept a `/ns/m` request before spec resolution. Return `true` when
|
|
173
|
+
* the request was fully answered (or delegated downstream via `next()`),
|
|
174
|
+
* so the shared route stops processing it. Angular implements this for
|
|
175
|
+
* AnalogJS `/@ng/component` metadata fetches (see
|
|
176
|
+
* `frameworks/angular/server/ng-component-route.ts`). Defaults to no
|
|
177
|
+
* interception.
|
|
178
|
+
*/
|
|
179
|
+
interceptModuleRequest?(ctx: FrameworkModuleRequestContext): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Last-chance export normalization on the final served body (after the
|
|
182
|
+
* CJS wrap, before URL canonicalization). Vue/Solid/TS implement the
|
|
183
|
+
* `routes` default-export alias so both `import { routes }` and
|
|
184
|
+
* `import routes` resolve against a route-config module. Defaults to
|
|
185
|
+
* identity.
|
|
186
|
+
*/
|
|
187
|
+
normalizeServedExports?(code: string): string;
|
|
188
|
+
/**
|
|
189
|
+
* Override the `/ns/m` served-module import rewrite. Defaults to the shared
|
|
190
|
+
* `rewriteImports` (today's non-Angular path); Angular overrides with its
|
|
191
|
+
* entry-preparation pass. Returns the rewritten code.
|
|
192
|
+
*/
|
|
193
|
+
rewriteServedModule?(code: string, ctx: FrameworkServedModuleContext): string;
|
|
194
|
+
/**
|
|
195
|
+
* Patch a served `node_modules` module before device delivery (e.g. Solid's
|
|
196
|
+
* inline `@solid-refresh` patch). Defaults to identity (code unchanged).
|
|
197
|
+
* `verbose` mirrors the `/ns/m` plugin's `verbose` option and gates the
|
|
198
|
+
* server-side diagnostics the inline patch emitted today (the device process
|
|
199
|
+
* sets `globalThis.__NS_ENV_VERBOSE__`, but the Node server never does).
|
|
200
|
+
*/
|
|
201
|
+
transformNodeModule?(code: string, moduleId: string, verbose?: boolean): string;
|
|
202
|
+
/**
|
|
203
|
+
* Framework SFC post-processing (Vue). Defaults to identity. Mirrors the
|
|
204
|
+
* `processSfcCode` helper currently injected via the registry context.
|
|
205
|
+
*/
|
|
206
|
+
processSfcCode?(code: string): string;
|
|
207
|
+
/**
|
|
208
|
+
* Register framework-owned dev HTTP endpoints (Vue: `/ns/sfc*`). Defaults to
|
|
209
|
+
* no-op for frameworks without extra routes.
|
|
210
|
+
*/
|
|
211
|
+
registerRoutes?(ctx: FrameworkRouteContext): void;
|
|
212
|
+
/**
|
|
213
|
+
* Extra import-map entries for this framework (e.g. Vue → `vue` /
|
|
214
|
+
* `nativescript-vue`; Solid → `solid-js`). Defaults to none. Replaces the
|
|
215
|
+
* `addFrameworkEntries` switch in `import-map.ts`.
|
|
216
|
+
*/
|
|
217
|
+
importMapEntries?(origin: string): Record<string, string>;
|
|
218
|
+
/**
|
|
219
|
+
* Extra volatile URL patterns the device runtime must always re-fetch.
|
|
220
|
+
* Defaults to none (freshness is eviction-driven). Angular supplies
|
|
221
|
+
* `/@ng/component` — its per-save `t` param mints a fresh module per
|
|
222
|
+
* recompile, so the previous entry must be evicted on every re-import
|
|
223
|
+
* or the registry accumulates one stale entry per save.
|
|
224
|
+
*/
|
|
225
|
+
volatilePatterns?(): string[];
|
|
226
|
+
/**
|
|
227
|
+
* Paths (substring match) whose query string IS the module identity and
|
|
228
|
+
* must be preserved verbatim by the runtime's canonical-key function.
|
|
229
|
+
* Defaults to none. Angular supplies `/@ng/component` — each
|
|
230
|
+
* `?c=<id>&t=<ts>` identifies a distinct metadata recompile; stripping
|
|
231
|
+
* `t` would collapse every HMR fetch onto the boot-time cache key and
|
|
232
|
+
* `ɵɵreplaceMetadata` would forever replay stale template instructions.
|
|
233
|
+
* Fed into `configureRuntime({ canonicalization.preserveQueryFor })`.
|
|
234
|
+
*/
|
|
235
|
+
preserveQueryPaths?(): string[];
|
|
65
236
|
processFile(ctx: FrameworkProcessFileContext): Promise<void>;
|
|
66
237
|
buildRegistry(ctx: FrameworkRegistryContext): Promise<void>;
|
|
67
238
|
}
|
|
@@ -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,OA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AO,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,+BAA+B,CAAC,cAAc,EAAE,OAAO,EAAE,iBAAiB,KAAK,IAAI,EAAE,OAAO,EAAE,cAAc,KAAK,KAAK,CAAC,EAAE,CAAC;YAC7H,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAED,MAAM,CAAC,EAAU;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO;QAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -2,47 +2,56 @@
|
|
|
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),
|
|
20
19
|
* then looks them up in this map. This ensures ALL imports — regardless of
|
|
21
20
|
* how Vite rewrites them — resolve through a single deterministic path.
|
|
22
21
|
*/
|
|
22
|
+
import type { FrameworkServerStrategy } from './framework-strategy.js';
|
|
23
23
|
export interface ImportMap {
|
|
24
24
|
imports: Record<string, string>;
|
|
25
25
|
}
|
|
26
26
|
export interface ImportMapOptions {
|
|
27
27
|
/** Origin of the Vite dev server (e.g. "http://192.168.1.5:5173") */
|
|
28
28
|
origin: string;
|
|
29
|
-
/** Framework flavor (vue, angular, solid, typescript) */
|
|
29
|
+
/** Framework flavor (vue, angular, solid, typescript) — framework identity. */
|
|
30
30
|
flavor: string;
|
|
31
|
+
/**
|
|
32
|
+
* Active framework strategy. Its `importMapEntries(origin)` +
|
|
33
|
+
* `volatilePatterns()` hooks supply the framework-specific pieces of the
|
|
34
|
+
* import map and volatile-pattern list.
|
|
35
|
+
* Optional: when omitted, the map/patterns carry only the shared
|
|
36
|
+
* vendor/core/HTTP entries.
|
|
37
|
+
*/
|
|
38
|
+
strategy?: FrameworkServerStrategy;
|
|
31
39
|
/** Additional entries to add to the import map */
|
|
32
40
|
extraEntries?: Record<string, string>;
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
43
|
* Generate an import map from the current vendor manifest.
|
|
36
44
|
*
|
|
37
|
-
* Vendor
|
|
38
|
-
*
|
|
39
|
-
*
|
|
45
|
+
* Vendor package roots map to `${origin}/ns/m/node_modules/<pkg>` — served
|
|
46
|
+
* as deps-bundle shims (thin re-exports out of `__NS_DEPS_MODULES__`, the
|
|
47
|
+
* single-evaluation bundle realm), so every specifier of a package resolves
|
|
48
|
+
* to one instance. Manifest aliases collapse onto their canonical package's
|
|
49
|
+
* URL, preserving the "many specifiers, one instance" semantics.
|
|
40
50
|
*
|
|
41
51
|
* IMPORTANT: Vendor entries are EXACT only (no trailing-slash prefixes).
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* module. Instead, they fall through to the HTTP trailing-slash prefix
|
|
52
|
+
* Subpath imports like solid-js/store or @nativescript/tanstack-router/solid
|
|
53
|
+
* are separate entry points with different exports — they must NOT resolve
|
|
54
|
+
* to the package root. They fall through to the HTTP trailing-slash prefix
|
|
46
55
|
* entries from discoverInstalledPackages().
|
|
47
56
|
*
|
|
48
57
|
* @nativescript/core is mapped to the HTTP bridge endpoint.
|
|
@@ -54,12 +63,35 @@ 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
|
-
*
|
|
60
|
-
*
|
|
68
|
+
* The URL canonicalization vocabulary handed to the runtime via
|
|
69
|
+
* `configureRuntime({ canonicalization })`. The runtime owns the *mechanism*
|
|
70
|
+
* (fragment strip, cache-buster param drop, param sort — it keys the module
|
|
71
|
+
* registry inside the engine's synchronous resolve walk); this server owns
|
|
72
|
+
* the *vocabulary*, because every name in it is a route this server defines:
|
|
73
|
+
*
|
|
74
|
+
* - `stripParams`: Vite's `import` marker and `t`/`v` cache stamps — pure
|
|
75
|
+
* cache busters that must not create distinct module identities.
|
|
76
|
+
* - `forPathPrefixes`: the dev endpoints under which query normalization is
|
|
77
|
+
* safe. Everything else (public/remote URLs) keeps its query verbatim,
|
|
78
|
+
* since for general HTTP modules the query can be identity (auth,
|
|
79
|
+
* content versioning, routing).
|
|
80
|
+
* - `preserveQueryFor`: strategy-owned paths whose query IS the module
|
|
81
|
+
* identity (e.g. Angular's `/@ng/component?c=<id>&t=<ts>` — each `t` is a
|
|
82
|
+
* distinct metadata recompile).
|
|
83
|
+
*/
|
|
84
|
+
export declare function getCanonicalization(strategy?: FrameworkServerStrategy): {
|
|
85
|
+
stripParams: string[];
|
|
86
|
+
forPathPrefixes: string[];
|
|
87
|
+
preserveQueryFor: string[];
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Serialize the import map + volatile patterns + canonicalization vocabulary
|
|
91
|
+
* into the config object that ns:runtime configureRuntime() expects.
|
|
61
92
|
*/
|
|
62
93
|
export declare function buildRuntimeConfig(options: ImportMapOptions): {
|
|
63
94
|
importMap: string;
|
|
64
95
|
volatilePatterns: string[];
|
|
96
|
+
canonicalization: ReturnType<typeof getCanonicalization>;
|
|
65
97
|
};
|