@nativescript/vite 8.0.0-alpha.9 → 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 (554) hide show
  1. package/README.md +89 -14
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +196 -217
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +152 -104
  7. package/configuration/base.js.map +1 -1
  8. package/configuration/javascript.js +14 -93
  9. package/configuration/javascript.js.map +1 -1
  10. package/configuration/react.js +41 -73
  11. package/configuration/react.js.map +1 -1
  12. package/configuration/solid.js +51 -6
  13. package/configuration/solid.js.map +1 -1
  14. package/configuration/typescript.js +11 -92
  15. package/configuration/typescript.js.map +1 -1
  16. package/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/css-platform-plugin.d.ts +14 -0
  34. package/helpers/css-platform-plugin.js +43 -25
  35. package/helpers/css-platform-plugin.js.map +1 -1
  36. package/helpers/dev-host.d.ts +360 -0
  37. package/helpers/dev-host.js +694 -0
  38. package/helpers/dev-host.js.map +1 -0
  39. package/helpers/dynamic-import-plugin.d.ts +2 -1
  40. package/helpers/dynamic-import-plugin.js +59 -53
  41. package/helpers/dynamic-import-plugin.js.map +1 -1
  42. package/helpers/esbuild-platform-resolver.js +4 -1
  43. package/helpers/esbuild-platform-resolver.js.map +1 -1
  44. package/helpers/external-configs.d.ts +10 -12
  45. package/helpers/external-configs.js +58 -35
  46. package/helpers/external-configs.js.map +1 -1
  47. package/helpers/flavor.d.ts +31 -0
  48. package/helpers/flavor.js +53 -2
  49. package/helpers/flavor.js.map +1 -1
  50. package/helpers/global-defines.d.ts +100 -33
  51. package/helpers/global-defines.js +192 -66
  52. package/helpers/global-defines.js.map +1 -1
  53. package/helpers/hmr-scope.d.ts +26 -0
  54. package/helpers/hmr-scope.js +67 -0
  55. package/helpers/hmr-scope.js.map +1 -0
  56. package/helpers/init.js +24 -26
  57. package/helpers/init.js.map +1 -1
  58. package/helpers/logging.d.ts +11 -1
  59. package/helpers/logging.js +45 -2
  60. package/helpers/logging.js.map +1 -1
  61. package/helpers/main-entry.d.ts +4 -1
  62. package/helpers/main-entry.js +293 -40
  63. package/helpers/main-entry.js.map +1 -1
  64. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  65. package/helpers/nativeclass-esbuild-plugin.js +6 -1
  66. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  67. package/helpers/nativeclass-transform.d.ts +13 -0
  68. package/helpers/nativeclass-transform.js +37 -7
  69. package/helpers/nativeclass-transform.js.map +1 -1
  70. package/helpers/nativeclass-transformer-plugin.js +8 -3
  71. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  72. package/helpers/nativescript-package-resolver.js +10 -62
  73. package/helpers/nativescript-package-resolver.js.map +1 -1
  74. package/helpers/normalize-id.d.ts +42 -0
  75. package/helpers/normalize-id.js +60 -0
  76. package/helpers/normalize-id.js.map +1 -0
  77. package/helpers/ns-core-external-urls.d.ts +32 -0
  78. package/helpers/ns-core-external-urls.js +107 -0
  79. package/helpers/ns-core-external-urls.js.map +1 -0
  80. package/helpers/ns-core-url.d.ts +26 -3
  81. package/helpers/ns-core-url.js +66 -8
  82. package/helpers/ns-core-url.js.map +1 -1
  83. package/helpers/optimize-deps.d.ts +16 -0
  84. package/helpers/optimize-deps.js +17 -0
  85. package/helpers/optimize-deps.js.map +1 -0
  86. package/helpers/package-platform-aliases.js +34 -49
  87. package/helpers/package-platform-aliases.js.map +1 -1
  88. package/helpers/platform-types.d.ts +2 -0
  89. package/helpers/platform-types.js +2 -0
  90. package/helpers/platform-types.js.map +1 -0
  91. package/helpers/postcss-platform-config.d.ts +17 -1
  92. package/helpers/postcss-platform-config.js +20 -37
  93. package/helpers/postcss-platform-config.js.map +1 -1
  94. package/helpers/resolve-main-field-platform.d.ts +20 -0
  95. package/helpers/resolve-main-field-platform.js +49 -0
  96. package/helpers/resolve-main-field-platform.js.map +1 -0
  97. package/helpers/resolver.js +17 -2
  98. package/helpers/resolver.js.map +1 -1
  99. package/helpers/theme-core-plugins.js +1 -1
  100. package/helpers/theme-core-plugins.js.map +1 -1
  101. package/helpers/ts-config-paths.d.ts +32 -0
  102. package/helpers/ts-config-paths.js +143 -62
  103. package/helpers/ts-config-paths.js.map +1 -1
  104. package/helpers/typescript-check.d.ts +3 -3
  105. package/helpers/typescript-check.js +4 -4
  106. package/helpers/typescript-check.js.map +1 -1
  107. package/helpers/ui-registration.d.ts +21 -0
  108. package/helpers/ui-registration.js +156 -0
  109. package/helpers/ui-registration.js.map +1 -0
  110. package/helpers/utils.d.ts +9 -0
  111. package/helpers/utils.js +22 -2
  112. package/helpers/utils.js.map +1 -1
  113. package/helpers/vite-package-version.d.ts +7 -0
  114. package/helpers/vite-package-version.js +44 -0
  115. package/helpers/vite-package-version.js.map +1 -0
  116. package/helpers/workers.d.ts +33 -0
  117. package/helpers/workers.js +237 -10
  118. package/helpers/workers.js.map +1 -1
  119. package/hmr/client/css-handler.d.ts +2 -1
  120. package/hmr/client/css-handler.js +63 -32
  121. package/hmr/client/css-handler.js.map +1 -1
  122. package/hmr/client/css-update-overlay.d.ts +18 -0
  123. package/hmr/client/css-update-overlay.js +27 -0
  124. package/hmr/client/css-update-overlay.js.map +1 -0
  125. package/hmr/client/framework-client-strategy.d.ts +117 -0
  126. package/hmr/client/framework-client-strategy.js +18 -0
  127. package/hmr/client/framework-client-strategy.js.map +1 -0
  128. package/hmr/client/framework.d.ts +31 -0
  129. package/hmr/client/framework.js +17 -0
  130. package/hmr/client/framework.js.map +1 -0
  131. package/hmr/client/hmr-pending-overlay.d.ts +0 -14
  132. package/hmr/client/hmr-pending-overlay.js +2 -11
  133. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  134. package/hmr/client/hot-context.d.ts +89 -0
  135. package/hmr/client/hot-context.js +404 -0
  136. package/hmr/client/hot-context.js.map +1 -0
  137. package/hmr/client/index.d.ts +9 -1
  138. package/hmr/client/index.js +70 -1970
  139. package/hmr/client/index.js.map +1 -1
  140. package/hmr/client/overlay-driver.d.ts +10 -0
  141. package/hmr/client/overlay-driver.js +33 -0
  142. package/hmr/client/overlay-driver.js.map +1 -0
  143. package/hmr/client/protocol-dispatch.d.ts +8 -0
  144. package/hmr/client/protocol-dispatch.js +308 -0
  145. package/hmr/client/protocol-dispatch.js.map +1 -0
  146. package/hmr/client/root-reset.d.ts +15 -0
  147. package/hmr/client/root-reset.js +358 -0
  148. package/hmr/client/root-reset.js.map +1 -0
  149. package/hmr/client/strategy-loader.d.ts +24 -0
  150. package/hmr/client/strategy-loader.js +136 -0
  151. package/hmr/client/strategy-loader.js.map +1 -0
  152. package/hmr/client/update-pipeline.d.ts +27 -0
  153. package/hmr/client/update-pipeline.js +489 -0
  154. package/hmr/client/update-pipeline.js.map +1 -0
  155. package/hmr/client/utils.d.ts +9 -1
  156. package/hmr/client/utils.js +117 -97
  157. package/hmr/client/utils.js.map +1 -1
  158. package/hmr/client/ws-transport.d.ts +21 -0
  159. package/hmr/client/ws-transport.js +323 -0
  160. package/hmr/client/ws-transport.js.map +1 -0
  161. package/hmr/entry-runtime.d.ts +2 -1
  162. package/hmr/entry-runtime.js +279 -44
  163. package/hmr/entry-runtime.js.map +1 -1
  164. package/hmr/framework-flavors.d.ts +59 -0
  165. package/hmr/framework-flavors.js +108 -0
  166. package/hmr/framework-flavors.js.map +1 -0
  167. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  168. package/hmr/frameworks/angular/build/angular-linker.js +113 -0
  169. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  170. package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.js +2 -70
  171. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  172. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  173. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  174. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  175. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  176. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  177. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  178. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  179. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  180. package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
  181. package/hmr/frameworks/angular/build/linker-stats.js +29 -0
  182. package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
  183. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  184. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  185. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  186. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  187. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  188. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  189. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  190. package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
  191. package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
  192. package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
  193. package/hmr/frameworks/angular/build/util.js.map +1 -0
  194. package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
  195. package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
  196. package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
  197. package/hmr/frameworks/angular/client/index.d.ts +0 -1
  198. package/hmr/frameworks/angular/client/index.js +360 -194
  199. package/hmr/frameworks/angular/client/index.js.map +1 -1
  200. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  201. package/hmr/frameworks/angular/client/strategy.js +19 -0
  202. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  203. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  204. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  205. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  206. package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
  207. package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
  208. package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
  209. package/hmr/frameworks/angular/server/strategy.js +668 -13
  210. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  211. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  212. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  213. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +27 -11
  214. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +179 -107
  215. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  216. package/hmr/frameworks/react/client/strategy.d.ts +12 -0
  217. package/hmr/frameworks/react/client/strategy.js +27 -0
  218. package/hmr/frameworks/react/client/strategy.js.map +1 -0
  219. package/hmr/frameworks/react/server/strategy.d.ts +2 -0
  220. package/hmr/frameworks/react/server/strategy.js +230 -0
  221. package/hmr/frameworks/react/server/strategy.js.map +1 -0
  222. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  223. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  224. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  225. package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
  226. package/hmr/frameworks/solid/client/app-runtime.js +252 -0
  227. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
  228. package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
  229. package/hmr/frameworks/solid/client/strategy.js +391 -0
  230. package/hmr/frameworks/solid/client/strategy.js.map +1 -0
  231. package/hmr/frameworks/solid/server/strategy.js +293 -16
  232. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  233. package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
  234. package/hmr/frameworks/typescript/client/strategy.js +418 -0
  235. package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
  236. package/hmr/frameworks/typescript/server/strategy.js +40 -14
  237. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  238. package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
  239. package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
  240. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  241. package/hmr/frameworks/vue/client/index.d.ts +10 -1
  242. package/hmr/frameworks/vue/client/index.js +270 -521
  243. package/hmr/frameworks/vue/client/index.js.map +1 -1
  244. package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
  245. package/hmr/frameworks/vue/client/navigate-app.js +178 -0
  246. package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
  247. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  248. package/hmr/frameworks/vue/client/strategy.js +152 -0
  249. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  250. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  251. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
  252. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  253. package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
  254. package/hmr/frameworks/vue/server/compiler.js +3 -1
  255. package/hmr/frameworks/vue/server/compiler.js.map +1 -1
  256. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  257. package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
  258. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  259. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  260. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  261. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  262. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  263. package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
  264. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  265. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
  266. package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
  267. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  268. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  269. package/hmr/frameworks/vue/server/strategy.js +291 -7
  270. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  271. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  272. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  273. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  274. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  275. package/hmr/helpers/ast-normalizer.js +109 -14
  276. package/hmr/helpers/ast-normalizer.js.map +1 -1
  277. package/hmr/helpers/package-exports.d.ts +16 -0
  278. package/hmr/helpers/package-exports.js +396 -0
  279. package/hmr/helpers/package-exports.js.map +1 -0
  280. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  281. package/hmr/helpers/vendor-rewrite.js +5 -3
  282. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  283. package/hmr/server/boot-recording.d.ts +51 -0
  284. package/hmr/server/boot-recording.js +214 -0
  285. package/hmr/server/boot-recording.js.map +1 -0
  286. package/hmr/server/constants.js +7 -1
  287. package/hmr/server/constants.js.map +1 -1
  288. package/hmr/server/content-css-update.d.ts +54 -0
  289. package/hmr/server/content-css-update.js +78 -0
  290. package/hmr/server/content-css-update.js.map +1 -0
  291. package/hmr/server/core-bundle.d.ts +140 -0
  292. package/hmr/server/core-bundle.js +614 -0
  293. package/hmr/server/core-bundle.js.map +1 -0
  294. package/hmr/server/core-sanitize.d.ts +86 -7
  295. package/hmr/server/core-sanitize.js +155 -37
  296. package/hmr/server/core-sanitize.js.map +1 -1
  297. package/hmr/server/css-connect-sync.d.ts +28 -0
  298. package/hmr/server/css-connect-sync.js +59 -0
  299. package/hmr/server/css-connect-sync.js.map +1 -0
  300. package/hmr/server/css-device-module.d.ts +28 -0
  301. package/hmr/server/css-device-module.js +44 -0
  302. package/hmr/server/css-device-module.js.map +1 -0
  303. package/hmr/server/css-update-message.d.ts +23 -0
  304. package/hmr/server/css-update-message.js +41 -0
  305. package/hmr/server/css-update-message.js.map +1 -0
  306. package/hmr/server/deps-bundle.d.ts +233 -0
  307. package/hmr/server/deps-bundle.js +1022 -0
  308. package/hmr/server/deps-bundle.js.map +1 -0
  309. package/hmr/server/device-transform-helpers.d.ts +24 -0
  310. package/hmr/server/device-transform-helpers.js +408 -0
  311. package/hmr/server/device-transform-helpers.js.map +1 -0
  312. package/hmr/server/framework-strategy.d.ts +182 -11
  313. package/hmr/server/hmr-module-graph.d.ts +37 -0
  314. package/hmr/server/hmr-module-graph.js +215 -0
  315. package/hmr/server/hmr-module-graph.js.map +1 -0
  316. package/hmr/server/import-map.d.ts +57 -23
  317. package/hmr/server/import-map.js +142 -70
  318. package/hmr/server/import-map.js.map +1 -1
  319. package/hmr/server/index.js +7 -16
  320. package/hmr/server/index.js.map +1 -1
  321. package/hmr/server/node-builtins-route.d.ts +12 -0
  322. package/hmr/server/node-builtins-route.js +86 -0
  323. package/hmr/server/node-builtins-route.js.map +1 -0
  324. package/hmr/server/ns-m-response-memo.d.ts +10 -0
  325. package/hmr/server/ns-m-response-memo.js +33 -0
  326. package/hmr/server/ns-m-response-memo.js.map +1 -0
  327. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  328. package/hmr/server/ns-rt-bridge.js +131 -0
  329. package/hmr/server/ns-rt-bridge.js.map +1 -0
  330. package/hmr/server/ns-rt-route.d.ts +5 -0
  331. package/hmr/server/ns-rt-route.js +39 -0
  332. package/hmr/server/ns-rt-route.js.map +1 -0
  333. package/hmr/server/perf-instrumentation.d.ts +1 -1
  334. package/hmr/server/perf-instrumentation.js +3 -1
  335. package/hmr/server/perf-instrumentation.js.map +1 -1
  336. package/hmr/server/process-code-for-device.d.ts +54 -0
  337. package/hmr/server/process-code-for-device.js +832 -0
  338. package/hmr/server/process-code-for-device.js.map +1 -0
  339. package/hmr/server/require-guard.d.ts +1 -0
  340. package/hmr/server/require-guard.js +12 -0
  341. package/hmr/server/require-guard.js.map +1 -0
  342. package/hmr/server/rewrite-imports.d.ts +2 -0
  343. package/hmr/server/rewrite-imports.js +631 -0
  344. package/hmr/server/rewrite-imports.js.map +1 -0
  345. package/hmr/server/route-helpers.d.ts +7 -0
  346. package/hmr/server/route-helpers.js +13 -0
  347. package/hmr/server/route-helpers.js.map +1 -0
  348. package/hmr/server/runtime-graph-filter.js +8 -1
  349. package/hmr/server/runtime-graph-filter.js.map +1 -1
  350. package/hmr/server/server-origin.d.ts +2 -0
  351. package/hmr/server/server-origin.js +88 -0
  352. package/hmr/server/server-origin.js.map +1 -0
  353. package/hmr/server/shared-transform-request.js +1 -2
  354. package/hmr/server/shared-transform-request.js.map +1 -1
  355. package/hmr/server/socket-utils.d.ts +10 -0
  356. package/hmr/server/socket-utils.js +14 -0
  357. package/hmr/server/socket-utils.js.map +1 -0
  358. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  359. package/hmr/server/transform-cache-invalidation.js +156 -0
  360. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  361. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  362. package/hmr/server/vendor-bare-module-shims.js +80 -0
  363. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  364. package/hmr/server/vite-plugin.d.ts +1 -0
  365. package/hmr/server/vite-plugin.js +211 -53
  366. package/hmr/server/vite-plugin.js.map +1 -1
  367. package/hmr/server/websocket-core-bridge.d.ts +51 -4
  368. package/hmr/server/websocket-core-bridge.js +62 -49
  369. package/hmr/server/websocket-core-bridge.js.map +1 -1
  370. package/hmr/server/websocket-device-transform.d.ts +3 -0
  371. package/hmr/server/websocket-device-transform.js +7 -0
  372. package/hmr/server/websocket-device-transform.js.map +1 -0
  373. package/hmr/server/websocket-hmr-pending.d.ts +2 -16
  374. package/hmr/server/websocket-hmr-pending.js +0 -22
  375. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  376. package/hmr/server/websocket-hot-update.d.ts +80 -0
  377. package/hmr/server/websocket-hot-update.js +299 -0
  378. package/hmr/server/websocket-hot-update.js.map +1 -0
  379. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  380. package/hmr/server/websocket-import-map-route.js +51 -0
  381. package/hmr/server/websocket-import-map-route.js.map +1 -0
  382. package/hmr/server/websocket-module-bindings.d.ts +15 -0
  383. package/hmr/server/websocket-module-bindings.js +36 -3
  384. package/hmr/server/websocket-module-bindings.js.map +1 -1
  385. package/hmr/server/websocket-module-specifiers.d.ts +2 -5
  386. package/hmr/server/websocket-module-specifiers.js +42 -30
  387. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  388. package/hmr/server/websocket-ns-core.d.ts +34 -0
  389. package/hmr/server/websocket-ns-core.js +414 -0
  390. package/hmr/server/websocket-ns-core.js.map +1 -0
  391. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  392. package/hmr/server/websocket-ns-entry.js +163 -0
  393. package/hmr/server/websocket-ns-entry.js.map +1 -0
  394. package/hmr/server/websocket-ns-m-paths.d.ts +19 -3
  395. package/hmr/server/websocket-ns-m-paths.js +98 -75
  396. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  397. package/hmr/server/websocket-ns-m-request.d.ts +2 -1
  398. package/hmr/server/websocket-ns-m-request.js +3 -2
  399. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  400. package/hmr/server/websocket-ns-m.d.ts +52 -0
  401. package/hmr/server/websocket-ns-m.js +592 -0
  402. package/hmr/server/websocket-ns-m.js.map +1 -0
  403. package/hmr/server/websocket-served-module-helpers.d.ts +65 -3
  404. package/hmr/server/websocket-served-module-helpers.js +457 -140
  405. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  406. package/hmr/server/websocket-txn.js +6 -9
  407. package/hmr/server/websocket-txn.js.map +1 -1
  408. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  409. package/hmr/server/websocket-vendor-unifier.js +4 -9
  410. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  411. package/hmr/server/websocket.d.ts +6 -40
  412. package/hmr/server/websocket.js +661 -6751
  413. package/hmr/server/websocket.js.map +1 -1
  414. package/hmr/shared/ns-globals.d.ts +108 -0
  415. package/hmr/shared/ns-globals.js +29 -0
  416. package/hmr/shared/ns-globals.js.map +1 -0
  417. package/hmr/shared/protocol.d.ts +157 -0
  418. package/hmr/shared/protocol.js +28 -0
  419. package/hmr/shared/protocol.js.map +1 -0
  420. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  421. package/hmr/shared/runtime/boot-complete.js +32 -0
  422. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  423. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  424. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  425. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  426. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  427. package/hmr/shared/runtime/boot-progress.js +134 -0
  428. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  429. package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
  430. package/hmr/shared/runtime/boot-timeline.js +8 -19
  431. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  432. package/hmr/shared/runtime/browser-runtime-contract.d.ts +58 -25
  433. package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
  434. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  435. package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
  436. package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
  437. package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
  438. package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
  439. package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
  440. package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
  441. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  442. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  443. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  444. package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
  445. package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
  446. package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
  447. package/hmr/shared/runtime/dev-overlay.d.ts +23 -69
  448. package/hmr/shared/runtime/dev-overlay.js +67 -1011
  449. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  450. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  451. package/hmr/shared/runtime/global-scope.js +21 -0
  452. package/hmr/shared/runtime/global-scope.js.map +1 -0
  453. package/hmr/shared/runtime/hooks.js +2 -1
  454. package/hmr/shared/runtime/hooks.js.map +1 -1
  455. package/hmr/shared/runtime/launch-bridge.d.ts +9 -0
  456. package/hmr/shared/runtime/launch-bridge.js +98 -0
  457. package/hmr/shared/runtime/launch-bridge.js.map +1 -0
  458. package/hmr/shared/runtime/module-provenance.js +3 -2
  459. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  460. package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
  461. package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
  462. package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
  463. package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
  464. package/hmr/shared/runtime/overlay-flag.js +34 -0
  465. package/hmr/shared/runtime/overlay-flag.js.map +1 -0
  466. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  467. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  468. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  469. package/hmr/shared/runtime/root-placeholder.js +382 -157
  470. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  471. package/hmr/shared/runtime/session-bootstrap.js +209 -54
  472. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  473. package/hmr/shared/runtime/vendor-bootstrap.js +2 -1
  474. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  475. package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
  476. package/hmr/shared/runtime/vendor-resolve.js +45 -0
  477. package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
  478. package/hmr/shared/runtime/worker-tracking.d.ts +28 -0
  479. package/hmr/shared/runtime/worker-tracking.js +114 -0
  480. package/hmr/shared/runtime/worker-tracking.js.map +1 -0
  481. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  482. package/hmr/shared/vendor/manifest-collect.js +909 -0
  483. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  484. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  485. package/hmr/shared/vendor/manifest-loader.js +5 -3
  486. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  487. package/hmr/shared/vendor/manifest.d.ts +10 -35
  488. package/hmr/shared/vendor/manifest.js +154 -978
  489. package/hmr/shared/vendor/manifest.js.map +1 -1
  490. package/hmr/shared/vendor/registry.d.ts +2 -0
  491. package/hmr/shared/vendor/registry.js +14 -0
  492. package/hmr/shared/vendor/registry.js.map +1 -1
  493. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  494. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  495. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  496. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +107 -0
  497. package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
  498. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  499. package/package.json +70 -13
  500. package/runtime/core-aliases-early.js +11 -16
  501. package/runtime/core-aliases-early.js.map +1 -1
  502. package/shims/react-jsx-runtime.d.ts +4 -0
  503. package/shims/react-jsx-runtime.js +61 -0
  504. package/shims/react-jsx-runtime.js.map +1 -0
  505. package/helpers/angular/angular-linker.d.ts +0 -13
  506. package/helpers/angular/angular-linker.js +0 -185
  507. package/helpers/angular/angular-linker.js.map +0 -1
  508. package/helpers/angular/inject-component-hmr-registration.js.map +0 -1
  509. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  510. package/helpers/angular/shared-linker.d.ts +0 -11
  511. package/helpers/angular/shared-linker.js +0 -75
  512. package/helpers/angular/shared-linker.js.map +0 -1
  513. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  514. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  515. package/helpers/angular/util.js.map +0 -1
  516. package/helpers/module-runner-patch.d.ts +0 -3
  517. package/helpers/module-runner-patch.js +0 -63
  518. package/helpers/module-runner-patch.js.map +0 -1
  519. package/helpers/prelink-angular.d.ts +0 -2
  520. package/helpers/prelink-angular.js +0 -114
  521. package/helpers/prelink-angular.js.map +0 -1
  522. package/hmr/server/websocket-angular-entry.js.map +0 -1
  523. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  524. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
  525. package/hmr/server/websocket-ns-m-finalize.js +0 -88
  526. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  527. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  528. package/hmr/server/websocket-runtime-compat.js +0 -287
  529. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  530. package/hmr/server/websocket-vue-sfc.d.ts +0 -27
  531. package/hmr/server/websocket-vue-sfc.js +0 -1069
  532. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  533. package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
  534. package/hmr/shared/runtime/http-only-boot.js +0 -171
  535. package/hmr/shared/runtime/http-only-boot.js.map +0 -1
  536. package/hmr/vendor-bootstrap.d.ts +0 -3
  537. package/hmr/vendor-bootstrap.js +0 -32
  538. package/hmr/vendor-bootstrap.js.map +0 -1
  539. package/shims/react-reconciler-constants.d.ts +0 -14
  540. package/shims/react-reconciler-constants.js +0 -21
  541. package/shims/react-reconciler-constants.js.map +0 -1
  542. package/shims/react-reconciler.d.ts +0 -8
  543. package/shims/react-reconciler.js +0 -15
  544. package/shims/react-reconciler.js.map +0 -1
  545. package/transformers/NativeClass/index.d.ts +0 -2
  546. package/transformers/NativeClass/index.js +0 -222
  547. package/transformers/NativeClass/index.js.map +0 -1
  548. /package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.d.ts +0 -0
  549. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  550. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  551. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  552. /package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +0 -0
  553. /package/{helpers/angular → hmr/frameworks/angular/build}/util.js +0 -0
  554. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -1,1017 +1,38 @@
