@nativescript/vite 8.0.0-alpha.6 → 8.0.0-alpha.61

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 (465) hide show
  1. package/README.md +51 -11
  2. package/bin/cli.cjs +8 -14
  3. package/configuration/angular.d.ts +34 -1
  4. package/configuration/angular.js +390 -165
  5. package/configuration/angular.js.map +1 -1
  6. package/configuration/base.js +244 -53
  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-state.d.ts +8 -0
  19. package/helpers/app-css-state.js +8 -0
  20. package/helpers/app-css-state.js.map +1 -0
  21. package/helpers/bundler-context.d.ts +11 -0
  22. package/helpers/bundler-context.js +71 -0
  23. package/helpers/bundler-context.js.map +1 -0
  24. package/helpers/cli-flags.d.ts +12 -0
  25. package/helpers/cli-flags.js +34 -0
  26. package/helpers/cli-flags.js.map +1 -1
  27. package/helpers/css-platform-plugin.d.ts +14 -0
  28. package/helpers/css-platform-plugin.js +43 -25
  29. package/helpers/css-platform-plugin.js.map +1 -1
  30. package/helpers/dev-host.d.ts +360 -0
  31. package/helpers/dev-host.js +694 -0
  32. package/helpers/dev-host.js.map +1 -0
  33. package/helpers/dynamic-import-plugin.js +9 -4
  34. package/helpers/dynamic-import-plugin.js.map +1 -1
  35. package/helpers/esbuild-platform-resolver.js +4 -1
  36. package/helpers/esbuild-platform-resolver.js.map +1 -1
  37. package/helpers/external-configs.d.ts +10 -12
  38. package/helpers/external-configs.js +58 -35
  39. package/helpers/external-configs.js.map +1 -1
  40. package/helpers/global-defines.d.ts +100 -13
  41. package/helpers/global-defines.js +165 -28
  42. package/helpers/global-defines.js.map +1 -1
  43. package/helpers/hmr-scope.d.ts +26 -0
  44. package/helpers/hmr-scope.js +67 -0
  45. package/helpers/hmr-scope.js.map +1 -0
  46. package/helpers/init.js +0 -18
  47. package/helpers/init.js.map +1 -1
  48. package/helpers/logging.js +29 -1
  49. package/helpers/logging.js.map +1 -1
  50. package/helpers/main-entry.d.ts +4 -1
  51. package/helpers/main-entry.js +368 -53
  52. package/helpers/main-entry.js.map +1 -1
  53. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  54. package/helpers/nativeclass-esbuild-plugin.js +6 -1
  55. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  56. package/helpers/nativeclass-transform.d.ts +13 -0
  57. package/helpers/nativeclass-transform.js +37 -7
  58. package/helpers/nativeclass-transform.js.map +1 -1
  59. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  60. package/helpers/nativeclass-transformer-plugin.js +163 -15
  61. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  62. package/helpers/nativescript-package-resolver.js +10 -62
  63. package/helpers/nativescript-package-resolver.js.map +1 -1
  64. package/helpers/normalize-id.d.ts +42 -0
  65. package/helpers/normalize-id.js +60 -0
  66. package/helpers/normalize-id.js.map +1 -0
  67. package/helpers/ns-core-url.d.ts +29 -7
  68. package/helpers/ns-core-url.js +69 -12
  69. package/helpers/ns-core-url.js.map +1 -1
  70. package/helpers/optimize-deps.d.ts +16 -0
  71. package/helpers/optimize-deps.js +17 -0
  72. package/helpers/optimize-deps.js.map +1 -0
  73. package/helpers/package-platform-aliases.js +34 -49
  74. package/helpers/package-platform-aliases.js.map +1 -1
  75. package/helpers/platform-types.d.ts +2 -0
  76. package/helpers/platform-types.js +2 -0
  77. package/helpers/platform-types.js.map +1 -0
  78. package/helpers/postcss-platform-config.d.ts +17 -1
  79. package/helpers/postcss-platform-config.js +20 -37
  80. package/helpers/postcss-platform-config.js.map +1 -1
  81. package/helpers/project.d.ts +35 -0
  82. package/helpers/project.js +120 -2
  83. package/helpers/project.js.map +1 -1
  84. package/helpers/resolve-main-field-platform.d.ts +20 -0
  85. package/helpers/resolve-main-field-platform.js +49 -0
  86. package/helpers/resolve-main-field-platform.js.map +1 -0
  87. package/helpers/resolver.js +17 -2
  88. package/helpers/resolver.js.map +1 -1
  89. package/helpers/theme-core-plugins.js +1 -1
  90. package/helpers/theme-core-plugins.js.map +1 -1
  91. package/helpers/ts-config-paths.d.ts +32 -0
  92. package/helpers/ts-config-paths.js +156 -27
  93. package/helpers/ts-config-paths.js.map +1 -1
  94. package/helpers/typescript-check.d.ts +2 -1
  95. package/helpers/typescript-check.js +2 -2
  96. package/helpers/typescript-check.js.map +1 -1
  97. package/helpers/ui-registration.d.ts +21 -0
  98. package/helpers/ui-registration.js +156 -0
  99. package/helpers/ui-registration.js.map +1 -0
  100. package/helpers/utils.d.ts +9 -0
  101. package/helpers/utils.js +22 -2
  102. package/helpers/utils.js.map +1 -1
  103. package/helpers/vite-package-version.d.ts +7 -0
  104. package/helpers/vite-package-version.js +44 -0
  105. package/helpers/vite-package-version.js.map +1 -0
  106. package/helpers/workers.d.ts +48 -19
  107. package/helpers/workers.js +662 -13
  108. package/helpers/workers.js.map +1 -1
  109. package/hmr/client/css-handler.d.ts +2 -1
  110. package/hmr/client/css-handler.js +50 -26
  111. package/hmr/client/css-handler.js.map +1 -1
  112. package/hmr/client/css-update-overlay.d.ts +18 -0
  113. package/hmr/client/css-update-overlay.js +27 -0
  114. package/hmr/client/css-update-overlay.js.map +1 -0
  115. package/hmr/client/framework-client-strategy.d.ts +79 -0
  116. package/hmr/client/framework-client-strategy.js +19 -0
  117. package/hmr/client/framework-client-strategy.js.map +1 -0
  118. package/hmr/client/hmr-pending-overlay.d.ts +0 -14
  119. package/hmr/client/hmr-pending-overlay.js +14 -4
  120. package/hmr/client/hmr-pending-overlay.js.map +1 -1
  121. package/hmr/client/hot-context.d.ts +67 -0
  122. package/hmr/client/hot-context.js +284 -0
  123. package/hmr/client/hot-context.js.map +1 -0
  124. package/hmr/client/index.js +922 -273
  125. package/hmr/client/index.js.map +1 -1
  126. package/hmr/client/utils.d.ts +2 -1
  127. package/hmr/client/utils.js +111 -99
  128. package/hmr/client/utils.js.map +1 -1
  129. package/hmr/entry-runtime.d.ts +2 -1
  130. package/hmr/entry-runtime.js +279 -71
  131. package/hmr/entry-runtime.js.map +1 -1
  132. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  133. package/hmr/frameworks/angular/build/angular-linker.js +109 -0
  134. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  135. package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
  136. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
  137. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  138. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  139. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  140. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  141. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  142. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  143. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  144. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  145. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  146. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  147. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  148. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  149. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  150. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  151. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  152. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  153. package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
  154. package/hmr/frameworks/angular/build/util.js +155 -0
  155. package/hmr/frameworks/angular/build/util.js.map +1 -0
  156. package/hmr/frameworks/angular/client/index.js +542 -175
  157. package/hmr/frameworks/angular/client/index.js.map +1 -1
  158. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  159. package/hmr/frameworks/angular/client/strategy.js +19 -0
  160. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  161. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  162. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  163. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  164. package/hmr/frameworks/angular/server/linker.js +1 -4
  165. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  166. package/hmr/frameworks/angular/server/strategy.js +458 -12
  167. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  168. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  169. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  170. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +14 -11
  171. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +108 -111
  172. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  173. package/hmr/frameworks/react/server/strategy.d.ts +2 -0
  174. package/hmr/frameworks/react/server/strategy.js +230 -0
  175. package/hmr/frameworks/react/server/strategy.js.map +1 -0
  176. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  177. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  178. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  179. package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
  180. package/hmr/frameworks/solid/client/app-runtime.js +246 -0
  181. package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
  182. package/hmr/frameworks/solid/server/strategy.js +291 -16
  183. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  184. package/hmr/frameworks/typescript/server/strategy.js +38 -14
  185. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  186. package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
  187. package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
  188. package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
  189. package/hmr/frameworks/vue/client/index.d.ts +9 -0
  190. package/hmr/frameworks/vue/client/index.js +251 -247
  191. package/hmr/frameworks/vue/client/index.js.map +1 -1
  192. package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
  193. package/hmr/frameworks/vue/client/strategy.js +157 -0
  194. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  195. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
  196. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +142 -0
  197. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  198. package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
  199. package/hmr/frameworks/vue/server/compiler.js +3 -1
  200. package/hmr/frameworks/vue/server/compiler.js.map +1 -1
  201. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  202. package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
  203. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  204. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  205. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  206. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  207. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  208. package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
  209. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  210. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
  211. package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
  212. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  213. package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
  214. package/hmr/frameworks/vue/server/strategy.js +286 -7
  215. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  216. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  217. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  218. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  219. package/hmr/helpers/ast-normalizer.d.ts +3 -1
  220. package/hmr/helpers/ast-normalizer.js +77 -10
  221. package/hmr/helpers/ast-normalizer.js.map +1 -1
  222. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  223. package/hmr/helpers/cjs-named-exports.js +152 -0
  224. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  225. package/hmr/helpers/package-exports.d.ts +16 -0
  226. package/hmr/helpers/package-exports.js +396 -0
  227. package/hmr/helpers/package-exports.js.map +1 -0
  228. package/hmr/helpers/vendor-rewrite.d.ts +1 -1
  229. package/hmr/helpers/vendor-rewrite.js +5 -3
  230. package/hmr/helpers/vendor-rewrite.js.map +1 -1
  231. package/hmr/server/boot-archive-route.d.ts +40 -0
  232. package/hmr/server/boot-archive-route.js +154 -0
  233. package/hmr/server/boot-archive-route.js.map +1 -0
  234. package/hmr/server/boot-closure-route.d.ts +49 -0
  235. package/hmr/server/boot-closure-route.js +144 -0
  236. package/hmr/server/boot-closure-route.js.map +1 -0
  237. package/hmr/server/boot-recording.d.ts +58 -0
  238. package/hmr/server/boot-recording.js +228 -0
  239. package/hmr/server/boot-recording.js.map +1 -0
  240. package/hmr/server/constants.js +20 -5
  241. package/hmr/server/constants.js.map +1 -1
  242. package/hmr/server/core-bundle.d.ts +140 -0
  243. package/hmr/server/core-bundle.js +614 -0
  244. package/hmr/server/core-bundle.js.map +1 -0
  245. package/hmr/server/core-sanitize.d.ts +86 -7
  246. package/hmr/server/core-sanitize.js +170 -45
  247. package/hmr/server/core-sanitize.js.map +1 -1
  248. package/hmr/server/css-device-module.d.ts +28 -0
  249. package/hmr/server/css-device-module.js +44 -0
  250. package/hmr/server/css-device-module.js.map +1 -0
  251. package/hmr/server/deps-bundle.d.ts +218 -0
  252. package/hmr/server/deps-bundle.js +998 -0
  253. package/hmr/server/deps-bundle.js.map +1 -0
  254. package/hmr/server/device-transform-helpers.d.ts +24 -0
  255. package/hmr/server/device-transform-helpers.js +408 -0
  256. package/hmr/server/device-transform-helpers.js.map +1 -0
  257. package/hmr/server/framework-strategy.d.ts +113 -11
  258. package/hmr/server/hmr-module-graph.d.ts +37 -0
  259. package/hmr/server/hmr-module-graph.js +215 -0
  260. package/hmr/server/hmr-module-graph.js.map +1 -0
  261. package/hmr/server/import-map.d.ts +13 -4
  262. package/hmr/server/import-map.js +94 -47
  263. package/hmr/server/import-map.js.map +1 -1
  264. package/hmr/server/index.js +7 -16
  265. package/hmr/server/index.js.map +1 -1
  266. package/hmr/server/ns-core-cjs-shape.d.ts +2 -4
  267. package/hmr/server/ns-core-cjs-shape.js +4 -6
  268. package/hmr/server/ns-core-cjs-shape.js.map +1 -1
  269. package/hmr/server/ns-m-response-memo.d.ts +10 -0
  270. package/hmr/server/ns-m-response-memo.js +33 -0
  271. package/hmr/server/ns-m-response-memo.js.map +1 -0
  272. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  273. package/hmr/server/ns-rt-bridge.js +131 -0
  274. package/hmr/server/ns-rt-bridge.js.map +1 -0
  275. package/hmr/server/ns-rt-route.d.ts +5 -0
  276. package/hmr/server/ns-rt-route.js +39 -0
  277. package/hmr/server/ns-rt-route.js.map +1 -0
  278. package/hmr/server/perf-instrumentation.d.ts +6 -10
  279. package/hmr/server/perf-instrumentation.js +5 -6
  280. package/hmr/server/perf-instrumentation.js.map +1 -1
  281. package/hmr/server/process-code-for-device.d.ts +30 -0
  282. package/hmr/server/process-code-for-device.js +791 -0
  283. package/hmr/server/process-code-for-device.js.map +1 -0
  284. package/hmr/server/require-guard.d.ts +1 -0
  285. package/hmr/server/require-guard.js +12 -0
  286. package/hmr/server/require-guard.js.map +1 -0
  287. package/hmr/server/rewrite-imports.d.ts +2 -0
  288. package/hmr/server/rewrite-imports.js +638 -0
  289. package/hmr/server/rewrite-imports.js.map +1 -0
  290. package/hmr/server/route-helpers.d.ts +7 -0
  291. package/hmr/server/route-helpers.js +13 -0
  292. package/hmr/server/route-helpers.js.map +1 -0
  293. package/hmr/server/server-origin.d.ts +2 -0
  294. package/hmr/server/server-origin.js +83 -0
  295. package/hmr/server/server-origin.js.map +1 -0
  296. package/hmr/server/shared-transform-request.js +1 -2
  297. package/hmr/server/shared-transform-request.js.map +1 -1
  298. package/hmr/server/transform-cache-invalidation.d.ts +37 -0
  299. package/hmr/server/transform-cache-invalidation.js +156 -0
  300. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  301. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  302. package/hmr/server/vendor-bare-module-shims.js +80 -0
  303. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  304. package/hmr/server/vite-plugin.d.ts +1 -0
  305. package/hmr/server/vite-plugin.js +180 -54
  306. package/hmr/server/vite-plugin.js.map +1 -1
  307. package/hmr/server/websocket-core-bridge.d.ts +51 -4
  308. package/hmr/server/websocket-core-bridge.js +62 -54
  309. package/hmr/server/websocket-core-bridge.js.map +1 -1
  310. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  311. package/hmr/server/websocket-css-hot-update.js +65 -0
  312. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  313. package/hmr/server/websocket-device-transform.d.ts +3 -0
  314. package/hmr/server/websocket-device-transform.js +7 -0
  315. package/hmr/server/websocket-device-transform.js.map +1 -0
  316. package/hmr/server/websocket-hmr-pending.d.ts +3 -9
  317. package/hmr/server/websocket-hmr-pending.js +1 -1
  318. package/hmr/server/websocket-hmr-pending.js.map +1 -1
  319. package/hmr/server/websocket-hot-update.d.ts +77 -0
  320. package/hmr/server/websocket-hot-update.js +360 -0
  321. package/hmr/server/websocket-hot-update.js.map +1 -0
  322. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  323. package/hmr/server/websocket-import-map-route.js +50 -0
  324. package/hmr/server/websocket-import-map-route.js.map +1 -0
  325. package/hmr/server/websocket-module-bindings.js +3 -3
  326. package/hmr/server/websocket-module-bindings.js.map +1 -1
  327. package/hmr/server/websocket-module-specifiers.d.ts +66 -2
  328. package/hmr/server/websocket-module-specifiers.js +191 -20
  329. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  330. package/hmr/server/websocket-ns-core.d.ts +34 -0
  331. package/hmr/server/websocket-ns-core.js +414 -0
  332. package/hmr/server/websocket-ns-core.js.map +1 -0
  333. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  334. package/hmr/server/websocket-ns-entry.js +164 -0
  335. package/hmr/server/websocket-ns-entry.js.map +1 -0
  336. package/hmr/server/websocket-ns-m-paths.d.ts +1 -3
  337. package/hmr/server/websocket-ns-m-paths.js +25 -82
  338. package/hmr/server/websocket-ns-m-paths.js.map +1 -1
  339. package/hmr/server/websocket-ns-m-request.d.ts +11 -1
  340. package/hmr/server/websocket-ns-m-request.js +17 -9
  341. package/hmr/server/websocket-ns-m-request.js.map +1 -1
  342. package/hmr/server/websocket-ns-m.d.ts +52 -0
  343. package/hmr/server/websocket-ns-m.js +835 -0
  344. package/hmr/server/websocket-ns-m.js.map +1 -0
  345. package/hmr/server/websocket-served-module-helpers.d.ts +50 -4
  346. package/hmr/server/websocket-served-module-helpers.js +384 -86
  347. package/hmr/server/websocket-served-module-helpers.js.map +1 -1
  348. package/hmr/server/websocket-txn.js +6 -9
  349. package/hmr/server/websocket-txn.js.map +1 -1
  350. package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
  351. package/hmr/server/websocket-vendor-unifier.js +4 -9
  352. package/hmr/server/websocket-vendor-unifier.js.map +1 -1
  353. package/hmr/server/websocket.d.ts +7 -39
  354. package/hmr/server/websocket.js +643 -6716
  355. package/hmr/server/websocket.js.map +1 -1
  356. package/hmr/shared/ns-globals.d.ts +108 -0
  357. package/hmr/shared/ns-globals.js +28 -0
  358. package/hmr/shared/ns-globals.js.map +1 -0
  359. package/hmr/shared/protocol.d.ts +145 -0
  360. package/hmr/shared/protocol.js +28 -0
  361. package/hmr/shared/protocol.js.map +1 -0
  362. package/hmr/shared/runtime/boot-archive-format.d.ts +16 -0
  363. package/hmr/shared/runtime/boot-archive-format.js +31 -0
  364. package/hmr/shared/runtime/boot-archive-format.js.map +1 -0
  365. package/hmr/shared/runtime/boot-complete.d.ts +14 -0
  366. package/hmr/shared/runtime/boot-complete.js +32 -0
  367. package/hmr/shared/runtime/boot-complete.js.map +1 -0
  368. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  369. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  370. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  371. package/hmr/shared/runtime/boot-progress.d.ts +44 -0
  372. package/hmr/shared/runtime/boot-progress.js +134 -0
  373. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  374. package/hmr/shared/runtime/boot-timeline.d.ts +2 -1
  375. package/hmr/shared/runtime/boot-timeline.js +9 -22
  376. package/hmr/shared/runtime/boot-timeline.js.map +1 -1
  377. package/hmr/shared/runtime/browser-runtime-contract.d.ts +53 -22
  378. package/hmr/shared/runtime/browser-runtime-contract.js +6 -9
  379. package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
  380. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  381. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  382. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  383. package/hmr/shared/runtime/dev-overlay.d.ts +76 -30
  384. package/hmr/shared/runtime/dev-overlay.js +767 -408
  385. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  386. package/hmr/shared/runtime/global-scope.d.ts +18 -0
  387. package/hmr/shared/runtime/global-scope.js +21 -0
  388. package/hmr/shared/runtime/global-scope.js.map +1 -0
  389. package/hmr/shared/runtime/hooks.js +2 -1
  390. package/hmr/shared/runtime/hooks.js.map +1 -1
  391. package/hmr/shared/runtime/http-only-boot.js +7 -6
  392. package/hmr/shared/runtime/http-only-boot.js.map +1 -1
  393. package/hmr/shared/runtime/module-provenance.js +4 -6
  394. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  395. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  396. package/hmr/shared/runtime/root-placeholder-view.js +311 -0
  397. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  398. package/hmr/shared/runtime/root-placeholder.js +398 -204
  399. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  400. package/hmr/shared/runtime/session-bootstrap.js +274 -55
  401. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  402. package/hmr/shared/runtime/vendor-bootstrap.js +3 -10
  403. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  404. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  405. package/hmr/shared/vendor/manifest-collect.js +549 -0
  406. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  407. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  408. package/hmr/shared/vendor/manifest-loader.js +5 -3
  409. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  410. package/hmr/shared/vendor/manifest.d.ts +1 -7
  411. package/hmr/shared/vendor/manifest.js +136 -825
  412. package/hmr/shared/vendor/manifest.js.map +1 -1
  413. package/hmr/shared/vendor/registry.d.ts +2 -0
  414. package/hmr/shared/vendor/registry.js +14 -0
  415. package/hmr/shared/vendor/registry.js.map +1 -1
  416. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  417. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  418. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  419. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +76 -0
  420. package/hmr/shared/vendor/vendor-esbuild-plugins.js +401 -0
  421. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  422. package/hmr/vendor-bootstrap.d.ts +1 -3
  423. package/hmr/vendor-bootstrap.js +4 -6
  424. package/hmr/vendor-bootstrap.js.map +1 -1
  425. package/index.d.ts +1 -0
  426. package/index.js +5 -0
  427. package/index.js.map +1 -1
  428. package/package.json +65 -11
  429. package/runtime/core-aliases-early.js +25 -55
  430. package/runtime/core-aliases-early.js.map +1 -1
  431. package/shims/react-jsx-runtime.d.ts +4 -0
  432. package/shims/react-jsx-runtime.js +61 -0
  433. package/shims/react-jsx-runtime.js.map +1 -0
  434. package/helpers/angular/angular-linker.d.ts +0 -13
  435. package/helpers/angular/angular-linker.js +0 -194
  436. package/helpers/angular/angular-linker.js.map +0 -1
  437. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  438. package/helpers/angular/shared-linker.d.ts +0 -11
  439. package/helpers/angular/shared-linker.js +0 -75
  440. package/helpers/angular/shared-linker.js.map +0 -1
  441. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  442. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  443. package/helpers/angular/util.js +0 -67
  444. package/helpers/angular/util.js.map +0 -1
  445. package/helpers/prelink-angular.d.ts +0 -2
  446. package/helpers/prelink-angular.js +0 -117
  447. package/helpers/prelink-angular.js.map +0 -1
  448. package/hmr/server/websocket-angular-entry.js.map +0 -1
  449. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  450. package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
  451. package/hmr/server/websocket-ns-m-finalize.js +0 -88
  452. package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
  453. package/hmr/server/websocket-runtime-compat.d.ts +0 -19
  454. package/hmr/server/websocket-runtime-compat.js +0 -286
  455. package/hmr/server/websocket-runtime-compat.js.map +0 -1
  456. package/hmr/server/websocket-vue-sfc.d.ts +0 -27
  457. package/hmr/server/websocket-vue-sfc.js +0 -1114
  458. package/hmr/server/websocket-vue-sfc.js.map +0 -1
  459. package/transformers/NativeClass/index.d.ts +0 -2
  460. package/transformers/NativeClass/index.js +0 -222
  461. package/transformers/NativeClass/index.js.map +0 -1
  462. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  463. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  464. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  465. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -1,143 +1,69 @@
