@nativescript/vite 8.0.0-beta.0 → 8.0.0-rc.0
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 +73 -14
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +35 -2
- package/configuration/angular.js +541 -216
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +227 -77
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +17 -96
- package/configuration/javascript.js.map +1 -1
- package/configuration/react.js +41 -73
- package/configuration/react.js.map +1 -1
- package/configuration/solid.js +58 -6
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +15 -96
- 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/commonjs-plugins.d.ts +5 -2
- package/helpers/commonjs-plugins.js +126 -0
- package/helpers/commonjs-plugins.js.map +1 -1
- package/helpers/config-as-json.js +10 -0
- package/helpers/config-as-json.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.d.ts +2 -1
- package/helpers/dynamic-import-plugin.js +59 -53
- package/helpers/dynamic-import-plugin.js.map +1 -1
- package/helpers/esbuild-platform-resolver.js +9 -6
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +10 -4
- package/helpers/external-configs.js +63 -15
- package/helpers/external-configs.js.map +1 -1
- package/helpers/flavor.d.ts +13 -0
- package/helpers/flavor.js +18 -1
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +117 -0
- package/helpers/global-defines.js +209 -11
- 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/import-meta-path.d.ts +4 -0
- package/helpers/import-meta-path.js +5 -0
- package/helpers/import-meta-path.js.map +1 -0
- package/helpers/import-specifier.d.ts +1 -0
- package/helpers/import-specifier.js +18 -0
- package/helpers/import-specifier.js.map +1 -0
- package/helpers/init.js +6 -20
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +1 -0
- package/helpers/logging.js +65 -4
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +8 -2
- package/helpers/main-entry.js +622 -120
- 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 +42 -131
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.d.ts +19 -1
- package/helpers/nativeclass-transformer-plugin.js +324 -37
- 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 +106 -0
- package/helpers/ns-core-url.js +225 -0
- package/helpers/ns-core-url.js.map +1 -0
- 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 +312 -13
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +95 -23
- 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 +13 -0
- package/hmr/client/hmr-pending-overlay.js +41 -0
- package/hmr/client/hmr-pending-overlay.js.map +1 -0
- 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 +91 -1418
- 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 +100 -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 +14 -1
- package/hmr/client/utils.js +265 -54
- 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 +11 -0
- package/hmr/entry-runtime.js +566 -43
- 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/hmr/frameworks/angular/build/inline-decorator-component-templates.d.ts +3 -0
- package/hmr/frameworks/angular/build/inline-decorator-component-templates.js +231 -0
- 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/hmr/frameworks/angular/build/js-lexer.js +182 -0
- 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.d.ts +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/hmr/frameworks/angular/build/synthesize-injectable-factories.d.ts +3 -0
- package/hmr/frameworks/angular/build/synthesize-injectable-factories.js +241 -0
- 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 +2 -1
- package/hmr/frameworks/angular/client/index.js +637 -23
- 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 +37 -6
- 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 +697 -18
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/frameworks/angular/server/websocket-angular-entry.d.ts +2 -0
- package/hmr/frameworks/angular/server/websocket-angular-entry.js +68 -0
- package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.d.ts +94 -0
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +485 -0
- 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 +48 -16
- 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 +131 -24
- 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.d.ts +1 -0
- package/hmr/server/constants.js +21 -4
- 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 +130 -4
- package/hmr/server/core-sanitize.js +393 -32
- 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 +99 -0
- package/hmr/server/import-map.js +294 -0
- package/hmr/server/import-map.js.map +1 -0
- package/hmr/server/index.d.ts +2 -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.d.ts +204 -0
- package/hmr/server/ns-core-cjs-shape.js +271 -0
- package/hmr/server/ns-core-cjs-shape.js.map +1 -0
- 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 +114 -0
- package/hmr/server/perf-instrumentation.js +197 -0
- package/hmr/server/perf-instrumentation.js.map +1 -0
- 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.d.ts +5 -0
- package/hmr/server/runtime-graph-filter.js +28 -0
- package/hmr/server/runtime-graph-filter.js.map +1 -0
- 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.d.ts +12 -0
- package/hmr/server/shared-transform-request.js +143 -0
- package/hmr/server/shared-transform-request.js.map +1 -0
- 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 +22 -1
- package/hmr/server/vite-plugin.js +655 -58
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +68 -0
- package/hmr/server/websocket-core-bridge.js +370 -0
- package/hmr/server/websocket-core-bridge.js.map +1 -0
- package/hmr/server/websocket-device-transform.d.ts +3 -0
- package/hmr/server/websocket-device-transform.js +7 -0
- package/hmr/server/websocket-device-transform.js.map +1 -0
- package/hmr/server/websocket-graph-upsert.d.ts +21 -0
- package/hmr/server/websocket-graph-upsert.js +33 -0
- package/hmr/server/websocket-graph-upsert.js.map +1 -0
- package/hmr/server/websocket-hmr-pending.d.ts +29 -0
- package/hmr/server/websocket-hmr-pending.js +33 -0
- package/hmr/server/websocket-hmr-pending.js.map +1 -0
- 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 +21 -0
- package/hmr/server/websocket-module-bindings.js +504 -0
- package/hmr/server/websocket-module-bindings.js.map +1 -0
- package/hmr/server/websocket-module-specifiers.d.ts +96 -0
- package/hmr/server/websocket-module-specifiers.js +819 -0
- package/hmr/server/websocket-module-specifiers.js.map +1 -0
- 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 +163 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +19 -0
- package/hmr/server/websocket-ns-m-paths.js +115 -0
- package/hmr/server/websocket-ns-m-paths.js.map +1 -0
- package/hmr/server/websocket-ns-m-request.d.ts +46 -0
- package/hmr/server/websocket-ns-m-request.js +197 -0
- package/hmr/server/websocket-ns-m-request.js.map +1 -0
- 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 +89 -0
- package/hmr/server/websocket-served-module-helpers.js +935 -0
- package/hmr/server/websocket-served-module-helpers.js.map +1 -0
- package/hmr/server/websocket-txn.d.ts +6 -0
- package/hmr/server/websocket-txn.js +42 -0
- package/hmr/server/websocket-txn.js.map +1 -0
- package/hmr/server/websocket-vendor-unifier.d.ts +9 -0
- package/hmr/server/websocket-vendor-unifier.js +46 -0
- package/hmr/server/websocket-vendor-unifier.js.map +1 -0
- package/hmr/server/websocket.d.ts +7 -17
- package/hmr/server/websocket.js +723 -5376
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +107 -0
- package/hmr/shared/ns-globals.js +29 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/package-classifier.d.ts +9 -0
- package/hmr/shared/package-classifier.js +58 -0
- package/hmr/shared/package-classifier.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 +17 -0
- package/hmr/shared/runtime/boot-timeline.js +40 -0
- package/hmr/shared/runtime/boot-timeline.js.map +1 -0
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +97 -0
- package/hmr/shared/runtime/browser-runtime-contract.js +66 -0
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -0
- 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 +39 -0
- package/hmr/shared/runtime/dev-overlay.js +292 -0
- package/hmr/shared/runtime/dev-overlay.js.map +1 -0
- 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.d.ts +1 -0
- package/hmr/shared/runtime/module-provenance.js +64 -0
- package/hmr/shared/runtime/module-provenance.js.map +1 -0
- 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/platform-polyfills.d.ts +26 -0
- package/hmr/shared/runtime/platform-polyfills.js +122 -0
- package/hmr/shared/runtime/platform-polyfills.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.d.ts +1 -0
- package/hmr/shared/runtime/root-placeholder.js +778 -83
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.d.ts +1 -0
- package/hmr/shared/runtime/session-bootstrap.js +350 -0
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -0
- package/hmr/shared/runtime/vendor-bootstrap.js +54 -16
- 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/runtime/worker-tracking.d.ts +28 -0
- package/hmr/shared/runtime/worker-tracking.js +114 -0
- package/hmr/shared/runtime/worker-tracking.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 -0
- package/hmr/shared/vendor/manifest.js +341 -545
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/hmr/shared/vendor/registry.d.ts +2 -0
- package/hmr/shared/vendor/registry.js +118 -7
- 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 +76 -14
- package/runtime/core-aliases-early.js +103 -81
- 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/shims/solid-jsx-runtime.d.ts +7 -0
- package/shims/solid-jsx-runtime.js +17 -0
- package/shims/solid-jsx-runtime.js.map +1 -0
- package/helpers/angular/angular-linker.d.ts +0 -13
- package/helpers/angular/angular-linker.js +0 -189
- package/helpers/angular/angular-linker.js.map +0 -1
- package/helpers/angular/shared-linker.d.ts +0 -4
- package/helpers/angular/shared-linker.js +0 -39
- package/helpers/angular/shared-linker.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/shared/runtime/http-only-boot.d.ts +0 -1
- package/hmr/shared/runtime/http-only-boot.js +0 -124
- 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/hmr/entry-runtime.js
CHANGED
|
@@ -1,4 +1,289 @@
|
|
|
1
|
-
|
|
1
|
+
import { getGlobalScope } from './shared/runtime/global-scope.js';
|
|
2
|
+
import { markDevBootComplete } from './shared/runtime/boot-complete.js';
|
|
3
|
+
import { readNsRuntimeDevHostApi } from './shared/runtime/browser-runtime-contract.js';
|
|
4
|
+
import { installWorkerConstructorTracking } from './shared/runtime/worker-tracking.js';
|
|
5
|
+
// Must match the tag used by the boot virtual `app.css` emitter in
|
|
6
|
+
// `helpers/main-entry.ts` so HMR's remove/add pair replaces the
|
|
7
|
+
// boot-time selectors instead of stacking on top of them.
|
|
8
|
+
export const APP_CSS_TAG = 'app.css';
|
|
9
|
+
function resolveTaggedCssApi(coreModule) {
|
|
10
|
+
const candidates = [coreModule, coreModule?.default, globalThis];
|
|
11
|
+
for (const candidate of candidates) {
|
|
12
|
+
if (!candidate)
|
|
13
|
+
continue;
|
|
14
|
+
const add = candidate.addTaggedAdditionalCSS;
|
|
15
|
+
const remove = candidate.removeTaggedAdditionalCSS;
|
|
16
|
+
if (typeof add === 'function' && typeof remove === 'function') {
|
|
17
|
+
return { add: add.bind(candidate), remove: remove.bind(candidate) };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
function updateBootOverlay(stage, info) {
|
|
23
|
+
try {
|
|
24
|
+
const api = globalThis.__NS_HMR_DEV_OVERLAY__;
|
|
25
|
+
if (api && typeof api.setBootStage === 'function') {
|
|
26
|
+
api.setBootStage(stage, info);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch { }
|
|
30
|
+
}
|
|
31
|
+
async function updateBootOverlayAndYield(stage, info) {
|
|
32
|
+
updateBootOverlay(stage, info);
|
|
33
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
34
|
+
}
|
|
35
|
+
function prepareBootImportProgress(url, attempt, attempts) {
|
|
36
|
+
const g = globalThis;
|
|
37
|
+
g.__NS_HMR_BOOT_MAIN_URL__ = url;
|
|
38
|
+
g.__NS_HMR_BOOT_MAIN_ATTEMPT__ = attempt;
|
|
39
|
+
g.__NS_HMR_BOOT_MAIN_ATTEMPTS__ = attempts;
|
|
40
|
+
g.__NS_HMR_BOOT_MODULE_COUNT__ = 0;
|
|
41
|
+
g.__NS_HMR_BOOT_LAST_MODULE__ = '';
|
|
42
|
+
g.__NS_HMR_BOOT_LAST_PROGRESS__ = 0;
|
|
43
|
+
g.__NS_HMR_BOOT_LAST_PROGRESS_AT__ = 0;
|
|
44
|
+
g.__NS_HMR_BOOT_IMPORT_STARTED_AT__ = Date.now();
|
|
45
|
+
}
|
|
46
|
+
function clearBootImportProgress() {
|
|
47
|
+
const g = getGlobalScope();
|
|
48
|
+
delete g.__NS_HMR_BOOT_MAIN_URL__;
|
|
49
|
+
delete g.__NS_HMR_BOOT_MAIN_ATTEMPT__;
|
|
50
|
+
delete g.__NS_HMR_BOOT_MAIN_ATTEMPTS__;
|
|
51
|
+
delete g.__NS_HMR_BOOT_MODULE_COUNT__;
|
|
52
|
+
delete g.__NS_HMR_BOOT_LAST_MODULE__;
|
|
53
|
+
delete g.__NS_HMR_BOOT_LAST_PROGRESS__;
|
|
54
|
+
delete g.__NS_HMR_BOOT_LAST_PROGRESS_AT__;
|
|
55
|
+
delete g.__NS_HMR_BOOT_IMPORT_STARTED_AT__;
|
|
56
|
+
}
|
|
57
|
+
function buildBootImportDetail(url) {
|
|
58
|
+
const g = globalThis;
|
|
59
|
+
const count = Number(g.__NS_HMR_BOOT_MODULE_COUNT__ || 0);
|
|
60
|
+
const lastModule = typeof g.__NS_HMR_BOOT_LAST_MODULE__ === 'string' ? g.__NS_HMR_BOOT_LAST_MODULE__ : '';
|
|
61
|
+
const lines = [count > 0 ? `Evaluated ${count} modules` : 'Resolving the module graph'];
|
|
62
|
+
lines.push(lastModule || url);
|
|
63
|
+
return lines.join('\n');
|
|
64
|
+
}
|
|
65
|
+
// Inlined copy of `boot-progress.ts::computeBootImportProgress` +
|
|
66
|
+
// `applyMonotonicBootProgress`. This file is the device-side entry
|
|
67
|
+
// runtime for the http-bootloader fallback path; relative imports from
|
|
68
|
+
// `shared/runtime/` would cross the runtime boundary and slow
|
|
69
|
+
// first-byte. Keep the formula in sync with `boot-progress.ts` —
|
|
70
|
+
// `boot-progress.spec.ts` pins the canonical values.
|
|
71
|
+
function computeBootImportProgress() {
|
|
72
|
+
const g = globalThis;
|
|
73
|
+
const count = Number(g.__NS_HMR_BOOT_MODULE_COUNT__ || 0);
|
|
74
|
+
const startedAt = Number(g.__NS_HMR_BOOT_IMPORT_STARTED_AT__ || Date.now());
|
|
75
|
+
const elapsedMs = Math.max(0, Date.now() - startedAt);
|
|
76
|
+
const progressFromCount = Math.min(40, Math.floor(count / 2));
|
|
77
|
+
const progressFromTime = Math.min(62, Math.floor(elapsedMs / 250));
|
|
78
|
+
const candidate = Math.min(94, 30 + Math.min(62, progressFromCount + progressFromTime));
|
|
79
|
+
const previousRaw = g.__NS_HMR_BOOT_LAST_PROGRESS__;
|
|
80
|
+
const previous = typeof previousRaw === 'number' && Number.isFinite(previousRaw) ? previousRaw : 0;
|
|
81
|
+
const next = Math.max(previous, candidate);
|
|
82
|
+
try {
|
|
83
|
+
g.__NS_HMR_BOOT_LAST_PROGRESS__ = next;
|
|
84
|
+
}
|
|
85
|
+
catch { }
|
|
86
|
+
return next;
|
|
87
|
+
}
|
|
88
|
+
function startBootImportHeartbeat(url, attempt, attempts) {
|
|
89
|
+
// 250 ms cadence matches `session-bootstrap.ts::startBootImportHeartbeat`
|
|
90
|
+
// so both boot paths feel equally responsive.
|
|
91
|
+
const timer = setInterval(() => {
|
|
92
|
+
const g = globalThis;
|
|
93
|
+
if (g.__NS_HMR_BOOT_COMPLETE__) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
updateBootOverlay('importing-main', {
|
|
97
|
+
detail: buildBootImportDetail(url),
|
|
98
|
+
attempt,
|
|
99
|
+
attempts,
|
|
100
|
+
progress: computeBootImportProgress(),
|
|
101
|
+
});
|
|
102
|
+
}, 250);
|
|
103
|
+
return () => clearInterval(timer);
|
|
104
|
+
}
|
|
105
|
+
export function installHttpCoreCssSupport(coreModule, verbose) {
|
|
106
|
+
try {
|
|
107
|
+
const g = getGlobalScope();
|
|
108
|
+
const core = coreModule?.default ?? coreModule;
|
|
109
|
+
const Application = (core && (typeof core.addCss === 'function' ? core : undefined)) || (core?.Application && typeof core.Application.addCss === 'function' ? core.Application : undefined) || (coreModule?.Application && typeof coreModule.Application.addCss === 'function' ? coreModule.Application : undefined) || g.Application;
|
|
110
|
+
if (!Application?.addCss) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
// Re-trigger styling on every reachable root view. The core bridge's
|
|
114
|
+
// Application realm is not always the realm whose Application.run()
|
|
115
|
+
// committed the root (monorepo per-module serving loads core through
|
|
116
|
+
// /ns/m/packages/... while the bridge re-exports @fs-spelled modules),
|
|
117
|
+
// so also consult the seeded global and the Application singletons the
|
|
118
|
+
// root-placeholder run-wrapper records in __NS_DEV_KNOWN_APPLICATIONS__.
|
|
119
|
+
const refreshRootViews = () => {
|
|
120
|
+
const candidates = [Application, g.Application];
|
|
121
|
+
try {
|
|
122
|
+
const known = g.__NS_DEV_KNOWN_APPLICATIONS__;
|
|
123
|
+
if (Array.isArray(known))
|
|
124
|
+
candidates.push(...known);
|
|
125
|
+
}
|
|
126
|
+
catch { }
|
|
127
|
+
const seenRoots = new Set();
|
|
128
|
+
for (const candidate of candidates) {
|
|
129
|
+
try {
|
|
130
|
+
const rootView = candidate?.getRootView?.();
|
|
131
|
+
if (!rootView || seenRoots.has(rootView))
|
|
132
|
+
continue;
|
|
133
|
+
seenRoots.add(rootView);
|
|
134
|
+
if (typeof rootView._onCssStateChange === 'function') {
|
|
135
|
+
rootView._onCssStateChange();
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const cls = rootView.className || '';
|
|
139
|
+
rootView.className = cls + ' ';
|
|
140
|
+
rootView.className = cls;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch { }
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
// Replace selectors via remove + add tagged pair so deleted
|
|
147
|
+
// rules disappear (the additive `Application.addCss` cannot
|
|
148
|
+
// undo previously installed selectors).
|
|
149
|
+
const taggedCss = resolveTaggedCssApi(coreModule);
|
|
150
|
+
const applyCss = (cssText, refreshRoot = true) => {
|
|
151
|
+
if (typeof cssText !== 'string' || !cssText.length) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
let appliedTagged = false;
|
|
155
|
+
if (taggedCss.add && taggedCss.remove) {
|
|
156
|
+
try {
|
|
157
|
+
taggedCss.remove(APP_CSS_TAG);
|
|
158
|
+
taggedCss.add(cssText, APP_CSS_TAG);
|
|
159
|
+
appliedTagged = true;
|
|
160
|
+
}
|
|
161
|
+
catch (taggedError) {
|
|
162
|
+
if (verbose)
|
|
163
|
+
console.warn('[ns-entry] tagged CSS replace failed, falling back to addCss:', taggedError?.message || taggedError);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (!appliedTagged) {
|
|
167
|
+
Application.addCss(cssText);
|
|
168
|
+
}
|
|
169
|
+
if (!refreshRoot) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
refreshRootViews();
|
|
173
|
+
};
|
|
174
|
+
g.__NS_HMR_APPLY_CSS__ = applyCss;
|
|
175
|
+
// Device CSS applier for the fallback HTTP-bootloader path (the native
|
|
176
|
+
// dev-session path installs the same one from `hmr/client`). Per-tag
|
|
177
|
+
// remove+add keeps each source independently replaceable on hot-update.
|
|
178
|
+
const registerCss = (tag, cssText) => {
|
|
179
|
+
if (typeof cssText !== 'string' || !cssText.length) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
if (taggedCss.add && taggedCss.remove) {
|
|
184
|
+
taggedCss.remove(tag);
|
|
185
|
+
taggedCss.add(cssText, tag);
|
|
186
|
+
}
|
|
187
|
+
else if (Application.addCss) {
|
|
188
|
+
Application.addCss(cssText);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
catch (cssErr) {
|
|
192
|
+
if (verbose)
|
|
193
|
+
console.warn('[ns-entry] CSS register/apply failed for', tag, cssErr?.message || cssErr);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
// Live edit (boot complete): refresh the root so mounted views pick up
|
|
197
|
+
// the replaced selectors. Cold boot needs no refresh (views not built yet).
|
|
198
|
+
if (g.__NS_HMR_BOOT_COMPLETE__) {
|
|
199
|
+
refreshRootViews();
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
g.__NS_REGISTER_CSS__ = registerCss;
|
|
203
|
+
// Drain any CSS registered before this applier was installed.
|
|
204
|
+
try {
|
|
205
|
+
const pending = g.__NS_PENDING_CSS__;
|
|
206
|
+
if (pending && typeof pending === 'object') {
|
|
207
|
+
for (const pendingTag of Object.keys(pending)) {
|
|
208
|
+
registerCss(pendingTag, pending[pendingTag]);
|
|
209
|
+
}
|
|
210
|
+
g.__NS_PENDING_CSS__ = null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch { }
|
|
214
|
+
if (!g.__NS_HMR_HTTP_APP_CSS_APPLIED__) {
|
|
215
|
+
// Cold boot: prefer the pre-parsed rework AST stashed by
|
|
216
|
+
// `helpers/main-entry.ts` so the HTTP-core realm follows the
|
|
217
|
+
// SAME application path as the no-HMR rolldown bundle. If the
|
|
218
|
+
// AST isn't present (e.g. older bundle, future entry shape),
|
|
219
|
+
// fall back to the raw text path. Live HMR edits arriving via
|
|
220
|
+
// the dev-server WebSocket continue to use `applyCss(rawText)`
|
|
221
|
+
// — `addTaggedAdditionalCSS` accepts either via
|
|
222
|
+
// `CSSSource.fromDetect`.
|
|
223
|
+
const appCssAst = g.__NS_HMR_APP_CSS_AST__;
|
|
224
|
+
const appCssText = g.__NS_HMR_APP_CSS__;
|
|
225
|
+
let cssApplied = false;
|
|
226
|
+
if (appCssAst && typeof appCssAst === 'object' && taggedCss.add && taggedCss.remove) {
|
|
227
|
+
try {
|
|
228
|
+
taggedCss.remove(APP_CSS_TAG);
|
|
229
|
+
taggedCss.add(appCssAst, APP_CSS_TAG);
|
|
230
|
+
cssApplied = true;
|
|
231
|
+
if (verbose)
|
|
232
|
+
console.info('[ns-entry] app.css applied in HTTP core realm via AST');
|
|
233
|
+
}
|
|
234
|
+
catch (astError) {
|
|
235
|
+
if (verbose)
|
|
236
|
+
console.warn('[ns-entry] AST CSS apply failed, falling back to raw text:', astError?.message || astError);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
if (!cssApplied && typeof appCssText === 'string' && appCssText.length) {
|
|
240
|
+
applyCss(appCssText);
|
|
241
|
+
cssApplied = true;
|
|
242
|
+
if (verbose)
|
|
243
|
+
console.info('[ns-entry] app.css applied in HTTP core realm via raw text');
|
|
244
|
+
}
|
|
245
|
+
if (cssApplied) {
|
|
246
|
+
g.__NS_HMR_HTTP_APP_CSS_APPLIED__ = true;
|
|
247
|
+
// On the http-bootloader path this install runs BEFORE the app
|
|
248
|
+
// mounts, so no refresh is needed. On the dev-session path the
|
|
249
|
+
// bootstrap installs this lazily AFTER boot completes — views
|
|
250
|
+
// are already mounted with stale (empty) styling, so re-style.
|
|
251
|
+
if (g.__NS_HMR_BOOT_COMPLETE__) {
|
|
252
|
+
refreshRootViews();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return applyCss;
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
if (verbose)
|
|
260
|
+
console.warn('[ns-entry] failed to install HTTP core CSS support:', error?.message || error);
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
export async function preloadHttpCoreStyleScope(importHttp, origin, verbose) {
|
|
265
|
+
// Use the canonical, unversioned subpath form `/ns/core/ui/styling/style-scope`.
|
|
266
|
+
// Every consumer of `@nativescript/core/ui/styling/style-scope` (cold-boot
|
|
267
|
+
// preload here, app-side imports, vendor `require()` shims via the runtime
|
|
268
|
+
// import map) lands on the same URL string, so iOS's HTTP-ESM loader keys
|
|
269
|
+
// them to one module record and the style-scope module's class identity is
|
|
270
|
+
// shared across realms.
|
|
271
|
+
const url = String(origin || '') + '/ns/core/ui/styling/style-scope';
|
|
272
|
+
const t0 = Date.now();
|
|
273
|
+
try {
|
|
274
|
+
await importHttp(url);
|
|
275
|
+
if (verbose) {
|
|
276
|
+
console.info('[ns-entry] HTTP core style-scope preloaded');
|
|
277
|
+
}
|
|
278
|
+
return { ok: true, ms: Date.now() - t0, url };
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
const result = { ok: false, ms: Date.now() - t0, url, err: String(error && (error.message || error)) };
|
|
282
|
+
if (verbose)
|
|
283
|
+
console.warn('[ns-entry] HTTP core style-scope preload failed:', error?.message || error);
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
2
287
|
function parseStackUrlLineCol(err) {
|
|
3
288
|
try {
|
|
4
289
|
const stack = (err && (err.stack || err.message)) || '';
|
|
@@ -23,106 +308,324 @@ async function fetchCodeframe(u, line) {
|
|
|
23
308
|
const num = String(i).padStart(4, ' ');
|
|
24
309
|
context += `${mark}${num}: ${lines[i - 1]}\n`;
|
|
25
310
|
}
|
|
26
|
-
|
|
311
|
+
if (globalThis.__NS_ENV_VERBOSE__)
|
|
312
|
+
console.warn('[ns-entry][diag]', u === globalThis.__NS_ENTRY_LAST_TARGET__ ? 'sanitized' : 'raw', hash ? `(hash ${hash})` : '', '\n' + context);
|
|
27
313
|
}
|
|
28
314
|
catch (fe) {
|
|
29
|
-
|
|
315
|
+
if (globalThis.__NS_ENV_VERBOSE__)
|
|
30
316
|
console.warn('[ns-entry][diag] fetch failed', u, fe && (fe.message || fe));
|
|
31
|
-
}
|
|
32
|
-
catch { }
|
|
33
317
|
}
|
|
34
318
|
}
|
|
35
319
|
export default async function startEntry(opts) {
|
|
320
|
+
const D = '[entry-rt-diag]';
|
|
36
321
|
const ORIGIN = String(opts.origin || '');
|
|
37
322
|
const MAIN = String(opts.main || `${__NS_APP_ROOT_VIRTUAL__}/app.ts`);
|
|
38
323
|
const VER = String(opts.ver || '0');
|
|
39
324
|
const VERBOSE = !!opts.verbose;
|
|
325
|
+
if (VERBOSE)
|
|
326
|
+
console.log(D, 'startEntry called', { origin: ORIGIN, main: MAIN, ver: VER });
|
|
327
|
+
// Track every `Worker` construction before any app/vendor module can
|
|
328
|
+
// evaluate (idempotent — the session-bootstrap path installs the same
|
|
329
|
+
// patch). The HMR client sweeps the tracked set before framework
|
|
330
|
+
// reboots; worker teardown is fully userland.
|
|
331
|
+
installWorkerConstructorTracking(getGlobalScope(), { verbose: VERBOSE });
|
|
40
332
|
// Announce chosen origin globally for any consumers (e.g., HMR client or helpers)
|
|
41
333
|
try {
|
|
42
334
|
globalThis.__NS_HTTP_ORIGIN__ = ORIGIN;
|
|
43
335
|
}
|
|
44
336
|
catch { }
|
|
45
337
|
// Module-local trace snapshot
|
|
46
|
-
const TRACE = { version: VER, origin: ORIGIN, mainPath: MAIN, t0: Date.now(), preload: { rt: {}, core: {} }, main: {} };
|
|
338
|
+
const TRACE = { version: VER, origin: ORIGIN, mainPath: MAIN, t0: Date.now(), preload: { rt: {}, core: {}, coreStyleScope: {} }, main: {}, importMap: {} };
|
|
47
339
|
// Native HTTP ESM import only.
|
|
48
340
|
// Ensure a single canonical module realm.
|
|
49
341
|
const importHttp = async (u) => {
|
|
50
342
|
return await import(/* @vite-ignore */ u);
|
|
51
343
|
};
|
|
52
344
|
try {
|
|
53
|
-
//
|
|
345
|
+
// Configure runtime with import map before loading any modules.
|
|
346
|
+
// This enables the native runtime to resolve bare specifiers through the
|
|
347
|
+
// import map instead of relying on Vite-side import rewriting.
|
|
348
|
+
//
|
|
349
|
+
// session-bootstrap may have already fetched the import map
|
|
350
|
+
// and configured the runtime before we were invoked. In that case the
|
|
351
|
+
// shared flag on globalThis lets us skip a redundant fetch (~100-200ms).
|
|
352
|
+
//
|
|
353
|
+
// once the import map is in place, the /ns/rt and /ns/core
|
|
354
|
+
// imports (plus the style-scope preload) are independent HTTP GETs. We
|
|
355
|
+
// fire them in parallel so the boot path is bounded by the slowest
|
|
356
|
+
// payload rather than the sum.
|
|
357
|
+
let configureLoader = readNsRuntimeDevHostApi(globalThis).configureLoader;
|
|
358
|
+
const g = globalThis;
|
|
359
|
+
const importMapPromise = (async () => {
|
|
360
|
+
if (typeof configureLoader !== 'function') {
|
|
361
|
+
// Re-resolve `ns:module` fresh — an earlier snapshot may have
|
|
362
|
+
// been taken through a stale or stubbed scope.
|
|
363
|
+
configureLoader = readNsRuntimeDevHostApi(globalThis).configureLoader;
|
|
364
|
+
}
|
|
365
|
+
if (typeof configureLoader !== 'function') {
|
|
366
|
+
// NOT verbose-gated: without the import map every bare specifier
|
|
367
|
+
// in served modules is unresolvable and the session degrades into
|
|
368
|
+
// an undebuggable stall. Surface the contract violation loudly.
|
|
369
|
+
console.error('[ns-entry] ns:module configureLoader is unavailable — the import map cannot be installed and bare-specifier imports WILL fail. Update @nativescript/ios to a runtime that provides the ns:module builtin module.');
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
if (g.__NS_IMPORT_MAP_CONFIGURED__ === true) {
|
|
373
|
+
TRACE.importMap = { ok: true, ms: 0, cached: true };
|
|
374
|
+
if (VERBOSE)
|
|
375
|
+
console.info('[ns-entry] import map already configured by earlier boot stage');
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
await updateBootOverlayAndYield('configuring-import-map', {
|
|
379
|
+
detail: ORIGIN + '/ns/import-map.json',
|
|
380
|
+
});
|
|
381
|
+
const t_imap = Date.now();
|
|
382
|
+
try {
|
|
383
|
+
const imapRes = await fetch(ORIGIN + '/ns/import-map.json');
|
|
384
|
+
if (imapRes.ok) {
|
|
385
|
+
const config = await imapRes.json();
|
|
386
|
+
configureLoader({
|
|
387
|
+
importMap: config.importMap,
|
|
388
|
+
volatilePatterns: config.volatilePatterns,
|
|
389
|
+
// Server-owned URL vocabulary for the runtime's canonical-key
|
|
390
|
+
// function; runtimes that predate the field ignore it.
|
|
391
|
+
...(config.canonicalization && typeof config.canonicalization === 'object' ? { canonicalization: config.canonicalization } : {}),
|
|
392
|
+
});
|
|
393
|
+
try {
|
|
394
|
+
g.__NS_IMPORT_MAP_CONFIGURED__ = true;
|
|
395
|
+
}
|
|
396
|
+
catch { }
|
|
397
|
+
TRACE.importMap = { ok: true, ms: Date.now() - t_imap, entries: Object.keys(config.importMap?.imports || {}).length };
|
|
398
|
+
if (VERBOSE)
|
|
399
|
+
console.info('[ns-entry] import map configured with', TRACE.importMap.entries, 'entries');
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
TRACE.importMap = { ok: false, ms: Date.now() - t_imap, status: imapRes.status };
|
|
403
|
+
if (VERBOSE)
|
|
404
|
+
console.warn('[ns-entry] import map fetch failed:', imapRes.status);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
catch (e_imap) {
|
|
408
|
+
TRACE.importMap = { ok: false, ms: Date.now() - t_imap, err: String(e_imap && (e_imap.message || e_imap)) };
|
|
409
|
+
if (VERBOSE)
|
|
410
|
+
console.warn('[ns-entry] import map error:', e_imap?.message);
|
|
411
|
+
}
|
|
412
|
+
})();
|
|
413
|
+
// Start the runtime bridge preload as soon as the import map is ready.
|
|
414
|
+
// Any bare-specifier resolution inside /ns/rt depends on the import map,
|
|
415
|
+
// so we chain it after importMapPromise — but otherwise let it race.
|
|
416
|
+
// Canonical (unversioned) URL: one module record per bridge, matching
|
|
417
|
+
// every served-module import of `/ns/rt`.
|
|
54
418
|
const t_rt = Date.now();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
419
|
+
const RT_URL = ORIGIN + '/ns/rt';
|
|
420
|
+
const rtPromise = importMapPromise.then(async () => {
|
|
421
|
+
await updateBootOverlayAndYield('loading-runtime-bridge', {
|
|
422
|
+
detail: RT_URL,
|
|
423
|
+
});
|
|
424
|
+
try {
|
|
425
|
+
const mod = await importHttp(RT_URL);
|
|
426
|
+
TRACE.preload.rt = { ok: true, ms: Date.now() - t_rt, url: RT_URL };
|
|
427
|
+
return mod;
|
|
428
|
+
}
|
|
429
|
+
catch (e_rt) {
|
|
430
|
+
TRACE.preload.rt = { ok: false, ms: Date.now() - t_rt, url: RT_URL, err: String(e_rt && (e_rt.message || e_rt)) };
|
|
431
|
+
console.warn('[ns-entry] /ns/rt preload failed:', e_rt && (e_rt.message || e_rt));
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
// /ns/core and the style-scope preload are both core-realm side effects
|
|
436
|
+
// that run independently of /ns/rt. We fire them in parallel with rt so
|
|
437
|
+
// the aggregate cost is max(rt, core, styleScope) instead of the sum.
|
|
438
|
+
// Preload the canonical, unversioned `/ns/core` URL so this cold-boot
|
|
439
|
+
// fetch shares an iOS HTTP-ESM module record (and a single class-
|
|
440
|
+
// identity realm) with vendor `require('@nativescript/core')` lookups
|
|
441
|
+
// resolved through the runtime import map, the `/ns/rt` bridge's
|
|
442
|
+
// dynamic core import, and every served-module import. Threading a
|
|
443
|
+
// `/<version>` segment here would create two separate module records
|
|
444
|
+
// for byte-identical content, splitting `Frame`/`Page`/`View` class
|
|
445
|
+
// identity across the boundary and leaving the dev placeholder root
|
|
446
|
+
// visible after `Application.resetRootView(realFrame)` no-ops via a
|
|
447
|
+
// failed `instanceof Frame` check.
|
|
62
448
|
const t_core = Date.now();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
449
|
+
const CORE_URL = ORIGIN + '/ns/core';
|
|
450
|
+
const corePromise = importMapPromise.then(async () => {
|
|
451
|
+
await updateBootOverlayAndYield('loading-core-bridge', {
|
|
452
|
+
detail: CORE_URL,
|
|
453
|
+
});
|
|
454
|
+
try {
|
|
455
|
+
const mod = await importHttp(CORE_URL);
|
|
456
|
+
TRACE.preload.core = { ok: true, ms: Date.now() - t_core, url: CORE_URL };
|
|
457
|
+
return mod;
|
|
458
|
+
}
|
|
459
|
+
catch (e_core) {
|
|
460
|
+
TRACE.preload.core = { ok: false, ms: Date.now() - t_core, url: CORE_URL, err: String(e_core && (e_core.message || e_core)) };
|
|
461
|
+
console.warn('[ns-entry] /ns/core preload failed:', e_core && (e_core.message || e_core));
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
const STYLE_SCOPE_URL = ORIGIN + '/ns/core/ui/styling/style-scope';
|
|
466
|
+
const styleScopePromise = importMapPromise.then(async () => {
|
|
467
|
+
await updateBootOverlayAndYield('preloading-style-scope', {
|
|
468
|
+
detail: STYLE_SCOPE_URL,
|
|
469
|
+
});
|
|
470
|
+
return preloadHttpCoreStyleScope(importHttp, ORIGIN, VERBOSE);
|
|
471
|
+
});
|
|
472
|
+
// Wait for all parallel preloads to resolve. Rejections are already
|
|
473
|
+
// absorbed inside each wrapper, so Promise.all never throws here.
|
|
474
|
+
const [, coreBridge, styleScopeResult] = await Promise.all([rtPromise, corePromise, styleScopePromise]);
|
|
475
|
+
TRACE.preload.coreStyleScope = styleScopeResult;
|
|
476
|
+
if (coreBridge) {
|
|
477
|
+
await updateBootOverlayAndYield('installing-css', {
|
|
478
|
+
detail: 'Applying app.css in the shared HTTP core realm.',
|
|
479
|
+
});
|
|
480
|
+
installHttpCoreCssSupport(coreBridge, VERBOSE);
|
|
69
481
|
}
|
|
482
|
+
// Canonical entry URL — no `__ns_boot__` path decoration. The
|
|
483
|
+
// boot-progress snippet is injected self-gating by the /ns/m module
|
|
484
|
+
// server (it no-ops once `__NS_HMR_BOOT_COMPLETE__` flips), so the
|
|
485
|
+
// entry URL matches the steady-state HMR form and shares one module
|
|
486
|
+
// identity. `?v=` is a dev-endpoint query the runtime canonicalizer
|
|
487
|
+
// strips from the cache key.
|
|
70
488
|
const MAIN_URL = ORIGIN + '/ns/m' + MAIN + '?v=' + VER;
|
|
489
|
+
const MAIN_IMPORT_URL = MAIN_URL;
|
|
71
490
|
if (VERBOSE)
|
|
72
|
-
console.
|
|
73
|
-
globalThis.__NS_ENTRY_LAST_TARGET__ =
|
|
491
|
+
console.log(D, 'importing main module:', MAIN_URL);
|
|
492
|
+
globalThis.__NS_ENTRY_LAST_TARGET__ = MAIN_IMPORT_URL; // used by fetchCodeframe sanitized-vs-raw tag
|
|
74
493
|
const t_main = Date.now();
|
|
75
494
|
let lastMainErr = null;
|
|
76
495
|
for (let attempt = 0; attempt < 6; attempt++) {
|
|
496
|
+
prepareBootImportProgress(MAIN_URL, attempt + 1, 6);
|
|
497
|
+
const stopBootImportHeartbeat = startBootImportHeartbeat(MAIN_URL, attempt + 1, 6);
|
|
77
498
|
try {
|
|
78
|
-
|
|
499
|
+
await updateBootOverlayAndYield('importing-main', {
|
|
500
|
+
detail: buildBootImportDetail(MAIN_URL),
|
|
501
|
+
attempt: attempt + 1,
|
|
502
|
+
attempts: 6,
|
|
503
|
+
progress: computeBootImportProgress(),
|
|
504
|
+
});
|
|
505
|
+
const url = attempt === 0 ? MAIN_IMPORT_URL : MAIN_IMPORT_URL + '&r=' + String(Date.now());
|
|
506
|
+
if (VERBOSE)
|
|
507
|
+
console.log(D, 'import attempt', attempt, url);
|
|
79
508
|
await importHttp(url);
|
|
509
|
+
if (VERBOSE)
|
|
510
|
+
console.log(D, 'import succeeded on attempt', attempt, 'took', Date.now() - t_main, 'ms');
|
|
80
511
|
lastMainErr = null;
|
|
81
512
|
break;
|
|
82
513
|
}
|
|
83
514
|
catch (e_main) {
|
|
84
515
|
lastMainErr = e_main;
|
|
516
|
+
if (VERBOSE)
|
|
517
|
+
console.log(D, 'import attempt', attempt, 'FAILED:', e_main?.message || e_main);
|
|
85
518
|
// brief backoff; allows dev server and device network to settle
|
|
86
519
|
await new Promise((r) => setTimeout(r, 150 + attempt * 150));
|
|
87
520
|
}
|
|
521
|
+
finally {
|
|
522
|
+
stopBootImportHeartbeat();
|
|
523
|
+
}
|
|
88
524
|
}
|
|
525
|
+
clearBootImportProgress();
|
|
89
526
|
if (lastMainErr)
|
|
90
527
|
throw lastMainErr;
|
|
91
|
-
TRACE.main = { ok: true, ms: Date.now() - t_main, url:
|
|
528
|
+
TRACE.main = { ok: true, ms: Date.now() - t_main, url: MAIN_IMPORT_URL };
|
|
529
|
+
await updateBootOverlayAndYield('waiting-for-app', {
|
|
530
|
+
detail: 'Waiting for the real application root to replace the boot placeholder.',
|
|
531
|
+
});
|
|
92
532
|
globalThis.__NS_ENTRY_OK__ = true;
|
|
93
|
-
|
|
94
|
-
|
|
533
|
+
updateBootOverlay('ready', {
|
|
534
|
+
detail: 'HTTP HMR boot is ready. The app root should take over now.',
|
|
535
|
+
});
|
|
536
|
+
if (VERBOSE)
|
|
537
|
+
console.log(D, '__NS_HMR_BOOT_COMPLETE__ = true');
|
|
538
|
+
// Flips the JS global AND the native cold-boot gate
|
|
539
|
+
// (ns:module `setDevBootComplete`) so the runtime stops pumping the
|
|
540
|
+
// JS-thread runloop between synchronous fetches.
|
|
541
|
+
markDevBootComplete();
|
|
542
|
+
// Belt-and-suspenders: kick off the placeholder finalize poll now. The
|
|
543
|
+
// `Application.resetRootView` wrapper (installed by `installRootPlaceholder`
|
|
544
|
+
// or `installCoreAliasesEarly`) is the primary trigger, but on Android
|
|
545
|
+
// HTTP HMR boot the early hook can silently fail to install (it runs
|
|
546
|
+
// before `@nativescript/core/bundle-entry-points` loads, when
|
|
547
|
+
// `g.Application` is still `undefined`). Calling the restore hook here
|
|
548
|
+
// runs `tryFinalizeBootPlaceholder` immediately and, if the real root
|
|
549
|
+
// isn't committed yet (it usually isn't — Angular bootstrap is still
|
|
550
|
+
// async), schedules a ~100 ms poll that succeeds the moment the
|
|
551
|
+
// framework's `Application.run({ create })` or `resetRootView()` call
|
|
552
|
+
// commits a non-placeholder root. Without this safety net Android can
|
|
553
|
+
// hang at "Waiting for the app root view (94 %)" indefinitely.
|
|
95
554
|
try {
|
|
96
|
-
const g =
|
|
97
|
-
|
|
555
|
+
const g = getGlobalScope();
|
|
556
|
+
const restorePlaceholder = g.__NS_DEV_RESTORE_PLACEHOLDER__;
|
|
557
|
+
// Verbose-gated: if an app-root stall surfaces (e.g. Android
|
|
558
|
+
// hanging at "Waiting for the app root view"), flip
|
|
559
|
+
// `verbose: true` in the HMR config to see this plus the
|
|
560
|
+
// matching `[ns-placeholder][diag]` chain.
|
|
561
|
+
try {
|
|
562
|
+
if (VERBOSE) {
|
|
563
|
+
console.warn('[ns-entry][diag] main import done; kicking placeholder finalize', {
|
|
564
|
+
hasRestoreCallback: typeof restorePlaceholder === 'function',
|
|
565
|
+
hasPlaceholderRoot: !!g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__,
|
|
566
|
+
hasApplication: !!(g.__NS_DEV_PLACEHOLDER_APPLICATION__ || g.Application),
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
catch { }
|
|
571
|
+
if (typeof restorePlaceholder === 'function') {
|
|
572
|
+
restorePlaceholder('main-import-done');
|
|
573
|
+
if (VERBOSE)
|
|
574
|
+
console.log(D, 'kicked __NS_DEV_RESTORE_PLACEHOLDER__ after main import');
|
|
575
|
+
}
|
|
98
576
|
}
|
|
99
577
|
catch { }
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
578
|
+
// The placeholder patches Application.run() → resetRootView(), so the
|
|
579
|
+
// app's Application.run() call in the main module transparently replaced
|
|
580
|
+
// the placeholder with the real app UI. Restore original run() now.
|
|
581
|
+
try {
|
|
582
|
+
const g = getGlobalScope();
|
|
583
|
+
if (typeof g.__NS_DEV_ORIGINAL_APP_RUN__ === 'function') {
|
|
584
|
+
// Restore original Application.run on ALL targets (mirrors placeholder patching)
|
|
585
|
+
const origRun = g.__NS_DEV_ORIGINAL_APP_RUN__;
|
|
586
|
+
const Application = g.Application || (g.__nsVendorRegistry?.get?.('@nativescript/core') || {}).Application;
|
|
587
|
+
if (Application) {
|
|
588
|
+
Application.run = origRun;
|
|
589
|
+
try {
|
|
590
|
+
const proto = Object.getPrototypeOf(Application);
|
|
591
|
+
if (proto && proto.run !== origRun)
|
|
592
|
+
proto.run = origRun;
|
|
593
|
+
}
|
|
594
|
+
catch { }
|
|
595
|
+
}
|
|
596
|
+
// Also restore on vendor-registry Application if different
|
|
597
|
+
try {
|
|
598
|
+
const reg = g.__nsVendorRegistry;
|
|
599
|
+
const vendorMod = reg?.get?.('@nativescript/core');
|
|
600
|
+
const vendorApp = vendorMod?.Application || vendorMod?.default?.Application;
|
|
601
|
+
if (vendorApp && vendorApp !== Application && vendorApp.run !== origRun) {
|
|
602
|
+
vendorApp.run = origRun;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
catch { }
|
|
606
|
+
delete g.__NS_DEV_ORIGINAL_APP_RUN__;
|
|
607
|
+
if (VERBOSE)
|
|
608
|
+
console.log(D, 'restored original Application.run');
|
|
609
|
+
}
|
|
109
610
|
}
|
|
611
|
+
catch { }
|
|
110
612
|
}
|
|
111
613
|
catch (e) {
|
|
614
|
+
clearBootImportProgress();
|
|
112
615
|
const errInfo = { message: String(e && (e.message || e)), stack: e && e.stack ? String(e.stack) : '' };
|
|
113
616
|
const loc = parseStackUrlLineCol(e);
|
|
114
617
|
const TARGET = loc.url || globalThis.__NS_ENTRY_LAST_TARGET__;
|
|
115
618
|
errInfo.url = loc.url;
|
|
116
619
|
errInfo.line = loc.line;
|
|
117
620
|
errInfo.column = loc.column;
|
|
621
|
+
updateBootOverlay('error', {
|
|
622
|
+
detail: errInfo.message,
|
|
623
|
+
});
|
|
118
624
|
globalThis.__NS_ENTRY_ERROR__ = errInfo;
|
|
119
625
|
TRACE.error = errInfo;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
console.error(errInfo.stack);
|
|
124
|
-
}
|
|
125
|
-
catch { }
|
|
626
|
+
console.error('[ns-entry] failed to import main via HTTP', errInfo.message);
|
|
627
|
+
if (errInfo.stack && VERBOSE)
|
|
628
|
+
console.error(errInfo.stack);
|
|
126
629
|
// Always provide minimal diagnostics on error, even if verbose=false
|
|
127
630
|
try {
|
|
128
631
|
const urls = [TARGET];
|
|
@@ -143,6 +646,26 @@ export default async function startEntry(opts) {
|
|
|
143
646
|
try {
|
|
144
647
|
TRACE.t1 = Date.now();
|
|
145
648
|
globalThis.__NS_ENTRY_TRACE__ = TRACE;
|
|
649
|
+
// Always print a concise, human-readable boot timeline so anyone
|
|
650
|
+
// investigating perf can see before/after numbers without flipping
|
|
651
|
+
// the verbose flag. Verbose mode still gets the full JSON dump.
|
|
652
|
+
try {
|
|
653
|
+
const parts = [];
|
|
654
|
+
const push = (label, ms) => {
|
|
655
|
+
if (typeof ms === 'number')
|
|
656
|
+
parts.push(`${label}=${ms}ms`);
|
|
657
|
+
};
|
|
658
|
+
push('importMap', TRACE.importMap?.ms);
|
|
659
|
+
push('rt', TRACE.preload?.rt?.ms);
|
|
660
|
+
push('core', TRACE.preload?.core?.ms);
|
|
661
|
+
push('styleScope', TRACE.preload?.coreStyleScope?.ms);
|
|
662
|
+
push('main', TRACE.main?.ms);
|
|
663
|
+
const total = typeof TRACE.t0 === 'number' && typeof TRACE.t1 === 'number' ? TRACE.t1 - TRACE.t0 : undefined;
|
|
664
|
+
push('total', total);
|
|
665
|
+
const status = TRACE.error ? 'FAILED' : 'ok';
|
|
666
|
+
console.info(`[ns-entry][boot] ${status} ${parts.join(' ')}`);
|
|
667
|
+
}
|
|
668
|
+
catch { }
|
|
146
669
|
if (VERBOSE)
|
|
147
670
|
console.info('[ns-entry][trace]', JSON.stringify(TRACE));
|
|
148
671
|
}
|