@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
@@ -0,0 +1,214 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { resolvePlatform } from '../../helpers/cli-flags.js';
4
+ import { getProjectFlavor } from '../../helpers/flavor.js';
5
+ // Cold-boot request recording.
6
+ //
7
+ // A real cold boot fetches hundreds of `/ns/m/node_modules/...` bodies (deep
8
+ // ESM packages like rxjs) that no static analysis can enumerate up front.
9
+ // This recorder captures the EXACT prefetchable URL set served during a boot
10
+ // window; the deps-bundle service (`resolveDepsEntriesFromRecording`) folds
11
+ // those recorded deep files into the single-eval `/ns/deps-bundle.mjs`, so
12
+ // the NEXT boot serves them as one payload instead of per-module fetches.
13
+ //
14
+ // Lifecycle: a recording session opens when the device fetches the session
15
+ // descriptor (`/__ns_dev__/session` — requested exactly once per boot by the
16
+ // session bootstrap), collects every successfully-served prefetchable
17
+ // request, and closes after an idle window. Closed sessions replace the
18
+ // previous recording and persist to
19
+ // `node_modules/.ns-vite/boot-closure-<platform>-<flavor>.json` so a fresh
20
+ // dev-server start benefits too.
21
+ //
22
+ // Self-healing: only 2xx responses are recorded, so deleted modules (404s)
23
+ // drop out on the next boot. Stale-but-servable entries are harmless — the
24
+ // deps bundle simply carries an unused entry until the next recording.
25
+ export const BOOT_RECORDING_VERSION = 1;
26
+ /** Endpoints whose request marks the start of a device boot. */
27
+ export const BOOT_SIGNAL_PATHS = new Set(['/__ns_dev__/session']);
28
+ // Non-JS resource types can never become deps-bundle entries, so recording
29
+ // them would only bloat the closure.
30
+ const NON_JS_EXT_RE = /\.(css|scss|sass|less|json|html|htm|png|jpe?g|gif|svg|webp|ico|woff2?|ttf|otf|eot|mp3|mp4|webm|wav|map)$/i;
31
+ // Volatile cache-buster query param (`?t=169…` / `&t=169…`). URLs carrying it
32
+ // are freshly minted per request (Vite HMR timestamps, the Angular
33
+ // `@ng/component?c=…&t=…` refresh route), so a recorded copy can never match
34
+ // a future boot's request — recording them only grows the closure by one dead
35
+ // variant per boot.
36
+ const VOLATILE_T_PARAM_RE = /[?&]t=\d+(?:&|$)/;
37
+ /**
38
+ * True when a request path is served through the device module loader and is
39
+ * therefore worth recording for the next boot's deps bundle. Matches the URL
40
+ * spaces the HTTP ESM loader fetches: `/ns/m/**`, the `/ns/rt` + `/ns/core`
41
+ * bridges, the core and deps bundles, Vue SFC artifacts, the served vendor
42
+ * bundle, and the dev client bootstrap.
43
+ */
44
+ export function isPrefetchableBootPath(pathWithSearch) {
45
+ if (!pathWithSearch || !pathWithSearch.startsWith('/'))
46
+ return false;
47
+ if (VOLATILE_T_PARAM_RE.test(pathWithSearch))
48
+ return false;
49
+ const pathname = pathWithSearch.split('?')[0];
50
+ if (NON_JS_EXT_RE.test(pathname))
51
+ return false;
52
+ if (pathname === '/ns/import-map.json')
53
+ return false;
54
+ if (pathname.startsWith('/ns/m/'))
55
+ return true;
56
+ if (pathname === '/ns/rt' || pathname.startsWith('/ns/rt/'))
57
+ return true;
58
+ if (pathname === '/ns/core' || pathname.startsWith('/ns/core/'))
59
+ return true;
60
+ if (pathname === '/ns/core-bundle.mjs')
61
+ return true;
62
+ if (pathname === '/ns/deps-bundle.mjs')
63
+ return true;
64
+ if (pathname.startsWith('/ns/sfc/') || pathname.startsWith('/ns/asm/'))
65
+ return true;
66
+ if (pathname === '/@nativescript/vendor.mjs')
67
+ return true;
68
+ if (pathname === '/__ns_dev__/client')
69
+ return true;
70
+ return false;
71
+ }
72
+ export function getBootRecordingFilePath(projectRoot, platform, flavor) {
73
+ return path.join(projectRoot, 'node_modules', '.ns-vite', `boot-closure-${platform}-${flavor}.json`);
74
+ }
75
+ /** Load a persisted recording; null when absent, invalid, or mismatched. */
76
+ export function loadPersistedBootRecording(projectRoot, platform, flavor) {
77
+ try {
78
+ const file = getBootRecordingFilePath(projectRoot, platform, flavor);
79
+ if (!existsSync(file))
80
+ return null;
81
+ const parsed = JSON.parse(readFileSync(file, 'utf-8'));
82
+ if (!parsed || parsed.version !== BOOT_RECORDING_VERSION)
83
+ return null;
84
+ if (parsed.platform !== platform || parsed.flavor !== flavor)
85
+ return null;
86
+ // Re-apply the prefetchability filter on load so recordings written by
87
+ // an older filter (or hand-edited files) shed dead entries.
88
+ const paths = Array.isArray(parsed.paths) ? parsed.paths.filter((p) => typeof p === 'string' && isPrefetchableBootPath(p)) : [];
89
+ return paths.length ? paths : null;
90
+ }
91
+ catch {
92
+ return null;
93
+ }
94
+ }
95
+ export function createBootRecorder(options) {
96
+ const idleWindowMs = Math.max(500, Math.floor(options.idleWindowMs ?? 5000));
97
+ const minEntries = Math.max(1, Math.floor(options.minEntries ?? 5));
98
+ const maxEntries = Math.max(minEntries, Math.floor(options.maxEntries ?? 5000));
99
+ const persist = options.persist !== false;
100
+ const now = options.now ?? (() => Date.now());
101
+ const setTimer = options.setTimer ?? ((handler, ms) => setTimeout(handler, ms));
102
+ const clearTimer = options.clearTimer ?? ((handle) => clearTimeout(handle));
103
+ const log = options.log ?? (() => { });
104
+ let best = persist ? loadPersistedBootRecording(options.projectRoot, options.platform, options.flavor) : null;
105
+ let session = null;
106
+ let idleTimer = null;
107
+ const persistBest = () => {
108
+ if (!persist || !best)
109
+ return;
110
+ try {
111
+ const file = getBootRecordingFilePath(options.projectRoot, options.platform, options.flavor);
112
+ mkdirSync(path.dirname(file), { recursive: true });
113
+ writeFileSync(file, JSON.stringify({
114
+ version: BOOT_RECORDING_VERSION,
115
+ platform: options.platform,
116
+ flavor: options.flavor,
117
+ recordedAt: now(),
118
+ paths: best,
119
+ }));
120
+ }
121
+ catch (error) {
122
+ log(`[hmr-ws][boot-record] persist failed: ${error?.message || error}`);
123
+ }
124
+ };
125
+ const closeSession = () => {
126
+ if (idleTimer !== null) {
127
+ clearTimer(idleTimer);
128
+ idleTimer = null;
129
+ }
130
+ if (!session)
131
+ return;
132
+ const finished = session;
133
+ session = null;
134
+ if (finished.order.length < minEntries) {
135
+ log(`[hmr-ws][boot-record] discarded window with ${finished.order.length} entries (< ${minEntries})`);
136
+ return;
137
+ }
138
+ best = finished.order.slice(0, maxEntries);
139
+ persistBest();
140
+ log(`[hmr-ws][boot-record] captured ${best.length} boot urls in ${Math.max(0, now() - finished.startedAt)}ms`);
141
+ };
142
+ const armIdle = () => {
143
+ if (idleTimer !== null)
144
+ clearTimer(idleTimer);
145
+ idleTimer = setTimer(() => {
146
+ idleTimer = null;
147
+ closeSession();
148
+ }, idleWindowMs);
149
+ };
150
+ const openSession = () => {
151
+ closeSession();
152
+ session = { order: [], seen: new Set(), startedAt: now() };
153
+ armIdle();
154
+ };
155
+ const record = (pathWithSearch) => {
156
+ if (!session || session.order.length >= maxEntries)
157
+ return;
158
+ if (session.seen.has(pathWithSearch))
159
+ return;
160
+ session.seen.add(pathWithSearch);
161
+ session.order.push(pathWithSearch);
162
+ };
163
+ return {
164
+ noteRequest(pathWithSearch) {
165
+ const pathname = pathWithSearch.split('?')[0];
166
+ if (BOOT_SIGNAL_PATHS.has(pathname)) {
167
+ openSession();
168
+ return null;
169
+ }
170
+ if (!session)
171
+ return null;
172
+ if (!isPrefetchableBootPath(pathWithSearch))
173
+ return null;
174
+ armIdle();
175
+ let done = false;
176
+ return (statusCode) => {
177
+ if (done)
178
+ return;
179
+ done = true;
180
+ if (!session)
181
+ return;
182
+ if (!(statusCode >= 200 && statusCode < 300))
183
+ return;
184
+ record(pathWithSearch);
185
+ armIdle();
186
+ };
187
+ },
188
+ getRecordedPaths() {
189
+ return best ? best.slice() : null;
190
+ },
191
+ closeActiveSession() {
192
+ closeSession();
193
+ },
194
+ };
195
+ }
196
+ /**
197
+ * Standard dev-server construction: resolves platform/flavor from the
198
+ * project, honors `NS_VITE_HMR_DISABLE_BOOT_RECORDING` (returns null) and
199
+ * `NS_VITE_HMR_BOOT_RECORD_IDLE_MS`.
200
+ */
201
+ export function createBootRecorderFromEnv(projectRoot, log) {
202
+ const disabled = process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === '1' || process.env.NS_VITE_HMR_DISABLE_BOOT_RECORDING === 'true';
203
+ if (disabled)
204
+ return null;
205
+ const configuredIdleMs = Number.parseInt(process.env.NS_VITE_HMR_BOOT_RECORD_IDLE_MS || '', 10);
206
+ return createBootRecorder({
207
+ platform: resolvePlatform() || 'ios',
208
+ flavor: getProjectFlavor(),
209
+ projectRoot,
210
+ idleWindowMs: Number.isFinite(configuredIdleMs) && configuredIdleMs > 0 ? configuredIdleMs : undefined,
211
+ log,
212
+ });
213
+ }
214
+ //# sourceMappingURL=boot-recording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot-recording.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/boot-recording.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,+BAA+B;AAC/B,EAAE;AACF,6EAA6E;AAC7E,0EAA0E;AAC1E,6EAA6E;AAC7E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,sEAAsE;AACtE,wEAAwE;AACxE,oCAAoC;AACpC,2EAA2E;AAC3E,iCAAiC;AACjC,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,uEAAuE;AAEvE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;AAEvF,2EAA2E;AAC3E,qCAAqC;AACrC,MAAM,aAAa,GAAG,2GAA2G,CAAC;AAElI,8EAA8E;AAC9E,mEAAmE;AACnE,6EAA6E;AAC7E,8EAA8E;AAC9E,oBAAoB;AACpB,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,cAAsB;IAC5D,IAAI,CAAC,cAAc,IAA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T = /((?:^|\n)\s*import\s+[^'";]*?\s+from\s+["'])([^"']+\.vue(?:\?[^"']*)?)(["'];?)/g;
26
26
  // Vite/HMR noise cleanup