1
1
  import { mergeConfig } from 'vite';
2
2
  import path from 'path';
3
3
  import fs from 'node:fs';
4
- import { createRequire } from 'node:module';
5
4
  import angular from '@analogjs/vite-plugin-angular';
6
- import { angularLinkerVitePlugin, angularLinkerVitePluginPost } from '../helpers/angular/angular-linker.js';
7
- import { synthesizeMissingInjectableFactories } from '../helpers/angular/synthesize-injectable-factories.js';
8
- import { ensureSharedAngularLinker, resolveAngularFileSystem } from '../helpers/angular/shared-linker.js';
9
- import { inlineDecoratorComponentTemplates } from '../helpers/angular/inline-decorator-component-templates.js';
10
- import { synthesizeDecoratorCtorParameters } from '../helpers/angular/synthesize-decorator-ctor-parameters.js';
11
- import { containsRealNgDeclare } from '../helpers/angular/util.js';
5
+ import { angularLinkerVitePlugin, angularLinkerVitePluginPost } from '../hmr/frameworks/angular/build/angular-linker.js';
6
+ import { synthesizeMissingInjectableFactories } from '../hmr/frameworks/angular/build/synthesize-injectable-factories.js';
7
+ import { getAngularLinkerFactory, runAngularLinker } from '../hmr/frameworks/angular/build/shared-linker.js';
8
+ import { inlineDecoratorComponentTemplates } from '../hmr/frameworks/angular/build/inline-decorator-component-templates.js';
9
+ import { appendComponentHmrRegistration, findComponentClassNames, INJECTION_MARKER as HMR_REGISTER_MARKER } from '../hmr/frameworks/angular/build/inject-component-hmr-registration.js';
10
+ import { injectAngularHmrViteIgnore } from '../hmr/frameworks/angular/build/inject-hmr-vite-ignore.js';
11
+ import { synthesizeDecoratorCtorParameters } from '../hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js';
12
+ import { containsRealNgDeclare, stripJsComments } from '../hmr/frameworks/angular/build/util.js';
12
13
  import { baseConfig } from './base.js';