1
- const BOOT_TITLE = 'NativeScript Vite preparing dev session...';
2
- const DEFAULT_SNAPSHOT = {
3
- visible: false,
4
- mode: 'hidden',
5
- badge: 'HMR',
6
- title: BOOT_TITLE,
7
- phase: '',
8
- detail: '',
9
- progress: null,
10
- busy: false,
11
- blocking: false,
12
- tone: 'info',
13
- };
14
- function getOverlayGlobal() {
15
- return globalThis;
16
- }
17
- function getRuntimeState() {
18
- const g = getOverlayGlobal();
19
- if (!g.__NS_HMR_DEV_OVERLAY_STATE__) {
20
- g.__NS_HMR_DEV_OVERLAY_STATE__ = {
21
- snapshot: { ...DEFAULT_SNAPSHOT },
22
- bootRefs: null,
23
- liveRefs: null,
24
- iosRefs: null,
25
- iosBuildFailed: false,
26
- verbose: false,
27
- updateAutoHideTimer: null,
28
- updateCycleStartedAt: 0,
29
- };
30
- }
31
- const state = g.__NS_HMR_DEV_OVERLAY_STATE__;
32
- // Backfill newer fields for legacy state objects (e.g. after hot reload)
33
- // so we never observe an undefined iosRefs/iosBuildFailed at runtime.
34
- if (typeof state.iosRefs === 'undefined')
35
- state.iosRefs = null;
36
- if (typeof state.iosBuildFailed === 'undefined')
37
- state.iosBuildFailed = false;
38
- if (typeof state.updateAutoHideTimer === 'undefined')
39
- state.updateAutoHideTimer = null;
40
- if (typeof state.updateCycleStartedAt !== 'number')
41
- state.updateCycleStartedAt = 0;
42
- return state;
43
- }
44
- function describeAttempt(info) {
45
- const attempt = Number(info?.attempt || 0);
46
- const attempts = Number(info?.attempts || 0);
47
- if (!attempt || !attempts) {
48
- return '';
49
- }
50
- return `Attempt ${attempt}/${attempts}`;
51
- }
52
- export function createBootOverlaySnapshot(stage, info) {
53
- const attemptText = describeAttempt(info);
54
- const phaseInfo = {
55
- placeholder: {
56
- visible: true,
57
- mode: 'boot',
58
- badge: 'BOOT',
59
- title: BOOT_TITLE,
60
- phase: 'Preparing the HTTP HMR bootstrap',
61
- progress: 4,
62
- busy: true,
63
- blocking: true,
64
- tone: 'info',
65
- },
66
- 'probing-origin': {
67
- visible: true,
68
- mode: 'boot',
69
- badge: 'BOOT',
70
- title: BOOT_TITLE,
71
- phase: 'Contacting the Vite dev server',
72
- progress: 8,
73
- busy: true,
74
- blocking: true,
75
- tone: 'info',
76
- },
77
- 'loading-entry-runtime': {
78
- visible: true,
79
- mode: 'boot',
80
- badge: 'BOOT',
81
- title: BOOT_TITLE,
82
- phase: 'Loading the entry runtime bridge',
83
- progress: 16,
84
- busy: true,
85
- blocking: true,
86
- tone: 'info',
87
- },
88
- 'configuring-import-map': {
89
- visible: true,
90
- mode: 'boot',
91
- badge: 'BOOT',
92
- title: BOOT_TITLE,
93
- phase: 'Configuring the import map',
94
- progress: 26,
95
- busy: true,
96
- blocking: true,
97
- tone: 'info',
98
- },
99
- 'loading-runtime-bridge': {
100
- visible: true,
101
- mode: 'boot',
102
- badge: 'BOOT',
103
- title: BOOT_TITLE,
104
- phase: 'Loading the NativeScript runtime bridge',
105
- progress: 40,
106
- busy: true,
107
- blocking: true,
108
- tone: 'info',
109
- },
110
- 'loading-core-bridge': {
111
- visible: true,
112
- mode: 'boot',
113
- badge: 'BOOT',
114
- title: BOOT_TITLE,
115
- phase: 'Loading the unified core bridge',
116
- progress: 54,
117
- busy: true,
118
- blocking: true,
119
- tone: 'info',
120
- },
121
- 'preloading-style-scope': {
122
- visible: true,
123
- mode: 'boot',
124
- badge: 'BOOT',
125
- title: BOOT_TITLE,
126
- phase: 'Preparing the shared style scope',
127
- progress: 62,
128
- busy: true,
129
- blocking: true,
130
- tone: 'info',
131
- },
132
- 'installing-css': {
133
- visible: true,
134
- mode: 'boot',
135
- badge: 'BOOT',
136
- title: BOOT_TITLE,
137
- phase: 'Applying the app stylesheet',
138
- progress: 70,
139
- busy: true,
140
- blocking: true,
141
- tone: 'info',
142
- },
143
- 'importing-main': {
144
- visible: true,
145
- mode: 'boot',
146
- badge: 'BOOT',
147
- title: BOOT_TITLE,
148
- phase: 'Importing the app entry',
149
- progress: 82,
150
- busy: true,
151
- blocking: true,
152
- tone: 'info',
153
- },
154
- 'waiting-for-app': {
155
- visible: true,
156
- mode: 'boot',
157
- badge: 'BOOT',
158
- title: BOOT_TITLE,
159
- phase: 'Waiting for the app root view',
160
- progress: 94,
161
- busy: true,
162
- blocking: true,
163
- tone: 'info',
164
- },
165
- 'app-root-committed': {
166
- visible: true,
167
- mode: 'boot',
168
- badge: 'READY',
169
- title: BOOT_TITLE,
170
- phase: 'Real app root committed',
171
- progress: 100,
172
- busy: false,
173
- blocking: true,
174
- tone: 'info',
175
- },
176
- ready: {
177
- visible: true,
178
- mode: 'boot',
179
- badge: 'READY',
180
- title: BOOT_TITLE,
181
- phase: 'Boot complete',
182
- progress: 100,
183
- busy: false,
184
- blocking: true,
185
- tone: 'info',
186
- },
187
- error: {
188
- visible: true,
189
- mode: 'boot',
190
- badge: 'RETRY',
191
- title: BOOT_TITLE,
192
- phase: 'Retrying after a boot failure',
193
- progress: null,
194
- busy: true,
195
- blocking: true,
196
- tone: 'error',
197
- },
198
- };
199
- const base = phaseInfo[stage];
200
- let detail = info?.detail || '';
201
- if (!detail && stage === 'probing-origin' && info?.origin) {
202
- detail = `Trying ${info.origin}`;
203
- }
204
- if (attemptText) {
205
- detail = detail ? `${detail} ${attemptText}` : attemptText;
206
- }
207
- return {
208
- ...base,
209
- detail,
210
- progress: typeof info?.progress === 'number' || info?.progress === null ? info.progress : base.progress,
211
- };
212
- }
213
- export function createConnectionOverlaySnapshot(stage, info) {
214
- if (stage === 'healthy') {
215
- return { ...DEFAULT_SNAPSHOT };
216
- }
217
- const phaseInfo = {
218
- connecting: {
219
- visible: true,
220
- mode: 'connection',
221
- badge: 'SOCKET',
222
- title: 'Waiting for Vite dev server',
223
- phase: 'Opening websocket connection',
224
- detail: 'Live updates are paused until the connection is healthy.',
225
- progress: null,
226
- busy: true,
227
- blocking: false,
228
- tone: 'warn',
229
- },
230
- reconnecting: {
231
- visible: true,
232
- mode: 'connection',
233
- badge: 'SOCKET',
234
- title: 'HMR connection lost',
235
- phase: 'Trying to reconnect Vite websocket',
236
- detail: 'The app may be stale until the dev server reconnects.',
237
- progress: null,
238
- busy: true,
239
- blocking: false,
240
- tone: 'warn',
241
- },
242
- synchronizing: {
243
- visible: true,
244
- mode: 'connection',
245
- badge: 'SYNC',
246
- title: 'HMR connection restored',
247
- phase: 'Synchronizing live-update state',
248
- detail: 'Finalizing the module graph before dismissing the overlay.',
249
- progress: 95,
250
- busy: true,
251
- blocking: false,
252
- tone: 'info',
253
- },
254
- offline: {
255
- visible: true,
256
- mode: 'connection',
257
- badge: 'OFFLINE',
258
- title: 'Vite dev server offline',
259
- phase: 'Please check your terminal.',
260
- detail: 'The websocket and HTTP HMR path are both unavailable right now.',
261
- progress: null,
262
- busy: true,
263
- blocking: false,
264
- tone: 'error',
265
- },
266
- };
267
- const base = phaseInfo[stage];
268
- return {
269
- ...base,
270
- detail: info?.detail || base.detail,
271
- progress: typeof info?.progress === 'number' || info?.progress === null ? info.progress : base.progress,
272
- };
273
- }
274
- // Snapshot factory for the HMR-applying overlay. Each stage owns a
275
- // fixed phase string, badge, and progress %. We pick the percentages
276
- // so users see continuous forward motion: the cheap stages (mutex
277
- // acquire, eviction call) advance fast; the long tail (entry
278
- // re-import + Angular reboot) sits at 60→90 so the bar keeps moving
279
- // even when the V8 ESM walk dominates wall time.
280
- //
281
- // The 'complete' stage holds for a brief moment (the API auto-hides
282
- // it via setUpdateStage) so the user gets visual closure ("the update
283
- // landed") without staring at a frozen overlay; tone stays 'success'
284
- // throughout so the colour scheme never flickers between phases.
285
- const HMR_UPDATE_TITLE = 'HMR update applying...';
286
- const HMR_UPDATE_DONE_TITLE = 'HMR update applied';
287
- export function createUpdateOverlaySnapshot(stage, info) {
288
- const phaseInfo = {
289
- received: {
290
- visible: true,
291
- mode: 'update',
292
- badge: 'HMR',
293
- title: HMR_UPDATE_TITLE,
294
- phase: 'Preparing update',
295
- detail: '',
296
- progress: 5,
297
- busy: true,
298
- blocking: false,
299
- tone: 'success',
300
- },
301
- evicting: {
302
- visible: true,
303
- mode: 'update',
304
- badge: 'HMR',
305
- title: HMR_UPDATE_TITLE,
306
- phase: 'Invalidating module cache',
307
- detail: '',
308
- progress: 30,
309
- busy: true,
310
- blocking: false,
311
- tone: 'success',
312
- },
313
- reimporting: {
314
- visible: true,
315
- mode: 'update',
316
- badge: 'HMR',
317
- title: HMR_UPDATE_TITLE,
318
- phase: 'Re-importing entry',
319
- detail: '',
320
- progress: 60,
321
- busy: true,
322
- blocking: false,
323
- tone: 'success',
324
- },
325
- rebooting: {
326
- visible: true,
327
- mode: 'update',
328
- badge: 'HMR',
329
- title: HMR_UPDATE_TITLE,
330
- phase: 'Rebooting Angular',
331
- detail: '',
332
- progress: 90,
333
- busy: true,
334
- blocking: false,
335
- tone: 'success',
336
- },
337
- complete: {
338
- visible: true,
339
- mode: 'update',
340
- badge: 'HMR',
341
- title: HMR_UPDATE_DONE_TITLE,
342
- phase: 'Update applied',
343
- detail: '',
344
- progress: 100,
345
- busy: false,
346
- blocking: false,
347
- tone: 'success',
348
- },
349
- };
350
- const base = phaseInfo[stage];
351
- return {
352
- ...base,
353
- detail: info?.detail || base.detail,
354
- progress: typeof info?.progress === 'number' || info?.progress === null ? info.progress : base.progress,
355
- };
356
- }
357
- function resolveCoreExport(name) {
358
- const g = getOverlayGlobal();
359
- try {
360
- const reg = g.__nsVendorRegistry;
361
- if (reg && typeof reg.get === 'function') {
362
- const mod = reg.get('@nativescript/core');
363
- const ns = (mod && (mod.default ?? mod)) || mod;
364
- if (ns && ns[name]) {
365
- return ns[name];
366
- }
367
- }
368
- }
369
- catch { }
370
- try {
371
- if (g && g[name]) {
372
- return g[name];
373
- }
374
- }
375
- catch { }
376
- try {
377
- const req = g.__nsVendorRequire || g.__nsRequire || g.require;
378
- if (typeof req === 'function') {
379
- const mod = req('@nativescript/core');
380
- const ns = (mod && (mod.default ?? mod)) || mod;
381
- if (ns && ns[name]) {
382
- return ns[name];
383
- }
384
- }
385
- }
386
- catch { }
387
- try {
388
- const nativeReq = g.__nativeRequire;
389
- if (typeof nativeReq === 'function') {
390
- const mod = nativeReq('@nativescript/core', '/');
391
- const ns = (mod && (mod.default ?? mod)) || mod;
392
- if (ns && ns[name]) {
393
- return ns[name];
394
- }
395
- }
396
- }
397
- catch { }
398
- return undefined;
399
- }
400
- function asColor(value) {
401
- try {
402
- const Color = resolveCoreExport('Color');
403
- if (Color) {
404
- return new Color(value);
405
- }
406
- }
407
- catch { }
408
- return value;
409
- }
410
- function formatStatusText(snapshot) {
411
- const progressText = typeof snapshot.progress === 'number' ? ` (${Math.round(Number(snapshot.progress))}%)` : '';
412
- const primary = `${snapshot.phase || ''}${progressText}`.trim();
413
- return [primary, snapshot.detail].filter(Boolean).join('\n');
414
- }
415
- function buildBootOverlayRefs(snapshot) {
416
- const Page = resolveCoreExport('Page');
417
- const StackLayout = resolveCoreExport('StackLayout');
418
- const Label = resolveCoreExport('Label');
419
- const ActivityIndicator = resolveCoreExport('ActivityIndicator');
420
- if (!Page || !StackLayout || !Label) {
421
- return null;
422
- }
423
- const page = new Page();
424
- page.actionBarHidden = true;
425
- const root = new StackLayout();
426
- root.padding = 24;
427
- root.verticalAlignment = 'middle';
428
- root.horizontalAlignment = 'stretch';
429
- const titleLabel = new Label();
430
- titleLabel.text = BOOT_TITLE;
431
- titleLabel.textAlignment = 'center';
432
- titleLabel.textWrap = true;
433
- titleLabel.fontSize = 22;
434
- titleLabel.fontWeight = '600';
435
- const statusLabel = new Label();
436
- statusLabel.textAlignment = 'center';
437
- statusLabel.textWrap = true;
438
- statusLabel.fontSize = 14;
439
- statusLabel.marginTop = 12;
440
- const activityIndicator = ActivityIndicator
441
- ? (() => {
442
- const indicator = new ActivityIndicator();
443
- indicator.marginTop = 16;
444
- indicator.width = 28;
445
- indicator.height = 28;
446
- indicator.horizontalAlignment = 'center';
447
- return indicator;
448
- })()
449
- : null;
450
- root.addChild(titleLabel);
451
- root.addChild(statusLabel);
452
- if (activityIndicator) {
453
- root.addChild(activityIndicator);
454
- }
455
- page.content = root;
456
- const refs = {
457
- page,
458
- root,
459
- titleLabel,
460
- statusLabel,
461
- activityIndicator,
462
- };
463
- applySnapshotToBootRefs(refs, snapshot);
464
- return refs;
465
- }
466
- function applySnapshotToBootRefs(refs, snapshot) {
467
- if (!refs) {
468
- return;
469
- }
470
- refs.page.actionBarHidden = true;
471
- refs.page.backgroundColor = asColor(snapshot.tone === 'error' ? '#b4181068' : '#a1771683');
472
- refs.root.visibility = snapshot.visible && snapshot.mode === 'boot' ? 'visible' : 'collapse';
473
- refs.titleLabel.text = BOOT_TITLE;
474
- refs.titleLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
475
- refs.statusLabel.text = formatStatusText(snapshot) || 'Preparing the HTTP HMR bootstrap (4%)';
476
- refs.statusLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
477
- if (refs.activityIndicator) {
478
- refs.activityIndicator.busy = !!snapshot.busy;
479
- refs.activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
480
- }
481
- }
482
- function findBootActivityIndicator() {
483
- const g = getOverlayGlobal();
484
- if (g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__) {
485
- return g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__;
486
- }
487
- try {
488
- const frame = g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__;
489
- if (!frame)
490
- return null;
491
- const page = frame.currentPage || frame._currentEntry?.resolvedPage;
492
- const content = page?.content;
493
- const children = content?.getChildrenCount?.() || 0;
494
- if (children >= 3) {
495
- const indicator = content.getChildAt?.(2);
496
- if (indicator && typeof indicator.busy !== 'undefined') {
497
- g.__NS_DEV_BOOT_ACTIVITY_INDICATOR__ = indicator;
498
- return indicator;
499
- }
500
- }
501
- }
502
- catch { }
503
- return null;
504
- }
505
- function findBootStatusLabel() {
506
- const g = getOverlayGlobal();
507
- // Try direct reference first
508
- if (g.__NS_DEV_BOOT_STATUS_LABEL__) {
509
- return g.__NS_DEV_BOOT_STATUS_LABEL__;
510
- }
511
- // Fallback: walk from placeholder root view
512
- try {
513
- const frame = g.__NS_DEV_PLACEHOLDER_ROOT_VIEW__;
514
- if (!frame)
515
- return null;
516
- const page = frame.currentPage || frame._currentEntry?.resolvedPage;
517
- if (!page)
518
- return null;
519
- const content = page.content;
520
- if (!content)
521
- return null;
522
- // StackLayout with children: titleLabel, statusLabel
523
- const children = content.getChildrenCount?.() || 0;
524
- if (children >= 2) {
525
- const label = content.getChildAt?.(1);
526
- if (label && typeof label.text !== 'undefined') {
527
- // Cache for next time
528
- g.__NS_DEV_BOOT_STATUS_LABEL__ = label;
529
- return label;
530
- }
531
- }
532
- }
533
- catch { }
534
- return null;
535
- }
536
- function updateBootStatusLabel(snapshot) {
537
- const newText = formatStatusText(snapshot) || 'Preparing the HTTP HMR bootstrap (4%)';
538
- const statusLabel = findBootStatusLabel();
539
- const activityIndicator = findBootActivityIndicator();
540
- if (!statusLabel) {
541
- if (activityIndicator) {
542
- try {
543
- activityIndicator.busy = !!snapshot.busy;
544
- activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
545
- }
546
- catch { }
547
- }
548
- return;
549
- }
550
- try {
551
- statusLabel.text = newText;
552
- statusLabel.color = asColor(snapshot.tone === 'error' ? '#b41810e6' : '#563e3fb1');
553
- if (typeof statusLabel.requestLayout === 'function') {
554
- statusLabel.requestLayout();
555
- }
556
- const parent = statusLabel.parent;
557
- if (parent && typeof parent.requestLayout === 'function') {
558
- parent.requestLayout();
559
- }
560
- }
561
- catch { }
562
- if (activityIndicator) {
563
- try {
564
- activityIndicator.busy = !!snapshot.busy;
565
- activityIndicator.visibility = snapshot.visible && snapshot.mode === 'boot' && snapshot.busy ? 'visible' : 'collapse';
566
- }
567
- catch { }
568
- }
569
- }
570
- function resolveActivePage() {
571
- try {
572
- const Frame = resolveCoreExport('Frame');
573
- const frame = Frame?.topmost?.() || null;
574
- const currentPage = frame?.currentPage || frame?._currentEntry?.resolvedPage || null;
575
- if (currentPage) {
576
- return currentPage;
577
- }
578
- }
579
- catch { }
580
- try {
581
- const Application = resolveCoreExport('Application');
582
- const rootView = Application?.getRootView?.() || null;
583
- if (rootView?.currentPage) {
584
- return rootView.currentPage;
585
- }
586
- if (typeof rootView?.content !== 'undefined') {
587
- return rootView;
588
- }
589
- }
590
- catch { }
591
- return null;
592
- }
593
- function buildLiveOverlayView(snapshot) {
594
- const GridLayout = resolveCoreExport('GridLayout');
595
- const StackLayout = resolveCoreExport('StackLayout');
596
- const Label = resolveCoreExport('Label');
597
- if (!GridLayout || !StackLayout || !Label) {
598
- return null;
599
- }
600
- const overlay = new GridLayout();
601
- overlay.visibility = 'collapse';
602
- overlay.width = '100%';
603
- overlay.height = '100%';
604
- overlay.horizontalAlignment = 'stretch';
605
- overlay.verticalAlignment = 'stretch';
606
- const panel = new StackLayout();
607
- panel.horizontalAlignment = 'center';
608
- panel.verticalAlignment = 'middle';
609
- panel.width = 320;
610
- panel.margin = 24;
611
- panel.padding = 16;
612
- const titleLabel = new Label();
613
- titleLabel.textAlignment = 'center';
614
- titleLabel.textWrap = true;
615
- titleLabel.fontSize = 18;
616
- titleLabel.fontWeight = '600';
617
- const statusLabel = new Label();
618
- statusLabel.textAlignment = 'center';
619
- statusLabel.textWrap = true;
620
- statusLabel.fontSize = 13;
621
- statusLabel.marginTop = 10;
622
- panel.addChild(titleLabel);
623
- panel.addChild(statusLabel);
624
- overlay.addChild(panel);
625
- const refs = {
626
- overlay,
627
- titleLabel,
628
- statusLabel,
629
- };
630
- applySnapshotToLiveRefs(refs, snapshot);
631
- return refs;
632
- }
633
- function ensureLiveOverlayRefs(snapshot) {
634
- const state = getRuntimeState();
635
- const page = resolveActivePage();
636
- if (!page) {
637
- return null;
638
- }
639
- if (state.liveRefs) {
640
- if (state.liveRefs.page === page && state.liveRefs.overlay?.parent) {
641
- return state.liveRefs;
642
- }
643
- try {
644
- state.liveRefs.overlay.visibility = 'collapse';
645
- }
646
- catch { }
647
- state.liveRefs = null;
648
- }
649
- const GridLayout = resolveCoreExport('GridLayout');
650
- if (!GridLayout || typeof page.content === 'undefined') {
651
- return null;
652
- }
653
- let wrapper = page.content;
654
- if (!wrapper || !wrapper.__ns_hmr_overlay_wrapper__) {
655
- const currentContent = page.content || null;
656
- wrapper = new GridLayout();
657
- wrapper.width = '100%';
658
- wrapper.height = '100%';
659
- wrapper.__ns_hmr_overlay_wrapper__ = true;
660
- try {
661
- page.content = null;
662
- }
663
- catch { }
664
- if (currentContent) {
665
- wrapper.addChild(currentContent);
666
- }
667
- page.content = wrapper;
668
- }
669
- const liveView = buildLiveOverlayView(snapshot);
670
- if (!liveView) {
671
- return null;
672
- }
673
- wrapper.addChild(liveView.overlay);
674
- state.liveRefs = {
675
- page,
676
- wrapper,
677
- ...liveView,
678
- };
679
- return state.liveRefs;
680
- }
681
- function applySnapshotToLiveRefs(refs, snapshot) {
682
- if (!refs) {
683
- return;
684
- }
685
- // 'update' mode shares the live (in-tree) overlay chrome with
686
- // 'connection'. Both render a centered panel inside the page;
687
- // only the colours and text change with the snapshot's tone.
688
- const visible = snapshot.visible && (snapshot.mode === 'connection' || snapshot.mode === 'update');
689
- refs.overlay.visibility = visible ? 'visible' : 'collapse';
690
- // Backdrop tints by tone:
691
- // error → red wash (matches existing UX)
692
- // success → richer green wash; the previous 18% alpha was so
693
- // subtle on light app backgrounds that users couldn't
694
- // tell the overlay had even fired. 50% alpha keeps the
695
- // underlying app legible while making the apply event
696
- // unmistakable during the (often <300ms) cycle.
697
- // default → warm orange (existing connection-overlay look)
698
- const overlayBg = snapshot.tone === 'error' ? '#b4181068' : snapshot.tone === 'success' ? '#1f883d80' : '#a1771683';
699
- refs.overlay.backgroundColor = asColor(overlayBg);
700
- refs.titleLabel.text = snapshot.title;
701
- const textColor = snapshot.tone === 'error' ? '#b41810e6' : snapshot.tone === 'success' ? '#0e6e2fff' : '#563e3fb1';
702
- refs.titleLabel.color = asColor(textColor);
703
- refs.statusLabel.text = formatStatusText(snapshot);
704
- refs.statusLabel.color = asColor(textColor);
705
- try {
706
- const panel = refs.titleLabel.parent;
707
- if (panel) {
708
- // Slightly richer green-tinted panel for HMR-apply so the
709
- // title/status text reads at a glance against the brighter
710
- // backdrop wash. White panel for connection/error keeps
711
- // existing UX intact.
712
- const panelBg = snapshot.tone === 'success' ? '#E6F8E9FF' : '#FFFFFFFF';
713
- panel.backgroundColor = asColor(panelBg);
714
- panel.opacity = 1;
715
- panel.padding = 16;
716
- try {
717
- panel.borderRadius = 12;
718
- }
719
- catch { }
720
- }
721
- }
722
- catch { }
723
- }
724
- // pure helpers for iOS window promotion. Factored out so the layout
725
- // math and window-level selection stay unit-testable without booting a
726
- // simulator. See `dev-overlay.spec.ts`.
727
1
  /**
728
- * Returns the UIWindow level we use for the live/connection overlay. We lift
729
- * above `UIWindowLevelAlert` so system alerts (and any app-presented modal)
730
- * stack underneath. When the platform does not expose `UIWindowLevelAlert`
731
- * we fall back to the documented constant value (2000).
2
+ * Dev overlay public API: boot / connection / update stage setters plus the
3
+ * auto-hide timing policy. Rendering is delegated to two backends behind the
4
+ * shared snapshot/state model (`dev-overlay-shared.ts`):
5
+ *
6
+ * - `dev-overlay-ios.ts` — dedicated UIWindow above `UIWindowLevelAlert`, so
7
+ * the overlay stacks above modals/sheets/system alerts (preferred on iOS)
8
+ * - `dev-overlay-tree.ts` — boot placeholder + in-tree toast chip (Android,
9
+ * and the fallback when the iOS window can't be built)
732
10
  */
