@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,5 +1,7 @@
1
- import type { ViteDevServer } from 'vite';
1
+ import type { HmrContext, ViteDevServer } from 'vite';
2
+ import type { ServerResponse } from 'node:http';
2
3
  import type { WebSocketServer } from 'ws';
4
+ import type { NsHotUpdateContext } from './websocket-hot-update.js';
3
5
  export interface FrameworkProcessFileContext {
4
6
  filePath: string;
5
7
  server: ViteDevServer;
@@ -39,29 +41,198 @@ export interface FrameworkRegistryContext {
39
41
  export interface FrameworkCleanContext {
40
42
  code: string;
41
43
  }
44
+ /**
45
+ * Inputs for {@link FrameworkServerStrategy.rewriteServedModule}, mirroring the
46
+ * arguments the `/ns/m` served-module pipeline passes to `rewriteImports` /
47
+ * `prepareAngularEntryForDevice` today (the angular/else fork in
48
+ * `websocket-ns-m.ts`).
49
+ */
50
+ export interface FrameworkServedModuleContext {
51
+ /** Resolved module specifier / URL being served (`resolvedCandidate || spec`). */
52
+ moduleId: string;
53
+ sfcFileMap: Map<string, string>;
54
+ depFileMap: Map<string, string>;
55
+ projectRoot: string;
56
+ serverOrigin: string;
57
+ verbose: boolean;
58
+ }
59
+ /**
60
+ * Inputs for {@link FrameworkServerStrategy.interceptModuleRequest}: the raw
61
+ * `/ns/m` request BEFORE spec resolution. `isLiveComponentUpdateFetch` is the
62
+ * live-broadcast gate injected from the WebSocket plugin's component-update
63
+ * ledger (Angular; undefined for other flavors).
64
+ */
65
+ export interface FrameworkModuleRequestContext {
66
+ urlObj: URL;
67
+ res: ServerResponse;
68
+ next: () => void;
69
+ isLiveComponentUpdateFetch?: (componentId: string, timestamp: number) => boolean;
70
+ }
71
+ /**
72
+ * Inputs for {@link FrameworkServerStrategy.registerRoutes}. A framework that
73
+ * owns dev-only HTTP endpoints (e.g. Vue's `/ns/sfc*`) registers them here;
74
+ * frameworks without extra endpoints leave the hook undefined (no-op default).
75
+ *
76
+ * Carries everything Vue's `registerSfcHandlers` needs (its
77
+ * `RegisterSfcHandlersOptions` shape): the dev server, plugin state
78
+ * (`sfcFileMap`/`depFileMap`/`appVirtualWithSlash`), the live graph-version
79
+ * accessor, and the active strategy. `wss` is included for parity with the
80
+ * other route registrars (the SFC handlers don't consult it today).
81
+ */
82
+ export interface FrameworkRouteContext {
83
+ server: ViteDevServer;
84
+ wss: WebSocketServer | null;
85
+ sfcFileMap: Map<string, string>;
86
+ depFileMap: Map<string, string>;
87
+ verbose: boolean;
88
+ appVirtualWithSlash: string;
89
+ getGraphVersion(): number;
90
+ getStrategy(): FrameworkServerStrategy;
91
+ }
42
92
  export interface FrameworkServerStrategy {
43
93
  readonly flavor: string;
44
94
  matchesFile(id: string): boolean;
95
+ /** Framework-specific pre-clean phase (remove virtual style imports, etc.). */
96
+ preClean?(code: string): string;
97
+ /** Rewrite framework runtime imports to vendor bundle. */
98
+ rewriteFrameworkImports?(code: string): string;
99
+ /** Framework-specific post-clean phase (strip HMR helpers, etc.). */
100
+ postClean?(code: string): string;
45
101
  /**
46
- * Framework-specific pre-clean phase (remove virtual style imports, etc.).
102
+ * Collapse framework-specific HTTP endpoint imports to their canonical
103
+ * (unversioned) URLs. Module identity is the URL; freshness is driven by
104
+ * explicit eviction, never URL variation. Versioned inbound shapes from
105
+ * stale cached device code (e.g. `/ns/sfc/<ver>/…`) are stripped here.
47
106
  */
48
- preClean(code: string): string;
107
+ canonicalizeFrameworkImports?(code: string, origin: string): string;
108
+ /** Optional vendor rewrite hook (e.g. map framework helper imports to vendor). */
109
+ rewriteVendorSpec?(code: string, origin: string, version: number): string;
49
110
  /**
50
- * Rewrite framework runtime imports to vendor bundle.
111
+ * Full per-framework `handleHotUpdate` implementation. Every flavor owns one:
112
+ * the WebSocket plugin's `handleHotUpdate` Vite hook calls it directly, and
113
+ * the implementation runs the shared {@link NsHotUpdateContext}-driven
114
+ * `runHotUpdatePrologue` followed by its own framework tail.
51
115
  */
52
- rewriteFrameworkImports(code: string): string;
116
+ handleHotUpdate?(ctx: HmrContext, deps: NsHotUpdateContext): Promise<HmrContext['modules'] | void>;
53
117
  /**
54
- * Framework-specific post-clean phase (strip HMR helpers, etc.).
118
+ * Handle a Vite custom event sent FROM the device (`import.meta.hot.send`
119
+ * arrives on the `/ns-hmr` socket as `{ type: 'custom', event, data }`).
120
+ * Frameworks use this for runtime→server recovery signals the shared
121
+ * message pump has no business interpreting. Angular implements it for
122
+ * `angular:invalidate` — Angular core sends that when an in-place
123
+ * `ɵɵreplaceMetadata` apply THROWS (see `executeWithInvalidateFallback`),
124
+ * expecting the dev server to force a full reload the way
125
+ * `@angular/build`'s Vite server does on web. Defaults to ignore.
55
126
  */
56
- postClean(code: string): string;
127
+ handleClientCustomEvent?(ctx: {
128
+ event: string;
129
+ data: unknown;
130
+ server: ViteDevServer;
131
+ }, deps: NsHotUpdateContext): Promise<void> | void;
57
132
  /**
58
- * Ensure framework-specific HTTP endpoints/imports are versioned for cache-busting.
133
+ * When `true`, the per-module graph delta is NOT broadcast inline during a
134
+ * hot update (the framework drives its own re-fetch/patch instead — Angular
135
+ * & Solid). Defaults to `false` → delta is broadcast (today's TS/Vue path).
59
136
  */
60
- ensureVersionedImports(code: string, origin: string, version: number): string;
137
+ readonly deferDeltaBroadcast?: boolean;
61
138
  /**
62
- * Optional vendor rewrite hook (e.g. map framework helper imports to vendor).
139
+ * When this returns `true` for the changed file, the shared prologue SKIPS
140
+ * its default module-graph delta upsert — the framework's own
141
+ * `handleHotUpdate` tail re-queries the graph and drives the update itself
142
+ * (Angular HTML templates: Analog's in-place swap or the NS reboot path).
143
+ * Defaults to no-skip (the prologue always upserts).
63
144
  */
64
- rewriteVendorSpec?(code: string, origin: string, version: number): string;
145
+ skipDefaultGraphUpdate?(file: string): boolean;
146
+ /**
147
+ * When `true`, the shared prologue does NOT broadcast `ns:css-updates` for a
148
+ * component-scoped style edit (a non-global `.css`) — the framework's own
149
+ * `handleHotUpdate` drives the in-place component update instead. For
150
+ * Angular with Analog `liveReload` active this is essential: Analog emits
151
+ * `angular:component-update` only while the css's `?direct` module is absent
152
+ * from the graph, and the prologue's broadcast makes the device fetch
153
+ * `…?direct=1`, which creates that module and flips Analog to its
154
+ * (NativeScript-inert) Vite css-update branch on every subsequent edit. The
155
+ * global app-entry CSS path is unaffected (it is not component-scoped).
156
+ * Defaults to `false` (every flavor keeps the component-style broadcast).
157
+ */
158
+ ownsComponentStyleHmr?(server: ViteDevServer): boolean;
159
+ /**
160
+ * Content-file edits (Tailwind scans) that change the generated `app.css`
161
+ * are normally broadcast as a standalone `ns:css-updates`. Return `true`
162
+ * when the framework's own update message must carry them instead — the
163
+ * prologue then hands them to the tail via
164
+ * {@link HotUpdatePrologueState.deferredCssUpdates} so the device
165
+ * serializes the CSS with the framework's update cycle instead of racing
166
+ * it (Angular: a TS edit reboots the root, and the CSS must land inside
167
+ * that reboot, not against a view tree mid-teardown). Defaults to `false`
168
+ * (standalone broadcast).
169
+ */
170
+ defersContentCssToFrameworkUpdate?(file: string): boolean;
171
+ /**
172
+ * Intercept a `/ns/m` request before spec resolution. Return `true` when
173
+ * the request was fully answered (or delegated downstream via `next()`),
174
+ * so the shared route stops processing it. Angular implements this for
175
+ * AnalogJS `/@ng/component` metadata fetches (see
176
+ * `frameworks/angular/server/ng-component-route.ts`). Defaults to no
177
+ * interception.
178
+ */
179
+ interceptModuleRequest?(ctx: FrameworkModuleRequestContext): boolean;
180
+ /**
181
+ * Last-chance export normalization on the final served body (after the
182
+ * CJS wrap, before URL canonicalization). Vue/Solid/TS implement the
183
+ * `routes` default-export alias so both `import { routes }` and
184
+ * `import routes` resolve against a route-config module. Defaults to
185
+ * identity.
186
+ */
187
+ normalizeServedExports?(code: string): string;
188
+ /**
189
+ * Override the `/ns/m` served-module import rewrite. Defaults to the shared
190
+ * `rewriteImports` (today's non-Angular path); Angular overrides with its
191
+ * entry-preparation pass. Returns the rewritten code.
192
+ */
193
+ rewriteServedModule?(code: string, ctx: FrameworkServedModuleContext): string;
194
+ /**
195
+ * Patch a served `node_modules` module before device delivery (e.g. Solid's
196
+ * inline `@solid-refresh` patch). Defaults to identity (code unchanged).
197
+ * `verbose` mirrors the `/ns/m` plugin's `verbose` option and gates the
198
+ * server-side diagnostics the inline patch emitted today (the device process
199
+ * sets `globalThis.__NS_ENV_VERBOSE__`, but the Node server never does).
200
+ */
201
+ transformNodeModule?(code: string, moduleId: string, verbose?: boolean): string;
202
+ /**
203
+ * Framework SFC post-processing (Vue). Defaults to identity. Mirrors the
204
+ * `processSfcCode` helper currently injected via the registry context.
205
+ */
206
+ processSfcCode?(code: string): string;
207
+ /**
208
+ * Register framework-owned dev HTTP endpoints (Vue: `/ns/sfc*`). Defaults to
209
+ * no-op for frameworks without extra routes.
210
+ */
211
+ registerRoutes?(ctx: FrameworkRouteContext): void | Promise<void>;
212
+ /**
213
+ * Extra import-map entries for this framework (e.g. Vue → `vue` /
214
+ * `nativescript-vue`; Solid → `solid-js`). Defaults to none. Replaces the
215
+ * `addFrameworkEntries` switch in `import-map.ts`.
216
+ */
217
+ importMapEntries?(origin: string): Record<string, string>;
218
+ /**
219
+ * Extra volatile URL patterns the device runtime must always re-fetch.
220
+ * Defaults to none (freshness is eviction-driven). Angular supplies
221
+ * `/@ng/component` — its per-save `t` param mints a fresh module per
222
+ * recompile, so the previous entry must be evicted on every re-import
223
+ * or the registry accumulates one stale entry per save.
224
+ */
225
+ volatilePatterns?(): string[];
226
+ /**
227
+ * Paths (substring match) whose query string IS the module identity and
228
+ * must be preserved verbatim by the runtime's canonical-key function.
229
+ * Defaults to none. Angular supplies `/@ng/component` — each
230
+ * `?c=<id>&t=<ts>` identifies a distinct metadata recompile; stripping
231
+ * `t` would collapse every HMR fetch onto the boot-time cache key and
232
+ * `ɵɵreplaceMetadata` would forever replay stale template instructions.
233
+ * Fed into `configureLoader({ canonicalization.preserveQueryFor })`.
234
+ */
235
+ preserveQueryPaths?(): string[];
65
236
  processFile(ctx: FrameworkProcessFileContext): Promise<void>;
66
237
  buildRegistry(ctx: FrameworkRegistryContext): Promise<void>;
67
238
  }
@@ -0,0 +1,37 @@
1
+ import type { WebSocket, WebSocketServer } from 'ws';
2
+ import type { FrameworkServerStrategy } from './framework-strategy.js';
3
+ export interface GraphModule {
4
+ id: string;
5
+ deps: string[];
6
+ hash: string;
7
+ }
8
+ export interface UpsertOptions {
9
+ emitDeltaOnInsert?: boolean;
10
+ broadcastDelta?: boolean;
11
+ bumpVersion?: boolean;
12
+ }
13
+ export interface HmrModuleGraphDeps {
14
+ verbose: boolean;
15
+ strategy: FrameworkServerStrategy;
16
+ getWss: () => WebSocketServer | null;
17
+ getPluginRoot: () => string | undefined;
18
+ }
19
+ export declare class HmrModuleGraph {
20
+ private readonly deps;
21
+ readonly modules: Map<string, GraphModule>;
22
+ private readonly txnBatches;
23
+ private _version;
24
+ constructor(deps: HmrModuleGraphDeps);
25
+ get version(): number;
26
+ get size(): number;
27
+ get(id: string): GraphModule | undefined;
28
+ getTxnBatch(version: number): string[];
29
+ computeHash(content: string): string;
30
+ normalizeGraphId(raw: string): string;
31
+ computeTxnOrderForChanged(changedIds: string[]): string[];
32
+ private fullGraphPayload;
33
+ emitFullGraph(ws: WebSocket): void;
34
+ emitDelta(changed: GraphModule[], removed: string[]): void;
35
+ upsert(rawId: string, code: string, deps: string[], options?: UpsertOptions): GraphModule | undefined;
36
+ remove(id: string): void;
37
+ }
@@ -0,0 +1,215 @@
1
+ import { matchesRuntimeGraphModuleId } from './runtime-graph-filter.js';
2
+ import { classifyGraphUpsert, shouldBroadcastGraphUpsertDelta, shouldBumpGraphVersion } from './websocket-graph-upsert.js';
3
+ import { getProjectAppVirtualPath } from '../../helpers/utils.js';
4
+ const APP_VIRTUAL_WITH_SLASH = `${getProjectAppVirtualPath()}/`;
5
+ // The HMR module graph: spec -> { deps, hash } plus a monotonically increasing
6
+ // version that sequences graph broadcasts and transactional HMR batches.
7
+ // Owns delta/full-graph broadcasts to connected clients and the per-version
8
+ // txn batch ordering. The version never appears in served module URLs —
9
+ // module identity is the canonical URL (see CLAUDE.md invariant 4).
10
+ //
11
+ // version starts at 1 and stays stable during cold boot (bulk warm-ups pass
12
+ // bumpVersion:false); it only advances on live edits, so the graph filling in
13
+ // lazily never churns the version.
14
+ export class HmrModuleGraph {
15
+ constructor(deps) {
16
+ this.deps = deps;
17
+ this.modules = new Map();
18
+ // Transactional HMR batches: version -> ordered list of changed ids for that version.
19
+ this.txnBatches = new Map();
20
+ this._version = 1;
21
+ }
22
+ get version() {
23
+ return this._version;
24
+ }
25
+ get size() {
26
+ return this.modules.size;
27
+ }
28
+ get(id) {
29
+ return this.modules.get(id);
30
+ }
31
+ getTxnBatch(version) {
32
+ return this.txnBatches.get(version) || [];
33
+ }
34
+ computeHash(content) {
35
+ let h = 0;
36
+ for (let i = 0; i < content.length; i++) {
37
+ h = (h * 31 + content.charCodeAt(i)) | 0;
38
+ }
39
+ return ('00000000' + (h >>> 0).toString(16)).slice(-8);
40
+ }
41
+ normalizeGraphId(raw) {
42
+ if (!raw)
43
+ return raw;
44
+ let id = raw.split('?')[0].replace(/\\/g, '/');
45
+ id = id.replace(/^file:\/\//, '');
46
+ const pluginRoot = this.deps.getPluginRoot();
47
+ if (pluginRoot) {
48
+ const rootNorm = pluginRoot.replace(/\\/g, '/');
49
+ if (id.startsWith(rootNorm)) {
50
+ id = id.slice(rootNorm.length);
51
+ }
52
+ }
53
+ if (!id.startsWith('/'))
54
+ id = '/' + id;
55
+ // Collapse nested app root indicators when present (defensive)
56
+ const idx = id.indexOf(APP_VIRTUAL_WITH_SLASH);
57
+ if (idx !== -1)
58
+ id = id.slice(idx);
59
+ return id;
60
+ }
61
+ // Dependency-closed, topologically sorted list of modules for a set of
62
+ // changed ids. Only includes application modules we can serve (under the
63
+ // app virtual root and known framework/.ts/.js entries already in the graph).
64
+ computeTxnOrderForChanged(changedIds) {
65
+ const { strategy } = this.deps;
66
+ const includeAppModule = (id) => matchesRuntimeGraphModuleId(id, APP_VIRTUAL_WITH_SLASH, /\.(ts|js|mjs|tsx|jsx)$/i);
67
+ const includeExt = (id) => strategy.matchesFile(id) || includeAppModule(id);
68
+ const isApp = (id) => id.startsWith(APP_VIRTUAL_WITH_SLASH);
69
+ const roots = changedIds.map((id) => this.normalizeGraphId(id)).filter((id) => this.modules.has(id) && (isApp(id) || strategy.matchesFile(id)) && includeExt(id));
70
+ const toVisit = new Set();
71
+ const stack = [...roots];
72
+ while (stack.length) {
73
+ const id = stack.pop();
74
+ if (toVisit.has(id))
75
+ continue;
76
+ toVisit.add(id);
77
+ const m = this.modules.get(id);
78
+ if (m) {
79
+ for (const d of m.deps) {
80
+ if (!this.modules.has(d))
81
+ continue;
82
+ if ((isApp(d) || strategy.matchesFile(d)) && includeExt(d) && !toVisit.has(d)) {
83
+ stack.push(d);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ // Topological order: deps first (post-order DFS)
89
+ const ordered = [];
90
+ const temp = new Set();
91
+ const perm = new Set();
92
+ const visit = (id) => {
93
+ if (perm.has(id))
94
+ return;
95
+ if (temp.has(id)) {
96
+ perm.add(id);
97
+ return;
98
+ } // cycle: bail out
99
+ temp.add(id);
100
+ const m = this.modules.get(id);
101
+ if (m) {
102
+ for (const d of m.deps) {
103
+ if (toVisit.has(d))
104
+ visit(d);
105
+ }
106
+ }
107
+ temp.delete(id);
108
+ perm.add(id);
109
+ ordered.push(id);
110
+ };
111
+ for (const id of toVisit)
112
+ visit(id);
113
+ return ordered;
114
+ }
115
+ fullGraphPayload() {
116
+ return {
117
+ type: 'ns:hmr-full-graph',
118
+ version: this._version,
119
+ modules: Array.from(this.modules.values()).map((m) => ({
120
+ id: m.id,
121
+ deps: m.deps,
122
+ hash: m.hash,
123
+ })),
124
+ };
125
+ }
126
+ emitFullGraph(ws) {
127
+ try {
128
+ if (this.deps.verbose) {
129
+ try {
130
+ const payload = this.fullGraphPayload();
131
+ console.log('[hmr-ws][graph] emitFullGraph version', payload.version, 'modules=', payload.modules.length);
132
+ if (payload.modules.length) {
133
+ console.log('[hmr-ws][graph] sample module ids', payload.modules.slice(0, 5).map((m) => m.id));
134
+ }
135
+ }
136
+ catch { }
137
+ }
138
+ ws.send(JSON.stringify(this.fullGraphPayload()));
139
+ }
140
+ catch { }
141
+ }
142
+ emitDelta(changed, removed) {
143
+ const wss = this.deps.getWss();
144
+ if (!wss)
145
+ return;
146
+ // Record this version's txn batch order
147
+ try {
148
+ const changedIds = changed.map((m) => m.id);
149
+ if (changedIds.length) {
150
+ const ordered = this.computeTxnOrderForChanged(changedIds);
151
+ this.txnBatches.set(this._version, ordered);
152
+ // Keep only the last ~20 versions
153
+ if (this.txnBatches.size > 20) {
154
+ const drop = Array.from(this.txnBatches.keys())
155
+ .sort((a, b) => a - b)
156
+ .slice(0, this.txnBatches.size - 20);
157
+ for (const k of drop)
158
+ this.txnBatches.delete(k);
159
+ }
160
+ }
161
+ }
162
+ catch { }
163
+ const payload = {
164
+ type: 'ns:hmr-delta',
165
+ baseVersion: this._version - 1,
166
+ newVersion: this._version,
167
+ changed: changed.map((m) => ({ id: m.id, deps: m.deps, hash: m.hash })),
168
+ removed,
169
+ };
170
+ const json = JSON.stringify(payload);
171
+ wss.clients.forEach((c) => {
172
+ try {
173
+ c.send(json);
174
+ }
175
+ catch { }
176
+ });
177
+ }
178
+ upsert(rawId, code, deps, options) {
179
+ const id = this.normalizeGraphId(rawId);
180
+ const normDeps = deps
181
+ .map((d) => this.normalizeGraphId(d))
182
+ .filter(Boolean)
183
+ .slice()
184
+ .sort();
185
+ const hash = this.computeHash(code);
186
+ const existing = this.modules.get(id);
187
+ const classification = classifyGraphUpsert(existing, hash, normDeps);
188
+ if (classification === 'unchanged')
189
+ return existing;
190
+ // Version bumps are only meaningful for live edits — serve-time graph
191
+ // warm-ups and the initial bulk walk should leave the version stable.
192
+ const bumpVersion = shouldBumpGraphVersion(classification, options?.bumpVersion !== false);
193
+ if (bumpVersion) {
194
+ this._version++;
195
+ }
196
+ const gm = { id, deps: normDeps, hash };
197
+ this.modules.set(id, gm);
198
+ if (this.deps.verbose) {
199
+ console.log('[hmr-ws][graph] upsert', { id, deps: normDeps, hash, graphVersion: this._version, classification, bumpVersion });
200
+ console.log('[hmr-ws][graph] size', this.modules.size);
201
+ }
202
+ if (shouldBroadcastGraphUpsertDelta(classification, options?.emitDeltaOnInsert === true, options?.broadcastDelta !== false)) {
203
+ this.emitDelta([gm], []);
204
+ }
205
+ return gm;
206
+ }
207
+ remove(id) {
208
+ if (!this.modules.has(id))
209
+ return;
210
+ this.modules.delete(id);
211
+ this._version++;
212
+ this.emitDelta([], [id]);
213
+ }
214
+ }
215
+ //# sourceMappingURL=hmr-module-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmr-module-graph.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/hmr-module-graph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3H,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,sBAAsB,GAAG,GAAG,wBAAwB,EAAE,GAAG,CAAC;AAwBhE,+EAA+E;AAC/E,yEAAyE;AACzE,4EAA4E;AAC5E,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,mCAAmC;AACnC,MAAM,OAAO,cAAc;IAM1B,YAA6B,IAAwB;QAAxB,SAAI,GAAJ,IAAI,CAAoB;QAL5C,YAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;QAClD,sFAAsF;QACrE,eAAU,GAAG,IAAI,GAAG,EAAoB,CAAC;QAClD,aAAQ,GAAG,CAAC,CAAC;IAEmC,CAAC;IAEzD,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,GAAG,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IAED,WAAW,CAAC,OAAe;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,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,CAAC,CAAC,CAAC;IAC1B,CAAC;CACD"}
@@ -2,47 +2,58 @@
2
2
  * Import Map Generator for NativeScript HMR
3
3
  *
4
4
  * Generates an import map that the iOS/Android runtime consumes via
5
- * __nsConfigureRuntime(). This is the single source of truth for module
5
+ * ns:module configureLoader(). This is the single source of truth for module
6
6
  * resolution on the device.
7
7
  *
8
8
  * Resolution strategy:
9
- * Vendor modules (direct project deps bundled by esbuild) → ns-vendor://
10
- * Only EXACT specifier entries — no trailing-slash prefixes.
11
- * Subpaths of vendor packages (e.g., solid-js/store) are NOT vendor-
12
- * resolved; they fall through to HTTP trailing-slash prefixes below.
9
+ * Every bare npm specifier → HTTP URL (`/ns/m/node_modules/<pkg>`).
10
+ * Package roots in the vendor collection get EXACT entries whose served
11
+ * body is a deps-bundle shim (see deps-bundle.ts), so "many specifiers,
12
+ * one instance" holds via the single bundle realm — no custom URL scheme.
13
13
  * @nativescript/core → HTTP bridge URL (/ns/core)
14
- * All other npm packages (transitive deps, etc.) → HTTP URL (/ns/m/)
15
- * Both exact AND trailing-slash prefix entries, so subpath imports
16
- * like @nativescript/tanstack-router/solid resolve correctly via HTTP.
14
+ * Trailing-slash prefix entries cover subpath imports
15
+ * (e.g. @nativescript/tanstack-router/solid) for every package.
17
16
  *
18
- * The runtime's NormalizeViteSpecifier() extracts bare package names from
19
- * Vite-rewritten paths (e.g. /node_modules/.vite/deps/solid-js.js → solid-js),
20
- * then looks them up in this map. This ensures ALL imports — regardless of
21
- * how Vite rewrites them — resolve through a single deterministic path.
17
+ * The runtime matches map keys literally: it reverse-engineers none of Vite's
18
+ * rewrites (`/node_modules/.vite/deps/solid-js.js?v=…`, `/@id/…`, `/@fs/…`).
19
+ * Every specifier form that reaches the device must therefore either be a key
20
+ * in this map or be rewritten by the server before it is served — the /ns/m
21
+ * pipeline (`processCodeForDevice`) turns prebundled-dep paths back into bare
22
+ * ids and resolves package-internal paths to full `/ns/m/node_modules/…` URLs.
22
23
  */
24
+ import type { FrameworkServerStrategy } from './framework-strategy.js';
23
25
  export interface ImportMap {
24
26
  imports: Record<string, string>;
25
27
  }
26
28
  export interface ImportMapOptions {
27
29
  /** Origin of the Vite dev server (e.g. "http://192.168.1.5:5173") */
28
30
  origin: string;
29
- /** Framework flavor (vue, angular, solid, typescript) */
31
+ /** Framework flavor (vue, angular, solid, typescript) — framework identity. */
30
32
  flavor: string;
33
+ /**
34
+ * Active framework strategy. Its `importMapEntries(origin)` +
35
+ * `volatilePatterns()` hooks supply the framework-specific pieces of the
36
+ * import map and volatile-pattern list.
37
+ * Optional: when omitted, the map/patterns carry only the shared
38
+ * vendor/core/HTTP entries.
39
+ */
40
+ strategy?: FrameworkServerStrategy;
31
41
  /** Additional entries to add to the import map */
32
42
  extraEntries?: Record<string, string>;
33
43
  }
34
44
  /**
35
45
  * Generate an import map from the current vendor manifest.
36
46
  *
37
- * Vendor modules are mapped to ns-vendor:// protocol URLs, which the
38
- * native runtime resolves from the in-memory vendor registry (populated
39
- * by vendor-bootstrap.ts).
47
+ * Vendor package roots map to `${origin}/ns/m/node_modules/<pkg>` — served
48
+ * as deps-bundle shims (thin re-exports out of `__NS_DEPS_MODULES__`, the
49
+ * single-evaluation bundle realm), so every specifier of a package resolves
50
+ * to one instance. Manifest aliases collapse onto their canonical package's
51
+ * URL, preserving the "many specifiers, one instance" semantics.
40
52
  *
41
53
  * IMPORTANT: Vendor entries are EXACT only (no trailing-slash prefixes).
42
- * The vendor bundle contains only root entry points. Subpath imports like
43
- * solid-js/store or @nativescript/tanstack-router/solid are separate entry
44
- * points with different exports — they must NOT resolve to the root vendor
45
- * module. Instead, they fall through to the HTTP trailing-slash prefix
54
+ * Subpath imports like solid-js/store or @nativescript/tanstack-router/solid
55
+ * are separate entry points with different exports — they must NOT resolve
56
+ * to the package root. They fall through to the HTTP trailing-slash prefix
46
57
  * entries from discoverInstalledPackages().
47
58
  *
48
59
  * @nativescript/core is mapped to the HTTP bridge endpoint.
@@ -54,12 +65,35 @@ export declare function generateImportMap(options: ImportMapOptions): ImportMap;
54
65
  * These patterns tell the runtime to always re-fetch matching URLs
55
66
  * instead of using cached modules.
56
67
  */
57
- export declare function getVolatilePatterns(flavor: string): string[];
68
+ export declare function getVolatilePatterns(strategy?: FrameworkServerStrategy): string[];
58
69
  /**
59
- * Serialize the import map + volatile patterns into the config object
60
- * that __nsConfigureRuntime() expects.
70
+ * The URL canonicalization vocabulary handed to the runtime via
71
+ * `configureLoader({ canonicalization })`. The runtime owns the *mechanism*
72
+ * (fragment strip, cache-buster param drop, param sort — it keys the module
73
+ * registry inside the engine's synchronous resolve walk); this server owns
74
+ * the *vocabulary*, because every name in it is a route this server defines:
75
+ *
76
+ * - `stripParams`: Vite's `import` marker and `t`/`v` cache stamps — pure
77
+ * cache busters that must not create distinct module identities.
78
+ * - `forPathPrefixes`: the dev endpoints under which query normalization is
79
+ * safe. Everything else (public/remote URLs) keeps its query verbatim,
80
+ * since for general HTTP modules the query can be identity (auth,
81
+ * content versioning, routing).
82
+ * - `preserveQueryFor`: strategy-owned paths whose query IS the module
83
+ * identity (e.g. Angular's `/@ng/component?c=<id>&t=<ts>` — each `t` is a
84
+ * distinct metadata recompile).
85
+ */
86
+ export declare function getCanonicalization(strategy?: FrameworkServerStrategy): {
87
+ stripParams: string[];
88
+ forPathPrefixes: string[];
89
+ preserveQueryFor: string[];
90
+ };
91
+ /**
92
+ * Serialize the import map + volatile patterns + canonicalization vocabulary
93
+ * into the config object that ns:module configureLoader() expects.
61
94
  */
62
95
  export declare function buildRuntimeConfig(options: ImportMapOptions): {
63
96
  importMap: string;
64
97
  volatilePatterns: string[];
98
+ canonicalization: ReturnType<typeof getCanonicalization>;
65
99
  };