@nativescript/vite 8.0.0-alpha.9 → 8.0.0-dev.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 +89 -14
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +196 -217
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +152 -104
- 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 +11 -92
- package/configuration/typescript.js.map +1 -1
- package/framework.d.ts +22 -0
- package/framework.js +18 -0
- package/framework.js.map +1 -0
- 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.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 +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 +31 -0
- package/helpers/flavor.js +53 -2
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +100 -33
- package/helpers/global-defines.js +192 -66
- 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 +24 -26
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +11 -1
- package/helpers/logging.js +45 -2
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +4 -1
- package/helpers/main-entry.js +293 -40
- 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.js +8 -3
- 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/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 +143 -62
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +3 -3
- 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 +33 -0
- package/helpers/workers.js +237 -10
- 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 +117 -0
- package/hmr/client/framework-client-strategy.js +18 -0
- package/hmr/client/framework-client-strategy.js.map +1 -0
- package/hmr/client/framework.d.ts +31 -0
- package/hmr/client/framework.js +17 -0
- package/hmr/client/framework.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 +89 -0
- package/hmr/client/hot-context.js +404 -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 +136 -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 +489 -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 +279 -44
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/framework-flavors.d.ts +59 -0
- package/hmr/framework-flavors.js +108 -0
- package/hmr/framework-flavors.js.map +1 -0
- 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/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.js +2 -70
- 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/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 +360 -194
- 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/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 +668 -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 +27 -11
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +179 -107
- 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 +270 -521
- 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/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 +7 -1
- 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 +155 -37
- 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 +57 -23
- package/hmr/server/import-map.js +142 -70
- 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-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 +54 -0
- package/hmr/server/process-code-for-device.js +832 -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 +211 -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 +299 -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 +36 -3
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-module-specifiers.d.ts +2 -5
- package/hmr/server/websocket-module-specifiers.js +42 -30
- 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 +163 -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 +2 -1
- package/hmr/server/websocket-ns-m-request.js +3 -2
- 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 +592 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +65 -3
- package/hmr/server/websocket-served-module-helpers.js +457 -140
- 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 +6 -40
- package/hmr/server/websocket.js +661 -6751
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +108 -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 +58 -25
- 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 -1011
- 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 +3 -2
- 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 +382 -157
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +209 -54
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +2 -1
- 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 +10 -35
- package/hmr/shared/vendor/manifest.js +154 -978
- 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/package.json +70 -13
- package/runtime/core-aliases-early.js +11 -16
- 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 -185
- package/helpers/angular/angular-linker.js.map +0 -1
- package/helpers/angular/inject-component-hmr-registration.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.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 -114
- 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 -1069
- 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}/inject-component-hmr-registration.d.ts +0 -0
- /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/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/util.js +0 -0
- /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { setHmrBootStage } from './dev-overlay.js';
|
|
2
|
+
import { buildPlaceholderPage } from './root-placeholder-view.js';
|
|
3
|
+
import { getGlobalScope } from './global-scope.js';
|
|
4
|
+
import { getVendorRequire } from './vendor-resolve.js';
|
|
5
|
+
import { markDevBootComplete } from './boot-complete.js';
|
|
2
6
|
function isPlaceholderView(view, placeholderRoot) {
|
|
3
7
|
if (!view) {
|
|
4
8
|
return false;
|
|
@@ -15,17 +19,37 @@ function isPlaceholderView(view, placeholderRoot) {
|
|
|
15
19
|
return false;
|
|
16
20
|
}
|
|
17
21
|
function getCommittedRootView(application, placeholderRoot) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const probe = (app) => {
|
|
23
|
+
try {
|
|
24
|
+
const root = app?.getRootView?.() || null;
|
|
25
|
+
if (!root)
|
|
26
|
+
return null;
|
|
27
|
+
if (!isPlaceholderView(root, placeholderRoot))
|
|
28
|
+
return root;
|
|
29
|
+
const currentPage = root.currentPage || root._currentEntry?.resolvedPage || null;
|
|
30
|
+
if (currentPage && !isPlaceholderView(currentPage, placeholderRoot))
|
|
31
|
+
return root;
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
catch { }
|
|
34
|
+
return null;
|
|
35
|
+
};
|
|
36
|
+
const primary = probe(application);
|
|
37
|
+
if (primary)
|
|
38
|
+
return primary;
|
|
39
|
+
// Vite HMR realm split: Angular's `Application.resetRootView` may have
|
|
40
|
+
// committed the real root on a different Application instance than the
|
|
41
|
+
// one the placeholder/early hook patched. Scan every Application we
|
|
42
|
+
// know about so we can detect the commit regardless of which twin
|
|
43
|
+
// Angular actually wrote to.
|
|
44
|
+
try {
|
|
45
|
+
const g = getGlobalScope();
|
|
46
|
+
const known = g['__NS_DEV_KNOWN_APPLICATIONS__'] || [];
|
|
47
|
+
for (const app of known) {
|
|
48
|
+
if (!app || app === application)
|
|
49
|
+
continue;
|
|
50
|
+
const r = probe(app);
|
|
51
|
+
if (r)
|
|
52
|
+
return r;
|
|
29
53
|
}
|
|
30
54
|
}
|
|
31
55
|
catch { }
|
|
@@ -85,6 +109,9 @@ function clearPlaceholderGlobals(g) {
|
|
|
85
109
|
delete g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'];
|
|
86
110
|
delete g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'];
|
|
87
111
|
delete g['__NS_DEV_BOOT_STATUS_LABEL__'];
|
|
112
|
+
delete g['__NS_DEV_BOOT_DETAIL_LABEL__'];
|
|
113
|
+
delete g['__NS_DEV_BOOT_PROGRESS_FILL__'];
|
|
114
|
+
delete g['__NS_DEV_BOOT_PROGRESS_LAST_SCALE__'];
|
|
88
115
|
delete g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'];
|
|
89
116
|
delete g['__NS_DEV_PLACEHOLDER_LAUNCH_HANDLER__'];
|
|
90
117
|
delete g['__NS_DEV_PLACEHOLDER_APPLICATION__'];
|
|
@@ -98,12 +125,48 @@ function clearPlaceholderGlobals(g) {
|
|
|
98
125
|
delete g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__'];
|
|
99
126
|
}
|
|
100
127
|
export function tryFinalizeBootPlaceholder(reason, verbose) {
|
|
101
|
-
const g =
|
|
128
|
+
const g = getGlobalScope();
|
|
102
129
|
const placeholderRoot = g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'] || null;
|
|
103
130
|
const hadPlaceholder = !!placeholderRoot || !!g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'] || !!g['__NS_DEV_BOOT_STATUS_LABEL__'] || !!g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'];
|
|
104
131
|
const application = g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application;
|
|
105
132
|
const committedRoot = getCommittedRootView(application, placeholderRoot);
|
|
106
133
|
if (!committedRoot) {
|
|
134
|
+
// Verbose-gated, throttled to 1 Hz to avoid spamming the log on long stalls.
|
|
135
|
+
try {
|
|
136
|
+
if (verbose) {
|
|
137
|
+
const now = Date.now();
|
|
138
|
+
const last = g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ || 0;
|
|
139
|
+
if (now - last > 1000) {
|
|
140
|
+
g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ = now;
|
|
141
|
+
const describe = (app) => {
|
|
142
|
+
try {
|
|
143
|
+
const r = app?.getRootView?.();
|
|
144
|
+
const cp = r?.currentPage || r?._currentEntry?.resolvedPage;
|
|
145
|
+
return {
|
|
146
|
+
appType: app?.constructor?.name || typeof app,
|
|
147
|
+
appIdentity: app === application ? 'primary' : 'alt',
|
|
148
|
+
rootType: r?.constructor?.name || 'null',
|
|
149
|
+
rootIsPlaceholder: !!r && (r === placeholderRoot || r.__ns_dev_placeholder === true),
|
|
150
|
+
currentPageType: cp?.constructor?.name,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
return { appType: 'error' };
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
const known = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []);
|
|
158
|
+
console.warn('[ns-placeholder][diag] tryFinalize: no committed root', {
|
|
159
|
+
reason,
|
|
160
|
+
hadPlaceholder,
|
|
161
|
+
placeholderRootType: placeholderRoot?.constructor?.name,
|
|
162
|
+
primary: describe(application),
|
|
163
|
+
knownApplications: known.length,
|
|
164
|
+
alts: known.filter((a) => a && a !== application).map(describe),
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch { }
|
|
107
170
|
return false;
|
|
108
171
|
}
|
|
109
172
|
let detachedPlaceholder = false;
|
|
@@ -119,10 +182,10 @@ export function tryFinalizeBootPlaceholder(reason, verbose) {
|
|
|
119
182
|
clearPlaceholderGlobals(g);
|
|
120
183
|
detachedPlaceholder = true;
|
|
121
184
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
185
|
+
// Flips the JS global AND the native cold-boot gate
|
|
186
|
+
// (ns:module `setDevBootComplete`): the real root is committed, so the
|
|
187
|
+
// runtime's boot-only runloop pump can disarm.
|
|
188
|
+
markDevBootComplete();
|
|
126
189
|
if (detachedPlaceholder) {
|
|
127
190
|
setHmrBootStage('app-root-committed', {
|
|
128
191
|
detail: 'The real app root replaced the boot placeholder.',
|
|
@@ -138,7 +201,7 @@ export function tryFinalizeBootPlaceholder(reason, verbose) {
|
|
|
138
201
|
return true;
|
|
139
202
|
}
|
|
140
203
|
function scheduleBootPlaceholderFinalize(reason, verbose) {
|
|
141
|
-
const g =
|
|
204
|
+
const g = getGlobalScope();
|
|
142
205
|
if (g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__']) {
|
|
143
206
|
return;
|
|
144
207
|
}
|
|
@@ -152,14 +215,33 @@ function scheduleBootPlaceholderFinalize(reason, verbose) {
|
|
|
152
215
|
}
|
|
153
216
|
attempts += 1;
|
|
154
217
|
if (Date.now() - startedAt >= maxWaitMs) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
218
|
+
// Always-on: a dev session that never commits a real root used to be
|
|
219
|
+
// an INFINITE silent spinner — the most common cause (a swallowed
|
|
220
|
+
// XML/Builder error during Application.run) printed one console line
|
|
221
|
+
// and nothing else. Flip the boot overlay to its error stage with the
|
|
222
|
+
// last captured builder error so the failure is visible on-device.
|
|
223
|
+
// Core's SourceErrorFormat stashes that error on
|
|
224
|
+
// `globalThis.__NS_LAST_XML_ERROR__` for exactly this hand-off.
|
|
225
|
+
try {
|
|
226
|
+
const lastXmlError = g.__NS_LAST_XML_ERROR__;
|
|
227
|
+
const hint = lastXmlError && lastXmlError.message ? `Last UI build error — ${lastXmlError.uri}: ${lastXmlError.message}` : 'No error was captured; check the device console for the first failure after launch.';
|
|
228
|
+
setHmrBootStage('error', {
|
|
229
|
+
detail: `Dev session is active but the app root never replaced the boot placeholder (waited ${Math.round((Date.now() - startedAt) / 1000)}s). ${hint}`,
|
|
161
230
|
});
|
|
162
231
|
}
|
|
232
|
+
catch { }
|
|
233
|
+
// Verbose-gated: enable `verbose` in the HMR config to surface stall diagnostics.
|
|
234
|
+
try {
|
|
235
|
+
if (verbose) {
|
|
236
|
+
console.warn('[ns-placeholder][diag] waiting for real root commit TIMED OUT', {
|
|
237
|
+
reason,
|
|
238
|
+
attempts,
|
|
239
|
+
waitMs: Date.now() - startedAt,
|
|
240
|
+
state: getPlaceholderWaitDiagnosticSnapshot(g, g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application, g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'] || null),
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
catch { }
|
|
163
245
|
return;
|
|
164
246
|
}
|
|
165
247
|
g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__'] = setTimeout(tick, attempts === 1 ? 0 : 100);
|
|
@@ -178,7 +260,7 @@ function scheduleBootPlaceholderFinalize(reason, verbose) {
|
|
|
178
260
|
// exactly as it would in production — the patch intercepts it and does a clean
|
|
179
261
|
// root replacement instead of fighting the already-running lifecycle.
|
|
180
262
|
export function installRootPlaceholder(verbose) {
|
|
181
|
-
const g =
|
|
263
|
+
const g = getGlobalScope();
|
|
182
264
|
if (g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'])
|
|
183
265
|
return;
|
|
184
266
|
g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'] = true;
|
|
@@ -208,8 +290,8 @@ export function installRootPlaceholder(verbose) {
|
|
|
208
290
|
}
|
|
209
291
|
catch { }
|
|
210
292
|
try {
|
|
211
|
-
const req =
|
|
212
|
-
if (
|
|
293
|
+
const req = getVendorRequire();
|
|
294
|
+
if (req) {
|
|
213
295
|
const mod = req(moduleId);
|
|
214
296
|
if (mod)
|
|
215
297
|
return { value: (mod.default ?? mod) || mod, via: 'require', moduleId };
|
|
@@ -297,35 +379,159 @@ export function installRootPlaceholder(verbose) {
|
|
|
297
379
|
}
|
|
298
380
|
g['__NS_DEV_PLACEHOLDER_APPLICATION__'] = Application;
|
|
299
381
|
const isAndroid = !!(g.__ANDROID__ || typeof g.android !== 'undefined');
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
382
|
+
// Patch `Application.resetRootView` on BOTH platforms so the placeholder
|
|
383
|
+
// finalize callback (`__NS_DEV_RESTORE_PLACEHOLDER__`) fires every time the
|
|
384
|
+
// framework swaps the root view. The early Android wrapper in
|
|
385
|
+
// `core-aliases-early.ts` is unreliable under HTTP HMR boot (it runs before
|
|
386
|
+
// `g.Application` exists), so we wrap here too and coordinate via
|
|
387
|
+
// `__NS_DEV_PATCHED_RESET_ROOT__` to avoid double-wrapping.
|
|
388
|
+
const earlyAndroidWrapped = !!g['__NS_DEV_PATCHED_RESET_ROOT__'];
|
|
389
|
+
// Verbose-gated: the diag stream (resetRootView wraps, launch-handler
|
|
390
|
+
// entries, placeholder install state) only matters when investigating a stall.
|
|
391
|
+
const diag = verbose
|
|
392
|
+
? (...args) => {
|
|
304
393
|
try {
|
|
305
|
-
|
|
306
|
-
if (typeof restore === 'function') {
|
|
307
|
-
restore('Application.resetRootView');
|
|
308
|
-
}
|
|
394
|
+
console.warn('[ns-placeholder][diag]', ...args);
|
|
309
395
|
}
|
|
310
396
|
catch { }
|
|
311
|
-
|
|
312
|
-
};
|
|
313
|
-
|
|
397
|
+
}
|
|
398
|
+
: () => { };
|
|
399
|
+
diag('install entry', {
|
|
400
|
+
platform: isAndroid ? 'android' : 'ios',
|
|
401
|
+
applicationSource: applicationResolved.source,
|
|
402
|
+
applicationType: Application?.constructor?.name,
|
|
403
|
+
hasReset: typeof Application.resetRootView === 'function',
|
|
404
|
+
alreadyPatchedEarly: earlyAndroidWrapped,
|
|
405
|
+
alreadyPatchedView: !!g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'],
|
|
406
|
+
globalApplicationSame: g.Application === Application,
|
|
407
|
+
vendorApplicationSame: (() => {
|
|
408
|
+
try {
|
|
409
|
+
const v = g.__nsVendorRegistry?.get?.('@nativescript/core');
|
|
410
|
+
return v?.Application === Application || v?.default?.Application === Application;
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
})(),
|
|
416
|
+
});
|
|
417
|
+
// Always patch every Application instance we can find. The early
|
|
418
|
+
// Android hook in `core-aliases-early.ts` only patches `g.Application`
|
|
419
|
+
// (the bundled realm's Application) and its prototype — but on Vite
|
|
420
|
+
// HMR there can be a SECOND Application loaded by the HTTP realm
|
|
421
|
+
// (`vendor-registry @nativescript/core`) that Angular's `import { Application }`
|
|
422
|
+
// actually resolves to. If we don't patch that twin too, Angular's
|
|
423
|
+
// `Application.resetRootView({ create: () => doc })` lands on an
|
|
424
|
+
// unpatched object, the placeholder finalize callback is never
|
|
425
|
+
// invoked, and the boot stalls at "Waiting for the app root view".
|
|
426
|
+
const makePatched = (origReset, label) => function __ns_dev_patched_reset_root_view(entry) {
|
|
427
|
+
diag(`patched resetRootView called (${label})`, {
|
|
428
|
+
hasEntry: !!entry,
|
|
429
|
+
entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
|
|
430
|
+
});
|
|
431
|
+
const result = origReset(entry);
|
|
314
432
|
try {
|
|
315
|
-
|
|
316
|
-
|
|
433
|
+
const restore = g['__NS_DEV_RESTORE_PLACEHOLDER__'];
|
|
434
|
+
if (typeof restore === 'function') {
|
|
435
|
+
restore(`Application.resetRootView (${label})`);
|
|
317
436
|
}
|
|
318
437
|
}
|
|
319
|
-
catch {
|
|
438
|
+
catch (e) {
|
|
439
|
+
diag('patched resetRootView restore threw', String(e && (e.message || e)));
|
|
440
|
+
}
|
|
441
|
+
return result;
|
|
442
|
+
};
|
|
443
|
+
const wrapOnce = (target, label) => {
|
|
444
|
+
try {
|
|
445
|
+
if (!target || typeof target.resetRootView !== 'function')
|
|
446
|
+
return false;
|
|
447
|
+
if (target.resetRootView.__ns_dev_placeholder_wrap === true)
|
|
448
|
+
return false;
|
|
449
|
+
const orig = target.resetRootView.bind(target);
|
|
450
|
+
const wrapped = makePatched(orig, label);
|
|
451
|
+
wrapped.__ns_dev_placeholder_wrap = true;
|
|
452
|
+
target.resetRootView = wrapped;
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
catch {
|
|
456
|
+
return false;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const wrappedLocal = wrapOnce(Application, 'local');
|
|
460
|
+
const wrappedGlobal = g.Application && g.Application !== Application ? wrapOnce(g.Application, 'global') : false;
|
|
461
|
+
const wrappedProto = (() => {
|
|
320
462
|
try {
|
|
321
463
|
const proto = Object.getPrototypeOf(Application);
|
|
322
|
-
|
|
323
|
-
|
|
464
|
+
return wrapOnce(proto, 'proto');
|
|
465
|
+
}
|
|
466
|
+
catch {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
})();
|
|
470
|
+
// Vendor-realm Application coverage. Even when `earlyAndroidWrapped`
|
|
471
|
+
// is true, the early hook only touched `g.Application` + its proto;
|
|
472
|
+
// the vendor's Application is a separate object with its own
|
|
473
|
+
// `resetRootView` that the early hook never sees.
|
|
474
|
+
let wrappedVendor = false;
|
|
475
|
+
let wrappedVendorAppModule = false;
|
|
476
|
+
try {
|
|
477
|
+
const reg = g.__nsVendorRegistry;
|
|
478
|
+
if (reg && typeof reg.get === 'function') {
|
|
479
|
+
const vendorCore = reg.get('@nativescript/core');
|
|
480
|
+
const vendorApp = vendorCore?.Application || vendorCore?.default?.Application;
|
|
481
|
+
if (vendorApp && vendorApp !== Application) {
|
|
482
|
+
wrappedVendor = wrapOnce(vendorApp, 'vendor-core');
|
|
483
|
+
try {
|
|
484
|
+
const vp = Object.getPrototypeOf(vendorApp);
|
|
485
|
+
if (vp && vp !== Object.getPrototypeOf(Application)) {
|
|
486
|
+
wrapOnce(vp, 'vendor-core-proto');
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
catch { }
|
|
490
|
+
}
|
|
491
|
+
const vendorAppMod = reg.get('@nativescript/core/application');
|
|
492
|
+
const vendorAppOnly = vendorAppMod?.Application || vendorAppMod?.default?.Application;
|
|
493
|
+
if (vendorAppOnly && vendorAppOnly !== Application && vendorAppOnly !== vendorApp) {
|
|
494
|
+
wrappedVendorAppModule = wrapOnce(vendorAppOnly, 'vendor-application');
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
catch { }
|
|
499
|
+
// Track every Application instance we know about so
|
|
500
|
+
// `tryFinalizeBootPlaceholder` can poll the real root view on the
|
|
501
|
+
// instance Angular actually committed to.
|
|
502
|
+
try {
|
|
503
|
+
const apps = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || (g['__NS_DEV_KNOWN_APPLICATIONS__'] = []));
|
|
504
|
+
const push = (a) => {
|
|
505
|
+
if (a && apps.indexOf(a) === -1)
|
|
506
|
+
apps.push(a);
|
|
507
|
+
};
|
|
508
|
+
push(Application);
|
|
509
|
+
push(g.Application);
|
|
510
|
+
try {
|
|
511
|
+
const reg = g.__nsVendorRegistry;
|
|
512
|
+
if (reg && typeof reg.get === 'function') {
|
|
513
|
+
const vendorCore = reg.get('@nativescript/core');
|
|
514
|
+
push(vendorCore?.Application);
|
|
515
|
+
push(vendorCore?.default?.Application);
|
|
516
|
+
const vendorAppMod = reg.get('@nativescript/core/application');
|
|
517
|
+
push(vendorAppMod?.Application);
|
|
518
|
+
push(vendorAppMod?.default?.Application);
|
|
324
519
|
}
|
|
325
520
|
}
|
|
326
521
|
catch { }
|
|
327
|
-
g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
|
|
328
522
|
}
|
|
523
|
+
catch { }
|
|
524
|
+
g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
|
|
525
|
+
g['__NS_DEV_PATCHED_RESET_ROOT__'] = true;
|
|
526
|
+
diag('patched Application.resetRootView', {
|
|
527
|
+
platform: isAndroid ? 'android' : 'ios',
|
|
528
|
+
wrappedLocal,
|
|
529
|
+
wrappedGlobal,
|
|
530
|
+
wrappedProto,
|
|
531
|
+
wrappedVendor,
|
|
532
|
+
wrappedVendorAppModule,
|
|
533
|
+
knownApplications: (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []).length,
|
|
534
|
+
});
|
|
329
535
|
const canCreatePlaceholderRoot = !!Frame && !!Page && !!Label;
|
|
330
536
|
if (!canCreatePlaceholderRoot && verbose) {
|
|
331
537
|
console.warn('[ns-placeholder] visual placeholder unavailable; starting lifecycle without placeholder root', {
|
|
@@ -346,64 +552,21 @@ export function installRootPlaceholder(verbose) {
|
|
|
346
552
|
let handlerFired = false;
|
|
347
553
|
// launchEvent handler: provides a placeholder root, then patches Application.run
|
|
348
554
|
const __ns_launch_handler = (args) => {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
555
|
+
diag('launch handler fired', {
|
|
556
|
+
hasArgs: !!args,
|
|
557
|
+
hasExistingRoot: !!args?.root,
|
|
558
|
+
existingRootType: args?.root?.constructor?.name,
|
|
559
|
+
hasLaunched: typeof Application.hasLaunched === 'function' ? !!Application.hasLaunched() : undefined,
|
|
560
|
+
started: !!Application.started,
|
|
561
|
+
});
|
|
357
562
|
try {
|
|
358
563
|
const prev = args?.root;
|
|
359
564
|
if (!prev && canCreatePlaceholderRoot && Frame && Page && Label) {
|
|
360
|
-
const
|
|
361
|
-
const page =
|
|
362
|
-
page.actionBarHidden = true;
|
|
363
|
-
const titleLabel = new Label();
|
|
364
|
-
titleLabel.text = 'NativeScript Vite preparing dev session...';
|
|
365
|
-
titleLabel.textAlignment = 'center';
|
|
366
|
-
titleLabel.textWrap = true;
|
|
367
|
-
titleLabel.fontSize = 20;
|
|
368
|
-
const statusLabel = new Label();
|
|
369
|
-
statusLabel.text = 'Preparing the HTTP HMR bootstrap (4%)';
|
|
370
|
-
statusLabel.textAlignment = 'center';
|
|
371
|
-
statusLabel.textWrap = true;
|
|
372
|
-
statusLabel.fontSize = 14;
|
|
373
|
-
statusLabel.marginTop = 12;
|
|
374
|
-
const activityIndicator = ActivityIndicator
|
|
375
|
-
? (() => {
|
|
376
|
-
const indicator = new ActivityIndicator();
|
|
377
|
-
indicator.busy = true;
|
|
378
|
-
indicator.marginTop = 16;
|
|
379
|
-
indicator.width = 28;
|
|
380
|
-
indicator.height = 28;
|
|
381
|
-
indicator.horizontalAlignment = 'center';
|
|
382
|
-
return indicator;
|
|
383
|
-
})()
|
|
384
|
-
: null;
|
|
385
|
-
if (StackLayout) {
|
|
386
|
-
const root = new StackLayout();
|
|
387
|
-
root.padding = 24;
|
|
388
|
-
root.verticalAlignment = 'middle';
|
|
389
|
-
root.horizontalAlignment = 'center';
|
|
390
|
-
root.addChild(titleLabel);
|
|
391
|
-
root.addChild(statusLabel);
|
|
392
|
-
if (activityIndicator) {
|
|
393
|
-
root.addChild(activityIndicator);
|
|
394
|
-
}
|
|
395
|
-
page.content = root;
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
398
|
-
// Fallback: just show the title label centered
|
|
399
|
-
titleLabel.verticalAlignment = 'middle';
|
|
400
|
-
titleLabel.horizontalAlignment = 'center';
|
|
401
|
-
titleLabel.width = 280;
|
|
402
|
-
titleLabel.padding = 12;
|
|
403
|
-
page.content = titleLabel;
|
|
404
|
-
}
|
|
405
|
-
// Store refs so the overlay API can update the status label
|
|
565
|
+
const built = buildPlaceholderPage({ Page, Label, ActivityIndicator, StackLayout: getCore('StackLayout').value, GridLayout: getCore('GridLayout').value, ContentView: getCore('ContentView').value, Image: getCore('Image').value, Color: getCore('Color').value, verbose });
|
|
566
|
+
const { page, statusLabel, detailLabel, progressFill, activityIndicator } = built;
|
|
406
567
|
g['__NS_DEV_BOOT_STATUS_LABEL__'] = statusLabel;
|
|
568
|
+
g['__NS_DEV_BOOT_DETAIL_LABEL__'] = detailLabel;
|
|
569
|
+
g['__NS_DEV_BOOT_PROGRESS_FILL__'] = progressFill;
|
|
407
570
|
g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'] = activityIndicator;
|
|
408
571
|
const frame = new Frame();
|
|
409
572
|
frame.navigate({ create: () => page, clearHistory: true, animated: false });
|
|
@@ -417,7 +580,7 @@ export function installRootPlaceholder(verbose) {
|
|
|
417
580
|
console.info('[ns-placeholder] assigned placeholder root', {
|
|
418
581
|
frameType: frame?.constructor?.name,
|
|
419
582
|
pageType: page?.constructor?.name,
|
|
420
|
-
|
|
583
|
+
hasProgressFill: !!progressFill,
|
|
421
584
|
hasActivityIndicator: !!activityIndicator,
|
|
422
585
|
});
|
|
423
586
|
}
|
|
@@ -441,73 +604,116 @@ export function installRootPlaceholder(verbose) {
|
|
|
441
604
|
if (Application && typeof Application.run === 'function') {
|
|
442
605
|
const _originalRun = Application.run.bind(Application);
|
|
443
606
|
g['__NS_DEV_ORIGINAL_APP_RUN__'] = _originalRun;
|
|
607
|
+
// HMR ordering invariant: the patched `Application.run` MUST yield
|
|
608
|
+
// back to the synchronous caller before any iOS view-lifecycle event
|
|
609
|
+
// fires on the new root view.
|
|
610
|
+
//
|
|
611
|
+
// Concrete bug this guards against: nativescript-vue's `app.start()` is
|
|
612
|
+
// const componentInstance = app.mount(createAppRoot(), false, false);
|
|
613
|
+
// startApp(componentInstance); // → Application.run({ create: … })
|
|
614
|
+
// setRootApp(app); // — sets the module-private `rootApp`
|
|
615
|
+
// In a non-HMR build `Application.run` is `UIApplicationMain`, which
|
|
616
|
+
// returns control to the iOS runloop and lets `setRootApp(app)` execute
|
|
617
|
+
// before any `loaded`/`traitCollectionDidChange` callbacks fire. Under
|
|
618
|
+
// HMR `Application.run` is replaced with synchronous `resetRootView`,
|
|
619
|
+
// which attaches the root to the window *inside* this call — iOS then
|
|
620
|
+
// synchronously fires `loaded` on the new view tree, a TabView handler
|
|
621
|
+
// calls `nativescript-vue`'s `createNativeView`, that reads
|
|
622
|
+
// `rootApp._context`, and crashes with
|
|
623
|
+
// TypeError: Cannot read properties of null (reading '_context')
|
|
624
|
+
// because `setRootApp(app)` hasn't run yet.
|
|
625
|
+
//
|
|
626
|
+
// `setRootApp` is module-private inside the vendor bundle, so the bridge
|
|
627
|
+
// cannot call it directly. Deferring the synchronous root attachment to a
|
|
628
|
+
// microtask restores the production timing: every consumer that called
|
|
629
|
+
// `Application.run(entry)` completes its tail (including private state
|
|
630
|
+
// setters like `setRootApp`) before iOS triggers lifecycle on the new
|
|
631
|
+
// root. The microtask runs before any I/O or DOM-tick boundary, so the UI
|
|
632
|
+
// still appears in the same iOS runloop turn — no user-visible delay.
|
|
444
633
|
const __ns_dev_patched_run = function __ns_dev_patched_run(entry) {
|
|
634
|
+
diag('patched Application.run called', {
|
|
635
|
+
hasEntry: !!entry,
|
|
636
|
+
entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
|
|
637
|
+
});
|
|
638
|
+
// Detach the launch handler synchronously: by the time the caller
|
|
639
|
+
// returned from `Application.run()`, the framework owns root-view
|
|
640
|
+
// management, and we must not re-enter the placeholder path on a
|
|
641
|
+
// subsequent launch tick.
|
|
445
642
|
try {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
try {
|
|
449
|
-
if (Application && Application.off) {
|
|
450
|
-
Application.off(Application.launchEvent, __ns_launch_handler);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
catch { }
|
|
454
|
-
// When entry is undefined/null, the calling framework (e.g. Angular)
|
|
455
|
-
// manages root views itself via launch events and resetRootView().
|
|
456
|
-
// Don't attempt resetRootView(undefined) which throws "Main entry is missing".
|
|
457
|
-
if (!entry) {
|
|
458
|
-
if (verbose)
|
|
459
|
-
console.info('[ns-placeholder] patched run() called with no entry; framework manages root view');
|
|
460
|
-
return;
|
|
643
|
+
if (Application && Application.off) {
|
|
644
|
+
Application.off(Application.launchEvent, __ns_launch_handler);
|
|
461
645
|
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
646
|
+
}
|
|
647
|
+
catch { }
|
|
648
|
+
// Frameworks (notably Angular) call `Application.run()` with no
|
|
649
|
+
// entry — they own the root via launch events and `resetRootView()`
|
|
650
|
+
// directly. Bailing here keeps `resetRootView(undefined)` from
|
|
651
|
+
// throwing "Main entry is missing".
|
|
652
|
+
if (!entry) {
|
|
653
|
+
diag('patched run() called with no entry; framework manages root view');
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
// Snapshot for the deferred body so a later mutation by the caller
|
|
657
|
+
// can't observe a half-finished closure.
|
|
658
|
+
const __ns_deferred_entry = entry;
|
|
659
|
+
const __ns_deferred_reset = () => {
|
|
660
|
+
try {
|
|
661
|
+
const isModuleNameEntry = __ns_deferred_entry && __ns_deferred_entry.moduleName && !__ns_deferred_entry.create;
|
|
662
|
+
if (isModuleNameEntry) {
|
|
663
|
+
if (typeof Application.resetRootView === 'function') {
|
|
664
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
665
|
+
}
|
|
466
666
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
667
|
+
else {
|
|
668
|
+
// Framework path: two-phase boot with dominative document
|
|
669
|
+
Application._rootView = null;
|
|
670
|
+
try {
|
|
671
|
+
const domModule = g.__nsVendorRegistry?.get?.('dominative') ||
|
|
672
|
+
(typeof require === 'function'
|
|
673
|
+
? (() => {
|
|
674
|
+
try {
|
|
675
|
+
return require('dominative');
|
|
676
|
+
}
|
|
677
|
+
catch {
|
|
678
|
+
return null;
|
|
679
|
+
}
|
|
680
|
+
})()
|
|
681
|
+
: null);
|
|
682
|
+
const doc = domModule?.document;
|
|
683
|
+
if (doc && typeof Application.resetRootView === 'function') {
|
|
684
|
+
Application.resetRootView({ create: () => doc });
|
|
685
|
+
if (__ns_deferred_entry && typeof __ns_deferred_entry.create === 'function') {
|
|
686
|
+
__ns_deferred_entry.create();
|
|
687
|
+
}
|
|
488
688
|
}
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
689
|
+
else {
|
|
690
|
+
if (typeof Application.resetRootView === 'function') {
|
|
691
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
692
|
+
}
|
|
493
693
|
}
|
|
494
694
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
695
|
+
catch (e2) {
|
|
696
|
+
if (verbose)
|
|
697
|
+
console.warn('[ns-placeholder] two-phase boot failed:', e2?.message || e2);
|
|
698
|
+
try {
|
|
699
|
+
if (typeof Application.resetRootView === 'function') {
|
|
700
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
701
|
+
}
|
|
502
702
|
}
|
|
703
|
+
catch { }
|
|
503
704
|
}
|
|
504
|
-
catch { }
|
|
505
705
|
}
|
|
506
706
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
707
|
+
catch (e) {
|
|
708
|
+
console.warn('[ns-placeholder] deferred patched run() error:', e);
|
|
709
|
+
}
|
|
710
|
+
};
|
|
711
|
+
// Microtask-defer. `Promise.resolve().then(...)` lands the callback
|
|
712
|
+
// in the same iOS runloop turn — no perceptible delay — but only
|
|
713
|
+
// after the synchronous call stack that invoked `Application.run`
|
|
714
|
+
// has fully unwound, so `nativescript-vue`'s post-`startApp` code
|
|
715
|
+
// (`setRootApp(app);`) has executed before any view lifecycle fires.
|
|
716
|
+
Promise.resolve().then(__ns_deferred_reset);
|
|
511
717
|
};
|
|
512
718
|
Application.run = __ns_dev_patched_run;
|
|
513
719
|
if (verbose) {
|
|
@@ -565,6 +771,21 @@ export function installRootPlaceholder(verbose) {
|
|
|
565
771
|
const nativeApp = appAny.nativeApp;
|
|
566
772
|
const iosNativeApp = appAny.ios?.nativeApp;
|
|
567
773
|
const canRunAsMainApp = typeof appAny.runAsMainApp === 'function';
|
|
774
|
+
// iOS family only: when NativeScript runs EMBEDDED inside a host
|
|
775
|
+
// UIApplication (a visionOS SwiftUI `App`, or iOS built with
|
|
776
|
+
// `NS_SWIFTUI_BOOT=1`), the UIApplication singleton ALREADY exists by
|
|
777
|
+
// the time this placeholder runs — the SwiftUI `@main` created it
|
|
778
|
+
// before `[NativeScriptStart boot]` ran our entry. Calling
|
|
779
|
+
// `UIApplicationMain` again (via `runAsMainApp`/`run`) asserts in
|
|
780
|
+
// `UIApplicationInstantiateSingleton` and crashes at boot.
|
|
781
|
+
//
|
|
782
|
+
// `runAsMainApp` is an iOS-only method, so gating on `canRunAsMainApp`
|
|
783
|
+
// scopes this to Apple platforms (it leaves Android's `appAny.run()`
|
|
784
|
+
// branch untouched, where `nativeApp` is legitimately present early).
|
|
785
|
+
// On STANDALONE iOS the UIApplication is not created until
|
|
786
|
+
// `runAsMainApp()` itself calls `UIApplicationMain`, so `nativeApp` is
|
|
787
|
+
// still null here and the normal boot path below is preserved.
|
|
788
|
+
const hostUIApplicationExists = canRunAsMainApp && !!(nativeApp || iosNativeApp);
|
|
568
789
|
if (verbose) {
|
|
569
790
|
console.info('[ns-placeholder] boot state', {
|
|
570
791
|
hasLaunched,
|
|
@@ -573,14 +794,18 @@ export function installRootPlaceholder(verbose) {
|
|
|
573
794
|
nativeApp: !!nativeApp,
|
|
574
795
|
iosNativeApp: !!iosNativeApp,
|
|
575
796
|
canRunAsMainApp,
|
|
797
|
+
hostUIApplicationExists,
|
|
576
798
|
hasResetRootView: typeof appAny.resetRootView === 'function',
|
|
577
799
|
});
|
|
578
800
|
}
|
|
579
|
-
if (hasLaunched || hasRootView) {
|
|
580
|
-
// App lifecycle is already active
|
|
581
|
-
//
|
|
801
|
+
if (hasLaunched || hasRootView || hostUIApplicationExists) {
|
|
802
|
+
// App lifecycle is already active — either a standalone app that has
|
|
803
|
+
// already launched, or NativeScript embedded inside a host
|
|
804
|
+
// UIApplication (visionOS SwiftUI). Skip starting it again
|
|
805
|
+
// (a second `UIApplicationMain` would assert) and only install the
|
|
806
|
+
// placeholder root/patching behavior for the existing instance.
|
|
582
807
|
if (verbose) {
|
|
583
|
-
console.info('[ns-placeholder] boot branch: existing lifecycle');
|
|
808
|
+
console.info('[ns-placeholder] boot branch: existing lifecycle', { hostUIApplicationExists });
|
|
584
809
|
}
|
|
585
810
|
try {
|
|
586
811
|
__ns_launch_handler();
|