27
- export const VITE_CLIENT_IMPORT = /(?:^|\n)\s*import\s+['"](?:\/@vite\/client|@vite\/client)['"];?/g;
27
+ // Matches BOTH the side-effect form (`import "/@vite/client";`) and the named
28
+ // form Vite 8 emits (`import { injectQuery as __vite__injectQuery } from "/@vite/client";`).
29
+ // NOT line-anchored: Vite 8 concatenates injected imports onto the module's
30
+ // original first line, so an anchored pattern either misses or over-deletes.
31
+ // Group 1 (the preceding `^`/newline/`;` boundary) MUST be preserved by
32
+ // replacements (`replace(..., '$1')`) so the prior statement keeps its terminator.
33
+ export const VITE_CLIENT_IMPORT = /(^|[\n;])\s*import\s+(?:[\w$]+\s*,\s*)?(?:\{[^}]*\}\s+from\s+|[\w$]+\s+from\s+|\*\s+as\s+[\w$]+\s+from\s+)?['"](?:\/@vite\/client|@vite\/client)['"];?/g;
28
34
  // Strip Vite's injected `import.meta.hot = __vite__createHotContext(...)` assignment.
29
35
  // Important: it may appear mid-line after other tokens/spaces in sanitized HTTP output,
30
36
  // so we cannot rely on it starting at BOL.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/constants.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,qGAAqG;AAErG,uBAAuB;AACvB,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AAErC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,sCAAsC,GAAG,0CAA0C,CAAC;AAEjG,8CAA8C;AAC9C,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,wEAAwE;AACxE,8BAA8B;AAC9B,kDAAkD;AAClD,qBAAqB;AACrB,8CAA8C;AAC9C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,+DAA+D,CAAC;AAChG,MAAM,CAAC,MAAM,gBAAgB,GA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AAG,gBAAgB,CAAC;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG,uCAAuC,CAAC;AACxE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,6CAA6C,CAAC;AAExF,wBAAwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,iFAAiF,CAAC;AAEjH,yBAAyB;AACzB,8EAA8E;AAC9E,6FAA6F;AAC7F,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,mFAAmF;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,yJAAyJ,CAAC;AAC5L,sFAAsF;AACtF,wFAAwF;AACxF,2CAA2C;AAC3C,MAAM,CAAC,MAAM,0BAA0B,GAAG,sCAAsC,CAAC;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAG,+DAA+D,CAAC;AAErG,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,kEAAkE,CAAC;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAAG,sEAAsE,CAAC;AAC5G,MAAM,CAAC,MAAM,qBAAqB,GAAG,+CAA+C,CAAC"}
@@ -0,0 +1,54 @@
1
+ import type { ViteDevServer } from 'vite';
2
+ import type { WebSocketServer } from 'ws';
3
+ import type { CssUpdateItem } from '../shared/protocol.js';
4
+ export interface ContentCssUpdateOptions {
5
+ server: ViteDevServer;
6
+ file: string;
7
+ root: string;
8
+ wss: WebSocketServer;
9
+ isSocketClientOpen: (client: {
10
+ readyState?: number;
11
+ OPEN?: number;
12
+ } | null | undefined) => boolean;
13
+ /**
14
+ * The active framework strategy's `defersContentCssToFrameworkUpdate`
15
+ * verdict for this file: `true` routes the update into the framework's own
16
+ * message (returned as `deferredCssUpdates`) instead of broadcasting.
17
+ */
18
+ deferToFrameworkUpdate: boolean;
19
+ verbose: boolean;
20
+ }
21
+ export interface ContentCssUpdateResult {
22
+ /** Present when the framework tail must carry the CSS update in its own message. */
23
+ deferredCssUpdates?: CssUpdateItem[];
24
+ /** Open sockets the standalone `ns:css-updates` broadcast reached. */
25
+ recipients: number;
26
+ }
27
+ /**
28
+ * Tailwind / content-scanning CSS routing for non-CSS edits.
29
+ *
30
+ * Background: when a `.html` template or `.ts` file scanned by Tailwind's
31
+ * `content` config gains a brand-new utility class (e.g. a `pt-6` never used
32
+ * before), the booted CSS bundle has no rule for it — the template HMR swaps
33
+ * the markup, the class lookup misses, and the layout regresses.
34
+ *
35
+ * In a stock Vite setup the `vite:css` plugin registers each PostCSS content
36
+ * dependency as an importer of the CSS module, so a content edit invalidates
37
+ * the CSS through the moduleGraph. NS HMR breaks that chain: `app.css` loads
38
+ * through `virtual:ns-app-css` whose `load` hook calls `preprocessCSS(...)`
39
+ * and emits a JS module — the CSS is never a moduleGraph node, so the importer
40
+ * chain never forms. `mainEntryPlugin` bridges the gap by tracking the
41
+ * `preprocessCSS` dep set on the server (see `AppCssState`).
42
+ *
43
+ * When the changed file is in that set, regenerate the stylesheet and compare
44
+ * with the previous output. Ordinary content edits are skipped; output that
45
+ * actually changed is either broadcast as `ns:css-updates` or — when the
46
+ * framework's own update message must carry it (Angular TS reboots, via the
47
+ * `defersContentCssToFrameworkUpdate` strategy hook) — returned as
48
+ * `deferredCssUpdates` so the device serializes CSS with the framework's
49
+ * update cycle instead of racing view-tree teardown.
50
+ *
51
+ * Never throws: refresh is non-throwing by contract and the broadcast guards
52
+ * each send.
53
+ */
54
+ export declare function processContentCssUpdate(opts: ContentCssUpdateOptions): Promise<ContentCssUpdateResult>;
@@ -0,0 +1,78 @@
1
+ import * as path from 'path';
2
+ import { getAppCssState } from '../../helpers/app-css-state.js';
3
+ import { appCssRootRelPath, buildCssUpdateItem, buildCssUpdatesMessage } from './css-update-message.js';
4
+ /**
5
+ * Tailwind / content-scanning CSS routing for non-CSS edits.
6
+ *
7
+ * Background: when a `.html` template or `.ts` file scanned by Tailwind's
8
+ * `content` config gains a brand-new utility class (e.g. a `pt-6` never used
9
+ * before), the booted CSS bundle has no rule for it — the template HMR swaps
10
+ * the markup, the class lookup misses, and the layout regresses.
11
+ *
12
+ * In a stock Vite setup the `vite:css` plugin registers each PostCSS content
13
+ * dependency as an importer of the CSS module, so a content edit invalidates
14
+ * the CSS through the moduleGraph. NS HMR breaks that chain: `app.css` loads
15
+ * through `virtual:ns-app-css` whose `load` hook calls `preprocessCSS(...)`
16
+ * and emits a JS module — the CSS is never a moduleGraph node, so the importer
17
+ * chain never forms. `mainEntryPlugin` bridges the gap by tracking the
18
+ * `preprocessCSS` dep set on the server (see `AppCssState`).
19
+ *
20
+ * When the changed file is in that set, regenerate the stylesheet and compare
21
+ * with the previous output. Ordinary content edits are skipped; output that
22
+ * actually changed is either broadcast as `ns:css-updates` or — when the
23
+ * framework's own update message must carry it (Angular TS reboots, via the
24
+ * `defersContentCssToFrameworkUpdate` strategy hook) — returned as
25
+ * `deferredCssUpdates` so the device serializes CSS with the framework's
26
+ * update cycle instead of racing view-tree teardown.
27
+ *
28
+ * Never throws: refresh is non-throwing by contract and the broadcast guards
29
+ * each send.
30
+ */
31
+ export async function processContentCssUpdate(opts) {
32
+ const { server, file, root, wss, isSocketClientOpen, deferToFrameworkUpdate, verbose } = opts;
33
+ const none = { recipients: 0 };
34
+ const appCssState = getAppCssState(server);
35
+ if (!appCssState?.deps || !appCssState.path) {
36
+ return none;
37
+ }
38
+ const normalizedFile = path.resolve(file).replace(/\\/g, '/');
39
+ if (!appCssState.deps.has(normalizedFile)) {
40
+ return none;
41
+ }
42
+ const { changed } = await appCssState.refresh();
43
+ if (!changed) {
44
+ if (verbose)
45
+ console.info(`[ns-hmr][server] Tailwind/PostCSS output unchanged after ${path.basename(file)}; skipped app.css refresh`);
46
+ return none;
47
+ }
48
+ const appCssRel = appCssRootRelPath(root, appCssState.path);
49
+ if (!appCssRel) {
50
+ return none;
51
+ }
52
+ const update = buildCssUpdateItem(appCssRel);
53
+ if (deferToFrameworkUpdate) {
54
+ if (verbose)
55
+ console.info(`[ns-hmr][server] Tailwind/PostCSS output changed after ${path.basename(file)}; deferred ${appCssRel} to framework update`);
56
+ return { deferredCssUpdates: [update], recipients: 0 };
57
+ }
58
+ let recipients = 0;
59
+ try {
60
+ const payload = JSON.stringify(buildCssUpdatesMessage(server, [update]));
61
+ wss.clients.forEach((client) => {
62
+ if (isSocketClientOpen(client)) {
63
+ try {
64
+ client.send(payload);
65
+ recipients += 1;
66
+ }
67
+ catch { }
68
+ }
69
+ });
70
+ if (verbose)
71
+ console.info(`[ns-hmr][server] Tailwind/PostCSS content-file edit (${path.basename(file)}) broadcast ${appCssRel}`);
72
+ }
73
+ catch (error) {
74
+ console.warn('[hmr-ws] CSS content-source broadcast failed:', error);
75
+ }
76
+ return { recipients };
77
+ }
78
+ //# sourceMappingURL=content-css-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content-css-update.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/content-css-update.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAyBxG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,IAA6B;IAC1E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC9F,MAAM,IAAI,GAA2B,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;IAEvD,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7C,OAAO,IAA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C,EAAE,CAAC;gBAChC,IAAI,CAAC;oBACJ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;oBACrB,UAAU,IAAI,CAAC,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC,CAAA,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;QACH,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,wDAAwD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC;IAClI,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,IAAI,CAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Single-eval @nativescript/core bundle for device serving (bundle mode).
3
+ *
4
+ * DEFAULT MODE (consumers)
5
+ * ------------------------
6
+ * Instead of serving @nativescript/core per-module through Vite's transform
7
+ * pipeline (~hundreds of serial HTTP fetches + per-file transforms during cold
8
+ * boot), the dev server pre-bundles the ENTIRE core package with esbuild into
9
+ * one ESM payload served at `GET /ns/core-bundle.mjs`. The canonical
10
+ * `/ns/core[/<sub>]` URL space is preserved — those routes serve THIN SHIMS
11
+ * that statically import the bundle and re-export the requested subpath's
12
+ * namespace from the `globalThis.__NS_CORE_MODULES__` registry the bundle
13
+ * populates. Because every shim's only dependency is the one bundle URL,
14
+ * V8/iOS evaluates core exactly once per app lifetime — the single-realm
15
+ * invariant is enforced by construction, with ONE big prefetchable payload
16
+ * instead of a deep serial fetch chain.
17
+ *
18
+ * OPT-IN PER-MODULE MODE (core maintainers)
19
+ * -----------------------------------------
20
+ * Set `NS_CORE_PER_MODULE=1` to keep the classic per-module `/ns/core` bridge
21
+ * (websocket-ns-core.ts). That is the right mode when editing
22
+ * `@nativescript/core` source live inside the NativeScript monorepo: each core
23
+ * module stays individually served/transformed so core edits participate in
24
+ * HMR. Consumers of the published package don't edit core mid-session, so the
25
+ * bundle is both safe and much faster for them.
26
+ *
27
+ * FAILURE FALLBACK
28
+ * ----------------
29
+ * If the esbuild bundle build fails for any reason, the service marks itself
30
+ * failed and `/ns/core[/<sub>]` transparently falls back to the per-module
31
+ * bridge for the whole session (logged loudly once). Boot still works; only
32
+ * the speed win is lost.
33
+ */
34
+ import type { ViteDevServer } from 'vite';
35
+ import type { Platform } from '../../helpers/platform-types.js';
36
+ /**
37
+ * Per-module /ns/core serving mode (vs the default single-eval bundle).
38
+ *
39
+ * `NS_CORE_PER_MODULE=1|true` forces it on, `0|false` forces bundle mode.
40
+ * When unset, it AUTO-ENABLES for monorepo core source (packages/core in the
41
+ * NativeScript repo). Two reasons:
42
+ * - core maintainers edit core live, and per-module serving keeps those
43
+ * edits in HMR;
44
+ * - realm safety: the build-time externalizer emits
45
+ * `/ns/m/packages/core/<file>` URLs for workspace-source core (see the
46
+ * `ns-core-external-urls` workspace branch in configuration/base.ts), so
47
+ * the served graph's core realm lives under /ns/m. A bundle-mode
48
+ * `/ns/core-bundle.mjs` would evaluate a complete SECOND copy of core for
49
+ * the entry's `/ns/core/globals|application|…` imports — duplicate native
50
+ * class registrations crash in MetadataBuilder at startup.
51
+ */
52
+ export declare function isCorePerModuleServingEnabled(env?: NodeJS.ProcessEnv, hasWorkspaceCoreSource?: () => boolean): boolean;
53
+ export interface CoreBundleState {
54
+ /** Full ESM payload served at /ns/core-bundle.mjs (shape header + esbuild output). */
55
+ code: string;
56
+ /** Canonical subpaths registered in the bundle's __NS_CORE_MODULES__ registry. */
57
+ subs: Set<string>;
58
+ hash: string;
59
+ builtAt: number;
60
+ buildMs: number;
61
+ }
62
+ export interface CoreBundleService {
63
+ /** Resolves the built bundle, or null when the build failed (per-module fallback). */
64
+ ensureBuilt(): Promise<CoreBundleState | null>;
65
+ /** Synchronous view — null until built (or when failed). */
66
+ getState(): CoreBundleState | null;
67
+ hasFailed(): boolean;
68
+ }
69
+ export interface GenerateCoreBundleOptions {
70
+ projectRoot: string;
71
+ platform: Platform | string;
72
+ mode: 'development' | 'production' | string;
73
+ flavor?: string;
74
+ verbose?: boolean;
75
+ }
76
+ /**
77
+ * Resolve the physical @nativescript/core root the same way configuration/
78
+ * base.ts does: prefer monorepo source (`<workspace>/packages/core`), else the
79
+ * node_modules install reachable from the project root.
80
+ */
81
+ export declare function resolveCoreRootForBundle(projectRoot: string): string;
82
+ /**
83
+ * True when a canonical core subpath was DELIBERATELY excluded from bundle
84
+ * enumeration (debugger/, inspector_modules, bundle-entry-points, …). Requests
85
+ * for these at boot are normal — the runtime's inspector/debugger plumbing
86
+ * imports them in dev — and the per-module fallback that serves them is
87
+ * by-design and realm-safe. Callers use this to keep the fallback log
88
+ * verbose-only for expected subs while still surfacing unexpected
89
+ * enumeration misses.
90
+ */
91
+ export declare function isExpectedCoreBundleExclusion(canonicalSub: string): boolean;
92
+ /**
93
+ * Enumerate every importable core subpath (canonical form, per
94
+ * `normalizeCoreSub`) for the given platform. A subpath is included when it
95
+ * has a platform-neutral variant OR a variant for the current platform —
96
+ * other-platform-only modules (e.g. `ui/frame/activity.android` on iOS) are
97
+ * skipped since they can never resolve for this build.
98
+ */
99
+ export declare function enumerateCoreModuleSubpaths(coreRoot: string, platform: string): string[];
100
+ /**
101
+ * Synthetic esbuild entry: evaluate core once, expose every subpath's live
102
+ * namespace through `globalThis.__NS_CORE_MODULES__` (the SAME registry the
103
+ * per-module bridge footers populate, so the vendor CJS `require()` shim and
104
+ * `_nsReq` lookups keep working unchanged), and re-export the package main so
105
+ * `/ns/core-bundle.mjs` itself has core's full named-export surface.
106
+ */
107
+ export declare function buildCoreBundleEntryCode(subs: readonly string[]): string;
108
+ export declare function computeCoreBundleCacheKey(input: {
109
+ coreRoot: string;
110
+ coreVersion: string;
111
+ corePkgMtimeMs: number;
112
+ platform: string;
113
+ mode: string;
114
+ flavor: string;
115
+ defines: Record<string, string>;
116
+ nsConfigJson: string;
117
+ subs: readonly string[];
118
+ vitePackageVersion: string;
119
+ }): string;
120
+ export declare function tryLoadCoreBundleFromDisk(projectRoot: string, platform: string, key: string): CoreBundleState | null;
121
+ export declare function saveCoreBundleToDisk(projectRoot: string, platform: string, key: string, state: CoreBundleState, verbose?: boolean): void;
122
+ export declare function generateCoreBundle(options: GenerateCoreBundleOptions): Promise<CoreBundleState>;
123
+ export declare function createCoreBundleService(options: GenerateCoreBundleOptions): CoreBundleService;
124
+ /**
125
+ * Process-wide bundle service derived from the dev server's config + CLI
126
+ * flags. One dev server per process, so a module-level singleton matches the
127
+ * vendor manifest's lifecycle.
128
+ */
129
+ export declare function getSharedCoreBundleService(server: ViteDevServer): CoreBundleService;
130
+ /** Test seam: drop the shared service so specs can mount fresh. */
131
+ export declare function resetSharedCoreBundleServiceForTests(): void;
132
+ export declare const CORE_BUNDLE_PATH = "/ns/core-bundle.mjs";
133
+ /**
134
+ * Shim served at `/ns/core` in bundle mode. `export * from` gives real,
135
+ * live named bindings straight off the bundle module record; the explicit
136
+ * default keeps the "default import + destructure" consumer rewrite working
137
+ * (see buildDefaultExportFooter in ns-core-cjs-shape.ts for that contract).
138
+ */
139
+ export declare function buildCoreMainShimCode(): string;
140
+ export declare function buildCoreSubShimCode(sub: string, exportNames: readonly string[], hasOwnDefaultExport?: boolean): string;