@nativescript/vite 8.0.0-alpha.56 → 8.0.0-alpha.58

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 (102) hide show
  1. package/configuration/angular.js +3 -3
  2. package/configuration/angular.js.map +1 -1
  3. package/helpers/global-defines.d.ts +1 -1
  4. package/helpers/global-defines.js +1 -1
  5. package/helpers/workers.js +10 -10
  6. package/helpers/workers.js.map +1 -1
  7. package/hmr/client/hot-context.d.ts +67 -0
  8. package/hmr/client/hot-context.js +284 -0
  9. package/hmr/client/hot-context.js.map +1 -0
  10. package/hmr/client/index.js +49 -60
  11. package/hmr/client/index.js.map +1 -1
  12. package/hmr/client/utils.js +29 -57
  13. package/hmr/client/utils.js.map +1 -1
  14. package/hmr/entry-runtime.js +73 -39
  15. package/hmr/entry-runtime.js.map +1 -1
  16. package/hmr/frameworks/angular/client/index.js +103 -161
  17. package/hmr/frameworks/angular/client/index.js.map +1 -1
  18. package/hmr/frameworks/angular/server/strategy.js +4 -6
  19. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  20. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +2 -2
  21. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -1
  22. package/hmr/frameworks/solid/client/app-runtime.js +9 -7
  23. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -1
  24. package/hmr/frameworks/solid/server/strategy.js +1 -1
  25. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  26. package/hmr/frameworks/typescript/server/strategy.js +1 -1
  27. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  28. package/hmr/frameworks/vue/client/index.d.ts +1 -0
  29. package/hmr/frameworks/vue/client/index.js +90 -12
  30. package/hmr/frameworks/vue/client/index.js.map +1 -1
  31. package/hmr/frameworks/vue/server/sfc-route-assemble.js +43 -39
  32. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -1
  33. package/hmr/frameworks/vue/server/sfc-route-serve.js +18 -30
  34. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -1
  35. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +13 -16
  36. package/hmr/frameworks/vue/server/sfc-route-shared.js +20 -24
  37. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -1
  38. package/hmr/frameworks/vue/server/strategy.js +14 -12
  39. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  40. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  41. package/hmr/helpers/vendor-rewrite.js +5 -3
  42. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  43. package/hmr/server/boot-closure-route.d.ts +16 -0
  44. package/hmr/server/boot-closure-route.js +99 -0
  45. package/hmr/server/boot-closure-route.js.map +1 -0
  46. package/hmr/server/core-bundle.d.ts +116 -0
  47. package/hmr/server/core-bundle.js +460 -0
  48. package/hmr/server/core-bundle.js.map +1 -0
  49. package/hmr/server/framework-strategy.d.ts +10 -5
  50. package/hmr/server/hmr-module-graph.js +7 -6
  51. package/hmr/server/hmr-module-graph.js.map +1 -1
  52. package/hmr/server/import-map.d.ts +3 -3
  53. package/hmr/server/import-map.js +4 -4
  54. package/hmr/server/import-map.js.map +1 -1
  55. package/hmr/server/ns-rt-route.js +2 -1
  56. package/hmr/server/ns-rt-route.js.map +1 -1
  57. package/hmr/server/perf-instrumentation.js +1 -1
  58. package/hmr/server/perf-instrumentation.js.map +1 -1
  59. package/hmr/server/process-code-for-device.d.ts +16 -0
  60. package/hmr/server/process-code-for-device.js +94 -2
  61. package/hmr/server/process-code-for-device.js.map +1 -1
  62. package/hmr/server/vite-plugin.d.ts +1 -0
  63. package/hmr/server/vite-plugin.js +110 -20
  64. package/hmr/server/vite-plugin.js.map +1 -1
  65. package/hmr/server/websocket-import-map-route.d.ts +1 -1
  66. package/hmr/server/websocket-import-map-route.js +1 -1
  67. package/hmr/server/websocket-ns-core.d.ts +16 -3
  68. package/hmr/server/websocket-ns-core.js +100 -5
  69. package/hmr/server/websocket-ns-core.js.map +1 -1
  70. package/hmr/server/websocket-ns-m-paths.d.ts +1 -3
  71. package/hmr/server/websocket-ns-m-paths.js +24 -80
  72. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  73. package/hmr/server/websocket-ns-m.js +41 -77
  74. package/hmr/server/websocket-ns-m.js.map +1 -1
  75. package/hmr/server/websocket-served-module-helpers.d.ts +1 -1
  76. package/hmr/server/websocket-served-module-helpers.js +11 -5
  77. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  78. package/hmr/server/websocket-txn.js +4 -1
  79. package/hmr/server/websocket-txn.js.map +1 -1
  80. package/hmr/server/websocket.js +8 -1
  81. package/hmr/server/websocket.js.map +1 -1
  82. package/hmr/shared/ns-globals.d.ts +2 -15
  83. package/hmr/shared/ns-globals.js +2 -3
  84. package/hmr/shared/ns-globals.js.map +1 -1
  85. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  86. package/hmr/shared/runtime/boot-complete.js +32 -0
  87. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  88. package/hmr/shared/runtime/boot-progress.js +6 -5
  89. package/hmr/shared/runtime/boot-progress.js.map +1 -1
  90. package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
  91. package/hmr/shared/runtime/boot-timeline.js +6 -7
  92. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  93. package/hmr/shared/runtime/browser-runtime-contract.d.ts +34 -22
  94. package/hmr/shared/runtime/browser-runtime-contract.js +6 -9
  95. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  96. package/hmr/shared/runtime/dev-overlay.js +1 -1
  97. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  98. package/hmr/shared/runtime/root-placeholder.js +5 -4
  99. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  100. package/hmr/shared/runtime/session-bootstrap.js +90 -48
  101. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  102. package/package.json +5 -1
