@nativescript/vite 8.0.0-alpha.67 → 8.0.0-alpha.68

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 (170) hide show
  1. package/configuration/angular.js +78 -182
  2. package/configuration/angular.js.map +1 -1
  3. package/configuration/base.js +10 -139
  4. package/configuration/base.js.map +1 -1
  5. package/helpers/app-css-state.d.ts +20 -0
  6. package/helpers/app-css-state.js.map +1 -1
  7. package/helpers/main-entry.js +44 -4
  8. package/helpers/main-entry.js.map +1 -1
  9. package/helpers/ns-core-external-urls.d.ts +32 -0
  10. package/helpers/ns-core-external-urls.js +107 -0
  11. package/helpers/ns-core-external-urls.js.map +1 -0
  12. package/helpers/typescript-check.js +2 -2
  13. package/helpers/typescript-check.js.map +1 -1
  14. package/helpers/workers.d.ts +0 -8
  15. package/helpers/workers.js +43 -381
  16. package/helpers/workers.js.map +1 -1
  17. package/hmr/client/framework-client-strategy.d.ts +17 -9
  18. package/hmr/client/framework-client-strategy.js +3 -4
  19. package/hmr/client/framework-client-strategy.js.map +1 -1
  20. package/hmr/client/hmr-pending-overlay.js +2 -21
  21. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  22. package/hmr/client/index.d.ts +9 -1
  23. package/hmr/client/index.js +34 -2621
  24. package/hmr/client/index.js.map +1 -1
  25. package/hmr/client/overlay-driver.d.ts +10 -0
  26. package/hmr/client/overlay-driver.js +33 -0
  27. package/hmr/client/overlay-driver.js.map +1 -0
  28. package/hmr/client/protocol-dispatch.d.ts +8 -0
  29. package/hmr/client/protocol-dispatch.js +309 -0
  30. package/hmr/client/protocol-dispatch.js.map +1 -0
  31. package/hmr/client/root-reset.d.ts +15 -0
  32. package/hmr/client/root-reset.js +358 -0
  33. package/hmr/client/root-reset.js.map +1 -0
  34. package/hmr/client/strategy-loader.d.ts +24 -0
  35. package/hmr/client/strategy-loader.js +83 -0
  36. package/hmr/client/strategy-loader.js.map +1 -0
  37. package/hmr/client/update-pipeline.d.ts +27 -0
  38. package/hmr/client/update-pipeline.js +464 -0
  39. package/hmr/client/update-pipeline.js.map +1 -0
  40. package/hmr/client/utils.js +3 -2
  41. package/hmr/client/utils.js.map +1 -1
  42. package/hmr/client/ws-transport.d.ts +21 -0
  43. package/hmr/client/ws-transport.js +344 -0
  44. package/hmr/client/ws-transport.js.map +1 -0
  45. package/hmr/frameworks/angular/build/angular-linker.js +4 -0
  46. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -1
  47. package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
  48. package/hmr/frameworks/angular/build/linker-stats.js +29 -0
  49. package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
  50. package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
  51. package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
  52. package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
  53. package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
  54. package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
  55. package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
  56. package/hmr/frameworks/angular/client/index.d.ts +3 -0
  57. package/hmr/frameworks/angular/client/index.js +28 -42
  58. package/hmr/frameworks/angular/client/index.js.map +1 -1
  59. package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
  60. package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
  61. package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
  62. package/hmr/frameworks/angular/server/strategy.js +15 -11
  63. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  64. package/hmr/frameworks/angular/server/websocket-angular-hot-update.d.ts +12 -0
  65. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +39 -0
  66. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -1
  67. package/hmr/frameworks/react/client/strategy.d.ts +12 -0
  68. package/hmr/frameworks/react/client/strategy.js +27 -0
  69. package/hmr/frameworks/react/client/strategy.js.map +1 -0
  70. package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
  71. package/hmr/frameworks/solid/client/strategy.js +391 -0
  72. package/hmr/frameworks/solid/client/strategy.js.map +1 -0
  73. package/hmr/frameworks/solid/server/strategy.js +2 -0
  74. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  75. package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
  76. package/hmr/frameworks/typescript/client/strategy.js +418 -0
  77. package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
  78. package/hmr/frameworks/typescript/server/strategy.js +2 -0
  79. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  80. package/hmr/frameworks/vue/client/index.d.ts +1 -1
  81. package/hmr/frameworks/vue/client/index.js +40 -319
  82. package/hmr/frameworks/vue/client/index.js.map +1 -1
  83. package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
  84. package/hmr/frameworks/vue/client/navigate-app.js +178 -0
  85. package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
  86. package/hmr/frameworks/vue/client/strategy.d.ts +1 -1
  87. package/hmr/frameworks/vue/client/strategy.js +9 -14
  88. package/hmr/frameworks/vue/client/strategy.js.map +1 -1
  89. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +2 -20
  90. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -1
  91. package/hmr/frameworks/vue/server/strategy.js +3 -0
  92. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  93. package/hmr/server/css-connect-sync.d.ts +28 -0
  94. package/hmr/server/css-connect-sync.js +78 -0
  95. package/hmr/server/css-connect-sync.js.map +1 -0
  96. package/hmr/server/framework-strategy.d.ts +30 -0
  97. package/hmr/server/websocket-hmr-pending.d.ts +0 -8
  98. package/hmr/server/websocket-hmr-pending.js +0 -22
  99. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  100. package/hmr/server/websocket-hot-update.d.ts +3 -0
  101. package/hmr/server/websocket-hot-update.js +63 -36
  102. package/hmr/server/websocket-hot-update.js.map +1 -1
  103. package/hmr/server/websocket-module-bindings.js +23 -5
  104. package/hmr/server/websocket-module-bindings.js.map +1 -1
  105. package/hmr/server/websocket-module-specifiers.d.ts +0 -5
  106. package/hmr/server/websocket-module-specifiers.js +0 -28
  107. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  108. package/hmr/server/websocket-ns-m-paths.d.ts +18 -0
  109. package/hmr/server/websocket-ns-m-paths.js +79 -0
  110. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  111. package/hmr/server/websocket-ns-m-request.d.ts +2 -1
  112. package/hmr/server/websocket-ns-m-request.js +3 -2
  113. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  114. package/hmr/server/websocket-ns-m.js +100 -374
  115. package/hmr/server/websocket-ns-m.js.map +1 -1
  116. package/hmr/server/websocket-served-module-helpers.d.ts +7 -0
  117. package/hmr/server/websocket-served-module-helpers.js +93 -69
  118. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  119. package/hmr/server/websocket.d.ts +0 -1
  120. package/hmr/server/websocket.js +27 -2
  121. package/hmr/server/websocket.js.map +1 -1
  122. package/hmr/shared/ns-globals.d.ts +0 -1
  123. package/hmr/shared/ns-globals.js.map +1 -1
  124. package/hmr/shared/protocol.d.ts +14 -0
  125. package/hmr/shared/protocol.js.map +1 -1
  126. package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
  127. package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
  128. package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
  129. package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
  130. package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
  131. package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
  132. package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
  133. package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
  134. package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
  135. package/hmr/shared/runtime/dev-overlay.d.ts +15 -107
  136. package/hmr/shared/runtime/dev-overlay.js +19 -1336
  137. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  138. package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
  139. package/hmr/shared/runtime/overlay-flag.js +34 -0
  140. package/hmr/shared/runtime/overlay-flag.js.map +1 -0
  141. package/hmr/shared/runtime/root-placeholder.js +3 -2
  142. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  143. package/hmr/shared/runtime/session-bootstrap.js +2 -1
  144. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  145. package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
  146. package/hmr/shared/runtime/vendor-resolve.js +45 -0
  147. package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
  148. package/hmr/shared/vendor/manifest-collect.js +0 -3
  149. package/hmr/shared/vendor/manifest-collect.js.map +1 -1
  150. package/package.json +1 -3
  151. package/runtime/core-aliases-early.js +3 -2
  152. package/runtime/core-aliases-early.js.map +1 -1
  153. package/helpers/module-runner-patch.d.ts +0 -3
  154. package/helpers/module-runner-patch.js +0 -63
  155. package/helpers/module-runner-patch.js.map +0 -1
  156. package/hmr/server/websocket-css-hot-update.d.ts +0 -33
  157. package/hmr/server/websocket-css-hot-update.js +0 -65
  158. package/hmr/server/websocket-css-hot-update.js.map +0 -1
  159. package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
  160. package/hmr/shared/runtime/http-only-boot.js +0 -172
  161. package/hmr/shared/runtime/http-only-boot.js.map +0 -1
  162. package/hmr/vendor-bootstrap.d.ts +0 -1
  163. package/hmr/vendor-bootstrap.js +0 -30
  164. package/hmr/vendor-bootstrap.js.map +0 -1
  165. package/shims/react-reconciler-constants.d.ts +0 -14
  166. package/shims/react-reconciler-constants.js +0 -21
  167. package/shims/react-reconciler-constants.js.map +0 -1
  168. package/shims/react-reconciler.d.ts +0 -8
  169. package/shims/react-reconciler.js +0 -15
  170. package/shims/react-reconciler.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import { deriveHttpOrigin, getCore, getCurrentApp, getHMRWsUrl, getHttpOriginForVite, graph, invalidateModulesByUrls, normalizeSpec, safeDynImport, safeReadDefault, setCurrentApp } from '../../../client/utils.js';
