@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
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { resolvePlatform } from '../../helpers/cli-flags.js';
|
|
4
|
+
import { getProjectFlavor } from '../../helpers/flavor.js';
|
|
5
|
+
// Cold-boot request recording.
|
|
6
|
+
//
|
|
7
|
+
// A real cold boot fetches hundreds of `/ns/m/node_modules/...` bodies (deep
|
|
8
|
+
// ESM packages like rxjs) that no static analysis can enumerate up front.
|
|
9
|
+
// This recorder captures the EXACT prefetchable URL set served during a boot
|
|
10
|
+
// window; the deps-bundle service (`resolveDepsEntriesFromRecording`) folds
|
|
11
|
+
// those recorded deep files into the single-eval `/ns/deps-bundle.mjs`, so
|
|
12
|
+
// the NEXT boot serves them as one payload instead of per-module fetches.
|
|
13
|
+
//
|
|
14
|
+
// Lifecycle: a recording session opens when the device fetches the session
|
|
15
|
+
// descriptor (`/__ns_dev__/session` — requested exactly once per boot by the
|
|
16
|
+
// session bootstrap), collects every successfully-served prefetchable
|
|
17
|
+
// request, and closes after an idle window. Closed sessions replace the
|
|
18
|
+
// previous recording and persist to
|
|
19
|
+
// `node_modules/.ns-vite/boot-closure-<platform>-<flavor>.json` so a fresh
|
|
20
|
+
// dev-server start benefits too.
|
|
21
|
+
//
|
|
22
|
+
// Self-healing: only 2xx responses are recorded, so deleted modules (404s)
|
|
23
|
+
// drop out on the next boot. Stale-but-servable entries are harmless — the
|
|
24
|
+
// deps bundle simply carries an unused entry until the next recording.
|
|
25
|
+
export const BOOT_RECORDING_VERSION = 1;
|
|
26
|
+
/** Endpoints whose request marks the start of a device boot. */
|
|
27
|
+
export const BOOT_SIGNAL_PATHS = new Set(['/__ns_dev__/session']);
|
|
28
|
+
// Non-JS resource types can never become deps-bundle entries, so recording
|
|
29
|
+
// them would only bloat the closure.
|
|
30
|
+
const NON_JS_EXT_RE = /\.(css|scss|sass|less|json|html|htm|png|jpe?g|gif|svg|webp|ico|woff2?|ttf|otf|eot|mp3|mp4|webm|wav|map)$/i;
|
|
31
|
+
// Volatile cache-buster query param (`?t=169…` / `&t=169…`). URLs carrying it
|
|
32
|
+
// are freshly minted per request (Vite HMR timestamps, the Angular
|
|
33
|
+
// `@ng/component?c=…&t=…` refresh route), so a recorded copy can never match
|
|
34
|
+
// a future boot's request — recording them only grows the closure by one dead
|
|
35
|
+
// variant per boot.
|
|
36
|
+
const VOLATILE_T_PARAM_RE = /[?&]t=\d+(?:&|$)/;
|
|
37
|
+
/**
|
|
38
|
+
* True when a request path is served through the device module loader and is
|
|
39
|
+
* therefore worth recording for the next boot's deps bundle. Matches the URL
|
|
40
|
+
* spaces the HTTP ESM loader fetches: `/ns/m/**`, the `/ns/rt` + `/ns/core`
|
|
41
|
+
* bridges, the core and deps bundles, Vue SFC artifacts, the served vendor
|
|
42
|
+
* bundle, and the dev client bootstrap.
|
|
43
|
+
*/
|
|
44
|
+
export function isPrefetchableBootPath(pathWithSearch) {
|
|
45
|
+
if (!pathWithSearch || !pathWithSearch.startsWith('/'))
|
|
46
|
+
return false;
|
|
47
|
+
if (VOLATILE_T_PARAM_RE.test(pathWithSearch))
|
|
48
|
+
return false;
|
|
49
|
+
const pathname = pathWithSearch.split('?')[0];
|
|
50
|
+
if (NON_JS_EXT_RE.test(pathname))
|
|
51
|
+
return false;
|
|
52
|
+
if (pathname === '/ns/import-map.json')
|
|
53
|
+
return false;
|
|
54
|
+
if (pathname.startsWith('/ns/m/'))
|
|
55
|
+
return true;
|
|
56
|
+
if (pathname === '/ns/rt' || pathname.startsWith('/ns/rt/'))
|
|
57
|
+
return true;
|
|
58
|
+
if (pathname === '/ns/core' || pathname.startsWith('/ns/core/'))
|
|
59
|
+
return true;
|
|
60
|
+
if (pathname === '/ns/core-bundle.mjs')
|
|
61
|
+
return true;
|
|
62
|
+
if (pathname === '/ns/deps-bundle.mjs')
|
|
63
|
+
return true;
|
|
64
|
+
if (pathname.startsWith('/ns/sfc/') || pathname.startsWith('/ns/asm/'))
|
|
65
|
+
return true;
|
|
66
|
+
if (pathname === '/@nativescript/vendor.mjs')
|
|
67
|
+
return true;
|
|
68
|
+
if (pathname === '/__ns_dev__/client')
|
|
69
|
+
return true;
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
export function getBootRecordingFilePath(projectRoot, platform, flavor) {
|
|
73
|
+
return path.join(projectRoot, 'node_modules', '.ns-vite', `boot-closure-${platform}-${flavor}.json`);
|
|
74
|
+
}
|
|
75
|
+
/** Load a persisted recording; null when absent, invalid, or mismatched. */
|
|
76
|
+
export function loadPersistedBootRecording(projectRoot, platform, flavor) {
|
|
77
|
+
try {
|
|
78
|
+
const file = getBootRecordingFilePath(projectRoot, platform, flavor);
|
|
79
|
+
if (!existsSync(file))
|
|
80
|
+
return null;
|
|
81
|
+
const parsed = JSON.parse(readFileSync(file, 'utf-8'));
|
|
82
|
+
if (!parsed || parsed.version !== BOOT_RECORDING_VERSION)
|
|
83
|
+
return null;
|
|
84
|
+
if (parsed.platform !== platform || parsed.flavor !== flavor)
|
|
85
|
+
return null;
|
|
86
|
+
// Re-apply the prefetchability filter on load so recordings written by
|
|
87
|
+
// an older filter (or hand-edited files) shed dead entries.
|
|
88
|
+
const paths = Array.isArray(parsed.paths) ? parsed.paths.filter((p) => typeof p === 'string' && isPrefetchableBootPath(p)) : [];
|
|
89
|
+
return paths.length ? paths : null;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function createBootRecorder(options) {
|
|
96
|
+
const idleWindowMs = Math.max(500, Math.floor(options.idleWindowMs ?? 5000));
|
|
97
|
+
const minEntries = Math.max(1, Math.floor(options.minEntries ?? 5));
|
|
98
|
+
const maxEntries = Math.max(minEntries, Math.floor(options.maxEntries ?? 5000));
|
|
99
|
+
const persist = options.persist !== false;
|
|
100
|
+
const now = options.now ?? (() => Date.now());
|
|
101
|
+
const setTimer = options.setTimer ?? ((handler, ms) => setTimeout(handler, ms));
|
|
102
|
+
const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
|
|
103
|
+
const log = options.log ?? (() => { });
|
|
104
|
+
let best = persist ? loadPersistedBootRecording(options.projectRoot, options.platform, options.flavor) : null;
|
|
105
|
+
let session = null;
|
|
106
|
+
let idleTimer = null;
|
|
107
|
+
const persistBest = () => {
|
|
108
|
+
if (!persist || !best)
|
|
109
|
+
return;
|
|
110
|
+
try {
|
|
111
|
+
const file = getBootRecordingFilePath(options.projectRoot, options.platform, options.flavor);
|
|
112
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
113
|
+
writeFileSync(file, JSON.stringify({
|
|
114
|
+
version: BOOT_RECORDING_VERSION,
|
|
115
|
+
platform: options.platform,
|
|
116
|
+
flavor: options.flavor,
|
|
117
|
+
recordedAt: now(),
|
|
118
|
+
paths: best,
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
log(`[hmr-ws][boot-record] persist failed: ${error?.message || error}`);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const closeSession = () => {
|
|
126
|
+
if (idleTimer !== null) {
|
|
127
|
+
clearTimer(idleTimer);
|
|
128
|
+
idleTimer = null;
|
|
129
|
+
}
|
|
130
|
+
if (!session)
|
|
131
|
+
return;
|
|
132
|
+
const finished = session;
|
|
133
|
+
session = null;
|
|
134
|
+
if (finished.order.length < minEntries) {
|
|
135
|
+
log(`[hmr-ws][boot-record] discarded window with ${finished.order.length} entries (< ${minEntries})`);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
best = finished.order.slice(0, maxEntries);
|
|
139
|
+
persistBest();
|
|
140
|
+
log(`[hmr-ws][boot-record] captured ${best.length} boot urls in ${Math.max(0, now() - finished.startedAt)}ms`);
|
|
141
|
+
};
|
|
142
|
+
const armIdle = () => {
|
|
143
|
+
if (idleTimer !== null)
|
|
144
|
+
clearTimer(idleTimer);
|
|
145
|
+
idleTimer = setTimer(() => {
|
|
146
|
+
idleTimer = null;
|
|
147
|
+
closeSession();
|
|
148
|
+
}, idleWindowMs);
|
|
149
|
+
};
|
|
150
|
+
const openSession = () => {
|
|
151
|
+
closeSession();
|
|
152
|
+
session = { order: [], seen: new Set(), startedAt: now() };
|
|
153
|
+
armIdle();
|
|
154
|
+
};
|
|
155
|
+
const record = (pathWithSearch) => {
|
|
156
|
+
if (!session || session.order.length >= maxEntries)
|
|
157
|
+
return;
|
|
158
|
+
if (session.seen.has(pathWithSearch))
|
|
159
|
+
return;
|
|
160
|
+
session.seen.add(pathWithSearch);
|
|
161
|
+
session.order.push(pathWithSearch);
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
noteRequest(pathWithSearch) {
|
|
165
|
+
const pathname = pathWithSearch.split('?')[0];
|
|
166
|
+
if (BOOT_SIGNAL_PATHS.has(pathname)) {
|
|
167
|
+
openSession();
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
if (!session)
|
|
171
|
+
return null;
|
|
172
|
+
if (!isPrefetchableBootPath(pathWithSearch))
|
|
173
|
+
return null;
|
|
174
|
+
armIdle();
|
|
175
|
+
let done = false;
|
|
176
|
+
return (statusCode) => {
|
|
177
|
+
if (done)
|
|
178
|
+
return;
|
|
179
|
+
done = true;
|
|
180
|
+
if (!session)
|
|
181
|
+
return;
|
|
182
|
+
if (!(statusCode >= 200 && statusCode < 300))
|
|
183
|
+
return;
|
|
184
|
+
record(pathWithSearch);
|
|
185
|
+
armIdle();
|
|
186
|
+
};
|
|
187
|
+
},
|
|
188
|
+
getRecordedPaths() {
|
|
189
|
+
return best ? best.slice() : null;
|
|
190
|
+
},
|
|
191
|
+
closeActiveSession() {
|
|
192
|
+
closeSession();
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Standard dev-server construction: resolves platform/flavor from the
|
|
198
|
+
* project, honors `NS_VITE_HMR_DISABLE_BOOT_RECORDING` (returns null) and
|
|
199
|
+
* `NS_VITE_HMR_BOOT_RECORD_IDLE_MS`.
|
|
200
|
+
*/
|
|
201
|
+
export function createBootRecorderFromEnv(projectRoot, log) {
|
|
202
|
+
const disabled = process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === '1' || process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === 'true';
|
|
203
|
+
if (disabled)
|
|
204
|
+
return null;
|
|
205
|
+
const configuredIdleMs = Number.parseInt(process.env.NS_VITE_HMR_BOOT_RECORD_IDLE_MS || '', 10);
|
|
206
|
+
return createBootRecorder({
|
|
207
|
+
platform: resolvePlatform() || 'ios',
|
|
208
|
+
flavor: getProjectFlavor(),
|
|
209
|
+
projectRoot,
|
|
210
|
+
idleWindowMs: Number.isFinite(configuredIdleMs) && configuredIdleMs > 0 ? configuredIdleMs : undefined,
|
|
211
|
+
log,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=boot-recording.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"boot-recording.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/boot-recording.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,+BAA+B;AAC/B,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,sEAAsE;AACtE,wEAAwE;AACxE,oCAAoC;AACpC,2EAA2E;AAC3E,iCAAiC;AACjC,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AAEvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAEvF,2EAA2E;AAC3E,qCAAqC;AACrC,MAAM,aAAa,GAAG,2GAA2G,CAAC;AAElI,8EAA8E;A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KACH,CAAC,CAAC;AACJ,CAAC"}
|
package/hmr/server/constants.js
CHANGED
|
@@ -5,17 +5,32 @@ export const QUERY_PATTERN = /\?.*$/;
|
|
|
5
5
|
// Detect whether Vite's variable dynamic import helper is already inlined
|
|
6
6
|
export const VARIABLE_DYNAMIC_IMPORT_HELPER_PATTERN = /__variableDynamicImportRuntimeHelper\s*=/;
|
|
7
7
|
// Import/export matchers (static and dynamic)
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
//
|
|
9
|
+
// Each pattern's first capture group includes the optional leading anchor
|
|
10
|
+
// (`^|\n`) so the replacement function preserves the line break that would
|
|
11
|
+
// otherwise be silently consumed by the regex engine. Without this, two
|
|
12
|
+
// concatenated patterns like:
|
|
13
|
+
// `})();\nexport * from "a"\nexport * from "b"`
|
|
14
|
+
// would collapse to:
|
|
15
|
+
// `})();export * from "a"export * from "b"`
|
|
16
|
+
// because each `(?:^|\n)` ate a newline that no replacement string put back.
|
|
17
|
+
export const IMPORT_PATTERN_1 = /((?:^|\n)\s*import\s+[^'";]*?\s+from\s+["'])([^"']+)(["'];?)/g;
|
|
18
|
+
export const IMPORT_PATTERN_2 = /((?:^|\n)\s*export\s+[^'";]*?\s+from\s+["'])([^"']+)(["'];?)/g;
|
|
10
19
|
export const EXPORT_PATTERN = IMPORT_PATTERN_2;
|
|
11
20
|
export const IMPORT_PATTERN_3 = /(import\(\s*["'])([^"']+)(["']\s*\))/g;
|
|
12
21
|
// Side-effect imports: import "spec" / import 'spec' (no `from`, no bindings)
|
|
13
|
-
export const IMPORT_PATTERN_SIDE_EFFECT = /(?:^|\n)
|
|
22
|
+
export const IMPORT_PATTERN_SIDE_EFFECT = /((?:^|\n)\s*import\s+["'])([^"']+)(["'];?)/g;
|
|
14
23
|
// Vue-specific patterns
|
|
15
24
|
export const VUE_FILE_PATTERN = /\.vue(?:\?[^"']*)?$/;
|
|
16
|
-
export const VUE_FILE_IMPORT = /(?:^|\n)
|
|
25
|
+
export const VUE_FILE_IMPORT = /((?:^|\n)\s*import\s+[^'";]*?\s+from\s+["'])([^"']+\.vue(?:\?[^"']*)?)(["'];?)/g;
|
|
17
26
|
// Vite/HMR noise cleanup
|
|
18
|
-
|
|
27
|
+
// Matches BOTH the side-effect form (`import "/@vite/client";`) and the named
|
|
28
|
+
// form Vite 8 emits (`import { injectQuery as __vite__injectQuery } from "/@vite/client";`).
|
|
29
|
+
// NOT line-anchored: Vite 8 concatenates injected imports onto the module's
|
|
30
|
+
// original first line, so an anchored pattern either misses or over-deletes.
|
|
31
|
+
// Group 1 (the preceding `^`/newline/`;` boundary) MUST be preserved by
|
|
32
|
+
// replacements (`replace(..., '$1')`) so the prior statement keeps its terminator.
|
|
33
|
+
export const VITE_CLIENT_IMPORT = /(^|[\n;])\s*import\s+(?:[\w$]+\s*,\s*)?(?:\{[^}]*\}\s+from\s+|[\w$]+\s+from\s+|\*\s+as\s+[\w$]+\s+from\s+)?['"](?:\/@vite\/client|@vite\/client)['"];?/g;
|
|
19
34
|
// Strip Vite's injected `import.meta.hot = __vite__createHotContext(...)` assignment.
|
|
20
35
|
// Important: it may appear mid-line after other tokens/spaces in sanitized HTTP output,
|
|
21
36
|
// so we cannot rely on it starting at BOL.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/constants.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,qGAAqG;AAErG,uBAAuB;AACvB,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sCAAsC,GAAG,0CAA0C,CAAC;AAEjG,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,+DAA+D,CAAC;AAChG,MAAM,CAAC,MAAM,gBAAgB,GAAG,+DAA+D,CAAC;AAChG,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,u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wFAAwF;AACxF,2CAA2C;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAG,+DAA+D,CAAC;AAErG,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,kEAAkE,CAAC;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAAG,sEAAsE,CAAC;AAC5G,MAAM,CAAC,MAAM,qBAAqB,GAAG,+CAA+C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ViteDevServer } from 'vite';
|
|
2
|
+
import type { WebSocketServer } from 'ws';
|
|
3
|
+
import type { CssUpdateItem } from '../shared/protocol.js';
|
|
4
|
+
export interface ContentCssUpdateOptions {
|
|
5
|
+
server: ViteDevServer;
|
|
6
|
+
file: string;
|
|
7
|
+
root: string;
|
|
8
|
+
wss: WebSocketServer;
|
|
9
|
+
isSocketClientOpen: (client: {
|
|
10
|
+
readyState?: number;
|
|
11
|
+
OPEN?: number;
|
|
12
|
+
} | null | undefined) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The active framework strategy's `defersContentCssToFrameworkUpdate`
|
|
15
|
+
* verdict for this file: `true` routes the update into the framework's own
|
|
16
|
+
* message (returned as `deferredCssUpdates`) instead of broadcasting.
|
|
17
|
+
*/
|
|
18
|
+
deferToFrameworkUpdate: boolean;
|
|
19
|
+
verbose: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ContentCssUpdateResult {
|
|
22
|
+
/** Present when the framework tail must carry the CSS update in its own message. */
|
|
23
|
+
deferredCssUpdates?: CssUpdateItem[];
|
|
24
|
+
/** Open sockets the standalone `ns:css-updates` broadcast reached. */
|
|
25
|
+
recipients: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Tailwind / content-scanning CSS routing for non-CSS edits.
|
|
29
|
+
*
|
|
30
|
+
* Background: when a `.html` template or `.ts` file scanned by Tailwind's
|
|
31
|
+
* `content` config gains a brand-new utility class (e.g. a `pt-6` never used
|
|
32
|
+
* before), the booted CSS bundle has no rule for it — the template HMR swaps
|
|
33
|
+
* the markup, the class lookup misses, and the layout regresses.
|
|
34
|
+
*
|
|
35
|
+
* In a stock Vite setup the `vite:css` plugin registers each PostCSS content
|
|
36
|
+
* dependency as an importer of the CSS module, so a content edit invalidates
|
|
37
|
+
* the CSS through the moduleGraph. NS HMR breaks that chain: `app.css` loads
|
|
38
|
+
* through `virtual:ns-app-css` whose `load` hook calls `preprocessCSS(...)`
|
|
39
|
+
* and emits a JS module — the CSS is never a moduleGraph node, so the importer
|
|
40
|
+
* chain never forms. `mainEntryPlugin` bridges the gap by tracking the
|
|
41
|
+
* `preprocessCSS` dep set on the server (see `AppCssState`).
|
|
42
|
+
*
|
|
43
|
+
* When the changed file is in that set, regenerate the stylesheet and compare
|
|
44
|
+
* with the previous output. Ordinary content edits are skipped; output that
|
|
45
|
+
* actually changed is either broadcast as `ns:css-updates` or — when the
|
|
46
|
+
* framework's own update message must carry it (Angular TS reboots, via the
|
|
47
|
+
* `defersContentCssToFrameworkUpdate` strategy hook) — returned as
|
|
48
|
+
* `deferredCssUpdates` so the device serializes CSS with the framework's
|
|
49
|
+
* update cycle instead of racing view-tree teardown.
|
|
50
|
+
*
|
|
51
|
+
* Never throws: refresh is non-throwing by contract and the broadcast guards
|
|
52
|
+
* each send.
|
|
53
|
+
*/
|
|
54
|
+
export declare function processContentCssUpdate(opts: ContentCssUpdateOptions): Promise<ContentCssUpdateResult>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { getAppCssState } from '../../helpers/app-css-state.js';
|
|
3
|
+
import { appCssRootRelPath, buildCssUpdateItem, buildCssUpdatesMessage } from './css-update-message.js';
|
|
4
|
+
/**
|
|
5
|
+
* Tailwind / content-scanning CSS routing for non-CSS edits.
|
|
6
|
+
*
|
|
7
|
+
* Background: when a `.html` template or `.ts` file scanned by Tailwind's
|
|
8
|
+
* `content` config gains a brand-new utility class (e.g. a `pt-6` never used
|
|
9
|
+
* before), the booted CSS bundle has no rule for it — the template HMR swaps
|
|
10
|
+
* the markup, the class lookup misses, and the layout regresses.
|
|
11
|
+
*
|
|
12
|
+
* In a stock Vite setup the `vite:css` plugin registers each PostCSS content
|
|
13
|
+
* dependency as an importer of the CSS module, so a content edit invalidates
|
|
14
|
+
* the CSS through the moduleGraph. NS HMR breaks that chain: `app.css` loads
|
|
15
|
+
* through `virtual:ns-app-css` whose `load` hook calls `preprocessCSS(...)`
|
|
16
|
+
* and emits a JS module — the CSS is never a moduleGraph node, so the importer
|
|
17
|
+
* chain never forms. `mainEntryPlugin` bridges the gap by tracking the
|
|
18
|
+
* `preprocessCSS` dep set on the server (see `AppCssState`).
|
|
19
|
+
*
|
|
20
|
+
* When the changed file is in that set, regenerate the stylesheet and compare
|
|
21
|
+
* with the previous output. Ordinary content edits are skipped; output that
|
|
22
|
+
* actually changed is either broadcast as `ns:css-updates` or — when the
|
|
23
|
+
* framework's own update message must carry it (Angular TS reboots, via the
|
|
24
|
+
* `defersContentCssToFrameworkUpdate` strategy hook) — returned as
|
|
25
|
+
* `deferredCssUpdates` so the device serializes CSS with the framework's
|
|
26
|
+
* update cycle instead of racing view-tree teardown.
|
|
27
|
+
*
|
|
28
|
+
* Never throws: refresh is non-throwing by contract and the broadcast guards
|
|
29
|
+
* each send.
|
|
30
|
+
*/
|
|
31
|
+
export async function processContentCssUpdate(opts) {
|
|
32
|
+
const { server, file, root, wss, isSocketClientOpen, deferToFrameworkUpdate, verbose } = opts;
|
|
33
|
+
const none = { recipients: 0 };
|
|
34
|
+
const appCssState = getAppCssState(server);
|
|
35
|
+
if (!appCssState?.deps || !appCssState.path) {
|
|
36
|
+
return none;
|
|
37
|
+
}
|
|
38
|
+
const normalizedFile = path.resolve(file).replace(/\\/g, '/');
|
|
39
|
+
if (!appCssState.deps.has(normalizedFile)) {
|
|
40
|
+
return none;
|
|
41
|
+
}
|
|
42
|
+
const { changed } = await appCssState.refresh();
|
|
43
|
+
if (!changed) {
|
|
44
|
+
if (verbose)
|
|
45
|
+
console.info(`[ns-hmr][server] Tailwind/PostCSS output unchanged after ${path.basename(file)}; skipped app.css refresh`);
|
|
46
|
+
return none;
|
|
47
|
+
}
|
|
48
|
+
const appCssRel = appCssRootRelPath(root, appCssState.path);
|
|
49
|
+
if (!appCssRel) {
|
|
50
|
+
return none;
|
|
51
|
+
}
|
|
52
|
+
const update = buildCssUpdateItem(appCssRel);
|
|
53
|
+
if (deferToFrameworkUpdate) {
|
|
54
|
+
if (verbose)
|
|
55
|
+
console.info(`[ns-hmr][server] Tailwind/PostCSS output changed after ${path.basename(file)}; deferred ${appCssRel} to framework update`);
|
|
56
|
+
return { deferredCssUpdates: [update], recipients: 0 };
|
|
57
|
+
}
|
|
58
|
+
let recipients = 0;
|
|
59
|
+
try {
|
|
60
|
+
const payload = JSON.stringify(buildCssUpdatesMessage(server, [update]));
|
|
61
|
+
wss.clients.forEach((client) => {
|
|
62
|
+
if (isSocketClientOpen(client)) {
|
|
63
|
+
try {
|
|
64
|
+
client.send(payload);
|
|
65
|
+
recipients += 1;
|
|
66
|
+
}
|
|
67
|
+
catch { }
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
if (verbose)
|
|
71
|
+
console.info(`[ns-hmr][server] Tailwind/PostCSS content-file edit (${path.basename(file)}) broadcast ${appCssRel}`);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.warn('[hmr-ws] CSS content-source broadcast failed:', error);
|
|
75
|
+
}
|
|
76
|
+
return { recipients };
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=content-css-update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-css-update.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/content-css-update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EA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S,CAAC,CAAC;IAE7C,IAAI,sBAAsB,EAAE,CAAC;QAC5B,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,0DAA0D,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,SAAS,sBAAsB,CAAC,CAAC;QACtJ,OAAO,EAAE,kBAAkB,EAAE,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IACxD,CAAC;IAED,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzE,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YAC9B,IAAI,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;gBAChC,IAAI,CAAC;oBACJ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACrB,UAAU,IAAI,CAAC,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC,CAAA,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;QACH,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,wDAAwD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC;IAClI,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Single-eval @nativescript/core bundle for device serving (bundle mode).
|
|
3
|
+
*
|
|
4
|
+
* DEFAULT MODE (consumers)
|
|
5
|
+
* ------------------------
|
|
6
|
+
* Instead of serving @nativescript/core per-module through Vite's transform
|
|
7
|
+
* pipeline (~hundreds of serial HTTP fetches + per-file transforms during cold
|
|
8
|
+
* boot), the dev server pre-bundles the ENTIRE core package with esbuild into
|
|
9
|
+
* one ESM payload served at `GET /ns/core-bundle.mjs`. The canonical
|
|
10
|
+
* `/ns/core[/<sub>]` URL space is preserved — those routes serve THIN SHIMS
|
|
11
|
+
* that statically import the bundle and re-export the requested subpath's
|
|
12
|
+
* namespace from the `globalThis.__NS_CORE_MODULES__` registry the bundle
|
|
13
|
+
* populates. Because every shim's only dependency is the one bundle URL,
|
|
14
|
+
* V8/iOS evaluates core exactly once per app lifetime — the single-realm
|
|
15
|
+
* invariant is enforced by construction, with ONE big prefetchable payload
|
|
16
|
+
* instead of a deep serial fetch chain.
|
|
17
|
+
*
|
|
18
|
+
* OPT-IN PER-MODULE MODE (core maintainers)
|
|
19
|
+
* -----------------------------------------
|
|
20
|
+
* Set `NS_CORE_PER_MODULE=1` to keep the classic per-module `/ns/core` bridge
|
|
21
|
+
* (websocket-ns-core.ts). That is the right mode when editing
|
|
22
|
+
* `@nativescript/core` source live inside the NativeScript monorepo: each core
|
|
23
|
+
* module stays individually served/transformed so core edits participate in
|
|
24
|
+
* HMR. Consumers of the published package don't edit core mid-session, so the
|
|
25
|
+
* bundle is both safe and much faster for them.
|
|
26
|
+
*
|
|
27
|
+
* FAILURE FALLBACK
|
|
28
|
+
* ----------------
|
|
29
|
+
* If the esbuild bundle build fails for any reason, the service marks itself
|
|
30
|
+
* failed and `/ns/core[/<sub>]` transparently falls back to the per-module
|
|
31
|
+
* bridge for the whole session (logged loudly once). Boot still works; only
|
|
32
|
+
* the speed win is lost.
|
|
33
|
+
*/
|
|
34
|
+
import type { ViteDevServer } from 'vite';
|
|
35
|
+
import type { Platform } from '../../helpers/platform-types.js';
|
|
36
|
+
/**
|
|
37
|
+
* Per-module /ns/core serving mode (vs the default single-eval bundle).
|
|
38
|
+
*
|
|
39
|
+
* `NS_CORE_PER_MODULE=1|true` forces it on, `0|false` forces bundle mode.
|
|
40
|
+
* When unset, it AUTO-ENABLES for monorepo core source (packages/core in the
|
|
41
|
+
* NativeScript repo). Two reasons:
|
|
42
|
+
* - core maintainers edit core live, and per-module serving keeps those
|
|
43
|
+
* edits in HMR;
|
|
44
|
+
* - realm safety: the build-time externalizer emits
|
|
45
|
+
* `/ns/m/packages/core/<file>` URLs for workspace-source core (see the
|
|
46
|
+
* `ns-core-external-urls` workspace branch in configuration/base.ts), so
|
|
47
|
+
* the served graph's core realm lives under /ns/m. A bundle-mode
|
|
48
|
+
* `/ns/core-bundle.mjs` would evaluate a complete SECOND copy of core for
|
|
49
|
+
* the entry's `/ns/core/globals|application|…` imports — duplicate native
|
|
50
|
+
* class registrations crash in MetadataBuilder at startup.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isCorePerModuleServingEnabled(env?: NodeJS.ProcessEnv, hasWorkspaceCoreSource?: () => boolean): boolean;
|
|
53
|
+
export interface CoreBundleState {
|
|
54
|
+
/** Full ESM payload served at /ns/core-bundle.mjs (shape header + esbuild output). */
|
|
55
|
+
code: string;
|
|
56
|
+
/** Canonical subpaths registered in the bundle's __NS_CORE_MODULES__ registry. */
|
|
57
|
+
subs: Set<string>;
|
|
58
|
+
hash: string;
|
|
59
|
+
builtAt: number;
|
|
60
|
+
buildMs: number;
|
|
61
|
+
}
|
|
62
|
+
export interface CoreBundleService {
|
|
63
|
+
/** Resolves the built bundle, or null when the build failed (per-module fallback). */
|
|
64
|
+
ensureBuilt(): Promise<CoreBundleState | null>;
|
|
65
|
+
/** Synchronous view — null until built (or when failed). */
|
|
66
|
+
getState(): CoreBundleState | null;
|
|
67
|
+
hasFailed(): boolean;
|
|
68
|
+
}
|
|
69
|
+
export interface GenerateCoreBundleOptions {
|
|
70
|
+
projectRoot: string;
|
|
71
|
+
platform: Platform | string;
|
|
72
|
+
mode: 'development' | 'production' | string;
|
|
73
|
+
flavor?: string;
|
|
74
|
+
verbose?: boolean;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Resolve the physical @nativescript/core root the same way configuration/
|
|
78
|
+
* base.ts does: prefer monorepo source (`<workspace>/packages/core`), else the
|
|
79
|
+
* node_modules install reachable from the project root.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveCoreRootForBundle(projectRoot: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* True when a canonical core subpath was DELIBERATELY excluded from bundle
|
|
84
|
+
* enumeration (debugger/, inspector_modules, bundle-entry-points, …). Requests
|
|
85
|
+
* for these at boot are normal — the runtime's inspector/debugger plumbing
|
|
86
|
+
* imports them in dev — and the per-module fallback that serves them is
|
|
87
|
+
* by-design and realm-safe. Callers use this to keep the fallback log
|
|
88
|
+
* verbose-only for expected subs while still surfacing unexpected
|
|
89
|
+
* enumeration misses.
|
|
90
|
+
*/
|
|
91
|
+
export declare function isExpectedCoreBundleExclusion(canonicalSub: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Enumerate every importable core subpath (canonical form, per
|
|
94
|
+
* `normalizeCoreSub`) for the given platform. A subpath is included when it
|
|
95
|
+
* has a platform-neutral variant OR a variant for the current platform —
|
|
96
|
+
* other-platform-only modules (e.g. `ui/frame/activity.android` on iOS) are
|
|
97
|
+
* skipped since they can never resolve for this build.
|
|
98
|
+
*/
|
|
99
|
+
export declare function enumerateCoreModuleSubpaths(coreRoot: string, platform: string): string[];
|
|
100
|
+
/**
|
|
101
|
+
* Synthetic esbuild entry: evaluate core once, expose every subpath's live
|
|
102
|
+
* namespace through `globalThis.__NS_CORE_MODULES__` (the SAME registry the
|
|
103
|
+
* per-module bridge footers populate, so the vendor CJS `require()` shim and
|
|
104
|
+
* `_nsReq` lookups keep working unchanged), and re-export the package main so
|
|
105
|
+
* `/ns/core-bundle.mjs` itself has core's full named-export surface.
|
|
106
|
+
*/
|
|
107
|
+
export declare function buildCoreBundleEntryCode(subs: readonly string[]): string;
|
|
108
|
+
export declare function computeCoreBundleCacheKey(input: {
|
|
109
|
+
coreRoot: string;
|
|
110
|
+
coreVersion: string;
|
|
111
|
+
corePkgMtimeMs: number;
|
|
112
|
+
platform: string;
|
|
113
|
+
mode: string;
|
|
114
|
+
flavor: string;
|
|
115
|
+
defines: Record<string, string>;
|
|
116
|
+
nsConfigJson: string;
|
|
117
|
+
subs: readonly string[];
|
|
118
|
+
vitePackageVersion: string;
|
|
119
|
+
}): string;
|
|
120
|
+
export declare function tryLoadCoreBundleFromDisk(projectRoot: string, platform: string, key: string): CoreBundleState | null;
|
|
121
|
+
export declare function saveCoreBundleToDisk(projectRoot: string, platform: string, key: string, state: CoreBundleState, verbose?: boolean): void;
|
|
122
|
+
export declare function generateCoreBundle(options: GenerateCoreBundleOptions): Promise<CoreBundleState>;
|
|
123
|
+
export declare function createCoreBundleService(options: GenerateCoreBundleOptions): CoreBundleService;
|
|
124
|
+
/**
|
|
125
|
+
* Process-wide bundle service derived from the dev server's config + CLI
|
|
126
|
+
* flags. One dev server per process, so a module-level singleton matches the
|
|
127
|
+
* vendor manifest's lifecycle.
|
|
128
|
+
*/
|
|
129
|
+
export declare function getSharedCoreBundleService(server: ViteDevServer): CoreBundleService;
|
|
130
|
+
/** Test seam: drop the shared service so specs can mount fresh. */
|
|
131
|
+
export declare function resetSharedCoreBundleServiceForTests(): void;
|
|
132
|
+
export declare const CORE_BUNDLE_PATH = "/ns/core-bundle.mjs";
|
|
133
|
+
/**
|
|
134
|
+
* Shim served at `/ns/core` in bundle mode. `export * from` gives real,
|
|
135
|
+
* live named bindings straight off the bundle module record; the explicit
|
|
136
|
+
* default keeps the "default import + destructure" consumer rewrite working
|
|
137
|
+
* (see buildDefaultExportFooter in ns-core-cjs-shape.ts for that contract).
|
|
138
|
+
*/
|
|
139
|
+
export declare function buildCoreMainShimCode(): string;
|
|
140
|
+
export declare function buildCoreSubShimCode(sub: string, exportNames: readonly string[], hasOwnDefaultExport?: boolean): string;
|