@@ -7,7 +7,7 @@ export interface RegisterImportMapRouteOptions {
7
7
  /**
8
8
  * Registers the device import-map endpoint: `GET /ns/import-map.json`.
9
9
  *
10
- * Returns the import map + runtime config consumed by `__nsConfigureRuntime()`
10
+ * Returns the import map + runtime config consumed by `__NS_DEV__.configureRuntime()`
11
11
  * on the device during cold boot. Extracted verbatim from
12
12
  * `createHmrWebSocketPlugin`; the only injected dependency is the active
13
13
  * framework strategy (for its `flavor`).
@@ -3,7 +3,7 @@ import { getServerOrigin } from './server-origin.js';
3
3
  /**
4
4
  * Registers the device import-map endpoint: `GET /ns/import-map.json`.
5
5
  *
6
- * Returns the import map + runtime config consumed by `__nsConfigureRuntime()`
6
+ * Returns the import map + runtime config consumed by `__NS_DEV__.configureRuntime()`
7
7
  * on the device during cold boot. Extracted verbatim from
8
8
  * `createHmrWebSocketPlugin`; the only injected dependency is the active
9
9
  * framework strategy (for its `flavor`).
@@ -1,4 +1,5 @@
1
1
  import type { TransformResult, ViteDevServer } from 'vite';
2
+ import { type CoreBundleService } from './core-bundle.js';
2
3
  type SharedTransformRequestFn = (url: string, timeoutMs?: number) => Promise<TransformResult | null>;
3
4
  /**
4
5
  * Plugin-closure dependencies the `/ns/core` bridge needs: the shared transform
@@ -9,13 +10,25 @@ type SharedTransformRequestFn = (url: string, timeoutMs?: number) => Promise<Tra
9
10
  export interface RegisterNsCoreRouteOptions {
10
11
  getGraphVersion(): number;
11
12
  sharedTransformRequest: SharedTransformRequestFn;
13
+ /**
14
+ * Injectable core-bundle service (testability seam). When omitted, the
15
+ * shared process-wide service is used — unless `NS_CORE_PER_MODULE=1`
16
+ * disables bundle mode entirely.
17
+ */
18
+ coreBundle?: CoreBundleService | null;
12
19
  }
13
20
  /**
14
21
  * Registers the `@nativescript/core` device bridge on the dev server:
15
22
  * - a catch-all that rewrites stray `/node_modules/@nativescript/core/*`
16
- * requests to the canonical `/ns/core[/<sub>]` URL, and
17
- * - `GET /ns/core[/<sub>]` — the ONE place @nativescript/core is evaluated on
18
- * device (single module realm, shared class identities, one-time `register()`).
23
+ * requests to the canonical `/ns/core[/<sub>]` URL,
24
+ * - `GET /ns/core-bundle.mjs` (bundle mode) — the single-eval core bundle, and
25
+ * - `GET /ns/core[/<sub>]` the canonical core URL space. In bundle mode
26
+ * (default) these serve thin shims over the bundle; with
27
+ * `NS_CORE_PER_MODULE=1` (core maintainers editing core source in the
28
+ * monorepo) each core module is served/transformed individually so core
29
+ * edits participate in HMR. Either way this URL family is the ONE place
30
+ * @nativescript/core reaches the device (single module realm, shared class
31
+ * identities, one-time `register()`).
19
32
  */
20
33
  export declare function registerNsCoreRoute(server: ViteDevServer, options: RegisterNsCoreRouteOptions): void;
21
34
  export {};
@@ -1,20 +1,86 @@
1
+ import { readFileSync } from 'node:fs';
1
2
  import { isDirectoryIndexFilename, rewriteSpecifiersForDevice } from './core-sanitize.js';
2
- import { buildDefaultExportFooter, buildShapeInstallHeader, hasNamespaceReExport, rewriteNamespaceReExportsForShape } from './ns-core-cjs-shape.js';
3
+ import { buildDefaultExportFooter, buildShapeInstallHeader, hasExistingDefaultExport, hasNamespaceReExport, rewriteNamespaceReExportsForShape } from './ns-core-cjs-shape.js';
3
4
  import { getCliFlags } from '../../helpers/cli-flags.js';
4
5
  import { normalizeCoreSub as normalizeCoreSubCanonical } from '../../helpers/ns-core-url.js';
