@nativescript/vite 8.0.0-alpha.9 → 8.0.0-rc.0

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 (544) hide show
  1. package/README.md +73 -14
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +196 -217
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +151 -103
  7. package/configuration/base.js.map +1 -1
  8. package/configuration/javascript.js +14 -93
  9. package/configuration/javascript.js.map +1 -1
  10. package/configuration/react.js +41 -73
  11. package/configuration/react.js.map +1 -1
  12. package/configuration/solid.js +51 -6
  13. package/configuration/solid.js.map +1 -1
  14. package/configuration/typescript.js +11 -92
  15. package/configuration/typescript.js.map +1 -1
  16. package/helpers/app-components.d.ts +2 -1
  17. package/helpers/app-components.js.map +1 -1
  18. package/helpers/app-css-refresh.d.ts +31 -0
  19. package/helpers/app-css-refresh.js +43 -0
  20. package/helpers/app-css-refresh.js.map +1 -0
  21. package/helpers/app-css-state.d.ts +17 -0
  22. package/helpers/app-css-state.js +51 -0
  23. package/helpers/app-css-state.js.map +1 -0
  24. package/helpers/bundler-context.d.ts +11 -0
  25. package/helpers/bundler-context.js +71 -0
  26. package/helpers/bundler-context.js.map +1 -0
  27. package/helpers/cli-flags.d.ts +12 -0
  28. package/helpers/cli-flags.js +34 -0
  29. package/helpers/cli-flags.js.map +1 -1
  30. package/helpers/css-platform-plugin.d.ts +14 -0
  31. package/helpers/css-platform-plugin.js +43 -25
  32. package/helpers/css-platform-plugin.js.map +1 -1
  33. package/helpers/dev-host.d.ts +360 -0
  34. package/helpers/dev-host.js +694 -0
  35. package/helpers/dev-host.js.map +1 -0
  36. package/helpers/dynamic-import-plugin.d.ts +2 -1
  37. package/helpers/dynamic-import-plugin.js +59 -53
  38. package/helpers/dynamic-import-plugin.js.map +1 -1
  39. package/helpers/esbuild-platform-resolver.js +4 -1
  40. package/helpers/esbuild-platform-resolver.js.map +1 -1
  41. package/helpers/external-configs.d.ts +10 -12
  42. package/helpers/external-configs.js +58 -35
  43. package/helpers/external-configs.js.map +1 -1
  44. package/helpers/flavor.d.ts +13 -0
  45. package/helpers/flavor.js +18 -1
  46. package/helpers/flavor.js.map +1 -1
  47. package/helpers/global-defines.d.ts +99 -33
  48. package/helpers/global-defines.js +187 -66
  49. package/helpers/global-defines.js.map +1 -1
  50. package/helpers/hmr-scope.d.ts +26 -0
  51. package/helpers/hmr-scope.js +67 -0
  52. package/helpers/hmr-scope.js.map +1 -0
  53. package/helpers/init.js +6 -20
  54. package/helpers/init.js.map +1 -1
  55. package/helpers/logging.js +29 -1
  56. package/helpers/logging.js.map +1 -1
  57. package/helpers/main-entry.d.ts +4 -1
  58. package/helpers/main-entry.js +293 -40
  59. package/helpers/main-entry.js.map +1 -1
  60. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  61. package/helpers/nativeclass-esbuild-plugin.js +6 -1
  62. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  63. package/helpers/nativeclass-transform.d.ts +13 -0
  64. package/helpers/nativeclass-transform.js +37 -7
  65. package/helpers/nativeclass-transform.js.map +1 -1
  66. package/helpers/nativeclass-transformer-plugin.js +8 -3
  67. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  68. package/helpers/nativescript-package-resolver.js +10 -62
  69. package/helpers/nativescript-package-resolver.js.map +1 -1
  70. package/helpers/normalize-id.d.ts +42 -0
  71. package/helpers/normalize-id.js +60 -0
  72. package/helpers/normalize-id.js.map +1 -0
  73. package/helpers/ns-core-external-urls.d.ts +32 -0
  74. package/helpers/ns-core-external-urls.js +107 -0
  75. package/helpers/ns-core-external-urls.js.map +1 -0
  76. package/helpers/ns-core-url.d.ts +26 -3
  77. package/helpers/ns-core-url.js +66 -8
  78. package/helpers/ns-core-url.js.map +1 -1
  79. package/helpers/optimize-deps.d.ts +16 -0
  80. package/helpers/optimize-deps.js +17 -0
  81. package/helpers/optimize-deps.js.map +1 -0
  82. package/helpers/package-platform-aliases.js +34 -49
  83. package/helpers/package-platform-aliases.js.map +1 -1
  84. package/helpers/platform-types.d.ts +2 -0
  85. package/helpers/platform-types.js +2 -0
  86. package/helpers/platform-types.js.map +1 -0
  87. package/helpers/postcss-platform-config.d.ts +17 -1
  88. package/helpers/postcss-platform-config.js +20 -37
  89. package/helpers/postcss-platform-config.js.map +1 -1
  90. package/helpers/resolve-main-field-platform.d.ts +20 -0
  91. package/helpers/resolve-main-field-platform.js +49 -0
  92. package/helpers/resolve-main-field-platform.js.map +1 -0
  93. package/helpers/resolver.js +17 -2
  94. package/helpers/resolver.js.map +1 -1
  95. package/helpers/theme-core-plugins.js +1 -1
  96. package/helpers/theme-core-plugins.js.map +1 -1
  97. package/helpers/ts-config-paths.d.ts +32 -0
  98. package/helpers/ts-config-paths.js +143 -62
  99. package/helpers/ts-config-paths.js.map +1 -1
  100. package/helpers/typescript-check.d.ts +2 -1
  101. package/helpers/typescript-check.js +4 -4
  102. package/helpers/typescript-check.js.map +1 -1
  103. package/helpers/ui-registration.d.ts +21 -0
  104. package/helpers/ui-registration.js +156 -0
  105. package/helpers/ui-registration.js.map +1 -0
  106. package/helpers/utils.d.ts +9 -0
  107. package/helpers/utils.js +22 -2
  108. package/helpers/utils.js.map +1 -1
  109. package/helpers/vite-package-version.d.ts +7 -0
  110. package/helpers/vite-package-version.js +44 -0
  111. package/helpers/vite-package-version.js.map +1 -0
  112. package/helpers/workers.d.ts +33 -0
  113. package/helpers/workers.js +237 -10
  114. package/helpers/workers.js.map +1 -1
  115. package/hmr/client/css-handler.d.ts +2 -1
  116. package/hmr/client/css-handler.js +63 -32
  117. package/hmr/client/css-handler.js.map +1 -1
  118. package/hmr/client/css-update-overlay.d.ts +18 -0
  119. package/hmr/client/css-update-overlay.js +27 -0
  120. package/hmr/client/css-update-overlay.js.map +1 -0
  121. package/hmr/client/framework-client-strategy.d.ts +87 -0
  122. package/hmr/client/framework-client-strategy.js +18 -0
  123. package/hmr/client/framework-client-strategy.js.map +1 -0
  124. package/hmr/client/hmr-pending-overlay.d.ts +0 -14
  125. package/hmr/client/hmr-pending-overlay.js +2 -11
  126. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  127. package/hmr/client/hot-context.d.ts +67 -0
  128. package/hmr/client/hot-context.js +307 -0
  129. package/hmr/client/hot-context.js.map +1 -0
  130. package/hmr/client/index.d.ts +9 -1
  131. package/hmr/client/index.js +70 -1970
  132. package/hmr/client/index.js.map +1 -1
  133. package/hmr/client/overlay-driver.d.ts +10 -0
  134. package/hmr/client/overlay-driver.js +33 -0
  135. package/hmr/client/overlay-driver.js.map +1 -0
  136. package/hmr/client/protocol-dispatch.d.ts +8 -0
  137. package/hmr/client/protocol-dispatch.js +308 -0
  138. package/hmr/client/protocol-dispatch.js.map +1 -0
  139. package/hmr/client/root-reset.d.ts +15 -0
  140. package/hmr/client/root-reset.js +358 -0
  141. package/hmr/client/root-reset.js.map +1 -0
  142. package/hmr/client/strategy-loader.d.ts +24 -0
  143. package/hmr/client/strategy-loader.js +100 -0
  144. package/hmr/client/strategy-loader.js.map +1 -0
  145. package/hmr/client/update-pipeline.d.ts +27 -0
  146. package/hmr/client/update-pipeline.js +464 -0
  147. package/hmr/client/update-pipeline.js.map +1 -0
  148. package/hmr/client/utils.d.ts +9 -1
  149. package/hmr/client/utils.js +117 -97
  150. package/hmr/client/utils.js.map +1 -1
  151. package/hmr/client/ws-transport.d.ts +21 -0
  152. package/hmr/client/ws-transport.js +323 -0
  153. package/hmr/client/ws-transport.js.map +1 -0
  154. package/hmr/entry-runtime.d.ts +2 -1
  155. package/hmr/entry-runtime.js +279 -44
  156. package/hmr/entry-runtime.js.map +1 -1
  157. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  158. package/hmr/frameworks/angular/build/angular-linker.js +113 -0
  159. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  160. package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.js +2 -70
  161. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  162. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  163. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  164. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  165. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  166. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  167. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  168. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  169. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  170. package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
  171. package/hmr/frameworks/angular/build/linker-stats.js +29 -0
  172. package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
  173. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  174. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  175. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  176. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  177. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  178. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  179. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  180. package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
  181. package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
  182. package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
  183. package/hmr/frameworks/angular/build/util.js.map +1 -0
  184. package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
  185. package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
  186. package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
  187. package/hmr/frameworks/angular/client/index.d.ts +0 -1
  188. package/hmr/frameworks/angular/client/index.js +360 -194
  189. package/hmr/frameworks/angular/client/index.js.map +1 -1
  190. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  191. package/hmr/frameworks/angular/client/strategy.js +19 -0
  192. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  193. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  194. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  195. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  196. package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
  197. package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
  198. package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
  199. package/hmr/frameworks/angular/server/strategy.js +668 -13
  200. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  201. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  202. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  203. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +27 -11
  204. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +179 -107
  205. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  206. package/hmr/frameworks/react/client/strategy.d.ts +12 -0
  207. package/hmr/frameworks/react/client/strategy.js +27 -0
  208. package/hmr/frameworks/react/client/strategy.js.map +1 -0
  209. package/hmr/frameworks/react/server/strategy.d.ts +2 -0
  210. package/hmr/frameworks/react/server/strategy.js +230 -0
  211. package/hmr/frameworks/react/server/strategy.js.map +1 -0
  212. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  213. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  214. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  215. package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
  216. package/hmr/frameworks/solid/client/app-runtime.js +252 -0
  217. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
  218. package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
  219. package/hmr/frameworks/solid/client/strategy.js +391 -0
  220. package/hmr/frameworks/solid/client/strategy.js.map +1 -0
  221. package/hmr/frameworks/solid/server/strategy.js +293 -16
  222. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  223. package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
  224. package/hmr/frameworks/typescript/client/strategy.js +418 -0
  225. package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
  226. package/hmr/frameworks/typescript/server/strategy.js +40 -14
  227. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  228. package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
  229. package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
  230. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  231. package/hmr/frameworks/vue/client/index.d.ts +10 -1
  232. package/hmr/frameworks/vue/client/index.js +270 -521
  233. package/hmr/frameworks/vue/client/index.js.map +1 -1
  234. package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
  235. package/hmr/frameworks/vue/client/navigate-app.js +178 -0
  236. package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
  237. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  238. package/hmr/frameworks/vue/client/strategy.js +152 -0
  239. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  240. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  241. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
  242. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  243. package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
  244. package/hmr/frameworks/vue/server/compiler.js +3 -1
  245. package/hmr/frameworks/vue/server/compiler.js.map +1 -1
  246. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  247. package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
  248. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  249. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  250. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  251. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  252. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  253. package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
  254. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  255. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
  256. package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
  257. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  258. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  259. package/hmr/frameworks/vue/server/strategy.js +291 -7
  260. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  261. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  262. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  263. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  264. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  265. package/hmr/helpers/ast-normalizer.js +109 -14
  266. package/hmr/helpers/ast-normalizer.js.map +1 -1
  267. package/hmr/helpers/package-exports.d.ts +16 -0
  268. package/hmr/helpers/package-exports.js +396 -0
  269. package/hmr/helpers/package-exports.js.map +1 -0
  270. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  271. package/hmr/helpers/vendor-rewrite.js +5 -3
  272. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  273. package/hmr/server/boot-recording.d.ts +51 -0
  274. package/hmr/server/boot-recording.js +214 -0
  275. package/hmr/server/boot-recording.js.map +1 -0
  276. package/hmr/server/constants.js +7 -1
  277. package/hmr/server/constants.js.map +1 -1
  278. package/hmr/server/content-css-update.d.ts +54 -0
  279. package/hmr/server/content-css-update.js +78 -0
  280. package/hmr/server/content-css-update.js.map +1 -0
  281. package/hmr/server/core-bundle.d.ts +140 -0
  282. package/hmr/server/core-bundle.js +614 -0
  283. package/hmr/server/core-bundle.js.map +1 -0
  284. package/hmr/server/core-sanitize.d.ts +86 -7
  285. package/hmr/server/core-sanitize.js +155 -37
  286. package/hmr/server/core-sanitize.js.map +1 -1
  287. package/hmr/server/css-connect-sync.d.ts +28 -0
  288. package/hmr/server/css-connect-sync.js +59 -0
  289. package/hmr/server/css-connect-sync.js.map +1 -0
  290. package/hmr/server/css-device-module.d.ts +28 -0
  291. package/hmr/server/css-device-module.js +44 -0
  292. package/hmr/server/css-device-module.js.map +1 -0
  293. package/hmr/server/css-update-message.d.ts +23 -0
  294. package/hmr/server/css-update-message.js +41 -0
  295. package/hmr/server/css-update-message.js.map +1 -0
  296. package/hmr/server/deps-bundle.d.ts +233 -0
  297. package/hmr/server/deps-bundle.js +1022 -0
  298. package/hmr/server/deps-bundle.js.map +1 -0
  299. package/hmr/server/device-transform-helpers.d.ts +24 -0
  300. package/hmr/server/device-transform-helpers.js +408 -0
  301. package/hmr/server/device-transform-helpers.js.map +1 -0
  302. package/hmr/server/framework-strategy.d.ts +182 -11
  303. package/hmr/server/hmr-module-graph.d.ts +37 -0
  304. package/hmr/server/hmr-module-graph.js +215 -0
  305. package/hmr/server/hmr-module-graph.js.map +1 -0
  306. package/hmr/server/import-map.d.ts +57 -23
  307. package/hmr/server/import-map.js +142 -70
  308. package/hmr/server/import-map.js.map +1 -1
  309. package/hmr/server/index.js +7 -16
  310. package/hmr/server/index.js.map +1 -1
  311. package/hmr/server/node-builtins-route.d.ts +12 -0
  312. package/hmr/server/node-builtins-route.js +86 -0
  313. package/hmr/server/node-builtins-route.js.map +1 -0
  314. package/hmr/server/ns-m-response-memo.d.ts +10 -0
  315. package/hmr/server/ns-m-response-memo.js +33 -0
  316. package/hmr/server/ns-m-response-memo.js.map +1 -0
  317. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  318. package/hmr/server/ns-rt-bridge.js +131 -0
  319. package/hmr/server/ns-rt-bridge.js.map +1 -0
  320. package/hmr/server/ns-rt-route.d.ts +5 -0
  321. package/hmr/server/ns-rt-route.js +39 -0
  322. package/hmr/server/ns-rt-route.js.map +1 -0
  323. package/hmr/server/perf-instrumentation.d.ts +1 -1
  324. package/hmr/server/perf-instrumentation.js +3 -1
  325. package/hmr/server/perf-instrumentation.js.map +1 -1
  326. package/hmr/server/process-code-for-device.d.ts +44 -0
  327. package/hmr/server/process-code-for-device.js +834 -0
  328. package/hmr/server/process-code-for-device.js.map +1 -0
  329. package/hmr/server/require-guard.d.ts +1 -0
  330. package/hmr/server/require-guard.js +12 -0
  331. package/hmr/server/require-guard.js.map +1 -0
  332. package/hmr/server/rewrite-imports.d.ts +2 -0
  333. package/hmr/server/rewrite-imports.js +631 -0
  334. package/hmr/server/rewrite-imports.js.map +1 -0
  335. package/hmr/server/route-helpers.d.ts +7 -0
  336. package/hmr/server/route-helpers.js +13 -0
  337. package/hmr/server/route-helpers.js.map +1 -0
  338. package/hmr/server/runtime-graph-filter.js +8 -1
  339. package/hmr/server/runtime-graph-filter.js.map +1 -1
  340. package/hmr/server/server-origin.d.ts +2 -0
  341. package/hmr/server/server-origin.js +88 -0
  342. package/hmr/server/server-origin.js.map +1 -0
  343. package/hmr/server/shared-transform-request.js +1 -2
  344. package/hmr/server/shared-transform-request.js.map +1 -1
  345. package/hmr/server/socket-utils.d.ts +10 -0
  346. package/hmr/server/socket-utils.js +14 -0
  347. package/hmr/server/socket-utils.js.map +1 -0
  348. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  349. package/hmr/server/transform-cache-invalidation.js +156 -0
  350. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  351. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  352. package/hmr/server/vendor-bare-module-shims.js +80 -0
  353. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  354. package/hmr/server/vite-plugin.d.ts +1 -0
  355. package/hmr/server/vite-plugin.js +211 -53
  356. package/hmr/server/vite-plugin.js.map +1 -1
  357. package/hmr/server/websocket-core-bridge.d.ts +51 -4
  358. package/hmr/server/websocket-core-bridge.js +62 -49
  359. package/hmr/server/websocket-core-bridge.js.map +1 -1
  360. package/hmr/server/websocket-device-transform.d.ts +3 -0
  361. package/hmr/server/websocket-device-transform.js +7 -0
  362. package/hmr/server/websocket-device-transform.js.map +1 -0
  363. package/hmr/server/websocket-hmr-pending.d.ts +2 -16
  364. package/hmr/server/websocket-hmr-pending.js +0 -22
  365. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  366. package/hmr/server/websocket-hot-update.d.ts +80 -0
  367. package/hmr/server/websocket-hot-update.js +295 -0
  368. package/hmr/server/websocket-hot-update.js.map +1 -0
  369. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  370. package/hmr/server/websocket-import-map-route.js +51 -0
  371. package/hmr/server/websocket-import-map-route.js.map +1 -0
  372. package/hmr/server/websocket-module-bindings.d.ts +15 -0
  373. package/hmr/server/websocket-module-bindings.js +36 -3
  374. package/hmr/server/websocket-module-bindings.js.map +1 -1
  375. package/hmr/server/websocket-module-specifiers.d.ts +0 -5
  376. package/hmr/server/websocket-module-specifiers.js +29 -30
  377. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  378. package/hmr/server/websocket-ns-core.d.ts +34 -0
  379. package/hmr/server/websocket-ns-core.js +414 -0
  380. package/hmr/server/websocket-ns-core.js.map +1 -0
  381. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  382. package/hmr/server/websocket-ns-entry.js +163 -0
  383. package/hmr/server/websocket-ns-entry.js.map +1 -0
  384. package/hmr/server/websocket-ns-m-paths.d.ts +19 -3
  385. package/hmr/server/websocket-ns-m-paths.js +98 -75
  386. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  387. package/hmr/server/websocket-ns-m-request.d.ts +2 -1
  388. package/hmr/server/websocket-ns-m-request.js +3 -2
  389. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  390. package/hmr/server/websocket-ns-m.d.ts +52 -0
  391. package/hmr/server/websocket-ns-m.js +590 -0
  392. package/hmr/server/websocket-ns-m.js.map +1 -0
  393. package/hmr/server/websocket-served-module-helpers.d.ts +56 -3
  394. package/hmr/server/websocket-served-module-helpers.js +444 -140
  395. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  396. package/hmr/server/websocket-txn.js +6 -9
  397. package/hmr/server/websocket-txn.js.map +1 -1
  398. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  399. package/hmr/server/websocket-vendor-unifier.js +4 -9
  400. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  401. package/hmr/server/websocket.d.ts +7 -40
  402. package/hmr/server/websocket.js +661 -6751
  403. package/hmr/server/websocket.js.map +1 -1
  404. package/hmr/shared/ns-globals.d.ts +107 -0
  405. package/hmr/shared/ns-globals.js +29 -0
  406. package/hmr/shared/ns-globals.js.map +1 -0
  407. package/hmr/shared/protocol.d.ts +157 -0
  408. package/hmr/shared/protocol.js +28 -0
  409. package/hmr/shared/protocol.js.map +1 -0
  410. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  411. package/hmr/shared/runtime/boot-complete.js +32 -0
  412. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  413. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  414. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  415. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  416. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  417. package/hmr/shared/runtime/boot-progress.js +134 -0
  418. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  419. package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
  420. package/hmr/shared/runtime/boot-timeline.js +8 -19
  421. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  422. package/hmr/shared/runtime/browser-runtime-contract.d.ts +58 -25
  423. package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
  424. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  425. package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
  426. package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
  427. package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
  428. package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
  429. package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
  430. package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
  431. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  432. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  433. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  434. package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
  435. package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
  436. package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
  437. package/hmr/shared/runtime/dev-overlay.d.ts +23 -69
  438. package/hmr/shared/runtime/dev-overlay.js +67 -1011
  439. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  440. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  441. package/hmr/shared/runtime/global-scope.js +21 -0
  442. package/hmr/shared/runtime/global-scope.js.map +1 -0
  443. package/hmr/shared/runtime/hooks.js +2 -1
  444. package/hmr/shared/runtime/hooks.js.map +1 -1
  445. package/hmr/shared/runtime/launch-bridge.d.ts +9 -0
  446. package/hmr/shared/runtime/launch-bridge.js +98 -0
  447. package/hmr/shared/runtime/launch-bridge.js.map +1 -0
  448. package/hmr/shared/runtime/module-provenance.js +3 -2
  449. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  450. package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
  451. package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
  452. package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
  453. package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
  454. package/hmr/shared/runtime/overlay-flag.js +34 -0
  455. package/hmr/shared/runtime/overlay-flag.js.map +1 -0
  456. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  457. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  458. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  459. package/hmr/shared/runtime/root-placeholder.js +382 -157
  460. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  461. package/hmr/shared/runtime/session-bootstrap.js +209 -54
  462. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  463. package/hmr/shared/runtime/vendor-bootstrap.js +2 -1
  464. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  465. package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
  466. package/hmr/shared/runtime/vendor-resolve.js +45 -0
  467. package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
  468. package/hmr/shared/runtime/worker-tracking.d.ts +28 -0
  469. package/hmr/shared/runtime/worker-tracking.js +114 -0
  470. package/hmr/shared/runtime/worker-tracking.js.map +1 -0
  471. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  472. package/hmr/shared/vendor/manifest-collect.js +909 -0
  473. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  474. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  475. package/hmr/shared/vendor/manifest-loader.js +5 -3
  476. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  477. package/hmr/shared/vendor/manifest.d.ts +10 -35
  478. package/hmr/shared/vendor/manifest.js +154 -978
  479. package/hmr/shared/vendor/manifest.js.map +1 -1
  480. package/hmr/shared/vendor/registry.d.ts +2 -0
  481. package/hmr/shared/vendor/registry.js +14 -0
  482. package/hmr/shared/vendor/registry.js.map +1 -1
  483. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  484. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  485. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  486. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +107 -0
  487. package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
  488. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  489. package/package.json +63 -13
  490. package/runtime/core-aliases-early.js +11 -16
  491. package/runtime/core-aliases-early.js.map +1 -1
  492. package/shims/react-jsx-runtime.d.ts +4 -0
  493. package/shims/react-jsx-runtime.js +61 -0
  494. package/shims/react-jsx-runtime.js.map +1 -0
  495. package/helpers/angular/angular-linker.d.ts +0 -13
  496. package/helpers/angular/angular-linker.js +0 -185
  497. package/helpers/angular/angular-linker.js.map +0 -1
  498. package/helpers/angular/inject-component-hmr-registration.js.map +0 -1
  499. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  500. package/helpers/angular/shared-linker.d.ts +0 -11
  501. package/helpers/angular/shared-linker.js +0 -75
  502. package/helpers/angular/shared-linker.js.map +0 -1
  503. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  504. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  505. package/helpers/angular/util.js.map +0 -1
  506. package/helpers/module-runner-patch.d.ts +0 -3
  507. package/helpers/module-runner-patch.js +0 -63
  508. package/helpers/module-runner-patch.js.map +0 -1
  509. package/helpers/prelink-angular.d.ts +0 -2
  510. package/helpers/prelink-angular.js +0 -114
  511. package/helpers/prelink-angular.js.map +0 -1
  512. package/hmr/server/websocket-angular-entry.js.map +0 -1
  513. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  514. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
  515. package/hmr/server/websocket-ns-m-finalize.js +0 -88
  516. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  517. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  518. package/hmr/server/websocket-runtime-compat.js +0 -287
  519. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  520. package/hmr/server/websocket-vue-sfc.d.ts +0 -27
  521. package/hmr/server/websocket-vue-sfc.js +0 -1069
  522. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  523. package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
  524. package/hmr/shared/runtime/http-only-boot.js +0 -171
  525. package/hmr/shared/runtime/http-only-boot.js.map +0 -1
  526. package/hmr/vendor-bootstrap.d.ts +0 -3
  527. package/hmr/vendor-bootstrap.js +0 -32
  528. package/hmr/vendor-bootstrap.js.map +0 -1
  529. package/shims/react-reconciler-constants.d.ts +0 -14
  530. package/shims/react-reconciler-constants.js +0 -21
  531. package/shims/react-reconciler-constants.js.map +0 -1
  532. package/shims/react-reconciler.d.ts +0 -8
  533. package/shims/react-reconciler.js +0 -15
  534. package/shims/react-reconciler.js.map +0 -1
  535. package/transformers/NativeClass/index.d.ts +0 -2
  536. package/transformers/NativeClass/index.js +0 -222
  537. package/transformers/NativeClass/index.js.map +0 -1
  538. /package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.d.ts +0 -0
  539. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  540. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  541. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  542. /package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +0 -0
  543. /package/{helpers/angular → hmr/frameworks/angular/build}/util.js +0 -0
  544. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -1,6 +1,12 @@
