@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
@@ -10,41 +10,107 @@
10
10
  */
11
11
  export declare function isHmrProgressOverlayEnabled(env?: NodeJS.ProcessEnv): boolean;
12
12
  /**
13
- * Kickstart-eligibility threshold for the parallel HMR prefetch
14
- * (`__nsKickstartHmrPrefetch`).
13
+ * Canonical runtime define VALUES, shared by every emitter:
14
+ * 1. Vite `define` substitution — `getGlobalDefines` below
15
+ * 2. the bundle entry's `virtual:ns-defines-seed` module — main-entry.ts
16
+ * 3. the dev server's per-module shim prelude + guarded platform seed —
17
+ * processCodeForDevice
15
18
  *
16
- * Why a threshold exists. The kickstart fetches the SERVER-computed
17
- * inverse-dep closure (`evictPaths`) in parallel before V8 starts
18
- * its module walk, which is a clean win when the closure size is
19
- * close to what V8 will actually re-evaluate on the next import. For
20
- * a typical Angular component edit (`*.component.ts` / `.html`) the
21
- * closure contains ~5–30 modules and almost all of them sit on the
22
- * live forward path from the entry, so fan-out beats sequential
23
- * `HttpFetchText` calls by 3–5×.
24
- *
25
- * The picture inverts for `.ts` files with deep inverse-dep fan-in
26
- * (constants files, design-system enums, shared utilities). The
27
- * server faithfully reports the entire inverse closure (often
28
- * 100–300 importers), but V8's forward walk on re-import only
29
- * re-evaluates the ~20–30 modules that sit on the currently-rendered
30
- * route's path. The kickstart's parallel wave then over-fetches the
31
- * other ~70–270 importers — and Vite's single-threaded transform
32
- * pipeline cannot keep up with 16-way concurrent demand, so each
33
- * fetch's tail latency balloons. Net result: a "should-be-200ms"
34
- * HMR cycle becomes 6+ seconds.
35
- *
36
- * The threshold short-circuits the kickstart when `evictPaths.length`
37
- * exceeds the configured cap. The HMR cycle still completes
38
- * correctly — V8 falls back to per-module synchronous fetches.
19
+ * All three MUST agree. They used to be maintained by hand in three places,
20
+ * and drift produced the HMR boot bug class where the bundle seed said
21
+ * `__APPLE__ = true` while a served module's shim fell back to `false` and
22
+ * ran Android code paths on iOS. Add new defines HERE, then thread them
23
+ * through the builders below.
24
+ */
25
+ export interface RuntimeDefineValues {
26
+ __DEV__: boolean;
27
+ __ANDROID__: boolean;
28
+ __IOS__: boolean;
29
+ __VISIONOS__: boolean;
30
+ __APPLE__: boolean;
31
+ __COMMONJS__: boolean;
32
+ __NS_WEBPACK__: boolean;
33
+ __NS_ENV_VERBOSE__: boolean;
34
+ __UI_USE_XML_PARSER__: boolean;
35
+ __UI_USE_EXTERNAL_RENDERER__: boolean;
36
+ __CSS_PARSER__: string;
37
+ __TEST__: boolean;
38
+ }
39
+ export declare function getRuntimeDefineValues(opts: {
40
+ platform?: string;
41
+ isDevMode: boolean;
42
+ verbose: boolean;
43
+ }): RuntimeDefineValues;
44
+ /**
45
+ * The COMPLETE set of globals the bundle entry's defines-seed module must
46
+ * plant. Superset of {@link getRuntimeDefineValues}: also carries every
47
+ * `__NS_*__` value that raw-served runtime files consume. Vite's `define`
48
+ * substitution never reaches those files (the HMR client and framework
49
+ * clients are served raw from node_modules/dist), so any define they read
50
+ * MUST also exist on globalThis or its build-time fallback silently wins —
51
+ * which is how `NS_VITE_PROGRESS_OVERLAY=0`
52
+ * historically never reached the device, and how '/src'-defaulted app roots
53
+ * broke 'app/'-rooted projects. Rule: add a define consumed by client code →
54
+ * add it HERE, and read it with a `globalThis` fallback at the consumer.
55
+ */
56
+ export declare function getRuntimeSeedValues(opts: {
57
+ platform?: string;
58
+ isDevMode: boolean;
59
+ verbose: boolean;
60
+ flavor: string;
61
+ isCI?: boolean;
62
+ }): Record<string, unknown>;
63
+ /**
64
+ * Unconditional `globalThis.<key> = <value>;` statements — the bundle entry's
65
+ * defines-seed module body (evaluates as a leaf before any sibling import).
66
+ * Accepts the full seed map; `Infinity` is serialized explicitly because
67
+ * `JSON.stringify(Infinity)` is the string "null".
68
+ */
69
+ export declare function buildGlobalSeedStatements(values: Record<string, unknown>): string[];
70
+ /** @deprecated kept for callers of the platform-only subset; prefer buildGlobalSeedStatements(getRuntimeSeedValues(...)) */
71
+ export declare function buildDefineSeedStatements(values: RuntimeDefineValues): string[];
72
+ /**
73
+ * Guarded seed for the dev server's per-module prelude. Under HMR the bundle's
74
+ * externalized core URL imports evaluate BEFORE the bundle body (ESM: imports
75
+ * run before the importer), so the unconditional seed above has NOT run when
76
+ * the HTTP core graph instantiates. Whichever served module evaluates first
77
+ * runs this and seeds globalThis with the correct platform; later modules and
78
+ * the bundle seed see it already set and no-op.
79
+ */
80
+ export declare function buildGuardedDefineSeedStatement(values: RuntimeDefineValues): string;
81
+ /**
82
+ * `const <key> = globalThis.<key> !== undefined ? globalThis.<key> : <canonical>;`
83
+ * shim statements injected at the top of every HTTP-served module. The
84
+ * fallbacks are the canonical values themselves, so a module snapshots correct
85
+ * platform flags even if it evaluates before ANY seed has run.
86
+ */
87
+ export declare function buildDefineShimStatements(values: RuntimeDefineValues): string[];
88
+ /**
89
+ * Record the app's `__FOO__`-style `define` entries from the resolved Vite
90
+ * config. `global.isIOS` / `import.meta.*` keys are ignored — only bare
91
+ * `__FOO__` identifiers can appear free in app code and get mis-bound. Vite
92
+ * `define` VALUES are JS-expression strings (e.g. `"true"`), so they pass
93
+ * through verbatim; a non-string value is JSON-encoded defensively.
39
94
  *
40
- * Default: 32. Empirically chosen so component-shaped closures
41
- * (typically 5–30) keep the kickstart speed-up while wide-fan-in
42
- * leaf edits (typically 100+) skip it. Override with
43
- * `NS_VITE_KICKSTART_MAX_URLS=N` (any non-negative integer) — `0`
44
- * disables the kickstart entirely; `Infinity` removes the cap.
95
+ * `process.env.<KEY>` entries are captured SEPARATELY: production bundles get
96
+ * them via Vite's textual substitution, but raw-served HMR modules read the
97
+ * injected `globalThis.process.env` shim — without these entries every
98
+ * dotenv-sourced value (webpack's dotenv-webpack behavior mirrored by app
99
+ * configs via `define`) is silently `undefined` only under HMR (observed:
100
+ * `SHARED_KEYCHAIN_GROUP` missing broke FCUUID shared-keychain device ids).
101
+ * Define values are JS expressions — for the env shim we want the runtime
102
+ * VALUE, so JSON-parse the common `JSON.stringify(...)`-encoded case and fall
103
+ * back to the raw text for anything exotic.
104
+ */
105
+ export declare function setUserDefineEntries(define: Record<string, unknown> | undefined): void;
106
+ /** The captured `process.env.<KEY>` define values (see setUserDefineEntries). */
107
+ export declare function getUserProcessEnvDefineEntries(): Record<string, string>;
108
+ /**
109
+ * Per-module const shims for the captured user defines. `excludeKeys` are the
110
+ * builtin defines already shimmed by {@link buildDefineShimStatements} — skipped
111
+ * here so we never emit a duplicate `const` (a syntax error).
45
112
  */
