@nativescript/vite 8.0.0-alpha.7 → 8.0.0-alpha.71

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 (555) hide show
  1. package/README.md +54 -14
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +293 -172
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +177 -110
  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 +12 -93
  15. package/configuration/typescript.js.map +1 -1
  16. package/helpers/app-components.d.ts +2 -1
  17. package/helpers/app-components.js.map +1 -1
  18. package/helpers/app-css-refresh.d.ts +31 -0
  19. package/helpers/app-css-refresh.js +43 -0
  20. package/helpers/app-css-refresh.js.map +1 -0
  21. package/helpers/app-css-state.d.ts +17 -0
  22. package/helpers/app-css-state.js +51 -0
  23. package/helpers/app-css-state.js.map +1 -0
  24. package/helpers/bundler-context.d.ts +11 -0
  25. package/helpers/bundler-context.js +71 -0
  26. package/helpers/bundler-context.js.map +1 -0
  27. package/helpers/cli-flags.d.ts +12 -0
  28. package/helpers/cli-flags.js +34 -0
  29. package/helpers/cli-flags.js.map +1 -1
  30. package/helpers/css-platform-plugin.d.ts +14 -0
  31. package/helpers/css-platform-plugin.js +43 -25
  32. package/helpers/css-platform-plugin.js.map +1 -1
  33. package/helpers/dev-host.d.ts +360 -0
  34. package/helpers/dev-host.js +694 -0
  35. package/helpers/dev-host.js.map +1 -0
  36. package/helpers/dynamic-import-plugin.d.ts +2 -1
  37. package/helpers/dynamic-import-plugin.js +59 -53
  38. package/helpers/dynamic-import-plugin.js.map +1 -1
  39. package/helpers/esbuild-platform-resolver.js +4 -1
  40. package/helpers/esbuild-platform-resolver.js.map +1 -1
  41. package/helpers/external-configs.d.ts +10 -12
  42. package/helpers/external-configs.js +58 -35
  43. package/helpers/external-configs.js.map +1 -1
  44. package/helpers/flavor.d.ts +13 -0
  45. package/helpers/flavor.js +18 -1
  46. package/helpers/flavor.js.map +1 -1
  47. package/helpers/global-defines.d.ts +101 -33
  48. package/helpers/global-defines.js +187 -64
  49. package/helpers/global-defines.js.map +1 -1
  50. package/helpers/hmr-scope.d.ts +26 -0
  51. package/helpers/hmr-scope.js +67 -0
  52. package/helpers/hmr-scope.js.map +1 -0
  53. package/helpers/init.js +6 -20
  54. package/helpers/init.js.map +1 -1
  55. package/helpers/logging.js +29 -1
  56. package/helpers/logging.js.map +1 -1
  57. package/helpers/main-entry.d.ts +4 -1
  58. package/helpers/main-entry.js +366 -47
  59. package/helpers/main-entry.js.map +1 -1
  60. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  61. package/helpers/nativeclass-esbuild-plugin.js +6 -1
  62. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  63. package/helpers/nativeclass-transform.d.ts +13 -0
  64. package/helpers/nativeclass-transform.js +37 -7
  65. package/helpers/nativeclass-transform.js.map +1 -1
  66. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  67. package/helpers/nativeclass-transformer-plugin.js +163 -15
  68. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  69. package/helpers/nativescript-package-resolver.js +10 -62
  70. package/helpers/nativescript-package-resolver.js.map +1 -1
  71. package/helpers/normalize-id.d.ts +42 -0
  72. package/helpers/normalize-id.js +60 -0
  73. package/helpers/normalize-id.js.map +1 -0
  74. package/helpers/ns-core-external-urls.d.ts +32 -0
  75. package/helpers/ns-core-external-urls.js +107 -0
  76. package/helpers/ns-core-external-urls.js.map +1 -0
  77. package/helpers/ns-core-url.d.ts +26 -3
  78. package/helpers/ns-core-url.js +66 -8
  79. package/helpers/ns-core-url.js.map +1 -1
  80. package/helpers/optimize-deps.d.ts +16 -0
  81. package/helpers/optimize-deps.js +17 -0
  82. package/helpers/optimize-deps.js.map +1 -0
  83. package/helpers/package-platform-aliases.js +34 -49
  84. package/helpers/package-platform-aliases.js.map +1 -1
  85. package/helpers/platform-types.d.ts +2 -0
  86. package/helpers/platform-types.js +2 -0
  87. package/helpers/platform-types.js.map +1 -0
  88. package/helpers/postcss-platform-config.d.ts +17 -1
  89. package/helpers/postcss-platform-config.js +20 -37
  90. package/helpers/postcss-platform-config.js.map +1 -1
  91. package/helpers/project.d.ts +35 -0
  92. package/helpers/project.js +120 -2
  93. package/helpers/project.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 +156 -27
  103. package/helpers/ts-config-paths.js.map +1 -1
  104. package/helpers/typescript-check.d.ts +2 -1
  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 +40 -19
  117. package/helpers/workers.js +324 -13
  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 +87 -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/hmr-pending-overlay.d.ts +0 -14
  129. package/hmr/client/hmr-pending-overlay.js +2 -11
  130. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  131. package/hmr/client/hot-context.d.ts +67 -0
  132. package/hmr/client/hot-context.js +307 -0
  133. package/hmr/client/hot-context.js.map +1 -0
  134. package/hmr/client/index.d.ts +9 -1
  135. package/hmr/client/index.js +70 -1970
  136. package/hmr/client/index.js.map +1 -1
  137. package/hmr/client/overlay-driver.d.ts +10 -0
  138. package/hmr/client/overlay-driver.js +33 -0
  139. package/hmr/client/overlay-driver.js.map +1 -0
  140. package/hmr/client/protocol-dispatch.d.ts +8 -0
  141. package/hmr/client/protocol-dispatch.js +308 -0
  142. package/hmr/client/protocol-dispatch.js.map +1 -0
  143. package/hmr/client/root-reset.d.ts +15 -0
  144. package/hmr/client/root-reset.js +358 -0
  145. package/hmr/client/root-reset.js.map +1 -0
  146. package/hmr/client/strategy-loader.d.ts +24 -0
  147. package/hmr/client/strategy-loader.js +83 -0
  148. package/hmr/client/strategy-loader.js.map +1 -0
  149. package/hmr/client/update-pipeline.d.ts +27 -0
  150. package/hmr/client/update-pipeline.js +464 -0
  151. package/hmr/client/update-pipeline.js.map +1 -0
  152. package/hmr/client/utils.d.ts +9 -1
  153. package/hmr/client/utils.js +117 -97
  154. package/hmr/client/utils.js.map +1 -1
  155. package/hmr/client/ws-transport.d.ts +21 -0
  156. package/hmr/client/ws-transport.js +323 -0
  157. package/hmr/client/ws-transport.js.map +1 -0
  158. package/hmr/entry-runtime.d.ts +2 -1
  159. package/hmr/entry-runtime.js +282 -71
  160. package/hmr/entry-runtime.js.map +1 -1
  161. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  162. package/hmr/frameworks/angular/build/angular-linker.js +113 -0
  163. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  164. package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
  165. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
  166. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  167. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  168. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  169. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  170. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  171. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  172. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  173. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  174. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  175. package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
  176. package/hmr/frameworks/angular/build/linker-stats.js +29 -0
  177. package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
  178. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  179. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  180. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  181. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  182. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  183. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  184. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  185. package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
  186. package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
  187. package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
  188. package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
  189. package/hmr/frameworks/angular/build/util.js +155 -0
  190. package/hmr/frameworks/angular/build/util.js.map +1 -0
  191. package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
  192. package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
  193. package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
  194. package/hmr/frameworks/angular/client/index.d.ts +0 -1
  195. package/hmr/frameworks/angular/client/index.js +459 -223
  196. package/hmr/frameworks/angular/client/index.js.map +1 -1
  197. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  198. package/hmr/frameworks/angular/client/strategy.js +19 -0
  199. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  200. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  201. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  202. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  203. package/hmr/frameworks/angular/server/linker.js +1 -4
  204. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  205. package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
  206. package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
  207. package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
  208. package/hmr/frameworks/angular/server/strategy.js +677 -13
  209. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  210. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  211. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  212. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +28 -11
  213. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +191 -105
  214. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  215. package/hmr/frameworks/react/client/strategy.d.ts +12 -0
  216. package/hmr/frameworks/react/client/strategy.js +27 -0
  217. package/hmr/frameworks/react/client/strategy.js.map +1 -0
  218. package/hmr/frameworks/react/server/strategy.d.ts +2 -0
  219. package/hmr/frameworks/react/server/strategy.js +230 -0
  220. package/hmr/frameworks/react/server/strategy.js.map +1 -0
  221. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  222. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  223. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  224. package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
  225. package/hmr/frameworks/solid/client/app-runtime.js +252 -0
  226. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
  227. package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
  228. package/hmr/frameworks/solid/client/strategy.js +391 -0
  229. package/hmr/frameworks/solid/client/strategy.js.map +1 -0
  230. package/hmr/frameworks/solid/server/strategy.js +293 -16
  231. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  232. package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
  233. package/hmr/frameworks/typescript/client/strategy.js +418 -0
  234. package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
  235. package/hmr/frameworks/typescript/server/strategy.js +40 -14
  236. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  237. package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
  238. package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
  239. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  240. package/hmr/frameworks/vue/client/index.d.ts +10 -1
  241. package/hmr/frameworks/vue/client/index.js +287 -562
  242. package/hmr/frameworks/vue/client/index.js.map +1 -1
  243. package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
  244. package/hmr/frameworks/vue/client/navigate-app.js +178 -0
  245. package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
  246. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  247. package/hmr/frameworks/vue/client/strategy.js +152 -0
  248. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  249. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  250. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
  251. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  252. package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
  253. package/hmr/frameworks/vue/server/compiler.js +3 -1
  254. package/hmr/frameworks/vue/server/compiler.js.map +1 -1
  255. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  256. package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
  257. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  258. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  259. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  260. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  261. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  262. package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
  263. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  264. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
  265. package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
  266. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  267. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  268. package/hmr/frameworks/vue/server/strategy.js +291 -7
  269. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  270. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  271. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  272. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  273. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  274. package/hmr/helpers/ast-normalizer.js +109 -14
  275. package/hmr/helpers/ast-normalizer.js.map +1 -1
  276. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  277. package/hmr/helpers/cjs-named-exports.js +152 -0
  278. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  279. package/hmr/helpers/package-exports.d.ts +16 -0
  280. package/hmr/helpers/package-exports.js +396 -0
  281. package/hmr/helpers/package-exports.js.map +1 -0
  282. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  283. package/hmr/helpers/vendor-rewrite.js +5 -3
  284. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  285. package/hmr/server/boot-recording.d.ts +51 -0
  286. package/hmr/server/boot-recording.js +214 -0
  287. package/hmr/server/boot-recording.js.map +1 -0
  288. package/hmr/server/constants.js +20 -5
  289. package/hmr/server/constants.js.map +1 -1
  290. package/hmr/server/content-css-update.d.ts +54 -0
  291. package/hmr/server/content-css-update.js +78 -0
  292. package/hmr/server/content-css-update.js.map +1 -0
  293. package/hmr/server/core-bundle.d.ts +140 -0
  294. package/hmr/server/core-bundle.js +614 -0
  295. package/hmr/server/core-bundle.js.map +1 -0
  296. package/hmr/server/core-sanitize.d.ts +86 -7
  297. package/hmr/server/core-sanitize.js +164 -39
  298. package/hmr/server/core-sanitize.js.map +1 -1
  299. package/hmr/server/css-connect-sync.d.ts +28 -0
  300. package/hmr/server/css-connect-sync.js +59 -0
  301. package/hmr/server/css-connect-sync.js.map +1 -0
  302. package/hmr/server/css-device-module.d.ts +28 -0
  303. package/hmr/server/css-device-module.js +44 -0
  304. package/hmr/server/css-device-module.js.map +1 -0
  305. package/hmr/server/css-update-message.d.ts +23 -0
  306. package/hmr/server/css-update-message.js +41 -0
  307. package/hmr/server/css-update-message.js.map +1 -0
  308. package/hmr/server/deps-bundle.d.ts +233 -0
  309. package/hmr/server/deps-bundle.js +1022 -0
  310. package/hmr/server/deps-bundle.js.map +1 -0
  311. package/hmr/server/device-transform-helpers.d.ts +24 -0
  312. package/hmr/server/device-transform-helpers.js +408 -0
  313. package/hmr/server/device-transform-helpers.js.map +1 -0
  314. package/hmr/server/framework-strategy.d.ts +182 -11
  315. package/hmr/server/hmr-module-graph.d.ts +37 -0
  316. package/hmr/server/hmr-module-graph.js +215 -0
  317. package/hmr/server/hmr-module-graph.js.map +1 -0
  318. package/hmr/server/import-map.d.ts +51 -19
  319. package/hmr/server/import-map.js +136 -66
  320. package/hmr/server/import-map.js.map +1 -1
  321. package/hmr/server/index.js +7 -16
  322. package/hmr/server/index.js.map +1 -1
  323. package/hmr/server/node-builtins-route.d.ts +12 -0
  324. package/hmr/server/node-builtins-route.js +86 -0
  325. package/hmr/server/node-builtins-route.js.map +1 -0
  326. package/hmr/server/ns-core-cjs-shape.js +1 -1
  327. package/hmr/server/ns-core-cjs-shape.js.map +1 -1
  328. package/hmr/server/ns-m-response-memo.d.ts +10 -0
  329. package/hmr/server/ns-m-response-memo.js +33 -0
  330. package/hmr/server/ns-m-response-memo.js.map +1 -0
  331. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  332. package/hmr/server/ns-rt-bridge.js +131 -0
  333. package/hmr/server/ns-rt-bridge.js.map +1 -0
  334. package/hmr/server/ns-rt-route.d.ts +5 -0
  335. package/hmr/server/ns-rt-route.js +39 -0
  336. package/hmr/server/ns-rt-route.js.map +1 -0
  337. package/hmr/server/perf-instrumentation.d.ts +1 -1
  338. package/hmr/server/perf-instrumentation.js +3 -1
  339. package/hmr/server/perf-instrumentation.js.map +1 -1
  340. package/hmr/server/process-code-for-device.d.ts +44 -0
  341. package/hmr/server/process-code-for-device.js +834 -0
  342. package/hmr/server/process-code-for-device.js.map +1 -0
  343. package/hmr/server/require-guard.d.ts +1 -0
  344. package/hmr/server/require-guard.js +12 -0
  345. package/hmr/server/require-guard.js.map +1 -0
  346. package/hmr/server/rewrite-imports.d.ts +2 -0
  347. package/hmr/server/rewrite-imports.js +631 -0
  348. package/hmr/server/rewrite-imports.js.map +1 -0
  349. package/hmr/server/route-helpers.d.ts +7 -0
  350. package/hmr/server/route-helpers.js +13 -0
  351. package/hmr/server/route-helpers.js.map +1 -0
  352. package/hmr/server/runtime-graph-filter.js +8 -1
  353. package/hmr/server/runtime-graph-filter.js.map +1 -1
  354. package/hmr/server/server-origin.d.ts +2 -0
  355. package/hmr/server/server-origin.js +88 -0
  356. package/hmr/server/server-origin.js.map +1 -0
  357. package/hmr/server/shared-transform-request.js +1 -2
  358. package/hmr/server/shared-transform-request.js.map +1 -1
  359. package/hmr/server/socket-utils.d.ts +10 -0
  360. package/hmr/server/socket-utils.js +14 -0
  361. package/hmr/server/socket-utils.js.map +1 -0
  362. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  363. package/hmr/server/transform-cache-invalidation.js +156 -0
  364. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  365. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  366. package/hmr/server/vendor-bare-module-shims.js +80 -0
  367. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  368. package/hmr/server/vite-plugin.d.ts +1 -0
  369. package/hmr/server/vite-plugin.js +227 -53
  370. package/hmr/server/vite-plugin.js.map +1 -1
  371. package/hmr/server/websocket-core-bridge.d.ts +51 -4
  372. package/hmr/server/websocket-core-bridge.js +62 -49
  373. package/hmr/server/websocket-core-bridge.js.map +1 -1
  374. package/hmr/server/websocket-device-transform.d.ts +3 -0
  375. package/hmr/server/websocket-device-transform.js +7 -0
  376. package/hmr/server/websocket-device-transform.js.map +1 -0
  377. package/hmr/server/websocket-hmr-pending.d.ts +2 -16
  378. package/hmr/server/websocket-hmr-pending.js +0 -22
  379. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  380. package/hmr/server/websocket-hot-update.d.ts +80 -0
  381. package/hmr/server/websocket-hot-update.js +295 -0
  382. package/hmr/server/websocket-hot-update.js.map +1 -0
  383. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  384. package/hmr/server/websocket-import-map-route.js +51 -0
  385. package/hmr/server/websocket-import-map-route.js.map +1 -0
  386. package/hmr/server/websocket-module-bindings.d.ts +15 -0
  387. package/hmr/server/websocket-module-bindings.js +38 -5
  388. package/hmr/server/websocket-module-bindings.js.map +1 -1
  389. package/hmr/server/websocket-module-specifiers.d.ts +66 -7
  390. package/hmr/server/websocket-module-specifiers.js +219 -49
  391. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  392. package/hmr/server/websocket-ns-core.d.ts +34 -0
  393. package/hmr/server/websocket-ns-core.js +414 -0
  394. package/hmr/server/websocket-ns-core.js.map +1 -0
  395. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  396. package/hmr/server/websocket-ns-entry.js +164 -0
  397. package/hmr/server/websocket-ns-entry.js.map +1 -0
  398. package/hmr/server/websocket-ns-m-paths.d.ts +19 -3
  399. package/hmr/server/websocket-ns-m-paths.js +98 -75
  400. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  401. package/hmr/server/websocket-ns-m-request.d.ts +13 -2
  402. package/hmr/server/websocket-ns-m-request.js +20 -11
  403. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  404. package/hmr/server/websocket-ns-m.d.ts +52 -0
  405. package/hmr/server/websocket-ns-m.js +590 -0
  406. package/hmr/server/websocket-ns-m.js.map +1 -0
  407. package/hmr/server/websocket-served-module-helpers.d.ts +57 -4
  408. package/hmr/server/websocket-served-module-helpers.js +462 -141
  409. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  410. package/hmr/server/websocket-txn.js +6 -9
  411. package/hmr/server/websocket-txn.js.map +1 -1
  412. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  413. package/hmr/server/websocket-vendor-unifier.js +4 -9
  414. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  415. package/hmr/server/websocket.d.ts +7 -40
  416. package/hmr/server/websocket.js +653 -6734
  417. package/hmr/server/websocket.js.map +1 -1
  418. package/hmr/shared/ns-globals.d.ts +106 -0
  419. package/hmr/shared/ns-globals.js +29 -0
  420. package/hmr/shared/ns-globals.js.map +1 -0
  421. package/hmr/shared/protocol.d.ts +157 -0
  422. package/hmr/shared/protocol.js +28 -0
  423. package/hmr/shared/protocol.js.map +1 -0
  424. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  425. package/hmr/shared/runtime/boot-complete.js +32 -0
  426. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  427. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  428. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  429. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  430. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  431. package/hmr/shared/runtime/boot-progress.js +134 -0
  432. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  433. package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
  434. package/hmr/shared/runtime/boot-timeline.js +8 -19
  435. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  436. package/hmr/shared/runtime/browser-runtime-contract.d.ts +43 -24
  437. package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
  438. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  439. package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
  440. package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
  441. package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
  442. package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
  443. package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
  444. package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
  445. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  446. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  447. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  448. package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
  449. package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
  450. package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
  451. package/hmr/shared/runtime/dev-overlay.d.ts +23 -69
  452. package/hmr/shared/runtime/dev-overlay.js +67 -1023
  453. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  454. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  455. package/hmr/shared/runtime/global-scope.js +21 -0
  456. package/hmr/shared/runtime/global-scope.js.map +1 -0
  457. package/hmr/shared/runtime/hooks.js +2 -1
  458. package/hmr/shared/runtime/hooks.js.map +1 -1
  459. package/hmr/shared/runtime/launch-bridge.d.ts +9 -0
  460. package/hmr/shared/runtime/launch-bridge.js +98 -0
  461. package/hmr/shared/runtime/launch-bridge.js.map +1 -0
  462. package/hmr/shared/runtime/module-provenance.js +4 -6
  463. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  464. package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
  465. package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
  466. package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
  467. package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
  468. package/hmr/shared/runtime/overlay-flag.js +34 -0
  469. package/hmr/shared/runtime/overlay-flag.js.map +1 -0
  470. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  471. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  472. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  473. package/hmr/shared/runtime/root-placeholder.js +401 -206
  474. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  475. package/hmr/shared/runtime/session-bootstrap.js +203 -58
  476. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  477. package/hmr/shared/runtime/vendor-bootstrap.js +3 -10
  478. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  479. package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
  480. package/hmr/shared/runtime/vendor-resolve.js +45 -0
  481. package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
  482. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  483. package/hmr/shared/vendor/manifest-collect.js +909 -0
  484. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  485. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  486. package/hmr/shared/vendor/manifest-loader.js +5 -3
  487. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  488. package/hmr/shared/vendor/manifest.d.ts +12 -7
  489. package/hmr/shared/vendor/manifest.js +180 -826
  490. package/hmr/shared/vendor/manifest.js.map +1 -1
  491. package/hmr/shared/vendor/registry.d.ts +2 -0
  492. package/hmr/shared/vendor/registry.js +14 -0
  493. package/hmr/shared/vendor/registry.js.map +1 -1
  494. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  495. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  496. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  497. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +107 -0
  498. package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
  499. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  500. package/index.d.ts +1 -0
  501. package/index.js +5 -0
  502. package/index.js.map +1 -1
  503. package/package.json +65 -13
  504. package/runtime/core-aliases-early.js +28 -57
  505. package/runtime/core-aliases-early.js.map +1 -1
  506. package/shims/react-jsx-runtime.d.ts +4 -0
  507. package/shims/react-jsx-runtime.js +61 -0
  508. package/shims/react-jsx-runtime.js.map +1 -0
  509. package/helpers/angular/angular-linker.d.ts +0 -13
  510. package/helpers/angular/angular-linker.js +0 -194
  511. package/helpers/angular/angular-linker.js.map +0 -1
  512. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  513. package/helpers/angular/shared-linker.d.ts +0 -11
  514. package/helpers/angular/shared-linker.js +0 -75
  515. package/helpers/angular/shared-linker.js.map +0 -1
  516. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  517. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  518. package/helpers/angular/util.js +0 -67
  519. package/helpers/angular/util.js.map +0 -1
  520. package/helpers/module-runner-patch.d.ts +0 -3
  521. package/helpers/module-runner-patch.js +0 -63
  522. package/helpers/module-runner-patch.js.map +0 -1
  523. package/helpers/prelink-angular.d.ts +0 -2
  524. package/helpers/prelink-angular.js +0 -117
  525. package/helpers/prelink-angular.js.map +0 -1
  526. package/hmr/server/websocket-angular-entry.js.map +0 -1
  527. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  528. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
  529. package/hmr/server/websocket-ns-m-finalize.js +0 -88
  530. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  531. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  532. package/hmr/server/websocket-runtime-compat.js +0 -287
  533. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  534. package/hmr/server/websocket-vue-sfc.d.ts +0 -27
  535. package/hmr/server/websocket-vue-sfc.js +0 -1114
  536. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  537. package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
  538. package/hmr/shared/runtime/http-only-boot.js +0 -171
  539. package/hmr/shared/runtime/http-only-boot.js.map +0 -1
  540. package/hmr/vendor-bootstrap.d.ts +0 -3
  541. package/hmr/vendor-bootstrap.js +0 -32
  542. package/hmr/vendor-bootstrap.js.map +0 -1
  543. package/shims/react-reconciler-constants.d.ts +0 -14
  544. package/shims/react-reconciler-constants.js +0 -21
  545. package/shims/react-reconciler-constants.js.map +0 -1
  546. package/shims/react-reconciler.d.ts +0 -8
  547. package/shims/react-reconciler.js +0 -15
  548. package/shims/react-reconciler.js.map +0 -1
  549. package/transformers/NativeClass/index.d.ts +0 -2
  550. package/transformers/NativeClass/index.js +0 -222
  551. package/transformers/NativeClass/index.js.map +0 -1
  552. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  553. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  554. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  555. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -0,0 +1,27 @@