1
- import { deriveHttpOrigin, getCore, getCurrentApp, getGraphVersion, getHMRWsUrl, getHttpOriginForVite, normalizeSpec, safeDynImport, safeReadDefault, setCurrentApp } from '../../../client/utils.js';
1
+ import { getCore, getCurrentApp, graph, invalidateModulesByUrls, normalizeSpec, resolveHmrHttpOrigin, safeDynImport, safeReadDefault, setCurrentApp } from '../../../client/utils.js';
2
+ import { getGlobalScope } from '../../../shared/runtime/global-scope.js';
3
+ import { resolveVendorModule } from '../../../shared/runtime/vendor-resolve.js';
4
+ import { findSfcAncestors } from './dep-propagation.js';
2
5
  const APP_VIRTUAL_WITH_SLASH = (() => {
3
- const root = typeof __NS_APP_ROOT_VIRTUAL__ === 'string' && __NS_APP_ROOT_VIRTUAL__ ? __NS_APP_ROOT_VIRTUAL__ : '/src';
6
+ // Define substitution does not reach this raw-served file; prefer the
7
+ // globalThis seed from the entry's defines-seed module ('app/'-rooted
8
+ // projects would otherwise get the wrong '/src' default).
9
+ const root = (typeof __NS_APP_ROOT_VIRTUAL__ === 'string' && __NS_APP_ROOT_VIRTUAL__) || (typeof getGlobalScope().__NS_APP_ROOT_VIRTUAL__ === 'string' && getGlobalScope().__NS_APP_ROOT_VIRTUAL__) || '/src';
4
10
  return root.replace(/\/+$/, '') + '/';
5
11
  })();