46
- export declare const HMR_KICKSTART_DEFAULT_MAX_URLS = 32;
47
- export declare function resolveHmrKickstartMaxUrls(env?: NodeJS.ProcessEnv): number;
113
+ export declare function buildUserDefineShimStatements(excludeKeys?: Iterable<string>): string[];
48
114
  export declare function getGlobalDefines(opts: {
49
115
  platform: string;
50
116
  targetMode: string;
@@ -61,10 +127,11 @@ export declare function getGlobalDefines(opts: {
61
127
  __DEV__: string;
62
128
  __COMMONJS__: boolean;
63
129
  __NS_WEBPACK__: boolean;
130
+ __non_webpack_require__: string;
64
131
  __NS_ENV_VERBOSE__: string;
65
132
  __NS_TARGET_FLAVOR__: string;
133
+ __NS_CLIENT_STRATEGY_URL__: string;
66
134
  __NS_HMR_PROGRESS_OVERLAY_ENABLED__: string;
67
- __NS_HMR_KICKSTART_MAX_URLS__: string;
68
135
  __CSS_PARSER__: string;
69
136
  __UI_USE_XML_PARSER__: boolean;
70
137
  __UI_USE_EXTERNAL_RENDERER__: boolean;
@@ -1,4 +1,5 @@
1
1
  import { getProjectAppPath, getProjectAppVirtualPath } from './utils.js';
2
+ import { getClientStrategyDevicePath } from '../hmr/framework-flavors.js';
2
3
  const APP_ROOT_DIR = getProjectAppPath();
3
4
  const APP_ROOT_VIRTUAL = getProjectAppVirtualPath();
4
5
  /**
@@ -17,84 +18,209 @@ export function isHmrProgressOverlayEnabled(env = process.env) {
17
18
  return true;
18
19
  return !['0', 'false', 'off', 'no'].includes(raw);
19
20
  }
21
+ export function getRuntimeDefineValues(opts) {
22
+ const platform = opts.platform || '';
23
+ return {
24
+ __DEV__: !!opts.isDevMode,
25
+ __ANDROID__: platform === 'android',
26
+ __IOS__: platform === 'ios',
27
+ __VISIONOS__: platform === 'visionos',
28
+ __APPLE__: platform === 'ios' || platform === 'visionos',
29
+ __COMMONJS__: false,
30
+ __NS_WEBPACK__: false,
31
+ __NS_ENV_VERBOSE__: !!opts.verbose,
32
+ __UI_USE_XML_PARSER__: true,
33
+ __UI_USE_EXTERNAL_RENDERER__: false,
34
+ __CSS_PARSER__: 'css-tree',
35
+ __TEST__: false,
36
+ };
37
+ }
20
38
  /**
21
- * Kickstart-eligibility threshold for the parallel HMR prefetch
22
- * (`__nsKickstartHmrPrefetch`).
23
- *
24
- * Why a threshold exists. The kickstart fetches the SERVER-computed
25
- * inverse-dep closure (`evictPaths`) in parallel before V8 starts
26
- * its module walk, which is a clean win when the closure size is
27
- * close to what V8 will actually re-evaluate on the next import. For
28
- * a typical Angular component edit (`*.component.ts` / `.html`) the
29
- * closure contains ~5–30 modules and almost all of them sit on the
30
- * live forward path from the entry, so fan-out beats sequential
31
- * `HttpFetchText` calls by 3–5×.
32
- *
33
- * The picture inverts for `.ts` files with deep inverse-dep fan-in
34
- * (constants files, design-system enums, shared utilities). The
35
- * server faithfully reports the entire inverse closure (often
36
- * 100–300 importers), but V8's forward walk on re-import only
37
- * re-evaluates the ~20–30 modules that sit on the currently-rendered
38
- * route's path. The kickstart's parallel wave then over-fetches the
39
- * other ~70–270 importers — and Vite's single-threaded transform
40
- * pipeline cannot keep up with 16-way concurrent demand, so each
41
- * fetch's tail latency balloons. Net result: a "should-be-200ms"
42
- * HMR cycle becomes 6+ seconds.
43
- *
44
- * The threshold short-circuits the kickstart when `evictPaths.length`
45
- * exceeds the configured cap. The HMR cycle still completes
46
- * correctly — V8 falls back to per-module synchronous fetches.
39
+ * The COMPLETE set of globals the bundle entry's defines-seed module must
40
+ * plant. Superset of {@link getRuntimeDefineValues}: also carries every
41
+ * `__NS_*__` value that raw-served runtime files consume. Vite's `define`
42
+ * substitution never reaches those files (the HMR client and framework
43
+ * clients are served raw from node_modules/dist), so any define they read
44
+ * MUST also exist on globalThis or its build-time fallback silently wins —
45
+ * which is how `NS_VITE_PROGRESS_OVERLAY=0`
46
+ * historically never reached the device, and how '/src'-defaulted app roots
47
+ * broke 'app/'-rooted projects. Rule: add a define consumed by client code →
48
+ * add it HERE, and read it with a `globalThis` fallback at the consumer.
49
+ */
50
+ export function getRuntimeSeedValues(opts) {
51
+ const values = getRuntimeDefineValues(opts);
52
+ return {
53
+ ...values,
54
+ // Legacy runtime globals (`global.isIOS` / `global.isAndroid`): the
55
+ // bundle build text-substitutes these member expressions via `define`
56
+ // (see getGlobalDefines), but raw-served HMR modules never get that
57
+ // substitution — app code branching on `global.isIOS` falls into its
58
+ // Android path on iOS. Seed the real globals so member-access reads
59
+ // behave identically under HMR. globalThis-only on purpose: these MUST
60
+ // NOT become per-module `const` shims (buildDefineShimStatements), or
61
+ // they'd collide with `import { isIOS } from '@nativescript/core'`.
62
+ isAndroid: values.__ANDROID__,
63
+ isIOS: values.__APPLE__,
64
+ // Runtime flavor for the raw-served HMR client's TARGET_FLAVOR resolution.
65
+ __NS_TARGET_FLAVOR__: opts.flavor,
66
+ // Device path of a registered (non built-in) flavor's client strategy;
67
+ // '' for built-ins, which the client resolves from its own package.
68
+ __NS_CLIENT_STRATEGY_URL__: getClientStrategyDevicePath(opts.flavor),
69
+ // App-root virtual path — every served-id → moduleName mapping (frame
70
+ // navigation targets, modal re-present matching) depends on this.
71
+ __NS_APP_ROOT_DIR__: APP_ROOT_DIR,
72
+ __NS_APP_ROOT_VIRTUAL__: APP_ROOT_VIRTUAL,
73
+ // HMR-applying overlay opt-out (NS_VITE_PROGRESS_OVERLAY=0).
74
+ __NS_HMR_PROGRESS_OVERLAY_ENABLED__: isHmrProgressOverlayEnabled(),
75
+ __CI__: !!opts.isCI,
76
+ };
77
+ }
78
+ /**
79
+ * Unconditional `globalThis.<key> = <value>;` statements — the bundle entry's
80
+ * defines-seed module body (evaluates as a leaf before any sibling import).
81
+ * Accepts the full seed map; `Infinity` is serialized explicitly because
82
+ * `JSON.stringify(Infinity)` is the string "null".
83
+ */
84
+ export function buildGlobalSeedStatements(values) {
85
+ return Object.entries(values).map(([key, value]) => `globalThis.${key} = ${typeof value === 'number' && !Number.isFinite(value) ? 'Infinity' : JSON.stringify(value)};`);
86
+ }
87
+ /** @deprecated kept for callers of the platform-only subset; prefer buildGlobalSeedStatements(getRuntimeSeedValues(...)) */
88
+ export function buildDefineSeedStatements(values) {
89
+ return buildGlobalSeedStatements(values);
90
+ }
91
+ /**
92
+ * Guarded seed for the dev server's per-module prelude. Under HMR the bundle's
93
+ * externalized core URL imports evaluate BEFORE the bundle body (ESM: imports
94
+ * run before the importer), so the unconditional seed above has NOT run when
95
+ * the HTTP core graph instantiates. Whichever served module evaluates first
96
+ * runs this and seeds globalThis with the correct platform; later modules and
97
+ * the bundle seed see it already set and no-op.
98
+ */
99
+ export function buildGuardedDefineSeedStatement(values) {
100
+ // `isIOS`/`isAndroid` mirror the bundle build's `global.isIOS` /
101
+ // `global.isAndroid` defines (getGlobalDefines) — raw-served modules get no
102
+ // text substitution, so the real globals must exist for member-access reads.
103
+ // Guarded separately from `__IOS__` because a bundle seed may already have
104
+ // planted one set but not the other.
105
+ return `if (globalThis.__IOS__ === undefined && globalThis.__ANDROID__ === undefined) { globalThis.__ANDROID__ = ${values.__ANDROID__}; globalThis.__IOS__ = ${values.__IOS__}; globalThis.__VISIONOS__ = ${values.__VISIONOS__}; globalThis.__APPLE__ = ${values.__APPLE__}; }\nif (globalThis.isIOS === undefined && globalThis.isAndroid === undefined) { globalThis.isAndroid = ${values.__ANDROID__}; globalThis.isIOS = ${values.__APPLE__}; }\nif (globalThis.__DEV__ === undefined) { globalThis.__DEV__ = ${values.__DEV__}; }`;
106
+ }
107
+ /**
108
+ * `const <key> = globalThis.<key> !== undefined ? globalThis.<key> : <canonical>;`
109
+ * shim statements injected at the top of every HTTP-served module. The
110
+ * fallbacks are the canonical values themselves, so a module snapshots correct
111
+ * platform flags even if it evaluates before ANY seed has run.
112
+ */
113
+ export function buildDefineShimStatements(values) {
114
+ return Object.entries(values).map(([key, value]) => `const ${key} = globalThis.${key} !== undefined ? globalThis.${key} : ${JSON.stringify(value)};`);
115
+ }
116
+ // ── User-configured `__FOO__` defines ─────────────────────────────────────────
117
+ // An app may add its own `__FOO__`-style entries to Vite `config.define`
118
+ // (e.g. `__NS_NATIVE_OVERRIDES__`). In a production bundle Vite text-substitutes
119
+ // them, but NS's HMR pipeline serves raw modules where that substitution never
120
+ // runs — and the AST normalizer then mis-reads the free `__FOO__` identifier as
121
+ // an `/ns/rt` helper and binds it from the runtime bridge (which doesn't export
122
+ // it) → `undefined` under HMR while the bundle had the real value. Emitting a
123
+ // per-module const shim (exactly like the builtin defines above) gives the
124
+ // identifier a binding the normalizer leaves alone AND the correct value, so HMR
125
+ // matches the bundle. Captured from the resolved config in `configResolved`.
126
+ const USER_DEFINE_IDENTIFIER_RE = /^__[A-Za-z0-9_]+__$/;
127
+ const USER_PROCESS_ENV_DEFINE_RE = /^process\.env\.([A-Za-z_$][\w$]*)$/;
128
+ let userDefineEntries = [];
129
+ let userProcessEnvDefineEntries = {};
130
+ /**
131
+ * Record the app's `__FOO__`-style `define` entries from the resolved Vite
132
+ * config. `global.isIOS` / `import.meta.*` keys are ignored — only bare
133
+ * `__FOO__` identifiers can appear free in app code and get mis-bound. Vite
134
+ * `define` VALUES are JS-expression strings (e.g. `"true"`), so they pass
135
+ * through verbatim; a non-string value is JSON-encoded defensively.
47
136
  *
48
- * Default: 32. Empirically chosen so component-shaped closures
49
- * (typically 5–30) keep the kickstart speed-up while wide-fan-in
50
- * leaf edits (typically 100+) skip it. Override with
51
- * `NS_VITE_KICKSTART_MAX_URLS=N` (any non-negative integer) — `0`
52
- * disables the kickstart entirely; `Infinity` removes the cap.
137
+ * `process.env.<KEY>` entries are captured SEPARATELY: production bundles get
138
+ * them via Vite's textual substitution, but raw-served HMR modules read the
139
+ * injected `globalThis.process.env` shim — without these entries every
140
+ * dotenv-sourced value (webpack's dotenv-webpack behavior mirrored by app
141
+ * configs via `define`) is silently `undefined` only under HMR (observed:
142
+ * `SHARED_KEYCHAIN_GROUP` missing broke FCUUID shared-keychain device ids).
143
+ * Define values are JS expressions — for the env shim we want the runtime
144
+ * VALUE, so JSON-parse the common `JSON.stringify(...)`-encoded case and fall
145
+ * back to the raw text for anything exotic.
53
146
  */
54
- export const HMR_KICKSTART_DEFAULT_MAX_URLS = 32;
55
- export function resolveHmrKickstartMaxUrls(env = process.env) {
56
- const raw = (env.NS_VITE_KICKSTART_MAX_URLS ?? '').toString().trim();
57
- if (!raw)
58
- return HMR_KICKSTART_DEFAULT_MAX_URLS;
59
- const lower = raw.toLowerCase();
60
- if (lower === 'infinity' || lower === 'unlimited' || lower === 'none') {
61
- return Number.POSITIVE_INFINITY;
62
- }
63
- const parsed = Number(raw);
64
- if (!Number.isFinite(parsed) || parsed < 0) {
65
- return HMR_KICKSTART_DEFAULT_MAX_URLS;
147
+ export function setUserDefineEntries(define) {
148
+ const entries = [];
149
+ const envEntries = {};
150
+ if (define) {
151
+ for (const [key, value] of Object.entries(define)) {
152
+ const envMatch = USER_PROCESS_ENV_DEFINE_RE.exec(key);
153
+ if (envMatch) {
154
+ const expr = typeof value === 'string' ? value : JSON.stringify(value);
155
+ // A missing dotenv key is commonly defined as the literal
156
+ // `undefined` expression (correct for text substitution). The
157
+ // env-shim equivalent is ABSENCE — stringifying it would make
158
+ // `process.env.X` the string "undefined" on device (observed as
159
+ // a login field prefilled with the text "undefined").
160
+ if (expr === undefined || expr === 'undefined' || expr === 'null') {
161
+ continue;
162
+ }
163
+ let resolved = expr;
164
+ try {
165
+ const parsed = JSON.parse(expr);
166
+ resolved = typeof parsed === 'string' ? parsed : String(parsed);
167
+ }
168
+ catch {
169
+ // Not JSON (a raw code expression) — keep the text verbatim.
170
+ }
171
+ envEntries[envMatch[1]] = resolved;
172
+ continue;
173
+ }
174
+ if (!USER_DEFINE_IDENTIFIER_RE.test(key))
175
+ continue;
176
+ entries.push([key, typeof value === 'string' ? value : JSON.stringify(value)]);
177
+ }
66
178
  }
67
- return Math.floor(parsed);
179
+ userDefineEntries = entries;
180
+ userProcessEnvDefineEntries = envEntries;
181
+ }
182
+ /** The captured `process.env.<KEY>` define values (see setUserDefineEntries). */
183
+ export function getUserProcessEnvDefineEntries() {
184
+ return userProcessEnvDefineEntries;
185
+ }
186
+ /**
187
+ * Per-module const shims for the captured user defines. `excludeKeys` are the
188
+ * builtin defines already shimmed by {@link buildDefineShimStatements} — skipped
189
+ * here so we never emit a duplicate `const` (a syntax error).
190
+ */
191
+ export function buildUserDefineShimStatements(excludeKeys = []) {
192
+ const exclude = new Set(excludeKeys);
193
+ return userDefineEntries.filter(([key]) => !exclude.has(key)).map(([key, expr]) => `const ${key} = globalThis.${key} !== undefined ? globalThis.${key} : (${expr});`);
68
194
  }
69
195
  export function getGlobalDefines(opts) {
196
+ const values = getRuntimeDefineValues({ platform: opts.platform, isDevMode: opts.targetMode === 'development', verbose: opts.verbose });
70
197
  return {
71
198
  // Define platform flags for runtime checks
72
- __ANDROID__: JSON.stringify(opts.platform === 'android'),
73
- __IOS__: JSON.stringify(opts.platform === 'ios'),
74
- __VISIONOS__: JSON.stringify(opts.platform === 'visionos'),
75
- __APPLE__: JSON.stringify(opts.platform === 'ios' || opts.platform === 'visionos'),
76
- 'global.isAndroid': JSON.stringify(opts.platform === 'android'),
77
- 'global.isIOS': JSON.stringify(opts.platform === 'ios' || opts.platform === 'visionos'),
78
- __DEV__: JSON.stringify(opts.targetMode === 'development'),
79
- __COMMONJS__: false,
80
- __NS_WEBPACK__: false,
81
- __NS_ENV_VERBOSE__: JSON.stringify(opts.verbose),
199
+ __ANDROID__: JSON.stringify(values.__ANDROID__),
200
+ __IOS__: JSON.stringify(values.__IOS__),
201
+ __VISIONOS__: JSON.stringify(values.__VISIONOS__),
202
+ __APPLE__: JSON.stringify(values.__APPLE__),
203
+ 'global.isAndroid': JSON.stringify(values.__ANDROID__),
204
+ 'global.isIOS': JSON.stringify(values.__APPLE__),
205
+ __DEV__: JSON.stringify(values.__DEV__),
206
+ __COMMONJS__: values.__COMMONJS__,
207
+ __NS_WEBPACK__: values.__NS_WEBPACK__,
208
+ // webpack exposes `__non_webpack_require__` (its APIPlugin) as the native,
209
+ // non-bundler require. Some NativeScript plugins (e.g. @nativescript/firebase-core's
210
+ // Android config reader) reference it unguarded. Map it to the runtime's
211
+ // global require so those plugins work under Vite/Rolldown too. Raw
212
+ // expression (NOT JSON.stringified) so it substitutes as code, not a string.
213
+ __non_webpack_require__: 'globalThis.require',
214
+ __NS_ENV_VERBOSE__: JSON.stringify(values.__NS_ENV_VERBOSE__),
82
215
  __NS_TARGET_FLAVOR__: JSON.stringify(opts.flavor),
216
+ __NS_CLIENT_STRATEGY_URL__: JSON.stringify(getClientStrategyDevicePath(opts.flavor)),
83
217
  // whether to show the HMR in-progress overlay.
84
218
  __NS_HMR_PROGRESS_OVERLAY_ENABLED__: JSON.stringify(isHmrProgressOverlayEnabled()),
85
- // Eviction-set size cap for the parallel HMR kickstart.
86
- // `JSON.stringify(Number.POSITIVE_INFINITY)` is the string
87
- // "null", so we serialize Infinity ourselves to keep the
88
- // build-time literal readable in source maps.
89
- __NS_HMR_KICKSTART_MAX_URLS__: (() => {
90
- const n = resolveHmrKickstartMaxUrls();
91
- return Number.isFinite(n) ? String(n) : 'Infinity';
92
- })(),
93
- __CSS_PARSER__: JSON.stringify('css-tree'),
94
- __UI_USE_XML_PARSER__: true,
95
- __UI_USE_EXTERNAL_RENDERER__: false,
219
+ __CSS_PARSER__: JSON.stringify(values.__CSS_PARSER__),
220
+ __UI_USE_XML_PARSER__: values.__UI_USE_XML_PARSER__,
221
+ __UI_USE_EXTERNAL_RENDERER__: values.__UI_USE_EXTERNAL_RENDERER__,
96
222
  // various ecosystems use this global (react for example)
97
- __TEST__: false,
223
+ __TEST__: values.__TEST__,
98
224
  // determine if running in CI environment
99
225
  __CI__: JSON.stringify(!!opts.isCI),
100
226
  __NS_APP_ROOT_DIR__: JSON.stringify(APP_ROOT_DIR),
@@ -1 +1 @@
1
- {"version":3,"file":"global-defines.js","sourceRoot":"","sources":["../../../../packages/vite/hel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SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnC,mBAAmB,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC;QACjD,uBAAuB,EAAE,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC;QACzD,2FAA2F;QAC3F,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,YAAY,CAAC;KACxG,CAAC;AACH,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Absolute directories HMR is allowed to react to:
3
+ * - the app source dir (`appPath`, default `src`)
4
+ * - shared-library roots from tsconfig `paths` (monorepo libs)
5
+ *
6
+ * Pass the project's tsconfig data (`{ paths, baseUrl }` from `getTsConfigData`)
7
+ * to include configured workspace libraries. Always includes the app source dir.
8
+ */
9
+ export declare function getHmrSourceRoots(tsConfig?: {
10
+ paths?: Record<string, string[]>;
11
+ baseUrl?: string;
12
+ }): string[];
13
+ /**
14
+ * True when `file` lives inside one of the HMR source roots (app source dir or a
15
+ * configured shared-library root). Accepts absolute paths with either separator
16
+ * style and strips any query/hash suffix (`…/app.component.ts?ngResource`).
17
+ */
18
+ export declare function isWithinHmrScope(file: string, roots: string[]): boolean;
19
+ /**
20
+ * Minimal glob list for `server.watch.ignored`. This is a *performance* guard,
21
+ * NOT the correctness gate (that's the {@link isWithinHmrScope} allowlist applied
22
+ * in `handleHotUpdate`). It keeps chokidar from walking the large native/generated
23
+ * trees that live under the app root. Vite already ignores `node_modules` and
24
+ * `.git` by default; these are the NativeScript-specific additions.
25
+ */
26
+ export declare function getHmrWatchIgnoreGlobs(distOutputFolder?: string): string[];
@@ -0,0 +1,67 @@
1
+ // Defines which files HMR is allowed to react to; an allowlist driven by the
2
+ // project's own configuration.
3
+ import { getProjectAppAbsolutePath } from './utils.js';
4
+ import { getTsConfigAliasRoots } from './ts-config-paths.js';
5
+ import { normalizeModuleId } from './normalize-id.js';
6
+ // Canonical root form: forward slashes, uppercase Windows drive, no trailing slash.
7
+ function asRoot(p) {
8
+ return normalizeModuleId(String(p || '')).replace(/\/+$/, '');
9
+ }
10
+ /**
11
+ * Absolute directories HMR is allowed to react to:
12
+ * - the app source dir (`appPath`, default `src`)
13
+ * - shared-library roots from tsconfig `paths` (monorepo libs)
14
+ *
15
+ * Pass the project's tsconfig data (`{ paths, baseUrl }` from `getTsConfigData`)
16
+ * to include configured workspace libraries. Always includes the app source dir.
17
+ */
18
+ export function getHmrSourceRoots(tsConfig) {
19
+ const roots = new Set();
20
+ const appDir = asRoot(getProjectAppAbsolutePath());
21
+ if (appDir)
22
+ roots.add(appDir);
23
+ for (const aliasRoot of getTsConfigAliasRoots({ paths: tsConfig?.paths, baseUrl: tsConfig?.baseUrl })) {
24
+ const r = asRoot(aliasRoot);
25
+ if (r)
26
+ roots.add(r);
27
+ }
28
+ return [...roots];
29
+ }
30
+ /**
31
+ * True when `file` lives inside one of the HMR source roots (app source dir or a
32
+ * configured shared-library root). Accepts absolute paths with either separator
33
+ * style and strips any query/hash suffix (`…/app.component.ts?ngResource`).
34
+ */
35
+ export function isWithinHmrScope(file, roots) {
36
+ if (!file || !roots || roots.length === 0)
37
+ return false;
38
+ const f = normalizeModuleId(String(file).replace(/[?#].*$/, ''));
39
+ for (const root of roots) {
40
+ if (!root)
41
+ continue;
42
+ if (f === root || f.startsWith(root + '/'))
43
+ return true;
44
+ }
45
+ return false;
46
+ }
47
+ /**
48
+ * Minimal glob list for `server.watch.ignored`. This is a *performance* guard,
49
+ * NOT the correctness gate (that's the {@link isWithinHmrScope} allowlist applied
50
+ * in `handleHotUpdate`). It keeps chokidar from walking the large native/generated
51
+ * trees that live under the app root. Vite already ignores `node_modules` and
52
+ * `.git` by default; these are the NativeScript-specific additions.
53
+ */
54
+ export function getHmrWatchIgnoreGlobs(distOutputFolder) {
55
+ const globs = ['**/platforms/**', '**/hooks/**', '**/App_Resources/**', '**/.ns-vite-build/**'];
56
+ if (distOutputFolder) {
57
+ const clean = distOutputFolder
58
+ .replace(/\\/g, '/')
59
+ .replace(/^\.\/+/, '')
60
+ .replace(/\/+$/, '');
61
+ if (clean && clean !== '.ns-vite-build') {
62
+ globs.push(`**/${clean}/**`);
63
+ }
64
+ }
65
+ return globs;
66
+ }
67
+ //# sourceMappingURL=hmr-scope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hmr-scope.js","sourceRoot":"","sources":["../../../../packages/vite/helpers/hmr-scope.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+BAA+B;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,oFAAoF;AACpF,SAAS,MAAM,CAAC,CAAS;IACxB,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiE;IAClG,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,CAAC,yBAAyB,EAAE,CAAC,CAAC;IACnD,IAAI,MAAM;QAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,KAAK,MAAM,SAAS,IAAI,qBAAqB,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QACvG,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC;QAC5B,IAAI,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,GAAG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