733
- export function computeIosOverlayWindowLevel(baseAlert) {
734
- if (typeof baseAlert === 'number' && Number.isFinite(baseAlert)) {
735
- return baseAlert + 1;
736
- }
737
- return 2000 + 1;
738
- }
11
+ import { DEFAULT_SNAPSHOT, createBootOverlaySnapshot, createConnectionOverlaySnapshot, createUpdateOverlaySnapshot } from './dev-overlay-snapshots.js';
12
+ import { getHmrDevOverlayPosition, getOverlayGlobal, getRuntimeState } from './dev-overlay-shared.js';
13
+ import { applySnapshotToBootRefs, applySnapshotToLiveRefs, buildBootOverlayRefs, ensureLiveOverlayRefs, updateBootStatusLabel } from './dev-overlay-tree.js';
14
+ import { applySnapshotToIosRefs, ensureIosOverlayRefs, getIosOverlayHost } from './dev-overlay-ios.js';
15
+ import { resolveOverlayEnabled } from './overlay-flag.js';
16
+ // Re-export the snapshot model and backend pure helpers so existing
17
+ // `./dev-overlay.js` importers keep working.
18
+ export { createBootOverlaySnapshot, createConnectionOverlaySnapshot, createUpdateOverlaySnapshot } from './dev-overlay-snapshots.js';
19
+ export { getHmrDevOverlayPosition } from './dev-overlay-shared.js';
20
+ export { computeAndroidToastMargin } from './dev-overlay-tree.js';
21
+ export { computeIosOverlayLayout, computeIosOverlayWindowLevel } from './dev-overlay-ios.js';
739
22
  /**
740
- * Layout math for the live overlay when it runs inside its own UIWindow.
741
- * Pure, deterministic and independent of UIKit so we can verify the rules
742
- * (max panel width, centered placement, safe-area clamping, sane defaults)
743
- * from tests.
23
+ * Imperative setter for the live-overlay position. Re-applies the
24
+ * current snapshot so the change is visible without waiting for the
25
+ * next HMR cycle. Useful during dev to A/B between top/bottom/center
26
+ * without restarting the app.
744
27
  */
