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

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 (465) hide show
  1. package/README.md +51 -11
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +390 -165
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +244 -53
  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 +12 -93
  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-state.d.ts +8 -0
  19. package/helpers/app-css-state.js +8 -0
  20. package/helpers/app-css-state.js.map +1 -0
  21. package/helpers/bundler-context.d.ts +11 -0
  22. package/helpers/bundler-context.js +71 -0
  23. package/helpers/bundler-context.js.map +1 -0
  24. package/helpers/cli-flags.d.ts +12 -0
  25. package/helpers/cli-flags.js +34 -0
  26. package/helpers/cli-flags.js.map +1 -1
  27. package/helpers/css-platform-plugin.d.ts +14 -0
  28. package/helpers/css-platform-plugin.js +43 -25
  29. package/helpers/css-platform-plugin.js.map +1 -1
  30. package/helpers/dev-host.d.ts +360 -0
  31. package/helpers/dev-host.js +694 -0
  32. package/helpers/dev-host.js.map +1 -0
  33. package/helpers/dynamic-import-plugin.js +9 -4
  34. package/helpers/dynamic-import-plugin.js.map +1 -1
  35. package/helpers/esbuild-platform-resolver.js +4 -1
  36. package/helpers/esbuild-platform-resolver.js.map +1 -1
  37. package/helpers/external-configs.d.ts +10 -12
  38. package/helpers/external-configs.js +58 -35
  39. package/helpers/external-configs.js.map +1 -1
  40. package/helpers/global-defines.d.ts +100 -13
  41. package/helpers/global-defines.js +165 -28
  42. package/helpers/global-defines.js.map +1 -1
  43. package/helpers/hmr-scope.d.ts +26 -0
  44. package/helpers/hmr-scope.js +67 -0
  45. package/helpers/hmr-scope.js.map +1 -0
  46. package/helpers/init.js +0 -18
  47. package/helpers/init.js.map +1 -1
  48. package/helpers/logging.js +29 -1
  49. package/helpers/logging.js.map +1 -1
  50. package/helpers/main-entry.d.ts +4 -1
  51. package/helpers/main-entry.js +368 -53
  52. package/helpers/main-entry.js.map +1 -1
  53. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  54. package/helpers/nativeclass-esbuild-plugin.js +6 -1
  55. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  56. package/helpers/nativeclass-transform.d.ts +13 -0
  57. package/helpers/nativeclass-transform.js +37 -7
  58. package/helpers/nativeclass-transform.js.map +1 -1
  59. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  60. package/helpers/nativeclass-transformer-plugin.js +163 -15
  61. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  62. package/helpers/nativescript-package-resolver.js +10 -62
  63. package/helpers/nativescript-package-resolver.js.map +1 -1
  64. package/helpers/normalize-id.d.ts +42 -0
  65. package/helpers/normalize-id.js +60 -0
  66. package/helpers/normalize-id.js.map +1 -0
  67. package/helpers/ns-core-url.d.ts +29 -7
  68. package/helpers/ns-core-url.js +69 -12
  69. package/helpers/ns-core-url.js.map +1 -1
  70. package/helpers/optimize-deps.d.ts +16 -0
  71. package/helpers/optimize-deps.js +17 -0
  72. package/helpers/optimize-deps.js.map +1 -0
  73. package/helpers/package-platform-aliases.js +34 -49
  74. package/helpers/package-platform-aliases.js.map +1 -1
  75. package/helpers/platform-types.d.ts +2 -0
  76. package/helpers/platform-types.js +2 -0
  77. package/helpers/platform-types.js.map +1 -0
  78. package/helpers/postcss-platform-config.d.ts +17 -1
  79. package/helpers/postcss-platform-config.js +20 -37
  80. package/helpers/postcss-platform-config.js.map +1 -1
  81. package/helpers/project.d.ts +35 -0
  82. package/helpers/project.js +120 -2
  83. package/helpers/project.js.map +1 -1
  84. package/helpers/resolve-main-field-platform.d.ts +20 -0
  85. package/helpers/resolve-main-field-platform.js +49 -0
  86. package/helpers/resolve-main-field-platform.js.map +1 -0
  87. package/helpers/resolver.js +17 -2
  88. package/helpers/resolver.js.map +1 -1
  89. package/helpers/theme-core-plugins.js +1 -1
  90. package/helpers/theme-core-plugins.js.map +1 -1
  91. package/helpers/ts-config-paths.d.ts +32 -0
  92. package/helpers/ts-config-paths.js +156 -27
  93. package/helpers/ts-config-paths.js.map +1 -1
  94. package/helpers/typescript-check.d.ts +2 -1
  95. package/helpers/typescript-check.js +2 -2
  96. package/helpers/typescript-check.js.map +1 -1
  97. package/helpers/ui-registration.d.ts +21 -0
  98. package/helpers/ui-registration.js +156 -0
  99. package/helpers/ui-registration.js.map +1 -0
  100. package/helpers/utils.d.ts +9 -0
  101. package/helpers/utils.js +22 -2
  102. package/helpers/utils.js.map +1 -1
  103. package/helpers/vite-package-version.d.ts +7 -0
  104. package/helpers/vite-package-version.js +44 -0
  105. package/helpers/vite-package-version.js.map +1 -0
  106. package/helpers/workers.d.ts +48 -19
  107. package/helpers/workers.js +662 -13
  108. package/helpers/workers.js.map +1 -1
  109. package/hmr/client/css-handler.d.ts +2 -1
  110. package/hmr/client/css-handler.js +50 -26
  111. package/hmr/client/css-handler.js.map +1 -1
  112. package/hmr/client/css-update-overlay.d.ts +18 -0
  113. package/hmr/client/css-update-overlay.js +27 -0
  114. package/hmr/client/css-update-overlay.js.map +1 -0
  115. package/hmr/client/framework-client-strategy.d.ts +79 -0
  116. package/hmr/client/framework-client-strategy.js +19 -0
  117. package/hmr/client/framework-client-strategy.js.map +1 -0
  118. package/hmr/client/hmr-pending-overlay.d.ts +0 -14
  119. package/hmr/client/hmr-pending-overlay.js +14 -4
  120. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  121. package/hmr/client/hot-context.d.ts +67 -0
  122. package/hmr/client/hot-context.js +284 -0
  123. package/hmr/client/hot-context.js.map +1 -0
  124. package/hmr/client/index.js +922 -273
  125. package/hmr/client/index.js.map +1 -1
  126. package/hmr/client/utils.d.ts +2 -1
  127. package/hmr/client/utils.js +111 -99
  128. package/hmr/client/utils.js.map +1 -1
  129. package/hmr/entry-runtime.d.ts +2 -1
  130. package/hmr/entry-runtime.js +279 -71
  131. package/hmr/entry-runtime.js.map +1 -1
  132. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  133. package/hmr/frameworks/angular/build/angular-linker.js +109 -0
  134. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  135. package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
  136. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
  137. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  138. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  139. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  140. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  141. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  142. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  143. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  144. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  145. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  146. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  147. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  148. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  149. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  150. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  151. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  152. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  153. package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
  154. package/hmr/frameworks/angular/build/util.js +155 -0
  155. package/hmr/frameworks/angular/build/util.js.map +1 -0
  156. package/hmr/frameworks/angular/client/index.js +542 -175
  157. package/hmr/frameworks/angular/client/index.js.map +1 -1
  158. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  159. package/hmr/frameworks/angular/client/strategy.js +19 -0
  160. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  161. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  162. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  163. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  164. package/hmr/frameworks/angular/server/linker.js +1 -4
  165. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  166. package/hmr/frameworks/angular/server/strategy.js +458 -12
  167. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  168. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  169. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  170. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +14 -11
  171. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +108 -111
  172. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  173. package/hmr/frameworks/react/server/strategy.d.ts +2 -0
  174. package/hmr/frameworks/react/server/strategy.js +230 -0
  175. package/hmr/frameworks/react/server/strategy.js.map +1 -0
  176. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  177. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  178. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  179. package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
  180. package/hmr/frameworks/solid/client/app-runtime.js +246 -0
  181. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
  182. package/hmr/frameworks/solid/server/strategy.js +291 -16
  183. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  184. package/hmr/frameworks/typescript/server/strategy.js +38 -14
  185. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  186. package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
  187. package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
  188. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  189. package/hmr/frameworks/vue/client/index.d.ts +9 -0
  190. package/hmr/frameworks/vue/client/index.js +251 -247
  191. package/hmr/frameworks/vue/client/index.js.map +1 -1
  192. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  193. package/hmr/frameworks/vue/client/strategy.js +157 -0
  194. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  195. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  196. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +142 -0
  197. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  198. package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
  199. package/hmr/frameworks/vue/server/compiler.js +3 -1
  200. package/hmr/frameworks/vue/server/compiler.js.map +1 -1
  201. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  202. package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
  203. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  204. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  205. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  206. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  207. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  208. package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
  209. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  210. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
  211. package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
  212. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  213. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  214. package/hmr/frameworks/vue/server/strategy.js +286 -7
  215. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  216. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  217. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  218. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  219. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  220. package/hmr/helpers/ast-normalizer.js +77 -10
  221. package/hmr/helpers/ast-normalizer.js.map +1 -1
  222. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  223. package/hmr/helpers/cjs-named-exports.js +152 -0
  224. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  225. package/hmr/helpers/package-exports.d.ts +16 -0
  226. package/hmr/helpers/package-exports.js +396 -0
  227. package/hmr/helpers/package-exports.js.map +1 -0
  228. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  229. package/hmr/helpers/vendor-rewrite.js +5 -3
  230. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  231. package/hmr/server/boot-archive-route.d.ts +40 -0
  232. package/hmr/server/boot-archive-route.js +154 -0
  233. package/hmr/server/boot-archive-route.js.map +1 -0
  234. package/hmr/server/boot-closure-route.d.ts +49 -0
  235. package/hmr/server/boot-closure-route.js +144 -0
  236. package/hmr/server/boot-closure-route.js.map +1 -0
  237. package/hmr/server/boot-recording.d.ts +58 -0
  238. package/hmr/server/boot-recording.js +228 -0
  239. package/hmr/server/boot-recording.js.map +1 -0
  240. package/hmr/server/constants.js +20 -5
  241. package/hmr/server/constants.js.map +1 -1
  242. package/hmr/server/core-bundle.d.ts +140 -0
  243. package/hmr/server/core-bundle.js +614 -0
  244. package/hmr/server/core-bundle.js.map +1 -0
  245. package/hmr/server/core-sanitize.d.ts +86 -7
  246. package/hmr/server/core-sanitize.js +170 -45
  247. package/hmr/server/core-sanitize.js.map +1 -1
  248. package/hmr/server/css-device-module.d.ts +28 -0
  249. package/hmr/server/css-device-module.js +44 -0
  250. package/hmr/server/css-device-module.js.map +1 -0
  251. package/hmr/server/deps-bundle.d.ts +218 -0
  252. package/hmr/server/deps-bundle.js +998 -0
  253. package/hmr/server/deps-bundle.js.map +1 -0
  254. package/hmr/server/device-transform-helpers.d.ts +24 -0
  255. package/hmr/server/device-transform-helpers.js +408 -0
  256. package/hmr/server/device-transform-helpers.js.map +1 -0
  257. package/hmr/server/framework-strategy.d.ts +113 -11
  258. package/hmr/server/hmr-module-graph.d.ts +37 -0
  259. package/hmr/server/hmr-module-graph.js +215 -0
  260. package/hmr/server/hmr-module-graph.js.map +1 -0
  261. package/hmr/server/import-map.d.ts +13 -4
  262. package/hmr/server/import-map.js +94 -47
  263. package/hmr/server/import-map.js.map +1 -1
  264. package/hmr/server/index.js +7 -16
  265. package/hmr/server/index.js.map +1 -1
  266. package/hmr/server/ns-core-cjs-shape.d.ts +2 -4
  267. package/hmr/server/ns-core-cjs-shape.js +4 -6
  268. package/hmr/server/ns-core-cjs-shape.js.map +1 -1
  269. package/hmr/server/ns-m-response-memo.d.ts +10 -0
  270. package/hmr/server/ns-m-response-memo.js +33 -0
  271. package/hmr/server/ns-m-response-memo.js.map +1 -0
  272. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  273. package/hmr/server/ns-rt-bridge.js +131 -0
  274. package/hmr/server/ns-rt-bridge.js.map +1 -0
  275. package/hmr/server/ns-rt-route.d.ts +5 -0
  276. package/hmr/server/ns-rt-route.js +39 -0
  277. package/hmr/server/ns-rt-route.js.map +1 -0
  278. package/hmr/server/perf-instrumentation.d.ts +6 -10
  279. package/hmr/server/perf-instrumentation.js +5 -6
  280. package/hmr/server/perf-instrumentation.js.map +1 -1
  281. package/hmr/server/process-code-for-device.d.ts +30 -0
  282. package/hmr/server/process-code-for-device.js +791 -0
  283. package/hmr/server/process-code-for-device.js.map +1 -0
  284. package/hmr/server/require-guard.d.ts +1 -0
  285. package/hmr/server/require-guard.js +12 -0
  286. package/hmr/server/require-guard.js.map +1 -0
  287. package/hmr/server/rewrite-imports.d.ts +2 -0
  288. package/hmr/server/rewrite-imports.js +638 -0
  289. package/hmr/server/rewrite-imports.js.map +1 -0
  290. package/hmr/server/route-helpers.d.ts +7 -0
  291. package/hmr/server/route-helpers.js +13 -0
  292. package/hmr/server/route-helpers.js.map +1 -0
  293. package/hmr/server/server-origin.d.ts +2 -0
  294. package/hmr/server/server-origin.js +83 -0
  295. package/hmr/server/server-origin.js.map +1 -0
  296. package/hmr/server/shared-transform-request.js +1 -2
  297. package/hmr/server/shared-transform-request.js.map +1 -1
  298. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  299. package/hmr/server/transform-cache-invalidation.js +156 -0
  300. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  301. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  302. package/hmr/server/vendor-bare-module-shims.js +80 -0
  303. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  304. package/hmr/server/vite-plugin.d.ts +1 -0
  305. package/hmr/server/vite-plugin.js +180 -54
  306. package/hmr/server/vite-plugin.js.map +1 -1
  307. package/hmr/server/websocket-core-bridge.d.ts +51 -4
  308. package/hmr/server/websocket-core-bridge.js +62 -54
  309. package/hmr/server/websocket-core-bridge.js.map +1 -1
  310. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  311. package/hmr/server/websocket-css-hot-update.js +65 -0
  312. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  313. package/hmr/server/websocket-device-transform.d.ts +3 -0
  314. package/hmr/server/websocket-device-transform.js +7 -0
  315. package/hmr/server/websocket-device-transform.js.map +1 -0
  316. package/hmr/server/websocket-hmr-pending.d.ts +3 -9
  317. package/hmr/server/websocket-hmr-pending.js +1 -1
  318. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  319. package/hmr/server/websocket-hot-update.d.ts +77 -0
  320. package/hmr/server/websocket-hot-update.js +360 -0
  321. package/hmr/server/websocket-hot-update.js.map +1 -0
  322. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  323. package/hmr/server/websocket-import-map-route.js +50 -0
  324. package/hmr/server/websocket-import-map-route.js.map +1 -0
  325. package/hmr/server/websocket-module-bindings.js +3 -3
  326. package/hmr/server/websocket-module-bindings.js.map +1 -1
  327. package/hmr/server/websocket-module-specifiers.d.ts +66 -2
  328. package/hmr/server/websocket-module-specifiers.js +191 -20
  329. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  330. package/hmr/server/websocket-ns-core.d.ts +34 -0
  331. package/hmr/server/websocket-ns-core.js +414 -0
  332. package/hmr/server/websocket-ns-core.js.map +1 -0
  333. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  334. package/hmr/server/websocket-ns-entry.js +164 -0
  335. package/hmr/server/websocket-ns-entry.js.map +1 -0
  336. package/hmr/server/websocket-ns-m-paths.d.ts +1 -3
  337. package/hmr/server/websocket-ns-m-paths.js +25 -82
  338. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  339. package/hmr/server/websocket-ns-m-request.d.ts +11 -1
  340. package/hmr/server/websocket-ns-m-request.js +17 -9
  341. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  342. package/hmr/server/websocket-ns-m.d.ts +52 -0
  343. package/hmr/server/websocket-ns-m.js +835 -0
  344. package/hmr/server/websocket-ns-m.js.map +1 -0
  345. package/hmr/server/websocket-served-module-helpers.d.ts +50 -4
  346. package/hmr/server/websocket-served-module-helpers.js +384 -86
  347. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  348. package/hmr/server/websocket-txn.js +6 -9
  349. package/hmr/server/websocket-txn.js.map +1 -1
  350. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  351. package/hmr/server/websocket-vendor-unifier.js +4 -9
  352. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  353. package/hmr/server/websocket.d.ts +7 -39
  354. package/hmr/server/websocket.js +643 -6716
  355. package/hmr/server/websocket.js.map +1 -1
  356. package/hmr/shared/ns-globals.d.ts +108 -0
  357. package/hmr/shared/ns-globals.js +28 -0
  358. package/hmr/shared/ns-globals.js.map +1 -0
  359. package/hmr/shared/protocol.d.ts +145 -0
  360. package/hmr/shared/protocol.js +28 -0
  361. package/hmr/shared/protocol.js.map +1 -0
  362. package/hmr/shared/runtime/boot-archive-format.d.ts +16 -0
  363. package/hmr/shared/runtime/boot-archive-format.js +31 -0
  364. package/hmr/shared/runtime/boot-archive-format.js.map +1 -0
  365. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  366. package/hmr/shared/runtime/boot-complete.js +32 -0
  367. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  368. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  369. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  370. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  371. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  372. package/hmr/shared/runtime/boot-progress.js +134 -0
  373. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  374. package/hmr/shared/runtime/boot-timeline.d.ts +2 -1
  375. package/hmr/shared/runtime/boot-timeline.js +9 -22
  376. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  377. package/hmr/shared/runtime/browser-runtime-contract.d.ts +53 -22
  378. package/hmr/shared/runtime/browser-runtime-contract.js +6 -9
  379. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  380. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  381. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  382. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  383. package/hmr/shared/runtime/dev-overlay.d.ts +76 -30
  384. package/hmr/shared/runtime/dev-overlay.js +767 -408
  385. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  386. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  387. package/hmr/shared/runtime/global-scope.js +21 -0
  388. package/hmr/shared/runtime/global-scope.js.map +1 -0
  389. package/hmr/shared/runtime/hooks.js +2 -1
  390. package/hmr/shared/runtime/hooks.js.map +1 -1
  391. package/hmr/shared/runtime/http-only-boot.js +7 -6
  392. package/hmr/shared/runtime/http-only-boot.js.map +1 -1
  393. package/hmr/shared/runtime/module-provenance.js +4 -6
  394. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  395. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  396. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  397. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  398. package/hmr/shared/runtime/root-placeholder.js +398 -204
  399. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  400. package/hmr/shared/runtime/session-bootstrap.js +274 -55
  401. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  402. package/hmr/shared/runtime/vendor-bootstrap.js +3 -10
  403. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  404. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  405. package/hmr/shared/vendor/manifest-collect.js +549 -0
  406. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  407. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  408. package/hmr/shared/vendor/manifest-loader.js +5 -3
  409. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  410. package/hmr/shared/vendor/manifest.d.ts +1 -7
  411. package/hmr/shared/vendor/manifest.js +136 -825
  412. package/hmr/shared/vendor/manifest.js.map +1 -1
  413. package/hmr/shared/vendor/registry.d.ts +2 -0
  414. package/hmr/shared/vendor/registry.js +14 -0
  415. package/hmr/shared/vendor/registry.js.map +1 -1
  416. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  417. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  418. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  419. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +76 -0
  420. package/hmr/shared/vendor/vendor-esbuild-plugins.js +401 -0
  421. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  422. package/hmr/vendor-bootstrap.d.ts +1 -3
  423. package/hmr/vendor-bootstrap.js +4 -6
  424. package/hmr/vendor-bootstrap.js.map +1 -1
  425. package/index.d.ts +1 -0
  426. package/index.js +5 -0
  427. package/index.js.map +1 -1
  428. package/package.json +65 -11
  429. package/runtime/core-aliases-early.js +25 -55
  430. package/runtime/core-aliases-early.js.map +1 -1
  431. package/shims/react-jsx-runtime.d.ts +4 -0
  432. package/shims/react-jsx-runtime.js +61 -0
  433. package/shims/react-jsx-runtime.js.map +1 -0
  434. package/helpers/angular/angular-linker.d.ts +0 -13
  435. package/helpers/angular/angular-linker.js +0 -194
  436. package/helpers/angular/angular-linker.js.map +0 -1
  437. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  438. package/helpers/angular/shared-linker.d.ts +0 -11
  439. package/helpers/angular/shared-linker.js +0 -75
  440. package/helpers/angular/shared-linker.js.map +0 -1
  441. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  442. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  443. package/helpers/angular/util.js +0 -67
  444. package/helpers/angular/util.js.map +0 -1
  445. package/helpers/prelink-angular.d.ts +0 -2
  446. package/helpers/prelink-angular.js +0 -117
  447. package/helpers/prelink-angular.js.map +0 -1
  448. package/hmr/server/websocket-angular-entry.js.map +0 -1
  449. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  450. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
  451. package/hmr/server/websocket-ns-m-finalize.js +0 -88
  452. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  453. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  454. package/hmr/server/websocket-runtime-compat.js +0 -286
  455. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  456. package/hmr/server/websocket-vue-sfc.d.ts +0 -27
  457. package/hmr/server/websocket-vue-sfc.js +0 -1114
  458. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  459. package/transformers/NativeClass/index.d.ts +0 -2
  460. package/transformers/NativeClass/index.js +0 -222
  461. package/transformers/NativeClass/index.js.map +0 -1
  462. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  463. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  464. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  465. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -1,4 +1,7 @@