6
12
  // Optional runtime knob: allow disabling assembler path in favor of variant-only flow
@@ -16,24 +22,8 @@ export const sfcArtifactMap = new Map();
16
22
  // Install dev shims for nativescript-vue navigation to observe and (optionally) rescue
17
23
  export function installNsVueDevShims() {
18
24
  try {
19
- const g = globalThis;
20
- const reg = g.__nsVendorRegistry;
21
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
22
- const getMod = (id) => {
23
- try {
24
- if (reg && reg.has(id))
25
- return reg.get(id);
26
- }
27
- catch { }
28
- try {
29
- if (typeof req === 'function')
30
- return req(id);
31
- }
32
- catch { }
33
- return null;
34
- };
35
- const nv = getMod('nativescript-vue');
36
- const rh = getMod('nativescript-vue/dist/runtimeHelpers');
25
+ const nv = resolveVendorModule('nativescript-vue');
26
+ const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
37
27
  const wrap = (orig, label) => {
38
28
  if (typeof orig !== 'function')
39
29
  return orig;
@@ -48,6 +38,7 @@ export function installNsVueDevShims() {
48
38
  paramKeys: Object.keys(params || {}),
49
39
  });
50
40
  }
41
+ // eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
51
42
  return orig.apply(this, arguments);
52
43
  }
