@nativescript/vite 8.0.0-alpha.3 → 8.0.0-alpha.30
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/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +369 -159
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +184 -14
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +5 -72
- package/configuration/javascript.js.map +1 -1
- package/configuration/solid.js +27 -1
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +5 -75
- package/configuration/typescript.js.map +1 -1
- package/helpers/angular/angular-linker.d.ts +5 -6
- package/helpers/angular/angular-linker.js +36 -121
- package/helpers/angular/angular-linker.js.map +1 -1
- package/helpers/angular/inject-component-hmr-registration.d.ts +112 -0
- package/helpers/angular/inject-component-hmr-registration.js +291 -0
- package/helpers/angular/inject-component-hmr-registration.js.map +1 -0
- package/helpers/angular/inject-hmr-vite-ignore.d.ts +75 -0
- package/helpers/angular/inject-hmr-vite-ignore.js +221 -0
- package/helpers/angular/inject-hmr-vite-ignore.js.map +1 -0
- package/helpers/angular/inline-decorator-component-templates.js +1 -170
- package/helpers/angular/inline-decorator-component-templates.js.map +1 -1
- package/helpers/angular/js-lexer.d.ts +4 -0
- package/helpers/angular/js-lexer.js +182 -0
- package/helpers/angular/js-lexer.js.map +1 -0
- package/helpers/angular/shared-linker.d.ts +31 -3
- package/helpers/angular/shared-linker.js +67 -14
- package/helpers/angular/shared-linker.js.map +1 -1
- package/helpers/angular/synthesize-decorator-ctor-parameters.js +2 -170
- package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +1 -1
- package/helpers/angular/synthesize-injectable-factories.js +1 -174
- package/helpers/angular/synthesize-injectable-factories.js.map +1 -1
- package/helpers/angular/util.d.ts +1 -0
- package/helpers/angular/util.js +88 -0
- package/helpers/angular/util.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/dev-host.d.ts +341 -0
- package/helpers/dev-host.js +617 -0
- package/helpers/dev-host.js.map +1 -0
- package/helpers/esbuild-platform-resolver.js +4 -1
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/global-defines.d.ts +51 -0
- package/helpers/global-defines.js +77 -0
- 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 +63 -3
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +2 -1
- package/helpers/main-entry.js +430 -47
- 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.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 +8 -3
- 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 +88 -0
- package/helpers/ns-core-url.js +191 -0
- package/helpers/ns-core-url.js.map +1 -0
- package/helpers/package-platform-aliases.js +4 -3
- 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/prelink-angular.js +12 -33
- package/helpers/prelink-angular.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/resolver.js +17 -2
- package/helpers/resolver.js.map +1 -1
- package/helpers/solid-jsx-deps.d.ts +15 -0
- package/helpers/solid-jsx-deps.js +178 -0
- package/helpers/solid-jsx-deps.js.map +1 -0
- package/helpers/ts-config-paths.d.ts +14 -0
- package/helpers/ts-config-paths.js +89 -8
- 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/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 +1 -0
- package/hmr/client/css-handler.js +33 -20
- 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/hmr-pending-overlay.d.ts +27 -0
- package/hmr/client/hmr-pending-overlay.js +50 -0
- package/hmr/client/hmr-pending-overlay.js.map +1 -0
- package/hmr/client/index.js +419 -15
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/utils.d.ts +6 -1
- package/hmr/client/utils.js +184 -8
- package/hmr/client/utils.js.map +1 -1
- package/hmr/client/vue-sfc-update-overlay.d.ts +82 -0
- package/hmr/client/vue-sfc-update-overlay.js +133 -0
- package/hmr/client/vue-sfc-update-overlay.js.map +1 -0
- package/hmr/entry-runtime.d.ts +2 -1
- package/hmr/entry-runtime.js +252 -65
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/client/index.d.ts +1 -0
- package/hmr/frameworks/angular/client/index.js +778 -20
- package/hmr/frameworks/angular/client/index.js.map +1 -1
- 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 +13 -15
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/frameworks/solid/server/strategy.js +3 -18
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/server/strategy.js +2 -15
- package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/client/index.js +30 -199
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/helpers/ast-normalizer.js +52 -5
- 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/angular-root-component.d.ts +79 -0
- package/hmr/server/angular-root-component.js +149 -0
- package/hmr/server/angular-root-component.js.map +1 -0
- package/hmr/server/constants.js +13 -4
- 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/framework-strategy.d.ts +9 -19
- 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.js +60 -8
- package/hmr/server/import-map.js.map +1 -1
- package/hmr/server/index.js +1 -0
- 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 +35 -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 +195 -0
- package/hmr/server/perf-instrumentation.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/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 +12 -0
- package/hmr/server/server-origin.js +66 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/shared-transform-request.js +12 -5
- package/hmr/server/shared-transform-request.js.map +1 -1
- 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 +60 -42
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-angular-entry.js +1 -1
- package/hmr/server/websocket-angular-entry.js.map +1 -1
- package/hmr/server/websocket-angular-hot-update.d.ts +17 -0
- package/hmr/server/websocket-angular-hot-update.js +176 -2
- package/hmr/server/websocket-angular-hot-update.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +41 -6
- package/hmr/server/websocket-core-bridge.js +72 -75
- 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 +21 -0
- package/hmr/server/websocket-device-transform.js +1570 -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 +43 -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 +51 -0
- package/hmr/server/websocket-hot-update.js +1160 -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 +44 -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 +202 -19
- 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 +305 -0
- package/hmr/server/websocket-ns-core.js.map +1 -0
- package/hmr/server/websocket-ns-entry.d.ts +22 -0
- package/hmr/server/websocket-ns-entry.js +150 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +3 -0
- package/hmr/server/websocket-ns-m-paths.js +92 -0
- package/hmr/server/websocket-ns-m-paths.js.map +1 -0
- package/hmr/server/websocket-ns-m-request.d.ts +45 -0
- package/hmr/server/websocket-ns-m-request.js +196 -0
- package/hmr/server/websocket-ns-m-request.js.map +1 -0
- package/hmr/server/websocket-ns-m.d.ts +34 -0
- package/hmr/server/websocket-ns-m.js +853 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +39 -0
- package/hmr/server/websocket-served-module-helpers.js +654 -0
- package/hmr/server/websocket-served-module-helpers.js.map +1 -0
- package/hmr/server/websocket-sfc.d.ts +24 -0
- package/hmr/server/websocket-sfc.js +1223 -0
- package/hmr/server/websocket-sfc.js.map +1 -0
- package/hmr/server/websocket-txn.d.ts +6 -0
- package/hmr/server/websocket-txn.js +39 -0
- package/hmr/server/websocket-txn.js.map +1 -0
- package/hmr/server/websocket-vendor-unifier.d.ts +10 -0
- package/hmr/server/websocket-vendor-unifier.js +45 -0
- package/hmr/server/websocket-vendor-unifier.js.map +1 -0
- package/hmr/server/websocket.d.ts +0 -30
- package/hmr/server/websocket.js +599 -6038
- package/hmr/server/websocket.js.map +1 -1
- 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 +40 -0
- package/hmr/shared/runtime/boot-progress.js +128 -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 +52 -0
- package/hmr/shared/runtime/boot-timeline.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.d.ts +75 -26
- package/hmr/shared/runtime/dev-overlay.js +990 -260
- package/hmr/shared/runtime/dev-overlay.js.map +1 -1
- package/hmr/shared/runtime/module-provenance.js +1 -4
- 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 +310 -0
- package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.js +352 -194
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +164 -1
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/vendor/manifest-collect.d.ts +32 -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 +3 -2
- package/hmr/shared/vendor/manifest-loader.js.map +1 -1
- package/hmr/shared/vendor/manifest.d.ts +1 -5
- package/hmr/shared/vendor/manifest.js +102 -739
- 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/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 +17 -41
- package/runtime/core-aliases-early.js.map +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { setHmrBootStage } from './dev-overlay.js';
|
|
2
|
+
import { buildPlaceholderPage } from './root-placeholder-view.js';
|
|
2
3
|
function isPlaceholderView(view, placeholderRoot) {
|
|
3
4
|
if (!view) {
|
|
4
5
|
return false;
|
|
@@ -15,17 +16,37 @@ function isPlaceholderView(view, placeholderRoot) {
|
|
|
15
16
|
return false;
|
|
16
17
|
}
|
|
17
18
|
function getCommittedRootView(application, placeholderRoot) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const probe = (app) => {
|
|
20
|
+
try {
|
|
21
|
+
const root = app?.getRootView?.() || null;
|
|
22
|
+
if (!root)
|
|
23
|
+
return null;
|
|
24
|
+
if (!isPlaceholderView(root, placeholderRoot))
|
|
25
|
+
return root;
|
|
26
|
+
const currentPage = root.currentPage || root._currentEntry?.resolvedPage || null;
|
|
27
|
+
if (currentPage && !isPlaceholderView(currentPage, placeholderRoot))
|
|
28
|
+
return root;
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
catch { }
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
33
|
+
const primary = probe(application);
|
|
34
|
+
if (primary)
|
|
35
|
+
return primary;
|
|
36
|
+
// Vite HMR realm split: Angular's `Application.resetRootView` may have
|
|
37
|
+
// committed the real root on a different Application instance than the
|
|
38
|
+
// one the placeholder/early hook patched. Scan every Application we
|
|
39
|
+
// know about so we can detect the commit regardless of which twin
|
|
40
|
+
// Angular actually wrote to.
|
|
41
|
+
try {
|
|
42
|
+
const g = globalThis;
|
|
43
|
+
const known = g['__NS_DEV_KNOWN_APPLICATIONS__'] || [];
|
|
44
|
+
for (const app of known) {
|
|
45
|
+
if (!app || app === application)
|
|
46
|
+
continue;
|
|
47
|
+
const r = probe(app);
|
|
48
|
+
if (r)
|
|
49
|
+
return r;
|
|
29
50
|
}
|
|
30
51
|
}
|
|
31
52
|
catch { }
|
|
@@ -85,6 +106,9 @@ function clearPlaceholderGlobals(g) {
|
|
|
85
106
|
delete g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'];
|
|
86
107
|
delete g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'];
|
|
87
108
|
delete g['__NS_DEV_BOOT_STATUS_LABEL__'];
|
|
109
|
+
delete g['__NS_DEV_BOOT_DETAIL_LABEL__'];
|
|
110
|
+
delete g['__NS_DEV_BOOT_PROGRESS_FILL__'];
|
|
111
|
+
delete g['__NS_DEV_BOOT_PROGRESS_LAST_SCALE__'];
|
|
88
112
|
delete g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'];
|
|
89
113
|
delete g['__NS_DEV_PLACEHOLDER_LAUNCH_HANDLER__'];
|
|
90
114
|
delete g['__NS_DEV_PLACEHOLDER_APPLICATION__'];
|
|
@@ -104,6 +128,42 @@ export function tryFinalizeBootPlaceholder(reason, verbose) {
|
|
|
104
128
|
const application = g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application;
|
|
105
129
|
const committedRoot = getCommittedRootView(application, placeholderRoot);
|
|
106
130
|
if (!committedRoot) {
|
|
131
|
+
// Verbose-gated, throttled to 1 Hz to avoid spamming the log on long stalls.
|
|
132
|
+
try {
|
|
133
|
+
if (verbose) {
|
|
134
|
+
const now = Date.now();
|
|
135
|
+
const last = g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ || 0;
|
|
136
|
+
if (now - last > 1000) {
|
|
137
|
+
g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ = now;
|
|
138
|
+
const describe = (app) => {
|
|
139
|
+
try {
|
|
140
|
+
const r = app?.getRootView?.();
|
|
141
|
+
const cp = r?.currentPage || r?._currentEntry?.resolvedPage;
|
|
142
|
+
return {
|
|
143
|
+
appType: app?.constructor?.name || typeof app,
|
|
144
|
+
appIdentity: app === application ? 'primary' : 'alt',
|
|
145
|
+
rootType: r?.constructor?.name || 'null',
|
|
146
|
+
rootIsPlaceholder: !!r && (r === placeholderRoot || r.__ns_dev_placeholder === true),
|
|
147
|
+
currentPageType: cp?.constructor?.name,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return { appType: 'error' };
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const known = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []);
|
|
155
|
+
console.warn('[ns-placeholder][diag] tryFinalize: no committed root', {
|
|
156
|
+
reason,
|
|
157
|
+
hadPlaceholder,
|
|
158
|
+
placeholderRootType: placeholderRoot?.constructor?.name,
|
|
159
|
+
primary: describe(application),
|
|
160
|
+
knownApplications: known.length,
|
|
161
|
+
alts: known.filter((a) => a && a !== application).map(describe),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch { }
|
|
107
167
|
return false;
|
|
108
168
|
}
|
|
109
169
|
let detachedPlaceholder = false;
|
|
@@ -129,14 +189,11 @@ export function tryFinalizeBootPlaceholder(reason, verbose) {
|
|
|
129
189
|
});
|
|
130
190
|
}
|
|
131
191
|
if (verbose) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
catch { }
|
|
192
|
+
console.info('[ns-placeholder] real app root committed', {
|
|
193
|
+
reason,
|
|
194
|
+
rootType: committedRoot?.constructor?.name || typeof committedRoot,
|
|
195
|
+
detachedPlaceholder,
|
|
196
|
+
});
|
|
140
197
|
}
|
|
141
198
|
return true;
|
|
142
199
|
}
|
|
@@ -155,17 +212,18 @@ function scheduleBootPlaceholderFinalize(reason, verbose) {
|
|
|
155
212
|
}
|
|
156
213
|
attempts += 1;
|
|
157
214
|
if (Date.now() - startedAt >= maxWaitMs) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
215
|
+
// Verbose-gated: enable `verbose` in the HMR config to surface stall diagnostics.
|
|
216
|
+
try {
|
|
217
|
+
if (verbose) {
|
|
218
|
+
console.warn('[ns-placeholder][diag] waiting for real root commit TIMED OUT', {
|
|
161
219
|
reason,
|
|
162
220
|
attempts,
|
|
163
221
|
waitMs: Date.now() - startedAt,
|
|
164
222
|
state: getPlaceholderWaitDiagnosticSnapshot(g, g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application, g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'] || null),
|
|
165
223
|
});
|
|
166
224
|
}
|
|
167
|
-
catch { }
|
|
168
225
|
}
|
|
226
|
+
catch { }
|
|
169
227
|
return;
|
|
170
228
|
}
|
|
171
229
|
g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__'] = setTimeout(tick, attempts === 1 ? 0 : 100);
|
|
@@ -303,35 +361,159 @@ export function installRootPlaceholder(verbose) {
|
|
|
303
361
|
}
|
|
304
362
|
g['__NS_DEV_PLACEHOLDER_APPLICATION__'] = Application;
|
|
305
363
|
const isAndroid = !!(g.__ANDROID__ || typeof g.android !== 'undefined');
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
364
|
+
// Patch `Application.resetRootView` on BOTH platforms so the placeholder
|
|
365
|
+
// finalize callback (`__NS_DEV_RESTORE_PLACEHOLDER__`) fires every time the
|
|
366
|
+
// framework swaps the root view. The early Android wrapper in
|
|
367
|
+
// `core-aliases-early.ts` is unreliable under HTTP HMR boot (it runs before
|
|
368
|
+
// `g.Application` exists), so we wrap here too and coordinate via
|
|
369
|
+
// `__NS_DEV_PATCHED_RESET_ROOT__` to avoid double-wrapping.
|
|
370
|
+
const earlyAndroidWrapped = !!g['__NS_DEV_PATCHED_RESET_ROOT__'];
|
|
371
|
+
// Verbose-gated: the diag stream (resetRootView wraps, launch-handler
|
|
372
|
+
// entries, placeholder install state) only matters when investigating a stall.
|
|
373
|
+
const diag = verbose
|
|
374
|
+
? (...args) => {
|
|
310
375
|
try {
|
|
311
|
-
|
|
312
|
-
if (typeof restore === 'function') {
|
|
313
|
-
restore('Application.resetRootView');
|
|
314
|
-
}
|
|
376
|
+
console.warn('[ns-placeholder][diag]', ...args);
|
|
315
377
|
}
|
|
316
378
|
catch { }
|
|
317
|
-
|
|
318
|
-
};
|
|
319
|
-
|
|
379
|
+
}
|
|
380
|
+
: () => { };
|
|
381
|
+
diag('install entry', {
|
|
382
|
+
platform: isAndroid ? 'android' : 'ios',
|
|
383
|
+
applicationSource: applicationResolved.source,
|
|
384
|
+
applicationType: Application?.constructor?.name,
|
|
385
|
+
hasReset: typeof Application.resetRootView === 'function',
|
|
386
|
+
alreadyPatchedEarly: earlyAndroidWrapped,
|
|
387
|
+
alreadyPatchedView: !!g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'],
|
|
388
|
+
globalApplicationSame: g.Application === Application,
|
|
389
|
+
vendorApplicationSame: (() => {
|
|
390
|
+
try {
|
|
391
|
+
const v = g.__nsVendorRegistry?.get?.('@nativescript/core');
|
|
392
|
+
return v?.Application === Application || v?.default?.Application === Application;
|
|
393
|
+
}
|
|
394
|
+
catch {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
})(),
|
|
398
|
+
});
|
|
399
|
+
// Always patch every Application instance we can find. The early
|
|
400
|
+
// Android hook in `core-aliases-early.ts` only patches `g.Application`
|
|
401
|
+
// (the bundled realm's Application) and its prototype — but on Vite
|
|
402
|
+
// HMR there can be a SECOND Application loaded by the HTTP realm
|
|
403
|
+
// (`vendor-registry @nativescript/core`) that Angular's `import { Application }`
|
|
404
|
+
// actually resolves to. If we don't patch that twin too, Angular's
|
|
405
|
+
// `Application.resetRootView({ create: () => doc })` lands on an
|
|
406
|
+
// unpatched object, the placeholder finalize callback is never
|
|
407
|
+
// invoked, and the boot stalls at "Waiting for the app root view".
|
|
408
|
+
const makePatched = (origReset, label) => function __ns_dev_patched_reset_root_view(entry) {
|
|
409
|
+
diag(`patched resetRootView called (${label})`, {
|
|
410
|
+
hasEntry: !!entry,
|
|
411
|
+
entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
|
|
412
|
+
});
|
|
413
|
+
const result = origReset(entry);
|
|
320
414
|
try {
|
|
321
|
-
|
|
322
|
-
|
|
415
|
+
const restore = g['__NS_DEV_RESTORE_PLACEHOLDER__'];
|
|
416
|
+
if (typeof restore === 'function') {
|
|
417
|
+
restore(`Application.resetRootView (${label})`);
|
|
323
418
|
}
|
|
324
419
|
}
|
|
325
|
-
catch {
|
|
420
|
+
catch (e) {
|
|
421
|
+
diag('patched resetRootView restore threw', String(e && (e.message || e)));
|
|
422
|
+
}
|
|
423
|
+
return result;
|
|
424
|
+
};
|
|
425
|
+
const wrapOnce = (target, label) => {
|
|
426
|
+
try {
|
|
427
|
+
if (!target || typeof target.resetRootView !== 'function')
|
|
428
|
+
return false;
|
|
429
|
+
if (target.resetRootView.__ns_dev_placeholder_wrap === true)
|
|
430
|
+
return false;
|
|
431
|
+
const orig = target.resetRootView.bind(target);
|
|
432
|
+
const wrapped = makePatched(orig, label);
|
|
433
|
+
wrapped.__ns_dev_placeholder_wrap = true;
|
|
434
|
+
target.resetRootView = wrapped;
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
catch {
|
|
438
|
+
return false;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
const wrappedLocal = wrapOnce(Application, 'local');
|
|
442
|
+
const wrappedGlobal = g.Application && g.Application !== Application ? wrapOnce(g.Application, 'global') : false;
|
|
443
|
+
const wrappedProto = (() => {
|
|
326
444
|
try {
|
|
327
445
|
const proto = Object.getPrototypeOf(Application);
|
|
328
|
-
|
|
329
|
-
|
|
446
|
+
return wrapOnce(proto, 'proto');
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
})();
|
|
452
|
+
// Vendor-realm Application coverage. Even when `earlyAndroidWrapped`
|
|
453
|
+
// is true, the early hook only touched `g.Application` + its proto;
|
|
454
|
+
// the vendor's Application is a separate object with its own
|
|
455
|
+
// `resetRootView` that the early hook never sees.
|
|
456
|
+
let wrappedVendor = false;
|
|
457
|
+
let wrappedVendorAppModule = false;
|
|
458
|
+
try {
|
|
459
|
+
const reg = g.__nsVendorRegistry;
|
|
460
|
+
if (reg && typeof reg.get === 'function') {
|
|
461
|
+
const vendorCore = reg.get('@nativescript/core');
|
|
462
|
+
const vendorApp = vendorCore?.Application || vendorCore?.default?.Application;
|
|
463
|
+
if (vendorApp && vendorApp !== Application) {
|
|
464
|
+
wrappedVendor = wrapOnce(vendorApp, 'vendor-core');
|
|
465
|
+
try {
|
|
466
|
+
const vp = Object.getPrototypeOf(vendorApp);
|
|
467
|
+
if (vp && vp !== Object.getPrototypeOf(Application)) {
|
|
468
|
+
wrapOnce(vp, 'vendor-core-proto');
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
catch { }
|
|
472
|
+
}
|
|
473
|
+
const vendorAppMod = reg.get('@nativescript/core/application');
|
|
474
|
+
const vendorAppOnly = vendorAppMod?.Application || vendorAppMod?.default?.Application;
|
|
475
|
+
if (vendorAppOnly && vendorAppOnly !== Application && vendorAppOnly !== vendorApp) {
|
|
476
|
+
wrappedVendorAppModule = wrapOnce(vendorAppOnly, 'vendor-application');
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
catch { }
|
|
481
|
+
// Track every Application instance we know about so
|
|
482
|
+
// `tryFinalizeBootPlaceholder` can poll the real root view on the
|
|
483
|
+
// instance Angular actually committed to.
|
|
484
|
+
try {
|
|
485
|
+
const apps = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || (g['__NS_DEV_KNOWN_APPLICATIONS__'] = []));
|
|
486
|
+
const push = (a) => {
|
|
487
|
+
if (a && apps.indexOf(a) === -1)
|
|
488
|
+
apps.push(a);
|
|
489
|
+
};
|
|
490
|
+
push(Application);
|
|
491
|
+
push(g.Application);
|
|
492
|
+
try {
|
|
493
|
+
const reg = g.__nsVendorRegistry;
|
|
494
|
+
if (reg && typeof reg.get === 'function') {
|
|
495
|
+
const vendorCore = reg.get('@nativescript/core');
|
|
496
|
+
push(vendorCore?.Application);
|
|
497
|
+
push(vendorCore?.default?.Application);
|
|
498
|
+
const vendorAppMod = reg.get('@nativescript/core/application');
|
|
499
|
+
push(vendorAppMod?.Application);
|
|
500
|
+
push(vendorAppMod?.default?.Application);
|
|
330
501
|
}
|
|
331
502
|
}
|
|
332
503
|
catch { }
|
|
333
|
-
g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
|
|
334
504
|
}
|
|
505
|
+
catch { }
|
|
506
|
+
g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
|
|
507
|
+
g['__NS_DEV_PATCHED_RESET_ROOT__'] = true;
|
|
508
|
+
diag('patched Application.resetRootView', {
|
|
509
|
+
platform: isAndroid ? 'android' : 'ios',
|
|
510
|
+
wrappedLocal,
|
|
511
|
+
wrappedGlobal,
|
|
512
|
+
wrappedProto,
|
|
513
|
+
wrappedVendor,
|
|
514
|
+
wrappedVendorAppModule,
|
|
515
|
+
knownApplications: (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []).length,
|
|
516
|
+
});
|
|
335
517
|
const canCreatePlaceholderRoot = !!Frame && !!Page && !!Label;
|
|
336
518
|
if (!canCreatePlaceholderRoot && verbose) {
|
|
337
519
|
console.warn('[ns-placeholder] visual placeholder unavailable; starting lifecycle without placeholder root', {
|
|
@@ -352,67 +534,21 @@ export function installRootPlaceholder(verbose) {
|
|
|
352
534
|
let handlerFired = false;
|
|
353
535
|
// launchEvent handler: provides a placeholder root, then patches Application.run
|
|
354
536
|
const __ns_launch_handler = (args) => {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
catch { }
|
|
365
|
-
}
|
|
537
|
+
diag('launch handler fired', {
|
|
538
|
+
hasArgs: !!args,
|
|
539
|
+
hasExistingRoot: !!args?.root,
|
|
540
|
+
existingRootType: args?.root?.constructor?.name,
|
|
541
|
+
hasLaunched: typeof Application.hasLaunched === 'function' ? !!Application.hasLaunched() : undefined,
|
|
542
|
+
started: !!Application.started,
|
|
543
|
+
});
|
|
366
544
|
try {
|
|
367
545
|
const prev = args?.root;
|
|
368
546
|
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
|
|
547
|
+
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 });
|
|
548
|
+
const { page, statusLabel, detailLabel, progressFill, activityIndicator } = built;
|
|
415
549
|
g['__NS_DEV_BOOT_STATUS_LABEL__'] = statusLabel;
|
|
550
|
+
g['__NS_DEV_BOOT_DETAIL_LABEL__'] = detailLabel;
|
|
551
|
+
g['__NS_DEV_BOOT_PROGRESS_FILL__'] = progressFill;
|
|
416
552
|
g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'] = activityIndicator;
|
|
417
553
|
const frame = new Frame();
|
|
418
554
|
frame.navigate({ create: () => page, clearHistory: true, animated: false });
|
|
@@ -423,15 +559,12 @@ export function installRootPlaceholder(verbose) {
|
|
|
423
559
|
}
|
|
424
560
|
catch { }
|
|
425
561
|
if (verbose) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
});
|
|
433
|
-
}
|
|
434
|
-
catch { }
|
|
562
|
+
console.info('[ns-placeholder] assigned placeholder root', {
|
|
563
|
+
frameType: frame?.constructor?.name,
|
|
564
|
+
pageType: page?.constructor?.name,
|
|
565
|
+
hasProgressFill: !!progressFill,
|
|
566
|
+
hasActivityIndicator: !!activityIndicator,
|
|
567
|
+
});
|
|
435
568
|
}
|
|
436
569
|
if (args)
|
|
437
570
|
args.root = frame;
|
|
@@ -453,80 +586,120 @@ export function installRootPlaceholder(verbose) {
|
|
|
453
586
|
if (Application && typeof Application.run === 'function') {
|
|
454
587
|
const _originalRun = Application.run.bind(Application);
|
|
455
588
|
g['__NS_DEV_ORIGINAL_APP_RUN__'] = _originalRun;
|
|
589
|
+
// HMR ordering invariant: the patched `Application.run` MUST yield
|
|
590
|
+
// back to the synchronous caller before any iOS view-lifecycle event
|
|
591
|
+
// fires on the new root view.
|
|
592
|
+
//
|
|
593
|
+
// Concrete bug this guards against: nativescript-vue's `app.start()` is
|
|
594
|
+
// const componentInstance = app.mount(createAppRoot(), false, false);
|
|
595
|
+
// startApp(componentInstance); // → Application.run({ create: … })
|
|
596
|
+
// setRootApp(app); // — sets the module-private `rootApp`
|
|
597
|
+
// In a non-HMR build `Application.run` is `UIApplicationMain`, which
|
|
598
|
+
// returns control to the iOS runloop and lets `setRootApp(app)` execute
|
|
599
|
+
// before any `loaded`/`traitCollectionDidChange` callbacks fire. Under
|
|
600
|
+
// HMR `Application.run` is replaced with synchronous `resetRootView`,
|
|
601
|
+
// which attaches the root to the window *inside* this call — iOS then
|
|
602
|
+
// synchronously fires `loaded` on the new view tree, a TabView handler
|
|
603
|
+
// calls `nativescript-vue`'s `createNativeView`, that reads
|
|
604
|
+
// `rootApp._context`, and crashes with
|
|
605
|
+
// TypeError: Cannot read properties of null (reading '_context')
|
|
606
|
+
// because `setRootApp(app)` hasn't run yet.
|
|
607
|
+
//
|
|
608
|
+
// `setRootApp` is module-private inside the vendor bundle, so the bridge
|
|
609
|
+
// cannot call it directly. Deferring the synchronous root attachment to a
|
|
610
|
+
// microtask restores the production timing: every consumer that called
|
|
611
|
+
// `Application.run(entry)` completes its tail (including private state
|
|
612
|
+
// setters like `setRootApp`) before iOS triggers lifecycle on the new
|
|
613
|
+
// root. The microtask runs before any I/O or DOM-tick boundary, so the UI
|
|
614
|
+
// still appears in the same iOS runloop turn — no user-visible delay.
|
|
456
615
|
const __ns_dev_patched_run = function __ns_dev_patched_run(entry) {
|
|
616
|
+
diag('patched Application.run called', {
|
|
617
|
+
hasEntry: !!entry,
|
|
618
|
+
entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
|
|
619
|
+
});
|
|
620
|
+
// Detach the launch handler synchronously: by the time the caller
|
|
621
|
+
// returned from `Application.run()`, the framework owns root-view
|
|
622
|
+
// management, and we must not re-enter the placeholder path on a
|
|
623
|
+
// subsequent launch tick.
|
|
457
624
|
try {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
try {
|
|
461
|
-
if (Application && Application.off) {
|
|
462
|
-
Application.off(Application.launchEvent, __ns_launch_handler);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
catch { }
|
|
466
|
-
// When entry is undefined/null, the calling framework (e.g. Angular)
|
|
467
|
-
// manages root views itself via launch events and resetRootView().
|
|
468
|
-
// Don't attempt resetRootView(undefined) which throws "Main entry is missing".
|
|
469
|
-
if (!entry) {
|
|
470
|
-
if (verbose)
|
|
471
|
-
console.info('[ns-placeholder] patched run() called with no entry; framework manages root view');
|
|
472
|
-
return;
|
|
625
|
+
if (Application && Application.off) {
|
|
626
|
+
Application.off(Application.launchEvent, __ns_launch_handler);
|
|
473
627
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
628
|
+
}
|
|
629
|
+
catch { }
|
|
630
|
+
// Frameworks (notably Angular) call `Application.run()` with no
|
|
631
|
+
// entry — they own the root via launch events and `resetRootView()`
|
|
632
|
+
// directly. Bailing here keeps `resetRootView(undefined)` from
|
|
633
|
+
// throwing "Main entry is missing".
|
|
634
|
+
if (!entry) {
|
|
635
|
+
diag('patched run() called with no entry; framework manages root view');
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
// Snapshot for the deferred body so a later mutation by the caller
|
|
639
|
+
// can't observe a half-finished closure.
|
|
640
|
+
const __ns_deferred_entry = entry;
|
|
641
|
+
const __ns_deferred_reset = () => {
|
|
642
|
+
try {
|
|
643
|
+
const isModuleNameEntry = __ns_deferred_entry && __ns_deferred_entry.moduleName && !__ns_deferred_entry.create;
|
|
644
|
+
if (isModuleNameEntry) {
|
|
645
|
+
if (typeof Application.resetRootView === 'function') {
|
|
646
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
647
|
+
}
|
|
478
648
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
649
|
+
else {
|
|
650
|
+
// Framework path: two-phase boot with dominative document
|
|
651
|
+
Application._rootView = null;
|
|
652
|
+
try {
|
|
653
|
+
const domModule = g.__nsVendorRegistry?.get?.('dominative') ||
|
|
654
|
+
(typeof require === 'function'
|
|
655
|
+
? (() => {
|
|
656
|
+
try {
|
|
657
|
+
return require('dominative');
|
|
658
|
+
}
|
|
659
|
+
catch {
|
|
660
|
+
return null;
|
|
661
|
+
}
|
|
662
|
+
})()
|
|
663
|
+
: null);
|
|
664
|
+
const doc = domModule?.document;
|
|
665
|
+
if (doc && typeof Application.resetRootView === 'function') {
|
|
666
|
+
Application.resetRootView({ create: () => doc });
|
|
667
|
+
if (__ns_deferred_entry && typeof __ns_deferred_entry.create === 'function') {
|
|
668
|
+
__ns_deferred_entry.create();
|
|
669
|
+
}
|
|
500
670
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
671
|
+
else {
|
|
672
|
+
if (typeof Application.resetRootView === 'function') {
|
|
673
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
674
|
+
}
|
|
505
675
|
}
|
|
506
676
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
677
|
+
catch (e2) {
|
|
678
|
+
if (verbose)
|
|
679
|
+
console.warn('[ns-placeholder] two-phase boot failed:', e2?.message || e2);
|
|
680
|
+
try {
|
|
681
|
+
if (typeof Application.resetRootView === 'function') {
|
|
682
|
+
Application.resetRootView(__ns_deferred_entry);
|
|
683
|
+
}
|
|
514
684
|
}
|
|
685
|
+
catch { }
|
|
515
686
|
}
|
|
516
|
-
catch { }
|
|
517
687
|
}
|
|
518
688
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
}
|
|
689
|
+
catch (e) {
|
|
690
|
+
console.warn('[ns-placeholder] deferred patched run() error:', e);
|
|
691
|
+
}
|
|
692
|
+
};
|
|
693
|
+
// Microtask-defer. `Promise.resolve().then(...)` lands the callback
|
|
694
|
+
// in the same iOS runloop turn — no perceptible delay — but only
|
|
695
|
+
// after the synchronous call stack that invoked `Application.run`
|
|
696
|
+
// has fully unwound, so `nativescript-vue`'s post-`startApp` code
|
|
697
|
+
// (`setRootApp(app);`) has executed before any view lifecycle fires.
|
|
698
|
+
Promise.resolve().then(__ns_deferred_reset);
|
|
523
699
|
};
|
|
524
700
|
Application.run = __ns_dev_patched_run;
|
|
525
701
|
if (verbose) {
|
|
526
|
-
|
|
527
|
-
console.info('[ns-placeholder] patched Application.run');
|
|
528
|
-
}
|
|
529
|
-
catch { }
|
|
702
|
+
console.info('[ns-placeholder] patched Application.run');
|
|
530
703
|
}
|
|
531
704
|
if (g.Application && g.Application !== Application) {
|
|
532
705
|
g.Application.run = __ns_dev_patched_run;
|
|
@@ -564,11 +737,8 @@ export function installRootPlaceholder(verbose) {
|
|
|
564
737
|
type: appAny?.constructor?.name,
|
|
565
738
|
};
|
|
566
739
|
if (verbose) {
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
console.info('[ns-placeholder] application source', applicationResolved.source);
|
|
570
|
-
}
|
|
571
|
-
catch { }
|
|
740
|
+
console.info('[ns-placeholder] application methods', methodState);
|
|
741
|
+
console.info('[ns-placeholder] application source', applicationResolved.source);
|
|
572
742
|
}
|
|
573
743
|
if (!appAny || typeof appAny.run !== 'function') {
|
|
574
744
|
console.warn('[ns-placeholder] Application.run unavailable', {
|
|
@@ -584,27 +754,21 @@ export function installRootPlaceholder(verbose) {
|
|
|
584
754
|
const iosNativeApp = appAny.ios?.nativeApp;
|
|
585
755
|
const canRunAsMainApp = typeof appAny.runAsMainApp === 'function';
|
|
586
756
|
if (verbose) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
catch { }
|
|
757
|
+
console.info('[ns-placeholder] boot state', {
|
|
758
|
+
hasLaunched,
|
|
759
|
+
hasRootView,
|
|
760
|
+
started,
|
|
761
|
+
nativeApp: !!nativeApp,
|
|
762
|
+
iosNativeApp: !!iosNativeApp,
|
|
763
|
+
canRunAsMainApp,
|
|
764
|
+
hasResetRootView: typeof appAny.resetRootView === 'function',
|
|
765
|
+
});
|
|
599
766
|
}
|
|
600
767
|
if (hasLaunched || hasRootView) {
|
|
601
768
|
// App lifecycle is already active. Skip starting it again and only install
|
|
602
769
|
// the placeholder root/patching behavior for the existing instance.
|
|
603
770
|
if (verbose) {
|
|
604
|
-
|
|
605
|
-
console.info('[ns-placeholder] boot branch: existing lifecycle');
|
|
606
|
-
}
|
|
607
|
-
catch { }
|
|
771
|
+
console.info('[ns-placeholder] boot branch: existing lifecycle');
|
|
608
772
|
}
|
|
609
773
|
try {
|
|
610
774
|
__ns_launch_handler();
|
|
@@ -613,20 +777,14 @@ export function installRootPlaceholder(verbose) {
|
|
|
613
777
|
}
|
|
614
778
|
else if (canRunAsMainApp) {
|
|
615
779
|
if (verbose) {
|
|
616
|
-
|
|
617
|
-
console.info('[ns-placeholder] boot branch: runAsMainApp');
|
|
618
|
-
}
|
|
619
|
-
catch { }
|
|
780
|
+
console.info('[ns-placeholder] boot branch: runAsMainApp');
|
|
620
781
|
}
|
|
621
782
|
appAny.started = true;
|
|
622
783
|
appAny.runAsMainApp();
|
|
623
784
|
}
|
|
624
785
|
else {
|
|
625
786
|
if (verbose) {
|
|
626
|
-
|
|
627
|
-
console.info('[ns-placeholder] boot branch: Application.run');
|
|
628
|
-
}
|
|
629
|
-
catch { }
|
|
787
|
+
console.info('[ns-placeholder] boot branch: Application.run');
|
|
630
788
|
}
|
|
631
789
|
appAny.run();
|
|
632
790
|
}
|