13
14
  import { getCliFlags } from '../helpers/cli-flags.js';
15
+ import { getMonorepoWorkspaceRoot } from '../helpers/project.js';
14
16
  import { resolveRelativeToImportMeta } from '../helpers/import-meta-path.js';
15
- // Lazily import the Angular linker factory function. Used by chunk-level linkers
16
- // to create FRESH plugin instances per invocation (avoiding stale state in watch mode).
17
- let _cachedLinkerFactory = null;
18
- async function importLinkerFactory() {
19
- if (_cachedLinkerFactory)
20
- return _cachedLinkerFactory;
21
- const req = createRequire(process.cwd() + '/package.json');
22
- try {
23
- const linkerPath = req.resolve('@angular/compiler-cli/linker/babel');
24
- const linkerMod = await import(linkerPath);
25
- _cachedLinkerFactory = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin || null;
26
- }
27
- catch {
28
- try {
29
- const linkerMod = await import('@angular/compiler-cli/linker/babel');
30
- _cachedLinkerFactory = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin || null;
31
- }
32
- catch { }
33
- }
34
- return _cachedLinkerFactory;
17
+ import { resolveVerboseFlag } from '../helpers/logging.js';
18
+ import { NS_OPTIMIZE_DEPS_EXCLUDE } from '../helpers/optimize-deps.js';
19
+ function hasNgDeclarePartial(code) {
20
+ return code.indexOf('\u0275\u0275ngDeclare') !== -1 || code.indexOf('ɵɵngDeclare') !== -1 || code.indexOf('ngDeclare') !== -1;
35
21
  }
36
22
  // Rollup-level linker to guarantee Angular libraries are linked when included in the bundle graph.
37
23
  function angularRollupLinker(projectRoot) {
38
- let babel = null;
39
- let createLinker = null;
40
- let angularFileSystem = null;
41
24
  const FILTER = /node_modules\/(?:@angular|@nativescript\/angular)\/.*\.[mc]?js$/;
42
- async function ensureDeps() {
43
- if (babel && createLinker)
44
- return;
45
- try {
46
- const req = createRequire((projectRoot ? projectRoot + '/package.json' : import.meta.url));
47
- const babelPath = req.resolve('@babel/core');
48
- const linkerPath = req.resolve('@angular/compiler-cli/linker/babel');
49
- babel = await import(babelPath);
50
- const linkerMod = await import(linkerPath);
51
- createLinker = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin;
52
- }
53
- catch {
54
- try {
55
- babel = await import('@babel/core');
56
- }
57
- catch { }
58
- try {
59
- const linkerMod = await import('@angular/compiler-cli/linker/babel');
60
- createLinker = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin;
61
- }
62
- catch { }
63
- }
64
- if (!angularFileSystem) {
65
- angularFileSystem = await resolveAngularFileSystem(projectRoot);
66
- }
67
- }
25
+ const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1';
68
26
  return {
69
27
  name: 'ns-angular-linker-rollup',
70
28
  enforce: 'pre',
71
29
  apply: 'build',
72
30
  async load(id) {
73
- const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1';
74
- const cleanId = id.split('?', 1)[0];
31
+ const cleanId = normalizeAngularWatchPath(id);
75
32
  if (!FILTER.test(cleanId))
76
33
  return null;
77
34
  try {
78
- await ensureDeps();
79
- if (!babel || !createLinker)
80
- return null;
81
35
  const fs = await import('node:fs/promises');
82
36
  const code = await fs.readFile(cleanId, 'utf8');
83
37
  const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills');
84
38
  if (!code)
85
39
  return null;
86
- if (!forceLink && code.indexOf('\u0275\u0275ngDeclare') === -1 && code.indexOf('ɵɵngDeclare') === -1 && code.indexOf('ngDeclare') === -1)
40
+ if (!forceLink && !hasNgDeclarePartial(code))
87
41
  return null;
88
- const plugin = createLinker({ sourceMapping: false, fileSystem: angularFileSystem });
89
- if (debug) {
90
- try {
91
- console.log('[ns-angular-linker][rollup-load] linking', cleanId);
92
- }
93
- catch { }
94
- }
95
- const result = await babel.transformAsync(code, {
96
- filename: cleanId,
97
- configFile: false,
98
- babelrc: false,
99
- sourceMaps: false,
100
- compact: false,
101
- plugins: [plugin],
102
- });
103
- if (result?.code && result.code !== code) {
104
- return { code: result.code, map: null };
42
+ const linked = await runAngularLinker(code, { filename: cleanId, projectRoot, freshPlugin: true });
43
+ if (linked) {
44
+ if (debug)
45
+ console.log('[ns-angular-linker][rollup-load] linked', cleanId);
46
+ return { code: linked, map: null };
105
47
  }
106
48
  }
107
49
  catch { }
108
50
  return null;
109
51
  },
110
52
  async transform(code, id) {
111
- const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1';
112
- const cleanId = id.split('?', 1)[0];
53
+ const cleanId = normalizeAngularWatchPath(id);
113
54
  if (!FILTER.test(cleanId))
114
55
  return null;
115
56
  const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills');
116
57
  if (!code)
117
58
  return null;
118
- if (!forceLink && code.indexOf('\u0275\u0275ngDeclare') === -1 && code.indexOf('ɵɵngDeclare') === -1 && code.indexOf('ngDeclare') === -1)
119
- return null;
120
- await ensureDeps();
121
- if (!babel || !createLinker)
59
+ if (!forceLink && !hasNgDeclarePartial(code))
122
60
  return null;
123
61
  try {
124
- const plugin = createLinker({ sourceMapping: false, fileSystem: angularFileSystem });
125
- if (debug) {
126
- try {
127
- console.log('[ns-angular-linker][rollup] linking', cleanId);
128
- }
129
- catch { }
130
- }
131
- const result = await babel.transformAsync(code, {
132
- filename: cleanId,
133
- configFile: false,
134
- babelrc: false,
135
- sourceMaps: false,
136
- compact: false,
137
- plugins: [plugin],
138
- });
139
- if (result?.code && result.code !== code) {
140
- return { code: result.code, map: null };
62
+ const linked = await runAngularLinker(code, { filename: cleanId, projectRoot, freshPlugin: true });
63
+ if (linked) {
64
+ if (debug)
65
+ console.log('[ns-angular-linker][rollup] linked', cleanId);
66
+ return { code: linked, map: null };
141
67
  }
142
68
  }
143
69
  catch { }
@@ -148,6 +74,37 @@ function angularRollupLinker(projectRoot) {
148
74
  const cliFlags = getCliFlags();
149
75
  const isDevEnv = process.env.NODE_ENV !== 'production';
150
76
  const hmrActive = isDevEnv && !!cliFlags.hmr;
77
+ /**
78
+ * Web-style template HMR opt-out.
79
+ *
80
+ * When `hmrActive` is true we default to the in-place template-replacement
81
+ * pipeline (`liveReload: true` on Analog → `_enableHmr: true` on the Angular
82
+ * TS compiler → `angular:component-update` events served via the
83
+ * `/@ng/component` middleware → `ɵɵreplaceMetadata` on the live class).
84
+ * Setting `_enableHmr: true` also forces Analog to set
85
+ * `externalRuntimeStyles: true`, changing how component styles are emitted
86
+ * (URLs fetched lazily instead of inlined). On the web that's fine; for
87
+ * NativeScript it's a new code path that touches the SCSS / Tailwind
88
+ * pipeline and the iOS runtime's HTTP module loader.
89
+ *
90
+ * If a project hits a regression on day one (broken styling, unresolved
91
+ * `?ngcomp=` imports, etc.) the user can roll back to the legacy reboot
92
+ * pipeline without an upstream patch by setting the env flag. We honour
93
+ * `0`, `false`, `off`, and `no` (case-insensitive) as "off" — anything
94
+ * else (including unset) keeps the new path on.
95
+ *
96
+ * The flag is read once at module load, mirroring how `hmrActive` is
97
+ * computed, so a project can flip it via `cross-env` in their dev script
98
+ * and never look back.
99
+ */
100
+ const angularLiveReloadDisabledByEnv = (() => {
101
+ const raw = process.env.NS_VITE_ANGULAR_LIVE_RELOAD;
102
+ if (typeof raw !== 'string')
103
+ return false;
104
+ const v = raw.trim().toLowerCase();
105
+ return v === '0' || v === 'false' || v === 'off' || v === 'no';
106
+ })();
107
+ const hmrAngularLiveReload = hmrActive && !angularLiveReloadDisabledByEnv;
151
108
  const projectRoot = process.cwd();
152
109
  const tsConfigAppPath = path.resolve(projectRoot, 'tsconfig.app.json');
153
110
  const tsConfigPath = path.resolve(projectRoot, 'tsconfig.json');
@@ -193,15 +150,24 @@ function extractComponentAssetPaths(code, componentId) {
193
150
  const componentPath = normalizeAngularWatchPath(componentId);
194
151
  const assetPaths = new Set();
195
152
  const resolveAssetPath = (assetPath) => normalizeAngularWatchPath(path.resolve(path.dirname(componentPath), assetPath));
196
- const templateUrlMatch = code.match(/templateUrl\s*:\s*['"](.+?\.(?:html|htm))['"]/);
153
+ // Blank out `//` and `/* */` comments before scanning. The regexes below
154
+ // are intentionally simple (no JS parser) so they would otherwise match
155
+ // commented-out `templateUrl` / `styleUrls` declarations and register
156
+ // phantom asset deps via `addWatchFile`. In current Rolldown-Vite that
157
+ // also enrolls them as `_addedImports`, which `vite:import-analysis`
158
+ // then tries to resolve — surfacing as a misleading
159
+ // `Failed to resolve import "<file>" from "<importer>". Does the file
160
+ // exist?` pre-transform error if the file (predictably) doesn't exist.
161
+ const scanCode = stripJsComments(code);
162
+ const templateUrlMatch = scanCode.match(/templateUrl\s*:\s*['"](.+?\.(?:html|htm))['"]/);
197
163
  if (templateUrlMatch) {
198
164
  assetPaths.add(resolveAssetPath(templateUrlMatch[1]));
199
165
  }
200
- const styleUrlMatch = code.match(/styleUrl\s*:\s*['"](.+?\.(?:css|less|sass|scss))['"]/);
166
+ const styleUrlMatch = scanCode.match(/styleUrl\s*:\s*['"](.+?\.(?:css|less|sass|scss))['"]/);
201
167
  if (styleUrlMatch) {
202
168
  assetPaths.add(resolveAssetPath(styleUrlMatch[1]));
203
169
  }
204
- const styleUrlsMatch = code.match(/styleUrls\s*:\s*\[([\s\S]*?)\]/m);
170
+ const styleUrlsMatch = scanCode.match(/styleUrls\s*:\s*\[([\s\S]*?)\]/m);
205
171
  if (styleUrlsMatch) {
206
172
  for (const match of styleUrlsMatch[1].matchAll(/['"](.+?\.(?:css|less|sass|scss))['"]/g)) {
207
173
  assetPaths.add(resolveAssetPath(match[1]));
@@ -210,9 +176,18 @@ function extractComponentAssetPaths(code, componentId) {
210
176
  return Array.from(assetPaths);
211
177
  }
212
178
  function createAngularPlugins(opts) {
179
+ const verbose = resolveVerboseFlag();
213
180
  const assetToComponents = new Map();
214
181
  const componentToAssets = new Map();
215
182
  const pendingComponentInvalidations = new Set();
183
+ // Shared state between the `enforce: 'pre'` discovery plugin and the
184
+ // `enforce: 'post'` injection plugin. Maps a clean (no-querystring)
185
+ // .ts file id to the list of `@Component`-decorated class names found
186
+ // in its RAW TypeScript source. The pre plugin populates this map;
187
+ // the post plugin reads it to know which class names to register
188
+ // against the compiled output. Cleared on each pre-plugin invocation
189
+ // so renames or `@Component` removals don't leave stale entries.
190
+ const componentsByCleanId = new Map();
216
191
  const untrackComponentAssets = (componentPath) => {
217
192
  const previousAssets = componentToAssets.get(componentPath);
218
193
  if (!previousAssets)
@@ -240,7 +215,121 @@ function createAngularPlugins(opts) {
240
215
  assetToComponents.set(assetPath, components);
241
216
  }
242
217
  };
218
+ const isCandidateComponentTs = (cleanId) => {
219
+ if (!cleanId.endsWith('.ts'))
220
+ return false;
221
+ if (cleanId.includes('/node_modules/'))
222
+ return false;
223
+ if (cleanId.endsWith('.d.ts'))
224
+ return false;
225
+ if (cleanId.endsWith('.spec.ts') || cleanId.endsWith('.test.ts'))
226
+ return false;
227
+ return true;
228
+ };
243
229
  return [
230
+ // HMR self-registration runs in two steps:
231
+ //
232
+ // 1. (this plugin, `enforce: 'pre'`) Walk the raw TypeScript
233
+ // source for each user `.ts` file and record the names of
234
+ // any `@Component`-decorated classes into the shared
235
+ // `componentsByCleanId` map. Discovery has to happen on the
236
+ // raw source because the Analog Angular plugin rewrites
237
+ // `@Component(...)` into static metadata calls and removes
238
+ // the textual decorator pattern.
239
+ //
240
+ // 2. (`ns-component-hmr-register-post`, `enforce: 'post'`)
241
+ // After the Analog Angular plugin has compiled the file,
242
+ // append the global `__NS_HMR_REGISTER_COMPONENT__`
243
+ // registration calls keyed by the names recorded in step 1.
244
+ //
245
+ // Why the two-step split: the Analog Angular plugin's `transform`
246
+ // returns its OWN regenerated compiled output (from its internal
247
+ // `outputFiles` cache populated at `buildStart`), discarding any
248
+ // code modifications applied earlier in the pipeline. We
249
+ // previously appended the registration snippet here, in the pre
250
+ // plugin, and the snippet was silently dropped — leaving the
251
+ // HMR class registry empty and `getFreshComponentClass` returning
252
+ // `found=false reason=no-registry` after every reboot.
253
+ //
254
+ // Placement notes that still apply:
255
+ // - `apply: 'serve'`: the registry runtime hook is dev-only;
256
+ // production builds never need self-registration.
257
+ // - Intentionally NOT gated on `hmrActive`. The injected
258
+ // snippet self-guards with
259
+ // `typeof globalThis.__NS_HMR_REGISTER_COMPONENT__ === 'function'`,
260
+ // so it's a no-op when the runtime hook isn't installed
261
+ // (e.g. `--no-hmr` users still serving modules through
262
+ // Vite). Gating the transform itself on `hmrActive` produced
263
+ // a silent failure mode where `--no-hmr` users got HMR
264
+ // machinery up but never got the registration calls
265
+ // injected, leaving the registry empty.
266
+ {
267
+ name: 'ns-component-hmr-register',
268
+ enforce: 'pre',
269
+ apply: 'serve',
270
+ transform(code, id) {
271
+ const cleanId = normalizeAngularWatchPath(id);
272
+ if (!isCandidateComponentTs(cleanId))
273
+ return null;
274
+ const componentNames = findComponentClassNames(code);
275
+ if (componentNames.length === 0) {
276
+ // Drop any stale entry from a previous transform
277
+ // pass; the file may have lost its `@Component`
278
+ // decorator across a rename/refactor.
279
+ componentsByCleanId.delete(cleanId);
280
+ return null;
281
+ }
282
+ componentsByCleanId.set(cleanId, componentNames);
283
+ if (verbose) {
284
+ console.info(`[ns-hmr][ns-component-hmr-register] discovered ${componentNames.length} component(s) in ${cleanId} (${componentNames.join(', ')})`);
285
+ }
286
+ // Discovery only — never modify the raw TS source. Any
287
+ // modification here is discarded by the Analog Angular
288
+ // plugin downstream; the actual snippet append happens
289
+ // in `ns-component-hmr-register-post`.
290
+ return null;
291
+ },
292
+ },
293
+ // Step 2 (post plugin): append the HMR registration snippet to the compiled
294
+ // JS output produced by `@analogjs/vite-plugin-angular`. Runs
295
+ // `enforce: 'post'` so we see the post-Angular code (where the
296
+ // pre plugin's work would otherwise be discarded). Reads the
297
+ // component names recorded by the pre plugin via
298
+ // `componentsByCleanId`.
299
+ {
300
+ name: 'ns-component-hmr-register-post',
301
+ enforce: 'post',
302
+ apply: 'serve',
303
+ transform(code, id) {
304
+ const cleanId = normalizeAngularWatchPath(id);
305
+ if (!isCandidateComponentTs(cleanId))
306
+ return null;
307
+ const componentNames = componentsByCleanId.get(cleanId);
308
+ if (!componentNames || componentNames.length === 0)
309
+ return null;
310
+ // Idempotency: the Vite cache may replay the transform
311
+ // pipeline on cached modules. The marker comment is
312
+ // inserted by `appendComponentHmrRegistration` and
313
+ // guards against double-injection. We also defensively
314
+ // short-circuit here so we don't have to allocate the
315
+ // suffix string on every cached re-run.
316
+ if (code.includes(HMR_REGISTER_MARKER))
317
+ return null;
318
+ const result = appendComponentHmrRegistration(code, componentNames);
319
+ if (!result.code)
320
+ return null;
321
+ if (verbose) {
322
+ console.info(`[ns-hmr][ns-component-hmr-register-post] appended registrations for ${result.componentNames.length} component(s) in ${cleanId} (${result.componentNames.join(', ')})`);
323
+ }
324
+ // Returning `null` for the source map is acceptable for
325
+ // dev: lines 1..N (the original compiled body) keep
326
+ // the upstream Angular source map; the appended snippet
327
+ // is invisible to debuggers but harmless. For
328
+ // production-grade source maps a MagicString-based
329
+ // pass-through could be used; not required for HMR.
330
+ return { code: result.code, map: null };
331
+ },
332
+ },
244
333
  // Allow external html template changes to trigger hot reload: Make .ts files depend on their .html templates
245
334
  {
246
335
  name: 'angular-template-deps',
@@ -255,6 +344,15 @@ function createAngularPlugins(opts) {
255
344
  for (const assetPath of assetPaths) {
256
345
  this.addWatchFile(assetPath);
257
346
  }
347
+ // Diagnostic: surface which .ts files we've registered
348
+ // asset (template/styleUrls) dependencies for. This is
349
+ // the first fence the HTML→TS invalidation pipeline must
350
+ // pass — if we never see a [tracking] log for the
351
+ // component we're editing, the watcher will never fire
352
+ // and `pendingComponentInvalidations` stays empty.
353
+ if (verbose) {
354
+ console.info(`[ns-hmr][angular-template-deps] [tracking] componentKey=${componentKey} assets=${assetPaths.length} (${assetPaths.slice(0, 4).join(', ')})`);
355
+ }
258
356
  return null;
259
357
  },
260
358
  watchChange(id) {
@@ -269,12 +367,27 @@ function createAngularPlugins(opts) {
269
367
  for (const componentPath of components) {
270
368
  pendingComponentInvalidations.add(componentPath);
271
369
  }
370
+ if (verbose) {
371
+ console.info(`[ns-hmr][angular-template-deps] watchChange [via assetToComponents] changed=${changedPath} → invalidating ${components.size} component(s):`, Array.from(components));
372
+ }
272
373
  return;
273
374
  }
274
375
  if (/\.(html|htm)$/i.test(changedPath)) {
275
376
  const componentPath = changedPath.replace(/\.(html|htm)$/i, '.ts');
276
- if (fs.existsSync(resolveAngularWatchFilePath(componentPath))) {
277
- pendingComponentInvalidations.add(normalizeAngularWatchKey(componentPath));
377
+ const exists = fs.existsSync(resolveAngularWatchFilePath(componentPath));
378
+ if (exists) {
379
+ const componentKey = normalizeAngularWatchKey(componentPath);
380
+ pendingComponentInvalidations.add(componentKey);
381
+ if (verbose) {
382
+ console.info(`[ns-hmr][angular-template-deps] watchChange [via fallback .html→.ts] changed=${changedPath} componentKey=${componentKey}`);
383
+ }
384
+ }
385
+ else {
386
+ // Truly anomalous: a watched template/style asset has no companion
387
+ // `.ts` file, so we cannot route the edit through the Angular
388
+ // HMR pipeline. Always-on warning so it surfaces in non-verbose
389
+ // runs — silent fallback would hide a real wiring break.
390
+ console.warn(`[ns-hmr][angular-template-deps] watchChange [no companion .ts found] changed=${changedPath} expectedTs=${componentPath}`);
278
391
  }
279
392
  }
280
393
  },
@@ -283,6 +396,9 @@ function createAngularPlugins(opts) {
283
396
  if (!pendingComponentInvalidations.has(componentPath))
284
397
  return null;
285
398
  pendingComponentInvalidations.delete(componentPath);
399
+ if (verbose) {
400
+ console.info(`[ns-hmr][angular-template-deps] shouldTransformCachedModule → re-transform componentKey=${componentPath}`);
401
+ }
286
402
  return true;
287
403
  },
288
404
  },
@@ -295,11 +411,153 @@ function createAngularPlugins(opts) {
295
411
  experimental: {
296
412
  useAngularCompilationAPI: opts.useAngularCompilationAPI,
297
413
  },
298
- liveReload: false, // Disable live reload in favor of HMR
414
+ // `liveReload` is Analog's flag for Angular's web-style template HMR
415
+ // pipeline. When ON, Analog:
416
+ // 1. Sets `_enableHmr = true` on the TS compiler so each compiled
417
+ // component `.mjs` emits `<ClassName>_HmrLoad` plus an
418
+ // `import.meta.hot.on('angular:component-update', ...)` listener.
419
+ // 2. Registers a `/@ng/component?c=<id>` middleware that serves the
420
+ // recompiled template's `_UpdateMetadata` source on demand.
421
+ // 3. In `handleHotUpdate` for `.html` / `.css` / `.scss` edits, sends
422
+ // `server.ws.send('angular:component-update', { id, timestamp })`
423
+ // so the runtime can call `ɵɵreplaceMetadata` on the live class —
424
+ // swapping the template definition AND walking live LViews to
425
+ // recreate matching views in-place. NO Angular reboot, NO route
426
+ // navigation.
427
+ //
428
+ // Previously this was `false` because the NativeScript HMR pipeline
429
+ // rebuilt every save through `__reboot_ng_modules__`. That works but
430
+ // has two big downsides on mobile: every save triggers a full app
431
+ // reboot AND the captured route-history replay (see
432
+ // `@nativescript/angular`'s `hmr-route-replay.ts`), which produces 2-3
433
+ // re-navigations per save and re-instantiates the page component
434
+ // multiple times. For pure template/style edits — the common case —
435
+ // the web-style component-replacement path keeps the page mounted and
436
+ // only swaps the changed bits.
437
+ //
438
+ // We only enable this when HMR itself is active (`hmrActive` already
439
+ // gates on `--hmr` and `NODE_ENV !== 'production'`). With HMR off the
440
+ // behaviour is unchanged: production builds and `--no-hmr` dev still
441
+ // see `liveReload: false`, the compiler skips the HMR initializers,
442
+ // and the middleware is not registered.
443
+ //
444
+ // Important interactions to be aware of:
445
+ // - When `_enableHmr` is true, Analog also sets
446
+ // `externalRuntimeStyles = true`, changing how component styles
447
+ // are emitted (URLs fetched at runtime instead of inlined). For
448
+ // NativeScript, the existing CSS pipeline expects inlined styles;
449
+ // `ns-component-hmr-style-overrides` (below) restores the
450
+ // pre-HMR style-emission strategy so Tailwind/global SCSS
451
+ // packaging keeps working.
452
+ // - The runtime dynamic-import resolves the metadata URL relative
453
+ // to `import.meta.url`, e.g. `http://host:port/ns/m/<componentDir>/@ng/component?c=...`.
454
+ // Analog's middleware uses `req.url.includes('/@ng/component')`
455
+ // (substring match), so the request still matches even with the
456
+ // `/ns/m/` prefix in the path.
457
+ // - The NS HMR client (`packages/vite/hmr/client/index.ts`)
458
+ // forwards Vite's standard `{ type: 'custom', event, data }`
459
+ // payloads to `import.meta.hot.on` listeners via the JS hot
460
+ // registry (`hmr/client/hot-context.ts`), and short-circuits
461
+ // before the reboot path for `angular:component-update`.
462
+ // - The NS server-side hot-update handler in
463
+ // `packages/vite/hmr/server/websocket.ts` skips its own
464
+ // `ns:angular-update` broadcast for `.html` / component-style
465
+ // edits so we don't double-fire (the reboot path stays for `.ts`
466
+ // edits).
467
+ // - To roll back to the legacy reboot-only pipeline (e.g. while
468
+ // debugging an `externalRuntimeStyles` regression), set
469
+ // `NS_VITE_ANGULAR_LIVE_RELOAD=0` in the dev environment.
470
+ // `hmrAngularLiveReload` collapses both gates above.
471
+ liveReload: hmrAngularLiveReload,
472
+ // NativeScript can't consume Angular's `externalRuntimeStyles`
473
+ // mode — that emits component styles as runtime-loaded
474
+ // `<hash>.css` URL references which only a browser CSSOM/`<link>`
475
+ // pipeline can resolve. We tell our patched Analog plugin (see
476
+ // `patches/@analogjs+vite-plugin-angular+2.3.1.patch` in
477
+ // downstream apps; upstream PR pending) to keep the legacy
478
+ // behavior of inlining preprocessed CSS strings into the
479
+ // component metadata's `styles: [...]` array, which the NS
480
+ // renderer's CSS-bundle pipeline already knows how to apply.
481
+ // The option is independent from `liveReload` (`_enableHmr`
482
+ // still wires up `ɵɵreplaceMetadata` for in-place template
483
+ // HMR) — we keep HMR ON, just opt out of the URL-style
484
+ // emission. Note the option lands as a no-op on stock
485
+ // Analog releases that haven't merged the patch; once
486
+ // merged, this will switch the compiler off external styles
487
+ // for NativeScript without affecting web builds.
488
+ //
489
+ // `@ts-expect-error` because the option is not yet in
490
+ // `@analogjs/vite-plugin-angular`'s published `PluginOptions`
491
+ // type. When the upstream PR (https://github.com/analogjs/analog)
492
+ // adds it, this `@ts-expect-error` will itself become an
493
+ // "unused suppression" error — that's the signal to remove
494
+ // this comment AND the surrounding explanation, and bump
495
+ // the Analog peer dep to the version that ships the type.
496
+ // @ts-expect-error -- pending upstream Analog type publish
497
+ externalRuntimeStyles: false,
299
498
  tsconfig: tsConfig,
499
+ // Forward Angular-style file replacements (e.g. `environment.ts`
500
+ // → `environment.stg.ts`) directly into the Analog plugin so the
501
+ // Angular TypeScript host (which reads source files via its own
502
+ // CompilerHost, bypassing Vite's load chain) sees the swap. This
503
+ // is the same hook Angular CLI uses for `fileReplacements` in
504
+ // `angular.json` build configurations.
505
+ fileReplacements: opts.fileReplacements ?? [],
506
+ // Component-HMR id alignment. Angular's compiler embeds each
507
+ // component's HMR id relative to the TS compilation's base path —
508
+ // in an Nx monorepo that's the WORKSPACE root (tsconfig.base.json's
509
+ // baseUrl), not the app dir. Analog uses `workspaceRoot` both to
510
+ // build the `angular:component-update` broadcast id
511
+ // (`relative(workspaceRoot, file)`) and to resolve `/@ng/component?c=`
512
+ // fetches back to absolute paths (`resolve(workspaceRoot, id)`).
513
+ // Defaulting to `process.cwd()` (the app dir) makes the broadcast id
514
+ // `src/...` while every compiled listener guards on
515
+ // `apps/<app>/src/...` — `d.id === id` never matches, so template
516
+ // edits dispatch cleanly but visually apply nothing. Default to the
517
+ // monorepo root when one exists so all three id producers agree;
518
+ // standalone apps (no monorepo root) keep the cwd behavior.
519
+ workspaceRoot: opts.workspaceRoot ?? getMonorepoWorkspaceRoot(process.cwd()) ?? process.cwd(),
300
520
  }),
301
521
  // Post-phase linker to catch any declarations introduced after other transforms (including project code)
302
522
  angularLinkerVitePluginPost(process.cwd()),
523
+ // Re-inject the `/* @vite-ignore */` annotation onto Angular's HMR
524
+ // initializer dynamic imports.
525
+ //
526
+ // Angular's compiler emits each component's HMR loader as
527
+ // `import(/* @vite-ignore */ i0.ɵɵgetReplaceMetadataURL(...))` so
528
+ // Vite leaves the runtime-computed URL alone. The annotation goes
529
+ // missing somewhere in the post-Angular pipeline (empirically the
530
+ // linker's `compact: false` Babel pass loses it on some files),
531
+ // causing Vite's static analyzer to flag the import and rewrite
532
+ // the call site through its runtime resolver — which then throws
533
+ // `TypeError at ɵɵgetReplaceMetadataURL` on the iOS device because
534
+ // the resolver expects a statically known specifier.
535
+ //
536
+ // Running `enforce: 'post'` and `apply: 'serve'` here ensures we
537
+ // see the file AFTER every other transform has had its chance to
538
+ // strip comments, AND only in dev (the HMR initializer is gated
539
+ // behind `ngDevMode` and never runs in a production build, so the
540
+ // fix would be wasted work outside `serve`). The helper is
541
+ // idempotent: if the annotation is already present, the file is
542
+ // returned unchanged.
543
+ {
544
+ name: 'ns-angular-hmr-vite-ignore',
545
+ enforce: 'post',
546
+ apply: 'serve',
547
+ transform(code, id) {
548
+ if (!hmrAngularLiveReload)
549
+ return null;
550
+ const cleanId = normalizeAngularWatchPath(id);
551
+ if (!cleanId.endsWith('.ts') && !cleanId.endsWith('.mjs') && !cleanId.endsWith('.js'))
552
+ return null;
553
+ if (cleanId.includes('/node_modules/'))
554
+ return null;
555
+ const next = injectAngularHmrViteIgnore(code);
556
+ if (next === code)
557
+ return null;
558
+ return { code: next, map: null };
559
+ },
560
+ },
303
561
  // Enforce: fully disable dependency optimization during serve to avoid rxjs esm5 crawling and OOM
304
562
  {
305
563
  name: 'ns-disable-optimize-deps',
@@ -309,7 +567,7 @@ function createAngularPlugins(opts) {
309
567
  const od = userConfig?.optimizeDeps || {};
310
568
  const prevExclude = Array.isArray(od.exclude) ? od.exclude : [];
311
569
  const exclude = new Set(prevExclude);
312
- ['@nativescript/core', 'rxjs', '@valor/nativescript-websockets', 'set-value', 'react', 'react-reconciler', 'react-nativescript'].forEach((x) => exclude.add(x));
570
+ [...NS_OPTIMIZE_DEPS_EXCLUDE, 'rxjs'].forEach((x) => exclude.add(x));
313
571
  return {
314
572
  optimizeDeps: {
315
573
  noDiscovery: true,
@@ -330,7 +588,7 @@ function createAngularPlugins(opts) {
330
588
  deps.entries = [];
331
589
  deps.include = [];
332
590
  const exclude = new Set(Array.isArray(deps.exclude) ? deps.exclude : []);
333
- ['@nativescript/core', 'rxjs', '@valor/nativescript-websockets', 'set-value', 'react', 'react-reconciler', 'react-nativescript'].forEach((x) => exclude.add(x));
591
+ [...NS_OPTIMIZE_DEPS_EXCLUDE, 'rxjs'].forEach((x) => exclude.add(x));
334
592
  deps.exclude = Array.from(exclude);
335
593
  const rolldownOptions = (deps.rolldownOptions || (deps.rolldownOptions = {}));
336
594
  rolldownOptions.plugins = [];
@@ -338,7 +596,7 @@ function createAngularPlugins(opts) {
338
596
  },
339
597
  ];
340
598
  }
341
- export const angularConfig = ({ mode }) => {
599
+ export const angularConfig = ({ mode, fileReplacements, workspaceRoot, }) => {
342
600
  const useSingleBundleDevOutput = mode === 'development' && !hmrActive;
343
601
  const plugins = createAngularPlugins({
344
602
  // Vite build --watch with the legacy Analog compilation path can regress
@@ -346,6 +604,8 @@ export const angularConfig = ({ mode }) => {
346
604
  // Restrict the newer compilation API to NativeScript's development no-HMR
347
605
  // flow, which is where the unstable rebuilds occur today.
348
606
  useAngularCompilationAPI: useSingleBundleDevOutput,
607
+ fileReplacements,
608
+ workspaceRoot,
349
609
  });
350
610
  const disableAnimations = true;
351
611
  //process.env.NS_DISABLE_NG_ANIMATIONS === "1" ||
@@ -366,17 +626,16 @@ export const angularConfig = ({ mode }) => {
366
626
  apply: 'build',
367
627
  enforce: 'post',
368
628
  async generateBundle(_options, bundle) {
629
+ function isNsAngularPolyfillsModule(id) {
630
+ return normalizeAngularWatchPath(id).includes('node_modules/@nativescript/angular/fesm2022/nativescript-angular-polyfills.mjs');
631
+ }
369
632
  function isNsAngularPolyfillsChunk(chunk) {
370
633
  if (!chunk || !chunk.modules)
371
634
  return false;
372
- return Object.keys(chunk.modules).some((m) => m.includes('node_modules/@nativescript/angular/fesm2022/nativescript-angular-polyfills.mjs'));
635
+ return Object.keys(chunk.modules).some(isNsAngularPolyfillsModule);
373
636
  }
374
- const { babel } = await ensureSharedAngularLinker(process.cwd());
375
- if (!babel)
376
- return;
377
- const fileSystem = await resolveAngularFileSystem(process.cwd());
378
- const linkerFactory = await importLinkerFactory();
379
- if (!linkerFactory)
637
+ const { babel, createLinker } = await getAngularLinkerFactory(process.cwd());
638
+ if (!babel || !createLinker)
380
639
  return;
381
640
  const strict = process.env.NS_STRICT_NG_LINK === '1' || process.env.NS_STRICT_NG_LINK === 'true';
382
641
  const enforceStrict = process.env.NS_STRICT_NG_LINK_ENFORCE === '1' || process.env.NS_STRICT_NG_LINK_ENFORCE === 'true';
@@ -396,26 +655,13 @@ export const angularConfig = ({ mode }) => {
396
655
  continue;
397
656
  const isNsPolyfills = isNsAngularPolyfillsChunk(chunk);
398
657
  try {
399
- // Create a FRESH linker plugin per chunk — the linker may have
400
- // internal state that becomes stale across watch-mode rebuild cycles.
401
- const freshPlugin = linkerFactory({ sourceMapping: false, fileSystem });
402
- const res = await babel.transformAsync(code, {
403
- filename: fileName,
404
- configFile: false,
405
- babelrc: false,
406
- sourceMaps: false,
407
- compact: false,
408
- plugins: [freshPlugin],
409
- });
410
- const linkedCode = res?.code && res.code !== code ? res.code : code;
411
- const finalCode = applyAngularChunkPostProcessing(linkedCode, { vendorInjectExport });
658
+ // Fresh plugin per chunk — avoids stale linker state across watch-mode rebuilds.
659
+ const linked = await runAngularLinker(code, { filename: fileName, projectRoot: process.cwd(), freshPlugin: true });
660
+ const finalCode = applyAngularChunkPostProcessing(linked ?? code, { vendorInjectExport });
412
661
  if (finalCode !== code) {
413
662
  chunk.code = finalCode;
414
663
  if (debug) {
415
- try {
416
- console.log('[ns-angular-linker][post] linked', fileName, isNsPolyfills ? '(polyfills)' : '');
417
- }
418
- catch { }
664
+ console.log('[ns-angular-linker][post] linked', fileName, isNsPolyfills ? '(polyfills)' : '');
419
665
  }
420
666
  }
421
667
  if (strict && !isNsPolyfills && containsRealNgDeclare(finalCode)) {
@@ -435,10 +681,10 @@ export const angularConfig = ({ mode }) => {
435
681
  const chunk = bundle[fname];
436
682
  const modIds = chunk?.modules
437
683
  ? Object.keys(chunk.modules)
438
- .filter((m) => /node_modules\/(?:@angular|@nativescript\/angular)\//.test(m))
684
+ .filter((m) => /node_modules\/(?:@angular|@nativescript\/angular)\//.test(normalizeAngularWatchPath(m)))
439
685
  .slice(0, 8)
440
686
  : [];
441
- const isOnlyPolyfills = modIds.length > 0 && modIds.every((m) => m.includes('node_modules/@nativescript/angular/fesm2022/nativescript-angular-polyfills.mjs'));
687
+ const isOnlyPolyfills = modIds.length > 0 && modIds.every(isNsAngularPolyfillsModule);
442
688
  if (isOnlyPolyfills)
443
689
  continue;
444
690
  let snippet = '';
@@ -461,10 +707,7 @@ export const angularConfig = ({ mode }) => {
461
707
  throw new Error(message);
462
708
  }
463
709
  else {
464
- try {
465
- console.warn(`[ns-angular-linker-post] ${message}`);
466
- }
467
- catch { }
710
+ console.warn(`[ns-angular-linker-post] ${message}`);
468
711
  }
469
712
  }
470
713
  },
@@ -484,37 +727,19 @@ export const angularConfig = ({ mode }) => {
484
727
  try {
485
728
  let transformed = code;
486
729
  if (containsRealNgDeclare(code)) {
487
- const { babel } = await ensureSharedAngularLinker(process.cwd());
488
- if (!babel)
730
+ const { babel, createLinker } = await getAngularLinkerFactory(process.cwd());
731
+ if (!babel || !createLinker)
489
732
  return null;
490
- const fileSystem = await resolveAngularFileSystem(process.cwd());
491
- // Fresh plugin per chunk — avoids stale linker state across watch-mode rebuilds
492
- const freshPlugin = (await importLinkerFactory())?.({ sourceMapping: false, fileSystem });
493
- if (!freshPlugin)
494
- return null;
495
- const runLink = async (input) => {
496
- const result = await babel.transformAsync(input, {
497
- filename,
498
- configFile: false,
499
- babelrc: false,
500
- sourceMaps: false,
501
- compact: false,
502
- plugins: [freshPlugin],
503
- });
504
- return result?.code ?? input;
505
- };
506
- transformed = await runLink(code);
733
+ // Fresh plugin per pass — avoids stale linker state across watch-mode rebuilds.
734
+ transformed = (await runAngularLinker(code, { filename, projectRoot: process.cwd(), freshPlugin: true })) ?? code;
507
735
  if (containsRealNgDeclare(transformed)) {
508
- transformed = await runLink(transformed);
736
+ transformed = (await runAngularLinker(transformed, { filename, projectRoot: process.cwd(), freshPlugin: true })) ?? transformed;
509
737
  }
510
738
  }
511
739
  transformed = applyAngularChunkPostProcessing(transformed);
512
740
  if (transformed !== code) {
513
741
  if (debug) {
514
- try {
515
- console.log('[ns-angular-linker][render] linked', filename);
516
- }
517
- catch { }
742
+ console.log('[ns-angular-linker][render] linked', filename);
518
743
  }
519
744
  return { code: transformed, map: null };
520
745
  }