@nativescript/vite 8.0.0-alpha.5 → 8.0.0-alpha.6

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.
Files changed (57) hide show
  1. package/helpers/global-defines.d.ts +55 -0
  2. package/helpers/global-defines.js +81 -0
  3. package/helpers/global-defines.js.map +1 -1
  4. package/helpers/logging.d.ts +1 -0
  5. package/helpers/logging.js +36 -3
  6. package/helpers/logging.js.map +1 -1
  7. package/hmr/client/hmr-pending-overlay.d.ts +27 -0
  8. package/hmr/client/hmr-pending-overlay.js +50 -0
  9. package/hmr/client/hmr-pending-overlay.js.map +1 -0
  10. package/hmr/client/index.js +72 -1
  11. package/hmr/client/index.js.map +1 -1
  12. package/hmr/client/utils.d.ts +5 -0
  13. package/hmr/client/utils.js +153 -15
  14. package/hmr/client/utils.js.map +1 -1
  15. package/hmr/entry-runtime.js +95 -31
  16. package/hmr/entry-runtime.js.map +1 -1
  17. package/hmr/frameworks/angular/client/index.d.ts +1 -0
  18. package/hmr/frameworks/angular/client/index.js +424 -11
  19. package/hmr/frameworks/angular/client/index.js.map +1 -1
  20. package/hmr/server/perf-instrumentation.d.ts +118 -0
  21. package/hmr/server/perf-instrumentation.js +198 -0
  22. package/hmr/server/perf-instrumentation.js.map +1 -0
  23. package/hmr/server/shared-transform-request.js +12 -5
  24. package/hmr/server/shared-transform-request.js.map +1 -1
  25. package/hmr/server/websocket-angular-hot-update.d.ts +16 -0
  26. package/hmr/server/websocket-angular-hot-update.js +163 -1
  27. package/hmr/server/websocket-angular-hot-update.js.map +1 -1
  28. package/hmr/server/websocket-graph-upsert.d.ts +15 -0
  29. package/hmr/server/websocket-graph-upsert.js +20 -0
  30. package/hmr/server/websocket-graph-upsert.js.map +1 -1
  31. package/hmr/server/websocket-hmr-pending.d.ts +43 -0
  32. package/hmr/server/websocket-hmr-pending.js +55 -0
  33. package/hmr/server/websocket-hmr-pending.js.map +1 -0
  34. package/hmr/server/websocket-ns-m-finalize.js +1 -1
  35. package/hmr/server/websocket-ns-m-finalize.js.map +1 -1
  36. package/hmr/server/websocket-ns-m-paths.d.ts +1 -1
  37. package/hmr/server/websocket-ns-m-paths.js +59 -13
  38. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  39. package/hmr/server/websocket-ns-m-request.js +1 -16
  40. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  41. package/hmr/server/websocket-runtime-compat.js.map +1 -1
  42. package/hmr/server/websocket-served-module-helpers.js +42 -18
  43. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  44. package/hmr/server/websocket-vue-sfc.js +3 -6
  45. package/hmr/server/websocket-vue-sfc.js.map +1 -1
  46. package/hmr/server/websocket.d.ts +4 -4
  47. package/hmr/server/websocket.js +614 -177
  48. package/hmr/server/websocket.js.map +1 -1
  49. package/hmr/shared/runtime/boot-timeline.d.ts +17 -0
  50. package/hmr/shared/runtime/boot-timeline.js +54 -0
  51. package/hmr/shared/runtime/boot-timeline.js.map +1 -0
  52. package/hmr/shared/runtime/dev-overlay.d.ts +49 -2
  53. package/hmr/shared/runtime/dev-overlay.js +587 -12
  54. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  55. package/hmr/shared/runtime/session-bootstrap.js +49 -0
  56. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  57. package/package.json +1 -1