1
1
  import { setHmrBootStage } from './dev-overlay.js';
2
+ import { buildPlaceholderPage } from './root-placeholder-view.js';
3
+ import { getGlobalScope } from './global-scope.js';
4
+ import { markDevBootComplete } from './boot-complete.js';
2
5
  function isPlaceholderView(view, placeholderRoot) {
3
6
  if (!view) {
4
7
  return false;
@@ -15,17 +18,37 @@ function isPlaceholderView(view, placeholderRoot) {
15
18
  return false;
16
19
  }
17
20
  function getCommittedRootView(application, placeholderRoot) {
18
- try {
19
- const root = application?.getRootView?.() || null;
20
- if (!root) {
21
- return null;
22
- }
23
- if (!isPlaceholderView(root, placeholderRoot)) {
24
- return root;
21
+ const probe = (app) => {
22
+ try {
23
+ const root = app?.getRootView?.() || null;
24
+ if (!root)
25
+ return null;
26
+ if (!isPlaceholderView(root, placeholderRoot))
27
+ return root;
28
+ const currentPage = root.currentPage || root._currentEntry?.resolvedPage || null;
29
+ if (currentPage && !isPlaceholderView(currentPage, placeholderRoot))
30
+ return root;
25
31
  }
26
- const currentPage = root.currentPage || root._currentEntry?.resolvedPage || null;
27
- if (currentPage && !isPlaceholderView(currentPage, placeholderRoot)) {
28
- return root;
32
+ catch { }
33
+ return null;
34
+ };
35
+ const primary = probe(application);
36
+ if (primary)
37
+ return primary;
38
+ // Vite HMR realm split: Angular's `Application.resetRootView` may have
39
+ // committed the real root on a different Application instance than the
40
+ // one the placeholder/early hook patched. Scan every Application we
41
+ // know about so we can detect the commit regardless of which twin
42
+ // Angular actually wrote to.
43
+ try {
44
+ const g = getGlobalScope();
45
+ const known = g['__NS_DEV_KNOWN_APPLICATIONS__'] || [];
46
+ for (const app of known) {
47
+ if (!app || app === application)
48
+ continue;
49
+ const r = probe(app);
50
+ if (r)
51
+ return r;
29
52
  }
30
53
  }
31
54
  catch { }
@@ -85,6 +108,9 @@ function clearPlaceholderGlobals(g) {
85
108
  delete g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'];
86
109
  delete g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'];
87
110
  delete g['__NS_DEV_BOOT_STATUS_LABEL__'];
111
+ delete g['__NS_DEV_BOOT_DETAIL_LABEL__'];
112
+ delete g['__NS_DEV_BOOT_PROGRESS_FILL__'];
113
+ delete g['__NS_DEV_BOOT_PROGRESS_LAST_SCALE__'];
88
114
  delete g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'];
89
115
  delete g['__NS_DEV_PLACEHOLDER_LAUNCH_HANDLER__'];
90
116
  delete g['__NS_DEV_PLACEHOLDER_APPLICATION__'];
@@ -98,12 +124,48 @@ function clearPlaceholderGlobals(g) {
98
124
  delete g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__'];
99
125
  }
100
126
  export function tryFinalizeBootPlaceholder(reason, verbose) {
101
- const g = globalThis;
127
+ const g = getGlobalScope();
102
128
  const placeholderRoot = g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'] || null;
103
129
  const hadPlaceholder = !!placeholderRoot || !!g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'] || !!g['__NS_DEV_BOOT_STATUS_LABEL__'] || !!g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'];
104
130
  const application = g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application;
105
131
  const committedRoot = getCommittedRootView(application, placeholderRoot);
106
132
  if (!committedRoot) {
133
+ // Verbose-gated, throttled to 1 Hz to avoid spamming the log on long stalls.
134
+ try {
135
+ if (verbose) {
136
+ const now = Date.now();
137
+ const last = g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ || 0;
138
+ if (now - last > 1000) {
139
+ g.__NS_PLACEHOLDER_DIAG_LAST_FINALIZE__ = now;
140
+ const describe = (app) => {
141
+ try {
142
+ const r = app?.getRootView?.();
143
+ const cp = r?.currentPage || r?._currentEntry?.resolvedPage;
144
+ return {
145
+ appType: app?.constructor?.name || typeof app,
146
+ appIdentity: app === application ? 'primary' : 'alt',
147
+ rootType: r?.constructor?.name || 'null',
148
+ rootIsPlaceholder: !!r && (r === placeholderRoot || r.__ns_dev_placeholder === true),
149
+ currentPageType: cp?.constructor?.name,
150
+ };
151
+ }
152
+ catch {
153
+ return { appType: 'error' };
154
+ }
155
+ };
156
+ const known = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []);
157
+ console.warn('[ns-placeholder][diag] tryFinalize: no committed root', {
158
+ reason,
159
+ hadPlaceholder,
160
+ placeholderRootType: placeholderRoot?.constructor?.name,
161
+ primary: describe(application),
162
+ knownApplications: known.length,
163
+ alts: known.filter((a) => a && a !== application).map(describe),
164
+ });
165
+ }
166
+ }
167
+ }
168
+ catch { }
107
169
  return false;
108
170
  }
109
171
  let detachedPlaceholder = false;
@@ -119,29 +181,26 @@ export function tryFinalizeBootPlaceholder(reason, verbose) {
119
181
  clearPlaceholderGlobals(g);
120
182
  detachedPlaceholder = true;
121
183
  }
122
- try {
123
- g.__NS_HMR_BOOT_COMPLETE__ = true;
124
- }
125
- catch { }
184
+ // Flips the JS global AND the native cold-boot gate
185
+ // (`__NS_DEV__.setDevBootComplete`): the real root is committed, so the
186
+ // runtime's boot-only runloop pump can disarm.
187
+ markDevBootComplete();
126
188
  if (detachedPlaceholder) {
127
189
  setHmrBootStage('app-root-committed', {
128
190
  detail: 'The real app root replaced the boot placeholder.',
129
191
  });
130
192
  }
131
193
  if (verbose) {
132
- try {
133
- console.info('[ns-placeholder] real app root committed', {
134
- reason,
135
- rootType: committedRoot?.constructor?.name || typeof committedRoot,
136
- detachedPlaceholder,
137
- });
138
- }
139
- catch { }
194
+ console.info('[ns-placeholder] real app root committed', {
195
+ reason,
196
+ rootType: committedRoot?.constructor?.name || typeof committedRoot,
197
+ detachedPlaceholder,
198
+ });
140
199
  }
141
200
  return true;
142
201
  }
143
202
  function scheduleBootPlaceholderFinalize(reason, verbose) {
144
- const g = globalThis;
203
+ const g = getGlobalScope();
145
204
  if (g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__']) {
146
205
  return;
147
206
  }
@@ -155,17 +214,33 @@ function scheduleBootPlaceholderFinalize(reason, verbose) {
155
214
  }
156
215
  attempts += 1;
157
216
  if (Date.now() - startedAt >= maxWaitMs) {
158
- if (verbose) {
159
- try {
160
- console.info('[ns-placeholder] waiting for real root commit timed out', {
217
+ // Always-on: a dev session that never commits a real root used to be
218
+ // an INFINITE silent spinner — the most common cause (a swallowed
219
+ // XML/Builder error during Application.run) printed one console line
220
+ // and nothing else. Flip the boot overlay to its error stage with the
221
+ // last captured builder error so the failure is visible on-device.
222
+ // Core's SourceErrorFormat stashes that error on
223
+ // `globalThis.__NS_LAST_XML_ERROR__` for exactly this hand-off.
224
+ try {
225
+ const lastXmlError = g.__NS_LAST_XML_ERROR__;
226
+ const hint = lastXmlError && lastXmlError.message ? `Last UI build error — ${lastXmlError.uri}: ${lastXmlError.message}` : 'No error was captured; check the device console for the first failure after launch.';
227
+ setHmrBootStage('error', {
228
+ detail: `Dev session is active but the app root never replaced the boot placeholder (waited ${Math.round((Date.now() - startedAt) / 1000)}s). ${hint}`,
229
+ });
230
+ }
231
+ catch { }
232
+ // Verbose-gated: enable `verbose` in the HMR config to surface stall diagnostics.
233
+ try {
234
+ if (verbose) {
235
+ console.warn('[ns-placeholder][diag] waiting for real root commit TIMED OUT', {
161
236
  reason,
162
237
  attempts,
163
238
  waitMs: Date.now() - startedAt,
164
239
  state: getPlaceholderWaitDiagnosticSnapshot(g, g['__NS_DEV_PLACEHOLDER_APPLICATION__'] || g.Application, g['__NS_DEV_PLACEHOLDER_ROOT_VIEW__'] || null),
165
240
  });
166
241
  }
167
- catch { }
168
242
  }
243
+ catch { }
169
244
  return;
170
245
  }
171
246
  g['__NS_DEV_PLACEHOLDER_RESTORE_TIMER__'] = setTimeout(tick, attempts === 1 ? 0 : 100);
@@ -184,7 +259,7 @@ function scheduleBootPlaceholderFinalize(reason, verbose) {
184
259
  // exactly as it would in production — the patch intercepts it and does a clean
185
260
  // root replacement instead of fighting the already-running lifecycle.
186
261
  export function installRootPlaceholder(verbose) {
187
- const g = globalThis;
262
+ const g = getGlobalScope();
188
263
  if (g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'])
189
264
  return;
190
265
  g['__NS_DEV_PLACEHOLDER_ROOT_EARLY__'] = true;
@@ -303,35 +378,159 @@ export function installRootPlaceholder(verbose) {
303
378
  }
304
379
  g['__NS_DEV_PLACEHOLDER_APPLICATION__'] = Application;
305
380
  const isAndroid = !!(g.__ANDROID__ || typeof g.android !== 'undefined');
306
- if (!isAndroid && typeof Application.resetRootView === 'function' && !g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__']) {
307
- const __ns_dev_original_reset_root_view = Application.resetRootView.bind(Application);
308
- const __ns_dev_patched_reset_root_view = function __ns_dev_patched_reset_root_view(entry) {
309
- const result = __ns_dev_original_reset_root_view(entry);
381
+ // Patch `Application.resetRootView` on BOTH platforms so the placeholder
382
+ // finalize callback (`__NS_DEV_RESTORE_PLACEHOLDER__`) fires every time the
383
+ // framework swaps the root view. The early Android wrapper in
384
+ // `core-aliases-early.ts` is unreliable under HTTP HMR boot (it runs before
385
+ // `g.Application` exists), so we wrap here too and coordinate via
386
+ // `__NS_DEV_PATCHED_RESET_ROOT__` to avoid double-wrapping.
387
+ const earlyAndroidWrapped = !!g['__NS_DEV_PATCHED_RESET_ROOT__'];
388
+ // Verbose-gated: the diag stream (resetRootView wraps, launch-handler
389
+ // entries, placeholder install state) only matters when investigating a stall.
390
+ const diag = verbose
391
+ ? (...args) => {
310
392
  try {
311
- const restore = g['__NS_DEV_RESTORE_PLACEHOLDER__'];
312
- if (typeof restore === 'function') {
313
- restore('Application.resetRootView');
314
- }
393
+ console.warn('[ns-placeholder][diag]', ...args);
315
394
  }
316
395
  catch { }
317
- return result;
318
- };
319
- Application.resetRootView = __ns_dev_patched_reset_root_view;
396
+ }
397
+ : () => { };
398
+ diag('install entry', {
399
+ platform: isAndroid ? 'android' : 'ios',
400
+ applicationSource: applicationResolved.source,
401
+ applicationType: Application?.constructor?.name,
402
+ hasReset: typeof Application.resetRootView === 'function',
403
+ alreadyPatchedEarly: earlyAndroidWrapped,
404
+ alreadyPatchedView: !!g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'],
405
+ globalApplicationSame: g.Application === Application,
406
+ vendorApplicationSame: (() => {
407
+ try {
408
+ const v = g.__nsVendorRegistry?.get?.('@nativescript/core');
409
+ return v?.Application === Application || v?.default?.Application === Application;
410
+ }
411
+ catch {
412
+ return null;
413
+ }
414
+ })(),
415
+ });
416
+ // Always patch every Application instance we can find. The early
417
+ // Android hook in `core-aliases-early.ts` only patches `g.Application`
418
+ // (the bundled realm's Application) and its prototype — but on Vite
419
+ // HMR there can be a SECOND Application loaded by the HTTP realm
420
+ // (`vendor-registry @nativescript/core`) that Angular's `import { Application }`
421
+ // actually resolves to. If we don't patch that twin too, Angular's
422
+ // `Application.resetRootView({ create: () => doc })` lands on an
423
+ // unpatched object, the placeholder finalize callback is never
424
+ // invoked, and the boot stalls at "Waiting for the app root view".
425
+ const makePatched = (origReset, label) => function __ns_dev_patched_reset_root_view(entry) {
426
+ diag(`patched resetRootView called (${label})`, {
427
+ hasEntry: !!entry,
428
+ entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
429
+ });
430
+ const result = origReset(entry);
320
431
  try {
321
- if (g.Application && g.Application !== Application) {
322
- g.Application.resetRootView = __ns_dev_patched_reset_root_view;
432
+ const restore = g['__NS_DEV_RESTORE_PLACEHOLDER__'];
433
+ if (typeof restore === 'function') {
434
+ restore(`Application.resetRootView (${label})`);
323
435
  }
324
436
  }
325
- catch { }
437
+ catch (e) {
438
+ diag('patched resetRootView restore threw', String(e && (e.message || e)));
439
+ }
440
+ return result;
441
+ };
442
+ const wrapOnce = (target, label) => {
443
+ try {
444
+ if (!target || typeof target.resetRootView !== 'function')
445
+ return false;
446
+ if (target.resetRootView.__ns_dev_placeholder_wrap === true)
447
+ return false;
448
+ const orig = target.resetRootView.bind(target);
449
+ const wrapped = makePatched(orig, label);
450
+ wrapped.__ns_dev_placeholder_wrap = true;
451
+ target.resetRootView = wrapped;
452
+ return true;
453
+ }
454
+ catch {
455
+ return false;
456
+ }
457
+ };
458
+ const wrappedLocal = wrapOnce(Application, 'local');
459
+ const wrappedGlobal = g.Application && g.Application !== Application ? wrapOnce(g.Application, 'global') : false;
460
+ const wrappedProto = (() => {
326
461
  try {
327
462
  const proto = Object.getPrototypeOf(Application);
328
- if (proto && typeof proto.resetRootView === 'function' && proto.resetRootView !== __ns_dev_patched_reset_root_view) {
329
- proto.resetRootView = __ns_dev_patched_reset_root_view;
463
+ return wrapOnce(proto, 'proto');
464
+ }
465
+ catch {
466
+ return false;
467
+ }
468
+ })();
469
+ // Vendor-realm Application coverage. Even when `earlyAndroidWrapped`
470
+ // is true, the early hook only touched `g.Application` + its proto;
471
+ // the vendor's Application is a separate object with its own
472
+ // `resetRootView` that the early hook never sees.
473
+ let wrappedVendor = false;
474
+ let wrappedVendorAppModule = false;
475
+ try {
476
+ const reg = g.__nsVendorRegistry;
477
+ if (reg && typeof reg.get === 'function') {
478
+ const vendorCore = reg.get('@nativescript/core');
479
+ const vendorApp = vendorCore?.Application || vendorCore?.default?.Application;
480
+ if (vendorApp && vendorApp !== Application) {
481
+ wrappedVendor = wrapOnce(vendorApp, 'vendor-core');
482
+ try {
483
+ const vp = Object.getPrototypeOf(vendorApp);
484
+ if (vp && vp !== Object.getPrototypeOf(Application)) {
485
+ wrapOnce(vp, 'vendor-core-proto');
486
+ }
487
+ }
488
+ catch { }
489
+ }
490
+ const vendorAppMod = reg.get('@nativescript/core/application');
491
+ const vendorAppOnly = vendorAppMod?.Application || vendorAppMod?.default?.Application;
492
+ if (vendorAppOnly && vendorAppOnly !== Application && vendorAppOnly !== vendorApp) {
493
+ wrappedVendorAppModule = wrapOnce(vendorAppOnly, 'vendor-application');
494
+ }
495
+ }
496
+ }
497
+ catch { }
498
+ // Track every Application instance we know about so
499
+ // `tryFinalizeBootPlaceholder` can poll the real root view on the
500
+ // instance Angular actually committed to.
501
+ try {
502
+ const apps = (g['__NS_DEV_KNOWN_APPLICATIONS__'] || (g['__NS_DEV_KNOWN_APPLICATIONS__'] = []));
503
+ const push = (a) => {
504
+ if (a && apps.indexOf(a) === -1)
505
+ apps.push(a);
506
+ };
507
+ push(Application);
508
+ push(g.Application);
509
+ try {
510
+ const reg = g.__nsVendorRegistry;
511
+ if (reg && typeof reg.get === 'function') {
512
+ const vendorCore = reg.get('@nativescript/core');
513
+ push(vendorCore?.Application);
514
+ push(vendorCore?.default?.Application);
515
+ const vendorAppMod = reg.get('@nativescript/core/application');
516
+ push(vendorAppMod?.Application);
517
+ push(vendorAppMod?.default?.Application);
330
518
  }
331
519
  }
332
520
  catch { }
333
- g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
334
521
  }
522
+ catch { }
523
+ g['__NS_DEV_PATCHED_RESET_ROOT_VIEW__'] = true;
524
+ g['__NS_DEV_PATCHED_RESET_ROOT__'] = true;
525
+ diag('patched Application.resetRootView', {
526
+ platform: isAndroid ? 'android' : 'ios',
527
+ wrappedLocal,
528
+ wrappedGlobal,
529
+ wrappedProto,
530
+ wrappedVendor,
531
+ wrappedVendorAppModule,
532
+ knownApplications: (g['__NS_DEV_KNOWN_APPLICATIONS__'] || []).length,
533
+ });
335
534
  const canCreatePlaceholderRoot = !!Frame && !!Page && !!Label;
336
535
  if (!canCreatePlaceholderRoot && verbose) {
337
536
  console.warn('[ns-placeholder] visual placeholder unavailable; starting lifecycle without placeholder root', {
@@ -352,67 +551,21 @@ export function installRootPlaceholder(verbose) {
352
551
  let handlerFired = false;
353
552
  // launchEvent handler: provides a placeholder root, then patches Application.run
354
553
  const __ns_launch_handler = (args) => {
355
- if (verbose) {
356
- try {
357
- console.info('[ns-placeholder] launch handler fired', {
358
- hasArgs: !!args,
359
- hasExistingRoot: !!args?.root,
360
- hasLaunched: typeof Application.hasLaunched === 'function' ? !!Application.hasLaunched() : undefined,
361
- started: !!Application.started,
362
- });
363
- }
364
- catch { }
365
- }
554
+ diag('launch handler fired', {
555
+ hasArgs: !!args,
556
+ hasExistingRoot: !!args?.root,
557
+ existingRootType: args?.root?.constructor?.name,
558
+ hasLaunched: typeof Application.hasLaunched === 'function' ? !!Application.hasLaunched() : undefined,
559
+ started: !!Application.started,
560
+ });
366
561
  try {
367
562
  const prev = args?.root;
368
563
  if (!prev && canCreatePlaceholderRoot && Frame && Page && Label) {
369
- const StackLayout = getCore('StackLayout').value;
370
- const page = new Page();
371
- page.actionBarHidden = true;
372
- const titleLabel = new Label();
373
- titleLabel.text = 'NativeScript Vite preparing dev session...';
374
- titleLabel.textAlignment = 'center';
375
- titleLabel.textWrap = true;
376
- titleLabel.fontSize = 20;
377
- const statusLabel = new Label();
378
- statusLabel.text = 'Preparing the HTTP HMR bootstrap (4%)';
379
- statusLabel.textAlignment = 'center';
380
- statusLabel.textWrap = true;
381
- statusLabel.fontSize = 14;
382
- statusLabel.marginTop = 12;
383
- const activityIndicator = ActivityIndicator
384
- ? (() => {
385
- const indicator = new ActivityIndicator();
386
- indicator.busy = true;
387
- indicator.marginTop = 16;
388
- indicator.width = 28;
389
- indicator.height = 28;
390
- indicator.horizontalAlignment = 'center';
391
- return indicator;
392
- })()
393
- : null;
394
- if (StackLayout) {
395
- const root = new StackLayout();
396
- root.padding = 24;
397
- root.verticalAlignment = 'middle';
398
- root.horizontalAlignment = 'center';
399
- root.addChild(titleLabel);
400
- root.addChild(statusLabel);
401
- if (activityIndicator) {
402
- root.addChild(activityIndicator);
403
- }
404
- page.content = root;
405
- }
406
- else {
407
- // Fallback: just show the title label centered
408
- titleLabel.verticalAlignment = 'middle';
409
- titleLabel.horizontalAlignment = 'center';
410
- titleLabel.width = 280;
411
- titleLabel.padding = 12;
412
- page.content = titleLabel;
413
- }
414
- // Store refs so the overlay API can update the status label
564
+ const built = buildPlaceholderPage({ Page, Label, ActivityIndicator, StackLayout: getCore('StackLayout').value, GridLayout: getCore('GridLayout').value, ContentView: getCore('ContentView').value, Image: getCore('Image').value, Color: getCore('Color').value, verbose });
565
+ const { page, statusLabel, detailLabel, progressFill, activityIndicator } = built;
415
566
  g['__NS_DEV_BOOT_STATUS_LABEL__'] = statusLabel;
567
+ g['__NS_DEV_BOOT_DETAIL_LABEL__'] = detailLabel;
568
+ g['__NS_DEV_BOOT_PROGRESS_FILL__'] = progressFill;
416
569
  g['__NS_DEV_BOOT_ACTIVITY_INDICATOR__'] = activityIndicator;
417
570
  const frame = new Frame();
418
571
  frame.navigate({ create: () => page, clearHistory: true, animated: false });
@@ -423,15 +576,12 @@ export function installRootPlaceholder(verbose) {
423
576
  }
424
577
  catch { }
425
578
  if (verbose) {
426
- try {
427
- console.info('[ns-placeholder] assigned placeholder root', {
428
- frameType: frame?.constructor?.name,
429
- pageType: page?.constructor?.name,
430
- hasStackLayout: !!StackLayout,
431
- hasActivityIndicator: !!activityIndicator,
432
- });
433
- }
434
- catch { }
579
+ console.info('[ns-placeholder] assigned placeholder root', {
580
+ frameType: frame?.constructor?.name,
581
+ pageType: page?.constructor?.name,
582
+ hasProgressFill: !!progressFill,
583
+ hasActivityIndicator: !!activityIndicator,
584
+ });
435
585
  }
436
586
  if (args)
437
587
  args.root = frame;
@@ -453,80 +603,120 @@ export function installRootPlaceholder(verbose) {
453
603
  if (Application && typeof Application.run === 'function') {
454
604
  const _originalRun = Application.run.bind(Application);
455
605
  g['__NS_DEV_ORIGINAL_APP_RUN__'] = _originalRun;
606
+ // HMR ordering invariant: the patched `Application.run` MUST yield
607
+ // back to the synchronous caller before any iOS view-lifecycle event
608
+ // fires on the new root view.
609
+ //
610
+ // Concrete bug this guards against: nativescript-vue's `app.start()` is
611
+ // const componentInstance = app.mount(createAppRoot(), false, false);
612
+ // startApp(componentInstance); // → Application.run({ create: … })
613
+ // setRootApp(app); // — sets the module-private `rootApp`
614
+ // In a non-HMR build `Application.run` is `UIApplicationMain`, which
615
+ // returns control to the iOS runloop and lets `setRootApp(app)` execute
616
+ // before any `loaded`/`traitCollectionDidChange` callbacks fire. Under
617
+ // HMR `Application.run` is replaced with synchronous `resetRootView`,
618
+ // which attaches the root to the window *inside* this call — iOS then
619
+ // synchronously fires `loaded` on the new view tree, a TabView handler
620
+ // calls `nativescript-vue`'s `createNativeView`, that reads
621
+ // `rootApp._context`, and crashes with
622
+ // TypeError: Cannot read properties of null (reading '_context')
623
+ // because `setRootApp(app)` hasn't run yet.
624
+ //
625
+ // `setRootApp` is module-private inside the vendor bundle, so the bridge
626
+ // cannot call it directly. Deferring the synchronous root attachment to a
627
+ // microtask restores the production timing: every consumer that called
628
+ // `Application.run(entry)` completes its tail (including private state
629
+ // setters like `setRootApp`) before iOS triggers lifecycle on the new
630
+ // root. The microtask runs before any I/O or DOM-tick boundary, so the UI
631
+ // still appears in the same iOS runloop turn — no user-visible delay.
456
632
  const __ns_dev_patched_run = function __ns_dev_patched_run(entry) {
633
+ diag('patched Application.run called', {
634
+ hasEntry: !!entry,
635
+ entryKind: entry?.create ? 'create-fn' : entry?.moduleName ? 'module-name' : typeof entry,
636
+ });
637
+ // Detach the launch handler synchronously: by the time the caller
638
+ // returned from `Application.run()`, the framework owns root-view
639
+ // management, and we must not re-enter the placeholder path on a
640
+ // subsequent launch tick.
457
641
  try {
458
- // Detach the launch handler, but keep placeholder refs until the
459
- // real app root is actually committed.
460
- try {
461
- if (Application && Application.off) {
462
- Application.off(Application.launchEvent, __ns_launch_handler);
463
- }
464
- }
465
- catch { }
466
- // When entry is undefined/null, the calling framework (e.g. Angular)
467
- // manages root views itself via launch events and resetRootView().
468
- // Don't attempt resetRootView(undefined) which throws "Main entry is missing".
469
- if (!entry) {
470
- if (verbose)
471
- console.info('[ns-placeholder] patched run() called with no entry; framework manages root view');
472
- return;
642
+ if (Application && Application.off) {
643
+ Application.off(Application.launchEvent, __ns_launch_handler);
473
644
  }
474
- const isModuleNameEntry = entry && entry.moduleName && !entry.create;
475
- if (isModuleNameEntry) {
476
- if (typeof Application.resetRootView === 'function') {
477
- Application.resetRootView(entry);
645
+ }
646
+ catch { }
647
+ // Frameworks (notably Angular) call `Application.run()` with no
648
+ // entry — they own the root via launch events and `resetRootView()`
649
+ // directly. Bailing here keeps `resetRootView(undefined)` from
650
+ // throwing "Main entry is missing".
651
+ if (!entry) {
652
+ diag('patched run() called with no entry; framework manages root view');
653
+ return;
654
+ }
655
+ // Snapshot for the deferred body so a later mutation by the caller
656
+ // can't observe a half-finished closure.
657
+ const __ns_deferred_entry = entry;
658
+ const __ns_deferred_reset = () => {
659
+ try {
660
+ const isModuleNameEntry = __ns_deferred_entry && __ns_deferred_entry.moduleName && !__ns_deferred_entry.create;
661
+ if (isModuleNameEntry) {
662
+ if (typeof Application.resetRootView === 'function') {
663
+ Application.resetRootView(__ns_deferred_entry);
664
+ }
478
665
  }
479
- }
480
- else {
481
- // Framework path: two-phase boot with dominative document
482
- Application._rootView = null;
483
- try {
484
- const domModule = g.__nsVendorRegistry?.get?.('dominative') ||
485
- (typeof require === 'function'
486
- ? (() => {
487
- try {
488
- return require('dominative');
489
- }
490
- catch {
491
- return null;
492
- }
493
- })()
494
- : null);
495
- const doc = domModule?.document;
496
- if (doc && typeof Application.resetRootView === 'function') {
497
- Application.resetRootView({ create: () => doc });
498
- if (entry && typeof entry.create === 'function') {
499
- entry.create();
666
+ else {
667
+ // Framework path: two-phase boot with dominative document
668
+ Application._rootView = null;
669
+ try {
670
+ const domModule = g.__nsVendorRegistry?.get?.('dominative') ||
671
+ (typeof require === 'function'
672
+ ? (() => {
673
+ try {
674
+ return require('dominative');
675
+ }
676
+ catch {
677
+ return null;
678
+ }
679
+ })()
680
+ : null);
681
+ const doc = domModule?.document;
682
+ if (doc && typeof Application.resetRootView === 'function') {
683
+ Application.resetRootView({ create: () => doc });
684
+ if (__ns_deferred_entry && typeof __ns_deferred_entry.create === 'function') {
685
+ __ns_deferred_entry.create();
686
+ }
500
687
  }
501
- }
502
- else {
503
- if (typeof Application.resetRootView === 'function') {
504
- Application.resetRootView(entry);
688
+ else {
689
+ if (typeof Application.resetRootView === 'function') {
690
+ Application.resetRootView(__ns_deferred_entry);
691
+ }
505
692
  }
506
693
  }
507
- }
508
- catch (e2) {
509
- if (verbose)
510
- console.warn('[ns-placeholder] two-phase boot failed:', e2?.message || e2);
511
- try {
512
- if (typeof Application.resetRootView === 'function') {
513
- Application.resetRootView(entry);
694
+ catch (e2) {
695
+ if (verbose)
696
+ console.warn('[ns-placeholder] two-phase boot failed:', e2?.message || e2);
697
+ try {
698
+ if (typeof Application.resetRootView === 'function') {
699
+ Application.resetRootView(__ns_deferred_entry);
700
+ }
514
701
  }
702
+ catch { }
515
703
  }
516
- catch { }
517
704
  }
518
705
  }
519
- }
520
- catch (e) {
521
- console.warn('[ns-placeholder] patched run() error:', e);
522
- }
706
+ catch (e) {
707
+ console.warn('[ns-placeholder] deferred patched run() error:', e);
708
+ }
709
+ };
710
+ // Microtask-defer. `Promise.resolve().then(...)` lands the callback
711
+ // in the same iOS runloop turn — no perceptible delay — but only
712
+ // after the synchronous call stack that invoked `Application.run`
713
+ // has fully unwound, so `nativescript-vue`'s post-`startApp` code
714
+ // (`setRootApp(app);`) has executed before any view lifecycle fires.
715
+ Promise.resolve().then(__ns_deferred_reset);
523
716
  };
524
717
  Application.run = __ns_dev_patched_run;
525
718
  if (verbose) {
526
- try {
527
- console.info('[ns-placeholder] patched Application.run');
528
- }
529
- catch { }
719
+ console.info('[ns-placeholder] patched Application.run');
530
720
  }
531
721
  if (g.Application && g.Application !== Application) {
532
722
  g.Application.run = __ns_dev_patched_run;
@@ -564,11 +754,8 @@ export function installRootPlaceholder(verbose) {
564
754
  type: appAny?.constructor?.name,
565
755
  };
566
756
  if (verbose) {
567
- try {
568
- console.info('[ns-placeholder] application methods', methodState);
569
- console.info('[ns-placeholder] application source', applicationResolved.source);
570
- }
571
- catch { }
757
+ console.info('[ns-placeholder] application methods', methodState);
758
+ console.info('[ns-placeholder] application source', applicationResolved.source);
572
759
  }
573
760
  if (!appAny || typeof appAny.run !== 'function') {
574
761
  console.warn('[ns-placeholder] Application.run unavailable', {
@@ -583,28 +770,41 @@ export function installRootPlaceholder(verbose) {
583
770
  const nativeApp = appAny.nativeApp;
584
771
  const iosNativeApp = appAny.ios?.nativeApp;
585
772
  const canRunAsMainApp = typeof appAny.runAsMainApp === 'function';
773
+ // iOS family only: when NativeScript runs EMBEDDED inside a host
774
+ // UIApplication (a visionOS SwiftUI `App`, or iOS built with
775
+ // `NS_SWIFTUI_BOOT=1`), the UIApplication singleton ALREADY exists by
776
+ // the time this placeholder runs — the SwiftUI `@main` created it
777
+ // before `[NativeScriptStart boot]` ran our entry. Calling
778
+ // `UIApplicationMain` again (via `runAsMainApp`/`run`) asserts in
779
+ // `UIApplicationInstantiateSingleton` and crashes at boot.
780
+ //
781
+ // `runAsMainApp` is an iOS-only method, so gating on `canRunAsMainApp`
782
+ // scopes this to Apple platforms (it leaves Android's `appAny.run()`
783
+ // branch untouched, where `nativeApp` is legitimately present early).
784
+ // On STANDALONE iOS the UIApplication is not created until
785
+ // `runAsMainApp()` itself calls `UIApplicationMain`, so `nativeApp` is
786
+ // still null here and the normal boot path below is preserved.
787
+ const hostUIApplicationExists = canRunAsMainApp && !!(nativeApp || iosNativeApp);
586
788
  if (verbose) {
587
- try {
588
- console.info('[ns-placeholder] boot state', {
589
- hasLaunched,
590
- hasRootView,
591
- started,
592
- nativeApp: !!nativeApp,
593
- iosNativeApp: !!iosNativeApp,
594
- canRunAsMainApp,
595
- hasResetRootView: typeof appAny.resetRootView === 'function',
596
- });
597
- }
598
- catch { }
789
+ console.info('[ns-placeholder] boot state', {
790
+ hasLaunched,
791
+ hasRootView,
792
+ started,
793
+ nativeApp: !!nativeApp,
794
+ iosNativeApp: !!iosNativeApp,
795
+ canRunAsMainApp,
796
+ hostUIApplicationExists,
797
+ hasResetRootView: typeof appAny.resetRootView === 'function',
798
+ });
599
799
  }
600
- if (hasLaunched || hasRootView) {
601
- // App lifecycle is already active. Skip starting it again and only install
602
- // the placeholder root/patching behavior for the existing instance.
800
+ if (hasLaunched || hasRootView || hostUIApplicationExists) {
801
+ // App lifecycle is already active — either a standalone app that has
802
+ // already launched, or NativeScript embedded inside a host
803
+ // UIApplication (visionOS SwiftUI). Skip starting it again
804
+ // (a second `UIApplicationMain` would assert) and only install the
805
+ // placeholder root/patching behavior for the existing instance.
603
806
  if (verbose) {
604
- try {
605
- console.info('[ns-placeholder] boot branch: existing lifecycle');
606
- }
607
- catch { }
807
+ console.info('[ns-placeholder] boot branch: existing lifecycle', { hostUIApplicationExists });
608
808
  }
609
809
  try {
610
810
  __ns_launch_handler();
@@ -613,20 +813,14 @@ export function installRootPlaceholder(verbose) {
613
813
  }
614
814
  else if (canRunAsMainApp) {
615
815
  if (verbose) {
616
- try {
617
- console.info('[ns-placeholder] boot branch: runAsMainApp');
618
- }
619
- catch { }
816
+ console.info('[ns-placeholder] boot branch: runAsMainApp');
620
817
  }
621
818
  appAny.started = true;
622
819
  appAny.runAsMainApp();
623
820
  }
624
821
  else {
625
822
  if (verbose) {
626
- try {
627
- console.info('[ns-placeholder] boot branch: Application.run');
628
- }
629
- catch { }
823
+ console.info('[ns-placeholder] boot branch: Application.run');
630
824
  }
631
825
  appAny.run();
632
826
  }