@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,56 @@
1
+ /**
2
+ * alpha.62 follow-up — opt-out flag for the HMR-applying progress
3
+ * overlay introduced in Round-eleven.3.
4
+ *
5
+ * Default: enabled. Set `NS_VITE_PROGRESS_OVERLAY=0` (or `false`) in
6
+ * the environment to suppress the overlay if a developer finds it
7
+ * distracting. We accept the same falsy spellings webpack-era tooling
8
+ * used (`0`, `false`, `off`, `no`) and treat anything else as
9
+ * enabled-by-default; this avoids surprising users who pass quoted
10
+ * truthy strings ("1", "true").
11
+ */
12
+ export declare function isHmrProgressOverlayEnabled(env?: NodeJS.ProcessEnv): boolean;
13
+ /**
14
+ * alpha.64 — Kickstart-eligibility threshold for the parallel HMR
15
+ * prefetch (alpha.63's `__nsKickstartHmrPrefetch`).
16
+ *
17
+ * Why a threshold exists. The kickstart fetches the SERVER-computed
18
+ * inverse-dep closure (`evictPaths`) in parallel before V8 starts
19
+ * its module walk, which is a clean win when the closure size is
20
+ * close to what V8 will actually re-evaluate on the next import. For
21
+ * a typical Angular component edit (`*.component.ts` / `.html`) the
22
+ * closure contains ~5–30 modules and almost all of them sit on the
23
+ * live forward path from the entry, so fan-out beats sequential
24
+ * `HttpFetchText` calls by 3–5×.
25
+ *
26
+ * The picture inverts for `.ts` files with deep inverse-dep fan-in
27
+ * (constants files, design-system enums, shared utilities). The
28
+ * server faithfully reports the entire inverse closure (often
29
+ * 100–300 importers), but V8's forward walk on re-import only
30
+ * re-evaluates the ~20–30 modules that sit on the currently-rendered
31
+ * route's path. The kickstart's parallel wave then over-fetches the
32
+ * other ~70–270 importers — and Vite's single-threaded transform
33
+ * pipeline cannot keep up with 16-way concurrent demand, so each
34
+ * fetch's tail latency balloons (avg `[http-loader][fetch-sync]`
35
+ * went from 17 ms to 74 ms in the user's repro). Net result: a
36
+ * "should-be-200ms" HMR cycle becomes 6+ seconds.
37
+ *
38
+ * The threshold short-circuits the kickstart when `evictPaths.length`
39
+ * exceeds the configured cap. The HMR cycle still completes
40
+ * correctly — V8 falls back to per-module synchronous fetches, which
41
+ * is what the runtime did before alpha.63 — and the cycle reverts
42
+ * to roughly the alpha.62 floor (~400–800 ms for a wide-fan-in
43
+ * constants edit).
44
+ *
45
+ * Default: 32. Empirically chosen so component-shaped closures
46
+ * (typically 5–30) keep the kickstart speed-up while wide-fan-in
47
+ * leaf edits (typically 100+) skip it. Override with
48
+ * `NS_VITE_KICKSTART_MAX_URLS=N` (any non-negative integer) — `0`
49
+ * disables the kickstart entirely; `Infinity` disables the
50
+ * threshold and restores alpha.63 behavior unconditionally.
51
+ */
52
+ export declare const HMR_KICKSTART_DEFAULT_MAX_URLS = 32;
53
+ export declare function resolveHmrKickstartMaxUrls(env?: NodeJS.ProcessEnv): number;
1
54
  export declare function getGlobalDefines(opts: {
2
55
  platform: string;
3
56
  targetMode: string;
@@ -14,6 +67,8 @@ export declare function getGlobalDefines(opts: {
14
67
  __NS_WEBPACK__: boolean;
15
68
  __NS_ENV_VERBOSE__: string;
16
69
  __NS_TARGET_FLAVOR__: string;
70
+ __NS_HMR_PROGRESS_OVERLAY_ENABLED__: string;
71
+ __NS_HMR_KICKSTART_MAX_URLS__: string;
17
72
  __CSS_PARSER__: string;
18
73
  __UI_USE_XML_PARSER__: boolean;
19
74
  __UI_USE_EXTERNAL_RENDERER__: boolean;
@@ -1,6 +1,77 @@
1
1
  import { getProjectAppPath, getProjectAppVirtualPath } from './utils.js';
2
2
  const APP_ROOT_DIR = getProjectAppPath();
3
3
  const APP_ROOT_VIRTUAL = getProjectAppVirtualPath();
4
+ /**
5
+ * alpha.62 follow-up — opt-out flag for the HMR-applying progress
6
+ * overlay introduced in Round-eleven.3.
7
+ *
8
+ * Default: enabled. Set `NS_VITE_PROGRESS_OVERLAY=0` (or `false`) in
9
+ * the environment to suppress the overlay if a developer finds it
10
+ * distracting. We accept the same falsy spellings webpack-era tooling
11
+ * used (`0`, `false`, `off`, `no`) and treat anything else as
12
+ * enabled-by-default; this avoids surprising users who pass quoted
13
+ * truthy strings ("1", "true").
14
+ */
15
+ export function isHmrProgressOverlayEnabled(env = process.env) {
16
+ const raw = (env.NS_VITE_PROGRESS_OVERLAY ?? '').toString().trim().toLowerCase();
17
+ if (!raw)
18
+ return true;
19
+ return !['0', 'false', 'off', 'no'].includes(raw);
20
+ }
21
+ /**
22
+ * alpha.64 — Kickstart-eligibility threshold for the parallel HMR
23
+ * prefetch (alpha.63's `__nsKickstartHmrPrefetch`).
24
+ *
25
+ * Why a threshold exists. The kickstart fetches the SERVER-computed
26
+ * inverse-dep closure (`evictPaths`) in parallel before V8 starts
27
+ * its module walk, which is a clean win when the closure size is
28
+ * close to what V8 will actually re-evaluate on the next import. For
29
+ * a typical Angular component edit (`*.component.ts` / `.html`) the
30
+ * closure contains ~5–30 modules and almost all of them sit on the
31
+ * live forward path from the entry, so fan-out beats sequential
32
+ * `HttpFetchText` calls by 3–5×.
33
+ *
34
+ * The picture inverts for `.ts` files with deep inverse-dep fan-in
35
+ * (constants files, design-system enums, shared utilities). The
36
+ * server faithfully reports the entire inverse closure (often
37
+ * 100–300 importers), but V8's forward walk on re-import only
38
+ * re-evaluates the ~20–30 modules that sit on the currently-rendered
39
+ * route's path. The kickstart's parallel wave then over-fetches the
40
+ * other ~70–270 importers — and Vite's single-threaded transform
41
+ * pipeline cannot keep up with 16-way concurrent demand, so each
42
+ * fetch's tail latency balloons (avg `[http-loader][fetch-sync]`
43
+ * went from 17 ms to 74 ms in the user's repro). Net result: a
44
+ * "should-be-200ms" HMR cycle becomes 6+ seconds.
45
+ *
46
+ * The threshold short-circuits the kickstart when `evictPaths.length`
47
+ * exceeds the configured cap. The HMR cycle still completes
48
+ * correctly — V8 falls back to per-module synchronous fetches, which
49
+ * is what the runtime did before alpha.63 — and the cycle reverts
50
+ * to roughly the alpha.62 floor (~400–800 ms for a wide-fan-in
51
+ * constants edit).
52
+ *
53
+ * Default: 32. Empirically chosen so component-shaped closures
54
+ * (typically 5–30) keep the kickstart speed-up while wide-fan-in
55
+ * leaf edits (typically 100+) skip it. Override with
56
+ * `NS_VITE_KICKSTART_MAX_URLS=N` (any non-negative integer) — `0`
57
+ * disables the kickstart entirely; `Infinity` disables the
58
+ * threshold and restores alpha.63 behavior unconditionally.
59
+ */
60
+ export const HMR_KICKSTART_DEFAULT_MAX_URLS = 32;
61
+ export function resolveHmrKickstartMaxUrls(env = process.env) {
62
+ const raw = (env.NS_VITE_KICKSTART_MAX_URLS ?? '').toString().trim();
63
+ if (!raw)
64
+ return HMR_KICKSTART_DEFAULT_MAX_URLS;
65
+ const lower = raw.toLowerCase();
66
+ if (lower === 'infinity' || lower === 'unlimited' || lower === 'none') {
67
+ return Number.POSITIVE_INFINITY;
68
+ }
69
+ const parsed = Number(raw);
70
+ if (!Number.isFinite(parsed) || parsed < 0) {
71
+ return HMR_KICKSTART_DEFAULT_MAX_URLS;
72
+ }
73
+ return Math.floor(parsed);
74
+ }
4
75
  export function getGlobalDefines(opts) {
5
76
  return {
6
77
  // Define platform flags for runtime checks
@@ -13,6 +84,16 @@ export function getGlobalDefines(opts) {
13
84
  __NS_WEBPACK__: false,
14
85
  __NS_ENV_VERBOSE__: JSON.stringify(opts.verbose),
15
86
  __NS_TARGET_FLAVOR__: JSON.stringify(opts.flavor),
87
+ // whether to show the HMR in-progress overlay.
88
+ __NS_HMR_PROGRESS_OVERLAY_ENABLED__: JSON.stringify(isHmrProgressOverlayEnabled()),
89
+ // alpha.64 — eviction-set size cap for the parallel HMR
90
+ // kickstart. JSON.stringify(Number.POSITIVE_INFINITY) is the
91
+ // string "null", so we serialize Infinity ourselves to keep the
92
+ // build-time literal readable in source maps.
93
+ __NS_HMR_KICKSTART_MAX_URLS__: (() => {
94
+ const n = resolveHmrKickstartMaxUrls();
95
+ return Number.isFinite(n) ? String(n) : 'Infinity';
96
+ })(),
16
97
  __CSS_PARSER__: JSON.stringify('css-tree'),
17
98
  __UI_USE_XML_PARSER__: true,
18
99
  __UI_USE_EXTERNAL_RENDERER__: false,
@@ -1 +1 @@
1
- {"version":3,"file":"global-defines.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/global-defines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAEzE,MAAM,YAAY,GAAG,iBAAiB,EAAE,CAAC;AACzC,MAAM,gBAAgB,GAAG,wBAAwB,EAAE,CAAC;AAEpD,MAAM,UAAU,gBAAgB,CAAC,IAAgG;IAChI,OAAO;QACN,2CAA2C;QAC3C,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;QACxD,OAAO,EAAE,IAAI,CAAC,SAAS,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AC,IAAI,CAAC,IAAI,CAAC;QACnC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QACjD,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;QACzD,2FAA2F;QAC3F,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;KACxG,CAAC;AACH,CAAC"}
@@ -10,4 +10,5 @@ type ResolveOptions = {
10
10
  export declare function resolveVerboseFlag(options?: ResolveOptions): boolean;
11
11
  export declare function clearVerboseCache(): void;
12
12
  export declare function createFilteredViteLogger(): Logger;
13
+ export declare function shouldSuppressViteWarning(msg: string): boolean;
13
14
  export {};
@@ -72,9 +72,19 @@ export function clearVerboseCache() {
72
72
  // expected given NativeScript's virtual vendor bundling strategy.
73
73
  // Currently filters:
74
74
  // - Sourcemap missing source files (common in published packages)
75
+ // - Sourcemap source paths that walk outside the published package (the map
76
+ // was generated in a monorepo and still references workspace paths the
77
+ // consumer's node_modules doesn't have)
78
+ // - Sidecar `.js.map` files listed in a `//# sourceMappingURL=` comment that
79
+ // were not published alongside the `.js` file
75
80
  // - Eval usage attributed to the virtual "@nativescript/vendor" module
76
81
  // - License/annotation position warnings for the vendor bundle
82
+ // - Analog Angular optimizer/router plugins that never emit sourcemaps
77
83
  // Extend this list cautiously; prefer documenting each suppression reason.
84
+ //
85
+ // All matching uses `.includes()` (never `.startsWith()`) because Vite wraps
86
+ // some warnings in picocolors ANSI escape sequences before handing them to
87
+ // the logger, which would defeat `startsWith`-style probes on TTY output.
78
88
  export function createFilteredViteLogger() {
79
89
  const baseLogger = createLogger(undefined, { allowClearScreen: true });
80
90
  return {
@@ -93,9 +103,32 @@ export function createFilteredViteLogger() {
93
103
  },
94
104
  };
95
105
  }
96
- function shouldSuppressViteWarning(msg) {
97
- // Missing sourcemap original sources
98
- if (msg.startsWith('Sourcemap for ') && msg.includes('missing source files')) {
106
+ // Exported for unit tests. Keep this function pure so the test suite can
107
+ // exercise every suppression pattern without instantiating a real logger.
108
+ export function shouldSuppressViteWarning(msg) {
109
+ // Missing sourcemap original sources (kept as-is — published packages
110
+ // frequently drop a few `sources[n]` entries during transpile).
111
+ if (msg.includes('Sourcemap for ') && msg.includes('missing source files')) {
112
+ return true;
113
+ }
114
+ // Cross-package sourcemap path. Emitted for every `@nativescript/core`
115
+ // file at dev-server startup when the consumer has the published
116
+ // package installed: the shipped `.js.map` still references the
117
+ // original monorepo `packages/core/**` path, which does not exist in
118
+ // the consumer's node_modules. There is nothing we (or the app
119
+ // author) can do about this short of republishing core with relative
120
+ // sources — silently dropping it is correct.
121
+ if (msg.includes('Sourcemap for ') && msg.includes('points to a source file outside its package')) {
122
+ return true;
123
+ }
124
+ // Missing sidecar .js.map file. A couple of community packages
125
+ // (e.g. `@nativescript-community/observable`) ship the `.js` with a
126
+ // `//# sourceMappingURL=foo.js.map` footer but never include the
127
+ // actual map. Vite's sourcemap loader then retries the ENOENT on
128
+ // every request, flooding the terminal. We cannot resolve the
129
+ // missing file, so suppressing the warn-level diagnostic is the
130
+ // least invasive fix.
131
+ if (msg.includes('Failed to load source map for')) {
99
132
  return true;
100
133
  }
101
134
  // Vendor eval usage (third-party libs aggregated); benign
@@ -1 +1 @@
1
- {"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,MAAM,CAAC;AAEjD,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACjD,MAAM,gBAAgB,GAAG,CAAC,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;AAYpH,IAAI,aAAkC,CAAC;AAEvC,SAAS,aAAa,CAAC,KAAgB;IACtC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;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,CAAC,CAAC,EAAE,CAAC;QACrH,OAAO,IAAI,CAAC;IACb,CAAC;IACD,wDAAwD;IACxD,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,qDAAqD,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,sBAAsB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC;QAC1M,OAAO,IAAI,CAAC;IACb,CAAC;IACD,kGAAkG;IAClG,IAAI,GAAG,CAAC,QAAQ,CAAC,qCAAqC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,8BAA8B,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC,EAAE,CAAC;QACtK,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * alpha.62 follow-up — client-side helper for `ns:hmr-pending`.
3
+ *
4
+ * Server emits `ns:hmr-pending` immediately when `handleHotUpdate`
5
+ * fires, BEFORE doing any graph upserts / transforms / dependency
6
+ * analysis. The client uses that hint to drive the HMR-applying
7
+ * overlay's 'received' frame so the user sees an instant reaction
8
+ * to their save instead of waiting ~7–200ms for the framework
9
+ * payload (`ns:angular-update` / `ns:css-updates`) to arrive.
10
+ *
11
+ * This module is intentionally a tiny pure helper so the gating
12
+ * (`__NS_HMR_PROGRESS_OVERLAY_ENABLED__`) and detail-string formatting
13
+ * can be unit-tested without booting the full HMR client.
14
+ */
15
+ export type HmrOverlayApiLike = {
16
+ setUpdateStage?: (stage: string, info?: {
17
+ detail?: string;
18
+ }) => unknown;
19
+ } | null | undefined;
20
+ export type HmrPendingHandlerDeps = {
21
+ /** Resolves the live overlay API. Returning null/undefined is treated as "no overlay installed". */
22
+ getOverlay: () => HmrOverlayApiLike;
23
+ /** Override the build-time gate for testing. Defaults to reading `__NS_HMR_PROGRESS_OVERLAY_ENABLED__` (or `true` when undefined). */
24
+ overlayEnabled?: boolean;
25
+ };
26
+ export declare function buildHmrPendingDetail(filePath: string | undefined): string;
27
+ export declare function applyHmrPendingFrame(filePath: string | undefined, deps: HmrPendingHandlerDeps): boolean;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * alpha.62 follow-up — client-side helper for `ns:hmr-pending`.
3
+ *
4
+ * Server emits `ns:hmr-pending` immediately when `handleHotUpdate`
5
+ * fires, BEFORE doing any graph upserts / transforms / dependency
6
+ * analysis. The client uses that hint to drive the HMR-applying
7
+ * overlay's 'received' frame so the user sees an instant reaction
8
+ * to their save instead of waiting ~7–200ms for the framework
9
+ * payload (`ns:angular-update` / `ns:css-updates`) to arrive.
10
+ *
11
+ * This module is intentionally a tiny pure helper so the gating
12
+ * (`__NS_HMR_PROGRESS_OVERLAY_ENABLED__`) and detail-string formatting
13
+ * can be unit-tested without booting the full HMR client.
14
+ */
15
+ export function buildHmrPendingDetail(filePath) {
16
+ if (!filePath || filePath === '<unknown>')
17
+ return 'Preparing update';
18
+ return `Updating ${filePath}`;
19
+ }
20
+ export function applyHmrPendingFrame(filePath, deps) {
21
+ const enabled = typeof deps.overlayEnabled === 'boolean'
22
+ ? deps.overlayEnabled
23
+ : (() => {
24
+ try {
25
+ return typeof __NS_HMR_PROGRESS_OVERLAY_ENABLED__ === 'boolean' ? __NS_HMR_PROGRESS_OVERLAY_ENABLED__ : true;
26
+ }
27
+ catch {
28
+ return true;
29
+ }
30
+ })();
31
+ if (!enabled)
32
+ return false;
33
+ let api;
34
+ try {
35
+ api = deps.getOverlay();
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ if (!api || typeof api.setUpdateStage !== 'function')
41
+ return false;
42
+ try {
43
+ api.setUpdateStage('received', { detail: buildHmrPendingDetail(filePath) });
44
+ return true;
45
+ }
46
+ catch {
47
+ return false;
48
+ }
49
+ }
50
+ //# sourceMappingURL=hmr-pending-overlay.js.map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7 +5,7 @@
5
5
  * Always resolve core classes and Application from the vendor realm or globalThis at runtime.
6
6
  * The HMR client is evaluated via HTTP ESM on device; static imports would create secondary instances.
7
7
  */
8
- import { setHMRWsUrl, getHMRWsUrl, pendingModuleFetches, deriveHttpOrigin, setHttpOriginForVite, moduleFetchCache, requestModuleFromServer, getHttpOriginForVite, normalizeSpec, hmrMetrics, graph, setGraphVersion, getGraphVersion, getCurrentApp, getRootFrame, setCurrentApp, setRootFrame, getCore } from './utils.js';
8
+ import { setHMRWsUrl, getHMRWsUrl, pendingModuleFetches, deriveHttpOrigin, setHttpOriginForVite, moduleFetchCache, requestModuleFromServer, getHttpOriginForVite, normalizeSpec, hmrMetrics, graph, setGraphVersion, getGraphVersion, getCurrentApp, getRootFrame, setCurrentApp, setRootFrame, getCore, hasExplicitEviction, invalidateModulesByUrls, buildEvictionUrls, emitHmrModeBannerOnce } from './utils.js';
9
9
  import { handleCssUpdates } from './css-handler.js';
10
10
  const VERBOSE = typeof __NS_ENV_VERBOSE__ !== 'undefined' && __NS_ENV_VERBOSE__;
11
11
  function resolveTargetFlavor() {
@@ -101,6 +101,23 @@ function hideConnectionOverlay() {
101
101
  }
102
102
  catch { }
103
103
  }
104
+ // alpha.62 follow-up — Eagerly drive the HMR-applying overlay's
105
+ // 'received' frame as soon as the server emits `ns:hmr-pending`,
106
+ // BEFORE the framework-specific (`ns:angular-update` /
107
+ // `ns:css-updates`) payload arrives. The flavor-specific handler
108
+ // later walks through 'evicting' → 'reimporting' → 'rebooting' →
109
+ // 'complete'. Calling 'received' twice in the same cycle is safe:
110
+ // the overlay preserves `updateCycleStartedAt` when a 'received'
111
+ // frame replaces an existing 'received' frame so the
112
+ // minimum-visible window is still timed against the FIRST frame.
113
+ //
114
+ // Soft-fails when the overlay isn't installed (production builds,
115
+ // vitest, etc.) or when the user opted out via
116
+ // `__NS_HMR_PROGRESS_OVERLAY_ENABLED__ === false`.
117
+ import { applyHmrPendingFrame } from './hmr-pending-overlay.js';
118
+ function setHmrPendingOverlay(filePath) {
119
+ applyHmrPendingFrame(filePath, { getOverlay: getHmrOverlayApi });
120
+ }
104
121
  let connectionOverlayTimer = null;
105
122
  let connectionOverlayVisible = false;
106
123
  let hasOpenedHmrSocket = false;
@@ -810,6 +827,25 @@ async function processQueue() {
810
827
  return;
811
828
  if (VERBOSE)
812
829
  console.log('[hmr][queue] processing changed ids', drained);
830
+ // alpha.59 — Explicit eviction step.
831
+ //
832
+ // On alpha.59+ runtimes the URL canonicalizer collapses any
833
+ // `__ns_hmr__/<tag>/` segment back to a stable cache key, so
834
+ // without explicit eviction the upcoming `import(url)` would
835
+ // resolve via V8's `g_moduleRegistry` and return the cached
836
+ // stale module — making the queue drain a silent no-op for
837
+ // every save after the first.
838
+ //
839
+ // We hand the canonical eviction URLs to the runtime first;
840
+ // `invalidateModulesByUrls` is a no-op on older runtimes and
841
+ // `requestModuleFromServer` automatically falls back to the
842
+ // legacy `/ns/m/__ns_hmr__/v<N>/` URL versioning path in that
843
+ // case. node_modules and virtual specs are filtered out by
844
+ // `buildEvictionUrls` so vendor modules stay hot.
845
+ const evictUrls = buildEvictionUrls(drained);
846
+ const evicted = invalidateModulesByUrls(evictUrls);
847
+ if (VERBOSE)
848
+ console.log(`[hmr][queue] eviction count=${evictUrls.length} ok=${evicted}`);
813
849
  // Evaluate changed modules best-effort; failures shouldn't completely break HMR.
814
850
  for (const id of drained) {
815
851
  try {
@@ -924,6 +960,15 @@ async function processQueue() {
924
960
  }
925
961
  return null;
926
962
  };
963
+ // alpha.59 — Evict the boundary set so re-importing
964
+ // each .tsx component actually picks up the new
965
+ // transitive dependency code; without this V8 returns
966
+ // the cached boundary module unchanged.
967
+ const boundaryIds = Array.from(boundaries);
968
+ const solidEvictUrls = buildEvictionUrls(boundaryIds);
969
+ const solidEvicted = invalidateModulesByUrls(solidEvictUrls);
970
+ if (VERBOSE)
971
+ console.log(`[hmr][solid] eviction count=${solidEvictUrls.length} ok=${solidEvicted}`);
927
972
  for (const id of boundaries) {
928
973
  if (seen.has(id))
929
974
  continue;
@@ -1274,6 +1319,13 @@ function connectHmr() {
1274
1319
  showConnectionOverlayNow('synchronizing', 'Connected. Synchronizing the HMR graph.');
1275
1320
  }
1276
1321
  VERBOSE && console.log('[hmr-client] Connected to HMR WebSocket');
1322
+ // alpha.59 — Print the active module reload mode once on first
1323
+ // successful connect so the user can correlate HMR latency with
1324
+ // runtime capability without grepping for protocol details.
1325
+ try {
1326
+ emitHmrModeBannerOnce();
1327
+ }
1328
+ catch { }
1277
1329
  };
1278
1330
  sock.onmessage = handleHmrMessage;
1279
1331
  sock.onerror = (error) => {
@@ -1333,6 +1385,17 @@ async function handleHmrMessage(ev) {
1333
1385
  catch { }
1334
1386
  }
1335
1387
  if (msg) {
1388
+ // alpha.62 follow-up — `ns:hmr-pending` is a fire-and-forget
1389
+ // UX hint emitted by the server at the START of handleHotUpdate.
1390
+ // We drive the HMR-applying overlay's 'received' frame here
1391
+ // (synchronously), well before the authoritative payload
1392
+ // (`ns:angular-update` / `ns:css-updates`) lands. Skip running
1393
+ // any other handlers — the pending message has no module
1394
+ // payload and intentionally does not bump the graph version.
1395
+ if (msg.type === 'ns:hmr-pending' && typeof msg.path === 'string') {
1396
+ setHmrPendingOverlay(msg.path);
1397
+ return;
1398
+ }
1336
1399
  if (msg.type === 'ns:hmr-full-graph') {
1337
1400
  // Bump a monotonic nonce so HTTP ESM imports can always be cache-busted per update.
1338
1401
  try {
@@ -1402,6 +1465,14 @@ async function handleHmrMessage(ev) {
1402
1465
  });
1403
1466
  if (toReimport.length && VERBOSE)
1404
1467
  console.log('[hmr][full-graph] inferred changed modules; re-importing', toReimport);
1468
+ // alpha.59 — Evict the inferred changed set before re-importing.
1469
+ // See `processQueue` for the architectural rationale; the
1470
+ // full-graph code path is the resync fallback (server chose
1471
+ // not to send a delta) and shares the same V8 cache pitfall.
1472
+ const fgEvictUrls = buildEvictionUrls(toReimport);
1473
+ const fgEvicted = invalidateModulesByUrls(fgEvictUrls);
1474
+ if (VERBOSE)
1475
+ console.log(`[hmr][full-graph] eviction count=${fgEvictUrls.length} ok=${fgEvicted}`);
1405
1476
  for (const id of toReimport) {
1406
1477
  try {
1407
1478
  const spec = normalizeSpec(id);