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