1
+ import { typescriptClientStrategy } from '../../typescript/client/strategy.js';
2
+ /**
3
+ * React reuses the generic TypeScript HMR path on BOTH server and client: it
4
+ * has no Fast Refresh, so a module edit drives a plain module reload (the
5
+ * React tree re-renders). This mirrors the server's
6
+ * `{ ...typescriptServerStrategy, flavor: 'react' }` — modal tracking, the
7
+ * TS-style root factory, and the code-behind re-registration all apply — but
8
+ * the batch refresh differs: React mounts a dominative document root via
9
+ * `startReactApp` rather than an `app-root` module, so the TypeScript
10
+ * `resetRootView({moduleName:'app-root'})` path doesn't apply.
11
+ */
12
+ export const reactClientStrategy = {
13
+ ...typescriptClientStrategy,
14
+ flavor: 'react',
15
+ refreshAfterBatch(_drained, ctx) {
16
+ // The changed modules were already re-imported into the device cache by
17
+ // the shared queue; the per-page remount is driven by the app's
18
+ // `__NS_HMR_ON_UPDATE__` hook (see `@nativescript/tanstack-router/react`'s
19
+ // `subscribeReactHmrRemount`), which fires right after this queue drains.
20
+ // Here we only mark the overlay complete so it doesn't stick at
21
+ // 'received' (5%).
22
+ ctx.setUpdateOverlayStage('complete', {
23
+ detail: `Total ${Math.max(0, Date.now() - ctx.startedAt)}ms`,
24
+ });
25
+ },
26
+ };
27
+ //# sourceMappingURL=strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../../../../../packages/vite/hmr/frameworks/react/client/strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA4B;IAC3D,GAAG,wBAAwB;IAC3B,MAAM,EAAE,OAAO;IAEf,iBAAiB,CAAC,QAAkB,EAAE,GAAgC;QACrE,wEAAwE;QACxE,gEAAgE;QAChE,2EAA2E;QAC3E,0EAA0E;QAC1E,gEAAgE;QAChE,mBAAmB;QACnB,GAAG,CAAC,qBAAqB,CAAC,UAAU,EAAE;YACrC,MAAM,EAAE,SAAS,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI;SAC5D,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { FrameworkServerStrategy } from '../../../server/framework-strategy.js';
2
+ export declare const reactServerStrategy: FrameworkServerStrategy;
@@ -0,0 +1,230 @@
1
+ import { createRequire } from 'node:module';
2
+ import { readFileSync, existsSync } from 'node:fs';
3
+ import * as path from 'node:path';
4
+ import { typescriptServerStrategy } from '../../typescript/server/strategy.js';
5
+ import { runHotUpdatePrologue } from '../../../server/websocket-hot-update.js';
6
+ import { purgeTransformCachesForHotUpdate } from '../../../server/transform-cache-invalidation.js';
7
+ // React server strategy for NativeScript HMR.
8
+ //
9
+ // React renders through DOMiNATIVE via `@nativescript-community/react` and runs
10
+ // WITHOUT React Fast Refresh (module-level reload, mirroring the Solid flavor's
11
+ // `hot: false`). It therefore needs no framework-specific HMR transform — it
12
+ // reuses the generic TypeScript strategy's device-module pipeline verbatim
13
+ // (HTTP-loaded modules, vendor bridge, shared graph delta on hot update).
14
+ //
15
+ // The important part is that this is REGISTERED in `STRATEGY_REGISTRY`: the
16
+ // server-side HMR plugin (which installs the `/ns/*` device routes — `/ns/core`,
17
+ // `/ns/import-map.json`, `/ns/m`, `/ns/entry-rt`, …) is only added for flavors
18
+ // with a registered strategy. Without it, a React project's dev server serves no
19
+ // `/ns/*` routes and the app fails at boot fetching `/ns/core/xhr` (404).
20
+ // ── React-ecosystem CJS named-export interop (the `transformNodeModule` hook) ──
21
+ //
22
+ // React and friends ship the classic prod/dev conditional re-export wrapper:
23
+ //
24
+ // if (process.env.NODE_ENV === 'production') module.exports = require('./cjs/x.production.js');
25
+ // else module.exports = require('./cjs/x.development.js');
26
+ //
27
+ // Served raw over `/ns/m`, that wrapper exposes ONLY a default export — the device's
28
+ // ESM loader can't see the names (`jsx`, `useSyncExternalStoreWithSelector`, …)
29
+ // because they materialize on `module.exports` only at runtime, through the
30
+ // conditional require. So a consumer's `import { useSyncExternalStoreWithSelector }`
31
+ // (or `{ jsx }` from react/jsx-runtime, etc.) fails with "does not provide an export
32
+ // named …". The non-HMR rolldown build bundles these fine; this only affects the
33
+ // HMR/dev `/ns/m` path.
34
+ //
35
+ // The DEVELOPMENT target file is plain CJS (`exports.x = …`), whose named exports
36
+ // the `/ns/m` pipeline DOES statically surface. So we rewrite the wrapper to
37
+ // re-export EXPLICIT names from its development target. (We can't `export *` — the
38
+ // device transform downgrades export-star to a side-effect import — so we read the
39
+ // dev file and list the names.) Generic: works for any such wrapper, no per-package
40
+ // shim.
41
+ const projectRequire = createRequire(path.join(process.cwd(), 'package.json'));
42
+ // react/jsx-runtime is the hottest of these (every JSX module imports it). Serve a
43
+ // self-contained shim built on React.createElement so it never depends on the
44
+ // internals of react's dev jsx-runtime file. (App-code imports are already routed
45
+ // here by the resolve alias in configuration/react.ts; this covers vendored
46
+ // importers served through `/ns/m`.)
47
+ const REACT_JSX_RUNTIME_RE = /(^|[\\/])react[\\/]jsx-(?:dev-)?runtime(?:[\\/.]|$)/;
48
+ const REACT_JSX_RUNTIME_SHIM = [
49
+ `import { createElement, Fragment as __NS_Fragment } from 'react';`,
50
+ `export const Fragment = __NS_Fragment;`,
51
+ `function __ns_jsx(type, config, maybeKey) {`,
52
+ ` if (maybeKey !== undefined) return createElement(type, Object.assign({}, config || {}, { key: maybeKey }));`,
53
+ ` return createElement(type, config);`,
54
+ `}`,
55
+ `export function jsx(type, config, maybeKey) { return __ns_jsx(type, config, maybeKey); }`,
56
+ `export function jsxs(type, config, maybeKey) { return __ns_jsx(type, config, maybeKey); }`,
57
+ `export function jsxDEV(type, config, maybeKey) { return __ns_jsx(type, config, maybeKey); }`,
58
+ ].join('\n');
59
+ // Lex `exports.NAME = …` / `Object.defineProperty(exports, "NAME", …)` from a CJS
60
+ // development file (the prod/dev targets are plain CJS, statically lexable).
61
+ function lexCjsExportNames(filePath) {
62
+ let src = '';
63
+ try {
64
+ src = readFileSync(filePath, 'utf8');
65
+ }
66
+ catch {
67
+ return [];
68
+ }
69
+ const names = new Set();
70
+ for (const m of src.matchAll(/\bexports\.([A-Za-z_$][\w$]*)\s*=/g))
71
+ names.add(m[1]);
72
+ for (const m of src.matchAll(/Object\.defineProperty\(\s*exports\s*,\s*['"]([A-Za-z_$][\w$]*)['"]/g))
73
+ names.add(m[1]);
74
+ names.delete('default');
75
+ names.delete('__esModule');
76
+ return Array.from(names);
77
+ }
78
+ // Resolve a wrapper module's development-target relative require (`devRel`) to an
79
+ // absolute fs path. `moduleId` is the wrapper's id (an fs path, or a
80
+ // `…/node_modules/<pkg>/<sub>` url/id). We find the wrapper's fs path — directly if
81
+ // it's already absolute, otherwise by resolving its public package subpath spec —
82
+ // then join `devRel` against the wrapper's directory (the dev file is internal, so
83
+ // it can't be import-resolved directly under an `exports` map).
84
+ function resolveDevTargetPath(moduleId, devRel) {
85
+ const clean = (moduleId || '').replace(/[?#].*$/, '');
86
+ if (!clean)
87
+ return null;
88
+ let wrapperPath = null;
89
+ if (path.isAbsolute(clean) && existsSync(clean)) {
90
+ wrapperPath = clean;
91
+ }
92
+ else {
93
+ const nm = clean.match(/node_modules[\\/]((?:@[^\\/]+[\\/])?[^\\/]+[\\/].*)$/);
94
+ if (nm) {
95
+ const subpath = nm[1].split(path.sep).join('/');
96
+ for (const spec of [subpath.replace(/\.(?:js|mjs|cjs)$/, ''), subpath]) {
97
+ try {
98
+ wrapperPath = projectRequire.resolve(spec);
99
+ break;
100
+ }
101
+ catch { }
102
+ }
103
+ }
104
+ }
105
+ if (!wrapperPath)
106
+ return null;
107
+ const devPath = path.resolve(path.dirname(wrapperPath), devRel);
108
+ return existsSync(devPath) ? devPath : null;
109
+ }
110
+ // If `code` is a prod/dev conditional re-export wrapper, return an ESM module that
111
+ // re-exports the development target's explicit named exports (+ default). Returns
112
+ // null otherwise so non-matching modules pass through untouched. Detection is
113
+ // intentionally narrow (requires the `module.exports = require(...)` indirection
114
+ // AND both a `.production.js` and `.development.js` target) so it only fires on the
115
+ // React-ecosystem prod/dev idiom.
116
+ function buildCondRequireReexport(code, moduleId) {
117
+ if (!/module\.exports\s*=\s*require\(/.test(code))
118
+ return null;
119
+ const devMatch = code.match(/require\(\s*['"]([^'"]+\.development\.js)['"]\s*\)/);
120
+ const hasProd = /require\(\s*['"][^'"]+\.production\.js['"]\s*\)/.test(code);
121
+ if (!devMatch || !hasProd)
122
+ return null;
123
+ const devRel = devMatch[1]; // e.g. '../cjs/use-sync-external-store-shim/with-selector.development.js'
124
+ // Resolve the dev target to an fs path so we can lex its export names. The dev
125
+ // file is an INTERNAL package file — usually exports-gated, so it can't be
126
+ // resolved as `pkg/cjs/…` directly. Instead resolve the (public) WRAPPER to its
127
+ // fs path and join the relative dev path against the wrapper's directory.
128
+ const devPath = resolveDevTargetPath(moduleId, devRel);
129
+ if (!devPath)
130
+ return null;
131
+ const names = lexCjsExportNames(devPath);
132
+ // Re-export by the ORIGINAL relative path so the device transform rewrites it to
133
+ // the dev target's `/ns/m` URL (served with real named exports). Explicit names
134
+ // only — `export *` is downgraded to a side-effect import by the device transform.
135
+ const target = JSON.stringify(devRel);
136
+ const lines = [];
137
+ if (names.length)
138
+ lines.push(`export { ${names.join(', ')} } from ${target};`);
139
+ lines.push(`export { default } from ${target};`);
140
+ return lines.join('\n');
141
+ }
142
+ export const reactServerStrategy = {
143
+ ...typescriptServerStrategy,
144
+ flavor: 'react',
145
+ transformNodeModule(code, moduleId, _verbose) {
146
+ if (moduleId && REACT_JSX_RUNTIME_RE.test(moduleId)) {
147
+ return REACT_JSX_RUNTIME_SHIM;
148
+ }
149
+ return buildCondRequireReexport(code, moduleId || '') ?? code;
150
+ },
151
+ // Like Solid (and unlike plain TypeScript, which recovers via a full
152
+ // `resetRootView`), React HMR applies an edit by having the CLIENT re-fetch +
153
+ // re-evaluate the just-changed route module and read its fresh
154
+ // `Route.options.component`. So the server MUST purge its transform caches
155
+ // BEFORE the client re-imports — otherwise the client races the server and the
156
+ // `/ns/m` re-fetch returns the PREVIOUS save's transform → V8 evaluates stale
157
+ // code → the visible page is "one save behind". The default TS strategy
158
+ // broadcasts the delta immediately (no purge), which is why React edits never
159
+ // applied. We mirror Solid's contract: defer the prologue's delta broadcast,
160
+ // purge the shared + Vite transform caches for the file AND its transitive
161
+ // importers (the route tree statically imports the route), re-transform fresh,
162
+ // then broadcast the delta.
163
+ deferDeltaBroadcast: true,
164
+ async handleHotUpdate(ctx, deps) {
165
+ const state = await runHotUpdatePrologue(ctx, deps);
166
+ if (!state)
167
+ return;
168
+ const { root, metrics, emitSummary } = state;
169
+ const { moduleGraph, verbose, sharedTransformRequest } = deps;
170
+ const { file, server } = ctx;
171
+ const isAppScriptFile = /\.(tsx?|jsx?)$/i.test(file);
172
+ if (!isAppScriptFile) {
173
+ emitSummary();
174
+ return;
175
+ }
176
+ metrics.tAfterFramework = Date.now();
177
+ try {
178
+ const rel = '/' + path.posix.normalize(path.relative(root, file)).split(path.sep).join('/');
179
+ const normalizedId = moduleGraph.normalizeGraphId(rel);
180
+ if (!moduleGraph.get(normalizedId)) {
181
+ moduleGraph.upsert(rel, `/* react-hmr ${Date.now()} */`, [], { emitDeltaOnInsert: true });
182
+ }
183
+ // Purge BOTH the shared transform-request cache and Vite's moduleGraph
184
+ // transformResult for the changed file + its bounded transitive importers
185
+ // (route tree → route file), so the client's re-import evaluates fresh code.
186
+ purgeTransformCachesForHotUpdate({ file, server, sharedTransformRequest, verbose, label: 'react' });
187
+ // Re-transform AFTER invalidation so the broadcast hash matches fresh
188
+ // content (the prologue's upsert ran before Vite's auto-invalidate fired).
189
+ try {
190
+ const ext = file.match(/\.(?:[mc]?[jt]sx?)$/i)?.[0] || '';
191
+ const baseSpec = '/' + path.posix.normalize(path.relative(root, file)).split(path.sep).join('/');
192
+ const baseNoExt = ext ? baseSpec.replace(/\.(?:[mc]?[jt]sx?)$/i, '') : baseSpec;
193
+ const candidates = Array.from(new Set([baseSpec, baseNoExt, baseNoExt + '.ts', baseNoExt + '.tsx', baseNoExt + '.js', baseNoExt + '.jsx', baseNoExt + '.mjs', file]));
194
+ let freshCode = '';
195
+ for (const cand of candidates) {
196
+ try {
197
+ const fresh = await sharedTransformRequest(cand, 30000);
198
+ if (fresh?.code && !freshCode)
199
+ freshCode = fresh.code;
200
+ }
201
+ catch { }
202
+ }
203
+ if (freshCode) {
204
+ const existingGm = moduleGraph.get(normalizedId);
205
+ moduleGraph.upsert(normalizedId, freshCode, (existingGm?.deps || []), { broadcastDelta: false });
206
+ }
207
+ }
208
+ catch (e) {
209
+ if (verbose)
210
+ console.warn('[hmr-ws][react] post-invalidation re-transform failed', e);
211
+ }
212
+ // Broadcast the now-fresh delta, AFTER cache invalidation.
213
+ try {
214
+ const gm = moduleGraph.get(normalizedId);
215
+ if (gm)
216
+ moduleGraph.emitDelta([gm], []);
217
+ }
218
+ catch (e) {
219
+ if (verbose)
220
+ console.warn('[hmr-ws][react] post-invalidation broadcast failed', e);
221
+ }
222
+ }
223
+ catch (e) {
224
+ if (verbose)
225
+ console.warn('[hmr-ws][react] failed to handle hot update for', file, e);
226
+ }
227
+ emitSummary();
228
+ },
229
+ };
230
+ //# sourceMappingURL=strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../../../../../packages/vite/hmr/frameworks/react/server/strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AAEnG,8CAA8C;AAC9C,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,2EAA2E;AAC3E,0EAA0E;AAC1E,EAAE;AACF,4EAA4E;AAC5E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E,CAAC;gBACZ,IAAI,OAAO;oBAAE,OAAO,CAAC,IAAI,CAAC,oDAAoD,EAAE,CAAC,CAAC,CAAC;YACpF,CAAC;QACF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,IAAI,OAAO;gBAAE,OAAO,CAAC,IAAI,CAAC,iDAAiD,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACvF,CAAC;QACD,WAAW,EAAE,CAAC;IACf,CAAC;CACD,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Find installed packages whose pre-bundle output would smuggle JSX into
3
+ * Vite's import-analysis stage. Returned names are safe to drop into
4
+ * `optimizeDeps.exclude` — the dev server will serve them through the
5
+ * normal module pipeline, where `vite-plugin-solid` can transform their
6
+ * original `.jsx`/`.tsx` files.
7
+ *
8
+ * The function is intentionally synchronous and best-effort: filesystem
9
+ * errors are swallowed, missing directories are skipped, and the scan
10
+ * caps at {@link MAX_SCAN_DEPTH} levels per package. Callers should
11
+ * treat the empty-array result as "no exclusions needed", not "scan
12
+ * failed". A nullable `monorepoRoot` is accepted so workspace hoisting
13
+ * is covered without forcing every caller to compute it.
14
+ */
15
+ export declare function findSolidPackagesShippingJsx(projectRoot: string, monorepoRoot?: string | null): string[];
@@ -0,0 +1,178 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ /**
4
+ * Why this helper exists
5
+ * ----------------------
6
+ *
7
+ * Vite's depscanner happily pre-bundles every bare specifier the app
8
+ * imports. For a Solid library that publishes pre-compiled-but-still-JSX
9
+ * files (e.g. `solid-navigation`'s `dist/src/*.jsx`), the pre-bundle output
10
+ * lands at `node_modules/.vite/deps/<pkg>.js` with the JSX intact —
11
+ * rolldown's depscanner doesn't run Solid's JSX transform (that lives in
12
+ * `vite-plugin-solid`'s `transform` hook, which only matches files whose
13
+ * id ends in `.jsx`/`.tsx`).
14
+ *
15
+ * Vite then runs `vite:import-analysis` on the `.js` output, hits the
16
+ * first JSX expression, and aborts the dev server's pre-transform with:
17
+ *
18
+ * Failed to parse source for import analysis because the content
19
+ * contains invalid JS syntax. If you are using JSX, make sure to
20
+ * name the file with the .jsx or .tsx extension.
21
+ * File: /…/.vite/deps/<pkg>.js:51:32
22
+ *
23
+ * The fix: when a project depends on a Solid library that ships `.jsx`
24
+ * (or `.tsx`) source files in its package directory, mark that package
25
+ * as `optimizeDeps.exclude` so Vite serves it through the regular dev
26
+ * pipeline, where `vite-plugin-solid`'s `transform` hook matches the
27
+ * original `.jsx` id and applies the Solid babel preset.
28
+ *
29
+ * Detection rules — biased toward false negatives so we never wrongly
30
+ * exclude a package that Vite must pre-bundle (esp. CJS-only deps that
31
+ * need esm interop). A package is excluded only when ALL of the
32
+ * following hold:
33
+ *
34
+ * 1. It declares `solid-js` or `@nativescript-community/solid-js` in
35
+ * `dependencies` / `peerDependencies` / `devDependencies`. This is
36
+ * a strong signal that the package's published artifacts are
37
+ * meant to be processed by a Solid-aware JSX transformer.
38
+ * 2. Its package directory contains at least one `.jsx` / `.tsx`
39
+ * source file under `dist` / `lib` / `build` / `es` / `esm` /
40
+ * `out` (the common published-output dirs) or directly at the
41
+ * package root. We deliberately skip `node_modules`, `src` (raw
42
+ * sources, not what `main` points to), and test dirs.
43
+ *
44
+ * Both checks are scoped to packages installed in the app's
45
+ * `node_modules` (plus the monorepo's hoisted `node_modules`, if any)
46
+ * — we never recurse into transitive nested copies, since those are
47
+ * also reachable from the same top-level scan once Vite resolves them.
48
+ */
49
+ const PUBLISHED_OUTPUT_DIRS = new Set(['dist', 'lib', 'build', 'es', 'esm', 'out']);
50
+ // Always-skip subdirs regardless of depth: nested copies, test fixtures,
51
+ // docs, and example apps. Notably `src` is NOT in here because a published
52
+ // bundle may use `dist/src/<file>.jsx` as its layout (e.g. `solid-navigation`).
53
+ // `src/` at the *package root* is rejected separately by the
54
+ // "depth 0 must be a published-output dir" gate below.
55
+ const ALWAYS_SKIP_DIR_NAMES = new Set(['node_modules', 'test', 'tests', '__tests__', 'spec', 'specs', 'docs', 'examples', 'example', '.git', '.cache']);
56
+ const JSX_EXT_RE = /\.(jsx|tsx)$/;
57
+ const MAX_SCAN_DEPTH = 4;
58
+ function isSolidConsumer(pkgJson) {
59
+ const buckets = ['dependencies', 'peerDependencies', 'devDependencies', 'optionalDependencies'];
60
+ for (const key of buckets) {
61
+ const deps = pkgJson[key];
62
+ if (!deps || typeof deps !== 'object')
63
+ continue;
64
+ if (deps['solid-js'])
65
+ return true;
66
+ if (deps['@nativescript-community/solid-js'])
67
+ return true;
68
+ }
69
+ return false;
70
+ }
71
+ function hasJsxFile(dir, depth = 0) {
72
+ if (depth > MAX_SCAN_DEPTH)
73
+ return false;
74
+ let entries;
75
+ try {
76
+ entries = fs.readdirSync(dir, { withFileTypes: true });
77
+ }
78
+ catch {
79
+ return false;
80
+ }
81
+ for (const entry of entries) {
82
+ if (entry.isFile() && JSX_EXT_RE.test(entry.name)) {
83
+ return true;
84
+ }
85
+ if (entry.isDirectory()) {
86
+ if (entry.name.startsWith('.'))
87
+ continue;
88
+ if (ALWAYS_SKIP_DIR_NAMES.has(entry.name))
89
+ continue;
90
+ // At depth 0 (package root) only descend into known
91
+ // published-output dirs so a sibling `src/` (raw sources)
92
+ // can't flag the package on its own. Deeper levels are
93
+ // inside a publish dir already, so any subdir (incl. `src`)
94
+ // is fair game.
95
+ if (depth === 0 && !PUBLISHED_OUTPUT_DIRS.has(entry.name))
96
+ continue;
97
+ if (hasJsxFile(path.join(dir, entry.name), depth + 1))
98
+ return true;
99
+ }
100
+ }
101
+ return false;
102
+ }
103
+ function scanDirectoryForJsxPackages(nodeModulesDir, result, scope = '') {
104
+ let entries;
105
+ try {
106
+ entries = fs.readdirSync(nodeModulesDir, { withFileTypes: true });
107
+ }
108
+ catch {
109
+ return;
110
+ }
111
+ for (const entry of entries) {
112
+ if (!entry.isDirectory())
113
+ continue;
114
+ if (entry.name.startsWith('.'))
115
+ continue;
116
+ if (entry.name === 'node_modules')
117
+ continue;
118
+ const entryPath = path.join(nodeModulesDir, entry.name);
119
+ if (!scope && entry.name.startsWith('@')) {
120
+ scanDirectoryForJsxPackages(entryPath, result, entry.name);
121
+ continue;
122
+ }
123
+ const pkgName = scope ? `${scope}/${entry.name}` : entry.name;
124
+ if (result.has(pkgName))
125
+ continue;
126
+ const pkgJsonPath = path.join(entryPath, 'package.json');
127
+ if (!fs.existsSync(pkgJsonPath))
128
+ continue;
129
+ let pkgJson;
130
+ try {
131
+ pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
132
+ }
133
+ catch {
134
+ continue;
135
+ }
136
+ if (!isSolidConsumer(pkgJson))
137
+ continue;
138
+ if (!hasJsxFile(entryPath))
139
+ continue;
140
+ result.add(pkgName);
141
+ }
142
+ }
143
+ /**
144
+ * Find installed packages whose pre-bundle output would smuggle JSX into
145
+ * Vite's import-analysis stage. Returned names are safe to drop into
146
+ * `optimizeDeps.exclude` — the dev server will serve them through the
147
+ * normal module pipeline, where `vite-plugin-solid` can transform their
148
+ * original `.jsx`/`.tsx` files.
149
+ *
150
+ * The function is intentionally synchronous and best-effort: filesystem
151
+ * errors are swallowed, missing directories are skipped, and the scan
152
+ * caps at {@link MAX_SCAN_DEPTH} levels per package. Callers should
153
+ * treat the empty-array result as "no exclusions needed", not "scan
154
+ * failed". A nullable `monorepoRoot` is accepted so workspace hoisting
155
+ * is covered without forcing every caller to compute it.
156
+ */
157
+ export function findSolidPackagesShippingJsx(projectRoot, monorepoRoot) {
158
+ const found = new Set();
159
+ const seenDirs = new Set();
160
+ const scanDirs = [];
161
+ const projectNodeModules = path.resolve(projectRoot, 'node_modules');
162
+ scanDirs.push(projectNodeModules);
163
+ if (monorepoRoot && path.resolve(monorepoRoot) !== path.resolve(projectRoot)) {
164
+ const monorepoNodeModules = path.resolve(monorepoRoot, 'node_modules');
165
+ scanDirs.push(monorepoNodeModules);
166
+ }
167
+ for (const dir of scanDirs) {
168
+ const key = path.resolve(dir);
169
+ if (seenDirs.has(key))
170
+ continue;
171
+ seenDirs.add(key);
172
+ if (!fs.existsSync(dir))
173
+ continue;
174
+ scanDirectoryForJsxPackages(dir, found);
175
+ }
176
+ return Array.from(found).sort();
177
+ }
178
+ //# sourceMappingURL=solid-jsx-deps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solid-jsx-deps.js","sourceRoot":"","sources":["../../../../../../../packages/vite/hmr/frameworks/solid/build/solid-jsx-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AACpF,yEAAyE;AACzE,2EAA2E;AAC3E,gFAAgF;AAChF,6DAA6D;AAC7D,uDAAuD;AACvD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACxJ,MAAM,UAAU,GAAG,cAAc,CAAC;AAClC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEzB,SAAS,eAAe,CAAC,OAA4B;IACpD,MAAM,OAAO,GAAG,CAAC,cAAc,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,sBAAsB,CAAU,CAAC;IACzG,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,SAAS;QAChD,IAAI,IAAI,CAAC,UAAU,CAAC;YAAE,OAAO,IAAI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E,CAAC;AACjC,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Bootstrap + HMR remount for NativeScript Solid apps.
3
+ *
4
+ * Solid runs with `hot: false` (solid-refresh is off — it rewrites `export
5
+ * function` into a non-hoisted const and breaks TanStack file-route modules), so
6
+ * there is no fine-grained component HMR.
7
+ *
8
+ * Division of labour on each Solid HMR cycle (`__ns_solid_hmr_subscribe`):
9
+ * • ROUTE files — handled by @nativescript/tanstack-router's per-page remount
10
+ * (`subscribeSolidHmrRemount` → `page.__ns_remount`), which swaps the route
11
+ * component in place WITHOUT re-navigating, so the user stays on their route.
12
+ * This helper does nothing for route-only edits.
13
+ * • Everything else (app shell / shared components / app entry) — this helper
14
+ * re-imports the app entry and re-renders the whole Solid tree. The router is
15
+ * REUSED (its chain is never evicted), so the current route is preserved.
16
+ *
17
+ * Renderer bindings (`Application`, `render`, `document`) are passed in rather than
18
+ * imported here so the helper uses the app's exact solid-js / dominative instances.
19
+ * Importing our own copies could resolve to a different module realm and break
20
+ * Solid reactivity (NativeScript can load a package's deps in a separate realm).
21
+ */
22
+ export interface StartSolidAppOptions {
23
+ /** `@nativescript/core` `Application`. */
24
+ Application: {
25
+ run(entry: {
26
+ create: () => any;
27
+ }): void;
28
+ };
29
+ /** `@nativescript-community/solid-js` `render` — mounts a component, returns a disposer. */
30
+ render: (component: any, target: any) => () => void;
31
+ /** dominative `document` — returned as the root view; `document.body` is the mount target. */
32
+ document: any;
33
+ /** Initial root component (used for the first mount). */
34
+ root: any;
35
+ /**
36
+ * App-relative specifier of the module that exports the root component, as
37
+ * `App` or default (e.g. `/src/native/app`). Re-imported fresh on each cycle.
38
+ */
39
+ rootModule: string;
40
+ /**
41
+ * Optional `@nativescript/core` `Frame` class. Pass it when the app uses a
42
+ * topmost-frame router (e.g. solid-navigation's `StackRouter` with
43
+ * `useTopMostFrame`): those routers re-run their initial navigation against
44
+ * `Frame.topmost()` when the fresh tree mounts. During a remount that would
45
+ * target a STALE frame from the old tree (often a nested tab frame) and push
46
+ * a backstack entry per edit. With `Frame` provided, the remount render
47
+ * redirects such navigations to the ROOT frame (`document.documentElement`)
48
+ * with `clearHistory: true`, so each HMR apply swaps the whole tree in place
49
+ * and disposes the old pages instead of stacking on top of them.
50
+ */
51
+ Frame?: any;
52
+ }
53
+ /**
54
+ * Boot a NativeScript Solid app and wire up HMR remounting. Call once from the
55
+ * app entry, e.g.:
56
+ *
57
+ * import './utils/dom';
58
+ * import { Application, Frame } from '@nativescript/core';
59
+ * import { render } from '@nativescript-community/solid-js';
60
+ * import { document } from 'dominative';
61
+ * import { startSolidApp } from '@nativescript/vite/solid-bootstrap';
62
+ * import { App } from './app';
63
+ *
64
+ * // `Frame` is optional — pass it when using a topmost-frame router
65
+ * // (solid-navigation) so HMR remounts replace the root page in place.
66
+ * startSolidApp({ Application, render, document, Frame, root: App, rootModule: '/src/native/app' });
67
+ */
68
+ export declare function startSolidApp(options: StartSolidAppOptions): void;