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