5
- import { parseCoreBridgeRequest, resolveRuntimeCoreModulePath } from './websocket-core-bridge.js';
6
+ import { parseCoreBridgeRequest, resolveRuntimeCoreModulePath, collectStaticExportNamesFromFile } from './websocket-core-bridge.js';
6
7
  import { setDeviceModuleHeaders } from './route-helpers.js';
7
8
  import { getServerOrigin } from './server-origin.js';
8
9
  import { resolveVerboseFlag } from '../../helpers/logging.js';
10
+ import { CORE_BUNDLE_PATH, buildCoreMainShimCode, buildCoreSubShimCode, getSharedCoreBundleService, isCorePerModuleServingEnabled } from './core-bundle.js';
9
11
  /**
10
12
  * Registers the `@nativescript/core` device bridge on the dev server:
11
13
  * - a catch-all that rewrites stray `/node_modules/@nativescript/core/*`
12
- * requests to the canonical `/ns/core[/<sub>]` URL, and
13
- * - `GET /ns/core[/<sub>]` — the ONE place @nativescript/core is evaluated on
14
- * device (single module realm, shared class identities, one-time `register()`).
14
+ * requests to the canonical `/ns/core[/<sub>]` URL,
15
+ * - `GET /ns/core-bundle.mjs` (bundle mode) — the single-eval core bundle, and
16
+ * - `GET /ns/core[/<sub>]` the canonical core URL space. In bundle mode
17
+ * (default) these serve thin shims over the bundle; with
18
+ * `NS_CORE_PER_MODULE=1` (core maintainers editing core source in the
19
+ * monorepo) each core module is served/transformed individually so core
20
+ * edits participate in HMR. Either way this URL family is the ONE place
21
+ * @nativescript/core reaches the device (single module realm, shared class
22
+ * identities, one-time `register()`).
15
23
  */
