@nativescript/vite 8.0.0-alpha.1 → 8.0.0-alpha.3
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/configuration/angular.d.ts +1 -1
- package/configuration/angular.js +323 -119
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +41 -24
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +3 -3
- package/configuration/javascript.js.map +1 -1
- package/configuration/solid.js +7 -0
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +3 -3
- package/configuration/typescript.js.map +1 -1
- package/helpers/angular/angular-linker.js +39 -34
- package/helpers/angular/angular-linker.js.map +1 -1
- package/helpers/angular/inline-decorator-component-templates.d.ts +3 -0
- package/helpers/angular/inline-decorator-component-templates.js +400 -0
- package/helpers/angular/inline-decorator-component-templates.js.map +1 -0
- package/helpers/angular/shared-linker.d.ts +7 -0
- package/helpers/angular/shared-linker.js +37 -1
- package/helpers/angular/shared-linker.js.map +1 -1
- package/helpers/angular/synthesize-decorator-ctor-parameters.d.ts +1 -0
- package/helpers/angular/synthesize-decorator-ctor-parameters.js +256 -0
- package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +1 -0
- package/helpers/angular/synthesize-injectable-factories.d.ts +3 -0
- package/helpers/angular/synthesize-injectable-factories.js +414 -0
- package/helpers/angular/synthesize-injectable-factories.js.map +1 -0
- package/helpers/commonjs-plugins.d.ts +5 -2
- package/helpers/commonjs-plugins.js +126 -0
- package/helpers/commonjs-plugins.js.map +1 -1
- package/helpers/esbuild-platform-resolver.js +5 -5
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +9 -1
- package/helpers/external-configs.js +31 -6
- package/helpers/external-configs.js.map +1 -1
- package/helpers/import-meta-path.d.ts +4 -0
- package/helpers/import-meta-path.js +5 -0
- package/helpers/import-meta-path.js.map +1 -0
- package/helpers/import-specifier.d.ts +1 -0
- package/helpers/import-specifier.js +18 -0
- package/helpers/import-specifier.js.map +1 -0
- package/helpers/main-entry.d.ts +5 -2
- package/helpers/main-entry.js +112 -95
- package/helpers/main-entry.js.map +1 -1
- package/helpers/nativeclass-transform.js +8 -127
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.d.ts +12 -1
- package/helpers/nativeclass-transformer-plugin.js +175 -36
- package/helpers/nativeclass-transformer-plugin.js.map +1 -1
- package/hmr/client/css-handler.js +60 -20
- package/hmr/client/css-handler.js.map +1 -1
- package/hmr/client/index.js +524 -23
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/utils.js +57 -6
- package/hmr/client/utils.js.map +1 -1
- package/hmr/entry-runtime.d.ts +10 -0
- package/hmr/entry-runtime.js +263 -21
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/client/index.d.ts +2 -1
- package/hmr/frameworks/angular/client/index.js +72 -19
- package/hmr/frameworks/angular/client/index.js.map +1 -1
- package/hmr/frameworks/angular/server/linker.js +36 -2
- package/hmr/frameworks/angular/server/linker.js.map +1 -1
- package/hmr/frameworks/angular/server/strategy.js +20 -5
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/server/strategy.js +8 -2
- package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
- package/hmr/helpers/ast-normalizer.js +22 -10
- package/hmr/helpers/ast-normalizer.js.map +1 -1
- package/hmr/server/constants.d.ts +1 -0
- package/hmr/server/constants.js +2 -0
- package/hmr/server/constants.js.map +1 -1
- package/hmr/server/core-sanitize.d.ts +43 -0
- package/hmr/server/core-sanitize.js +219 -13
- package/hmr/server/core-sanitize.js.map +1 -1
- package/hmr/server/import-map.d.ts +65 -0
- package/hmr/server/import-map.js +219 -0
- package/hmr/server/import-map.js.map +1 -0
- package/hmr/server/index.d.ts +2 -1
- package/hmr/server/index.js.map +1 -1
- package/hmr/server/runtime-graph-filter.d.ts +5 -0
- package/hmr/server/runtime-graph-filter.js +21 -0
- package/hmr/server/runtime-graph-filter.js.map +1 -0
- package/hmr/server/shared-transform-request.d.ts +12 -0
- package/hmr/server/shared-transform-request.js +137 -0
- package/hmr/server/shared-transform-request.js.map +1 -0
- package/hmr/server/vite-plugin.d.ts +21 -1
- package/hmr/server/vite-plugin.js +443 -22
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-angular-entry.d.ts +2 -0
- package/hmr/server/websocket-angular-entry.js +68 -0
- package/hmr/server/websocket-angular-entry.js.map +1 -0
- package/hmr/server/websocket-angular-hot-update.d.ts +61 -0
- package/hmr/server/websocket-angular-hot-update.js +239 -0
- package/hmr/server/websocket-angular-hot-update.js.map +1 -0
- package/hmr/server/websocket-core-bridge.d.ts +23 -0
- package/hmr/server/websocket-core-bridge.js +360 -0
- package/hmr/server/websocket-core-bridge.js.map +1 -0
- package/hmr/server/websocket-graph-upsert.d.ts +6 -0
- package/hmr/server/websocket-graph-upsert.js +13 -0
- package/hmr/server/websocket-graph-upsert.js.map +1 -0
- package/hmr/server/websocket-module-bindings.d.ts +6 -0
- package/hmr/server/websocket-module-bindings.js +471 -0
- package/hmr/server/websocket-module-bindings.js.map +1 -0
- package/hmr/server/websocket-module-specifiers.d.ts +37 -0
- package/hmr/server/websocket-module-specifiers.js +637 -0
- package/hmr/server/websocket-module-specifiers.js.map +1 -0
- package/hmr/server/websocket.d.ts +26 -3
- package/hmr/server/websocket.js +1402 -678
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/package-classifier.d.ts +9 -0
- package/hmr/shared/package-classifier.js +58 -0
- package/hmr/shared/package-classifier.js.map +1 -0
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +64 -0
- package/hmr/shared/runtime/browser-runtime-contract.js +54 -0
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay.d.ts +38 -0
- package/hmr/shared/runtime/dev-overlay.js +675 -0
- package/hmr/shared/runtime/dev-overlay.js.map +1 -0
- package/hmr/shared/runtime/http-only-boot.d.ts +1 -0
- package/hmr/shared/runtime/http-only-boot.js +53 -6
- package/hmr/shared/runtime/http-only-boot.js.map +1 -1
- package/hmr/shared/runtime/module-provenance.d.ts +1 -0
- package/hmr/shared/runtime/module-provenance.js +66 -0
- package/hmr/shared/runtime/module-provenance.js.map +1 -0
- package/hmr/shared/runtime/platform-polyfills.d.ts +26 -0
- package/hmr/shared/runtime/platform-polyfills.js +122 -0
- package/hmr/shared/runtime/platform-polyfills.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.d.ts +1 -0
- package/hmr/shared/runtime/root-placeholder.js +576 -76
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.d.ts +1 -0
- package/hmr/shared/runtime/session-bootstrap.js +146 -0
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -0
- package/hmr/shared/runtime/vendor-bootstrap.js +51 -6
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/vendor/manifest.d.ts +7 -0
- package/hmr/shared/vendor/manifest.js +363 -23
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/hmr/shared/vendor/registry.js +104 -7
- package/hmr/shared/vendor/registry.js.map +1 -1
- package/package.json +12 -2
- package/runtime/core-aliases-early.js +83 -32
- package/runtime/core-aliases-early.js.map +1 -1
- package/shims/solid-jsx-runtime.d.ts +7 -0
- package/shims/solid-jsx-runtime.js +17 -0
- package/shims/solid-jsx-runtime.js.map +1 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
const BOOT_TITLE = 'NativeScript Vite preparing dev session...';
|
|
2
|
+
const DEFAULT_SNAPSHOT = {
|
|
3
|
+
visible: false,
|
|
4
|
+
mode: 'hidden',
|
|
5
|
+
badge: 'HMR',
|
|
6
|
+
title: BOOT_TITLE,
|
|
7
|
+
phase: '',
|
|
8
|
+
detail: '',
|
|
9
|
+
progress: null,
|
|
10
|
+
busy: false,
|
|
11
|
+
blocking: false,
|
|
12
|
+
tone: 'info',
|
|
13
|
+
};
|
|
14
|
+
function getOverlayGlobal() {
|
|
15
|
+
return globalThis;
|
|
16
|
+
}
|
|
17
|
+
function getRuntimeState() {
|
|
18
|
+
const g = getOverlayGlobal();
|
|
19
|
+
if (!g.__NS_HMR_DEV_OVERLAY_STATE__) {
|
|
20
|
+
g.__NS_HMR_DEV_OVERLAY_STATE__ = {
|
|
21
|
+
snapshot: { ...DEFAULT_SNAPSHOT },
|
|
22
|
+
bootRefs: null,
|
|
23
|
+
liveRefs: null,
|
|
24
|
+
verbose: false,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return g.__NS_HMR_DEV_OVERLAY_STATE__;
|
|
28
|
+
}
|
|
29
|
+
function describeAttempt(info) {
|
|
30
|
+
const attempt = Number(info?.attempt || 0);
|
|
31
|
+
const attempts = Number(info?.attempts || 0);
|
|
32
|
+
if (!attempt || !attempts) {
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
return `Attempt ${attempt}/${attempts}`;
|
|
36
|
+
}
|
|
37
|
+
export function createBootOverlaySnapshot(stage, info) {
|
|
38
|
+
const attemptText = describeAttempt(info);
|
|
39
|
+
const phaseInfo = {
|
|
40
|
+
placeholder: {
|
|
41
|
+
visible: true,
|
|
42
|
+
mode: 'boot',
|
|
43
|
+
badge: 'BOOT',
|
|
44
|
+
title: BOOT_TITLE,
|
|
45
|
+
phase: 'Preparing the HTTP HMR bootstrap',
|
|
46
|
+
progress: 4,
|
|
47
|
+
busy: true,
|
|
48
|
+
blocking: true,
|
|
49
|
+
tone: 'info',
|
|
50
|
+
},
|
|
51
|
+
'probing-origin': {
|
|
52
|
+
visible: true,
|
|
53
|
+
mode: 'boot',
|
|
54
|
+
badge: 'BOOT',
|
|
55
|
+
title: BOOT_TITLE,
|
|
56
|
+
phase: 'Contacting the Vite dev server',
|
|
57
|
+
progress: 8,
|
|
58
|
+
busy: true,
|
|
59
|
+
blocking: true,
|
|
60
|
+
tone: 'info',
|
|
61
|
+
},
|
|
62
|
+
'loading-entry-runtime': {
|
|
63
|
+
visible: true,
|
|
64
|
+
mode: 'boot',
|
|
65
|
+
badge: 'BOOT',
|
|
66
|
+
title: BOOT_TITLE,
|
|
67
|
+
phase: 'Loading the entry runtime bridge',
|
|
68
|
+
progress: 16,
|
|
69
|
+
busy: true,
|
|
70
|
+
blocking: true,
|
|
71
|
+
tone: 'info',
|
|
72
|
+
},
|
|
73
|
+
'configuring-import-map': {
|
|
74
|
+
visible: true,
|
|
75
|
+
mode: 'boot',
|
|
76
|
+
badge: 'BOOT',
|
|
77
|
+
title: BOOT_TITLE,
|
|
78
|
+
phase: 'Configuring the import map',
|
|
79
|
+
progress: 26,
|
|
80
|
+
busy: true,
|
|
81
|
+
blocking: true,
|
|
82
|
+
tone: 'info',
|
|
83
|
+
},
|
|
84
|
+
'loading-runtime-bridge': {
|
|
85
|
+
visible: true,
|
|
86
|
+
mode: 'boot',
|
|
87
|
+
badge: 'BOOT',
|
|
88
|
+
title: BOOT_TITLE,
|
|
89
|
+
phase: 'Loading the NativeScript runtime bridge',
|
|
90
|
+
progress: 40,
|
|
91
|
+
busy: true,
|
|
92
|
+
blocking: true,
|
|
93
|
+
tone: 'info',
|
|
94
|
+
},
|
|
95
|
+
'loading-core-bridge': {
|
|
96
|
+
visible: true,
|
|
97
|
+
mode: 'boot',
|
|
98
|
+
badge: 'BOOT',
|
|
99
|
+
title: BOOT_TITLE,
|
|
100
|
+
phase: 'Loading the unified core bridge',
|
|
101
|
+
progress: 54,
|
|
102
|
+
busy: true,
|
|
103
|
+
blocking: true,
|
|
104
|
+
tone: 'info',
|
|
105
|
+
},
|
|
106
|
+
'preloading-style-scope': {
|
|
107
|
+
visible: true,
|
|
108
|
+
mode: 'boot',
|
|
109
|
+
badge: 'BOOT',
|
|
110
|
+
title: BOOT_TITLE,
|
|
111
|
+
phase: 'Preparing the shared style scope',
|
|
112
|
+
progress: 62,
|
|
113
|
+
busy: true,
|
|
114
|
+
blocking: true,
|
|
115
|
+
tone: 'info',
|
|
116
|
+
},
|
|
117
|
+
'installing-css': {
|
|
118
|
+
visible: true,
|
|
119
|
+
mode: 'boot',
|
|
120
|
+
badge: 'BOOT',
|
|
121
|
+
title: BOOT_TITLE,
|
|
122
|
+
phase: 'Applying the app stylesheet',
|
|
123
|
+
progress: 70,
|
|
124
|
+
busy: true,
|
|
125
|
+
blocking: true,
|
|
126
|
+
tone: 'info',
|
|
127
|
+
},
|
|
128
|
+
'importing-main': {
|
|
129
|
+
visible: true,
|
|
130
|
+
mode: 'boot',
|
|
131
|
+
badge: 'BOOT',
|
|
132
|
+
title: BOOT_TITLE,
|
|
133
|
+
phase: 'Importing the app entry',
|
|
134
|
+
progress: 82,
|
|
135
|
+
busy: true,
|
|
136
|
+
blocking: true,
|
|
137
|
+
tone: 'info',
|
|
138
|
+
},
|
|
139
|
+
'waiting-for-app': {
|
|
140
|
+
visible: true,
|
|
141
|
+
mode: 'boot',
|
|
142
|
+
badge: 'BOOT',
|
|
143
|
+
title: BOOT_TITLE,
|
|
144
|
+
phase: 'Waiting for the app root view',
|
|
145
|
+
progress: 94,
|
|
146
|
+
busy: true,
|
|
147
|
+
blocking: true,
|
|
148
|
+
tone: 'info',
|
|
149
|
+
},
|
|
150
|
+
'app-root-committed': {
|
|
151
|
+
visible: true,
|
|
152
|
+
mode: 'boot',
|
|
153
|
+
badge: 'READY',
|
|
154
|
+
title: BOOT_TITLE,
|
|
155
|
+
phase: 'Real app root committed',
|
|
156
|
+
progress: 100,
|
|
157
|
+
busy: false,
|
|
158
|
+
blocking: true,
|
|
159
|
+
tone: 'info',
|
|
160
|
+
},
|
|
161
|
+
ready: {
|
|
162
|
+
visible: true,
|
|
163
|
+
mode: 'boot',
|
|
164
|
+
badge: 'READY',
|
|
165
|
+
title: BOOT_TITLE,
|
|
166
|
+
phase: 'Boot complete',
|
|
167
|
+
progress: 100,
|
|
168
|
+
busy: false,
|
|
169
|
+
blocking: true,
|
|
170
|
+
tone: 'info',
|
|
171
|
+
},
|
|
172
|
+
error: {
|
|
173
|
+
visible: true,
|
|
174
|
+
mode: 'boot',
|
|
175
|
+
badge: 'RETRY',
|
|
176
|
+
title: BOOT_TITLE,
|
|
177
|
+
phase: 'Retrying after a boot failure',
|
|
178
|
+
progress: null,
|
|
179
|
+
busy: true,
|
|
180
|
+
blocking: true,
|
|
181
|
+
tone: 'error',
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
const base = phaseInfo[stage];
|
|
185
|
+
let detail = info?.detail || '';
|
|
186
|
+
if (!detail && stage === 'probing-origin' && info?.origin) {
|
|
187
|
+
detail = `Trying ${info.origin}`;
|
|
188
|
+
}
|
|
189
|
+
if (attemptText) {
|
|
190
|
+
detail = detail ? `${detail} ${attemptText}` : attemptText;
|
|
191
|
+
}
|
|
192
|
+
return {
|
|
193
|
+
...base,
|
|
194
|
+
detail,
|
|
195
|
+
progress: typeof info?.progress === 'number' || info?.progress === null ? info.progress : base.progress,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
export function createConnectionOverlaySnapshot(stage, info) {
|
|
199
|
+
if (stage === 'healthy') {
|
|
200
|
+
return { ...DEFAULT_SNAPSHOT };
|
|
201
|
+
}
|
|
202
|
+
const phaseInfo = {
|
|
203
|
+
connecting: {
|
|
204
|
+
visible: true,
|
|
205
|
+
mode: 'connection',
|
|
206
|
+
badge: 'SOCKET',
|
|
207
|
+
title: 'Waiting for Vite dev server',
|
|
208
|
+
phase: 'Opening websocket connection',
|
|
209
|
+
detail: 'Live updates are paused until the connection is healthy.',
|
|
210
|
+
progress: null,
|
|
211
|
+
busy: true,
|
|
212
|
+
blocking: false,
|
|
213
|
+
tone: 'warn',
|
|
214
|
+
},
|
|
215
|
+
reconnecting: {
|
|
216
|
+
visible: true,
|
|
217
|
+
mode: 'connection',
|
|
218
|
+
badge: 'SOCKET',
|
|
219
|
+
title: 'HMR connection lost',
|
|
220
|
+
phase: 'Reconnecting Vite websocket',
|
|
221
|
+
detail: 'The app may be stale until the dev server reconnects.',
|
|
222
|
+
progress: null,
|
|
223
|
+
busy: true,
|
|
224
|
+
blocking: false,
|
|
225
|
+
tone: 'warn',
|
|
226
|
+
},
|
|
227
|
+
synchronizing: {
|
|
228
|
+
visible: true,
|
|
229
|
+
mode: 'connection',
|
|
230
|
+
badge: 'SYNC',
|
|
231
|
+
title: 'HMR connection restored',
|
|
232
|
+
phase: 'Synchronizing live-update state',
|
|
233
|
+
detail: 'Finalizing the module graph before dismissing the overlay.',
|
|
234
|
+
progress: 95,
|
|
235
|
+
busy: true,
|
|
236
|
+
blocking: false,
|
|
237
|
+
tone: 'info',
|
|
238
|
+
},
|
|
239
|
+
offline: {
|
|
240
|
+
visible: true,
|
|
241
|
+
mode: 'connection',
|
|
242
|
+
badge: 'OFFLINE',
|
|
243
|
+
title: 'Vite dev server offline',
|
|
244
|
+
phase: 'Idle...',
|
|
245
|
+
detail: 'The websocket and HTTP HMR path are both unavailable right now.',
|
|
246
|
+
progress: null,
|
|
247
|
+
busy: true,
|
|
248
|
+
blocking: false,
|
|
249
|
+
tone: 'error',
|
|
250
|
+
},
|
|
251
|
+
};
|
|
252
|
+
const base = phaseInfo[stage];
|
|
253
|
+
return {
|
|
254
|
+
...base,
|
|
255
|
+
detail: info?.detail || base.detail,
|
|
256
|
+
progress: typeof info?.progress === 'number' || info?.progress === null ? info.progress : base.progress,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function resolveCoreExport(name) {
|
|
260
|
+
const g = getOverlayGlobal();
|
|
261
|
+
try {
|
|
262
|
+
const reg = g.__nsVendorRegistry;
|
|
263
|
+
if (reg && typeof reg.get === 'function') {
|
|
264
|
+
const mod = reg.get('@nativescript/core');
|
|
265
|
+
const ns = (mod && (mod.default ?? mod)) || mod;
|
|
266
|
+
if (ns && ns[name]) {
|
|
267
|
+
return ns[name];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch { }
|
|
272
|
+
try {
|
|
273
|
+
if (g && g[name]) {
|
|
274
|
+
return g[name];
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
catch { }
|
|
278
|
+
try {
|
|
279
|
+
const req = g.__nsVendorRequire || g.__nsRequire || g.require;
|
|
280
|
+
if (typeof req === 'function') {
|
|
281
|
+
const mod = req('@nativescript/core');
|
|
282
|
+
const ns = (mod && (mod.default ?? mod)) || mod;
|
|
283
|
+
if (ns && ns[name]) {
|
|
284
|
+
return ns[name];
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
catch { }
|
|
289
|
+
try {
|
|
290
|
+
const nativeReq = g.__nativeRequire;
|
|
291
|
+
if (typeof nativeReq === 'function') {
|
|
292
|
+
const mod = nativeReq('@nativescript/core', '/');
|
|
293
|
+
const ns = (mod && (mod.default ?? mod)) || mod;
|
|
294
|
+
if (ns && ns[name]) {
|
|
295
|
+
return ns[name];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch { }
|
|
300
|
+
return undefined;
|
|
301
|
+
}
|
|
302
|
+
function asColor(value) {
|
|
303
|
+
try {
|
|
304
|
+
const Color = resolveCoreExport('Color');
|
|
305
|
+
if (Color) {
|
|
306
|
+
return new Color(value);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch { }
|
|
310
|
+
return value;
|
|
311
|
+
}
|
|
312
|
+
function formatStatusText(snapshot) {
|
|
313
|
+
const progressText = typeof snapshot.progress === 'number' ? ` (${Math.round(Number(snapshot.progress))}%)` : '';
|
|
314
|
+
const primary = `${snapshot.phase || ''}${progressText}`.trim();
|
|
315
|
+
return [primary, snapshot.detail].filter(Boolean).join('\n');
|
|
316
|
+
}
|
|
317
|
+
function buildBootOverlayRefs(snapshot) {
|
|
318
|
+
const Page = resolveCoreExport('Page');
|
|
319
|
+
const StackLayout = resolveCoreExport('StackLayout');
|
|
320
|
+
const Label = resolveCoreExport('Label');
|
|
321
|
+
const ActivityIndicator = resolveCoreExport('ActivityIndicator');
|
|
322
|
+
if (!Page || !StackLayout || !Label) {
|
|
323
|
+
return null;
|
|
324
|
+
}
|
|
325
|
+
const page = new Page();
|
|
326
|
+
page.actionBarHidden = true;
|
|
327
|
+
const root = new StackLayout();
|
|
328
|
+
root.padding = 24;
|
|
329
|
+
root.verticalAlignment = 'middle';
|
|
330
|
+
root.horizontalAlignment = 'stretch';
|
|
331
|
+
const titleLabel = new Label();
|
|
332
|
+
titleLabel.text = BOOT_TITLE;
|
|
333
|
+
titleLabel.textAlignment = 'center';
|
|
334
|
+
titleLabel.textWrap = true;
|
|
335
|
+
titleLabel.fontSize = 22;
|
|
336
|
+
titleLabel.fontWeight = '600';
|
|
337
|
+
const statusLabel = new Label();
|
|
338
|
+
statusLabel.textAlignment = 'center';
|
|
339
|
+
statusLabel.textWrap = true;
|
|
340
|
+
statusLabel.fontSize = 14;
|
|
341
|
+
statusLabel.marginTop = 12;
|
|
342
|
+
const activityIndicator = ActivityIndicator
|
|
343
|
+
? (() => {
|
|
344
|
+
const indicator = new ActivityIndicator();
|
|
345
|
+
indicator.marginTop = 16;
|
|
346
|
+
indicator.width = 28;
|
|
347
|
+
indicator.height = 28;
|
|
348
|
+
indicator.horizontalAlignment = 'center';
|
|
349
|
+
return indicator;
|
|
350
|
+
})()
|
|
351
|
+
: null;
|
|
352
|
+
root.addChild(titleLabel);
|
|
353
|
+
root.addChild(statusLabel);
|
|
354
|
+
if (activityIndicator) {
|
|
355
|
+
root.addChild(activityIndicator);
|
|
356
|
+
}
|
|
357
|
+
page.content = root;
|
|
358
|
+
const refs = {
|
|
359
|
+
page,
|
|
360
|
+
root,
|
|
361
|
+
titleLabel,
|
|
362
|
+
statusLabel,
|
|
363
|
+
activityIndicator,
|
|
364
|
+
};
|
|
365
|
+
applySnapshotToBootRefs(refs, snapshot);
|
|
366
|
+
return refs;
|
|
367
|
+
}
|
|
368
|
+
function applySnapshotToBootRefs(refs, snapshot) {
|
|
369
|
+
if (!refs) {
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
refs.page.actionBarHidden = true;
|
|
373
|
+
refs.page.backgroundColor = asColor(snapshot.tone === 'error' ? '#b4181068' : '#a1771683');
|
|
374
|
+
refs.root.visibility = snapshot.visible && snapshot.mode === 'boot' ? 'visible' : 'collapse';
|
|
375
|
+
refs.titleLabel.text = BOOT_TITLE;
|
|
376
|
+
refs.titleLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
|
|
377
|
+
refs.statusLabel.text = formatStatusText(snapshot) || 'Preparing the HTTP HMR bootstrap (4%)';
|
|
378
|
+
refs.statusLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
|
|
379
|
+
if (refs.activityIndicator) {
|
|
380
|
+
refs.activityIndicator.busy = !!snapshot.busy;
|
|
381
|
+
refs.activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function findBootActivityIndicator() {
|
|
385
|
+
const g = getOverlayGlobal();
|
|
386
|
+
if (g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__) {
|
|
387
|
+
return g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__;
|
|
388
|
+
}
|
|
389
|
+
try {
|
|
390
|
+
const frame = g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__;
|
|
391
|
+
if (!frame)
|
|
392
|
+
return null;
|
|
393
|
+
const page = frame.currentPage || frame._currentEntry?.resolvedPage;
|
|
394
|
+
const content = page?.content;
|
|
395
|
+
const children = content?.getChildrenCount?.() || 0;
|
|
396
|
+
if (children >= 3) {
|
|
397
|
+
const indicator = content.getChildAt?.(2);
|
|
398
|
+
if (indicator && typeof indicator.busy !== 'undefined') {
|
|
399
|
+
g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__ = indicator;
|
|
400
|
+
return indicator;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
catch { }
|
|
405
|
+
return null;
|
|
406
|
+
}
|
|
407
|
+
function findBootStatusLabel() {
|
|
408
|
+
const g = getOverlayGlobal();
|
|
409
|
+
// Try direct reference first
|
|
410
|
+
if (g.__NS_DEV_BOOT_STATUS_LABEL__) {
|
|
411
|
+
return g.__NS_DEV_BOOT_STATUS_LABEL__;
|
|
412
|
+
}
|
|
413
|
+
// Fallback: walk from placeholder root view
|
|
414
|
+
try {
|
|
415
|
+
const frame = g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__;
|
|
416
|
+
if (!frame)
|
|
417
|
+
return null;
|
|
418
|
+
const page = frame.currentPage || frame._currentEntry?.resolvedPage;
|
|
419
|
+
if (!page)
|
|
420
|
+
return null;
|
|
421
|
+
const content = page.content;
|
|
422
|
+
if (!content)
|
|
423
|
+
return null;
|
|
424
|
+
// StackLayout with children: titleLabel, statusLabel
|
|
425
|
+
const children = content.getChildrenCount?.() || 0;
|
|
426
|
+
if (children >= 2) {
|
|
427
|
+
const label = content.getChildAt?.(1);
|
|
428
|
+
if (label && typeof label.text !== 'undefined') {
|
|
429
|
+
// Cache for next time
|
|
430
|
+
g.__NS_DEV_BOOT_STATUS_LABEL__ = label;
|
|
431
|
+
return label;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
catch { }
|
|
436
|
+
return null;
|
|
437
|
+
}
|
|
438
|
+
function updateBootStatusLabel(snapshot) {
|
|
439
|
+
const newText = formatStatusText(snapshot) || 'Preparing the HTTP HMR bootstrap (4%)';
|
|
440
|
+
const statusLabel = findBootStatusLabel();
|
|
441
|
+
const activityIndicator = findBootActivityIndicator();
|
|
442
|
+
if (!statusLabel) {
|
|
443
|
+
if (activityIndicator) {
|
|
444
|
+
try {
|
|
445
|
+
activityIndicator.busy = !!snapshot.busy;
|
|
446
|
+
activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
|
|
447
|
+
}
|
|
448
|
+
catch { }
|
|
449
|
+
}
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
statusLabel.text = newText;
|
|
454
|
+
statusLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
|
|
455
|
+
if (typeof statusLabel.requestLayout === 'function') {
|
|
456
|
+
statusLabel.requestLayout();
|
|
457
|
+
}
|
|
458
|
+
const parent = statusLabel.parent;
|
|
459
|
+
if (parent && typeof parent.requestLayout === 'function') {
|
|
460
|
+
parent.requestLayout();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
catch { }
|
|
464
|
+
if (activityIndicator) {
|
|
465
|
+
try {
|
|
466
|
+
activityIndicator.busy = !!snapshot.busy;
|
|
467
|
+
activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
|
|
468
|
+
}
|
|
469
|
+
catch { }
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function resolveActivePage() {
|
|
473
|
+
try {
|
|
474
|
+
const Frame = resolveCoreExport('Frame');
|
|
475
|
+
const frame = Frame?.topmost?.() || null;
|
|
476
|
+
const currentPage = frame?.currentPage || frame?._currentEntry?.resolvedPage || null;
|
|
477
|
+
if (currentPage) {
|
|
478
|
+
return currentPage;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
catch { }
|
|
482
|
+
try {
|
|
483
|
+
const Application = resolveCoreExport('Application');
|
|
484
|
+
const rootView = Application?.getRootView?.() || null;
|
|
485
|
+
if (rootView?.currentPage) {
|
|
486
|
+
return rootView.currentPage;
|
|
487
|
+
}
|
|
488
|
+
if (typeof rootView?.content !== 'undefined') {
|
|
489
|
+
return rootView;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
catch { }
|
|
493
|
+
return null;
|
|
494
|
+
}
|
|
495
|
+
function buildLiveOverlayView(snapshot) {
|
|
496
|
+
const GridLayout = resolveCoreExport('GridLayout');
|
|
497
|
+
const StackLayout = resolveCoreExport('StackLayout');
|
|
498
|
+
const Label = resolveCoreExport('Label');
|
|
499
|
+
if (!GridLayout || !StackLayout || !Label) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
const overlay = new GridLayout();
|
|
503
|
+
overlay.visibility = 'collapse';
|
|
504
|
+
overlay.width = '100%';
|
|
505
|
+
overlay.height = '100%';
|
|
506
|
+
overlay.horizontalAlignment = 'stretch';
|
|
507
|
+
overlay.verticalAlignment = 'stretch';
|
|
508
|
+
const panel = new StackLayout();
|
|
509
|
+
panel.horizontalAlignment = 'center';
|
|
510
|
+
panel.verticalAlignment = 'middle';
|
|
511
|
+
panel.width = 320;
|
|
512
|
+
panel.margin = 24;
|
|
513
|
+
panel.padding = 16;
|
|
514
|
+
const titleLabel = new Label();
|
|
515
|
+
titleLabel.textAlignment = 'center';
|
|
516
|
+
titleLabel.textWrap = true;
|
|
517
|
+
titleLabel.fontSize = 18;
|
|
518
|
+
titleLabel.fontWeight = '600';
|
|
519
|
+
const statusLabel = new Label();
|
|
520
|
+
statusLabel.textAlignment = 'center';
|
|
521
|
+
statusLabel.textWrap = true;
|
|
522
|
+
statusLabel.fontSize = 13;
|
|
523
|
+
statusLabel.marginTop = 10;
|
|
524
|
+
panel.addChild(titleLabel);
|
|
525
|
+
panel.addChild(statusLabel);
|
|
526
|
+
overlay.addChild(panel);
|
|
527
|
+
const refs = {
|
|
528
|
+
overlay,
|
|
529
|
+
titleLabel,
|
|
530
|
+
statusLabel,
|
|
531
|
+
};
|
|
532
|
+
applySnapshotToLiveRefs(refs, snapshot);
|
|
533
|
+
return refs;
|
|
534
|
+
}
|
|
535
|
+
function ensureLiveOverlayRefs(snapshot) {
|
|
536
|
+
const state = getRuntimeState();
|
|
537
|
+
const page = resolveActivePage();
|
|
538
|
+
if (!page) {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
if (state.liveRefs) {
|
|
542
|
+
if (state.liveRefs.page === page && state.liveRefs.overlay?.parent) {
|
|
543
|
+
return state.liveRefs;
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
state.liveRefs.overlay.visibility = 'collapse';
|
|
547
|
+
}
|
|
548
|
+
catch { }
|
|
549
|
+
state.liveRefs = null;
|
|
550
|
+
}
|
|
551
|
+
const GridLayout = resolveCoreExport('GridLayout');
|
|
552
|
+
if (!GridLayout || typeof page.content === 'undefined') {
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
let wrapper = page.content;
|
|
556
|
+
if (!wrapper || !wrapper.__ns_hmr_overlay_wrapper__) {
|
|
557
|
+
const currentContent = page.content || null;
|
|
558
|
+
wrapper = new GridLayout();
|
|
559
|
+
wrapper.width = '100%';
|
|
560
|
+
wrapper.height = '100%';
|
|
561
|
+
wrapper.__ns_hmr_overlay_wrapper__ = true;
|
|
562
|
+
try {
|
|
563
|
+
page.content = null;
|
|
564
|
+
}
|
|
565
|
+
catch { }
|
|
566
|
+
if (currentContent) {
|
|
567
|
+
wrapper.addChild(currentContent);
|
|
568
|
+
}
|
|
569
|
+
page.content = wrapper;
|
|
570
|
+
}
|
|
571
|
+
const liveView = buildLiveOverlayView(snapshot);
|
|
572
|
+
if (!liveView) {
|
|
573
|
+
return null;
|
|
574
|
+
}
|
|
575
|
+
wrapper.addChild(liveView.overlay);
|
|
576
|
+
state.liveRefs = {
|
|
577
|
+
page,
|
|
578
|
+
wrapper,
|
|
579
|
+
...liveView,
|
|
580
|
+
};
|
|
581
|
+
return state.liveRefs;
|
|
582
|
+
}
|
|
583
|
+
function applySnapshotToLiveRefs(refs, snapshot) {
|
|
584
|
+
if (!refs) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const visible = snapshot.visible && snapshot.mode === 'connection';
|
|
588
|
+
refs.overlay.visibility = visible ? 'visible' : 'collapse';
|
|
589
|
+
refs.overlay.backgroundColor = asColor(snapshot.tone === 'error' ? '#b4181068' : '#a1771683');
|
|
590
|
+
refs.titleLabel.text = snapshot.title;
|
|
591
|
+
refs.titleLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
|
|
592
|
+
refs.statusLabel.text = formatStatusText(snapshot);
|
|
593
|
+
refs.statusLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
|
|
594
|
+
try {
|
|
595
|
+
const panel = refs.titleLabel.parent;
|
|
596
|
+
if (panel) {
|
|
597
|
+
panel.backgroundColor = asColor('#FFFFFFFF');
|
|
598
|
+
panel.opacity = 1;
|
|
599
|
+
panel.padding = 16;
|
|
600
|
+
try {
|
|
601
|
+
panel.borderRadius = 12;
|
|
602
|
+
}
|
|
603
|
+
catch { }
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
catch { }
|
|
607
|
+
}
|
|
608
|
+
function applyRuntimeSnapshot(snapshot) {
|
|
609
|
+
const state = getRuntimeState();
|
|
610
|
+
state.snapshot = snapshot;
|
|
611
|
+
// Update the boot status label created by root-placeholder.ts
|
|
612
|
+
if (snapshot.mode === 'boot') {
|
|
613
|
+
updateBootStatusLabel(snapshot);
|
|
614
|
+
}
|
|
615
|
+
applySnapshotToBootRefs(state.bootRefs, snapshot);
|
|
616
|
+
if (snapshot.visible && snapshot.mode === 'connection') {
|
|
617
|
+
const liveRefs = ensureLiveOverlayRefs(snapshot);
|
|
618
|
+
applySnapshotToLiveRefs(liveRefs, snapshot);
|
|
619
|
+
}
|
|
620
|
+
else {
|
|
621
|
+
applySnapshotToLiveRefs(state.liveRefs, snapshot);
|
|
622
|
+
}
|
|
623
|
+
return state.snapshot;
|
|
624
|
+
}
|
|
625
|
+
function createOverlayApi() {
|
|
626
|
+
return {
|
|
627
|
+
ensureBootPage(verbose) {
|
|
628
|
+
const state = getRuntimeState();
|
|
629
|
+
state.verbose = state.verbose || !!verbose;
|
|
630
|
+
if (!state.snapshot.visible || state.snapshot.mode !== 'boot') {
|
|
631
|
+
state.snapshot = createBootOverlaySnapshot('placeholder');
|
|
632
|
+
}
|
|
633
|
+
if (!state.bootRefs) {
|
|
634
|
+
state.bootRefs = buildBootOverlayRefs(state.snapshot);
|
|
635
|
+
}
|
|
636
|
+
applySnapshotToBootRefs(state.bootRefs, state.snapshot);
|
|
637
|
+
return state.bootRefs?.page || null;
|
|
638
|
+
},
|
|
639
|
+
setBootStage(stage, info) {
|
|
640
|
+
return applyRuntimeSnapshot(createBootOverlaySnapshot(stage, info));
|
|
641
|
+
},
|
|
642
|
+
setConnectionStage(stage, info) {
|
|
643
|
+
return applyRuntimeSnapshot(createConnectionOverlaySnapshot(stage, info));
|
|
644
|
+
},
|
|
645
|
+
hide() {
|
|
646
|
+
applyRuntimeSnapshot({ ...DEFAULT_SNAPSHOT });
|
|
647
|
+
},
|
|
648
|
+
getSnapshot() {
|
|
649
|
+
return getRuntimeState().snapshot;
|
|
650
|
+
},
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
export function ensureHmrDevOverlayRuntimeInstalled(verbose) {
|
|
654
|
+
const g = getOverlayGlobal();
|
|
655
|
+
const state = getRuntimeState();
|
|
656
|
+
state.verbose = state.verbose || !!verbose;
|
|
657
|
+
if (!g.__NS_HMR_DEV_OVERLAY__) {
|
|
658
|
+
g.__NS_HMR_DEV_OVERLAY__ = createOverlayApi();
|
|
659
|
+
}
|
|
660
|
+
return g.__NS_HMR_DEV_OVERLAY__;
|
|
661
|
+
}
|
|
662
|
+
export function createHmrBootOverlayPage(verbose) {
|
|
663
|
+
return ensureHmrDevOverlayRuntimeInstalled(verbose).ensureBootPage(verbose);
|
|
664
|
+
}
|
|
665
|
+
export function setHmrBootStage(stage, info) {
|
|
666
|
+
return ensureHmrDevOverlayRuntimeInstalled().setBootStage(stage, info);
|
|
667
|
+
}
|
|
668
|
+
export function setHmrConnectionStage(stage, info) {
|
|
669
|
+
return ensureHmrDevOverlayRuntimeInstalled().setConnectionStage(stage, info);
|
|
670
|
+
}
|
|
671
|
+
export function hideHmrDevOverlay(reason) {
|
|
672
|
+
void reason;
|
|
673
|
+
ensureHmrDevOverlayRuntimeInstalled().hide(reason);
|
|
674
|
+
}
|
|
675
|
+
//# sourceMappingURL=dev-overlay.js.map
|