@nativescript/vite 8.0.0-alpha.3 → 8.0.0-alpha.31

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 (356) hide show
  1. package/README.md +51 -11
  2. package/configuration/angular.d.ts +34 -1
  3. package/configuration/angular.js +373 -163
  4. package/configuration/angular.js.map +1 -1
  5. package/configuration/base.js +184 -14
  6. package/configuration/base.js.map +1 -1
  7. package/configuration/javascript.js +5 -72
  8. package/configuration/javascript.js.map +1 -1
  9. package/configuration/solid.js +27 -1
  10. package/configuration/solid.js.map +1 -1
  11. package/configuration/typescript.js +5 -75
  12. package/configuration/typescript.js.map +1 -1
  13. package/helpers/app-components.d.ts +2 -1
  14. package/helpers/app-components.js.map +1 -1
  15. package/helpers/app-css-state.d.ts +8 -0
  16. package/helpers/app-css-state.js +8 -0
  17. package/helpers/app-css-state.js.map +1 -0
  18. package/helpers/bundler-context.d.ts +11 -0
  19. package/helpers/bundler-context.js +71 -0
  20. package/helpers/bundler-context.js.map +1 -0
  21. package/helpers/config-as-json.js +10 -0
  22. package/helpers/config-as-json.js.map +1 -1
  23. package/helpers/dev-host.d.ts +341 -0
  24. package/helpers/dev-host.js +617 -0
  25. package/helpers/dev-host.js.map +1 -0
  26. package/helpers/esbuild-platform-resolver.js +4 -1
  27. package/helpers/esbuild-platform-resolver.js.map +1 -1
  28. package/helpers/global-defines.d.ts +51 -0
  29. package/helpers/global-defines.js +77 -0
  30. package/helpers/global-defines.js.map +1 -1
  31. package/helpers/hmr-scope.d.ts +26 -0
  32. package/helpers/hmr-scope.js +67 -0
  33. package/helpers/hmr-scope.js.map +1 -0
  34. package/helpers/init.js +0 -18
  35. package/helpers/init.js.map +1 -1
  36. package/helpers/logging.d.ts +1 -0
  37. package/helpers/logging.js +63 -3
  38. package/helpers/logging.js.map +1 -1
  39. package/helpers/main-entry.d.ts +2 -1
  40. package/helpers/main-entry.js +430 -47
  41. package/helpers/main-entry.js.map +1 -1
  42. package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
  43. package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
  44. package/helpers/nativeclass-transform.js.map +1 -1
  45. package/helpers/nativeclass-transformer-plugin.d.ts +9 -2
  46. package/helpers/nativeclass-transformer-plugin.js +157 -14
  47. package/helpers/nativeclass-transformer-plugin.js.map +1 -1
  48. package/helpers/nativescript-package-resolver.js +8 -3
  49. package/helpers/nativescript-package-resolver.js.map +1 -1
  50. package/helpers/normalize-id.d.ts +42 -0
  51. package/helpers/normalize-id.js +60 -0
  52. package/helpers/normalize-id.js.map +1 -0
  53. package/helpers/ns-core-url.d.ts +88 -0
  54. package/helpers/ns-core-url.js +191 -0
  55. package/helpers/ns-core-url.js.map +1 -0
  56. package/helpers/package-platform-aliases.js +4 -3
  57. package/helpers/package-platform-aliases.js.map +1 -1
  58. package/helpers/platform-types.d.ts +2 -0
  59. package/helpers/platform-types.js +2 -0
  60. package/helpers/platform-types.js.map +1 -0
  61. package/helpers/project.d.ts +35 -0
  62. package/helpers/project.js +120 -2
  63. package/helpers/project.js.map +1 -1
  64. package/helpers/resolver.js +17 -2
  65. package/helpers/resolver.js.map +1 -1
  66. package/helpers/ts-config-paths.d.ts +14 -0
  67. package/helpers/ts-config-paths.js +89 -8
  68. package/helpers/ts-config-paths.js.map +1 -1
  69. package/helpers/typescript-check.d.ts +2 -1
  70. package/helpers/typescript-check.js.map +1 -1
  71. package/helpers/workers.d.ts +20 -19
  72. package/helpers/workers.js +624 -4
  73. package/helpers/workers.js.map +1 -1
  74. package/hmr/client/css-handler.d.ts +1 -0
  75. package/hmr/client/css-handler.js +33 -20
  76. package/hmr/client/css-handler.js.map +1 -1
  77. package/hmr/client/css-update-overlay.d.ts +18 -0
  78. package/hmr/client/css-update-overlay.js +27 -0
  79. package/hmr/client/css-update-overlay.js.map +1 -0
  80. package/hmr/client/framework-client-strategy.d.ts +73 -0
  81. package/hmr/client/framework-client-strategy.js +19 -0
  82. package/hmr/client/framework-client-strategy.js.map +1 -0
  83. package/hmr/client/hmr-pending-overlay.d.ts +27 -0
  84. package/hmr/client/hmr-pending-overlay.js +50 -0
  85. package/hmr/client/hmr-pending-overlay.js.map +1 -0
  86. package/hmr/client/index.js +459 -164
  87. package/hmr/client/index.js.map +1 -1
  88. package/hmr/client/utils.d.ts +6 -1
  89. package/hmr/client/utils.js +184 -8
  90. package/hmr/client/utils.js.map +1 -1
  91. package/hmr/entry-runtime.d.ts +2 -1
  92. package/hmr/entry-runtime.js +252 -65
  93. package/hmr/entry-runtime.js.map +1 -1
  94. package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
  95. package/hmr/frameworks/angular/build/angular-linker.js +109 -0
  96. package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
  97. package/hmr/frameworks/angular/build/inject-component-hmr-registration.d.ts +112 -0
  98. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js +291 -0
  99. package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
  100. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
  101. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
  102. package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
  103. package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
  104. package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
  105. package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
  106. package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
  107. package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
  108. package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
  109. package/hmr/frameworks/angular/build/shared-linker.js +128 -0
  110. package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
  111. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
  112. package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
  113. package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
  114. package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
  115. package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +1 -0
  116. package/hmr/frameworks/angular/build/util.js +155 -0
  117. package/hmr/frameworks/angular/build/util.js.map +1 -0
  118. package/hmr/frameworks/angular/client/index.d.ts +1 -0
  119. package/hmr/frameworks/angular/client/index.js +778 -20
  120. package/hmr/frameworks/angular/client/index.js.map +1 -1
  121. package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
  122. package/hmr/frameworks/angular/client/strategy.js +19 -0
  123. package/hmr/frameworks/angular/client/strategy.js.map +1 -0
  124. package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
  125. package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
  126. package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
  127. package/hmr/frameworks/angular/server/linker.js +1 -4
  128. package/hmr/frameworks/angular/server/linker.js.map +1 -1
  129. package/hmr/frameworks/angular/server/strategy.js +448 -12
  130. package/hmr/frameworks/angular/server/strategy.js.map +1 -1
  131. package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
  132. package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
  133. package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +17 -11
  134. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js +336 -0
  135. package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
  136. package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
  137. package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
  138. package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
  139. package/hmr/frameworks/solid/server/strategy.js +360 -16
  140. package/hmr/frameworks/solid/server/strategy.js.map +1 -1
  141. package/hmr/frameworks/typescript/server/strategy.js +28 -14
  142. package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
  143. package/hmr/frameworks/vue/client/index.js +30 -199
  144. package/hmr/frameworks/vue/client/index.js.map +1 -1
  145. package/hmr/frameworks/vue/client/strategy.d.ts +7 -0
  146. package/hmr/frameworks/vue/client/strategy.js +83 -0
  147. package/hmr/frameworks/vue/client/strategy.js.map +1 -0
  148. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +82 -0
  149. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +133 -0
  150. package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
  151. package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
  152. package/hmr/frameworks/vue/server/sfc-route-assemble.js +706 -0
  153. package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
  154. package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
  155. package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
  156. package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
  157. package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
  158. package/hmr/frameworks/vue/server/sfc-route-serve.js +457 -0
  159. package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
  160. package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +19 -0
  161. package/hmr/frameworks/vue/server/sfc-route-shared.js +14 -0
  162. package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
  163. package/hmr/frameworks/vue/server/strategy.js +244 -0
  164. package/hmr/frameworks/vue/server/strategy.js.map +1 -1
  165. package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
  166. package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
  167. package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
  168. package/hmr/helpers/ast-normalizer.js +52 -5
  169. package/hmr/helpers/ast-normalizer.js.map +1 -1
  170. package/hmr/helpers/cjs-named-exports.d.ts +23 -0
  171. package/hmr/helpers/cjs-named-exports.js +152 -0
  172. package/hmr/helpers/cjs-named-exports.js.map +1 -0
  173. package/hmr/helpers/package-exports.d.ts +16 -0
  174. package/hmr/helpers/package-exports.js +396 -0
  175. package/hmr/helpers/package-exports.js.map +1 -0
  176. package/hmr/server/constants.js +13 -4
  177. package/hmr/server/constants.js.map +1 -1
  178. package/hmr/server/core-sanitize.d.ts +90 -7
  179. package/hmr/server/core-sanitize.js +211 -56
  180. package/hmr/server/core-sanitize.js.map +1 -1
  181. package/hmr/server/device-transform-helpers.d.ts +24 -0
  182. package/hmr/server/device-transform-helpers.js +327 -0
  183. package/hmr/server/device-transform-helpers.js.map +1 -0
  184. package/hmr/server/framework-strategy.d.ts +95 -11
  185. package/hmr/server/hmr-module-graph.d.ts +37 -0
  186. package/hmr/server/hmr-module-graph.js +214 -0
  187. package/hmr/server/hmr-module-graph.js.map +1 -0
  188. package/hmr/server/import-map.d.ts +11 -2
  189. package/hmr/server/import-map.js +59 -40
  190. package/hmr/server/import-map.js.map +1 -1
  191. package/hmr/server/index.js +7 -16
  192. package/hmr/server/index.js.map +1 -1
  193. package/hmr/server/ns-core-cjs-shape.d.ts +204 -0
  194. package/hmr/server/ns-core-cjs-shape.js +271 -0
  195. package/hmr/server/ns-core-cjs-shape.js.map +1 -0
  196. package/hmr/server/ns-rt-bridge.d.ts +51 -0
  197. package/hmr/server/ns-rt-bridge.js +131 -0
  198. package/hmr/server/ns-rt-bridge.js.map +1 -0
  199. package/hmr/server/ns-rt-route.d.ts +5 -0
  200. package/hmr/server/ns-rt-route.js +35 -0
  201. package/hmr/server/ns-rt-route.js.map +1 -0
  202. package/hmr/server/perf-instrumentation.d.ts +114 -0
  203. package/hmr/server/perf-instrumentation.js +195 -0
  204. package/hmr/server/perf-instrumentation.js.map +1 -0
  205. package/hmr/server/process-code-for-device.d.ts +15 -0
  206. package/hmr/server/process-code-for-device.js +654 -0
  207. package/hmr/server/process-code-for-device.js.map +1 -0
  208. package/hmr/server/require-guard.d.ts +1 -0
  209. package/hmr/server/require-guard.js +12 -0
  210. package/hmr/server/require-guard.js.map +1 -0
  211. package/hmr/server/rewrite-imports.d.ts +2 -0
  212. package/hmr/server/rewrite-imports.js +604 -0
  213. package/hmr/server/rewrite-imports.js.map +1 -0
  214. package/hmr/server/route-helpers.d.ts +7 -0
  215. package/hmr/server/route-helpers.js +13 -0
  216. package/hmr/server/route-helpers.js.map +1 -0
  217. package/hmr/server/server-origin.d.ts +12 -0
  218. package/hmr/server/server-origin.js +66 -0
  219. package/hmr/server/server-origin.js.map +1 -0
  220. package/hmr/server/shared-transform-request.js +12 -5
  221. package/hmr/server/shared-transform-request.js.map +1 -1
  222. package/hmr/server/transform-cache-invalidation.d.ts +11 -0
  223. package/hmr/server/transform-cache-invalidation.js +84 -0
  224. package/hmr/server/transform-cache-invalidation.js.map +1 -0
  225. package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
  226. package/hmr/server/vendor-bare-module-shims.js +80 -0
  227. package/hmr/server/vendor-bare-module-shims.js.map +1 -0
  228. package/hmr/server/vite-plugin.js +60 -42
  229. package/hmr/server/vite-plugin.js.map +1 -1
  230. package/hmr/server/websocket-core-bridge.d.ts +41 -6
  231. package/hmr/server/websocket-core-bridge.js +72 -75
  232. package/hmr/server/websocket-core-bridge.js.map +1 -1
  233. package/hmr/server/websocket-css-hot-update.d.ts +33 -0
  234. package/hmr/server/websocket-css-hot-update.js +65 -0
  235. package/hmr/server/websocket-css-hot-update.js.map +1 -0
  236. package/hmr/server/websocket-device-transform.d.ts +3 -0
  237. package/hmr/server/websocket-device-transform.js +7 -0
  238. package/hmr/server/websocket-device-transform.js.map +1 -0
  239. package/hmr/server/websocket-graph-upsert.d.ts +15 -0
  240. package/hmr/server/websocket-graph-upsert.js +20 -0
  241. package/hmr/server/websocket-graph-upsert.js.map +1 -1
  242. package/hmr/server/websocket-hmr-pending.d.ts +37 -0
  243. package/hmr/server/websocket-hmr-pending.js +55 -0
  244. package/hmr/server/websocket-hmr-pending.js.map +1 -0
  245. package/hmr/server/websocket-hot-update.d.ts +77 -0
  246. package/hmr/server/websocket-hot-update.js +330 -0
  247. package/hmr/server/websocket-hot-update.js.map +1 -0
  248. package/hmr/server/websocket-import-map-route.d.ts +15 -0
  249. package/hmr/server/websocket-import-map-route.js +46 -0
  250. package/hmr/server/websocket-import-map-route.js.map +1 -0
  251. package/hmr/server/websocket-module-bindings.js +3 -3
  252. package/hmr/server/websocket-module-bindings.js.map +1 -1
  253. package/hmr/server/websocket-module-specifiers.d.ts +66 -2
  254. package/hmr/server/websocket-module-specifiers.js +202 -19
  255. package/hmr/server/websocket-module-specifiers.js.map +1 -1
  256. package/hmr/server/websocket-ns-core.d.ts +21 -0
  257. package/hmr/server/websocket-ns-core.js +306 -0
  258. package/hmr/server/websocket-ns-core.js.map +1 -0
  259. package/hmr/server/websocket-ns-entry.d.ts +21 -0
  260. package/hmr/server/websocket-ns-entry.js +150 -0
  261. package/hmr/server/websocket-ns-entry.js.map +1 -0
  262. package/hmr/server/websocket-ns-m-paths.d.ts +3 -0
  263. package/hmr/server/websocket-ns-m-paths.js +92 -0
  264. package/hmr/server/websocket-ns-m-paths.js.map +1 -0
  265. package/hmr/server/websocket-ns-m-request.d.ts +45 -0
  266. package/hmr/server/websocket-ns-m-request.js +196 -0
  267. package/hmr/server/websocket-ns-m-request.js.map +1 -0
  268. package/hmr/server/websocket-ns-m.d.ts +33 -0
  269. package/hmr/server/websocket-ns-m.js +748 -0
  270. package/hmr/server/websocket-ns-m.js.map +1 -0
  271. package/hmr/server/websocket-served-module-helpers.d.ts +39 -0
  272. package/hmr/server/websocket-served-module-helpers.js +654 -0
  273. package/hmr/server/websocket-served-module-helpers.js.map +1 -0
  274. package/hmr/server/websocket-txn.d.ts +6 -0
  275. package/hmr/server/websocket-txn.js +39 -0
  276. package/hmr/server/websocket-txn.js.map +1 -0
  277. package/hmr/server/websocket-vendor-unifier.d.ts +9 -0
  278. package/hmr/server/websocket-vendor-unifier.js +46 -0
  279. package/hmr/server/websocket-vendor-unifier.js.map +1 -0
  280. package/hmr/server/websocket.d.ts +8 -39
  281. package/hmr/server/websocket.js +602 -6049
  282. package/hmr/server/websocket.js.map +1 -1
  283. package/hmr/shared/ns-globals.d.ts +118 -0
  284. package/hmr/shared/ns-globals.js +27 -0
  285. package/hmr/shared/ns-globals.js.map +1 -0
  286. package/hmr/shared/protocol.d.ts +136 -0
  287. package/hmr/shared/protocol.js +28 -0
  288. package/hmr/shared/protocol.js.map +1 -0
  289. package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
  290. package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
  291. package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
  292. package/hmr/shared/runtime/boot-progress.d.ts +40 -0
  293. package/hmr/shared/runtime/boot-progress.js +128 -0
  294. package/hmr/shared/runtime/boot-progress.js.map +1 -0
  295. package/hmr/shared/runtime/boot-timeline.d.ts +18 -0
  296. package/hmr/shared/runtime/boot-timeline.js +52 -0
  297. package/hmr/shared/runtime/boot-timeline.js.map +1 -0
  298. package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
  299. package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
  300. package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
  301. package/hmr/shared/runtime/dev-overlay.d.ts +75 -26
  302. package/hmr/shared/runtime/dev-overlay.js +990 -260
  303. package/hmr/shared/runtime/dev-overlay.js.map +1 -1
  304. package/hmr/shared/runtime/module-provenance.js +1 -4
  305. package/hmr/shared/runtime/module-provenance.js.map +1 -1
  306. package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
  307. package/hmr/shared/runtime/root-placeholder-view.js +310 -0
  308. package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
  309. package/hmr/shared/runtime/root-placeholder.js +352 -194
  310. package/hmr/shared/runtime/root-placeholder.js.map +1 -1
  311. package/hmr/shared/runtime/session-bootstrap.js +164 -1
  312. package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
  313. package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
  314. package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
  315. package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
  316. package/hmr/shared/vendor/manifest-collect.js +512 -0
  317. package/hmr/shared/vendor/manifest-collect.js.map +1 -0
  318. package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
  319. package/hmr/shared/vendor/manifest-loader.js +3 -2
  320. package/hmr/shared/vendor/manifest-loader.js.map +1 -1
  321. package/hmr/shared/vendor/manifest.d.ts +1 -7
  322. package/hmr/shared/vendor/manifest.js +102 -741
  323. package/hmr/shared/vendor/manifest.js.map +1 -1
  324. package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
  325. package/hmr/shared/vendor/vendor-device-shim.js +208 -0
  326. package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
  327. package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +16 -0
  328. package/hmr/shared/vendor/vendor-esbuild-plugins.js +203 -0
  329. package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
  330. package/index.d.ts +1 -0
  331. package/index.js +5 -0
  332. package/index.js.map +1 -1
  333. package/package.json +55 -11
  334. package/runtime/core-aliases-early.js +17 -41
  335. package/runtime/core-aliases-early.js.map +1 -1
  336. package/helpers/angular/angular-linker.d.ts +0 -13
  337. package/helpers/angular/angular-linker.js +0 -194
  338. package/helpers/angular/angular-linker.js.map +0 -1
  339. package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
  340. package/helpers/angular/shared-linker.d.ts +0 -11
  341. package/helpers/angular/shared-linker.js +0 -75
  342. package/helpers/angular/shared-linker.js.map +0 -1
  343. package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
  344. package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
  345. package/helpers/angular/util.js +0 -67
  346. package/helpers/angular/util.js.map +0 -1
  347. package/helpers/prelink-angular.d.ts +0 -2
  348. package/helpers/prelink-angular.js +0 -117
  349. package/helpers/prelink-angular.js.map +0 -1
  350. package/hmr/server/websocket-angular-entry.js.map +0 -1
  351. package/hmr/server/websocket-angular-hot-update.js +0 -239
  352. package/hmr/server/websocket-angular-hot-update.js.map +0 -1
  353. /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
  354. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
  355. /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
  356. /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