@@ -1,3 +1,73 @@
1
+ // alpha.62 follow-up — opt-out flag (default: enabled). Driven by
2
+ // `NS_VITE_PROGRESS_OVERLAY=0` (or `false`/`off`/`no`) on the dev
3
+ // server; baked into the bundle via `__NS_HMR_PROGRESS_OVERLAY_ENABLED__`
4
+ // at build time. We collapse the build-time constant into a runtime
5
+ // boolean once so each call-site is a single property check rather
6
+ // than a try/typeof. Tests that re-run the angular client (via vitest)
7
+ // see `undefined` and default to enabled — matching the production
8
+ // dev-server experience.
9
+ const overlayEnabled = (() => {
10
+ try {
11
+ return typeof __NS_HMR_PROGRESS_OVERLAY_ENABLED__ === 'boolean' ? __NS_HMR_PROGRESS_OVERLAY_ENABLED__ : true;
12
+ }
13
+ catch {
14
+ return true;
15
+ }
16
+ })();
17
+ function getHmrOverlayApi() {
18
+ if (!overlayEnabled)
19
+ return null;
20
+ try {
21
+ return globalThis.__NS_HMR_DEV_OVERLAY__ || null;
22
+ }
23
+ catch { }
24
+ return null;
25
+ }
26
+ function setUpdateOverlayStage(stage, info) {
27
+ if (!overlayEnabled)
28
+ return;
29
+ try {
30
+ const api = getHmrOverlayApi();
31
+ if (api && typeof api.setUpdateStage === 'function') {
32
+ api.setUpdateStage(stage, info);
33
+ }
34
+ }
35
+ catch { }
36
+ }
37
+ function hideUpdateOverlay() {
38
+ if (!overlayEnabled)
39
+ return;
40
+ try {
41
+ const api = getHmrOverlayApi();
42
+ if (api && typeof api.hide === 'function') {
43
+ api.hide('hmr-applied');
44
+ }
45
+ }
46
+ catch { }
47
+ }
48
+ // alpha.59 — Safe accessor for the build-time `__NS_ENV_VERBOSE__`
49
+ // constant.
50
+ //
51
+ // Vite replaces `__NS_ENV_VERBOSE__` at build time via `define`. In
52
+ // unit tests (vitest, plain ts-node, etc.) the identifier is
53
+ // undeclared at runtime, so a bare reference throws ReferenceError —
54
+ // `typeof` is the only safe way to probe it. We collapse the
55
+ // build-time constant into a runtime boolean once at module load and
56
+ // then short-circuit on `verbose` arguments at every call-site.
57
+ //
58
+ // Pre-alpha.59 several call-sites wrote `if (__NS_ENV_VERBOSE__ &&
59
+ // options.verbose)`, which threw on the FIRST call into
60
+ // `refreshAngularBootstrapOptions` from a test. Always order
61
+ // `verbose && envVerbose` so the runtime flag short-circuits the
62
+ // build constant.
63
+ const envVerbose = (() => {
64
+ try {
65
+ return typeof __NS_ENV_VERBOSE__ === 'boolean' ? __NS_ENV_VERBOSE__ : false;
66
+ }
67
+ catch {
68
+ return false;
69
+ }
70
+ })();
1
71
  export function installAngularHmrClientHooks() {
2
72
  const g = globalThis;
3
73
  if (g.__NS_ANGULAR_HMR_CLIENT_INSTALLED__) {
@@ -5,16 +75,184 @@ export function installAngularHmrClientHooks() {
5
75
  }
6
76
  try {
7
77
  g.__NS_ANGULAR_HMR_CLIENT_INSTALLED__ = true;
8
- if (__NS_ENV_VERBOSE__) {
78
+ if (envVerbose) {
9
79
  console.log('[hmr-angular] client hooks installed');
10
80
  }
11
81
  }
12
82
  catch { }
13
83
  }
84
+ // alpha.59 — HMR cycle serialization mutex.
85
+ //
86
+ // Pre-alpha.59 a back-to-back save (e.g., the user holds Cmd+S, or
87
+ // `runOnSave` saves a file twice during one tick) could overlap two
88
+ // HMR cycles: the first cycle's `import(entry)` would still be
89
+ // resolving when the second cycle's `__nsInvalidateModules` ran,
90
+ // leaving the registry in a half-evicted state and producing flaky
91
+ // "module already evaluated" errors.
92
+ //
93
+ // Each `handleAngularHotUpdateMessage` call now publishes a promise
94
+ // to `inFlightHmrCycle` and awaits the previous publication before
95
+ // starting its own evict + import. The previous-cycle promise resolves
96
+ // regardless of success or failure (we always run `resolveCycle()` in
97
+ // `finally`), so a stuck cycle can't deadlock the queue. The mutex is
98
+ // intentionally process-wide and resets naturally on cold-boot or
99
+ // websocket reconnect (both blow away the JS realm).
100
+ let inFlightHmrCycle = null;
101
+ // alpha.59 — Explicit module eviction.
102
+ //
103
+ // `__nsInvalidateModules` is a runtime-installed global that takes an
104
+ // array of canonical /ns/m/<rel> URLs and removes each one from V8's
105
+ // module registry (`g_moduleRegistry`). The runtime canonicalizer
106
+ // (HMRSupport.mm) strips legacy `__ns_hmr__/<tag>/` and
107
+ // `__ns_boot__/b1/` segments before lookup, so the same URL evicts
108
+ // every cache entry historically created for that module — even if a
109
+ // pre-alpha.59 stale tagged URL is still around.
110
+ //
111
+ // Soft-fails on older runtimes (alpha.58 and earlier) that don't
112
+ // expose the function. In that case we fall through to the legacy
113
+ // URL-versioning path and emit a one-time warning so the user knows
114
+ // the eviction protocol is unavailable.
115
+ function invalidateModules(urls, verbose) {
116
+ if (!urls || !urls.length)
117
+ return false;
118
+ const g = globalThis;
119
+ const fn = g.__nsInvalidateModules;
120
+ if (typeof fn !== 'function') {
121
+ if (verbose && envVerbose) {
122
+ try {
123
+ console.warn(`[hmr-angular] runtime missing __nsInvalidateModules; falling back to legacy URL versioning. evict=${urls.length}`);
124
+ }
125
+ catch { }
126
+ }
127
+ return false;
128
+ }
129
+ try {
130
+ fn.call(null, urls);
131
+ return true;
132
+ }
133
+ catch (error) {
134
+ if (verbose && envVerbose) {
135
+ try {
136
+ console.warn('[hmr-angular] __nsInvalidateModules threw', error?.message || error);
137
+ }
138
+ catch { }
139
+ }
140
+ return false;
141
+ }
142
+ }
143
+ // alpha.64 — Eviction-set size cap for the kickstart.
144
+ //
145
+ // `__NS_HMR_KICKSTART_MAX_URLS__` is a build-time literal injected
146
+ // by `helpers/global-defines.ts` (default 32). It is a pure
147
+ // performance gate: the kickstart never affects correctness, so
148
+ // skipping it for large fan-out edits just reverts the runtime to
149
+ // alpha.62-style sequential `HttpFetchText`. See the doc comment on
150
+ // `resolveHmrKickstartMaxUrls` (in global-defines.ts) for the
151
+ // rationale and the empirical numbers behind the default.
152
+ //
153
+ // The constant is read once at module load (the same pattern used
154
+ // for `overlayEnabled`) so each call site is a single inequality
155
+ // check rather than a try/typeof. Tests that re-import this module
156
+ // see `undefined` and fall back to the default.
157
+ const KICKSTART_DEFAULT_MAX_URLS = 32;
158
+ const kickstartMaxUrls = (() => {
159
+ try {
160
+ const raw = __NS_HMR_KICKSTART_MAX_URLS__;
161
+ if (typeof raw !== 'number')
162
+ return KICKSTART_DEFAULT_MAX_URLS;
163
+ if (!Number.isFinite(raw))
164
+ return Number.POSITIVE_INFINITY;
165
+ if (raw < 0)
166
+ return KICKSTART_DEFAULT_MAX_URLS;
167
+ return Math.floor(raw);
168
+ }
169
+ catch {
170
+ return KICKSTART_DEFAULT_MAX_URLS;
171
+ }
172
+ })();
173
+ // Decide whether to run the kickstart for a given eviction set.
174
+ // Exported for unit testing — callers in this module use the inline
175
+ // `evictPaths.length` comparison below for a slightly cheaper
176
+ // hot-path.
177
+ //
178
+ // Semantics:
179
+ // - `0` urls → no work to do; skip (returns false).
180
+ // - `urls.length <= cap` → kickstart eligible (returns true).
181
+ // - `urls.length > cap` → skip kickstart (returns false). V8 falls
182
+ // back to per-module synchronous fetches inside its module walk.
183
+ // - `cap === 0` → kickstart disabled regardless of size.
184
+ // - `cap === Infinity` → kickstart always eligible (alpha.63
185
+ // behavior).
186
+ export function shouldRunKickstart(urlCount, maxUrls = kickstartMaxUrls) {
187
+ if (!Number.isFinite(urlCount) || urlCount <= 0)
188
+ return false;
189
+ if (!Number.isFinite(maxUrls))
190
+ return maxUrls > 0;
191
+ if (maxUrls <= 0)
192
+ return false;
193
+ return urlCount <= maxUrls;
194
+ }
195
+ function kickstartHmrPrefetch(urls, verbose) {
196
+ if (!urls || !urls.length)
197
+ return null;
198
+ const g = globalThis;
199
+ const fn = g.__nsKickstartHmrPrefetch;
200
+ if (typeof fn !== 'function') {
201
+ if (verbose && envVerbose) {
202
+ try {
203
+ console.info(`[hmr-angular] runtime missing __nsKickstartHmrPrefetch; serial fetches will be used. urls=${urls.length}`);
204
+ }
205
+ catch { }
206
+ }
207
+ return null;
208
+ }
209
+ try {
210
+ // Concurrency cap of 16 matches the runtime's documented
211
+ // default for the kickstart BFS. Timeout at 10s tracks the
212
+ // runtime's `HttpFetchText` retry envelope so we don't
213
+ // hold the JS thread forever on a stalled dev server.
214
+ const result = fn.call(null, urls.slice(), { maxConcurrent: 16, timeoutMs: 10000 });
215
+ if (result && typeof result === 'object') {
216
+ const ok = !!result.ok;
217
+ const fetched = typeof result.fetched === 'number' ? result.fetched : 0;
218
+ const ms = typeof result.ms === 'number' ? result.ms : 0;
219
+ return { ok, fetched, ms };
220
+ }
221
+ return null;
222
+ }
223
+ catch (error) {
224
+ if (verbose && envVerbose) {
225
+ try {
226
+ console.warn('[hmr-angular] __nsKickstartHmrPrefetch threw', error?.message || error);
227
+ }
228
+ catch { }
229
+ }
230
+ return null;
231
+ }
232
+ }
14
233
  function getAngularBootstrapEntryCandidates(msg) {
15
234
  const root = typeof __NS_APP_ROOT_VIRTUAL__ === 'string' && __NS_APP_ROOT_VIRTUAL__ ? __NS_APP_ROOT_VIRTUAL__ : '/src';
16
- const rawCandidates = Array.isArray(msg?.entryCandidates) && msg.entryCandidates.length ? msg.entryCandidates : [`${root}/main.ts`, `${root}/app.ts`];
17
- return rawCandidates.filter((entry) => typeof entry === 'string' && entry.startsWith('/'));
235
+ // alpha.59 Server announces the canonical bootstrap entry as
236
+ // `importerEntry`, computed from `package.json#main`. Fall back to
237
+ // the legacy `entryCandidates` array (for older servers) and finally
238
+ // to a hard-coded list. All candidates must be project-relative
239
+ // posix paths (e.g. `/src/main.ts`) so they slot directly behind
240
+ // `${origin}/ns/m`.
241
+ const explicit = typeof msg?.importerEntry === 'string' && msg.importerEntry.startsWith('/') ? [msg.importerEntry] : [];
242
+ const legacy = Array.isArray(msg?.entryCandidates) && msg.entryCandidates.length ? msg.entryCandidates : [];
243
+ const fallback = [`${root}/main.ts`, `${root}/app.ts`];
244
+ const merged = [...explicit, ...legacy, ...fallback];
245
+ const seen = new Set();
246
+ const result = [];
247
+ for (const candidate of merged) {
248
+ if (typeof candidate !== 'string' || !candidate.startsWith('/'))
249
+ continue;
250
+ if (seen.has(candidate))
251
+ continue;
252
+ seen.add(candidate);
253
+ result.push(candidate);
254
+ }
255
+ return result;
18
256
  }
19
257
  async function importAngularBootstrapEntry(url) {
20
258
  const g = globalThis;
@@ -28,18 +266,109 @@ export async function refreshAngularBootstrapOptions(msg, options) {
28
266
  if (typeof g.__NS_UPDATE_ANGULAR_APP_OPTIONS__ !== 'function') {
29
267
  return;
30
268
  }
31
- const version = typeof msg?.version === 'number' ? msg.version : 0;
32
- if (!version) {
33
- return;
34
- }
35
269
  const originSource = typeof msg?.origin === 'string' && /^https?:\/\//.test(msg.origin) ? msg.origin : g.__NS_HTTP_ORIGIN__;
36
270
  if (typeof originSource !== 'string' || !/^https?:\/\//.test(originSource)) {
37
271
  return;
38
272
  }
39
273
  const origin = originSource.replace(/\/$/, '');
274
+ // alpha.59 — Explicit eviction set takes precedence over URL
275
+ // versioning. The server walks the inverse-dep closure of the
276
+ // changed file (collectAngularEvictionUrls) and emits canonical
277
+ // /ns/m/<rel> URLs in `evictPaths`. We hand the list to the runtime
278
+ // before re-importing the entry; the runtime drops those entries
279
+ // from `g_moduleRegistry` so V8's subsequent `import(entry)` walks
280
+ // the dep graph and re-fetches ONLY those modules. Everything else
281
+ // stays hot in the cache (the dominant cost of a pre-alpha.59 HMR
282
+ // cycle was V8 re-fetching the ENTIRE graph because the URL changed
283
+ // for every node — see HMR_STABLE_URL_INVALIDATION_PLAN.md).
284
+ const evictPaths = Array.isArray(msg?.evictPaths) ? msg.evictPaths.filter((u) => typeof u === 'string' && /^https?:\/\//.test(u)) : [];
285
+ // Round-eleven.3 — Drive the apply-progress overlay through the
286
+ // 'evicting' frame *before* the runtime invalidate call so the
287
+ // user sees the count even on the cheapest stage. Eviction count
288
+ // also doubles as a useful debug breadcrumb in the overlay's
289
+ // detail line — large counts (e.g. constants edits → 100+
290
+ // importers) explain why a cycle takes longer than an HTML edit.
291
+ setUpdateOverlayStage('evicting', {
292
+ detail: evictPaths.length ? `Invalidating ${evictPaths.length} module${evictPaths.length === 1 ? '' : 's'}` : 'Invalidating module cache',
293
+ });
294
+ const evicted = invalidateModules(evictPaths, options.verbose);
295
+ if (options.verbose && envVerbose) {
296
+ try {
297
+ console.info(`[ns-hmr][angular] evict count=${evictPaths.length} ok=${evicted ? 'yes' : 'no'}`);
298
+ }
299
+ catch { }
300
+ }
301
+ // alpha.63 — Parallel HTTP prefetch for the freshly-evicted modules.
302
+ //
303
+ // Order matters here: the kickstart MUST run after the eviction so
304
+ // that it actually re-populates `g_prefetchCache` for the modules
305
+ // V8 will ask for. If we kickstarted before the eviction, every URL
306
+ // would skip on the "already cached" check (the walk consumes
307
+ // destructively but the prior non-evicted modules sit in V8's
308
+ // `g_moduleRegistry`, not the prefetch cache).
309
+ //
310
+ // We only kickstart when the eviction succeeded, because the
311
+ // fallback path (legacy URL-versioning, see `useStableUrls = evicted`
312
+ // below) doesn't go through canonical /ns/m URLs and the runtime
313
+ // would not match its prefetch cache lookups against the version-
314
+ // prefixed forms V8 will end up requesting. Better to skip the
315
+ // optimization than risk a confusing partial cache hit.
316
+ //
317
+ // alpha.64 — `shouldRunKickstart` gates large eviction sets out
318
+ // of the parallel wave. A `.ts` file with deep inverse-dep
319
+ // fan-in (constants files, design-system enums) can produce a
320
+ // 200–300-URL closure that overwhelms Vite's single-threaded
321
+ // transform pipeline. The kickstart fan-out then makes the cycle
322
+ // 5–8× slower than letting V8 fetch sequentially as it walks the
323
+ // real forward path. The cap (default 32, override with
324
+ // `NS_VITE_KICKSTART_MAX_URLS`) keeps component-shaped closures
325
+ // (typically 5–30 URLs) on the fast path. Correctness is
326
+ // unaffected — V8's per-module synchronous fetch is the same code
327
+ // path the runtime used through alpha.62.
328
+ if (evicted && evictPaths.length > 0) {
329
+ if (shouldRunKickstart(evictPaths.length)) {
330
+ const result = kickstartHmrPrefetch(evictPaths, options.verbose);
331
+ if (options.verbose && envVerbose && result) {
332
+ try {
333
+ console.info(`[ns-hmr][angular] kickstart urls=${evictPaths.length} fetched=${result.fetched} ok=${result.ok ? 'yes' : 'no'} ms=${result.ms}`);
334
+ }
335
+ catch { }
336
+ }
337
+ }
338
+ else if (options.verbose && envVerbose) {
339
+ try {
340
+ console.info(`[ns-hmr][angular] kickstart skipped urls=${evictPaths.length} cap=${Number.isFinite(kickstartMaxUrls) ? kickstartMaxUrls : 'Infinity'} (eviction set too large; falling back to sequential fetch)`);
341
+ }
342
+ catch { }
343
+ }
344
+ }
345
+ // URL strategy:
346
+ //
347
+ // * `evicted=true` → alpha.59 runtime accepted the eviction; we
348
+ // re-import the entry under its STABLE canonical URL. V8's
349
+ // registry no longer holds the evicted modules so the import
350
+ // triggers fresh fetches for them; the rest of the graph is a
351
+ // cache hit.
352
+ // * `evicted=false` → either we have no eviction set (older server)
353
+ // or the runtime lacks `__nsInvalidateModules` (older runtime).
354
+ // Fall back to the legacy `__ns_hmr__/v<version>/` URL pattern
355
+ // so V8 sees a fresh URL and re-fetches the entry. The runtime
356
+ // canonicalizer (alpha.59) collapses the path back to the stable
357
+ // key, which keeps cache identity consistent across saves.
358
+ const versionRaw = typeof msg?.version === 'number' ? msg.version : 0;
359
+ const useStableUrls = evicted;
40
360
  let lastError;
361
+ // Round-eleven.3 — 'reimporting' is the entry point for the long
362
+ // tail of an HMR cycle: V8 walks the freshly-evicted graph and
363
+ // the iOS runtime re-fetches each node from the dev server. We
364
+ // announce the stage once, before the loop, so the user sees a
365
+ // progress jump even when the import resolves on the first
366
+ // candidate (the common case).
367
+ setUpdateOverlayStage('reimporting', {
368
+ detail: 'Re-importing Angular bootstrap entry',
369
+ });
41
370
  for (const entry of getAngularBootstrapEntryCandidates(msg)) {
42
- const url = `${origin}/ns/m/__ns_hmr__/v${version}${entry}`;
371
+ const url = useStableUrls ? `${origin}/ns/m${entry}` : versionRaw ? `${origin}/ns/m/__ns_hmr__/v${versionRaw}${entry}` : `${origin}/ns/m${entry}`;
43
372
  try {
44
373
  g.__NS_ANGULAR_HMR_REGISTER_ONLY__ = true;
45
374
  await importAngularBootstrapEntry(url);
@@ -52,7 +381,7 @@ export async function refreshAngularBootstrapOptions(msg, options) {
52
381
  g.__NS_ANGULAR_HMR_REGISTER_ONLY__ = false;
53
382
  }
54
383
  }
55
- if (options.verbose && __NS_ENV_VERBOSE__ && lastError) {
384
+ if (options.verbose && envVerbose && lastError) {
56
385
  try {
57
386
  console.warn('[hmr-angular] failed to refresh Angular bootstrap entry', lastError?.message || lastError);
58
387
  }
@@ -63,6 +392,51 @@ export async function handleAngularHotUpdateMessage(msg, options) {
63
392
  if (!msg || msg.type !== 'ns:angular-update') {
64
393
  return false;
65
394
  }
395
+ // alpha.59 — Cycle mutex. See `inFlightHmrCycle` for why this is
396
+ // necessary. We publish `thisCycle` *before* awaiting the previous
397
+ // one so a third concurrent message sees the latest in-flight,
398
+ // not the stale previous. This serializes N concurrent updates into
399
+ // a single FIFO chain.
400
+ const previousCycle = inFlightHmrCycle;
401
+ let resolveCycle;
402
+ const thisCycle = new Promise((resolve) => {
403
+ resolveCycle = resolve;
404
+ });
405
+ inFlightHmrCycle = thisCycle;
406
+ if (previousCycle) {
407
+ try {
408
+ await previousCycle;
409
+ }
410
+ catch { }
411
+ }
412
+ // Single-line log lands in iOS device console as `CONSOLE INFO` so the user can
413
+ // correlate with the server's `[hmr-ws][update] ...` line and see
414
+ // where the save's wall time actually goes (refresh vs. reboot).
415
+ const t0 = Date.now();
416
+ let tAfterRefresh = t0;
417
+ let tEnd = t0;
418
+ const filePath = typeof msg?.path === 'string' ? msg.path : '<unknown>';
419
+ const emitTiming = (ok, errorMessage) => {
420
+ try {
421
+ const refreshMs = Math.max(0, tAfterRefresh - t0);
422
+ const rebootMs = Math.max(0, tEnd - tAfterRefresh);
423
+ const totalMs = Math.max(0, tEnd - t0);
424
+ const status = ok ? 'ok' : 'FAILED';
425
+ const suffix = errorMessage ? ` error=${errorMessage}` : '';
426
+ console.info(`[ns-hmr][angular] ${status} file=${filePath} refresh=${refreshMs}ms reboot=${rebootMs}ms total=${totalMs}ms${suffix}`);
427
+ }
428
+ catch { }
429
+ };
430
+ // Show the apply-progress overlay as soon as the
431
+ // mutex unblocks us. Posting this *after* the awaited
432
+ // previousCycle keeps each cycle's stages visually grouped in the
433
+ // overlay (cycle-1 finishes its 'complete' before cycle-2's
434
+ // 'received' overrides it).
435
+ //
436
+ // The detail line surfaces the changed file path so the user can
437
+ // confirm at a glance which save the overlay is reflecting.
438
+ const overlayDetail = filePath && filePath !== '<unknown>' ? `Updating ${filePath}` : 'Preparing update';
439
+ setUpdateOverlayStage('received', { detail: overlayDetail });
66
440
  try {
67
441
  const g = globalThis;
68
442
  // Prefer __reboot_ng_modules__ — it properly disposes existing modules,
@@ -72,10 +446,11 @@ export async function handleAngularHotUpdateMessage(msg, options) {
72
446
  // canonical reboot entry point.
73
447
  const reboot = g.__reboot_ng_modules__;
74
448
  if (typeof reboot === 'function') {
75
- if (options.verbose && __NS_ENV_VERBOSE__) {
449
+ if (options.verbose && envVerbose) {
76
450
  console.log('[hmr-angular] rebooting Angular modules via __reboot_ng_modules__');
77
451
  }
78
452
  await refreshAngularBootstrapOptions(msg, options);
453
+ tAfterRefresh = Date.now();
79
454
  try {
80
455
  g.__NS_HMR_IMPORT_NONCE__ = (typeof g.__NS_HMR_IMPORT_NONCE__ === 'number' ? g.__NS_HMR_IMPORT_NONCE__ : 0) + 1;
81
456
  }
@@ -84,6 +459,14 @@ export async function handleAngularHotUpdateMessage(msg, options) {
84
459
  g.__NS_DEV_RESET_IN_PROGRESS__ = true;
85
460
  }
86
461
  catch { }
462
+ // Round-eleven.3 — 'rebooting' marks the long tail of the
463
+ // cycle: NgZone teardown, module re-instantiation, and
464
+ // resetRootView. The detail line shows refresh-so-far ms
465
+ // so a user can already see if the slow phase is
466
+ // re-import or reboot.
467
+ setUpdateOverlayStage('rebooting', {
468
+ detail: `Re-bootstrapping Angular (refresh ${Math.max(0, tAfterRefresh - t0)}ms)`,
469
+ });
87
470
  try {
88
471
  reboot(true);
89
472
  }
@@ -93,11 +476,25 @@ export async function handleAngularHotUpdateMessage(msg, options) {
93
476
  }
94
477
  catch { }
95
478
  }
479
+ tEnd = Date.now();
480
+ emitTiming(true);
481
+ // Round-eleven.3 — 'complete' surfaces the wall-clock
482
+ // total so a user gets a single-glance confirmation
483
+ // matching the [ns-hmr][angular] log line in the
484
+ // terminal. The overlay auto-hides shortly after.
485
+ setUpdateOverlayStage('complete', {
486
+ detail: `Total ${Math.max(0, tEnd - t0)}ms`,
487
+ });
96
488
  return true;
97
489
  }
98
- if (options.verbose && __NS_ENV_VERBOSE__) {
490
+ if (options.verbose && envVerbose) {
99
491
  console.warn('[hmr-angular] No Angular HMR handler found. Ensure runNativeScriptAngularApp() has been called.');
100
492
  }
493
+ tEnd = Date.now();
494
+ emitTiming(false, 'no-reboot-handler');
495
+ // No reboot handler → we can't apply the update; hide the
496
+ // overlay rather than leaving stale progress on screen.
497
+ hideUpdateOverlay();
101
498
  }
102
499
  catch (error) {
103
500
  if (options.verbose) {
@@ -106,6 +503,22 @@ export async function handleAngularHotUpdateMessage(msg, options) {
106
503
  }
107
504
  catch { }
108
505
  }
506
+ tEnd = Date.now();
507
+ emitTiming(false, (error && error.message) || String(error));
508
+ // Errors → drop the overlay so the user isn't left looking
509
+ // at indefinite progress; the underlying error is already
510
+ // logged above (and surfaced via Vite's standard error
511
+ // pipeline through the websocket).
512
+ hideUpdateOverlay();
513
+ }
514
+ finally {
515
+ try {
516
+ resolveCycle();
517
+ }
518
+ catch { }
519
+ if (inFlightHmrCycle === thisCycle) {
520
+ inFlightHmrCycle = null;
521
+ }
109
522
  }
110
523
  return true;
111
524
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/vite/hmr/frameworks/angular/client/index.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,4BAA4B;IAC3C,MAAM,CAAC,GAAQ,UAAU,CAAC;IAC1B,IAAI,CAAC,CAAC,mCAAmC,EAAE,CAAC;QAC3C,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,CAAC,CAAC,mCAAmC,GAAG,IAAI,CAAC;QAC7C,IAAI,kBAAkB,EAAE,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACrD,CAAC;IACF,CAAC;IAAC,MAAM,CAAC,CAAA,CAAC;AACX,CAAC;AAOD,SAAS,kCAAkC,CAAC,GAAQ;IACnD,MAAM,IAAI,GAAG,OAAO,uBAAuB,KAAK,QAAQ,IAAI,uBAAuB,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,MAAM,CAAC;IACvH,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,IAAI,GAAG,CAA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AO,IAAI,kBAAkB,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,mEAAmE,CAAC,CAAC;YAClF,CAAC;YACD,MAAM,8BAA8B,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YACnD,IAAI,CAAC;gBACJ,CAAC,CAAC,uBAAuB,GAAG,CAAC,OAAO,CAAC,CAAC,uBAAuB,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACjH,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,IAAI,CAAC;gBACJ,CAAC,CAAC,4BAA4B,GAAG,IAAI,CAAC;YACvC,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;YACV,IAAI,CAAC;gBACJ,MAAM,CAAC,IAAI,CAAC,CAAC;YACd,CAAC;oBAAS,CAAC;gBACV,IAAI,CAAC;oBACJ,CAAC,CAAC,4BAA4B,GAAG,KAAK,CAAC;gBACxC,CAAC;gBAAC,MAAM,CAAC,CAAA,CAAC;YACX,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,IAAI,kBAAkB,EAAE,CAAC;YAC3C,OAAO,CAAC,IAAI,CAAC,iGAAiG,CAAC,CAAC;QACjH,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,CAAC,KAAK,IAAK,KAAa,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC;YACnG,CAAC;YAAC,MAAM,CAAC,CAAA,CAAC;QACX,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/vite/hmr/frameworks/angular/client/index.ts"],"names":[],"mappings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AAK,CAAC,CAAC,CAAC;QACtE,2DAA2D;QAC3D,0DAA0D;QAC1D,uDAAuD;QACvD,mCAAmC;QACnC,iBAAiB,EAAE,CAAC;IACrB,CAAC;YAAS,CAAC;QACV,IAAI,CAAC;YACJ,YAAY,EAAE,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;YACpC,gBAAgB,GAAG,IAAI,CAAC;QACzB,CAAC;IACF,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,118 @@
1
+ export type ServerStartupBannerInput = {
2
+ version: string;
3
+ transformConcurrency: number;
4
+ transformCacheMs: number;
5
+ lazyInitialGraph: boolean;
6
+ graphVersion: number;
7
+ };
8
+ export declare function formatServerStartupBanner(input: ServerStartupBannerInput): string;
9
+ /**
10
+ * Classify a URL path into a coarse route category. Any pathname that
11
+ * doesn't match a known NativeScript dev route is reported as `other`;
12
+ * callers are expected to filter their own irrelevant routes before
13
+ * calling `record()`.
14
+ */
15
+ export declare function classifyBootRoute(pathname: string): BootRouteCategory;
16
+ export type BootRouteCategory = 'ns/m' | 'ns/rt' | 'ns/core' | 'ns/vendor' | 'ns/import-map' | 'ns/boot' | 'ns/hmr' | 'ns/other' | 'other';
17
+ export type ColdBootRequestCounter = {
18
+ record: (url: string) => RecordHandle;
19
+ finalize: () => void;
20
+ getState: () => ColdBootCounterState;
21
+ };
22
+ export type RecordHandle = {
23
+ finish: () => void;
24
+ };
25
+ export type ColdBootCounterState = {
26
+ active: boolean;
27
+ count: number;
28
+ inFlight: number;
29
+ maxConcurrent: number;
30
+ startedAt: number | null;
31
+ firstRequestUrl: string | null;
32
+ perRoute: Partial<Record<BootRouteCategory, number>>;
33
+ };
34
+ export type ColdBootCounterOptions = {
35
+ /**
36
+ * Emit a rolling summary every N requests (default 100). Lower the
37
+ * threshold in tests to keep them snappy. Set to 0 to disable rolling
38
+ * summaries; a final summary still fires from `finalize()`.
39
+ */
40
+ summaryEvery?: number;
41
+ /**
42
+ * Cold-boot window closes when no new requests arrive within this
43
+ * idle window (default 5000ms). The HMR edit loop reuses the same
44
+ * handler, but it never bursts as heavily as cold boot. Raise this
45
+ * via `NS_VITE_HMR_BOOT_TRACE_IDLE_MS` when profiling a slow boot
46
+ * so inter-wave pauses don't close the counter prematurely.
47
+ */
48
+ idleWindowMs?: number;
49
+ /** Defaults to `Date.now`; tests inject a deterministic clock. */
50
+ now?: () => number;
51
+ /** Defaults to `setTimeout`; tests can inject a fake timer. */
52
+ setTimer?: (handler: () => void, ms: number) => unknown;
53
+ /** Defaults to `clearTimeout`; tests can inject a fake timer. */
54
+ clearTimer?: (handle: unknown) => void;
55
+ /** Logger called for every summary line (rolling + final). */
56
+ log: (line: string) => void;
57
+ };
58
+ export declare function createColdBootRequestCounter(options: ColdBootCounterOptions): ColdBootRequestCounter;
59
+ export type PopulateInitialGraphSummary = {
60
+ moduleCount: number;
61
+ durationMs: number;
62
+ graphVersion: number;
63
+ bumpedVersion: boolean;
64
+ };
65
+ export declare function formatPopulateInitialGraphSummary(input: PopulateInitialGraphSummary): string;
66
+ export type HmrUpdateKind = 'ts' | 'html' | 'css' | 'vue' | 'tsx' | 'jsx' | 'js' | 'mjs' | 'unknown';
67
+ /**
68
+ * Classify a file's HMR update kind by extension. Used by the server-side
69
+ * update summary so a quick log line tells us which pipeline ran. Returns
70
+ * `'unknown'` for anything that doesn't match a known dev-time extension —
71
+ * the caller decides whether to log it or skip it entirely.
72
+ */
73
+ export declare function classifyHmrUpdateKind(file: string): HmrUpdateKind;
74
+ export type HmrUpdateSummary = {
75
+ /** Project-relative or absolute path of the file that triggered HMR. */
76
+ file: string;
77
+ /** File classification. */
78
+ kind: HmrUpdateKind;
79
+ /** Time spent waiting for `populateInitialGraph` to complete (ms). */
80
+ awaitMs: number;
81
+ /** Time spent in framework-specific work (graph updates, invalidation). */
82
+ frameworkMs: number;
83
+ /** Time spent broadcasting the WebSocket message. */
84
+ broadcastMs: number;
85
+ /** End-to-end handler time. */
86
+ totalMs: number;
87
+ /** Number of modules invalidated by the update. */
88
+ invalidated: number;
89
+ /** Number of HMR clients the message was sent to. */
90
+ recipients: number;
91
+ /**
92
+ * Round-Seven decision (Angular only): whether transitive-importer
93
+ * invalidation was narrowed because the changed file lacks Angular
94
+ * semantic decorators (`@Component`/`@Directive`/`@Pipe`/`@Injectable`/
95
+ * `@NgModule`). `true` means narrow (importers preserved, ESM live
96
+ * bindings carry the change). `false` means broad (importers also
97
+ * invalidated, pre-Round-Seven behavior). `null`/`undefined` means
98
+ * the field is not applicable to this update (e.g. CSS, non-Angular
99
+ * flavor) and the field is omitted from the summary line entirely.
100
+ *
101
+ * See HMR_CORE_REALM_DETERMINISTIC_PLAN.md ("Round-eight — surface
102
+ * narrowing decision in update summary") for why this is rendered
103
+ * inline alongside `invalidated`.
104
+ */
105
+ narrowed?: boolean | null;
106
+ };
107
+ /**
108
+ * Single-line summary for the server side of an HMR update. Always-on so
109
+ * a 6-second `.ts` save is immediately visible without flipping verbose.
110
+ * Format:
111
+ * [hmr-ws][update] kind=ts file=/src/foo.ts await=12ms framework=180ms broadcast=2ms total=194ms invalidated=23 recipients=1
112
+ *
113
+ * For Angular `.ts` updates, `narrowed=yes|no` is appended so the
114
+ * Round-Seven decision is immediately visible without flipping verbose:
115
+ * [hmr-ws][update] kind=ts file=/src/app/foo.constants.ts ... invalidated=1 recipients=1 narrowed=yes
116
+ * [hmr-ws][update] kind=ts file=/src/app/foo.component.ts ... invalidated=132 recipients=1 narrowed=no
117
+ */
118
+ export declare function formatHmrUpdateSummary(input: HmrUpdateSummary): string;