745
- export function computeIosOverlayLayout(input) {
746
- const viewWidth = Math.max(0, Number(input.viewWidth) || 0);
747
- const viewHeight = Math.max(0, Number(input.viewHeight) || 0);
748
- const safeInsets = {
749
- top: Math.max(0, Number(input.safeInsets?.top ?? 0) || 0),
750
- bottom: Math.max(0, Number(input.safeInsets?.bottom ?? 0) || 0),
751
- left: Math.max(0, Number(input.safeInsets?.left ?? 0) || 0),
752
- right: Math.max(0, Number(input.safeInsets?.right ?? 0) || 0),
753
- };
754
- const titleHeight = Math.max(0, Number(input.titleHeight) || 0);
755
- const statusHeight = Math.max(0, Number(input.statusHeight) || 0);
756
- const horizontalMargin = Math.max(0, Number(input.horizontalMargin ?? 24));
757
- const maxPanelWidth = Math.max(0, Number(input.maxPanelWidth ?? 340));
758
- const panelPadding = Math.max(0, Number(input.panelPadding ?? 16));
759
- const interLabelSpacing = Math.max(0, Number(input.interLabelSpacing ?? 10));
760
- const minTopInset = Math.max(0, Number(input.minTopInset ?? 20));
761
- const available = Math.max(0, viewWidth - 2 * horizontalMargin - safeInsets.left - safeInsets.right);
762
- const panelWidth = Math.min(maxPanelWidth, available);
763
- const innerWidth = Math.max(0, panelWidth - 2 * panelPadding);
764
- const spacing = titleHeight > 0 && statusHeight > 0 ? interLabelSpacing : 0;
765
- const panelHeight = panelPadding * 2 + titleHeight + spacing + statusHeight;
766
- const panelX = Math.max(0, (viewWidth - panelWidth) / 2);
767
- // Center vertically, but never cross the top safe-area inset (notch/Dynamic Island).
768
- const centered = (viewHeight - panelHeight) / 2;
769
- const panelY = Math.max(safeInsets.top + minTopInset, centered);
770
- return {
771
- backdrop: { x: 0, y: 0, width: viewWidth, height: viewHeight },
772
- panel: { x: panelX, y: panelY, width: panelWidth, height: panelHeight },
773
- title: { x: panelPadding, y: panelPadding, width: innerWidth, height: titleHeight },
774
- status: {
775
- x: panelPadding,
776
- y: panelPadding + titleHeight + spacing,
777
- width: innerWidth,
778
- height: statusHeight,
779
- },
780
- };
781
- }
782
- /**
783
- * Returns the iOS UIKit symbols we rely on if we're running on an iOS runtime
784
- * with the metadata bridge available. Returns null on Android, web, or in
785
- * tests so callers can gracefully fall back to the in-tree overlay.
786
- */
787
- function getIosOverlayHost() {
788
- const g = getOverlayGlobal();
789
- if (typeof g.UIWindow === 'undefined' || typeof g.UIApplication === 'undefined' || typeof g.UIViewController === 'undefined' || typeof g.UIView === 'undefined' || typeof g.UILabel === 'undefined' || typeof g.UIColor === 'undefined' || typeof g.UIFont === 'undefined' || typeof g.UIScreen === 'undefined') {
790
- return null;
791
- }
792
- return {
793
- UIWindow: g.UIWindow,
794
- UIViewController: g.UIViewController,
795
- UIView: g.UIView,
796
- UILabel: g.UILabel,
797
- UIColor: g.UIColor,
798
- UIFont: g.UIFont,
799
- UIApplication: g.UIApplication,
800
- UIScreen: g.UIScreen,
801
- UIWindowLevelAlert: typeof g.UIWindowLevelAlert === 'number' ? g.UIWindowLevelAlert : undefined,
802
- };
803
- }
804
- /**
805
- * Walks UIApplication.sharedApplication windows and returns the first active
806
- * UIWindowScene we can locate. On iOS 13+ every UIWindow is attached to a
807
- * scene, and we must initialise our overlay window the same way or the OS
808
- * will silently refuse to render it. Returns null when no scene is found
809
- * (older iOS versions or non-UI environments).
810
- */
811
- function findActiveWindowScene(host) {
812
- try {
813
- const app = host.UIApplication.sharedApplication;
814
- const windows = app?.windows;
815
- if (!windows || typeof windows.count !== 'number')
816
- return null;
817
- for (let i = 0; i < windows.count; i++) {
818
- const w = windows.objectAtIndex(i);
819
- const scene = w && w.windowScene;
820
- if (scene)
821
- return scene;
822
- }
823
- }
824
- catch { }
825
- return null;
826
- }
827
- function buildIosOverlayRefs(state) {
828
- const host = getIosOverlayHost();
829
- if (!host)
830
- return null;
831
- // Without a scene we can't build a modern UIWindow that actually renders.
832
- // Fall back to the in-tree overlay rather than show nothing.
833
- const scene = findActiveWindowScene(host);
834
- if (!scene) {
835
- if (state.verbose) {
836
- console.info('[ns-hmr-overlay] no active UIWindowScene; skipping iOS overlay promotion');
837
- }
838
- return null;
839
- }
840
- try {
841
- const { UIWindow, UIViewController, UIView, UILabel, UIColor, UIFont } = host;
842
- const window = UIWindow.alloc().initWithWindowScene(scene);
843
- window.windowLevel = computeIosOverlayWindowLevel(host.UIWindowLevelAlert ?? null);
844
- window.backgroundColor = UIColor.clearColor;
845
- window.hidden = true;
846
- const controller = UIViewController.new();
847
- controller.view.backgroundColor = UIColor.clearColor;
848
- window.rootViewController = controller;
849
- // UIViewAutoresizing bit masks. We mirror the UIKit constants here to
850
- // avoid depending on symbols the metadata bridge does not always
851
- // expose as top-level globals.
852
- const FLEXIBLE_LEFT_MARGIN = 1 << 0;
853
- const FLEXIBLE_WIDTH = 1 << 1;
854
- const FLEXIBLE_RIGHT_MARGIN = 1 << 2;
855
- const FLEXIBLE_TOP_MARGIN = 1 << 3;
856
- const FLEXIBLE_HEIGHT = 1 << 4;
857
- const FLEXIBLE_BOTTOM_MARGIN = 1 << 5;
858
- const backdrop = UIView.new();
859
- backdrop.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0, 0, 0, 0.35);
860
- backdrop.autoresizingMask = FLEXIBLE_WIDTH | FLEXIBLE_HEIGHT;
861
- controller.view.addSubview(backdrop);
862
- const panel = UIView.new();
863
- panel.backgroundColor = UIColor.whiteColor;
864
- panel.autoresizingMask = FLEXIBLE_LEFT_MARGIN | FLEXIBLE_RIGHT_MARGIN | FLEXIBLE_TOP_MARGIN | FLEXIBLE_BOTTOM_MARGIN;
865
- try {
866
- panel.layer.cornerRadius = 14;
867
- panel.layer.masksToBounds = true;
868
- }
869
- catch { }
870
- controller.view.addSubview(panel);
871
- const titleLabel = UILabel.new();
872
- titleLabel.numberOfLines = 0;
873
- titleLabel.textAlignment = 1; // NSTextAlignmentCenter
874
- titleLabel.font = UIFont.boldSystemFontOfSize(16);
875
- titleLabel.textColor = UIColor.blackColor;
876
- panel.addSubview(titleLabel);
877
- const statusLabel = UILabel.new();
878
- statusLabel.numberOfLines = 0;
879
- statusLabel.textAlignment = 1;
880
- statusLabel.font = UIFont.systemFontOfSize(13);
881
- statusLabel.textColor = UIColor.darkGrayColor;
882
- panel.addSubview(statusLabel);
883
- return { window, controller, backdrop, panel, titleLabel, statusLabel };
884
- }
885
- catch (err) {
886
- console.warn('[ns-hmr-overlay] iOS overlay construction failed:', err?.message || err);
887
- return null;
888
- }
889
- }
890
- function ensureIosOverlayRefs(state) {
891
- if (state.iosRefs)
892
- return state.iosRefs;
893
- if (state.iosBuildFailed)
894
- return null;
895
- const built = buildIosOverlayRefs(state);
896
- if (built) {
897
- state.iosRefs = built;
898
- }
899
- else {
900
- // Remember failure so we don't hammer construction on every snapshot
901
- // update — the in-tree path will take over for this session.
902
- state.iosBuildFailed = true;
903
- }
904
- return state.iosRefs;
905
- }
906
- function layoutIosOverlayRefs(refs) {
907
- try {
908
- const bounds = refs.controller.view.bounds;
909
- const viewWidth = Number(bounds?.size?.width) || 0;
910
- const viewHeight = Number(bounds?.size?.height) || 0;
911
- const raw = refs.controller.view.safeAreaInsets;
912
- const safeInsets = raw
913
- ? {
914
- top: Number(raw.top) || 0,
915
- bottom: Number(raw.bottom) || 0,
916
- left: Number(raw.left) || 0,
917
- right: Number(raw.right) || 0,
918
- }
919
- : { top: 0, bottom: 0, left: 0, right: 0 };
920
- // Ask UIKit what the labels want given the panel inner width. We use a
921
- // generous height bound so nothing clips on long reconnect strings.
922
- const panelPadding = 16;
923
- const horizontalMargin = 24;
924
- const maxPanelWidth = 340;
925
- const innerWidth = Math.max(0, Math.min(maxPanelWidth, viewWidth - 2 * horizontalMargin - safeInsets.left - safeInsets.right) - 2 * panelPadding);
926
- const titleFit = refs.titleLabel.sizeThatFits({ width: innerWidth, height: 10000 }) || { height: 0 };
927
- const statusFit = refs.statusLabel.sizeThatFits({ width: innerWidth, height: 10000 }) || { height: 0 };
928
- const layout = computeIosOverlayLayout({
929
- viewWidth,
930
- viewHeight,
931
- safeInsets,
932
- titleHeight: Number(titleFit.height) || 0,
933
- statusHeight: Number(statusFit.height) || 0,
934
- maxPanelWidth,
935
- horizontalMargin,
936
- panelPadding,
937
- });
938
- const toCgRect = (rect) => ({
939
- origin: { x: rect.x, y: rect.y },
940
- size: { width: rect.width, height: rect.height },
941
- });
942
- refs.backdrop.frame = toCgRect(layout.backdrop);
943
- refs.panel.frame = toCgRect(layout.panel);
944
- refs.titleLabel.frame = toCgRect(layout.title);
945
- refs.statusLabel.frame = toCgRect(layout.status);
946
- }
947
- catch (err) {
948
- console.warn('[ns-hmr-overlay] iOS overlay layout failed:', err?.message || err);
949
- }
950
- }
951
- function applySnapshotToIosRefs(refs, snapshot) {
952
- if (!refs)
953
- return false;
954
- try {
955
- // 'update' mode rides the same dedicated UIWindow as
956
- // 'connection' so the HMR apply overlay always stacks above
957
- // modals/sheets/system alerts. The window is constructed
958
- // lazily (ensureIosOverlayRefs) and reused for the lifetime of
959
- // the dev session.
960
- const visible = snapshot.visible && (snapshot.mode === 'connection' || snapshot.mode === 'update');
961
- refs.window.hidden = !visible;
962
- if (!visible)
963
- return true;
964
- refs.titleLabel.text = snapshot.title || '';
965
- refs.statusLabel.text = formatStatusText(snapshot);
966
- const host = getIosOverlayHost();
967
- if (host) {
968
- const { UIColor } = host;
969
- const isError = snapshot.tone === 'error';
970
- const isSuccess = snapshot.tone === 'success';
971
- try {
972
- if (isError) {
973
- // Red panel + dark red text (existing UX).
974
- refs.panel.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(1, 0.96, 0.96, 1);
975
- refs.titleLabel.textColor = UIColor.colorWithRedGreenBlueAlpha(0.7, 0.1, 0.06, 1);
976
- refs.statusLabel.textColor = UIColor.colorWithRedGreenBlueAlpha(0.7, 0.1, 0.06, 0.9);
977
- // Slightly stronger dimming on errors; users need to
978
- // notice these.
979
- refs.backdrop.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0, 0, 0, 0.35);
980
- }
981
- else if (isSuccess) {
982
- // Slightly more saturated green panel + dark-green
983
- // text. The previous 0.94/0.99/0.95 background was
984
- // nearly indistinguishable from white on most
985
- // devices; this bump keeps long detail strings
986
- // readable while making the apply event obviously
987
- // "happening right now".
988
- refs.panel.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0.9, 0.97, 0.91, 1);
989
- refs.titleLabel.textColor = UIColor.colorWithRedGreenBlueAlpha(0.05, 0.43, 0.18, 1);
990
- refs.statusLabel.textColor = UIColor.colorWithRedGreenBlueAlpha(0.05, 0.43, 0.18, 1);
991
- // Bumped from 0.12 to 0.28. The 0.12 wash was so
992
- // faint on bright app backgrounds that the overlay
993
- // was effectively invisible during a fast cycle.
994
- // 0.28 still keeps the app readable underneath but
995
- // makes the HMR event visually unmistakable.
996
- refs.backdrop.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0, 0.15, 0.05, 0.28);
997
- }
998
- else {
999
- // Default (info / warn) — existing connection look.
1000
- refs.panel.backgroundColor = UIColor.whiteColor;
1001
- refs.titleLabel.textColor = UIColor.blackColor;
1002
- refs.statusLabel.textColor = UIColor.darkGrayColor;
1003
- refs.backdrop.backgroundColor = UIColor.colorWithRedGreenBlueAlpha(0, 0, 0, 0.35);
1004
- }
1005
- }
1006
- catch { }
1007
- }
1008
- layoutIosOverlayRefs(refs);
1009
- return true;
1010
- }
1011
- catch (err) {
1012
- console.warn('[ns-hmr-overlay] iOS overlay apply failed:', err?.message || err);
1013
- return false;
28
+ export function setHmrDevOverlayPosition(position) {
29
+ if (position !== 'top' && position !== 'bottom' && position !== 'center') {
30
+ return;
1014
31
  }
32
+ const g = getOverlayGlobal();
33
+ g.__NS_HMR_OVERLAY_POSITION__ = position;
34
+ const state = getRuntimeState();
35
+ applyRuntimeSnapshot(state.snapshot);
1015
36
  }
1016
37
  function applyRuntimeSnapshot(snapshot) {
1017
38
  const state = getRuntimeState();
@@ -1143,7 +164,17 @@ function createOverlayApi() {
1143
164
  const state = getRuntimeState();
1144
165
  clearUpdateAutoHideTimer(state);
1145
166
  state.updateCycleStartedAt = 0;
1146
- return applyRuntimeSnapshot(createBootOverlaySnapshot(stage, info));
167
+ const next = createBootOverlaySnapshot(stage, info);
168
+ // Monotonic boot-progress ratchet: boot stages can fire out of
169
+ // order across boot paths (JS session bootstrap vs the
170
+ // http-bootloader fallback) and individual bases were tuned
171
+ // independently, so clamp boot→boot transitions to never go
172
+ // backwards. Non-boot snapshots (error/ready) bypass — they
173
+ // genuinely want to reset the visual.
174
+ if (next.mode === 'boot' && state.snapshot.mode === 'boot' && typeof next.progress === 'number' && typeof state.snapshot.progress === 'number' && next.progress < state.snapshot.progress) {
175
+ next.progress = state.snapshot.progress;
176
+ }
177
+ return applyRuntimeSnapshot(next);
1147
178
  },
1148
179
  setConnectionStage(stage, info) {
1149
180
  const state = getRuntimeState();
@@ -1203,12 +234,37 @@ function createOverlayApi() {
1203
234
  },
1204
235
  };
1205
236
  }
237
+ // When the overlay is opted out, every surface (boot / connection / update / pending)
238
+ // becomes a no-op so nothing is ever drawn. The boot placeholder root and the
239
+ // `__NS_HMR_BOOT_COMPLETE__` signal are owned by `root-placeholder.ts` and are
240
+ // unaffected, so boot + HMR keep working — the user just sees no progress UI.
241
+ function createNoopOverlayApi() {
242
+ const snapshot = () => getRuntimeState().snapshot;
243
+ return {
244
+ ensureBootPage() {
245
+ return null;
246
+ },
247
+ setBootStage() {
248
+ return snapshot();
249
+ },
250
+ setConnectionStage() {
251
+ return snapshot();
252
+ },
253
+ setUpdateStage() {
254
+ return snapshot();
255
+ },
256
+ hide() { },
257
+ getSnapshot() {
258
+ return snapshot();
259
+ },
260
+ };
261
+ }
1206
262
  export function ensureHmrDevOverlayRuntimeInstalled(verbose) {
1207
263
  const g = getOverlayGlobal();
1208
264
  const state = getRuntimeState();
1209
265
  state.verbose = state.verbose || !!verbose;
1210
266
  if (!g.__NS_HMR_DEV_OVERLAY__) {
1211
- g.__NS_HMR_DEV_OVERLAY__ = createOverlayApi();
267
+ g.__NS_HMR_DEV_OVERLAY__ = resolveOverlayEnabled() ? createOverlayApi() : createNoopOverlayApi();
1212
268
  }
1213
269
  return g.__NS_HMR_DEV_OVERLAY__;
1214
270
  }