@nativescript/vite 8.0.0-alpha.4 → 8.0.0-alpha.41

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 (410) hide show
  1. package/README.md +51 -11
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +376 -165
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +256 -30
  7. package/configuration/base.js.map +1 -1
  8. package/configuration/javascript.js +12 -90
  9. package/configuration/javascript.js.map +1 -1
  10. package/configuration/solid.js +33 -4
  11. package/configuration/solid.js.map +1 -1
  12. package/configuration/typescript.js +10 -90
  13. package/configuration/typescript.js.map +1 -1
  14. package/helpers/app-components.d.ts +2 -1
  15. package/helpers/app-components.js.map +1 -1
  16. package/helpers/app-css-state.d.ts +8 -0
  17. package/helpers/app-css-state.js +8 -0
  18. package/helpers/app-css-state.js.map +1 -0
  19. package/helpers/bundler-context.d.ts +11 -0
  20. package/helpers/bundler-context.js +71 -0
  21. package/helpers/bundler-context.js.map +1 -0
  22. package/helpers/config-as-json.js +10 -0
  23. package/helpers/config-as-json.js.map +1 -1
  24. package/helpers/css-platform-plugin.d.ts +14 -0
  25. package/helpers/css-platform-plugin.js +43 -25
  26. package/helpers/css-platform-plugin.js.map +1 -1
  27. package/helpers/dev-host.d.ts +360 -0
  28. package/helpers/dev-host.js +692 -0
  29. package/helpers/dev-host.js.map +1 -0
  30. package/helpers/dynamic-import-plugin.js +1 -1
  31. package/helpers/dynamic-import-plugin.js.map +1 -1
  32. package/helpers/esbuild-platform-resolver.js +4 -1
  33. package/helpers/esbuild-platform-resolver.js.map +1 -1
  34. package/helpers/external-configs.d.ts +10 -12
  35. package/helpers/external-configs.js +54 -35
  36. package/helpers/external-configs.js.map +1 -1
  37. package/helpers/global-defines.d.ts +128 -0
  38. package/helpers/global-defines.js +174 -11
  39. package/helpers/global-defines.js.map +1 -1
  40. package/helpers/hmr-scope.d.ts +26 -0
  41. package/helpers/hmr-scope.js +67 -0
  42. package/helpers/hmr-scope.js.map +1 -0
  43. package/helpers/init.js +0 -18
  44. package/helpers/init.js.map +1 -1
  45. package/helpers/logging.d.ts +1 -0
  46. package/helpers/logging.js +65 -4
  47. package/helpers/logging.js.map +1 -1
  48. package/helpers/main-entry.d.ts +3 -1
  49. package/helpers/main-entry.js +444 -50
  50. package/helpers/main-entry.js.map +1 -1
  51. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  52. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  53. package/helpers/nativeclass-transform.js +5 -6
  54. package/helpers/nativeclass-transform.js.map +1 -1
  55. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  56. package/helpers/nativeclass-transformer-plugin.js +157 -14
  57. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  58. package/helpers/nativescript-package-resolver.js +10 -62
  59. package/helpers/nativescript-package-resolver.js.map +1 -1
  60. package/helpers/normalize-id.d.ts +42 -0
  61. package/helpers/normalize-id.js +60 -0
  62. package/helpers/normalize-id.js.map +1 -0
  63. package/helpers/ns-core-url.d.ts +106 -0
  64. package/helpers/ns-core-url.js +225 -0
  65. package/helpers/ns-core-url.js.map +1 -0
  66. package/helpers/optimize-deps.d.ts +16 -0
  67. package/helpers/optimize-deps.js +17 -0
  68. package/helpers/optimize-deps.js.map +1 -0
  69. package/helpers/package-platform-aliases.js +34 -49
  70. package/helpers/package-platform-aliases.js.map +1 -1
  71. package/helpers/platform-types.d.ts +2 -0
  72. package/helpers/platform-types.js +2 -0
  73. package/helpers/platform-types.js.map +1 -0
  74. package/helpers/postcss-platform-config.d.ts +17 -1
  75. package/helpers/postcss-platform-config.js +20 -37
  76. package/helpers/postcss-platform-config.js.map +1 -1
  77. package/helpers/project.d.ts +35 -0
  78. package/helpers/project.js +120 -2
  79. package/helpers/project.js.map +1 -1
  80. package/helpers/resolve-main-field-platform.d.ts +20 -0
  81. package/helpers/resolve-main-field-platform.js +49 -0
  82. package/helpers/resolve-main-field-platform.js.map +1 -0
  83. package/helpers/resolver.js +17 -2
  84. package/helpers/resolver.js.map +1 -1
  85. package/helpers/theme-core-plugins.js +1 -1
  86. package/helpers/theme-core-plugins.js.map +1 -1
  87. package/helpers/ts-config-paths.d.ts +14 -0
  88. package/helpers/ts-config-paths.js +90 -9
  89. package/helpers/ts-config-paths.js.map +1 -1
  90. package/helpers/typescript-check.d.ts +2 -1
  91. package/helpers/typescript-check.js.map +1 -1
  92. package/helpers/ui-registration.d.ts +21 -0
  93. package/helpers/ui-registration.js +156 -0
  94. package/helpers/ui-registration.js.map +1 -0
  95. package/helpers/utils.js +1 -2
  96. package/helpers/utils.js.map +1 -1
  97. package/helpers/workers.d.ts +20 -19
  98. package/helpers/workers.js +624 -4
  99. package/helpers/workers.js.map +1 -1
  100. package/hmr/client/css-handler.d.ts +2 -1
  101. package/hmr/client/css-handler.js +50 -26
  102. package/hmr/client/css-handler.js.map +1 -1
  103. package/hmr/client/css-update-overlay.d.ts +18 -0
  104. package/hmr/client/css-update-overlay.js +27 -0
  105. package/hmr/client/css-update-overlay.js.map +1 -0
  106. package/hmr/client/framework-client-strategy.d.ts +79 -0
  107. package/hmr/client/framework-client-strategy.js +19 -0
  108. package/hmr/client/framework-client-strategy.js.map +1 -0
  109. package/hmr/client/hmr-pending-overlay.d.ts +13 -0
  110. package/hmr/client/hmr-pending-overlay.js +60 -0
  111. package/hmr/client/hmr-pending-overlay.js.map +1 -0
  112. package/hmr/client/index.js +820 -212
  113. package/hmr/client/index.js.map +1 -1
  114. package/hmr/client/utils.d.ts +7 -1
  115. package/hmr/client/utils.js +207 -29
  116. package/hmr/client/utils.js.map +1 -1
  117. package/hmr/entry-runtime.d.ts +2 -1
  118. package/hmr/entry-runtime.js +256 -69
  119. package/hmr/entry-runtime.js.map +1 -1
  120. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  121. package/hmr/frameworks/angular/build/angular-linker.js +109 -0
  122. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  123. package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
  124. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
  125. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  126. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  127. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  128. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  129. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  130. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  131. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  132. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  133. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  134. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  135. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  136. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  137. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  138. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  139. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  140. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  141. package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
  142. package/hmr/frameworks/angular/build/util.js +155 -0
  143. package/hmr/frameworks/angular/build/util.js.map +1 -0
  144. package/hmr/frameworks/angular/client/index.d.ts +1 -0
  145. package/hmr/frameworks/angular/client/index.js +803 -21
  146. package/hmr/frameworks/angular/client/index.js.map +1 -1
  147. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  148. package/hmr/frameworks/angular/client/strategy.js +19 -0
  149. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  150. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  151. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  152. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  153. package/hmr/frameworks/angular/server/linker.js +1 -4
  154. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  155. package/hmr/frameworks/angular/server/strategy.js +460 -12
  156. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  157. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  158. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  159. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +17 -11
  160. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +336 -0
  161. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  162. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  163. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  164. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  165. package/hmr/frameworks/solid/server/strategy.js +291 -16
  166. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  167. package/hmr/frameworks/typescript/server/strategy.js +38 -14
  168. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  169. package/hmr/frameworks/vue/client/dep-propagation.d.ts +36 -0
  170. package/hmr/frameworks/vue/client/dep-propagation.js +101 -0
  171. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  172. package/hmr/frameworks/vue/client/index.d.ts +8 -0
  173. package/hmr/frameworks/vue/client/index.js +56 -243
  174. package/hmr/frameworks/vue/client/index.js.map +1 -1
  175. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  176. package/hmr/frameworks/vue/client/strategy.js +157 -0
  177. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  178. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  179. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +142 -0
  180. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  181. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  182. package/hmr/frameworks/vue/server/sfc-route-assemble.js +747 -0
  183. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  184. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  185. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  186. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  187. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  188. package/hmr/frameworks/vue/server/sfc-route-serve.js +459 -0
  189. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  190. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +38 -0
  191. package/hmr/frameworks/vue/server/sfc-route-shared.js +48 -0
  192. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  193. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  194. package/hmr/frameworks/vue/server/strategy.js +278 -1
  195. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  196. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  197. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  198. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  199. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  200. package/hmr/helpers/ast-normalizer.js +77 -10
  201. package/hmr/helpers/ast-normalizer.js.map +1 -1
  202. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  203. package/hmr/helpers/cjs-named-exports.js +152 -0
  204. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  205. package/hmr/helpers/package-exports.d.ts +16 -0
  206. package/hmr/helpers/package-exports.js +396 -0
  207. package/hmr/helpers/package-exports.js.map +1 -0
  208. package/hmr/server/constants.js +20 -5
  209. package/hmr/server/constants.js.map +1 -1
  210. package/hmr/server/core-sanitize.d.ts +90 -7
  211. package/hmr/server/core-sanitize.js +211 -56
  212. package/hmr/server/core-sanitize.js.map +1 -1
  213. package/hmr/server/device-transform-helpers.d.ts +24 -0
  214. package/hmr/server/device-transform-helpers.js +369 -0
  215. package/hmr/server/device-transform-helpers.js.map +1 -0
  216. package/hmr/server/framework-strategy.d.ts +108 -11
  217. package/hmr/server/hmr-module-graph.d.ts +37 -0
  218. package/hmr/server/hmr-module-graph.js +214 -0
  219. package/hmr/server/hmr-module-graph.js.map +1 -0
  220. package/hmr/server/import-map.d.ts +11 -2
  221. package/hmr/server/import-map.js +95 -44
  222. package/hmr/server/import-map.js.map +1 -1
  223. package/hmr/server/index.js +7 -16
  224. package/hmr/server/index.js.map +1 -1
  225. package/hmr/server/ns-core-cjs-shape.d.ts +204 -0
  226. package/hmr/server/ns-core-cjs-shape.js +271 -0
  227. package/hmr/server/ns-core-cjs-shape.js.map +1 -0
  228. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  229. package/hmr/server/ns-rt-bridge.js +131 -0
  230. package/hmr/server/ns-rt-bridge.js.map +1 -0
  231. package/hmr/server/ns-rt-route.d.ts +5 -0
  232. package/hmr/server/ns-rt-route.js +38 -0
  233. package/hmr/server/ns-rt-route.js.map +1 -0
  234. package/hmr/server/perf-instrumentation.d.ts +114 -0
  235. package/hmr/server/perf-instrumentation.js +197 -0
  236. package/hmr/server/perf-instrumentation.js.map +1 -0
  237. package/hmr/server/process-code-for-device.d.ts +14 -0
  238. package/hmr/server/process-code-for-device.js +702 -0
  239. package/hmr/server/process-code-for-device.js.map +1 -0
  240. package/hmr/server/require-guard.d.ts +1 -0
  241. package/hmr/server/require-guard.js +12 -0
  242. package/hmr/server/require-guard.js.map +1 -0
  243. package/hmr/server/rewrite-imports.d.ts +2 -0
  244. package/hmr/server/rewrite-imports.js +600 -0
  245. package/hmr/server/rewrite-imports.js.map +1 -0
  246. package/hmr/server/route-helpers.d.ts +7 -0
  247. package/hmr/server/route-helpers.js +13 -0
  248. package/hmr/server/route-helpers.js.map +1 -0
  249. package/hmr/server/server-origin.d.ts +2 -0
  250. package/hmr/server/server-origin.js +83 -0
  251. package/hmr/server/server-origin.js.map +1 -0
  252. package/hmr/server/shared-transform-request.js +13 -7
  253. package/hmr/server/shared-transform-request.js.map +1 -1
  254. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  255. package/hmr/server/transform-cache-invalidation.js +156 -0
  256. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  257. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  258. package/hmr/server/vendor-bare-module-shims.js +80 -0
  259. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  260. package/hmr/server/vite-plugin.js +72 -42
  261. package/hmr/server/vite-plugin.js.map +1 -1
  262. package/hmr/server/websocket-core-bridge.d.ts +45 -6
  263. package/hmr/server/websocket-core-bridge.js +81 -77
  264. package/hmr/server/websocket-core-bridge.js.map +1 -1
  265. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  266. package/hmr/server/websocket-css-hot-update.js +65 -0
  267. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  268. package/hmr/server/websocket-device-transform.d.ts +3 -0
  269. package/hmr/server/websocket-device-transform.js +7 -0
  270. package/hmr/server/websocket-device-transform.js.map +1 -0
  271. package/hmr/server/websocket-graph-upsert.d.ts +15 -0
  272. package/hmr/server/websocket-graph-upsert.js +20 -0
  273. package/hmr/server/websocket-graph-upsert.js.map +1 -1
  274. package/hmr/server/websocket-hmr-pending.d.ts +37 -0
  275. package/hmr/server/websocket-hmr-pending.js +55 -0
  276. package/hmr/server/websocket-hmr-pending.js.map +1 -0
  277. package/hmr/server/websocket-hot-update.d.ts +77 -0
  278. package/hmr/server/websocket-hot-update.js +360 -0
  279. package/hmr/server/websocket-hot-update.js.map +1 -0
  280. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  281. package/hmr/server/websocket-import-map-route.js +50 -0
  282. package/hmr/server/websocket-import-map-route.js.map +1 -0
  283. package/hmr/server/websocket-module-bindings.js +3 -3
  284. package/hmr/server/websocket-module-bindings.js.map +1 -1
  285. package/hmr/server/websocket-module-specifiers.d.ts +66 -2
  286. package/hmr/server/websocket-module-specifiers.js +203 -20
  287. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  288. package/hmr/server/websocket-ns-core.d.ts +21 -0
  289. package/hmr/server/websocket-ns-core.js +311 -0
  290. package/hmr/server/websocket-ns-core.js.map +1 -0
  291. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  292. package/hmr/server/websocket-ns-entry.js +164 -0
  293. package/hmr/server/websocket-ns-entry.js.map +1 -0
  294. package/hmr/server/websocket-ns-m-paths.d.ts +1 -1
  295. package/hmr/server/websocket-ns-m-paths.js +58 -13
  296. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  297. package/hmr/server/websocket-ns-m-request.d.ts +11 -1
  298. package/hmr/server/websocket-ns-m-request.js +18 -25
  299. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  300. package/hmr/server/websocket-ns-m.d.ts +33 -0
  301. package/hmr/server/websocket-ns-m.js +752 -0
  302. package/hmr/server/websocket-ns-m.js.map +1 -0
  303. package/hmr/server/websocket-served-module-helpers.d.ts +82 -0
  304. package/hmr/server/websocket-served-module-helpers.js +879 -0
  305. package/hmr/server/websocket-served-module-helpers.js.map +1 -0
  306. package/hmr/server/websocket-txn.js +2 -8
  307. package/hmr/server/websocket-txn.js.map +1 -1
  308. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  309. package/hmr/server/websocket-vendor-unifier.js +4 -9
  310. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  311. package/hmr/server/websocket.d.ts +8 -39
  312. package/hmr/server/websocket.js +514 -4030
  313. package/hmr/server/websocket.js.map +1 -1
  314. package/hmr/shared/ns-globals.d.ts +118 -0
  315. package/hmr/shared/ns-globals.js +29 -0
  316. package/hmr/shared/ns-globals.js.map +1 -0
  317. package/hmr/shared/protocol.d.ts +145 -0
  318. package/hmr/shared/protocol.js +28 -0
  319. package/hmr/shared/protocol.js.map +1 -0
  320. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  321. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  322. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  323. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  324. package/hmr/shared/runtime/boot-progress.js +133 -0
  325. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  326. package/hmr/shared/runtime/boot-timeline.d.ts +18 -0
  327. package/hmr/shared/runtime/boot-timeline.js +42 -0
  328. package/hmr/shared/runtime/boot-timeline.js.map +1 -0
  329. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  330. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  331. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  332. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  333. package/hmr/shared/runtime/dev-overlay.d.ts +119 -26
  334. package/hmr/shared/runtime/dev-overlay.js +1153 -261
  335. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  336. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  337. package/hmr/shared/runtime/global-scope.js +21 -0
  338. package/hmr/shared/runtime/global-scope.js.map +1 -0
  339. package/hmr/shared/runtime/hooks.js +2 -1
  340. package/hmr/shared/runtime/hooks.js.map +1 -1
  341. package/hmr/shared/runtime/http-only-boot.js +7 -6
  342. package/hmr/shared/runtime/http-only-boot.js.map +1 -1
  343. package/hmr/shared/runtime/module-provenance.js +4 -6
  344. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  345. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  346. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  347. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  348. package/hmr/shared/runtime/root-placeholder.js +371 -197
  349. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  350. package/hmr/shared/runtime/session-bootstrap.js +168 -4
  351. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  352. package/hmr/shared/runtime/vendor-bootstrap.js +3 -10
  353. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  354. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  355. package/hmr/shared/vendor/manifest-collect.js +512 -0
  356. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  357. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  358. package/hmr/shared/vendor/manifest-loader.js +5 -3
  359. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  360. package/hmr/shared/vendor/manifest.d.ts +1 -7
  361. package/hmr/shared/vendor/manifest.js +102 -741
  362. package/hmr/shared/vendor/manifest.js.map +1 -1
  363. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  364. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  365. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  366. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +16 -0
  367. package/hmr/shared/vendor/vendor-esbuild-plugins.js +203 -0
  368. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  369. package/hmr/vendor-bootstrap.d.ts +1 -3
  370. package/hmr/vendor-bootstrap.js +4 -6
  371. package/hmr/vendor-bootstrap.js.map +1 -1
  372. package/index.d.ts +1 -0
  373. package/index.js +5 -0
  374. package/index.js.map +1 -1
  375. package/package.json +55 -11
  376. package/runtime/core-aliases-early.js +25 -55
  377. package/runtime/core-aliases-early.js.map +1 -1
  378. package/helpers/angular/angular-linker.d.ts +0 -13
  379. package/helpers/angular/angular-linker.js +0 -194
  380. package/helpers/angular/angular-linker.js.map +0 -1
  381. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  382. package/helpers/angular/shared-linker.d.ts +0 -11
  383. package/helpers/angular/shared-linker.js +0 -75
  384. package/helpers/angular/shared-linker.js.map +0 -1
  385. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  386. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  387. package/helpers/angular/util.js +0 -67
  388. package/helpers/angular/util.js.map +0 -1
  389. package/helpers/prelink-angular.d.ts +0 -2
  390. package/helpers/prelink-angular.js +0 -117
  391. package/helpers/prelink-angular.js.map +0 -1
  392. package/hmr/server/websocket-angular-entry.js.map +0 -1
  393. package/hmr/server/websocket-angular-hot-update.js +0 -239
  394. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  395. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -32
  396. package/hmr/server/websocket-ns-m-finalize.js +0 -73
  397. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  398. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  399. package/hmr/server/websocket-runtime-compat.js +0 -286
  400. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  401. package/hmr/server/websocket-vue-sfc.d.ts +0 -35
  402. package/hmr/server/websocket-vue-sfc.js +0 -1116
  403. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  404. package/transformers/NativeClass/index.d.ts +0 -2
  405. package/transformers/NativeClass/index.js +0 -222
  406. package/transformers/NativeClass/index.js.map +0 -1
  407. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  408. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  409. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  410. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ export interface CollectCssHotUpdatePathsOptions {
2
+ /** Absolute path of the file the watcher saw change. */
3
+ file: string;
4
+ /** Vite dev server `config.root` (project root for the NS app). */
5
+ root: string;
6
+ /** `nativescript.config#appPath` value. Defaults to `'src'`. */
7
+ appRootDir?: string;
8
+ /**
9
+ * Absolute path to the project's primary CSS entry
10
+ * (`<root>/<appRootDir>/app.css`). Required to broadcast for
11
+ * out-of-scope CSS saves — workspace deps `@import`'d from
12
+ * `app.css` invalidate the `virtual:ns-app-css` module, which has
13
+ * no real `.file` to broadcast on its own.
14
+ */
15
+ appEntryCss?: string | null;
16
+ }
17
+ /**
18
+ * Compute the root-relative POSIX path to broadcast in `ns:css-updates`
19
+ * for a given CSS hot-update.
20
+ *
21
+ * - **In-scope CSS edit** (`<root>/src|core|<appRootDir>/...css`):
22
+ * broadcast that file's path.
23
+ * - **Out-of-scope CSS edit** (workspace dep `@import`'d via
24
+ * `app.css`): broadcast `appEntryCss`. The runtime fetches
25
+ * `app.css?direct=1`, Vite re-runs PostCSS through the `@import`
26
+ * chain, and the merged CSS lands.
27
+ *
28
+ * NS only ever fetches the entry CSS at runtime, so a single
29
+ * `appEntryCss` broadcast covers every workspace-dep CSS save —
30
+ * regardless of how deep the `@import` chain goes. Returns `[]` for
31
+ * non-CSS files or when no broadcast target is available.
32
+ */
33
+ export declare function collectCssHotUpdatePaths(options: CollectCssHotUpdatePathsOptions): string[];
@@ -0,0 +1,65 @@
1
+ import path from 'path';
2
+ const CSS_EXTENSION = /\.css(?:[?#].*)?$/i;
3
+ function toPosix(value) {
4
+ return value.replace(/\\/g, '/');
5
+ }
6
+ function stripQuery(value) {
7
+ const idx = value.search(/[?#]/);
8
+ return idx === -1 ? value : value.slice(0, idx);
9
+ }
10
+ function isInProjectScope(absPath, root, appRootDir) {
11
+ if (!absPath || !root)
12
+ return false;
13
+ const absPosix = stripQuery(toPosix(absPath));
14
+ const rootPosix = toPosix(root).replace(/\/$/, '');
15
+ const dirs = [`${rootPosix}/src`, `${rootPosix}/core`];
16
+ if (appRootDir && appRootDir !== 'src') {
17
+ dirs.push(`${rootPosix}/${appRootDir}`);
18
+ }
19
+ return dirs.some((dir) => absPosix === dir || absPosix.startsWith(`${dir}/`));
20
+ }
21
+ function toRootRelative(absPath, root) {
22
+ if (!absPath || !root)
23
+ return null;
24
+ const cleaned = stripQuery(toPosix(absPath));
25
+ const rootPosix = toPosix(root).replace(/\/$/, '');
26
+ if (cleaned !== rootPosix && !cleaned.startsWith(`${rootPosix}/`)) {
27
+ return null;
28
+ }
29
+ const rel = path.posix.normalize(path.posix.relative(rootPosix, cleaned));
30
+ if (!rel || rel === '.' || rel.startsWith('..'))
31
+ return null;
32
+ return rel.startsWith('/') ? rel : `/${rel}`;
33
+ }
34
+ /**
35
+ * Compute the root-relative POSIX path to broadcast in `ns:css-updates`
36
+ * for a given CSS hot-update.
37
+ *
38
+ * - **In-scope CSS edit** (`<root>/src|core|<appRootDir>/...css`):
39
+ * broadcast that file's path.
40
+ * - **Out-of-scope CSS edit** (workspace dep `@import`'d via
41
+ * `app.css`): broadcast `appEntryCss`. The runtime fetches
42
+ * `app.css?direct=1`, Vite re-runs PostCSS through the `@import`
43
+ * chain, and the merged CSS lands.
44
+ *
45
+ * NS only ever fetches the entry CSS at runtime, so a single
46
+ * `appEntryCss` broadcast covers every workspace-dep CSS save —
47
+ * regardless of how deep the `@import` chain goes. Returns `[]` for
48
+ * non-CSS files or when no broadcast target is available.
49
+ */
50
+ export function collectCssHotUpdatePaths(options) {
51
+ const { file, root, appRootDir, appEntryCss } = options;
52
+ if (!file || !root)
53
+ return [];
54
+ if (!CSS_EXTENSION.test(file))
55
+ return [];
56
+ if (isInProjectScope(file, root, appRootDir)) {
57
+ const rel = toRootRelative(file, root);
58
+ return rel ? [rel] : [];
59
+ }
60
+ if (!appEntryCss)
61
+ return [];
62
+ const rel = toRootRelative(appEntryCss, root);
63
+ return rel ? [rel] : [];
64
+ }
65
+ //# sourceMappingURL=websocket-css-hot-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-css-hot-update.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-css-hot-update.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAmBxB,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C,SAAS,OAAO,CAAC,KAAa;IAC7B,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,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { processCodeForDevice, cleanCode, collectImportDependencies } from './process-code-for-device.js';
2
+ export { rewriteImports, prepareAngularEntryForDevice } from './rewrite-imports.js';
3
+ export { shouldRemapImport } from './device-transform-helpers.js';
@@ -0,0 +1,7 @@
1
+ // Public entry point for the device code-transform subsystem (the HMR plugin's
2
+ // hot path). The implementation lives in three focused modules; consumers and
3
+ // spec suites import the subsystem's surface from here.
4
+ export { processCodeForDevice, cleanCode, collectImportDependencies } from './process-code-for-device.js';
5
+ export { rewriteImports, prepareAngularEntryForDevice } from './rewrite-imports.js';
6
+ export { shouldRemapImport } from './device-transform-helpers.js';
7
+ //# sourceMappingURL=websocket-device-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-device-transform.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-device-transform.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,8EAA8E;AAC9E,wDAAwD;AACxD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC1G,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC"}
@@ -4,3 +4,18 @@ export declare function classifyGraphUpsert(existing: {
4
4
  deps: string[];
5
5
  } | undefined, nextHash: string, nextDeps: string[]): GraphUpsertClassification;
6
6
  export declare function shouldBroadcastGraphUpsertDelta(classification: GraphUpsertClassification, emitDeltaOnInsert?: boolean, broadcastEnabled?: boolean): boolean;
7
+ /**
8
+ * Decide whether an upsert should advance the shared graphVersion
9
+ * counter. Serve-time warm-ups (and the background initial-graph walk) pass
10
+ * `bumpVersion: false` so graphVersion stays stable during cold boot — that
11
+ * stability is what lets the dynamic-import helper tag every first-session
12
+ * URL with a consistent `v1` instead of drifting between `live`, `v12`,
13
+ * `v433`... (which would produce double-loaded modules on iOS HTTP ESM).
14
+ * Real live edits (handleHotUpdate and framework hot-update handlers) leave
15
+ * `bumpVersion` unset or true and advance the counter as before.
16
+ *
17
+ * The helper also treats `unchanged` classifications as no-op: they bypass
18
+ * the graph set entirely in upsertGraphModule, so the version must not
19
+ * advance for them either.
20
+ */
21
+ export declare function shouldBumpGraphVersion(classification: GraphUpsertClassification, bumpVersion?: boolean): boolean;
@@ -10,4 +10,24 @@ export function classifyGraphUpsert(existing, nextHash, nextDeps) {
10
10
  export function shouldBroadcastGraphUpsertDelta(classification, emitDeltaOnInsert = false, broadcastEnabled = true) {
11
11
  return broadcastEnabled && (classification === 'changed' || (classification === 'inserted' && emitDeltaOnInsert));
12
12
  }
13
+ /**
14
+ * Decide whether an upsert should advance the shared graphVersion
15
+ * counter. Serve-time warm-ups (and the background initial-graph walk) pass
16
+ * `bumpVersion: false` so graphVersion stays stable during cold boot — that
17
+ * stability is what lets the dynamic-import helper tag every first-session
18
+ * URL with a consistent `v1` instead of drifting between `live`, `v12`,
19
+ * `v433`... (which would produce double-loaded modules on iOS HTTP ESM).
20
+ * Real live edits (handleHotUpdate and framework hot-update handlers) leave
21
+ * `bumpVersion` unset or true and advance the counter as before.
22
+ *
23
+ * The helper also treats `unchanged` classifications as no-op: they bypass
24
+ * the graph set entirely in upsertGraphModule, so the version must not
25
+ * advance for them either.
26
+ */
27
+ export function shouldBumpGraphVersion(classification, bumpVersion = true) {
28
+ if (classification === 'unchanged') {
29
+ return false;
30
+ }
31
+ return bumpVersion !== false;
32
+ }
13
33
  //# sourceMappingURL=websocket-graph-upsert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket-graph-upsert.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-graph-upsert.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB,CAAC,QAAsD,EAAE,QAAgB,EAAE,QAAkB;IAC/H,IAAI,CAA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gBAAgB,IAAI,CAAC,cAAc,KAAK,SAAS,IAAI,CAAC,cAAc,KAAK,UAAU,IAAI,iBAAiB,CAAC,CAAC,CAAC;AACnH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAAyC,EAAE,cAAuB,IAAI;IAC5G,IAAI,cAAc,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,WAAW,KAAK,KAAK,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Early "pending" notification for HMR.
3
+ *
4
+ * When `handleHotUpdate(ctx)` first fires for a save event, the server
5
+ * spends 7–200ms doing graph upserts, transforms and dependency
6
+ * analysis BEFORE broadcasting `ns:angular-update` (or
7
+ * `ns:css-updates`). During that window the client has no idea a
8
+ * change is in flight, so the HMR-applying overlay only appears at
9
+ * the tail end of the cycle and the user perceives the dev loop as
10
+ * laggy.
11
+ *
12
+ * `ns:hmr-pending` is broadcast at the very start of `handleHotUpdate`
13
+ * with just the file path + classified kind. The client reacts by
14
+ * showing the 'received' overlay frame immediately. The authoritative
15
+ * payload (`ns:angular-update` / `ns:css-updates`) follows once the
16
+ * server is ready and walks the rest of the stage progression.
17
+ *
18
+ * This module is intentionally a pure helper so the message shape and
19
+ * narrowing rules can be verified without spinning up a Vite dev
20
+ * server.
21
+ */
22
+ import type { HmrPendingKind, HmrPendingMessage } from '../shared/protocol.js';
23
+ export type { HmrPendingKind, HmrPendingMessage };
24
+ export declare function createHmrPendingMessage(input: {
25
+ origin: string;
26
+ path: string;
27
+ kind: string;
28
+ timestamp: number;
29
+ }): HmrPendingMessage;
30
+ /**
31
+ * Parser used by the client to identify a pending message regardless of
32
+ * which framework is active. We accept the message only when every
33
+ * expected field is present and well-formed — this guards against
34
+ * accidental matches on legacy server payloads or developer-written
35
+ * mocks during tests.
36
+ */
37
+ export declare function isHmrPendingMessage(value: unknown): value is HmrPendingMessage;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Early "pending" notification for HMR.
3
+ *
4
+ * When `handleHotUpdate(ctx)` first fires for a save event, the server
5
+ * spends 7–200ms doing graph upserts, transforms and dependency
6
+ * analysis BEFORE broadcasting `ns:angular-update` (or
7
+ * `ns:css-updates`). During that window the client has no idea a
8
+ * change is in flight, so the HMR-applying overlay only appears at
9
+ * the tail end of the cycle and the user perceives the dev loop as
10
+ * laggy.
11
+ *
12
+ * `ns:hmr-pending` is broadcast at the very start of `handleHotUpdate`
13
+ * with just the file path + classified kind. The client reacts by
14
+ * showing the 'received' overlay frame immediately. The authoritative
15
+ * payload (`ns:angular-update` / `ns:css-updates`) follows once the
16
+ * server is ready and walks the rest of the stage progression.
17
+ *
18
+ * This module is intentionally a pure helper so the message shape and
19
+ * narrowing rules can be verified without spinning up a Vite dev
20
+ * server.
21
+ */
22
+ export function createHmrPendingMessage(input) {
23
+ const allowed = ['ts', 'css', 'html', 'unknown'];
24
+ const kind = allowed.includes(input.kind || '') ? input.kind : 'unknown';
25
+ return {
26
+ type: 'ns:hmr-pending',
27
+ origin: typeof input.origin === 'string' ? input.origin : '',
28
+ path: typeof input.path === 'string' ? input.path : '',
29
+ kind,
30
+ timestamp: typeof input.timestamp === 'number' && Number.isFinite(input.timestamp) ? input.timestamp : 0,
31
+ };
32
+ }
33
+ /**
34
+ * Parser used by the client to identify a pending message regardless of
35
+ * which framework is active. We accept the message only when every
36
+ * expected field is present and well-formed — this guards against
37
+ * accidental matches on legacy server payloads or developer-written
38
+ * mocks during tests.
39
+ */
40
+ export function isHmrPendingMessage(value) {
41
+ if (!value || typeof value !== 'object')
42
+ return false;
43
+ const v = value;
44
+ if (v.type !== 'ns:hmr-pending')
45
+ return false;
46
+ if (typeof v.path !== 'string' || !v.path)
47
+ return false;
48
+ if (typeof v.timestamp !== 'number' || !Number.isFinite(v.timestamp))
49
+ return false;
50
+ const allowed = ['ts', 'css', 'html', 'unknown'];
51
+ if (!allowed.includes(v.kind || ''))
52
+ return false;
53
+ return true;
54
+ }
55
+ //# sourceMappingURL=websocket-hmr-pending.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websocket-hmr-pending.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/websocket-hmr-pending.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAQH,MAAM,UAAU,uBAAuB,CAAC,KAAwE;IAC/G,MAAM,OAAO,GAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnE,MAAM,IAAI,GAAI,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAE,KAAK,CAAC,IAAuB,CAAC,CAAC,CAAC,SAAS,CAAC;IACpH,OAAO;QACN,IAAI,EAAE,gBAAgB;QACtB,MAAM,EAAE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QAC5D,IAAI,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;QACtD,IAAI;QACJ,SAAS,EAAE,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KACxG,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc;IACjD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAAmC,CAAC;IAC9C,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAgB;QAAE,OAAO,KAAK,CAAC;IAC9C,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxD,IAAI,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAC;IACnF,MAAM,OAAO,GAAqB,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnE,IAAI,CAAE,OAA6B,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QAAE,OAAO,KAAK,CAAC;IACzE,OAAO,IAAI,CAAC;AACb,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { HmrContext } from 'vite';
2
+ import type { WebSocketServer } from 'ws';
3
+ import type { FrameworkServerStrategy } from './framework-strategy.js';
4
+ import type { HmrModuleGraph } from './hmr-module-graph.js';
5
+ import type { SharedTransformRequestRunner } from './shared-transform-request.js';
6
+ import type { BootstrapRootComponent } from '../frameworks/angular/server/angular-root-component.js';
7
+ /**
8
+ * Dependencies injected into each strategy's `handleHotUpdate` (and the shared
9
+ * {@link runHotUpdatePrologue} it runs first). These hold per-server instance
10
+ * state (`wss`, `moduleGraph`, the file maps, `sharedTransformRequest`) or are
11
+ * plugin-closure accessors. Pure transform helpers (`cleanCode`,
12
+ * `rewriteImports`, `processSfcCode`, `collectImportDependencies`) are NOT on the
13
+ * context — the strategies that need them import them directly from
14
+ * `websocket-device-transform.ts`. `getServerOrigin` is likewise imported
15
+ * directly here from `server-origin.ts` (spy via the module in tests).
16
+ */
17
+ export interface NsHotUpdateContext {
18
+ wss: WebSocketServer | null;
19
+ moduleGraph: HmrModuleGraph;
20
+ strategy: FrameworkServerStrategy;
21
+ verbose: boolean;
22
+ sfcFileMap: Map<string, string>;
23
+ depFileMap: Map<string, string>;
24
+ sharedTransformRequest: SharedTransformRequestRunner;
25
+ getHmrSourceRootsCached: () => string[];
26
+ getBootstrapEntryRelPath: () => string;
27
+ isSocketClientOpen: (client: {
28
+ readyState?: number;
29
+ OPEN?: number;
30
+ } | null | undefined) => boolean;
31
+ getHmrSocketRole: (client: {
32
+ __nsHmrClientRole?: string;
33
+ } | null | undefined) => string;
34
+ shouldRemapImport: (spec: string) => boolean;
35
+ rememberAngularReloadSuppression: (root: string, file: string, ttlMs?: number) => void;
36
+ /**
37
+ * Resolves the Angular bootstrap (root) component, or `null` when it
38
+ * can't be statically determined. Used to force root-component template
39
+ * edits through the reboot path instead of Analog's in-place update,
40
+ * which is destructive for the root view (see {@link BootstrapRootComponent}).
41
+ */
42
+ getRootComponentIdentity: () => BootstrapRootComponent | null;
43
+ getGraphInitialPopulationPromise: () => Promise<void> | null;
44
+ appRootDir: string;
45
+ }
46
+ /** Always-on per-update timing + diagnostics, mutated in place across the prologue and the framework tail. */
47
+ export interface HmrUpdateMetrics {
48
+ file: string;
49
+ kind: string;
50
+ t0: number;
51
+ tAfterAwait: number;
52
+ tAfterFramework: number;
53
+ tEnd: number;
54
+ invalidated: number;
55
+ recipients: number;
56
+ narrowed: boolean | undefined;
57
+ emitted: boolean;
58
+ }
59
+ /** Per-invocation locals computed by {@link runHotUpdatePrologue} and consumed by the per-flavor tail. */
60
+ export interface HotUpdatePrologueState {
61
+ root: string;
62
+ updateRel: string;
63
+ metrics: HmrUpdateMetrics;
64
+ emitSummary: () => void;
65
+ }
66
+ /**
67
+ * Shared, framework-agnostic prologue for every strategy's `handleHotUpdate`:
68
+ * scope gating, update-metrics setup, the `ns:hmr-pending` broadcast, awaiting the
69
+ * initial graph population, the common module-graph upsert, CSS hot-update +
70
+ * Tailwind content-CSS broadcast, and the project-scope filter. Returns `null`
71
+ * when one of those steps fully handles the change (every such path resolves to
72
+ * Vite's `undefined` result, so the caller just returns), otherwise the
73
+ * per-invocation {@link HotUpdatePrologueState} (`root`, `updateRel`, the live
74
+ * `metrics` object, the idempotent `emitSummary`) the per-flavor tail consumes.
75
+ * Exported so per-flavor strategies can own `prologue + their tail`.
76
+ */
77
+ export declare function runHotUpdatePrologue(ctx: HmrContext, deps: NsHotUpdateContext): Promise<HotUpdatePrologueState | null>;