53
44
  catch (e) {
@@ -85,74 +76,20 @@ export function installNsVueDevShims() {
85
76
  }
86
77
  catch { }
87
78
  }
88
- // initial root component for back fallback
89
- let ORIG_ROOT_COMPONENT = null;
90
79
  // Ensure Vue runtime global functions exist before evaluating SFC artifacts that rely on globalThis.* indirections.
91
80
  export function ensureVueGlobals() {
92
81
  try {
93
82
  const g = globalThis;
94
83
  const vueAlready = g.defineComponent && g.resolveComponent && g.createVNode;
95
- const req = globalThis.__nsVendorRegistry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
96
- const registry = globalThis.__nsVendorRegistry;
97
- let nvMod = null;
98
- let vueMod = null;
99
84
  // Prefer nativescript-vue first so createApp has .start and NSVRoot is available
100
- if (registry && registry.has('nativescript-vue')) {
101
- nvMod = registry.get('nativescript-vue');
102
- }
103
- if (registry && registry.has('vue')) {
104
- vueMod = registry.get('vue');
105
- }
106
- if (!nvMod && typeof req === 'function') {
107
- try {
108
- nvMod = req('nativescript-vue');
109
- }
110
- catch { }
111
- }
112
- if (!vueMod && typeof req === 'function') {
113
- try {
114
- vueMod = req('vue');
115
- }
116
- catch { }
117
- if (!vueMod) {
118
- try {
119
- vueMod = req('@vue/runtime-core');
120
- }
121
- catch { }
122
- }
123
- }
124
- const baseMod = nvMod || vueMod;
125
- let chosenMod = baseMod;
126
- if (!chosenMod) {
127
- // Last-ditch attempts on known ids
128
- try {
129
- chosenMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
130
- }
131
- catch { }
132
- if (!chosenMod) {
133
- try {
134
- chosenMod = req && typeof req === 'function' ? req('vue') : null;
135
- }
136
- catch { }
137
- }
138
- if (!chosenMod)
139
- return;
140
- }
141
- if (!vueMod) {
142
- // Last-ditch attempts on known ids
143
- try {
144
- vueMod = req && typeof req === 'function' ? req('vue') : null;
145
- }
146
- catch { }
147
- if (!vueMod) {
148
- try {
149
- vueMod = req && typeof req === 'function' ? req('nativescript-vue') : null;
150
- }
151
- catch { }
152
- }
153
- if (!vueMod)
154
- return;
155
- }
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;
156
93
  // Polyfill essential runtime helpers often imported from 'vue' by compiled SFC render code
157
94
  try {
158
95
  const polyNormalizeClass = (val) => {
@@ -318,7 +255,7 @@ export function ensurePiniaOnApp(app) {
318
255
  try {
319
256
  if (!app || typeof app.use !== 'function')
320
257
  return;
321
- const g = globalThis;
258
+ const g = getGlobalScope();
322
259
  // If this app already has a Pinia provide, skip
323
260
  try {
324
261
  const prov = app?._context?.provides;
@@ -340,17 +277,7 @@ export function ensurePiniaOnApp(app) {
340
277
  catch { }
341
278
  // Attempt to set active pinia if API is available
342
279
  try {
343
- const registry = g.__nsVendorRegistry;
344
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
345
- let piniaMod = null;
346
- if (registry && registry.has('pinia'))
347
- piniaMod = registry.get('pinia');
348
- if (!piniaMod && typeof req === 'function') {
349
- try {
350
- piniaMod = req('pinia');
351
- }
352
- catch { }
353
- }
280
+ const piniaMod = resolveVendorModule('pinia');
354
281
  const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
355
282
  const setActivePinia = resolved?.setActivePinia;
356
283
  if (typeof setActivePinia === 'function')
@@ -360,18 +287,7 @@ export function ensurePiniaOnApp(app) {
360
287
  return;
361
288
  }
362
289
  // Prefer vendor registry/require to load 'pinia'
363
- const registry = g.__nsVendorRegistry;
364
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
365
- let piniaMod = null;
366
- if (registry && registry.has('pinia')) {
367
- piniaMod = registry.get('pinia');
368
- }
369
- if (!piniaMod && typeof req === 'function') {
370
- try {
371
- piniaMod = req('pinia');
372
- }
373
- catch { }
374
- }
290
+ const piniaMod = resolveVendorModule('pinia');
375
291
  if (!piniaMod)
376
292
  return;
377
293
  const resolved = (piniaMod && (piniaMod.default ?? piniaMod)) || null;
@@ -396,16 +312,11 @@ export function ensurePiniaOnApp(app) {
396
312
  // Prefer nativescript-vue's own bootstrap to set up element registry and built-ins
397
313
  export function ensureNsVueBootstrap() {
398
314
  try {
399
- const g = globalThis;
400
315
  if (nsVueInitDone)
401
316
  return;
402
- const reg = g.__nsVendorRegistry;
403
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
404
- if (typeof req !== 'function')
405
- return;
406
317
  // Try full init, which should register core elements and built-in components
407
318
  try {
408
- const nv = req('nativescript-vue/dist/nativescript');
319
+ const nv = resolveVendorModule('nativescript-vue/dist/nativescript');
409
320
  const init = (nv && (nv.init || nv.default?.init)) || undefined;
410
321
  if (typeof init === 'function') {
411
322
  init();
@@ -418,7 +329,7 @@ export function ensureNsVueBootstrap() {
418
329
  catch { }
419
330
  // Fallback: register core elements only
420
331
  try {
421
- const elems = req('nativescript-vue/dist/nativescript/elements');
332
+ const elems = resolveVendorModule('nativescript-vue/dist/nativescript/elements');
422
333
  const fn = (elems && (elems.registerCoreElements || elems.default?.registerCoreElements)) || undefined;
423
334
  if (typeof fn === 'function') {
424
335
  fn();
@@ -435,19 +346,7 @@ function installBuiltInComponentsOnApp(app) {
435
346
  try {
436
347
  if (!app || typeof app.component !== 'function')
437
348
  return;
438
- const g = globalThis;
439
- const reg = g.__nsVendorRegistry;
440
- const req = reg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
441
- if (typeof req !== 'function')
442
- return;
443
- const comps = (() => {
444
- try {
445
- return req('nativescript-vue/dist/components');
446
- }
447
- catch {
448
- return null;
449
- }
450
- })();
349
+ const comps = resolveVendorModule('nativescript-vue/dist/components');
451
350
  const built = comps && (comps.BUILT_IN_COMPONENTS || comps.default?.BUILT_IN_COMPONENTS);
452
351
  if (!built || typeof built !== 'object')
453
352
  return;
@@ -468,55 +367,9 @@ function installBuiltInComponentsOnApp(app) {
468
367
  }
469
368
  catch { }
470
369
  }
471
- // Ensure the Pinia instance is also active in the HTTP ESM module world and that we provide
472
- // the exact piniaSymbol exported by that module, so getActivePinia() and inject() both succeed
473
- // regardless of which module copy a component imports.
474
- async function syncPiniaAcrossEsm(app) {
475
- try {
476
- const g = globalThis;
477
- const piniaInst = g.__NS_HMR_PINIA__ || app?._context?.provides?.pinia;
478
- if (!piniaInst)
479
- return;
480
- // Resolve Pinia from ESM world and set active
481
- let esmUrl = null;
482
- try {
483
- esmUrl = await requestModuleFromServer('pinia');
484
- }
485
- catch { }
486
- if (esmUrl) {
487
- try {
488
- const mod = await safeDynImport(esmUrl);
489
- const resolved = (mod && (mod.default ?? mod)) || mod;
490
- const setActivePinia = resolved?.setActivePinia || mod?.setActivePinia;
491
- const piniaSymbol = resolved?.piniaSymbol || mod?.piniaSymbol;
492
- if (typeof setActivePinia === 'function') {
493
- try {
494
- setActivePinia(piniaInst);
495
- }
496
- catch { }
497
- }
498
- if (piniaSymbol && app?._context?.provides && !app._context.provides[piniaSymbol]) {
499
- try {
500
- app._context.provides[piniaSymbol] = piniaInst;
501
- }
502
- catch { }
503
- try {
504
- g.__NS_PINIA_SYMBOL__ = piniaSymbol;
505
- }
506
- catch { }
507
- }
508
- }
509
- catch (e) {
510
- if (__NS_ENV_VERBOSE__)
511
- console.warn('[hmr-client] syncPiniaAcrossEsm failed import', e);
512
- }
513
- }
514
- }
515
- catch { }
516
- }
517
370
  function bridgePiniaProvides(app, existingApp) {
518
371
  try {
519
- const g = globalThis;
372
+ const g = getGlobalScope();
520
373
  if (!app || !app._context)
521
374
  return;
522
375
  const newProv = app._context.provides || (app._context.provides = {});
@@ -546,17 +399,7 @@ function bridgePiniaProvides(app, existingApp) {
546
399
  }
547
400
  catch { }
548
401
  try {
549
- const vendorReg = g.__nsVendorRegistry;
550
- const req = vendorReg?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
551
- let vmod = null;
552
- if (vendorReg && vendorReg.has('pinia'))
553
- vmod = vendorReg.get('pinia');
554
- else if (typeof req === 'function') {
555
- try {
556
- vmod = req('pinia');
557
- }
558
- catch { }
559
- }
402
+ const vmod = resolveVendorModule('pinia');
560
403
  const resolved = (vmod && (vmod.default ?? vmod)) || vmod;
561
404
  const vendorSym = resolved?.piniaSymbol || vmod?.piniaSymbol;
562
405
  if (vendorSym && typeof vendorSym === 'symbol')
@@ -630,37 +473,172 @@ export function handleVueSfcRegistry(msg) {
630
473
  console.warn('[hmr-client][sfc-registry] install failed', e);
631
474
  }
632
475
  }
476
+ /**
477
+ * A component that declares required props can't be mounted as a standalone HMR
478
+ * root — nothing supplies them, so its render throws (white screen). Detects the
479
+ * object-form `props` Vue itself reads for the "Missing required prop" warning.
480
+ */
481
+ function hmrComponentHasRequiredProps(comp) {
482
+ try {
483
+ const props = comp && comp.props;
484
+ if (!props || typeof props !== 'object' || Array.isArray(props))
485
+ return false;
486
+ for (const key of Object.keys(props)) {
487
+ const def = props[key];
488
+ if (def && typeof def === 'object' && def.required === true)
489
+ return true;
490
+ }
491
+ }
492
+ catch { }
493
+ return false;
494
+ }
495
+ // ── HMR replace-navigation window ────────────────────────────────────────────
496
+ // An in-place SFC reload (`__VUE_HMR_RUNTIME__.reload`) unmounts the old
497
+ // component subtree and mounts the fresh one. When the component's root is a
498
+ // `<Page>` hosted by a `<Frame>`, nativescript-vue's Frame nodeOps `insert`
499
+ // calls `frame.navigate({ create })` — a forward navigation that PUSHES a new
500
+ // backstack entry. Every HMR apply would grow the backstack and surface a Back
501
+ // button in the ActionBar (tapping it walks back through stale pre-edit
502
+ // renders). While a reload flush is in flight, convert those page navigations
503
+ // into `replacePage` (core's replace-navigation, the same primitive LiveSync
504
+ // uses) so the fresh Page takes the current entry's place and the user's real
505
+ // backstack is preserved untouched.
506
+ let hmrReplaceNavInstalled = false;
507
+ let hmrReplaceNavWindowDepth = 0;
508
+ function installHmrFrameReplaceNavigation() {
509
+ if (hmrReplaceNavInstalled)
510
+ return true;
511
+ try {
512
+ const FrameCtor = getCore('Frame');
513
+ const proto = FrameCtor?.prototype;
514
+ if (!proto || typeof proto.navigate !== 'function' || typeof proto.replacePage !== 'function')
515
+ return false;
516
+ const originalNavigate = proto.navigate;
517
+ proto.navigate = function (entry) {
518
+ // Only page-entry navigations on a frame that is already showing a
519
+ // page are rewritten — first mounts and user-driven navigations
520
+ // (outside the window) flow through untouched.
521
+ if (hmrReplaceNavWindowDepth > 0 && entry && typeof entry === 'object' && typeof entry.create === 'function' && this.currentPage) {
522
+ try {
523
+ if (__NS_ENV_VERBOSE__)
524
+ console.log('[hmr][vue] reload window: replacePage instead of forward navigate');
525
+ this.replacePage({ create: entry.create, animated: false });
526
+ return;
527
+ }
528
+ catch (e) {
529
+ console.warn('[hmr][vue] replacePage during reload failed; falling back to navigate', e);
530
+ }
531
+ }
532
+ // eslint-disable-next-line prefer-rest-params -- forwards all args verbatim to the patched original (arity-preserving)
533
+ return originalNavigate.apply(this, arguments);
534
+ };
535
+ hmrReplaceNavInstalled = true;
536
+ return true;
537
+ }
538
+ catch {
539
+ return false;
540
+ }
541
+ }
542
+ function openHmrReplaceNavWindow() {
543
+ if (!installHmrFrameReplaceNavigation())
544
+ return () => { };
545
+ hmrReplaceNavWindowDepth++;
546
+ let closed = false;
547
+ return () => {
548
+ if (closed)
549
+ return;
550
+ closed = true;
551
+ hmrReplaceNavWindowDepth = Math.max(0, hmrReplaceNavWindowDepth - 1);
552
+ };
553
+ }
554
+ /**
555
+ * In-place Vue HMR. The assembled SFC stamps a stable `comp.__hmrId`, so Vue's
556
+ * registerHMR has a record for every mounted instance. Calling the real
557
+ * `__VUE_HMR_RUNTIME__.reload(id, newComp)` re-renders just those instances in
558
+ * place — preserving the App.vue shell (drawer, nav, router), current route, and
559
+ * scroll — instead of a whole-tree resetRootView. Returns false (→ resetRoot
560
+ * fallback) when the real runtime is absent (stub/prod build), the component has
561
+ * no id, or reload throws. A reload that matches no live instances is a no-op
562
+ * (component not currently displayed); the caller treats that as handled.
563
+ */
564
+ function tryInPlaceVueReload(comp) {
565
+ try {
566
+ const rt = getGlobalScope().__VUE_HMR_RUNTIME__;
567
+ const id = comp && comp.__hmrId;
568
+ if (!rt || typeof rt.reload !== 'function' || !id)
569
+ return false;
570
+ // Vue queues the remount on its scheduler (microtask flush) — the
571
+ // Frame navigation happens inside that flush, not synchronously in
572
+ // reload(). Hold the replace-navigation window through the flush:
573
+ // nextTick resolves after the job queue drains; the timeout is a
574
+ // safety net when nextTick is unavailable.
575
+ const closeWindow = openHmrReplaceNavWindow();
576
+ try {
577
+ rt.reload(id, comp);
578
+ }
579
+ catch (e) {
580
+ closeWindow();
581
+ throw e;
582
+ }
583
+ try {
584
+ const nextTick = getGlobalScope().nextTick;
585
+ if (typeof nextTick === 'function') {
586
+ nextTick(() => closeWindow());
587
+ }
588
+ }
589
+ catch { }
590
+ setTimeout(closeWindow, 500);
591
+ if (__NS_ENV_VERBOSE__)
592
+ console.log('[hmr][vue] in-place reload', id);
593
+ return true;
594
+ }
595
+ catch (e) {
596
+ if (__NS_ENV_VERBOSE__)
597
+ console.warn('[hmr][vue] in-place reload failed; resetRoot fallback', e);
598
+ return false;
599
+ }
600
+ }
633
601
  export async function handleVueSfcRegistryUpdate(msg, graphVersion) {
634
602
  try {
635
603
  if (typeof msg.path === 'string' && /\.vue$/i.test(msg.path)) {
636
- // 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.
637
607
  try {
638
- const base = String(msg.path).split('?')[0];
639
- const inChanged = sfcChangedIds.has(base) || sfcChangedIds.has(msg.path);
640
- const versionsMatch = sfcChangedVersion != null && sfcChangedVersion === graphVersion;
641
- if (!inChanged || !versionsMatch) {
642
- // Be resilient to out-of-order delivery: treat the registry update itself
643
- // as authoritative signal that this SFC changed for the announced version.
644
- // This unblocks remounts when the delta was dropped or applied earlier than we recorded.
645
- try {
646
- const effectiveVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
647
- sfcChangedVersion = effectiveVersion;
648
- sfcChangedIds.add(base);
649
- if (__NS_ENV_VERBOSE__)
650
- console.log('[hmr][sfc-registry-update] accepting as change (out-of-order)', { path: msg.path, graphVersion, sfcChangedVersion });
651
- }
652
- catch { }
653
- }
608
+ sfcChangedVersion = typeof msg.version === 'number' ? msg.version : graphVersion;
609
+ sfcChangedIds.add(String(msg.path).split('?')[0]);
654
610
  }
655
611
  catch { }
656
612
  try {
657
613
  ensureVueGlobals();
658
614
  const changedPath = String(msg.path);
659
- // Prefer remounting the SFC that actually changed so you immediately see it
660
- // (e.g., editing Details.vue should remount Details.vue even if Home.vue is currently displayed).
661
- // This keeps existing behavior intact when the changed file is already the root.
662
- const targetPath = changedPath;
663
- const comp = await loadSfcComponent(targetPath, 'sfc_update');
615
+ // Default: remount the SFC that changed, so editing a page reflects
616
+ // immediately even if a different page is displayed.
617
+ let comp = await loadSfcComponent(changedPath);
618
+ // Preferred path: patch the changed component's mounted instances in
619
+ // place (App.vue shell, route, scroll all survive). Returning null tells
620
+ // the overlay no resetRootView is needed.
621
+ if (tryInPlaceVueReload(comp)) {
622
+ return null;
623
+ }
624
+ // Fallback (real Vue HMR runtime unavailable): a child SFC with required
625
+ // props cannot be a standalone root — mounting it bare crashes (missing
626
+ // props → white screen). Walk up to the nearest mountable ancestor (its
627
+ // hosting page) and remount that; the child's artifact set was evicted
628
+ // above, so the ancestor's re-assembly links the edited child and it
629
+ // re-renders with props.
630
+ if (comp && hmrComponentHasRequiredProps(comp)) {
631
+ const ancestors = findSfcAncestors(changedPath, graph);
632
+ for (const ancestor of ancestors) {
633
+ const ancestorComp = await loadSfcComponent(ancestor);
634
+ if (ancestorComp && !hmrComponentHasRequiredProps(ancestorComp)) {
635
+ if (__NS_ENV_VERBOSE__)
636
+ console.log('[hmr][vue] child SFC needs props; remounting nearest mountable ancestor', { changed: changedPath, ancestor });
637
+ comp = ancestorComp;
638
+ break;
639
+ }
640
+ }
641
+ }
664
642
  return comp;
665
643
  }
666
644
  catch (e) {
@@ -685,21 +663,15 @@ export function recordVuePayloadChanges(changed, graphVersion) {
685
663
  if (sawVue)
686
664
  sfcChangedVersion = graphVersion;
687
665
  }
688
- async function waitForSfcMapping(id, timeoutMs = 350) {
689
- if (!/\.vue$/i.test(id))
690
- return true;
691
- const base = id.split('?')[0];
692
- const srcIdx = base.indexOf(APP_VIRTUAL_WITH_SLASH);
693
- const rel = srcIdx !== -1 ? base.slice(srcIdx) : base;
694
- if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
695
- return true;
696
- const start = Date.now();
697
- while (Date.now() - start < timeoutMs) {
698
- await new Promise((r) => setTimeout(r, 30));
699
- if (sfcArtifactMap.has(rel) || sfcArtifactMap.has(base))
700
- return true;
701
- }
702
- return false;
666
+ /**
667
+ * True when the delta for `version` included a `.vue` change. The dep-change
668
+ * propagation in `refreshAfterBatch` uses this to stand down for mixed batches:
669
+ * the SFC registry-update path will already remount with a freshly assembled
670
+ * artifact at this version, which links against the re-imported deps — a second
671
+ * resetRoot from propagation would just double the work (and the flash).
672
+ */
673
+ export function sfcChangedInVersion(version) {
674
+ return sfcChangedVersion != null && sfcChangedVersion === version && sfcChangedIds.size > 0;
703
675
  }
704
676
  // Map a graph id (possibly a .vue source path) to actual import spec
705
677
  export function addSfcMapping(originalPath, fileName) {
@@ -719,26 +691,25 @@ export function addSfcMapping(originalPath, fileName) {
719
691
  }
720
692
  catch { }
721
693
  }
722
- // Build explicit SFC variant URL (script/template). Always preserves the variant query.
723
- function resolveSfcVariantSpec(id, type, cacheBustTag) {
724
- const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
694
+ // Build explicit SFC variant URL (script/template). Always preserves the
695
+ // variant query. CANONICAL (unversioned): module identity is the URL;
696
+ // freshness comes from the eviction in `evictSfcArtifacts` below.
697
+ function resolveSfcVariantSpec(id, type) {
698
+ const origin = resolveHmrHttpOrigin();
725
699
  const base = id.split('?')[0];
726
700
  if (!origin)
727
701
  return base + `?vue&type=${type}`;
728
702
  const safePath = base.startsWith('/') ? base : '/' + base;
729
- const ver = typeof getGraphVersion() === 'number' && getGraphVersion() > 0 ? String(getGraphVersion()) : '0';
730
- let url = origin + `/ns/sfc/${ver}` + safePath + `?vue&type=${type}`;
731
- return url;
703
+ return origin + '/ns/sfc' + safePath + `?vue&type=${type}`;
732
704
  }
733
- // Resolve deterministic SFC assembler ESM module
734
- function resolveSfcAssemblerSpec(id, cacheBustTag) {
735
- const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
705
+ // Resolve deterministic SFC assembler ESM module (canonical, unversioned).
706
+ function resolveSfcAssemblerSpec(id) {
707
+ const origin = resolveHmrHttpOrigin();
736
708
  const base = id.split('?')[0];
737
709
  if (!origin)
738
710
  return base; // fallback: device will likely fail; origin should be available in dev
739
711
  const safePath = base.startsWith('/') ? base : '/' + base;
740
- const ver = typeof getGraphVersion() === 'number' && getGraphVersion() > 0 ? String(getGraphVersion()) : '0';
741
- let url = origin + `/ns/asm/${ver}` + `?path=${encodeURIComponent(safePath)}`;
712
+ let url = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
742
713
  try {
743
714
  if (globalThis.__NS_HMR_ASM_DIAG__) {
744
715
  url += '&diag=1';
@@ -747,49 +718,60 @@ function resolveSfcAssemblerSpec(id, cacheBustTag) {
747
718
  catch { }
748
719
  return url;
749
720
  }
750
- // Resolve metadata endpoint for an SFC
751
- function resolveSfcMetaSpec(id, cacheBustTag) {
752
- const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
753
- const base = id.split('?')[0];
721
+ // The full SFC artifact URL set for one `.vue` path — every URL shape the
722
+ // device may hold a module record under for this component:
723
+ // - the assembler module (dynamic loads + full-SFC delegation target)
724
+ // - the assembler's `mode=inline` twin (static child imports inside a
725
+ // parent's assembled module)
726
+ // - the script/template variants (variant assembly + asm fallbacks)
727
+ // - the full `/ns/sfc<path>` delegation module (static `.vue` imports
728
+ // rewritten by the server inside `/ns/m` modules)
729
+ export function buildSfcEvictionUrls(id) {
730
+ const origin = resolveHmrHttpOrigin();
754
731
  if (!origin)
755
- return base;
732
+ return [];
733
+ const base = id.split('?')[0];
756
734
  const safePath = base.startsWith('/') ? base : '/' + base;
757
- const ver = typeof getGraphVersion() === 'number' && getGraphVersion() > 0 ? String(getGraphVersion()) : '0';
758
- let url = origin + `/ns/sfc-meta/${ver}` + `?path=${encodeURIComponent(safePath)}`;
759
- return url;
735
+ const asmUrl = origin + '/ns/asm' + `?path=${encodeURIComponent(safePath)}`;
736
+ return [asmUrl, asmUrl + '&mode=inline', origin + '/ns/sfc' + safePath + '?vue&type=script', origin + '/ns/sfc' + safePath + '?vue&type=template', origin + '/ns/sfc' + safePath];
760
737
  }
761
- async function fetchSfcMeta(id, tag) {
738
+ // Evict every module record for this SFC's artifact set so the re-imports in
739
+ // `loadSfcComponent` fetch fresh content. ns:module `invalidateModules` drops the
740
+ // V8 registry entries AND arms the
741
+ // bust-next-fetch nonce that defeats the OS HTTP cache — the same freshness
742
+ // protocol `/ns/m` modules use (URLs never vary; eviction drives updates).
743
+ // Soft-fail: on runtimes without the eviction primitive we still re-import
744
+ // (worst case the device serves the cached artifact — same as any other
745
+ // module type on such a runtime).
746
+ function evictSfcArtifacts(id) {
762
747
  try {
763
- const url = resolveSfcMetaSpec(id, tag + '_meta');
764
- const res = await fetch(url, { method: 'GET' });
765
- if (!res.ok)
766
- return null;
767
- const json = await res.json();
768
- return json;
748
+ const urls = buildSfcEvictionUrls(id);
749
+ if (urls.length)
750
+ invalidateModulesByUrls(urls);
769
751
  }
770
- catch {
771
- return null;
752
+ catch (e) {
753
+ try {
754
+ console.warn('[hmr][vue] SFC artifact eviction failed for', id, e);
755
+ }
756
+ catch { }
772
757
  }
773
758
  }
774
759
  // Safely load a component for a .vue SFC. Prefer deterministic assembler first to avoid
775
760
  // any variant-compile or TDZ flakiness; only fall back to variant assembly if needed.
776
- export async function loadSfcComponent(targetVuePath, tag) {
761
+ export async function loadSfcComponent(targetVuePath) {
777
762
  // Minimal mode removed: always go through deterministic assembler + device reset
778
763
  // Ensure Vue globals exist BEFORE evaluating variant modules; their top-level aliasing reads globalThis.* once.
779
764
  ensureVueGlobals();
780
- // Consult metadata to choose optimal path
781
- let meta = null;
782
- try {
783
- meta = await fetchSfcMeta(targetVuePath, tag);
784
- }
785
- catch { }
786
- if (__NS_ENV_VERBOSE__ && meta) {
787
- console.log('[hmr][vue-reset][meta]', targetVuePath, meta);
788
- }
765
+ // Evict this SFC's artifact URL set BEFORE any import below. Every load
766
+ // through here happens because fresh content is wanted (a `.vue` edit, an
767
+ // ancestor remount, or a dep-change boundary re-assembly), and the URLs
768
+ // are stable across saves — without the eviction, `import()` would return
769
+ // the cached (pre-edit) module records.
770
+ evictSfcArtifacts(targetVuePath);
789
771
  // Prefer deterministic assembler first so AST normalization (including nav helpers) always applies.
790
772
  try {
791
773
  if (!DISABLE_ASM) {
792
- const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_first'));
774
+ const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
793
775
  const asmComp = asmMod?.default ?? asmMod;
794
776
  if (asmComp && typeof asmComp === 'object') {
795
777
  if (__NS_ENV_VERBOSE__)
@@ -805,11 +787,11 @@ export async function loadSfcComponent(targetVuePath, tag) {
805
787
  // 1) Variant assembly (script then template) – closest to browser behavior
806
788
  try {
807
789
  // Import script variant FIRST to avoid TDZ due to cyclic evaluation between script/template.
808
- const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script', tag + '_script'));
790
+ const scriptMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'script'));
809
791
  // Ensure script default is readable before importing the template; this enforces a stable order.
810
792
  const base = await safeReadDefault(scriptMod);
811
793
  // Now import the template render implementation
812
- const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template', tag + '_template'));
794
+ const templateMod = await safeDynImport(resolveSfcVariantSpec(targetVuePath, 'template'));
813
795
  if (__NS_ENV_VERBOSE__) {
814
796
  const sKeys = scriptMod ? Object.keys(scriptMod).join(',') : '<none>';
815
797
  const tKeys = templateMod ? Object.keys(templateMod).join(',') : '<none>';
@@ -829,7 +811,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
829
811
  try {
830
812
  if (__NS_ENV_VERBOSE__)
831
813
  console.log('[hmr][vue-reset][diag] no render from template variant; attempting assembler for', targetVuePath);
832
- const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_norender'));
814
+ const asmMod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
833
815
  const asmComp = asmMod?.default ?? asmMod;
834
816
  if (asmComp && typeof asmComp === 'object' && typeof asmComp.render === 'function') {
835
817
  try {
@@ -875,7 +857,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
875
857
  if (__NS_ENV_VERBOSE__)
876
858
  console.log('[hmr][vue-reset][diag] no script exports detected; attempting assembler import for', targetVuePath);
877
859
  try {
878
- const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm'));
860
+ const asm = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
879
861
  const compAsm = asm?.default ?? asm;
880
862
  if (compAsm && typeof compAsm === 'object') {
881
863
  if (__NS_ENV_VERBOSE__)
@@ -891,8 +873,8 @@ export async function loadSfcComponent(targetVuePath, tag) {
891
873
  // Synthesize a minimal component and attach named exports as local components so template resolveComponent works.
892
874
  try {
893
875
  ensureVueGlobals();
894
- const comp = globalThis.defineComponent
895
- ? globalThis.defineComponent({
876
+ const comp = getGlobalScope().defineComponent
877
+ ? getGlobalScope().defineComponent({
896
878
  name: targetVuePath.split('/').pop() || 'AnonymousSFC',
897
879
  render,
898
880
  })
@@ -933,7 +915,7 @@ export async function loadSfcComponent(targetVuePath, tag) {
933
915
  if (DISABLE_ASM)
934
916
  throw new Error('asm disabled by __NS_HMR_DISABLE_ASM__');
935
917
  await new Promise((r) => setTimeout(r, 10));
936
- const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath, tag + '_asm_final'));
918
+ const mod = await safeDynImport(resolveSfcAssemblerSpec(targetVuePath));
937
919
  try {
938
920
  const comp = await safeReadDefault(mod);
939
921
  if (comp)
@@ -956,7 +938,7 @@ export function getRootForVue(newComponent, state) {
956
938
  if (__NS_ENV_VERBOSE__)
957
939
  console.log('[hmr-client] [createRoot] begin');
958
940
  ensureVueGlobals();
959
- const g = globalThis;
941
+ const g = getGlobalScope();
960
942
  const AppFactory = g.createApp;
961
943
  let RootCtor = g.NSVRoot;
962
944
  // Hygiene: unmount any existing app instance to avoid duplicate lifecycle hooks
@@ -974,25 +956,9 @@ export function getRootForVue(newComponent, state) {
974
956
  catch { }
975
957
  try {
976
958
  if (!RootCtor) {
977
- const registry = g.__nsVendorRegistry;
978
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
979
- let domMod = null;
980
- if (registry && registry.has('nativescript-vue/dist/dom')) {
981
- domMod = registry.get('nativescript-vue/dist/dom');
982
- if (__NS_ENV_VERBOSE__)
983
- console.log('[hmr-client] [createRoot] NS DOM from vendor registry');
984
- }
985
- else if (typeof req === 'function') {
986
- try {
987
- domMod = req('nativescript-vue/dist/dom');
988
- if (__NS_ENV_VERBOSE__)
989
- console.log('[hmr-client] [createRoot] NS DOM via require');
990
- }
991
- catch (e) {
992
- if (__NS_ENV_VERBOSE__)
993
- console.warn('[hmr-client] [createRoot] NS DOM require failed', e);
994
- }
995
- }
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');
996
962
  if (domMod) {
997
963
  const nsDom = (domMod && (domMod.default ?? domMod)) || domMod;
998
964
  const ctor = nsDom?.NSVRoot || (nsDom?.default && nsDom.default.NSVRoot) || domMod?.NSVRoot;
@@ -1045,17 +1011,7 @@ export function getRootForVue(newComponent, state) {
1045
1011
  console.log('[hmr-client] [createRoot] app created via createApp');
1046
1012
  }
1047
1013
  try {
1048
- const registry = g.__nsVendorRegistry;
1049
- const req = registry?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
1050
- let rh = null;
1051
- if (registry && registry.has('nativescript-vue/dist/runtimeHelpers'))
1052
- rh = registry.get('nativescript-vue/dist/runtimeHelpers');
1053
- if (!rh && typeof req === 'function') {
1054
- try {
1055
- rh = req('nativescript-vue/dist/runtimeHelpers');
1056
- }
1057
- catch { }
1058
- }
1014
+ const rh = resolveVendorModule('nativescript-vue/dist/runtimeHelpers');
1059
1015
  const setRootApp = rh && (rh.setRootApp || rh.default?.setRootApp);
1060
1016
  if (typeof setRootApp === 'function') {
1061
1017
  setRootApp(app);
@@ -1063,15 +1019,7 @@ export function getRootForVue(newComponent, state) {
1063
1019
  console.log('[hmr-client] [createRoot] runtimeHelpers.setRootApp applied');
1064
1020
  }
1065
1021
  try {
1066
- let nv = null;
1067
- if (registry && registry.has('nativescript-vue'))
1068
- nv = registry.get('nativescript-vue');
1069
- if (!nv && typeof req === 'function') {
1070
- try {
1071
- nv = req('nativescript-vue');
1072
- }
1073
- catch { }
1074
- }
1022
+ const nv = resolveVendorModule('nativescript-vue');
1075
1023
  const setRootApp2 = nv && (nv.setRootApp || nv.default?.setRootApp);
1076
1024
  if (typeof setRootApp2 === 'function') {
1077
1025
  setRootApp2(app);
@@ -1103,20 +1051,6 @@ export function getRootForVue(newComponent, state) {
1103
1051
  if (__NS_ENV_VERBOSE__)
1104
1052
  console.warn('[hmr-client] [createRoot] ensurePiniaOnApp failed', e);
1105
1053
  }
1106
- try {
1107
- (async () => {
1108
- try {
1109
- await syncPiniaAcrossEsm(app);
1110
- if (__NS_ENV_VERBOSE__)
1111
- console.log('[hmr-client] [createRoot] Pinia state sync requested');
1112
- }
1113
- catch (e) {
1114
- if (__NS_ENV_VERBOSE__)
1115
- console.warn('[hmr-client] [createRoot] syncPiniaAcrossEsm failed', e);
1116
- }
1117
- })();
1118
- }
1119
- catch { }
1120
1054
  try {
1121
1055
  bridgePiniaProvides(app, existingApp);
1122
1056
  if (__NS_ENV_VERBOSE__)
@@ -1192,9 +1126,18 @@ export function getRootForVue(newComponent, state) {
1192
1126
  }
1193
1127
  return null;
1194
1128
  };
1195
- // Prefer adopting a Frame if the component produced one. This avoids nesting a Frame inside
1196
- // the placeholder Frame and ensures a single authoritative Frame for app navigation.
1197
- const nativeView = findFrameNativeView(vm?.$el) || findPageNativeView(vm?.$el) || findNativeView(vm?.$el);
1129
+ // Resolve the top-level native view from the component output. The previous logic
1130
+ // preferred ANY Frame found anywhere in the tree via depth-first recursion, which
1131
+ // is wrong when the component root is a Page that contains nested Frames (e.g.
1132
+ // a TabView whose TabViewItems each wrap their content in a <Frame>). That picked
1133
+ // the FIRST nested Frame and set it as the app root via resetRootView, severing
1134
+ // it from its TabViewItem parent and leaving a white screen on HMR reload.
1135
+ // Only fall back to the deep Frame/Page lookups when the top-level view is neither
1136
+ // (e.g., a raw Layout that the user intends to host an inner Frame for navigation).
1137
+ const topLevelNativeView = findNativeView(vm?.$el);
1138
+ const topCtorName = topLevelNativeView ? String(topLevelNativeView?.constructor?.name || '').replace(/^_+/, '') : '';
1139
+ const topIsPageOrFrame = /^(Page|Frame)(\$\d+)?$/.test(topCtorName);
1140
+ const nativeView = topIsPageOrFrame ? topLevelNativeView : findFrameNativeView(vm?.$el) || findPageNativeView(vm?.$el) || topLevelNativeView;
1198
1141
  const GPage = getCore('Page');
1199
1142
  // Decide root type and cache it
1200
1143
  if (nativeView) {
@@ -1219,160 +1162,6 @@ export function getRootForVue(newComponent, state) {
1219
1162
  state.setCachedRoot(nativeView);
1220
1163
  return state.getCachedRoot();
1221
1164
  }
1222
- // Treat Frame$N as Frame as well
1223
- if (ctorName === 'Frame_OLD_NEVER_REACHED') {
1224
- // If a Frame is produced, prefer adopting the Frame as the new root to ensure a single authoritative Frame.
1225
- // Extracting the Page and navigating a placeholder Frame can split realms and break app-controlled navigation.
1226
- let pageCandidate = undefined;
1227
- try {
1228
- pageCandidate = nativeView.currentPage || nativeView._currentEntry?.resolvedPage;
1229
- }
1230
- catch { }
1231
- if (pageCandidate) {
1232
- if (__NS_ENV_VERBOSE__)
1233
- console.log('[hmr-client] [createRoot] Frame root with currentPage detected; adopting Frame as root');
1234
- state.setRootKind('frame');
1235
- state.setCachedRoot(nativeView);
1236
- return state.getCachedRoot();
1237
- }
1238
- // No currentPage yet; construct a Page wrapper and mount the component inside it
1239
- try {
1240
- if (__NS_ENV_VERBOSE__)
1241
- console.log('[hmr-client] [createRoot] no currentPage; creating Page wrapper for navigation-first');
1242
- const registry = globalThis.__nsVendorRegistry;
1243
- const req = registry?.get ? globalThis.__nsVendorRequire || globalThis.__nsRequire || globalThis.require : globalThis.__nsRequire || globalThis.require;
1244
- let vueMod = null;
1245
- if (registry && registry.has('vue'))
1246
- vueMod = registry.get('vue');
1247
- if (!vueMod && typeof req === 'function') {
1248
- try {
1249
- vueMod = req('vue');
1250
- }
1251
- catch { }
1252
- }
1253
- const h = vueMod?.h;
1254
- const WrappedRoot = h
1255
- ? {
1256
- name: 'HMRPageWrapper',
1257
- setup() {
1258
- return () => h('Page', null, [h(newComponent)]);
1259
- },
1260
- }
1261
- : null;
1262
- if (WrappedRoot) {
1263
- const g = globalThis;
1264
- const AppFactory = g.createApp;
1265
- let app2 = AppFactory(WrappedRoot);
1266
- try {
1267
- const reg2 = g.__nsVendorRegistry;
1268
- const req2 = reg2?.get ? g.__nsVendorRequire || g.__nsRequire || g.require : g.__nsRequire || g.require;
1269
- let rh2 = null;
1270
- if (reg2 && reg2.has('nativescript-vue/dist/runtimeHelpers'))
1271
- rh2 = reg2.get('nativescript-vue/dist/runtimeHelpers');
1272
- if (!rh2 && typeof req2 === 'function') {
1273
- try {
1274
- rh2 = req2('nativescript-vue/dist/runtimeHelpers');
1275
- }
1276
- catch { }
1277
- }
1278
- const setRootApp2a = rh2 && (rh2.setRootApp || rh2.default?.setRootApp);
1279
- if (typeof setRootApp2a === 'function')
1280
- setRootApp2a(app2);
1281
- try {
1282
- let nv2 = null;
1283
- if (reg2 && reg2.has('nativescript-vue'))
1284
- nv2 = reg2.get('nativescript-vue');
1285
- if (!nv2 && typeof req2 === 'function') {
1286
- try {
1287
- nv2 = req2('nativescript-vue');
1288
- }
1289
- catch { }
1290
- }
1291
- const setRootApp2b = nv2 && (nv2.setRootApp || nv2.default?.setRootApp);
1292
- if (typeof setRootApp2b === 'function')
1293
- setRootApp2b(app2);
1294
- }
1295
- catch { }
1296
- }
1297
- catch { }
1298
- try {
1299
- const hook = globalThis.__NS_HMR_INSTALL_PLUGINS__;
1300
- if (typeof hook === 'function')
1301
- hook(app2);
1302
- }
1303
- catch { }
1304
- try {
1305
- ensurePiniaOnApp(app2);
1306
- }
1307
- catch { }
1308
- try {
1309
- bridgePiniaProvides(app2, getCurrentApp() || globalThis.__NS_VUE_APP__);
1310
- }
1311
- catch { }
1312
- try {
1313
- installBuiltInComponentsOnApp(app2);
1314
- }
1315
- catch { }
1316
- const RootCtor2 = globalThis.NSVRoot || RootCtor;
1317
- const root2 = new RootCtor2();
1318
- const vm2 = typeof app2.runWithContext === 'function' ? app2.runWithContext(() => app2.mount(root2)) : app2.mount(root2);
1319
- setCurrentApp(app2);
1320
- const findNativeView2 = (element) => {
1321
- if (element?.nativeView)
1322
- return element.nativeView;
1323
- const kids = element?.childNodes || element?.children || [];
1324
- for (const c of kids) {
1325
- const r = findNativeView2(c);
1326
- if (r)
1327
- return r;
1328
- }
1329
- return null;
1330
- };
1331
- const findPageNativeView2 = (element) => {
1332
- if (!element)
1333
- return null;
1334
- const nv = element.nativeView;
1335
- if (nv) {
1336
- const ctorName = String(nv?.constructor?.name || '').replace(/^_+/, '');
1337
- if (ctorName === 'Page' || /^Page(\$\d+)?$/.test(ctorName))
1338
- return nv;
1339
- }
1340
- const kids = element?.childNodes || element?.children || [];
1341
- for (const k of kids) {
1342
- const r = findPageNativeView2(k);
1343
- if (r)
1344
- return r;
1345
- }
1346
- return null;
1347
- };
1348
- const nv2 = findPageNativeView2(vm2?.$el) || findNativeView2(vm2?.$el);
1349
- const ctor2 = String(nv2?.constructor?.name || '').replace(/^_+/, '');
1350
- if (ctor2 === 'Page' || /^Page(\$\d+)?$/.test(ctor2)) {
1351
- // Hide wrapper ActionBar to avoid double bars when a Frame is nested inside
1352
- try {
1353
- nv2.actionBarHidden = true;
1354
- }
1355
- catch { }
1356
- if (__NS_ENV_VERBOSE__)
1357
- console.log('[hmr-client] [createRoot] Page wrapper created successfully');
1358
- state.setRootKind('page');
1359
- state.setCachedRoot(nv2);
1360
- return state.getCachedRoot();
1361
- }
1362
- if (__NS_ENV_VERBOSE__)
1363
- console.warn('[hmr-client] [createRoot] Page wrapper did not yield Page; got', ctor2);
1364
- }
1365
- }
1366
- catch (e) {
1367
- if (__NS_ENV_VERBOSE__)
1368
- console.warn('[hmr-client] [createRoot] Page wrapper attempt failed', e);
1369
- }
1370
- if (__NS_ENV_VERBOSE__)
1371
- console.log('[hmr-client] [createRoot] root kind=frame (no currentPage)');
1372
- state.setRootKind('frame');
1373
- state.setCachedRoot(nativeView);
1374
- return state.getCachedRoot();
1375
- }
1376
1165
  if (GPage) {
1377
1166
  const page = new GPage();
1378
1167
  page.content = nativeView;
@@ -1407,12 +1196,12 @@ export function getRootForVue(newComponent, state) {
1407
1196
  */
1408
1197
  export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1409
1198
  try {
1410
- const g = globalThis;
1199
+ const g = getGlobalScope();
1411
1200
  // Provide global back-remount hooks for bridges to call
1412
1201
  if (!g.__nsAttemptBackRemount) {
1413
1202
  g.__nsAttemptBackRemount = () => {
1414
1203
  try {
1415
- const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__ || ORIG_ROOT_COMPONENT;
1204
+ const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
1416
1205
  if (orig) {
1417
1206
  performResetRoot(orig);
1418
1207
  return true;
@@ -1454,7 +1243,7 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1454
1243
  // fall through to fallback
1455
1244
  }
1456
1245
  // Fallback: reset to original root component if available
1457
- const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__ || ORIG_ROOT_COMPONENT;
1246
+ const orig = g.__NS_HMR_ORIG_ROOT_COMPONENT__;
1458
1247
  if (orig) {
1459
1248
  try {
1460
1249
  // Reuse the proven remount pipeline for consistency
@@ -1470,44 +1259,4 @@ export function ensureBackWrapperInstalled(performResetRoot, getCore) {
1470
1259
  }
1471
1260
  catch { }
1472
1261
  }
1473
- async function requestModuleFromServer(name) {
1474
- try {
1475
- // Derive the dev-server origin (mirrors other resolver helpers in this file)
1476
- const origin = getHttpOriginForVite() || deriveHttpOrigin(getHMRWsUrl());
1477
- if (!origin)
1478
- return null;
1479
- // Candidate URL patterns that a Vite-like server might expose for resolving modules to importable URLs.
1480
- const candidates = [
1481
- // Vite serves bare imports under /@modules/<name>
1482
- `${origin.replace(/\/$/, '')}/@modules/${encodeURIComponent(name)}`,
1483
- // Some setups use @id for resolved module ids
1484
- `${origin.replace(/\/$/, '')}/@id/${encodeURIComponent(name)}`,
1485
- // Custom-ish endpoint pattern used elsewhere in this project style
1486
- `${origin.replace(/\/$/, '')}/ns/esmmod?name=${encodeURIComponent(name)}`,
1487
- ];
1488
- // Probe each candidate with a lightweight HEAD request first; if allowed, return the candidate URL.
1489
- for (const url of candidates) {
1490
- try {
1491
- const res = await fetch(url, { method: 'HEAD' });
1492
- if (res && (res.ok || res.status === 200))
1493
- return url;
1494
- }
1495
- catch {
1496
- // ignore and try next
1497
- }
1498
- }
1499
- // As a final attempt, try GET on the first candidate and return if we get a module-like response.
1500
- try {
1501
- const url = candidates[0];
1502
- const res = await fetch(url, { method: 'GET' });
1503
- if (res && res.ok)
1504
- return url;
1505
- }
1506
- catch { }
1507
- return null;
1508
- }
1509
- catch {
1510
- return null;
1511
- }
1512
- }
1513
1262
  //# sourceMappingURL=index.js.map