@@ -0,0 +1,204 @@
1
+ /**
2
+ * CJS/ESM interop shape.
3
+ *
4
+ * PROBLEM
5
+ * -------
6
+ * ESM Module Namespace Objects (ECMA §9.4.6) have [[Prototype]] = null.
7
+ * They do NOT inherit Object.prototype — no `hasOwnProperty`, no `toString`,
8
+ * no `isPrototypeOf`. CJS consumers (most notably zone.js's `patchMethod`)
9
+ * assume their require() result is a plain object that has those methods:
10
+ *
11
+ * let proto = target;
12
+ * while (proto && !proto.hasOwnProperty(name)) // ← crashes on null-proto
13
+ * proto = Object.getPrototypeOf(proto);
14
+ *
15
+ * `@nativescript/core/index.js` re-exports several sub-modules as namespaces:
16
+ *
17
+ * export * as Utils from './utils';
18
+ * export * as Http from './http';
19
+ * export * as Connectivity from './connectivity';
20
+ * export * as ApplicationSettings from './application-settings';
21
+ *
22
+ * When bundle.mjs does `import { Utils } from '@nativescript/core'`, `Utils`
23
+ * binds to that null-proto sub-namespace. zone.js then does
24
+ * `patchMethod(Utils, 'mainThreadify', …)` and crashes.
25
+ *
26
+ * WHY globalThis.require shims ALONE DON'T FIX THIS
27
+ * -------------------------------------------------
28
+ * ESM imports never pass through `globalThis.require`. They go through the
29
+ * host's ESM linker (V8 on iOS). Shimming `require` only intercepts the CJS
30
+ * path (vendor packages that use `require('@nativescript/core')`); direct
31
+ * ESM imports of `Utils` still see the raw null-proto namespace.
32
+ *
33
+ * THE FIX
34
+ * -------
35
+ * Rewrite `export * as X from 'Y'` at the /ns/core bridge response level:
36
+ *
37
+ * // before
38
+ * export * as Utils from './utils';
39
+ *
40
+ * // after
41
+ * import * as __ns_re_Utils__ from './utils';
42
+ * export const Utils = __NS_CJS_SHAPE__(__ns_re_Utils__);
43
+ *
44
+ * Now `Utils` is a plain Object (inherits Object.prototype). Zone.js's
45
+ * `patchMethod(Utils, ...)` succeeds. The shape function is recursive —
46
+ * nested namespaces get the same treatment — and identity-preserving
47
+ * (WeakMap-cached) so mutations stick across lookups.
48
+ *
49
+ * WHY THE SHAPE INSTALL MUST RUN IN MODULE BODY (NOT FOOTER)
50
+ * ---------------------------------------------------------
51
+ * `export const Utils = __NS_CJS_SHAPE__(__ns_re_Utils__)` is body code. It
52
+ * executes during module evaluation, BEFORE the registration footer. So the
53
+ * shape function must be installed as a body-level statement that runs
54
+ * before the rewritten body — we can't rely on the footer's install.
55
+ *
56
+ * Each served /ns/core module independently installs the shape function via
57
+ * an idempotent `|| (globalThis.__NS_CJS_SHAPE__ = ...)` assignment. The
58
+ * first module to evaluate wins; subsequent evaluations are no-ops. This
59
+ * also handles dependency-before-importer order (depth-first ESM eval):
60
+ * `/ns/core/utils` evaluates before `/ns/core` main, so the shape helper
61
+ * is in place whenever any body needs it.
62
+ */
63
+ /**
64
+ * Body-code statements that idempotently install `globalThis.__NS_CJS_SHAPE__`
65
+ * and `globalThis.__NS_CJS_SHAPE_CACHE__`. Must execute BEFORE any transformed
66
+ * `export const X = __NS_CJS_SHAPE__(...)` statement in the same module.
67
+ *
68
+ * Properties:
69
+ * - Recursive: traverses nested namespaces so `Utils.Something` is also
70
+ * a plain Object (if that sub-namespace is itself null-proto).
71
+ * - Identity-preserving: WeakMap keyed on the underlying ESM namespace.
72
+ * zone.js mutates its patch target; a fresh copy per call would lose
73
+ * mutations. Every lookup of the same namespace returns the same
74
+ * shaped object.
75
+ * - Cycle-safe: records the output in the cache BEFORE recursing into
76
+ * children. Handles `core ↔ platform` style cycles.
77
+ * - TDZ-safe: wraps each property read in try/catch. Some exports
78
+ * (Angular zone.js with early-access patterns) are still in their
79
+ * temporal dead zone when the namespace is first snapshotted. A thrown
80
+ * property read is skipped rather than failing the whole shape.
81
+ */
82
+ export declare function buildShapeInstallHeader(): string;
83
+ /**
84
+ * Rewrite namespace re-exports from CJS-incompatible ESM namespace form into
85
+ * shape-aware const exports. Handles the two forms Vite/esbuild may emit:
86
+ *
87
+ * (1) Original ES2020 syntax preserved unchanged:
88
+ * export * as X from 'Y';
89
+ *
90
+ * (2) Transpiled form esbuild emits when targeting older ES:
91
+ * import * as _foo from 'Y';
92
+ * export { _foo as X };
93
+ *
94
+ * Both become:
95
+ * import * as __ns_re_X__ from 'Y';
96
+ * export const X = __NS_CJS_SHAPE__(__ns_re_X__);
97
+ *
98
+ * Notes on the transform:
99
+ * - The internal binding uses a derived name (`__ns_re_<X>__`) so
100
+ * collisions with user bindings are extremely unlikely. Core doesn't
101
+ * declare identifiers matching that shape.
102
+ * - `__NS_CJS_SHAPE__` is read from globalThis with a defensive fallback
103
+ * (identity function) in case installation failed or runs in an
104
+ * environment where it hasn't been initialized yet. This makes the
105
+ * transform safe to apply to modules that don't always go through the
106
+ * /ns/core handler's headers.
107
+ * - We do NOT shape `export *` (star re-exports without alias). Those
108
+ * spread individual named exports — they don't create a nested
109
+ * namespace and aren't affected by the null-proto issue.
110
+ * - We do NOT shape `export { x } from 'y'` forms. Those copy individual
111
+ * named exports directly; the consumer never sees the namespace.
112
+ *
113
+ * The regex is intentionally precise. It matches only the `export * as X from
114
+ * 'Y'` syntactic form (and its transpiled equivalent) — no accidental matches
115
+ * in string literals or comments because those can't start a top-level
116
+ * statement with `export`.
117
+ */
118
+ export declare function rewriteNamespaceReExportsForShape(code: string): string;
119
+ /**
120
+ * Convenience: returns true if the given code appears to contain at least one
121
+ * namespace re-export that would benefit from the shape transform. Used to
122
+ * skip the regex replace for modules that don't need it (keeps the response
123
+ * identical for most submodules, which just have plain `export * from` or
124
+ * named exports).
125
+ */
126
+ export declare function hasNamespaceReExport(code: string): boolean;
127
+ /**
128
+ * Default-export bridge footer.
129
+ *
130
+ * BACKGROUND
131
+ * ----------
132
+ * Upstream consumer rewrites in the /ns/m handler convert
133
+ * `import { X } from '@nativescript/core'` into
134
+ * `import __ns_core_ns from '/ns/core'; const { X } = __ns_core_ns;`
135
+ * — a DEFAULT import followed by destructuring. The inline comment on that
136
+ * rewrite says explicitly: "This makes `import { Frame } from
137
+ * '@nativescript/core'` work even if the bridge provides only a default
138
+ * export."
139
+ *
140
+ * The original `@nativescript/core/index.js` has no `export default` — all
141
+ * named exports. Without this footer, consumers of the transformed import
142
+ * fail at ESM link time:
143
+ *
144
+ * SyntaxError: The requested module '/ns/core/<ver>' does not
145
+ * provide an export named 'default'
146
+ *
147
+ * THE FIX
148
+ * -------
149
+ * Emit `export default __ns_core_self_ns__;` at the end of the served
150
+ * module body. `__ns_core_self_ns__` is the namespace import the server
151
+ * already emits at the top of every /ns/core response for self-
152
+ * registration purposes. ESM spec guarantees a module re-entering itself
153
+ * during evaluation returns the in-progress namespace — so no extra
154
+ * evaluation occurs, and the default binding receives an object whose
155
+ * properties are every named export of the same module.
156
+ *
157
+ * CONSUMER MATRIX AFTER THIS FIX
158
+ * ------------------------------
159
+ * • `import X from '/ns/core'` (default) → X = self namespace
160
+ * • `import * as X from '/ns/core'` → X = self namespace + X.default = self
161
+ * • `import { X } from '/ns/core'` (named) → individual named binding (untouched)
162
+ * • `const { X } = <default-import>` → destructure from self namespace
163
+ * • `require('@nativescript/core')` (CJS) → shaped self via registry
164
+ *
165
+ * SKIP CONDITIONS
166
+ * ---------------
167
+ * Returns empty string when the source already declares a default export
168
+ * (some deep subpaths do — e.g. a file that does `export default MyClass`
169
+ * would SyntaxError on a duplicate). The consumer rewrite is also gated
170
+ * on `isDeepCoreSubpath`, so those paths don't normally hit the default-
171
+ * import pattern anyway.
172
+ *
173
+ * WHY THE DEFAULT ISN'T SHAPED
174
+ * ----------------------------
175
+ * The default is the raw null-proto MNO. This is intentional:
176
+ *
177
+ * 1. All current default-import consumers either destructure or do
178
+ * property access. Neither requires Object.prototype in the chain.
179
+ * 2. Shaping the default inside the module body would require calling
180
+ * __NS_CJS_SHAPE__ on a namespace whose own `default` slot is still
181
+ * being initialized — temporal dead zone hazard.
182
+ * 3. CJS consumers that need `.hasOwnProperty` go through the registry
183
+ * (shaped at registration), not through the default import.
184
+ *
185
+ * If a future consumer surfaces that calls `.hasOwnProperty` on the
186
+ * default, we can revisit. The current rule-of-least-surprise is:
187
+ * shape at the CJS boundary, not at the ESM boundary.
188
+ */
189
+ export declare function buildDefaultExportFooter(rewrittenCode: string): string;
190
+ /**
191
+ * Detects whether a module body already declares a default export in any of
192
+ * the syntactic forms the ESM spec allows. Mirrors the logic in
193
+ * `websocket-core-bridge.ts:hasModuleDefaultExport` — kept here so the
194
+ * default-export bridge helper is self-contained and unit-testable.
195
+ *
196
+ * Handles:
197
+ * - `export default <expr>;`
198
+ * - `export default function|class ...`
199
+ * - `export { x as default };`
200
+ * - `export { default };` (implicit `default as default`)
201
+ * - `export { default as default };`
202
+ * - `export { foo, default };`
203
+ */
204
+ export declare function hasExistingDefaultExport(code: string): boolean;
@@ -0,0 +1,271 @@
1
+ /**
2
+ * CJS/ESM interop shape.
3
+ *
4
+ * PROBLEM
5
+ * -------
6
+ * ESM Module Namespace Objects (ECMA §9.4.6) have [[Prototype]] = null.
7
+ * They do NOT inherit Object.prototype — no `hasOwnProperty`, no `toString`,
8
+ * no `isPrototypeOf`. CJS consumers (most notably zone.js's `patchMethod`)
9
+ * assume their require() result is a plain object that has those methods:
10
+ *
11
+ * let proto = target;
12
+ * while (proto && !proto.hasOwnProperty(name)) // ← crashes on null-proto
13
+ * proto = Object.getPrototypeOf(proto);
14
+ *
15
+ * `@nativescript/core/index.js` re-exports several sub-modules as namespaces:
16
+ *
17
+ * export * as Utils from './utils';
18
+ * export * as Http from './http';
19
+ * export * as Connectivity from './connectivity';
20
+ * export * as ApplicationSettings from './application-settings';
21
+ *
22
+ * When bundle.mjs does `import { Utils } from '@nativescript/core'`, `Utils`
23
+ * binds to that null-proto sub-namespace. zone.js then does
24
+ * `patchMethod(Utils, 'mainThreadify', …)` and crashes.
25
+ *
26
+ * WHY globalThis.require shims ALONE DON'T FIX THIS
27
+ * -------------------------------------------------
28
+ * ESM imports never pass through `globalThis.require`. They go through the
29
+ * host's ESM linker (V8 on iOS). Shimming `require` only intercepts the CJS
30
+ * path (vendor packages that use `require('@nativescript/core')`); direct
31
+ * ESM imports of `Utils` still see the raw null-proto namespace.
32
+ *
33
+ * THE FIX
34
+ * -------
35
+ * Rewrite `export * as X from 'Y'` at the /ns/core bridge response level:
36
+ *
37
+ * // before
38
+ * export * as Utils from './utils';
39
+ *
40
+ * // after
41
+ * import * as __ns_re_Utils__ from './utils';
42
+ * export const Utils = __NS_CJS_SHAPE__(__ns_re_Utils__);
43
+ *
44
+ * Now `Utils` is a plain Object (inherits Object.prototype). Zone.js's
45
+ * `patchMethod(Utils, ...)` succeeds. The shape function is recursive —
46
+ * nested namespaces get the same treatment — and identity-preserving
47
+ * (WeakMap-cached) so mutations stick across lookups.
48
+ *
49
+ * WHY THE SHAPE INSTALL MUST RUN IN MODULE BODY (NOT FOOTER)
50
+ * ---------------------------------------------------------
51
+ * `export const Utils = __NS_CJS_SHAPE__(__ns_re_Utils__)` is body code. It
52
+ * executes during module evaluation, BEFORE the registration footer. So the
53
+ * shape function must be installed as a body-level statement that runs
54
+ * before the rewritten body — we can't rely on the footer's install.
55
+ *
56
+ * Each served /ns/core module independently installs the shape function via
57
+ * an idempotent `|| (globalThis.__NS_CJS_SHAPE__ = ...)` assignment. The
58
+ * first module to evaluate wins; subsequent evaluations are no-ops. This
59
+ * also handles dependency-before-importer order (depth-first ESM eval):
60
+ * `/ns/core/utils` evaluates before `/ns/core` main, so the shape helper
61
+ * is in place whenever any body needs it.
62
+ */
63
+ /**
64
+ * Body-code statements that idempotently install `globalThis.__NS_CJS_SHAPE__`
65
+ * and `globalThis.__NS_CJS_SHAPE_CACHE__`. Must execute BEFORE any transformed
66
+ * `export const X = __NS_CJS_SHAPE__(...)` statement in the same module.
67
+ *
68
+ * Properties:
69
+ * - Recursive: traverses nested namespaces so `Utils.Something` is also
70
+ * a plain Object (if that sub-namespace is itself null-proto).
71
+ * - Identity-preserving: WeakMap keyed on the underlying ESM namespace.
72
+ * zone.js mutates its patch target; a fresh copy per call would lose
73
+ * mutations. Every lookup of the same namespace returns the same
74
+ * shaped object.
75
+ * - Cycle-safe: records the output in the cache BEFORE recursing into
76
+ * children. Handles `core ↔ platform` style cycles.
77
+ * - TDZ-safe: wraps each property read in try/catch. Some exports
78
+ * (Angular zone.js with early-access patterns) are still in their
79
+ * temporal dead zone when the namespace is first snapshotted. A thrown
80
+ * property read is skipped rather than failing the whole shape.
81
+ */
82
+ export function buildShapeInstallHeader() {
83
+ return [
84
+ `/* Invariant D: CJS/ESM interop shape installer */`,
85
+ `try { if (typeof globalThis !== 'undefined') {`,
86
+ ` const __nsShapeCache = globalThis.__NS_CJS_SHAPE_CACHE__ || (globalThis.__NS_CJS_SHAPE_CACHE__ = new WeakMap());`,
87
+ ` if (typeof globalThis.__NS_CJS_SHAPE__ !== 'function') {`,
88
+ ` globalThis.__NS_CJS_SHAPE__ = function __nsShape(obj) {`,
89
+ ` if (!obj || typeof obj !== 'object') return obj;`,
90
+ ` let isNsModule = false;`,
91
+ ` try { isNsModule = obj[Symbol.toStringTag] === 'Module'; } catch (e) {}`,
92
+ ` const proto = Object.getPrototypeOf(obj);`,
93
+ ` if (proto !== null && !isNsModule) return obj;`,
94
+ ` if (__nsShapeCache.has(obj)) return __nsShapeCache.get(obj);`,
95
+ ` const out = {};`,
96
+ ` __nsShapeCache.set(obj, out);`,
97
+ ` try {`,
98
+ ` const keys = Object.keys(obj);`,
99
+ ` for (let i = 0; i < keys.length; i++) {`,
100
+ ` const k = keys[i];`,
101
+ ` try { out[k] = __nsShape(obj[k]); } catch (e) { /* TDZ / unreadable */ }`,
102
+ ` }`,
103
+ ` } catch (e) {}`,
104
+ ` return out;`,
105
+ ` };`,
106
+ ` }`,
107
+ `} } catch (e) { console.warn('[ns-core] shape installer failed:', (e && e.message) || e); }`,
108
+ ].join('\n');
109
+ }
110
+ /**
111
+ * Rewrite namespace re-exports from CJS-incompatible ESM namespace form into
112
+ * shape-aware const exports. Handles the two forms Vite/esbuild may emit:
113
+ *
114
+ * (1) Original ES2020 syntax preserved unchanged:
115
+ * export * as X from 'Y';
116
+ *
117
+ * (2) Transpiled form esbuild emits when targeting older ES:
118
+ * import * as _foo from 'Y';
119
+ * export { _foo as X };
120
+ *
121
+ * Both become:
122
+ * import * as __ns_re_X__ from 'Y';
123
+ * export const X = __NS_CJS_SHAPE__(__ns_re_X__);
124
+ *
125
+ * Notes on the transform:
126
+ * - The internal binding uses a derived name (`__ns_re_<X>__`) so
127
+ * collisions with user bindings are extremely unlikely. Core doesn't
128
+ * declare identifiers matching that shape.
129
+ * - `__NS_CJS_SHAPE__` is read from globalThis with a defensive fallback
130
+ * (identity function) in case installation failed or runs in an
131
+ * environment where it hasn't been initialized yet. This makes the
132
+ * transform safe to apply to modules that don't always go through the
133
+ * /ns/core handler's headers.
134
+ * - We do NOT shape `export *` (star re-exports without alias). Those
135
+ * spread individual named exports — they don't create a nested
136
+ * namespace and aren't affected by the null-proto issue.
137
+ * - We do NOT shape `export { x } from 'y'` forms. Those copy individual
138
+ * named exports directly; the consumer never sees the namespace.
139
+ *
140
+ * The regex is intentionally precise. It matches only the `export * as X from
141
+ * 'Y'` syntactic form (and its transpiled equivalent) — no accidental matches
142
+ * in string literals or comments because those can't start a top-level
143
+ * statement with `export`.
144
+ */
145
+ export function rewriteNamespaceReExportsForShape(code) {
146
+ const shapeExpr = `(typeof globalThis.__NS_CJS_SHAPE__ === 'function' ? globalThis.__NS_CJS_SHAPE__ : function (x) { return x; })`;
147
+ // Form (1): export * as X from 'Y'; (ES2020 aggregate re-export)
148
+ let out = code.replace(/(^|\n)(\s*)export\s+\*\s+as\s+([A-Za-z_$][\w$]*)\s+from\s+(['"`])([^'"`\n]+)\4\s*;?/g, (_match, prefix, indent, name, quote, spec) => {
149
+ const internal = `__ns_re_${name}__`;
150
+ return `${prefix}${indent}import * as ${internal} from ${quote}${spec}${quote};\n${indent}export const ${name} = ${shapeExpr}(${internal});`;
151
+ });
152
+ // Form (2): import * as _x from 'Y'; export { _x as X };
153
+ // This pattern appears when esbuild targets older ES. We detect the pair
154
+ // by matching the import and its paired export on the same or adjacent
155
+ // lines. Rather than try to join two regex passes, we transform the
156
+ // `export { _x as X }` branch by replacing the `_x` in the export with a
157
+ // shape-wrapped const. Keeping the import intact is safe because the
158
+ // local binding is still needed for the shape call.
159
+ out = out.replace(/export\s*\{\s*([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)\s*\}\s*;?/g, (match, localName, exportName) => {
160
+ // Only transform if the local name looks like an esbuild-generated
161
+ // namespace binding (leading underscore) AND the export name is a
162
+ // PascalCase identifier. This avoids touching user re-exports.
163
+ if (!/^_/.test(localName))
164
+ return match;
165
+ if (!/^[A-Z]/.test(exportName))
166
+ return match;
167
+ return `export const ${exportName} = ${shapeExpr}(${localName});`;
168
+ });
169
+ return out;
170
+ }
171
+ /**
172
+ * Convenience: returns true if the given code appears to contain at least one
173
+ * namespace re-export that would benefit from the shape transform. Used to
174
+ * skip the regex replace for modules that don't need it (keeps the response
175
+ * identical for most submodules, which just have plain `export * from` or
176
+ * named exports).
177
+ */
178
+ export function hasNamespaceReExport(code) {
179
+ return /export\s+\*\s+as\s+[A-Za-z_$][\w$]*\s+from\s+['"`]/.test(code);
180
+ }
181
+ /**
182
+ * Default-export bridge footer.
183
+ *
184
+ * BACKGROUND
185
+ * ----------
186
+ * Upstream consumer rewrites in the /ns/m handler convert
187
+ * `import { X } from '@nativescript/core'` into
188
+ * `import __ns_core_ns from '/ns/core'; const { X } = __ns_core_ns;`
189
+ * — a DEFAULT import followed by destructuring. The inline comment on that
190
+ * rewrite says explicitly: "This makes `import { Frame } from
191
+ * '@nativescript/core'` work even if the bridge provides only a default
192
+ * export."
193
+ *
194
+ * The original `@nativescript/core/index.js` has no `export default` — all
195
+ * named exports. Without this footer, consumers of the transformed import
196
+ * fail at ESM link time:
197
+ *
198
+ * SyntaxError: The requested module '/ns/core/<ver>' does not
199
+ * provide an export named 'default'
200
+ *
201
+ * THE FIX
202
+ * -------
203
+ * Emit `export default __ns_core_self_ns__;` at the end of the served
204
+ * module body. `__ns_core_self_ns__` is the namespace import the server
205
+ * already emits at the top of every /ns/core response for self-
206
+ * registration purposes. ESM spec guarantees a module re-entering itself
207
+ * during evaluation returns the in-progress namespace — so no extra
208
+ * evaluation occurs, and the default binding receives an object whose
209
+ * properties are every named export of the same module.
210
+ *
211
+ * CONSUMER MATRIX AFTER THIS FIX
212
+ * ------------------------------
213
+ * • `import X from '/ns/core'` (default) → X = self namespace
214
+ * • `import * as X from '/ns/core'` → X = self namespace + X.default = self
215
+ * • `import { X } from '/ns/core'` (named) → individual named binding (untouched)
216
+ * • `const { X } = <default-import>` → destructure from self namespace
217
+ * • `require('@nativescript/core')` (CJS) → shaped self via registry
218
+ *
219
+ * SKIP CONDITIONS
220
+ * ---------------
221
+ * Returns empty string when the source already declares a default export
222
+ * (some deep subpaths do — e.g. a file that does `export default MyClass`
223
+ * would SyntaxError on a duplicate). The consumer rewrite is also gated
224
+ * on `isDeepCoreSubpath`, so those paths don't normally hit the default-
225
+ * import pattern anyway.
226
+ *
227
+ * WHY THE DEFAULT ISN'T SHAPED
228
+ * ----------------------------
229
+ * The default is the raw null-proto MNO. This is intentional:
230
+ *
231
+ * 1. All current default-import consumers either destructure or do
232
+ * property access. Neither requires Object.prototype in the chain.
233
+ * 2. Shaping the default inside the module body would require calling
234
+ * __NS_CJS_SHAPE__ on a namespace whose own `default` slot is still
235
+ * being initialized — temporal dead zone hazard.
236
+ * 3. CJS consumers that need `.hasOwnProperty` go through the registry
237
+ * (shaped at registration), not through the default import.
238
+ *
239
+ * If a future consumer surfaces that calls `.hasOwnProperty` on the
240
+ * default, we can revisit. The current rule-of-least-surprise is:
241
+ * shape at the CJS boundary, not at the ESM boundary.
242
+ */
243
+ export function buildDefaultExportFooter(rewrittenCode) {
244
+ if (hasExistingDefaultExport(rewrittenCode))
245
+ return '';
246
+ return ['/* Default-export bridge for /ns/core consumers */', 'export default __ns_core_self_ns__;'].join('\n');
247
+ }
248
+ /**
249
+ * Detects whether a module body already declares a default export in any of
250
+ * the syntactic forms the ESM spec allows. Mirrors the logic in
251
+ * `websocket-core-bridge.ts:hasModuleDefaultExport` — kept here so the
252
+ * default-export bridge helper is self-contained and unit-testable.
253
+ *
254
+ * Handles:
255
+ * - `export default <expr>;`
256
+ * - `export default function|class ...`
257
+ * - `export { x as default };`
258
+ * - `export { default };` (implicit `default as default`)
259
+ * - `export { default as default };`
260
+ * - `export { foo, default };`
261
+ */
262
+ export function hasExistingDefaultExport(code) {
263
+ if (!code || typeof code !== 'string')
264
+ return false;
265
+ if (/\bexport\s+default\b/.test(code))
266
+ return true;
267
+ if (/\bexport\s*\{[^}]*\bdefault\b[^}]*\}/.test(code))
268
+ return true;
269
+ return false;
270
+ }
271
+ //# sourceMappingURL=ns-core-cjs-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ns-core-cjs-shape.js","sourceRoot":"","sources":["../../../../../packages/vite/hmr/server/ns-core-cjs-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,oDAAoD;QACpD,gDAAgD;QAChD,oHAAoH;QACpH,4DAA4D;QAC5D,6DAA6D;QAC7D,wDAAwD;QACxD,+BAA+B;QAC/B,+EAA+E;QAC/E,iDAAiD;QACjD,sDAAsD;QACtD,oEAAoE;QACpE,uBAAuB;QACvB,qCAAqC;QACrC,aAAa;QACb,wCAAwC;QACxC,iDAAiD;QACjD,8BAA8B;QAC9B,oFAAoF;QACpF,WAAW;QACX,sBAAsB;QACtB,mBAAmB;QACnB,QAAQ;QACR,KAAK;QACL,6FAA6F;KAC7F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,UAAU,iCAAiC,CAAC,IAAY;IAC7D,MAAM,SAAS,GAAG,gHAAgH,CAAC;IAEnI,kEAAkE;IAClE,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,sFAAsF,EAAE,CAAC,MAAM,EAAE,MAAc,EAAE,MAAc,EAAE,IAAY,EAAE,KAAa,EAAE,IAAY,EAAE,EAAE;QACpM,MAAM,QAAQ,GAAG,WAAW,IAAI,IAAI,CAAC;QACrC,OAAO,GAAG,MAAM,GAAG,MAAM,eAAe,QAAQ,SAAS,KAAK,GAAG,IAAI,GAAG,KAAK,MAAM,MAAM,gBAAgB,IAAI,MAAM,SAAS,IAAI,QAAQ,IAAI,CAAC;IAC9I,CAAC,CAAC,CAAC;IAEH,yDAAyD;IACzD,yEAAyE;IACzE,uEAAuE;IACvE,oEAAoE;IACpE,yEAAyE;IACzE,qEAAqE;IACrE,oDAAoD;IACpD,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,uEAAuE,EAAE,CAAC,KAAK,EAAE,SAAiB,EAAE,UAAkB,EAAE,EAAE;QAC3I,mEAAmE;QACnE,kEAAkE;QAClE,+DAA+D;QAC/D,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC;YAAE,OAAO,KAAK,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC;YAAE,OAAO,KAAK,CAAC;QAC7C,OAAO,gBAAgB,UAAU,MAAM,SAAS,IAAI,SAAS,IAAI,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAChD,OAAO,oDAAoD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC7D,IAAI,wBAAwB,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,CAAC;IACvD,OAAO,CAAC,oDAAoD,EAAE,qCAAqC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAY;IACpD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACpD,IAAI,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACnE,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,51 @@
1
+ export interface NsRtBridgeOptions {
2
+ /** Version segment from `/ns/rt/<ver>`. Retained for the URL dispatcher; the bridge body intentionally ignores it. */
3
+ rtVer: string;
4
+ /** Prologue installed verbatim before the bridge body (typically the require URL guard). */
5
+ requireGuardSnippet: string;
6
+ /**
7
+ * The discovered ESM export names of the underlying vendor package
8
+ * (`nativescript-vue`, including its `@vue/runtime-core` re-export
9
+ * chain). Each name becomes `export const <name> = (__ensure().<name>);` —
10
+ * a single canonical specifier (`/ns/rt`) forwards *every* symbol the
11
+ * vendor publishes.
12
+ *
13
+ * Required: discovery is the only source of truth. There is no hand-curated
14
+ * fallback — if discovery cannot see the package, the bridge serves no
15
+ * passthroughs and the call site is expected to surface that as a config
16
+ * error rather than silently degrade.
17
+ */
18
+ vendorExports: Iterable<string>;
19
+ }
20
+ /**
21
+ * Build the `/ns/rt` runtime bridge module text.
22
+ *
23
+ * Single-realm policy: every named export the vendor package publishes
24
+ * appears as `export const X = (__ensure().X);` — a constant binding, not a
25
+ * function wrapper. Constant bindings preserve identity for Vue's Symbol
26
+ * markers (`Fragment`, `Teleport`, …) AND work transparently for functions
27
+ * (`ref`, `createApp`, …) since the user code calls the underlying value
28
+ * directly. Calling `__ensure()` at module evaluation time is safe because
29
+ * the vendor bundle is registered earlier in the boot graph (vendor.mjs →
30
+ * `__nsVendorRegistry`), and the bridge resolves the same `nativescript-vue`
31
+ * record everyone else uses.
32
+ *
33
+ * HMR-specific shims (`$navigateTo`, `$navigateBack`, `$showModal`) and the
34
+ * Vite client polyfill (`vite__injectQuery`) are emitted as overrides that
35
+ * replace the would-be passthrough — those exports route through the HMR
36
+ * navigator instead of the vendor's native version, so the bridge must
37
+ * provide the override, not the discovered original.
38
+ */
39
+ export declare function buildNsRtBridgeModule(options: NsRtBridgeOptions): string;
40
+ /**
41
+ * Resolve the set of names the bridge should re-export for `nativescript-vue`
42
+ * given a project root. Static discovery via `enumeratePackageExports` is the
43
+ * only source — there is no curated fallback. If `nativescript-vue` is not
44
+ * resolvable from `projectRoot`, the returned set is empty and the bridge
45
+ * built from it will not emit passthroughs; the caller should treat that as
46
+ * the misconfiguration it is rather than mask it with a stale baseline.
47
+ *
48
+ * Caching lives inside `enumeratePackageExports`, so repeated calls in a dev
49
+ * session are effectively free.
50
+ */
51
+ export declare function discoverNsvBridgeExports(projectRoot: string): Set<string>;