2
2
  import { getGlobalScope } from '../../../shared/runtime/global-scope.js';
3
+ import { resolveVendorModule } from '../../../shared/runtime/vendor-resolve.js';
3
4
  import { findSfcAncestors } from './dep-propagation.js';
4
5
  const APP_VIRTUAL_WITH_SLASH = (() => {
5
6
  // Define substitution does not reach this raw-served file; prefer the
@@ -21,24 +22,8 @@ export const sfcArtifactMap = new Map();
21
22
  // Install dev shims for nativescript-vue navigation to observe and (optionally) rescue
22
23
  export function installNsVueDevShims() {
23
24
  try {
24
- const g = getGlobalScope();
25
- const reg = g.__nsVendorRegistry;
26
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
27
- const getMod = (id) => {
28
- try {
29
- if (reg && reg.has(id))
30
- return reg.get(id);
31
- }
32
- catch { }
33
- try {
34
- if (typeof req === 'function')
35
- return req(id);
36
- }
37
- catch { }
38
- return null;
39
- };
40
- const nv = getMod('nativescript-vue');
41
- const rh = getMod('nativescript-vue/dist/runtimeHelpers');
25
+ const nv = resolveVendorModule('nativescript-vue');
26
+ const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
42
27
  const wrap = (orig, label) => {
43
28
  if (typeof orig !== 'function')
44
29
  return orig;
@@ -91,74 +76,20 @@ export function installNsVueDevShims() {
91
76
  }
92
77
  catch { }
93
78
  }
94
- // initial root component for back fallback
95
- const ORIG_ROOT_COMPONENT = null;
96
79
  // Ensure Vue runtime global functions exist before evaluating SFC artifacts that rely on globalThis.* indirections.
97
80
  export function ensureVueGlobals() {
98
81
  try {
99
82
  const g = globalThis;
100
83
  const vueAlready = g.defineComponent && g.resolveComponent && g.createVNode;
101
- const req = getGlobalScope().__nsVendorRegistry?.get ? getGlobalScope().__nsVendorRequire || getGlobalScope().__nsRequire || getGlobalScope().require : getGlobalScope().__nsRequire || getGlobalScope().require;
102
- const registry = globalThis.__nsVendorRegistry;
103
- let nvMod = null;
104
- let vueMod = null;
105
84
  // Prefer nativescript-vue first so createApp has .start and NSVRoot is available
106
- if (registry && registry.has('nativescript-vue')) {
107
- nvMod = registry.get('nativescript-vue');
108
- }
109
- if (registry && registry.has('vue')) {
110
- vueMod = registry.get('vue');
111
- }
112
- if (!nvMod && typeof req === 'function') {
113
- try {
114
- nvMod = req('nativescript-vue');
115
- }
116
- catch { }
117
- }
118
- if (!vueMod && typeof req === 'function') {
119
- try {
120
- vueMod = req('vue');
121
- }
122
- catch { }
123
- if (!vueMod) {
124
- try {
125
- vueMod = req('@vue/runtime-core');
126
- }
127
- catch { }
128
- }
129
- }
130
- const baseMod = nvMod || vueMod;
131
- let chosenMod = baseMod;
132
- if (!chosenMod) {
133
- // Last-ditch attempts on known ids
134
- try {
135
- chosenMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
136
- }
137
- catch { }
138
- if (!chosenMod) {
139
- try {
140
- chosenMod = req && typeof req === 'function' ? req('vue') : null;
141
- }
142
- catch { }
143
- }
144
- if (!chosenMod)
145
- return;
146
- }
147
- if (!vueMod) {
148
- // Last-ditch attempts on known ids
149
- try {
150
- vueMod = req && typeof req === 'function' ? req('vue') : null;
151
- }
152
- catch { }
153
- if (!vueMod) {
154
- try {
155
- vueMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
156
- }
157
- catch { }
158
- }
159
- if (!vueMod)
160
- return;
161
- }
85
+ const nvMod = resolveVendorModule('nativescript-vue');
86
+ let vueMod = resolveVendorModule('vue') ?? resolveVendorModule('@vue/runtime-core');
87
+ const chosenMod = nvMod || vueMod;
88
+ if (!chosenMod)
89
+ return;
90
+ // No standalone vue realm available: nativescript-vue re-exports the runtime API.
91
+ if (!vueMod)
92
+ vueMod = nvMod;
162
93
  // Polyfill essential runtime helpers often imported from 'vue' by compiled SFC render code
163
94
  try {
164
95
  const polyNormalizeClass = (val) => {
@@ -346,17 +277,7 @@ export function ensurePiniaOnApp(app) {
346
277
  catch { }
347
278
  // Attempt to set active pinia if API is available
348
279
  try {
349
- const registry = g.__nsVendorRegistry;
350
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
351
- let piniaMod = null;
352
- if (registry && registry.has('pinia'))
353
- piniaMod = registry.get('pinia');
354
- if (!piniaMod && typeof req === 'function') {
355
- try {
356
- piniaMod = req('pinia');
357
- }
358
- catch { }
359
- }
280
+ const piniaMod = resolveVendorModule('pinia');
360
281
  const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
361
282
  const setActivePinia = resolved?.setActivePinia;
362
283
  if (typeof setActivePinia === 'function')
@@ -366,18 +287,7 @@ export function ensurePiniaOnApp(app) {
366
287
  return;
367
288
  }
368
289
  // Prefer vendor registry/require to load 'pinia'
369
- const registry = g.__nsVendorRegistry;
370
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
371
- let piniaMod = null;
372
- if (registry && registry.has('pinia')) {
373
- piniaMod = registry.get('pinia');
374
- }
375
- if (!piniaMod && typeof req === 'function') {
376
- try {
377
- piniaMod = req('pinia');
378
- }
379
- catch { }
380
- }
290
+ const piniaMod = resolveVendorModule('pinia');
381
291
  if (!piniaMod)
382
292
  return;
383
293
  const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
@@ -402,16 +312,11 @@ export function ensurePiniaOnApp(app) {
402
312
  // Prefer nativescript-vue's own bootstrap to set up element registry and built-ins
403
313
  export function ensureNsVueBootstrap() {
404
314
  try {
405
- const g = globalThis;
406
315
  if (nsVueInitDone)
407
316
  return;
408
- const reg = g.__nsVendorRegistry;
409
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
410
- if (typeof req !== 'function')
411
- return;
412
317
  // Try full init, which should register core elements and built-in components
413
318
  try {
414
- const nv = req('nativescript-vue/dist/nativescript');
319
+ const nv = resolveVendorModule('nativescript-vue/dist/nativescript');
415
320
  const init = (nv && (nv.init || nv.default?.init)) || undefined;
416
321
  if (typeof init === 'function') {
417
322
  init();
@@ -424,7 +329,7 @@ export function ensureNsVueBootstrap() {
424
329
  catch { }
425
330
  // Fallback: register core elements only
426
331
  try {
427
- const elems = req('nativescript-vue/dist/nativescript/elements');
332
+ const elems = resolveVendorModule('nativescript-vue/dist/nativescript/elements');
428
333
  const fn = (elems && (elems.registerCoreElements || elems.default?.registerCoreElements)) || undefined;
429
334
  if (typeof fn === 'function') {
430
335
  fn();
@@ -441,19 +346,7 @@ function installBuiltInComponentsOnApp(app) {
441
346
  try {
442
347
  if (!app || typeof app.component !== 'function')
443
348
  return;
444
- const g = getGlobalScope();
445
- const reg = g.__nsVendorRegistry;
446
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
447
- if (typeof req !== 'function')
448
- return;
449
- const comps = (() => {
450
- try {
451
- return req('nativescript-vue/dist/components');
452
- }
453
- catch {
454
- return null;
455
- }
456
- })();
349
+ const comps = resolveVendorModule('nativescript-vue/dist/components');
457
350
  const built = comps && (comps.BUILT_IN_COMPONENTS || comps.default?.BUILT_IN_COMPONENTS);
458
351
  if (!built || typeof built !== 'object')
459
352
  return;
@@ -474,52 +367,6 @@ function installBuiltInComponentsOnApp(app) {
474
367
  }
475
368
  catch { }
476
369
  }
477
- // Ensure the Pinia instance is also active in the HTTP ESM module world and that we provide
478
- // the exact piniaSymbol exported by that module, so getActivePinia() and inject() both succeed
479
- // regardless of which module copy a component imports.
480
- async function syncPiniaAcrossEsm(app) {
481
- try {
482
- const g = globalThis;
483
- const piniaInst = g.__NS_HMR_PINIA__ || app?._context?.provides?.pinia;
484
- if (!piniaInst)
485
- return;
486
- // Resolve Pinia from ESM world and set active
487
- let esmUrl = null;
488
- try {
489
- esmUrl = await requestModuleFromServer('pinia');
490
- }
491
- catch { }
492
- if (esmUrl) {
493
- try {
494
- const mod = await safeDynImport(esmUrl);
495
- const resolved = (mod && (mod.default ?? mod)) || mod;
496
- const setActivePinia = resolved?.setActivePinia || mod?.setActivePinia;
497
- const piniaSymbol = resolved?.piniaSymbol || mod?.piniaSymbol;
498
- if (typeof setActivePinia === 'function') {
499
- try {
500
- setActivePinia(piniaInst);
501
- }
502
- catch { }
503
- }
504
- if (piniaSymbol && app?._context?.provides && !app._context.provides[piniaSymbol]) {
505
- try {
506
- app._context.provides[piniaSymbol] = piniaInst;
507
- }
508
- catch { }
509
- try {
510
- g.__NS_PINIA_SYMBOL__ = piniaSymbol;
511
- }
512
- catch { }
513
- }
514
- }
515
- catch (e) {
516
- if (__NS_ENV_VERBOSE__)
517
- console.warn('[hmr-client] syncPiniaAcrossEsm failed import', e);
518
- }
519
- }
520
- }
521
- catch { }
522
- }
523
370
  function bridgePiniaProvides(app, existingApp) {
524
371
  try {
525
372
  const g = getGlobalScope();
@@ -552,17 +399,7 @@ function bridgePiniaProvides(app, existingApp) {
552
399
  }
553
400
  catch { }
554
401
  try {
555
- const vendorReg = g.__nsVendorRegistry;
556
- const req = vendorReg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
557
- let vmod = null;
558
- if (vendorReg && vendorReg.has('pinia'))
559
- vmod = vendorReg.get('pinia');
560
- else if (typeof req === 'function') {
561
- try {
562
- vmod = req('pinia');
563
- }
564
- catch { }
565
- }
402
+ const vmod = resolveVendorModule('pinia');
566
403
  const resolved = (vmod && (vmod.default ?? vmod)) || vmod;
567
404
  const vendorSym = resolved?.piniaSymbol || vmod?.piniaSymbol;
568
405
  if (vendorSym && typeof vendorSym === 'symbol')
@@ -764,24 +601,12 @@ function tryInPlaceVueReload(comp) {
764
601
  export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
765
602
  try {
766
603
  if (typeof msg.path === 'string' && /\.vue$/i.test(msg.path)) {
767
- // Gate updates: only remount if this path is actually marked as changed in the current delta
604
+ // The registry update is the authoritative signal that this SFC changed
605
+ // for the announced version — record it unconditionally so remounts are
606
+ // resilient to out-of-order or dropped delta delivery.
768
607
  try {
769
- const base = String(msg.path).split('?')[0];
770
- const inChanged = sfcChangedIds.has(base) || sfcChangedIds.has(msg.path);
771
- const versionsMatch = sfcChangedVersion != null && sfcChangedVersion === graphVersion;
772
- if (!inChanged || !versionsMatch) {
773
- // Be resilient to out-of-order delivery: treat the registry update itself
774
- // as authoritative signal that this SFC changed for the announced version.
775
- // This unblocks remounts when the delta was dropped or applied earlier than we recorded.
776
- try {
777
- const effectiveVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
778
- sfcChangedVersion = effectiveVersion;
779
- sfcChangedIds.add(base);
780
- if (__NS_ENV_VERBOSE__)
781
- console.log('[hmr][sfc-registry-update] accepting as change (out-of-order)', { path: msg.path, graphVersion, sfcChangedVersion });
782
- }
783
- catch { }
784
- }
608
+ sfcChangedVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
609
+ sfcChangedIds.add(String(msg.path).split('?')[0]);
785
610
  }
786
611
  catch { }
787
612
  try {
@@ -789,7 +614,7 @@ export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
789
614
  const changedPath = String(msg.path);
790
615
  // Default: remount the SFC that changed, so editing a page reflects
791
616
  // immediately even if a different page is displayed.
792
- let comp = await loadSfcComponent(changedPath, 'sfc_update');
617
+ let comp = await loadSfcComponent(changedPath);
793
618
  // Preferred path: patch the changed component's mounted instances in
794
619
  // place (App.vue shell, route, scroll all survive). Returning null tells
795
620
  // the overlay no resetRootView is needed.
@@ -805,7 +630,7 @@ export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
805
630
  if (comp && hmrComponentHasRequiredProps(comp)) {
806
631
  const ancestors = findSfcAncestors(changedPath, graph);
807
632
  for (const ancestor of ancestors) {
808
- const ancestorComp = await loadSfcComponent(ancestor, 'sfc_update_ancestor');
633
+ const ancestorComp = await loadSfcComponent(ancestor);
809
634
  if (ancestorComp && !hmrComponentHasRequiredProps(ancestorComp)) {
810
635
  if (__NS_ENV_VERBOSE__)
811
636
  console.log('[hmr][vue] child SFC needs props; remounting nearest mountable ancestor', { changed: changedPath, ancestor });
@@ -848,22 +673,6 @@ export function recordVuePayloadChanges(changed, graphVersion) {
848
673
  export function sfcChangedInVersion(version) {
849
674
  return sfcChangedVersion != null && sfcChangedVersion === version && sfcChangedIds.size > 0;
850
675
  }
851
- async function waitForSfcMapping(id, timeoutMs = 350) {
852
- if (!/\.vue$/i.test(id))
853
- return true;
854
- const base = id.split('?')[0];
855
- const srcIdx = base.indexOf(APP_VIRTUAL_WITH_SLASH);
856
- const rel = srcIdx !== -1 ? base.slice(srcIdx) : base;
857
- if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
858
- return true;
859
- const start = Date.now();
860
- while (Date.now() - start < timeoutMs) {
861
- await new Promise((r) => setTimeout(r, 30));
862
- if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
863
- return true;
864
- }
865
- return false;
866
- }
867
676
  // Map a graph id (possibly a .vue source path) to actual import spec
868
677
  export function addSfcMapping(originalPath, fileName) {
869
678
  try {
@@ -885,7 +694,7 @@ export function addSfcMapping(originalPath, fileName) {
885
694
  // Build explicit SFC variant URL (script/template). Always preserves the
886
695
  // variant query. CANONICAL (unversioned): module identity is the URL;
887
696
  // freshness comes from the eviction in `evictSfcArtifacts` below.
888
- function resolveSfcVariantSpec(id, type, cacheBustTag) {
697
+ function resolveSfcVariantSpec(id, type) {
889
698
  const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
890
699
  const base = id.split('?')[0];
891
700
  if (!origin)
@@ -894,7 +703,7 @@ function resolveSfcVariantSpec(id, type, cacheBustTag) {
894
703
  return origin + '/ns/sfc' + safePath + `?vue&type=${type}`;
895
704
  }
896
705
  // Resolve deterministic SFC assembler ESM module (canonical, unversioned).
897
- function resolveSfcAssemblerSpec(id, cacheBustTag) {
706
+ function resolveSfcAssemblerSpec(id) {
898
707
  const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
899
708
  const base = id.split('?')[0];
900
709
  if (!origin)
@@ -949,7 +758,7 @@ function evictSfcArtifacts(id) {
949
758
  }
950
759
  // Safely load a component for a .vue SFC. Prefer deterministic assembler first to avoid
951
760
  // any variant-compile or TDZ flakiness; only fall back to variant assembly if needed.
952
- export async function loadSfcComponent(targetVuePath, tag) {
761
+ export async function loadSfcComponent(targetVuePath) {
953
762
  // Minimal mode removed: always go through deterministic assembler + device reset
954
763
  // Ensure Vue globals exist BEFORE evaluating variant modules; their top-level aliasing reads globalThis.* once.
955
764
  ensureVueGlobals();
@@ -962,7 +771,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
962
771
  // Prefer deterministic assembler first so AST normalization (including nav helpers) always applies.
963
772
  try {
964
773
  if (!DISABLE_ASM) {
965
- const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_first'));
774
+ const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
966
775
  const asmComp = asmMod?.default ?? asmMod;
967
776
  if (asmComp && typeof asmComp === 'object') {
968
777
  if (__NS_ENV_VERBOSE__)
@@ -978,11 +787,11 @@ export async function loadSfcComponent(targetVuePath, tag) {
978
787
  // 1) Variant assembly (script then template) – closest to browser behavior
979
788
  try {
980
789
  // Import script variant FIRST to avoid TDZ due to cyclic evaluation between script/template.
981
- const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script', tag + '_script'));
790
+ const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'));
982
791
  // Ensure script default is readable before importing the template; this enforces a stable order.
983
792
  const base = await safeReadDefault(scriptMod);
984
793
  // Now import the template render implementation
985
- const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template', tag + '_template'));
794
+ const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'));
986
795
  if (__NS_ENV_VERBOSE__) {
987
796
  const sKeys = scriptMod ? Object.keys(scriptMod).join(',') : '<none>';
988
797
  const tKeys = templateMod ? Object.keys(templateMod).join(',') : '<none>';
@@ -1002,7 +811,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
1002
811
  try {
1003
812
  if (__NS_ENV_VERBOSE__)
1004
813
  console.log('[hmr][vue-reset][diag] no render from template variant; attempting assembler for', targetVuePath);
1005
- const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_norender'));
814
+ const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
1006
815
  const asmComp = asmMod?.default ?? asmMod;
1007
816
  if (asmComp && typeof asmComp === 'object' && typeof asmComp.render === 'function') {
1008
817
  try {
@@ -1048,7 +857,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
1048
857
  if (__NS_ENV_VERBOSE__)
1049
858
  console.log('[hmr][vue-reset][diag] no script exports detected; attempting assembler import for', targetVuePath);
1050
859
  try {
1051
- const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm'));
860
+ const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
1052
861
  const compAsm = asm?.default ?? asm;
1053
862
  if (compAsm && typeof compAsm === 'object') {
1054
863
  if (__NS_ENV_VERBOSE__)
@@ -1106,7 +915,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
1106
915
  if (DISABLE_ASM)
1107
916
  throw new Error('asm disabled by __NS_HMR_DISABLE_ASM__');
1108
917
  await new Promise((r) => setTimeout(r, 10));
1109
- const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_final'));
918
+ const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
1110
919
  try {
1111
920
  const comp = await safeReadDefault(mod);
1112
921
  if (comp)
@@ -1147,25 +956,9 @@ export function getRootForVue(newComponent, state) {
1147
956
  catch { }
1148
957
  try {
1149
958
  if (!RootCtor) {
1150
- const registry = g.__nsVendorRegistry;
1151
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
1152
- let domMod = null;
1153
- if (registry && registry.has('nativescript-vue/dist/dom')) {
1154
- domMod = registry.get('nativescript-vue/dist/dom');
1155
- if (__NS_ENV_VERBOSE__)
1156
- console.log('[hmr-client] [createRoot] NS DOM from vendor registry');
1157
- }
1158
- else if (typeof req === 'function') {
1159
- try {
1160
- domMod = req('nativescript-vue/dist/dom');
1161
- if (__NS_ENV_VERBOSE__)
1162
- console.log('[hmr-client] [createRoot] NS DOM via require');
1163
- }
1164
- catch (e) {
1165
- if (__NS_ENV_VERBOSE__)
1166
- console.warn('[hmr-client] [createRoot] NS DOM require failed', e);
1167
- }
1168
- }
959
+ const domMod = resolveVendorModule('nativescript-vue/dist/dom');
960
+ if (__NS_ENV_VERBOSE__)
961
+ console.log('[hmr-client] [createRoot] NS DOM', domMod ? 'resolved from vendor chain' : 'unresolved');
1169
962
  if (domMod) {
1170
963
  const nsDom = (domMod && (domMod.default ?? domMod)) || domMod;
1171
964
  const ctor = nsDom?.NSVRoot || (nsDom?.default && nsDom.default.NSVRoot) || domMod?.NSVRoot;
@@ -1218,17 +1011,7 @@ export function getRootForVue(newComponent, state) {
1218
1011
  console.log('[hmr-client] [createRoot] app created via createApp');
1219
1012
  }
1220
1013
  try {
1221
- const registry = g.__nsVendorRegistry;
1222
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
1223
- let rh = null;
1224
- if (registry && registry.has('nativescript-vue/dist/runtimeHelpers'))
1225
- rh = registry.get('nativescript-vue/dist/runtimeHelpers');
1226
- if (!rh && typeof req === 'function') {
1227
- try {
1228
- rh = req('nativescript-vue/dist/runtimeHelpers');
1229
- }
1230
- catch { }
1231
- }
1014
+ const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
1232
1015
  const setRootApp = rh && (rh.setRootApp || rh.default?.setRootApp);
1233
1016
  if (typeof setRootApp === 'function') {
1234
1017
  setRootApp(app);
@@ -1236,15 +1019,7 @@ export function getRootForVue(newComponent, state) {
1236
1019
  console.log('[hmr-client] [createRoot] runtimeHelpers.setRootApp applied');
1237
1020
  }
1238
1021
  try {
1239
- let nv = null;
1240
- if (registry && registry.has('nativescript-vue'))
1241
- nv = registry.get('nativescript-vue');
1242
- if (!nv && typeof req === 'function') {
1243
- try {
1244
- nv = req('nativescript-vue');
1245
- }
1246
- catch { }
1247
- }
1022
+ const nv = resolveVendorModule('nativescript-vue');
1248
1023
  const setRootApp2 = nv && (nv.setRootApp || nv.default?.setRootApp);
1249
1024
  if (typeof setRootApp2 === 'function') {
1250
1025
  setRootApp2(app);
@@ -1276,20 +1051,6 @@ export function getRootForVue(newComponent, state) {
1276
1051
  if (__NS_ENV_VERBOSE__)
1277
1052
  console.warn('[hmr-client] [createRoot] ensurePiniaOnApp failed', e);
1278
1053
  }
1279
- try {
1280
- (async () => {
1281
- try {
1282
- await syncPiniaAcrossEsm(app);
1283
- if (__NS_ENV_VERBOSE__)
1284
- console.log('[hmr-client] [createRoot] Pinia state sync requested');
1285
- }
1286
- catch (e) {
1287
- if (__NS_ENV_VERBOSE__)
1288
- console.warn('[hmr-client] [createRoot] syncPiniaAcrossEsm failed', e);
1289
- }
1290
- })();
1291
- }
1292
- catch { }
1293
1054
  try {
1294
1055
  bridgePiniaProvides(app, existingApp);
1295
1056
  if (__NS_ENV_VERBOSE__)
@@ -1440,7 +1201,7 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1440
1201
  if (!g.__nsAttemptBackRemount) {
1441
1202
  g.__nsAttemptBackRemount = () => {
1442
1203
  try {
1443
- const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__ || ORIG_ROOT_COMPONENT;
1204
+ const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
1444
1205
  if (orig) {
1445
1206
  performResetRoot(orig);
1446
1207
  return true;
@@ -1482,7 +1243,7 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1482
1243
  // fall through to fallback
1483
1244
  }
1484
1245
  // Fallback: reset to original root component if available
1485
- const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__ || ORIG_ROOT_COMPONENT;
1246
+ const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
1486
1247
  if (orig) {
1487
1248
  try {
1488
1249
  // Reuse the proven remount pipeline for consistency
@@ -1498,44 +1259,4 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1498
1259
  }
1499
1260
  catch { }
1500
1261
  }
1501
- async function requestModuleFromServer(name) {
1502
- try {
1503
- // Derive the dev-server origin (mirrors other resolver helpers in this file)
1504
- const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
1505
- if (!origin)
1506
- return null;
1507
- // Candidate URL patterns that a Vite-like server might expose for resolving modules to importable URLs.
1508
- const candidates = [
1509
- // Vite serves bare imports under /@modules/<name>
1510
- `${origin.replace(/\/$/, '')}/@modules/${encodeURIComponent(name)}`,
1511
- // Some setups use @id for resolved module ids
1512
- `${origin.replace(/\/$/, '')}/@id/${encodeURIComponent(name)}`,
1513
- // Custom-ish endpoint pattern used elsewhere in this project style
1514
- `${origin.replace(/\/$/, '')}/ns/esmmod?name=${encodeURIComponent(name)}`,
1515
- ];
1516
- // Probe each candidate with a lightweight HEAD request first; if allowed, return the candidate URL.
1517
- for (const url of candidates) {
1518
- try {
1519
- const res = await fetch(url, { method: 'HEAD' });
1520
- if (res && (res.ok || res.status === 200))
1521
- return url;
1522
- }
1523
- catch {
1524
- // ignore and try next
1525
- }
1526
- }
1527
- // As a final attempt, try GET on the first candidate and return if we get a module-like response.
1528
- try {
1529
- const url = candidates[0];
1530
- const res = await fetch(url, { method: 'GET' });
1531
- if (res && res.ok)
1532
- return url;
1533
- }
1534
- catch { }
1535
- return null;
1536
- }
1537
- catch {
1538
- return null;
1539
- }
1540
- }
1541
1262
  //# sourceMappingURL=index.js.map