16
24
  export function registerNsCoreRoute(server, options) {
17
25
  const verbose = resolveVerboseFlag();
26
+ const coreBundle = options.coreBundle !== undefined ? options.coreBundle : isCorePerModuleServingEnabled() ? null : getSharedCoreBundleService(server);
27
+ if (coreBundle) {
28
+ // Warm the bundle build in the background so the first device request
29
+ // doesn't pay the esbuild cost (parallels the vendor bundle warmup).
30
+ void coreBundle.ensureBuilt();
31
+ // GET /ns/core-bundle.mjs — the single-eval core payload.
32
+ server.middlewares.use(async (req, res, next) => {
33
+ try {
34
+ const urlObj = new URL(req.url || '', 'http://localhost');
35
+ if (urlObj.pathname !== CORE_BUNDLE_PATH)
36
+ return next();
37
+ const state = await coreBundle.ensureBuilt();
38
+ if (!state) {
39
+ res.statusCode = 503;
40
+ res.setHeader('Access-Control-Allow-Origin', '*');
41
+ res.setHeader('Content-Type', 'application/json');
42
+ res.end(JSON.stringify({ error: 'core-bundle-build-failed' }));
43
+ return;
44
+ }
45
+ setDeviceModuleHeaders(res);
46
+ res.statusCode = 200;
47
+ res.end(state.code);
48
+ }
49
+ catch (e) {
50
+ console.warn('[ns-core-bundle] serve failed:', e?.message);
51
+ next();
52
+ }
53
+ });
54
+ }
55
+ const subExportInfoCache = new Map();
56
+ const resolveModuleIdViaVite = async (moduleId) => {
57
+ const resolved = await server.pluginContainer?.resolveId?.(moduleId, undefined);
58
+ return typeof resolved === 'string' ? resolved : resolved?.id || null;
59
+ };
60
+ const getSubShimExportInfo = (canonicalSub) => {
61
+ let pending = subExportInfoCache.get(canonicalSub);
62
+ if (!pending) {
63
+ pending = (async () => {
64
+ try {
65
+ const modulePath = await resolveRuntimeCoreModulePath(canonicalSub, resolveModuleIdViaVite);
66
+ if (!modulePath)
67
+ return { names: [], hasDefault: false };
68
+ let hasDefault = false;
69
+ try {
70
+ hasDefault = hasExistingDefaultExport(readFileSync(modulePath.replace(/[?#].*$/, ''), 'utf8'));
71
+ }
72
+ catch { }
73
+ return { names: collectStaticExportNamesFromFile(modulePath), hasDefault };
74
+ }
75
+ catch {
76
+ return { names: [], hasDefault: false };
77
+ }
78
+ })();
79
+ subExportInfoCache.set(canonicalSub, pending);
80
+ }
81
+ return pending;
82
+ };
83
+ const warnedFallbackSubs = new Set();
18
84
  // Catch-all redirect for stray /node_modules/@nativescript/core/*
19
85
  // requests — route them to the /ns/core bridge so they get the same
20
86
  // __DEV__/__IOS__ preamble and specifier rewriting. Without this,
@@ -85,6 +151,35 @@ export function registerNsCoreRoute(server, options) {
85
151
  }
86
152
  setDeviceModuleHeaders(res);
87
153
  const { normalizedSub, sub } = coreRequest;
154
+ // BUNDLE MODE (default): serve thin shims over /ns/core-bundle.mjs.
155
+ // The canonical URL space is unchanged — only the response bodies
156
+ // differ. Fall through to the per-module pipeline below when the
157
+ // bundle build failed or when the requested subpath was excluded
158
+ // from bundle enumeration (e.g. debugger/ modules). That fallback
159
+ // is realm-safe: the per-module response's own core imports are
160
+ // rewritten to `/ns/core/<sub>` URLs, which resolve to shims that
161
+ // join the bundle realm.
162
+ if (coreBundle) {
163
+ const bundleState = await coreBundle.ensureBuilt();
164
+ if (bundleState) {
165
+ const canonicalSubForShim = normalizeCoreSubCanonical(normalizedSub || sub || '');
166
+ if (!canonicalSubForShim) {
167
+ res.statusCode = 200;
168
+ res.end(buildCoreMainShimCode());
169
+ return;
170
+ }
171
+ if (bundleState.subs.has(canonicalSubForShim)) {
172
+ const exportInfo = await getSubShimExportInfo(canonicalSubForShim);
173
+ res.statusCode = 200;
174
+ res.end(buildCoreSubShimCode(canonicalSubForShim, exportInfo.names, exportInfo.hasDefault));
175
+ return;
176
+ }
177
+ if (!warnedFallbackSubs.has(canonicalSubForShim)) {
178
+ warnedFallbackSubs.add(canonicalSubForShim);
179
+ console.warn(`[ns-core-bundle] sub '${canonicalSubForShim}' not in bundle enumeration — serving per-module (realm-safe fallback)`);
180
+ }
181
+ }
182
+ }
88
183
  const resolveModuleId = async (moduleId) => {
89
184
  const resolved = await server.pluginContainer?.resolveId?.(moduleId, undefined);
90
185
  return typeof resolved === 'string' ? resolved : resolved?.id || null;
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-ns-core.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-ns-core.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAqB,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AACpJ,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,IAAI,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAClG,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAe9D;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAqB,EAAE,OAAmC;IAC7F,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,kEAAkE;IA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pE,IAAI,EAAE,CAAC;QACR,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1 @@
1
- export declare function formatNsMHmrServeTag(value: string | number): string;
2
- export declare function rewriteNsMImportPathForHmr(p: string, _ver: string | number, bootTaggedRequest: boolean): string;
3
- export declare function getNumericServeVersionTag(tag: string | null | undefined, fallback: number): number;
1
+ export declare function canonicalizeNsMImportPath(p: string): string;
@@ -1,92 +1,36 @@
1
1
  // Stable URL + explicit invalidation contract for `/ns/m/...` modules.
2
2
  //
3
- // Older versions emitted `/ns/m/__ns_hmr__/v<N>/<rel>` URLs in every
4
- // served module so that V8's HTTP module cache (`g_moduleRegistry`)
5
- // would see a fresh URL on each save and re-fetch the dependency
6
- // closure. On every save the server also bumped a global `graphVersion`
7
- // counter, which propagated into every emitted URL — effectively
8
- // invalidating the ENTIRE cached graph on every save (Vite's
9
- // single-threaded transform pipeline became the wall-clock bottleneck).
3
+ // Older versions emitted `/ns/m/__ns_hmr__/v<N>/<rel>` (and, for cold boot,
4
+ // `/ns/m/__ns_boot__/b1/<rel>`) URLs in served modules so that V8's HTTP
5
+ // module cache would see a fresh URL on each save and so that the server
6
+ // could detect boot-time requests. Both decorations are gone:
10
7
  //
11
- // The current contract inverts that:
12
- // - The runtime registers a canonical key for every URL via
13
- // `CanonicalizeHttpUrlKey` (HMRSupport.mm), which strips
14
- // `__ns_hmr__/<tag>/` and `__ns_boot__/b1/` segments before lookup.
15
- // - The Angular HMR client receives an explicit `evictPaths` list in
16
- // `ns:angular-update` and calls `__nsInvalidateModules` to drop only
17
- // the modules that actually need re-evaluation.
18
- // - The server emits STABLE URLs for app modules. No version segment.
8
+ // - Freshness is driven by explicit eviction: the client calls
9
+ // `__NS_DEV__.invalidateModules(urls)` with the server-computed eviction set,
10
+ // and the iOS runtime pairs that with an eviction-driven fetch nonce
11
+ // that defeats CFNetwork's HTTP cache. URLs stay STABLE across saves —
12
+ // module identity IS the canonical URL.
13
+ // - Boot-progress instrumentation is injected self-gating into every
14
+ // served /ns/m module (the snippet no-ops once
15
+ // `__NS_HMR_BOOT_COMPLETE__` flips), so no boot tag is needed.
19
16
  //
20
- // `rewriteNsMImportPathForHmr` collapses any inbound URL shape to the
21
- // canonical stable form. We still preserve `__ns_boot__/b1/` for
22
- // boot-tagged requests because that wrapper drives boot-progress
23
- // instrumentation (see `buildBootProgressSnippet`), and we still pass
24
- // `node_modules` through unchanged because vendor packages live on a
25
- // stable namespace already.
26
- export function formatNsMHmrServeTag(value) {
27
- const raw = String(value ?? '').trim();
28
- if (!raw) {
29
- return 'v0';
30
- }
31
- if (raw === 'live' || /^n\d+$/i.test(raw) || /^v[^/]+$/i.test(raw)) {
32
- return raw;
33
- }
34
- if (/^\d+$/.test(raw)) {
35
- return `v${raw}`;
36
- }
37
- return raw;
38
- }
39
- export function rewriteNsMImportPathForHmr(p, _ver, bootTaggedRequest) {
17
+ // `canonicalizeNsMImportPath` collapses any tagged inbound URL shape
18
+ // (stale served code still cached on a device) back to the canonical
19
+ // stable form.
20
+ export function canonicalizeNsMImportPath(p) {
40
21
  if (!p || !p.startsWith('/ns/m/')) {
41
22
  return p;
42
23
  }
43
- // Step 1: collapse any legacy boot+hmr or hmr-only prefix back to the
44
- // canonical `/ns/m/<rest>` form. Inputs we may see in the wild include:
45
- // * `/ns/m/__ns_boot__/b1/__ns_hmr__/v<N>/<rest>` (legacy cold-boot
46
- // served code)
47
- // * `/ns/m/__ns_hmr__/v<N>/<rest>` (legacy HMR served code)
48
- // * `/ns/m/__ns_boot__/b1/<rest>` (current cold boot)
49
- // * `/ns/m/<rest>` (current HMR)
50
- // We strip `__ns_hmr__/<tag>/` regardless of `<tag>` (handles `live`,
51
- // `v<N>`, `n<N>`, anything matched by `formatNsMHmrServeTag`). The
52
- // `__ns_boot__/b1/` segment is stripped here too — we'll re-add it
53
- // below if `bootTaggedRequest` is set, so the canonicalization is
54
- // idempotent (a boot URL that flows through twice ends up correct).
55
- const canonical = p
24
+ // Collapse tagged boot+hmr, hmr-only, or boot-only prefixes back to the
25
+ // canonical `/ns/m/<rest>` form. Inputs we may still see from stale
26
+ // cached code include:
27
+ // * `/ns/m/__ns_boot__/b1/__ns_hmr__/v<N>/<rest>`
28
+ // * `/ns/m/__ns_hmr__/v<N>/<rest>` (any tag: `live`, `v<N>`, `n<N>`, …)
29
+ // * `/ns/m/__ns_boot__/b1/<rest>`
30
+ // * `/ns/m/<rest>` (canonical, passes through unchanged)
31
+ return p
56
32
  .replace(/^\/ns\/m\/__ns_boot__\/b1\/__ns_hmr__\/[^/]+\//, '/ns/m/')
57
33
  .replace(/^\/ns\/m\/__ns_hmr__\/[^/]+\//, '/ns/m/')
58
34
  .replace(/^\/ns\/m\/__ns_boot__\/b1\//, '/ns/m/');
59
- // Vendor packages: always serve under the canonical
60
- // `/ns/m/node_modules/<rest>` path, never under the boot prefix. This
61
- // preserves the longstanding invariant that node_modules paths are
62
- // stable across boot and HMR (so V8 dedups them in the module
63
- // registry regardless of which load triggered the fetch first).
64
- if (canonical.startsWith('/ns/m/node_modules/')) {
65
- return canonical;
66
- }
67
- // Boot-tagged request: app-module URL gets wrapped with the boot
68
- // prefix. The runtime canonicalizer collapses this back to the same
69
- // cache key as the unprefixed URL, so cold boot and HMR share module
70
- // identity. The boot prefix is still useful at request time because
71
- // the server detects it and injects the boot-progress snippet.
72
- if (bootTaggedRequest) {
73
- return `/ns/m/__ns_boot__/b1${canonical.slice('/ns/m'.length)}`;
74
- }
75
- // HMR / steady-state request: stable canonical URL.
76
- return canonical;
77
- }
78
- export function getNumericServeVersionTag(tag, fallback) {
79
- const raw = String(tag || '').trim();
80
- if (!raw) {
81
- return fallback;
82
- }
83
- const versionMatch = raw.match(/^v(\d+)$/);
84
- if (versionMatch?.[1]) {
85
- return Number(versionMatch[1]);
86
- }
87
- if (/^\d+$/.test(raw)) {
88
- return Number(raw);
89
- }
90
- return fallback;
91
35
  }
92
36
  //# sourceMappingURL=websocket-ns-m-paths.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-ns-m-paths.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-ns-m-paths.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,iEAAiE;AACjE,wEAAwE;AACxE,iEAAiE;AACjE,6DAA6D;AAC7D,wEAAwE;AACxE,EAAE;AACF,qCAAqC;AACrC,8DAA8D;AAC9D,6DAA6D;AAC7D,wEAAwE;AACxE,uEAAuE;AACvE,yEAAyE;AACzE,oDAAoD;AACpD,wEAAwE;AACxE,EAAE;AACF,sEAAsE;AACtE,iEAAiE;AACjE,iEAAiE;AACjE,sEAAsE;AACtE,qEAAqE;AACrE,4BAA4B;AAE5B,MAAM,UAAU,oBAAoB,CAAC,KAAsB;IAC1D,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAI,GAAG,KAAK,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACpE,OAAO,GAAG,CAAC;IACZ,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,GAAG,EAAE,CAAC;IAClB,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,CAAS,EAAE,IAAqB,EAAE,iBAA0B;IACtG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC;IACV,CAAC;IAED,sEAAsE;IACtE,wEAAwE;IACxE,sEAAsE;IACtE,mBAAmB;IACnB,4EAA4E;IAC5E,uEAAuE;IAC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+ {"version":3,"file":"websocket-ns-m-paths.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-ns-m-paths.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAC5E,yEAAyE;AACzE,yEAAyE;AACzE,8DAA8D;AAC9D,EAAE;AACF,iEAAiE;AACjE,kFAAkF;AAClF,yEAAyE;AACzE,2EAA2E;AAC3E,4CAA4C;AAC5C,uEAAuE;AACvE,mDAAmD;AACnD,mEAAmE;AACnE,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,eAAe;AAEf,MAAM,UAAU,yBAAyB,CAAC,CAAS;IAClD,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC;IACV,CAAC;IAED,wEAAwE;IACxE,oEAAoE;IACpE,uBAAuB;IACvB,oDAAoD;IACpD,0EAA0E;IAC1E,oCAAoC;IACpC,2DAA2D;IAC3D,OAAO,CAAC;SACN,OAAO,CAAC,gDAAgD,EAAE,QAAQ,CAAC;SACnE,OAAO,CAAC,+BAA+B,EAAE,QAAQ,CAAC;SAClD,OAAO,CAAC,6BAA6B,EAAE,QAAQ,CAAC,CAAC;AACpD,CAAC"}
@@ -5,11 +5,11 @@ import { sanitizeStrayCoreReferences } from './core-sanitize.js';
5
5
  import { getMonorepoWorkspaceRoot } from '../../helpers/project.js';
6
6
  import { isRuntimeGraphExcludedPath } from './runtime-graph-filter.js';
7
7
  import { buildPiniaVendorShim, buildVueVendorShim } from './vendor-bare-module-shims.js';
8
- import { getNumericServeVersionTag, rewriteNsMImportPathForHmr } from './websocket-ns-m-paths.js';
8
+ import { canonicalizeNsMImportPath } from './websocket-ns-m-paths.js';
9
9
  import { setDeviceModuleHeaders } from './route-helpers.js';
10
10
  import { CSS_MODULE_RE, buildCssRegisterSnippetFromVar, normalizeCssForDevice } from './css-device-module.js';
11
11
  import { filterExistingNodeModulesTransformCandidates, getBlockedDeviceNodeModulesReason, resolveCandidateFilePath, stripDecoratedServePrefixes, tryReadRawExplicitJavaScriptModule } from './websocket-module-specifiers.js';
12
- import { assertNoOptimizedArtifacts, buildBootProgressSnippet, classifyServedModule, dedupeRtNamedImportsAgainstDestructures, deduplicateLinkerImports, ensureDestructureCoreImports, ensureGuardPlainDynamicImports, ensureVariableDynamicImportHelper, ensureVersionedRtImports, expandStarExports, hoistTopLevelStaticImports, MODULE_IMPORT_ANALYSIS_PLUGINS, wrapCommonJsModuleForDevice } from './websocket-served-module-helpers.js';
12
+ import { assertNoOptimizedArtifacts, buildBootProgressSnippet, canonicalizeRtImports, classifyServedModule, dedupeRtNamedImportsAgainstDestructures, deduplicateLinkerImports, ensureDestructureCoreImports, ensureGuardPlainDynamicImports, ensureVariableDynamicImportHelper, expandStarExports, hoistTopLevelStaticImports, MODULE_IMPORT_ANALYSIS_PLUGINS, wrapCommonJsModuleForDevice } from './websocket-served-module-helpers.js';
13
13
  import { cleanCode, collectImportDependencies, processCodeForDevice, rewriteImports } from './websocket-device-transform.js';
14
14
  import { REQUIRE_GUARD_SNIPPET } from './require-guard.js';
15
15
  import { getServerOrigin } from './server-origin.js';
@@ -123,17 +123,14 @@ export function registerNsModuleServerRoute(server, options) {
123
123
  // first response. `handleHotUpdate` awaits the same promise so
124
124
  // the first HMR event still sees a fully populated graph.
125
125
  ensureInitialGraphPopulationStarted(server);
126
- // Cold-boot counter is now hooked via the leading boot-trace
127
- // middleware (see `configureServer` — it records the request
128
- // and tracks finish() via res.on('close'/'finish')). This
129
- // handler used to record here but that missed the
130
- // round-trip timing and didn't track per-route breakdowns.
126
+ // Cold-boot counting lives in the leading boot-trace middleware
127
+ // (see `configureServer` — it records the request and tracks
128
+ // finish() via res.on('close'/'finish')), not here: recording in
129
+ // this handler would miss the round-trip timing and per-route
130
+ // breakdowns.
131
131
  setDeviceModuleHeaders(res);
132
132
  // Support both query (?path=/abs) and path-style (/ns/m/abs)
133
133
  let spec = urlObj.searchParams.get('path') || '';
134
- // Optional graph version pin for deterministic boot
135
- let forcedVer = urlObj.searchParams.get('v');
136
- let bootTaggedRequest = false;
137
134
  if (!spec) {
138
135
  const base = '/ns/m';
139
136
  const rest = urlObj.pathname.slice(base.length);
@@ -154,17 +151,11 @@ export function registerNsModuleServerRoute(server, options) {
154
151
  const serverRoot = (server.config?.root || process.cwd());
155
152
  const monorepoWorkspaceRoot = getMonorepoWorkspaceRoot(serverRoot);
156
153
  spec = spec.replace(/[?#].*$/, '');
157
- // Accept path-based boot/HMR prefixes:
158
- // /ns/m/__ns_boot__/b1/<real-spec>
159
- // /ns/m/__ns_hmr__/<tag>/<real-spec>
160
- // /ns/m/__ns_boot__/b1/__ns_hmr__/<tag>/<real-spec>
161
- // The iOS HTTP ESM loader canonicalizes cache keys by stripping query params,
162
- // so we must carry the cache-buster in the path.
154
+ // Tolerate LEGACY path-based boot/HMR prefixes from stale cached
155
+ // device code (`/ns/m/__ns_boot__/b1/…`, `/ns/m/__ns_hmr__/<tag>/…`).
156
+ // Current servers never emit them — freshness is eviction-driven.
163
157
  try {
164
- const decorated = stripDecoratedServePrefixes(spec);
165
- spec = decorated.cleanedSpec;
166
- bootTaggedRequest = decorated.bootTaggedRequest;
167
- forcedVer || (forcedVer = decorated.forcedVer);
158
+ spec = stripDecoratedServePrefixes(spec).cleanedSpec;
168
159
  }
169
160
  catch { }
170
161
  // Normalize absolute filesystem paths back to project-relative ids (e.g. /src/app.ts)
@@ -466,11 +457,10 @@ export function registerNsModuleServerRoute(server, options) {
466
457
  // point — see classifyServedModule for the full case list.
467
458
  const isNodeMod = classifyServedModule(resolvedCandidate || spec) === 'library';
468
459
  code = processCodeForDevice(code, false, true, isNodeMod, resolvedCandidate || spec);
469
- // Solid HMR: The NativeScript iOS/Android runtime provides import.meta.hot
470
- // natively (via InitializeImportMetaHot in HMRSupport.mm) with C++-backed
471
- // persistent hot.data that survives across module re-evaluations.
472
- // cleanCode() strips Vite's __vite__createHotContext assignment, which is
473
- // correct — the runtime's native hot context is better.
460
+ // import.meta.hot is JS-owned: cleanCode() strips Vite's browser
461
+ // __vite__createHotContext assignment and processCodeForDevice
462
+ // injects the NS hot-context prelude (globalThis.__NS_HOT_REGISTRY__,
463
+ // installed by the /__ns_dev__/client bootstrap) for app modules.
474
464
  const projectRoot = server.config?.root || process.cwd();
475
465
  const serverOrigin = getServerOrigin(server);
476
466
  // Served-module import rewrite, routed through the active framework
@@ -563,60 +553,29 @@ export function registerNsModuleServerRoute(server, options) {
563
553
  }
564
554
  }
565
555
  catch { }
566
- // `/ns/rt` and `/ns/core` URL versioning.
556
+ // Every emitted endpoint URL is CANONICAL (unversioned).
567
557
  //
568
- // Older versions of the server emitted `/ns/rt/<ver>` and
569
- // `/ns/core/<ver>` so V8's HTTP module cache would see a
570
- // fresh URL on every save. The runtime canonicalizer
571
- // (`CanonicalizeHttpUrlKey` in HMRSupport.mm) collapses
572
- // these version segments to the bare `/ns/rt` and
573
- // `/ns/core` keys before lookup, so V8 actually saw a
574
- // single cache entry — but the server was doing extra
575
- // work to inject a version segment that the runtime then
576
- // immediately stripped. Now that the runtime supports
577
- // explicit eviction (and these bridge endpoints don't
578
- // change at HMR time anyway), the version segment is
579
- // purely vestigial.
580
- //
581
- // Rather than rip the helpers out (which would touch
582
- // every ensureVersionedImports caller and risk bumping
583
- // older runtimes), we keep them but pass `verNum=0`. The
584
- // helpers still normalize URL shape (strip the absolute
585
- // origin prefix when present) but emit a stable
586
- // `/ns/rt/0` / `/ns/core/0` URL — which collapses to
587
- // `/ns/rt` / `/ns/core` in the runtime.
558
+ // Module identity is literally the URL a versioned
559
+ // `/ns/rt/<ver>` / `/ns/core/<ver>` / `/ns/sfc/<ver>` would
560
+ // create a second module realm. `canonicalizeRtImports` and the
561
+ // strategy's `canonicalizeFrameworkImports` collapse any
562
+ // versioned form (stale cached device code) back to the single
563
+ // canonical URL.
588
564
  try {
589
- const verNum = 0;
590
- code = ensureVersionedRtImports(code, getServerOrigin(server), verNum);
591
- code = strategy.ensureVersionedImports?.(code, getServerOrigin(server), verNum) ?? code;
565
+ code = canonicalizeRtImports(code, getServerOrigin(server));
566
+ code = strategy.canonicalizeFrameworkImports?.(code, getServerOrigin(server)) ?? code;
592
567
  }
593
568
  catch { }
594
569
  // `/ns/m` URL finalize step.
595
570
  //
596
- // `rewriteNsMImportPathForHmr` is a canonicalizer: it
597
- // strips legacy `__ns_hmr__/<tag>/` segments and adds
598
- // `__ns_boot__/b1/` only for boot-tagged requests. The
599
- // `ver` parameter is preserved on the signature for API
600
- // compatibility but is ignored for app modules (cache
601
- // busting is driven by `__nsInvalidateModules`, not URL
602
- // versioning). We pass `'v0'` as a stable placeholder —
603
- // the canonicalizer emits the same URL regardless of
604
- // this value, but a constant placeholder makes the
605
- // contract explicit.
606
- //
607
- // SFC URLs (line below, `/ns/sfc/${verTag}/...`) still
608
- // embed a version because the Vue SFC pathway does not
609
- // yet have an eviction protocol. The runtime
610
- // canonicalizer does NOT strip `/ns/sfc/<ver>/`, so Vue
611
- // users still see per-save SFC re-fetches — that's a
612
- // known follow-up.
571
+ // `canonicalizeNsMImportPath` strips any `__ns_hmr__/<tag>/`
572
+ // and `__ns_boot__/b1/` segments so every emitted URL is the
573
+ // canonical stable form (cache busting is driven by
574
+ // `__NS_DEV__.invalidateModules` + the runtime's eviction nonce, not
575
+ // URL decoration).
613
576
  try {
614
- const verTag = (() => {
615
- const numeric = getNumericServeVersionTag(forcedVer, Number(options.getGraphVersion() || 0));
616
- return numeric > 0 ? `v${numeric}` : 'v0';
617
- })();
618
577
  const origin = getServerOrigin(server);
619
- const rewritePath = (p) => rewriteNsMImportPathForHmr(p, 'v0', bootTaggedRequest);
578
+ const rewritePath = (p) => canonicalizeNsMImportPath(p);
620
579
  // /ns/m URL forms — all collapse to canonical stable
621
580
  // URLs via the `rewriteNsMImportPathForHmr` rewriter.
622
581
  // 1) Static imports: import ... from "/ns/m/..."
@@ -634,9 +593,10 @@ export function registerNsModuleServerRoute(server, options) {
634
593
  code = code.replace(/new\s+URL\(\s*["'](\/ns\/m\/[^"'?]+)(?:\?[^"']*)?["']\s*,\s*import\.meta\.url\s*\)\.href/g, (_m, p1) => `${JSON.stringify(`${origin}${rewritePath(p1)}`)}`);
635
594
  }
636
595
  catch { }
637
- // 7) SFC URLs (Vue) — still versioned. See header comment.
596
+ // 7) SFC URLs (Vue) — canonical, like everything else. Freshness
597
+ // is driven by the Vue client evicting the SFC artifact URL set.
638
598
  try {
639
- code = code.replace(/new\s+URL\(\s*["']\/ns\/sfc(\/[^"'?]+)(?:\?[^"']*)?["']\s*,\s*import\.meta\.url\s*\)\.href/g, (_m, p1) => `${JSON.stringify(`${origin}/ns/sfc/${verTag}${p1}`)}`);
599
+ code = code.replace(/new\s+URL\(\s*["']\/ns\/sfc(\/[^"'?]+)(?:\?[^"']*)?["']\s*,\s*import\.meta\.url\s*\)\.href/g, (_m, p1) => `${JSON.stringify(`${origin}/ns/sfc${p1}`)}`);
640
600
  }
641
601
  catch { }
642
602
  }
@@ -647,11 +607,15 @@ export function registerNsModuleServerRoute(server, options) {
647
607
  code = ensureDestructureCoreImports(code);
648
608
  }
649
609
  catch { }
650
- // Boot-time module graph progress: while the app is still replacing the
651
- // placeholder, emit lightweight progress updates as /ns/m modules begin
652
- // evaluating. This keeps the overlay moving during large initial graphs.
610
+ // Boot-time module graph progress: while the app is still replacing
611
+ // the placeholder, emit lightweight progress updates as /ns/m app
612
+ // modules begin evaluating. The snippet is SELF-GATING (it no-ops
613
+ // once `__NS_HMR_BOOT_COMPLETE__` flips) so it is injected
614
+ // unconditionally — no boot-tagged URL needed. node_modules are
615
+ // deliberately skipped (the heartbeat's wall-clock axis covers
616
+ // vendor stretches; see startBootImportHeartbeat).
653
617
  try {
654
- if (bootTaggedRequest) {
618
+ if (!isNodeMod) {
655
619
  const bootModuleLabel = String(spec || '').replace(/\\/g, '/');
656
620
  const bootProgressSnippet = buildBootProgressSnippet(bootModuleLabel);
657
621
  code = bootProgressSnippet + code;