powerlines 0.9.0 → 0.10.1

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 (365) hide show
  1. package/dist/astro.cjs +9 -9
  2. package/dist/astro.d.cts +2 -1
  3. package/dist/astro.d.ts +2 -1
  4. package/dist/astro.js +6 -6
  5. package/dist/{chunk-3L4KRPXQ.cjs → chunk-2RHPFVYT.cjs} +17 -18
  6. package/dist/{chunk-VQ5O5N7V.js → chunk-3Y5CCIJR.js} +3 -3
  7. package/dist/{chunk-YE56I7CZ.cjs → chunk-5XYGZ3DC.cjs} +2 -2
  8. package/dist/{chunk-V4TNA6HX.js → chunk-5Y4JYQ66.js} +3 -3
  9. package/dist/{chunk-WM76YQJH.cjs → chunk-66GXB2UY.cjs} +4 -4
  10. package/dist/{chunk-VOB62ELC.js → chunk-6TJGZR5X.js} +4 -4
  11. package/dist/{chunk-OKC6TA7P.js → chunk-6UDHGAAI.js} +3 -3
  12. package/dist/{chunk-ETEQKM36.cjs → chunk-7IWH37DY.cjs} +2 -2
  13. package/dist/{chunk-BDTLKRKQ.js → chunk-EGSEJQCE.js} +3 -3
  14. package/dist/{chunk-ILVCZATT.js → chunk-GPPJ2CRE.js} +2 -2
  15. package/dist/{chunk-RGJMMCOR.js → chunk-HVT7PBFF.js} +3 -3
  16. package/dist/chunk-IJBH5OUN.cjs +12 -0
  17. package/dist/chunk-JBTSAOIQ.js +31 -0
  18. package/dist/{chunk-W3NQCDUN.js → chunk-KYGEWAEG.js} +3 -3
  19. package/dist/{chunk-FOLQTZUP.cjs → chunk-L2SAK2JC.cjs} +4 -4
  20. package/dist/chunk-LXMNDUPG.cjs +12 -0
  21. package/dist/{chunk-GHW2FUF5.js → chunk-N7NE3VOU.js} +4 -4
  22. package/dist/{chunk-OEL3BTQP.js → chunk-OYIM2M74.js} +547 -522
  23. package/dist/{chunk-QK36ULYT.cjs → chunk-QHGPZK2H.cjs} +4 -4
  24. package/dist/chunk-RQ4CHMPO.cjs +12 -0
  25. package/dist/chunk-S5QFX2GM.cjs +12 -0
  26. package/dist/{chunk-IOBFVFH2.js → chunk-S746E63M.js} +3 -3
  27. package/dist/{chunk-MKZOY5EV.js → chunk-SDEBJQDT.js} +12 -13
  28. package/dist/chunk-SL3CXJWD.cjs +34 -0
  29. package/dist/{chunk-KC4VY5X4.cjs → chunk-UHCRNFFC.cjs} +9 -9
  30. package/dist/{chunk-ZQZ5ZUGG.cjs → chunk-UTVZVGM3.cjs} +555 -530
  31. package/dist/{chunk-QIKKQQF7.cjs → chunk-UZQYBO6Z.cjs} +4 -4
  32. package/dist/{chunk-65PSZQFC.js → chunk-VIRKTIPK.js} +3 -3
  33. package/dist/{chunk-UYS3BU6I.js → chunk-WCPY7HPU.js} +4 -4
  34. package/dist/{chunk-MMDBMHAW.js → chunk-WPVIF35O.js} +2 -2
  35. package/dist/chunk-YG7U2GIR.cjs +24 -0
  36. package/dist/{chunk-BY4UTCHZ.cjs → chunk-ZBDP43LG.cjs} +6 -6
  37. package/dist/chunk-ZFATNDSY.cjs +12 -0
  38. package/dist/{chunk-C3I5QEF5.js → chunk-ZU4IRZSQ.js} +7 -7
  39. package/dist/define-config.d.cts +2 -1
  40. package/dist/define-config.d.ts +2 -1
  41. package/dist/esbuild.cjs +8 -8
  42. package/dist/esbuild.d.cts +2 -1
  43. package/dist/esbuild.d.ts +2 -1
  44. package/dist/esbuild.js +5 -5
  45. package/dist/extend-plugin.d.cts +2 -1
  46. package/dist/extend-plugin.d.ts +2 -1
  47. package/dist/farm.cjs +4 -4
  48. package/dist/farm.d.cts +2 -1
  49. package/dist/farm.d.ts +2 -1
  50. package/dist/farm.js +3 -3
  51. package/dist/{hooks-D0gf1nT3.d.ts → hooks-BGYnc61f.d.ts} +1 -1
  52. package/dist/{hooks-fVJu9DCF.d.cts → hooks-gk8S8LFP.d.cts} +1 -1
  53. package/dist/index.cjs +27 -27
  54. package/dist/index.d.cts +4 -3
  55. package/dist/index.d.ts +4 -3
  56. package/dist/index.js +18 -18
  57. package/dist/internal/api.cjs +3 -3
  58. package/dist/internal/api.d.cts +3 -2
  59. package/dist/internal/api.d.ts +3 -2
  60. package/dist/internal/api.js +2 -2
  61. package/dist/lib/build/esbuild.cjs +4 -4
  62. package/dist/lib/build/esbuild.d.cts +2 -1
  63. package/dist/lib/build/esbuild.d.ts +2 -1
  64. package/dist/lib/build/esbuild.js +1 -1
  65. package/dist/lib/build/index.cjs +25 -25
  66. package/dist/lib/build/index.d.cts +3 -2
  67. package/dist/lib/build/index.d.ts +3 -2
  68. package/dist/lib/build/index.js +9 -9
  69. package/dist/lib/build/rolldown.cjs +3 -3
  70. package/dist/lib/build/rolldown.d.cts +2 -1
  71. package/dist/lib/build/rolldown.d.ts +2 -1
  72. package/dist/lib/build/rolldown.js +2 -2
  73. package/dist/lib/build/rollup.cjs +3 -3
  74. package/dist/lib/build/rollup.d.cts +2 -1
  75. package/dist/lib/build/rollup.d.ts +2 -1
  76. package/dist/lib/build/rollup.js +1 -1
  77. package/dist/lib/build/rspack.cjs +2 -2
  78. package/dist/lib/build/rspack.d.cts +2 -1
  79. package/dist/lib/build/rspack.d.ts +2 -1
  80. package/dist/lib/build/rspack.js +1 -1
  81. package/dist/lib/build/tsup.cjs +5 -5
  82. package/dist/lib/build/tsup.d.cts +2 -1
  83. package/dist/lib/build/tsup.d.ts +2 -1
  84. package/dist/lib/build/tsup.js +2 -2
  85. package/dist/lib/build/unbuild.cjs +6 -6
  86. package/dist/lib/build/unbuild.d.cts +3 -2
  87. package/dist/lib/build/unbuild.d.ts +3 -2
  88. package/dist/lib/build/unbuild.js +3 -3
  89. package/dist/lib/build/vite.cjs +4 -4
  90. package/dist/lib/build/vite.d.cts +2 -1
  91. package/dist/lib/build/vite.d.ts +2 -1
  92. package/dist/lib/build/vite.js +2 -2
  93. package/dist/lib/build/webpack.cjs +2 -2
  94. package/dist/lib/build/webpack.d.cts +2 -1
  95. package/dist/lib/build/webpack.d.ts +2 -1
  96. package/dist/lib/build/webpack.js +1 -1
  97. package/dist/lib/{chunk-7CZ2QZEV.js → chunk-3I2YOM2E.js} +4 -4
  98. package/dist/lib/chunk-3I2YOM2E.js.map +1 -0
  99. package/dist/lib/{chunk-KAOWUIFH.cjs → chunk-4XUVP2LL.cjs} +3 -3
  100. package/dist/lib/chunk-4XUVP2LL.cjs.map +1 -0
  101. package/dist/lib/{chunk-ZKYZWEHY.cjs → chunk-6U2UX2PX.cjs} +4 -4
  102. package/dist/lib/chunk-6U2UX2PX.cjs.map +1 -0
  103. package/dist/lib/{chunk-VRNWPH35.cjs → chunk-7EAV6Q7B.cjs} +10 -9
  104. package/dist/lib/chunk-7EAV6Q7B.cjs.map +1 -0
  105. package/dist/lib/{chunk-ZYBUJ2HE.js → chunk-CAPN4FSS.js} +7 -7
  106. package/dist/lib/chunk-CAPN4FSS.js.map +1 -0
  107. package/dist/lib/{chunk-LTBRHAQ2.cjs → chunk-GJNFAFKR.cjs} +4 -4
  108. package/dist/lib/chunk-GJNFAFKR.cjs.map +1 -0
  109. package/dist/lib/{chunk-VANFTXBT.cjs → chunk-GWYTWFZE.cjs} +7 -7
  110. package/dist/lib/chunk-GWYTWFZE.cjs.map +1 -0
  111. package/dist/lib/{chunk-DKE25WTL.js → chunk-HQ6TGY34.js} +2 -2
  112. package/dist/lib/chunk-HQ6TGY34.js.map +1 -0
  113. package/dist/lib/{chunk-QSBORJCS.js → chunk-HZDOJWUO.js} +6 -6
  114. package/dist/lib/chunk-HZDOJWUO.js.map +1 -0
  115. package/dist/lib/{chunk-ECJPGNXE.cjs → chunk-IK3ABDPP.cjs} +2 -2
  116. package/dist/lib/chunk-IK3ABDPP.cjs.map +1 -0
  117. package/dist/lib/{chunk-G5DJO4HA.cjs → chunk-JTUL3477.cjs} +5 -5
  118. package/dist/lib/chunk-JTUL3477.cjs.map +1 -0
  119. package/dist/lib/{chunk-E7UTFXPP.js → chunk-KFE2IR3Y.js} +4 -4
  120. package/dist/lib/chunk-KFE2IR3Y.js.map +1 -0
  121. package/dist/lib/{chunk-RY67J24J.js → chunk-KSBESEOF.js} +2 -2
  122. package/dist/lib/chunk-KSBESEOF.js.map +1 -0
  123. package/dist/lib/{chunk-26W3IQT6.js → chunk-LTVWU4J2.js} +5 -5
  124. package/dist/lib/chunk-LTVWU4J2.js.map +1 -0
  125. package/dist/lib/{chunk-GWAVDFOE.js → chunk-M7U5RMK7.js} +8 -6
  126. package/dist/lib/chunk-M7U5RMK7.js.map +1 -0
  127. package/dist/lib/{chunk-YQG6JE5R.cjs → chunk-M7WHFUKR.cjs} +549 -527
  128. package/dist/lib/chunk-M7WHFUKR.cjs.map +1 -0
  129. package/dist/lib/{chunk-EOO7IRCI.js → chunk-MAHHHINV.js} +3 -3
  130. package/dist/lib/chunk-MAHHHINV.js.map +1 -0
  131. package/dist/lib/{chunk-7FQQFIHR.cjs → chunk-NANLYIUO.cjs} +4 -4
  132. package/dist/lib/chunk-NANLYIUO.cjs.map +1 -0
  133. package/dist/lib/{chunk-TNCZYSNV.js → chunk-NE46WXNJ.js} +2 -2
  134. package/dist/lib/chunk-NE46WXNJ.js.map +1 -0
  135. package/dist/lib/{chunk-QGJVGFY4.js → chunk-OF5IJ4WG.js} +6 -6
  136. package/dist/lib/chunk-OF5IJ4WG.js.map +1 -0
  137. package/dist/lib/{chunk-6IEUZ5DZ.js → chunk-PIFE7MUZ.js} +525 -503
  138. package/dist/lib/chunk-PIFE7MUZ.js.map +1 -0
  139. package/dist/lib/{chunk-2ZYHO243.js → chunk-PXSRMP4E.js} +2 -2
  140. package/dist/lib/chunk-PXSRMP4E.js.map +1 -0
  141. package/dist/lib/{chunk-CXYZENE4.js → chunk-Q2L3FNJO.js} +13 -7
  142. package/dist/lib/chunk-Q2L3FNJO.js.map +1 -0
  143. package/dist/lib/{chunk-XFIGAAKN.cjs → chunk-Q2RUDKWY.cjs} +8 -6
  144. package/dist/lib/chunk-Q2RUDKWY.cjs.map +1 -0
  145. package/dist/lib/{chunk-NFDRIBCM.js → chunk-Q3KJZ3B5.js} +5 -7
  146. package/dist/lib/chunk-Q3KJZ3B5.js.map +1 -0
  147. package/dist/lib/{chunk-FHZJQZOE.cjs → chunk-QXJHCA3E.cjs} +7 -7
  148. package/dist/lib/chunk-QXJHCA3E.cjs.map +1 -0
  149. package/dist/lib/{chunk-TZFBE35T.cjs → chunk-RQICHHZM.cjs} +2 -2
  150. package/dist/lib/chunk-RQICHHZM.cjs.map +1 -0
  151. package/dist/lib/{chunk-7MXG5EG2.js → chunk-RXQWNSZX.js} +3 -3
  152. package/dist/lib/chunk-RXQWNSZX.js.map +1 -0
  153. package/dist/lib/{chunk-I6A564OE.cjs → chunk-U36VZLW6.cjs} +2 -2
  154. package/dist/lib/chunk-U36VZLW6.cjs.map +1 -0
  155. package/dist/lib/{chunk-65DUUIIF.cjs → chunk-UQJWVRRE.cjs} +2 -2
  156. package/dist/lib/chunk-UQJWVRRE.cjs.map +1 -0
  157. package/dist/lib/{chunk-XHCRXNQ3.cjs → chunk-V5OY4ALI.cjs} +5 -5
  158. package/dist/lib/chunk-V5OY4ALI.cjs.map +1 -0
  159. package/dist/lib/{chunk-I3I4BYJ4.js → chunk-VJN72T2O.js} +5 -5
  160. package/dist/lib/chunk-VJN72T2O.js.map +1 -0
  161. package/dist/lib/{chunk-KACTPBW2.cjs → chunk-W4OMKQ7W.cjs} +14 -8
  162. package/dist/lib/chunk-W4OMKQ7W.cjs.map +1 -0
  163. package/dist/lib/{chunk-SB3NFYXT.cjs → chunk-XZD7S5TU.cjs} +5 -5
  164. package/dist/lib/chunk-XZD7S5TU.cjs.map +1 -0
  165. package/dist/lib/{chunk-PJKWY74P.js → chunk-YBIWVB66.js} +10 -9
  166. package/dist/lib/chunk-YBIWVB66.js.map +1 -0
  167. package/dist/lib/{chunk-JXIRUV56.js → chunk-YF3YHK4X.js} +5 -5
  168. package/dist/lib/chunk-YF3YHK4X.js.map +1 -0
  169. package/dist/lib/{chunk-TJQEGHJA.cjs → chunk-YVDJCVE5.cjs} +12 -12
  170. package/dist/lib/chunk-YVDJCVE5.cjs.map +1 -0
  171. package/dist/lib/{chunk-M2TB43VG.cjs → chunk-ZP7PDTVE.cjs} +7 -9
  172. package/dist/lib/chunk-ZP7PDTVE.cjs.map +1 -0
  173. package/dist/lib/{config-BOPIY57U.d.cts → config-AuIGsUck.d.cts} +110 -106
  174. package/dist/lib/{config-Chd_3Uh3.d.ts → config-B_WTwd49.d.ts} +110 -106
  175. package/dist/lib/config-file.d.cts +2 -1
  176. package/dist/lib/config-file.d.ts +2 -1
  177. package/dist/lib/entry.d.cts +2 -1
  178. package/dist/lib/entry.d.ts +2 -1
  179. package/dist/lib/{hooks-DkVRKYVN.d.cts → hooks-4KkL9GD2.d.cts} +1 -1
  180. package/dist/lib/{hooks-56fQP2HY.d.ts → hooks-DErK4Fv4.d.ts} +1 -1
  181. package/dist/lib/index.cjs +36 -36
  182. package/dist/lib/index.d.cts +3 -2
  183. package/dist/lib/index.d.ts +3 -2
  184. package/dist/lib/index.js +11 -11
  185. package/dist/lib/logger.d.cts +2 -1
  186. package/dist/lib/logger.d.ts +2 -1
  187. package/dist/lib/typescript/compiler-host.cjs +6 -6
  188. package/dist/lib/typescript/compiler-host.cjs.map +1 -1
  189. package/dist/lib/typescript/compiler-host.d.cts +2 -1
  190. package/dist/lib/typescript/compiler-host.d.ts +2 -1
  191. package/dist/lib/typescript/compiler-host.js +5 -5
  192. package/dist/lib/typescript/compiler-host.js.map +1 -1
  193. package/dist/lib/typescript/import-transformer.cjs +1 -1
  194. package/dist/lib/typescript/import-transformer.cjs.map +1 -1
  195. package/dist/lib/typescript/import-transformer.d.cts +2 -1
  196. package/dist/lib/typescript/import-transformer.d.ts +2 -1
  197. package/dist/lib/typescript/import-transformer.js +1 -1
  198. package/dist/lib/typescript/import-transformer.js.map +1 -1
  199. package/dist/lib/typescript/index.cjs +6 -6
  200. package/dist/lib/typescript/index.d.cts +2 -1
  201. package/dist/lib/typescript/index.d.ts +2 -1
  202. package/dist/lib/typescript/index.js +1 -1
  203. package/dist/lib/typescript/program.cjs +6 -6
  204. package/dist/lib/typescript/program.d.cts +2 -1
  205. package/dist/lib/typescript/program.d.ts +2 -1
  206. package/dist/lib/typescript/program.js +1 -1
  207. package/dist/lib/unplugin/factory.cjs +6 -6
  208. package/dist/lib/unplugin/factory.d.cts +3 -2
  209. package/dist/lib/unplugin/factory.d.ts +3 -2
  210. package/dist/lib/unplugin/factory.js +5 -5
  211. package/dist/lib/unplugin/index.cjs +9 -9
  212. package/dist/lib/unplugin/index.d.cts +3 -2
  213. package/dist/lib/unplugin/index.d.ts +3 -2
  214. package/dist/lib/unplugin/index.js +6 -6
  215. package/dist/lib/unplugin/plugin.cjs +4 -4
  216. package/dist/lib/unplugin/plugin.d.cts +2 -1
  217. package/dist/lib/unplugin/plugin.d.ts +2 -1
  218. package/dist/lib/unplugin/plugin.js +3 -3
  219. package/dist/lib/unplugin/resolve-id.cjs +2 -2
  220. package/dist/lib/unplugin/resolve-id.d.cts +2 -1
  221. package/dist/lib/unplugin/resolve-id.d.ts +2 -1
  222. package/dist/lib/unplugin/resolve-id.js +1 -1
  223. package/dist/lib/utilities/cache.cjs +4 -4
  224. package/dist/lib/utilities/cache.js +2 -2
  225. package/dist/lib/utilities/file-header.d.cts +2 -1
  226. package/dist/lib/utilities/file-header.d.ts +2 -1
  227. package/dist/lib/utilities/index.cjs +24 -24
  228. package/dist/lib/utilities/index.d.cts +2 -1
  229. package/dist/lib/utilities/index.d.ts +2 -1
  230. package/dist/lib/utilities/index.js +7 -7
  231. package/dist/lib/utilities/meta.cjs +8 -8
  232. package/dist/lib/utilities/meta.d.cts +2 -1
  233. package/dist/lib/utilities/meta.d.ts +2 -1
  234. package/dist/lib/utilities/meta.js +1 -1
  235. package/dist/lib/utilities/plugin-helpers.d.cts +2 -1
  236. package/dist/lib/utilities/plugin-helpers.d.ts +2 -1
  237. package/dist/lib/utilities/resolve-path.cjs +2 -2
  238. package/dist/lib/utilities/resolve-path.d.cts +2 -1
  239. package/dist/lib/utilities/resolve-path.d.ts +2 -1
  240. package/dist/lib/utilities/resolve-path.js +1 -1
  241. package/dist/lib/utilities/source-file.cjs +4 -4
  242. package/dist/lib/utilities/source-file.js +1 -1
  243. package/dist/lib/utilities/source-map.cjs +2 -2
  244. package/dist/lib/utilities/source-map.js +1 -1
  245. package/dist/lib/utilities/worker.cjs +3 -3
  246. package/dist/lib/utilities/worker.d.cts +2 -1
  247. package/dist/lib/utilities/worker.d.ts +2 -1
  248. package/dist/lib/utilities/worker.js +1 -1
  249. package/dist/lib/utilities/write-file.cjs +2 -2
  250. package/dist/lib/utilities/write-file.d.cts +2 -1
  251. package/dist/lib/utilities/write-file.d.ts +2 -1
  252. package/dist/lib/utilities/write-file.js +1 -1
  253. package/dist/next.cjs +8 -8
  254. package/dist/next.js +5 -5
  255. package/dist/nuxt.cjs +10 -10
  256. package/dist/nuxt.js +7 -7
  257. package/dist/{resolved-NZTd64-O.d.cts → resolved-CcuVqMqc.d.cts} +28 -3
  258. package/dist/{resolved-DhHHMnUD.d.ts → resolved-Dhscmo3z.d.ts} +28 -3
  259. package/dist/rolldown.cjs +7 -7
  260. package/dist/rolldown.d.cts +2 -1
  261. package/dist/rolldown.d.ts +2 -1
  262. package/dist/rolldown.js +4 -4
  263. package/dist/rollup.cjs +7 -7
  264. package/dist/rollup.d.cts +2 -1
  265. package/dist/rollup.d.ts +2 -1
  266. package/dist/rollup.js +4 -4
  267. package/dist/rspack.cjs +7 -7
  268. package/dist/rspack.d.cts +2 -1
  269. package/dist/rspack.d.ts +2 -1
  270. package/dist/rspack.js +4 -4
  271. package/dist/tsup.cjs +9 -9
  272. package/dist/tsup.js +6 -6
  273. package/dist/types/babel.d.cts +2 -1
  274. package/dist/types/babel.d.ts +2 -1
  275. package/dist/types/commands.d.cts +2 -1
  276. package/dist/types/commands.d.ts +2 -1
  277. package/dist/types/compiler.d.cts +2 -1
  278. package/dist/types/compiler.d.ts +2 -1
  279. package/dist/types/config.d.cts +2 -1
  280. package/dist/types/config.d.ts +2 -1
  281. package/dist/types/context.cjs +2 -2
  282. package/dist/types/context.d.cts +2 -1
  283. package/dist/types/context.d.ts +2 -1
  284. package/dist/types/context.js +1 -1
  285. package/dist/types/hooks.d.cts +2 -1
  286. package/dist/types/hooks.d.ts +2 -1
  287. package/dist/types/index.cjs +9 -9
  288. package/dist/types/index.d.cts +3 -2
  289. package/dist/types/index.d.ts +3 -2
  290. package/dist/types/index.js +2 -2
  291. package/dist/types/internal.d.cts +3 -2
  292. package/dist/types/internal.d.ts +3 -2
  293. package/dist/types/plugin.d.cts +2 -1
  294. package/dist/types/plugin.d.ts +2 -1
  295. package/dist/types/resolved.d.cts +2 -1
  296. package/dist/types/resolved.d.ts +2 -1
  297. package/dist/types/unplugin.d.cts +2 -1
  298. package/dist/types/unplugin.d.ts +2 -1
  299. package/dist/types/vfs.cjs +7 -7
  300. package/dist/types/vfs.d.cts +93 -111
  301. package/dist/types/vfs.d.ts +93 -111
  302. package/dist/types/vfs.js +1 -1
  303. package/dist/unloader.cjs +7 -7
  304. package/dist/unloader.d.cts +2 -1
  305. package/dist/unloader.d.ts +2 -1
  306. package/dist/unloader.js +4 -4
  307. package/dist/unplugin.cjs +19 -19
  308. package/dist/unplugin.d.cts +3 -2
  309. package/dist/unplugin.d.ts +3 -2
  310. package/dist/unplugin.js +16 -16
  311. package/dist/vite.cjs +8 -8
  312. package/dist/vite.d.cts +2 -1
  313. package/dist/vite.d.ts +2 -1
  314. package/dist/vite.js +5 -5
  315. package/dist/webpack.cjs +7 -7
  316. package/dist/webpack.d.cts +2 -1
  317. package/dist/webpack.d.ts +2 -1
  318. package/dist/webpack.js +4 -4
  319. package/package.json +9 -9
  320. package/dist/chunk-4JUWHOFJ.cjs +0 -12
  321. package/dist/chunk-ARHKVB3S.cjs +0 -12
  322. package/dist/chunk-JCXSBKRJ.js +0 -31
  323. package/dist/chunk-NRMXL6VA.cjs +0 -34
  324. package/dist/chunk-QKXJRYA5.cjs +0 -12
  325. package/dist/chunk-STLRGAW6.cjs +0 -24
  326. package/dist/chunk-TJIHTRP5.cjs +0 -12
  327. package/dist/chunk-VES34CLG.cjs +0 -12
  328. package/dist/lib/chunk-26W3IQT6.js.map +0 -1
  329. package/dist/lib/chunk-2ZYHO243.js.map +0 -1
  330. package/dist/lib/chunk-65DUUIIF.cjs.map +0 -1
  331. package/dist/lib/chunk-6IEUZ5DZ.js.map +0 -1
  332. package/dist/lib/chunk-7CZ2QZEV.js.map +0 -1
  333. package/dist/lib/chunk-7FQQFIHR.cjs.map +0 -1
  334. package/dist/lib/chunk-7MXG5EG2.js.map +0 -1
  335. package/dist/lib/chunk-CXYZENE4.js.map +0 -1
  336. package/dist/lib/chunk-DKE25WTL.js.map +0 -1
  337. package/dist/lib/chunk-E7UTFXPP.js.map +0 -1
  338. package/dist/lib/chunk-ECJPGNXE.cjs.map +0 -1
  339. package/dist/lib/chunk-EOO7IRCI.js.map +0 -1
  340. package/dist/lib/chunk-FHZJQZOE.cjs.map +0 -1
  341. package/dist/lib/chunk-G5DJO4HA.cjs.map +0 -1
  342. package/dist/lib/chunk-GWAVDFOE.js.map +0 -1
  343. package/dist/lib/chunk-I3I4BYJ4.js.map +0 -1
  344. package/dist/lib/chunk-I6A564OE.cjs.map +0 -1
  345. package/dist/lib/chunk-JXIRUV56.js.map +0 -1
  346. package/dist/lib/chunk-KACTPBW2.cjs.map +0 -1
  347. package/dist/lib/chunk-KAOWUIFH.cjs.map +0 -1
  348. package/dist/lib/chunk-LTBRHAQ2.cjs.map +0 -1
  349. package/dist/lib/chunk-M2TB43VG.cjs.map +0 -1
  350. package/dist/lib/chunk-NFDRIBCM.js.map +0 -1
  351. package/dist/lib/chunk-PJKWY74P.js.map +0 -1
  352. package/dist/lib/chunk-QGJVGFY4.js.map +0 -1
  353. package/dist/lib/chunk-QSBORJCS.js.map +0 -1
  354. package/dist/lib/chunk-RY67J24J.js.map +0 -1
  355. package/dist/lib/chunk-SB3NFYXT.cjs.map +0 -1
  356. package/dist/lib/chunk-TJQEGHJA.cjs.map +0 -1
  357. package/dist/lib/chunk-TNCZYSNV.js.map +0 -1
  358. package/dist/lib/chunk-TZFBE35T.cjs.map +0 -1
  359. package/dist/lib/chunk-VANFTXBT.cjs.map +0 -1
  360. package/dist/lib/chunk-VRNWPH35.cjs.map +0 -1
  361. package/dist/lib/chunk-XFIGAAKN.cjs.map +0 -1
  362. package/dist/lib/chunk-XHCRXNQ3.cjs.map +0 -1
  363. package/dist/lib/chunk-YQG6JE5R.cjs.map +0 -1
  364. package/dist/lib/chunk-ZKYZWEHY.cjs.map +0 -1
  365. package/dist/lib/chunk-ZYBUJ2HE.js.map +0 -1
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkTZFBE35T_cjs = require('./chunk-TZFBE35T.cjs');
3
+ var chunkRQICHHZM_cjs = require('./chunk-RQICHHZM.cjs');
4
4
  var chunkMFC7UJHT_cjs = require('./chunk-MFC7UJHT.cjs');
5
- var chunkXFIGAAKN_cjs = require('./chunk-XFIGAAKN.cjs');
5
+ var chunkQ2RUDKWY_cjs = require('./chunk-Q2RUDKWY.cjs');
6
6
  var chunkRK2VVGL6_cjs = require('./chunk-RK2VVGL6.cjs');
7
- var chunkVRNWPH35_cjs = require('./chunk-VRNWPH35.cjs');
7
+ var chunk7EAV6Q7B_cjs = require('./chunk-7EAV6Q7B.cjs');
8
8
  var chunkLJZEN4HP_cjs = require('./chunk-LJZEN4HP.cjs');
9
9
  var chunkMGEZC2RV_cjs = require('./chunk-MGEZC2RV.cjs');
10
10
  var chunk632PWWU7_cjs = require('./chunk-632PWWU7.cjs');
11
- var chunk65DUUIIF_cjs = require('./chunk-65DUUIIF.cjs');
11
+ var chunkUQJWVRRE_cjs = require('./chunk-UQJWVRRE.cjs');
12
12
  var chunkBEKLDCTV_cjs = require('./chunk-BEKLDCTV.cjs');
13
13
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
14
14
  var types = require('@storm-software/config-tools/types');
@@ -22,8 +22,6 @@ var helpers = require('@stryke/fs/helpers');
22
22
  var install = require('@stryke/fs/install');
23
23
  var listFiles = require('@stryke/fs/list-files');
24
24
  var packageFns = require('@stryke/fs/package-fns');
25
- var filePathFns = require('@stryke/path/file-path-fns');
26
- var isParentPath = require('@stryke/path/is-parent-path');
27
25
  var joinPaths = require('@stryke/path/join-paths');
28
26
  var replace = require('@stryke/path/replace');
29
27
  var isError = require('@stryke/type-checks/is-error');
@@ -44,6 +42,8 @@ var murmurhash = require('@stryke/hash/murmurhash');
44
42
  var getUnique = require('@stryke/helpers/get-unique');
45
43
  var omit = require('@stryke/helpers/omit');
46
44
  var append = require('@stryke/path/append');
45
+ var filePathFns = require('@stryke/path/file-path-fns');
46
+ var isType = require('@stryke/path/is-type');
47
47
  var join = require('@stryke/path/join');
48
48
  var isNull = require('@stryke/type-checks/is-null');
49
49
  var isString = require('@stryke/type-checks/is-string');
@@ -51,9 +51,10 @@ var uuid = require('@stryke/unique-id/uuid');
51
51
  var oxcParser = require('oxc-parser');
52
52
  var jiti = require('jiti');
53
53
  var bufferToString = require('@stryke/convert/buffer-to-string');
54
- var isType = require('@stryke/path/is-type');
54
+ var isParentPath = require('@stryke/path/is-parent-path');
55
55
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
56
56
  var isBuffer = require('@stryke/type-checks/is-buffer');
57
+ var isUndefined = require('@stryke/type-checks/is-undefined');
57
58
  var memfs = require('memfs');
58
59
  var buffer = require('buffer');
59
60
  var fs = require('fs');
@@ -161,6 +162,154 @@ function createResolver(options) {
161
162
  return baseResolver;
162
163
  }
163
164
  chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
165
+ function isBufferEncoding(options) {
166
+ return isSetString.isSetString(options) || options === null;
167
+ }
168
+ chunkPK6SKIKE_cjs.__name(isBufferEncoding, "isBufferEncoding");
169
+ function isPowerlinesWriteFileOptions(options) {
170
+ return !isBufferEncoding(options) && isSetObject.isSetObject(options) && ("skipFormat" in options || "mode" in options && (options.mode === "fs" || options.mode === "virtual"));
171
+ }
172
+ chunkPK6SKIKE_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
173
+ function isNodeWriteFileOptions(options) {
174
+ return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
175
+ }
176
+ chunkPK6SKIKE_cjs.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
177
+ function isPowerLinesWriteFileData(data) {
178
+ return !!(isSetObject.isSetObject(data) && "code" in data && data.code);
179
+ }
180
+ chunkPK6SKIKE_cjs.__name(isPowerLinesWriteFileData, "isPowerLinesWriteFileData");
181
+ var FILE_PREFIX = "file://";
182
+ function toFilePath(pathOrUrl) {
183
+ if (!pathOrUrl) {
184
+ throw new Error("No Path or URL provided to Virtual File System");
185
+ }
186
+ let result = pathOrUrl.toString();
187
+ if (result.startsWith(FILE_PREFIX)) {
188
+ result = result.slice(FILE_PREFIX.length);
189
+ }
190
+ return result;
191
+ }
192
+ chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
193
+ var FS_METHODS = [
194
+ "mkdir",
195
+ "mkdirSync",
196
+ "rmdir",
197
+ "rmdirSync",
198
+ "unlink",
199
+ "unlinkSync",
200
+ "existsSync",
201
+ "realpathSync",
202
+ "writeFileSync",
203
+ "readFileSync",
204
+ "readdirSync",
205
+ "createWriteStream",
206
+ "WriteStream",
207
+ "createReadStream",
208
+ "ReadStream"
209
+ ];
210
+ var FS_PROMISE_METHODS = [
211
+ "mkdir",
212
+ "rm",
213
+ "rmdir",
214
+ "unlink",
215
+ "writeFile",
216
+ "readFile",
217
+ "readdir",
218
+ "stat",
219
+ "lstat"
220
+ ];
221
+ function cloneFS(originalFS) {
222
+ const clonedFS = {
223
+ ...originalFS,
224
+ promises: {
225
+ ...originalFS.promises ?? {}
226
+ }
227
+ };
228
+ for (const method of FS_METHODS) {
229
+ if (originalFS[method]) {
230
+ clonedFS[method] = originalFS[method];
231
+ }
232
+ }
233
+ originalFS.promises ??= {};
234
+ for (const method of FS_PROMISE_METHODS) {
235
+ if (originalFS.promises[method]) {
236
+ clonedFS.promises ??= {};
237
+ clonedFS.promises[method] = originalFS.promises[method];
238
+ clonedFS[method] = originalFS.promises[method];
239
+ }
240
+ }
241
+ for (const prop in clonedFS) {
242
+ if (isFunction.isFunction(clonedFS[prop])) {
243
+ clonedFS[prop] = clonedFS[prop].bind(originalFS);
244
+ if (isFunction.isFunction(clonedFS.promises[prop])) {
245
+ clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
246
+ }
247
+ }
248
+ }
249
+ for (const prop in clonedFS.promises) {
250
+ if (isFunction.isFunction(clonedFS.promises[prop])) {
251
+ clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
252
+ }
253
+ }
254
+ return clonedFS;
255
+ }
256
+ chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
257
+ function patchFS(originalFS, vfs) {
258
+ const clonedFS = cloneFS(originalFS);
259
+ originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
260
+ originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
261
+ originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
262
+ originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
263
+ originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
264
+ originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
265
+ originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
266
+ Object.defineProperty(originalFS, "realpathSync", {
267
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
268
+ });
269
+ originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
270
+ originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
271
+ originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
272
+ originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
273
+ originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
274
+ originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
275
+ Object.defineProperty(originalFS, "statSync", {
276
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
277
+ });
278
+ originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
279
+ originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
280
+ Object.defineProperty(originalFS, "lstatSync", {
281
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
282
+ });
283
+ originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
284
+ originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
285
+ return () => {
286
+ originalFS.mkdirSync = clonedFS.mkdirSync;
287
+ originalFS.mkdir = clonedFS.mkdir;
288
+ originalFS.promises.mkdir = clonedFS.promises.mkdir;
289
+ originalFS.unlinkSync = clonedFS.unlinkSync;
290
+ originalFS.promises.rm = clonedFS.promises.rm;
291
+ originalFS.promises.unlink = clonedFS.promises.unlink;
292
+ originalFS.existsSync = clonedFS.existsSync;
293
+ originalFS.realpathSync = clonedFS.realpathSync;
294
+ originalFS.writeFileSync = clonedFS.writeFileSync;
295
+ originalFS.promises.writeFile = clonedFS.promises.writeFile;
296
+ originalFS.readFileSync = clonedFS.readFileSync;
297
+ originalFS.promises.readFile = clonedFS.promises.readFile;
298
+ originalFS.readdirSync = clonedFS.readdirSync;
299
+ originalFS.promises.readdir = clonedFS.promises.readdir;
300
+ Object.defineProperty(originalFS, "statSync", {
301
+ value: clonedFS.statSync
302
+ });
303
+ originalFS.stat = clonedFS.stat;
304
+ originalFS.promises.stat = clonedFS.promises.stat;
305
+ Object.defineProperty(originalFS, "lstatSync", {
306
+ value: clonedFS.lstatSync
307
+ });
308
+ originalFS.lstat = clonedFS.lstat;
309
+ originalFS.promises.lstat = clonedFS.promises.lstat;
310
+ };
311
+ }
312
+ chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
164
313
  var VirtualFileSystem = class {
165
314
  static {
166
315
  chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
@@ -168,7 +317,11 @@ var VirtualFileSystem = class {
168
317
  /**
169
318
  * The internal map of virtual files.
170
319
  */
171
- #builtinIdMap = /* @__PURE__ */ new Map();
320
+ #meta = {};
321
+ /**
322
+ * A map of unique identifiers to their virtual file paths.
323
+ */
324
+ #ids = {};
172
325
  /**
173
326
  * A map of virtual file paths to their underlying file content.
174
327
  */
@@ -209,39 +362,88 @@ var VirtualFileSystem = class {
209
362
  */
210
363
  #log;
211
364
  /**
365
+ * Checks if a path exists in the virtual file system (VFS).
366
+ *
367
+ * @param path - The path to check.
368
+ * @returns `true` if the path exists, otherwise `false`.
369
+ */
370
+ #existsSync(path) {
371
+ const formattedPath = this.formatPath(path);
372
+ return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
373
+ }
374
+ /**
212
375
  * Exposes the internal VFS map for advanced usage.
213
376
  */
214
- get [chunkXFIGAAKN_cjs.__VFS_CACHE__]() {
377
+ get [chunkQ2RUDKWY_cjs.__VFS_CACHE__]() {
215
378
  return this.#cachedFS;
216
379
  }
217
380
  /**
218
381
  * Exposes the internal VFS resolver cache for advanced usage.
219
382
  */
220
- get [chunkXFIGAAKN_cjs.__VFS_RESOLVER__]() {
383
+ get [chunkQ2RUDKWY_cjs.__VFS_RESOLVER__]() {
221
384
  return this.#cachedResolver;
222
385
  }
223
386
  /**
224
387
  * Exposes the internal VFS map for advanced usage.
225
388
  */
226
- get [chunkXFIGAAKN_cjs.__VFS_VIRTUAL__]() {
389
+ get [chunkQ2RUDKWY_cjs.__VFS_VIRTUAL__]() {
227
390
  return this.#virtualFS;
228
391
  }
229
392
  /**
230
393
  * Exposes the internal UFS map for advanced usage.
231
394
  */
232
- get [chunkXFIGAAKN_cjs.__VFS_UNIFIED__]() {
395
+ get [chunkQ2RUDKWY_cjs.__VFS_UNIFIED__]() {
233
396
  return this.#unifiedFS;
234
397
  }
235
398
  /**
399
+ * A proxy to access the underlying file metadata.
400
+ */
401
+ get meta() {
402
+ return new Proxy(this.#meta, {
403
+ get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
404
+ if (target[prop]) {
405
+ return {
406
+ id: prop,
407
+ mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
408
+ details: {},
409
+ variant: "normal",
410
+ ...target[prop]
411
+ };
412
+ }
413
+ return void 0;
414
+ }, "get"),
415
+ set: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop, value) => {
416
+ target[prop] = value;
417
+ this.#ids[value.id || prop] = prop;
418
+ return true;
419
+ }, "set"),
420
+ deleteProperty: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
421
+ delete this.#ids[target[prop]?.id || prop];
422
+ delete target[prop];
423
+ return true;
424
+ }, "deleteProperty")
425
+ });
426
+ }
427
+ /**
428
+ * A map of module ids to their file paths.
429
+ */
430
+ get ids() {
431
+ return this.#ids;
432
+ }
433
+ /**
236
434
  * Creates a new instance of the VirtualFileSystem.
237
435
  *
238
436
  * @param context - The context of the virtual file system, typically containing options and logging functions.
239
437
  * @param serialized - A map of files/file contents to populate in cache
240
438
  */
241
- constructor(context, serialized) {
439
+ constructor(context, serialized = {}) {
242
440
  this.#context = context;
243
441
  this.#cachedFS = /* @__PURE__ */ new Map();
244
- this.#builtinIdMap = new Map(Object.entries(serialized?.builtinIdMap ?? {}));
442
+ this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
443
+ this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
444
+ data.id || path,
445
+ path
446
+ ]));
245
447
  if (!this.#fs.existsSync(this.#context.dataPath)) {
246
448
  this.#fs.mkdirSync(this.#context.dataPath, {
247
449
  recursive: true
@@ -307,13 +509,13 @@ var VirtualFileSystem = class {
307
509
  }
308
510
  this.#log = chunk632PWWU7_cjs.extendLog(this.#context.log, "virtual-file-system");
309
511
  }
310
- [chunkXFIGAAKN_cjs.__VFS_INIT__]() {
512
+ [chunkQ2RUDKWY_cjs.__VFS_INIT__]() {
311
513
  if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
312
514
  this.#revert = patchFS(fs__default.default, this);
313
515
  this.#isPatched = true;
314
516
  }
315
517
  }
316
- [chunkXFIGAAKN_cjs.__VFS_REVERT__]() {
518
+ [chunkQ2RUDKWY_cjs.__VFS_REVERT__]() {
317
519
  if (this.#isPatched && this.#context.config.output.mode !== "fs") {
318
520
  if (!this.#revert) {
319
521
  throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
@@ -323,65 +525,44 @@ var VirtualFileSystem = class {
323
525
  }
324
526
  }
325
527
  /**
326
- * Returns a Map of all runtime file IDs and their corresponding paths in the virtual file system.
327
- *
328
- * @returns A Map where the keys are runtime file IDs (strings) and the values are their corresponding paths (strings).
329
- */
330
- get builtinIdMap() {
331
- return this.#builtinIdMap;
332
- }
333
- /**
334
- * Lists all runtime IDs in the virtual file system.
335
- *
336
- * @returns An array of formatted runtime IDs.
337
- */
338
- get runtimeIds() {
339
- return Array.from(this.builtinIdMap.keys()).map((id) => this.formatRuntimeId(id));
340
- }
341
- /**
342
- * Checks if a given path or ID corresponds to a runtime file.
528
+ * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
343
529
  *
344
- * @param pathOrId - The path or ID to check.
345
- * @param options - Options for resolving the path, such as paths to check.
346
- * @returns `true` if the path or ID corresponds to a runtime file, otherwise `false`.
530
+ * @param pathOrId - The path or id to check.
531
+ * @param options - Optional parameters for resolving the path.
532
+ * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
347
533
  */
348
- isBuiltinFile(pathOrId, options) {
349
- return !!this.builtinIdMap.values().find((path) => path === this.resolvePath(pathOrId, {
534
+ isVirtual(pathOrId, options = {}) {
535
+ if (!pathOrId) {
536
+ return false;
537
+ }
538
+ const resolvedPath = this.resolve(pathOrId, {
350
539
  ...options,
351
540
  type: "file"
352
- }));
353
- }
354
- /**
355
- * Checks if a provided string is a valid runtime ID (does not need to already be created in the file system).
356
- *
357
- * @param id - The ID to check.
358
- * @returns Whether the ID is a valid runtime ID.
359
- */
360
- isValidBuiltinId(id) {
361
- return id.startsWith(`${this.#context.config.output.builtinPrefix}:`);
541
+ });
542
+ if (!resolvedPath) {
543
+ return false;
544
+ }
545
+ return this.meta[resolvedPath]?.mode === "virtual";
362
546
  }
363
547
  /**
364
- * Check if a path or ID corresponds to a virtual file.
548
+ * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
365
549
  *
366
- * @param pathOrId - The path or ID to check.
367
- * @param options - Options for resolving the path, such as paths to check.
368
- * @returns Whether the path or ID corresponds to a virtual file.
550
+ * @param pathOrId - The path or id to check.
551
+ * @param options - Optional parameters for resolving the path.
552
+ * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
369
553
  */
370
- isVirtualFile(pathOrId, options = {}) {
554
+ isFs(pathOrId, options = {}) {
371
555
  if (!pathOrId) {
372
556
  return false;
373
557
  }
374
- const resolvedPath = this.resolvePath(pathOrId, {
558
+ const resolvedPath = this.resolve(pathOrId, {
375
559
  ...options,
376
560
  type: "file"
377
561
  });
378
562
  if (!resolvedPath) {
379
563
  return false;
380
564
  }
381
- if (this.builtinIdMap.values().find((path) => path === resolvedPath)) {
382
- return true;
383
- }
384
- return this.#virtualFS.existsSync(resolvedPath);
565
+ return this.meta[resolvedPath]?.mode === "fs";
385
566
  }
386
567
  /**
387
568
  * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
@@ -395,37 +576,6 @@ var VirtualFileSystem = class {
395
576
  return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
396
577
  }
397
578
  /**
398
- * Checks if a given ID corresponds to a runtime file path.
399
- *
400
- * @param id - The unique identifier for the runtime file.
401
- * @param pathOrId - The path or ID to check.
402
- * @returns `true` if the ID corresponds to the path or ID of a runtime file, otherwise `false`.
403
- */
404
- isMatchingBuiltinId(id, pathOrId) {
405
- const resolvedPath = this.resolvePath(pathOrId);
406
- const resolvedId = this.resolveId(pathOrId);
407
- return !!(this.isBuiltinFile(pathOrId) && (resolvedPath && (resolvedPath === this.builtinIdMap.get(id) || resolvedPath === this.builtinIdMap.get(this.formatRuntimeId(id))) || resolvedId && (resolvedId === this.builtinIdMap.get(id) || resolvedId === this.builtinIdMap.get(this.formatRuntimeId(id)))));
408
- }
409
- /**
410
- * Lists all runtime files in the virtual file system.
411
- *
412
- * @returns A promise that resolves to an array of runtime files.
413
- */
414
- async listBuiltinFiles() {
415
- const runtimeFiles = [];
416
- for (const [id, path] of this.builtinIdMap.entries()) {
417
- const contents = await this.readFile(path);
418
- if (contents) {
419
- runtimeFiles.push({
420
- id: this.formatRuntimeId(id),
421
- path,
422
- contents
423
- });
424
- }
425
- }
426
- return runtimeFiles;
427
- }
428
- /**
429
579
  * Lists files in a given path.
430
580
  *
431
581
  * @param path - The path to list files from.
@@ -442,7 +592,7 @@ var VirtualFileSystem = class {
442
592
  */
443
593
  unlinkSync(path, options) {
444
594
  const formattedPath = toFilePath(path);
445
- if (!this.fileExistsSync(path)) {
595
+ if (!this.isFile(formattedPath)) {
446
596
  return;
447
597
  }
448
598
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
@@ -457,7 +607,7 @@ var VirtualFileSystem = class {
457
607
  */
458
608
  async unlink(path, options) {
459
609
  const formattedPath = toFilePath(path);
460
- if (!this.fileExistsSync(path)) {
610
+ if (!this.isFile(formattedPath)) {
461
611
  return;
462
612
  }
463
613
  this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
@@ -477,7 +627,7 @@ var VirtualFileSystem = class {
477
627
  */
478
628
  rmdirSync(path, options = {}) {
479
629
  const formattedPath = toFilePath(path);
480
- if (!this.directoryExistsSync(path)) {
630
+ if (!this.isDirectory(formattedPath)) {
481
631
  return;
482
632
  }
483
633
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
@@ -496,7 +646,7 @@ var VirtualFileSystem = class {
496
646
  */
497
647
  async rmdir(path, options = {}) {
498
648
  const formattedPath = toFilePath(path);
499
- if (!this.directoryExistsSync(path)) {
649
+ if (!this.isDirectory(formattedPath)) {
500
650
  return;
501
651
  }
502
652
  this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
@@ -523,7 +673,7 @@ var VirtualFileSystem = class {
523
673
  */
524
674
  async rm(path, options = {}) {
525
675
  this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
526
- if (this.directoryExistsSync(path)) {
676
+ if (this.isDirectory(path)) {
527
677
  return this.rmdir(path, options);
528
678
  }
529
679
  return this.unlink(path, options);
@@ -567,12 +717,12 @@ var VirtualFileSystem = class {
567
717
  /**
568
718
  * Lists files in a given path.
569
719
  *
570
- * @param path - The path to list files from.
720
+ * @param pathOrId - The path to list files from.
571
721
  * @param options - Options for listing files, such as encoding and recursion.
572
722
  * @returns An array of file names in the specified path.
573
723
  */
574
- async readdir(path, options = "utf8") {
575
- return this.resolveFS(path).promises.readdir(toFilePath(path), options);
724
+ async readdir(pathOrId, options = "utf8") {
725
+ return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
576
726
  }
577
727
  /**
578
728
  * Asynchronously reads a file from the virtual file system (VFS).
@@ -584,7 +734,7 @@ var VirtualFileSystem = class {
584
734
  if (!pathOrId) {
585
735
  return void 0;
586
736
  }
587
- const filePath = this.resolvePath(toFilePath(pathOrId), {
737
+ const filePath = this.resolve(toFilePath(pathOrId), {
588
738
  type: "file"
589
739
  });
590
740
  if (filePath) {
@@ -613,7 +763,7 @@ var VirtualFileSystem = class {
613
763
  if (!pathOrId) {
614
764
  return void 0;
615
765
  }
616
- const filePath = this.resolvePath(toFilePath(pathOrId), {
766
+ const filePath = this.resolve(toFilePath(pathOrId), {
617
767
  type: "file"
618
768
  });
619
769
  if (filePath) {
@@ -630,137 +780,80 @@ var VirtualFileSystem = class {
630
780
  /**
631
781
  * Writes a file to the virtual file system (VFS).
632
782
  *
633
- * @param file - The path to the file.
783
+ * @param path - The path to the file.
634
784
  * @param data - The contents of the file.
635
785
  * @param options - Optional parameters for writing the file.
636
786
  * @returns A promise that resolves when the file is written.
637
787
  */
638
- async writeFile(file, data = "", options = "utf8") {
639
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(file));
640
- if (!this.directoryExistsSync(filePathFns.findFilePath(absolutePath))) {
641
- await this.mkdir(filePathFns.findFilePath(absolutePath), options);
788
+ async writeFile(path, data = "", options = "utf8") {
789
+ const formattedPath = this.formatPath(path);
790
+ if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
791
+ await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
642
792
  }
643
- this.#log(types.LogLevelLabel.TRACE, `Writing ${absolutePath} file to the ${this.resolveOutputMode(absolutePath, options) === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)})`);
644
- this.#cachedFS.set(absolutePath, data.toString());
645
- this.clearResolverCache(absolutePath);
646
- const ifs = this.resolveFS(absolutePath, options);
793
+ let code = isPowerLinesWriteFileData(data) ? data.code : data;
794
+ if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
795
+ const resolvedConfig = await prettier.resolveConfig(formattedPath);
796
+ if (resolvedConfig) {
797
+ code = await prettier.format(code, {
798
+ absolutePath: formattedPath,
799
+ ...resolvedConfig
800
+ });
801
+ }
802
+ }
803
+ const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
804
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
805
+ this.meta[formattedPath] = {
806
+ path: formattedPath,
807
+ code,
808
+ mode: outputMode,
809
+ variant: "normal",
810
+ ...isPowerLinesWriteFileData(data) ? data : {}
811
+ };
812
+ this.clearResolverCache(formattedPath);
813
+ const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
647
814
  if (isFunction.isFunction(ifs.promises.writeFile)) {
648
- return ifs.promises.writeFile(absolutePath, data, omit.omit(options, [
649
- "mode"
650
- ]));
815
+ return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
651
816
  }
652
- return ifs.writeFileSync(absolutePath, data, omit.omit(options, [
653
- "mode"
654
- ]));
817
+ return ifs.writeFileSync(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
655
818
  }
656
819
  /**
657
820
  * Synchronously writes a file to the virtual file system (VFS).
658
821
  *
659
- * @param file - The file to write.
822
+ * @param path - The file to write.
660
823
  * @param data - The contents of the file.
661
824
  * @param options - Optional parameters for writing the file.
662
825
  */
663
- writeFileSync(file, data = "", options = "utf8") {
664
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(file));
665
- if (!this.directoryExistsSync(filePathFns.findFilePath(absolutePath))) {
666
- this.mkdirSync(filePathFns.findFilePath(absolutePath));
667
- }
668
- this.#log(types.LogLevelLabel.TRACE, `Writing ${absolutePath} file to the ${this.resolveOutputMode(absolutePath, options) === "fs" ? "" : "virtual "} (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)})`);
669
- this.#cachedFS.set(absolutePath, data.toString());
670
- this.clearResolverCache(absolutePath);
671
- const writeStream = this.resolveFS(absolutePath, omit.omit(options, [
672
- "mode"
673
- ])).createWriteStream(absolutePath);
826
+ writeFileSync(path, data = "", options = "utf8") {
827
+ const formattedPath = this.formatPath(path);
828
+ if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
829
+ this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
830
+ }
831
+ const code = isPowerLinesWriteFileData(data) ? data.code : data;
832
+ const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
833
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
834
+ this.meta[formattedPath] = {
835
+ path: formattedPath,
836
+ code,
837
+ mode: outputMode,
838
+ variant: "normal",
839
+ ...isPowerLinesWriteFileData(data) ? data : {}
840
+ };
841
+ this.clearResolverCache(formattedPath);
842
+ const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
674
843
  try {
675
- writeStream.write(data);
844
+ writeStream.write(code);
676
845
  } finally {
677
846
  writeStream.close();
678
847
  }
679
848
  }
680
849
  /**
681
- * Writes a runtime file to the virtual file system (VFS).
682
- *
683
- * @param id - The unique identifier for the runtime file.
684
- * @param path - The path to the runtime file.
685
- * @param contents - The contents of the runtime file.
686
- * @param options - Optional parameters for writing the runtime file.
687
- * @returns A promise that resolves when the file is written.
688
- */
689
- async writeBuiltinFile(id, path, contents, options = {}) {
690
- const formattedId = this.formatRuntimeId(id);
691
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
692
- this.builtinIdMap.set(formattedId, absolutePath);
693
- let data = contents;
694
- if (!options.skipFormat) {
695
- data = await prettier.format(contents, {
696
- absolutePath,
697
- ...await prettier.resolveConfig(absolutePath)
698
- });
699
- }
700
- const _options = defu3__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
701
- encoding: isSetString.isSetString(options) ? options : "utf8",
702
- mode: "virtual"
703
- });
704
- this.#log(types.LogLevelLabel.DEBUG, `Writing runtime file ${absolutePath} (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)}) to ${this.resolveOutputMode(absolutePath, _options) === "fs" ? "disk" : "memory"}`);
705
- return this.writeFile(absolutePath, data, _options);
706
- }
707
- /**
708
- * Adds an entry file to the virtual file system.
709
- *
710
- * @param name - The file name or absolute path of the entry module.
711
- * @param contents - The contents of the entry file.
712
- * @param options - Optional parameters for writing the entry file.
713
- */
714
- async writeEntryFile(name, contents, options = {}) {
715
- const absolutePath = this.formatAbsoluteFilePath(isType.isAbsolutePath(toFilePath(name)) ? toFilePath(name) : toFilePath(joinPaths.joinPaths(this.#context.entryPath, name)));
716
- let data = contents;
717
- if (!options.skipFormat) {
718
- data = await prettier.format(contents, {
719
- absolutePath,
720
- ...await prettier.resolveConfig(absolutePath)
721
- });
722
- }
723
- const _options = defu3__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
724
- encoding: isSetString.isSetString(options) ? options : "utf8",
725
- mode: "virtual"
726
- });
727
- this.#log(types.LogLevelLabel.DEBUG, `Writing entry file ${absolutePath} (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(data)).size)}) to ${this.resolveOutputMode(absolutePath, _options) === "fs" ? "disk" : "virtual memory"}`);
728
- return this.writeFile(absolutePath, data, _options);
729
- }
730
- /**
731
- * Writes a file to disk from the physical file system (on disk).
732
- *
733
- * @param path - The path to the file to write.
734
- * @param contents - The contents of the file to write.
735
- * @param options - Optional parameters for writing the file.
736
- * @returns A promise that resolves when the file is written.
737
- */
738
- async writeFileToDisk(path, contents, options = {}) {
739
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
740
- let data = contents;
741
- if (!options.skipFormat) {
742
- const resolvedConfig = await prettier.resolveConfig(absolutePath);
743
- if (resolvedConfig) {
744
- data = await prettier.format(contents, {
745
- absolutePath,
746
- ...resolvedConfig
747
- });
748
- }
749
- }
750
- return this.writeFile(absolutePath, data, defu3__default.default({
751
- mode: "fs"
752
- }, isSetString.isSetString(options) ? {} : options ?? {}, {
753
- encoding: isSetString.isSetString(options) ? options : "utf8"
754
- }));
755
- }
756
- /**
757
850
  * Synchronously checks if a file exists in the virtual file system (VFS).
758
851
  *
759
852
  * @param pathOrId - The path or ID of the file to check.
760
853
  * @returns `true` if the file exists, otherwise `false`.
761
854
  */
762
855
  existsSync(pathOrId) {
763
- return this.pathExistsSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId));
856
+ return this.resolve(pathOrId) !== false;
764
857
  }
765
858
  /**
766
859
  * Checks if a file exists in the virtual file system (VFS).
@@ -768,32 +861,22 @@ var VirtualFileSystem = class {
768
861
  * @remarks
769
862
  * This is a base method used by {@link existsSync} - it does not try to resolve the path prior to checking if it exists or not.
770
863
  *
771
- * @param path - The path of the file to check.
864
+ * @param pathOrId - The path of the file to check.
772
865
  * @returns `true` if the file exists, otherwise `false`.
773
866
  */
774
- fileExistsSync(path) {
775
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
776
- return this.isValidBuiltinId(formattedPath) || this.#virtualFS.existsSync(formattedPath) && this.#virtualFS.lstatSync(formattedPath).isFile() || this.#fs.existsSync(formattedPath) && this.#fs.lstatSync(formattedPath).isFile() || this.resolveFS(path).existsSync(formattedPath) && this.resolveFS(path).lstatSync(formattedPath).isFile();
867
+ isFile(pathOrId) {
868
+ const resolved = this.resolve(pathOrId);
869
+ return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isFile() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isFile() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isFile()));
777
870
  }
778
871
  /**
779
872
  * Checks if a directory exists in the virtual file system (VFS).
780
873
  *
781
- * @param path - The path of the directory to check.
874
+ * @param pathOrId - The path of the directory to check.
782
875
  * @returns `true` if the directory exists, otherwise `false`.
783
876
  */
784
- directoryExistsSync(path) {
785
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
786
- return this.#virtualFS.existsSync(formattedPath) && this.#virtualFS.lstatSync(formattedPath).isDirectory() || this.#fs.existsSync(formattedPath) && this.#fs.lstatSync(formattedPath).isDirectory() || this.resolveFS(path).existsSync(formattedPath) && this.resolveFS(path).lstatSync(formattedPath).isDirectory();
787
- }
788
- /**
789
- * Checks if a path exists in the virtual file system (VFS).
790
- *
791
- * @param path - The path to check.
792
- * @returns `true` if the path exists, otherwise `false`.
793
- */
794
- pathExistsSync(path) {
795
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
796
- return this.isValidBuiltinId(formattedPath) || this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
877
+ isDirectory(pathOrId) {
878
+ const resolved = this.resolve(pathOrId);
879
+ return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isDirectory() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isDirectory() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isDirectory()));
797
880
  }
798
881
  /**
799
882
  * Retrieves the status of a file in the virtual file system (VFS).
@@ -802,7 +885,7 @@ var VirtualFileSystem = class {
802
885
  * @returns A promise that resolves to the file's status information, or false if the file does not exist.
803
886
  */
804
887
  async stat(pathOrId, options) {
805
- return this.resolveFS(pathOrId).promises.stat(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
888
+ return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
806
889
  }
807
890
  /**
808
891
  * Synchronously retrieves the status of a file in the virtual file system (VFS).
@@ -811,7 +894,7 @@ var VirtualFileSystem = class {
811
894
  * @returns The file's status information, or false if the file does not exist.
812
895
  */
813
896
  statSync(pathOrId) {
814
- return this.resolveFS(pathOrId).statSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId));
897
+ return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
815
898
  }
816
899
  /**
817
900
  * Retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -820,7 +903,7 @@ var VirtualFileSystem = class {
820
903
  * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
821
904
  */
822
905
  async lstat(pathOrId, options) {
823
- return this.resolveFS(pathOrId).promises.lstat(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
906
+ return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
824
907
  }
825
908
  /**
826
909
  * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -829,23 +912,7 @@ var VirtualFileSystem = class {
829
912
  * @returns The symbolic link's status information, or false if the link does not exist.
830
913
  */
831
914
  lstatSync(pathOrId, options) {
832
- return this.resolveFS(pathOrId).lstatSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
833
- }
834
- /**
835
- * Resolves a path or ID to a runtime file id in the virtual file system.
836
- *
837
- * @param pathOrId - The path or id of the file to resolve.
838
- * @returns The resolved id of the runtime file if it exists, otherwise false.
839
- */
840
- resolveId(pathOrId) {
841
- if (this.builtinIdMap.has(this.formatRuntimeId(toFilePath(pathOrId)))) {
842
- return this.formatRuntimeId(toFilePath(pathOrId));
843
- }
844
- const filePath = this.resolvePath(toFilePath(pathOrId));
845
- if (filePath) {
846
- return this.builtinIdMap.keys().find((id) => this.builtinIdMap.get(id) === filePath) || false;
847
- }
848
- return false;
915
+ return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
849
916
  }
850
917
  /**
851
918
  * Resolves a path based on TypeScript's `tsconfig.json` paths.
@@ -858,9 +925,9 @@ var VirtualFileSystem = class {
858
925
  resolveTsconfigPath(path) {
859
926
  if (this.#context.tsconfig.options.paths) {
860
927
  for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
861
- const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePathName(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatAbsoluteFilePath(tsconfigPath) === this.formatAbsoluteFilePath(path));
928
+ const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
862
929
  if (resolvedPath) {
863
- return this.formatAbsoluteFilePath(resolvedPath) === this.formatAbsoluteFilePath(path) ? this.formatAbsoluteFilePath(resolvedPath) : this.resolvePathName(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
930
+ return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
864
931
  }
865
932
  }
866
933
  }
@@ -890,7 +957,7 @@ var VirtualFileSystem = class {
890
957
  * @returns The resolved real path if it exists, otherwise undefined.
891
958
  */
892
959
  realpathSync(pathOrId) {
893
- const filePath = this.resolvePath(toFilePath(pathOrId));
960
+ const filePath = this.resolve(toFilePath(pathOrId));
894
961
  if (!filePath) {
895
962
  throw new Error(`File not found: ${toFilePath(pathOrId)}`);
896
963
  }
@@ -903,24 +970,18 @@ var VirtualFileSystem = class {
903
970
  * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
904
971
  * @returns The resolved file path if it exists, otherwise undefined.
905
972
  */
906
- resolvePath(pathOrId, options = {}) {
907
- const formattedPath = toFilePath(pathOrId);
908
- const resolverKey = `${formattedPath}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
973
+ resolve(pathOrId, options = {}) {
974
+ const formattedPathOrId = toFilePath(pathOrId);
975
+ const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
909
976
  if (this.#cachedResolver.has(resolverKey)) {
910
977
  return this.#cachedResolver.get(resolverKey);
911
- } else if (this.#cachedFS.has(formattedPath)) {
912
- return formattedPath;
913
978
  }
914
- let result = false;
915
- if (this.isValidBuiltinId(formattedPath)) {
916
- result = this.builtinIdMap.get(this.formatRuntimeId(formattedPath));
917
- } else {
918
- result = this.resolvePathName(formattedPath, options);
979
+ let result = this.resolveId(formattedPathOrId);
980
+ if (!result) {
981
+ result = this.resolvePath(formattedPathOrId, options);
919
982
  }
920
983
  if (!result) {
921
984
  result = false;
922
- } else {
923
- result = toFilePath(result);
924
985
  }
925
986
  if (result && options.withExtension === false) {
926
987
  return result.replace(/\.[m|c]?[t|j]sx?$/, "");
@@ -929,16 +990,12 @@ var VirtualFileSystem = class {
929
990
  return result;
930
991
  }
931
992
  /**
932
- * Formats a file path by removing the runtime prefix and leading null character.
993
+ * Retrieves the partial metadata for all files in the virtual file system (VFS).
933
994
  *
934
- * @param path - The file path to format.
935
- * @returns The formatted file path.
995
+ * @returns A record containing the partial metadata for all files.
936
996
  */
937
- formatFilePath(path) {
938
- if (!isSetString.isSetString(path)) {
939
- throw new Error(`Invalid path provided. Expected a string or a valid file path.`);
940
- }
941
- return path.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "");
997
+ getPartialMeta() {
998
+ return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
942
999
  }
943
1000
  /**
944
1001
  * Converts a relative path to an absolute path based on the workspace and project root.
@@ -946,56 +1003,67 @@ var VirtualFileSystem = class {
946
1003
  * @param path - The relative path to convert.
947
1004
  * @returns The absolute path.
948
1005
  */
949
- formatAbsoluteFilePath = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((path) => {
950
- const formattedPath = this.formatFilePath(path);
1006
+ formatPath(path) {
1007
+ const formattedPath = toFilePath(path);
951
1008
  if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
952
1009
  return formattedPath;
953
1010
  } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
954
1011
  return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
955
1012
  }
956
1013
  return formattedPath;
957
- }, "formatAbsoluteFilePath");
1014
+ }
958
1015
  /**
959
- * Formats a runtime ID by removing the file extension and prepending the runtime prefix.
1016
+ * Formats a file id by removing the file extension and prepending the runtime prefix.
960
1017
  *
961
- * @param id - The runtime ID to format.
962
- * @returns The formatted runtime ID.
1018
+ * @param id - The file ID to format.
1019
+ * @returns The formatted file ID.
963
1020
  */
964
- formatRuntimeId(id) {
965
- return `${this.#context.config.output.builtinPrefix}:${this.formatFilePath(id).replace(/\.[m|c]?[t|j]sx?$/, "")}`;
1021
+ formatId(id) {
1022
+ const formattedId = toFilePath(id);
1023
+ return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileExtensionSafe(formattedId), "")}`;
966
1024
  }
967
1025
  /**
968
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1026
+ * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
969
1027
  *
970
- * @param pathOrId - The path or ID to resolve.
971
- * @returns The resolved file path if it exists, otherwise undefined.
1028
+ * @param id - The id to resolve.
1029
+ * @returns The resolved file id if it exists, otherwise undefined.
972
1030
  */
973
- resolvePathName(pathOrId, options = {}) {
974
- if (pathOrId.startsWith(`${this.#context.config.output.builtinPrefix}:`)) {
975
- return false;
1031
+ resolveId(id) {
1032
+ if (this.#ids[this.formatId(id)]) {
1033
+ return this.#ids[this.formatId(id)] || false;
976
1034
  }
977
- if (isType.isAbsolutePath(pathOrId)) {
978
- if (options.type === "file" ? this.fileExistsSync(pathOrId) : this.pathExistsSync(pathOrId)) {
979
- return pathOrId;
1035
+ return false;
1036
+ }
1037
+ /**
1038
+ * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1039
+ *
1040
+ * @param path - The path to resolve.
1041
+ * @param options - Optional parameters for resolving the path.
1042
+ * @returns The resolved file path if it exists, otherwise undefined.
1043
+ */
1044
+ resolvePath(path, options = {}) {
1045
+ if (isType.isAbsolutePath(path)) {
1046
+ if (this.#existsSync(path)) {
1047
+ return path;
980
1048
  }
981
- const result = checkVariants(pathOrId, this);
1049
+ const result = this.checkVariants(path);
982
1050
  if (result) {
983
1051
  return result;
984
1052
  }
985
1053
  }
986
- for (const path of this.resolveParentPaths(pathOrId, options.paths)) {
987
- const request = joinPaths.joinPaths(path, pathOrId);
988
- if (options.type === "file" ? this.fileExistsSync(pathOrId) : this.pathExistsSync(pathOrId)) {
1054
+ for (const parentPath of this.resolveParentPaths(path, options.paths)) {
1055
+ const request = joinPaths.joinPaths(parentPath, path);
1056
+ if (this.#existsSync(request)) {
989
1057
  return request;
990
1058
  }
991
- const result = checkVariants(request, this);
1059
+ const result = this.checkVariants(request);
992
1060
  if (result) {
993
1061
  return result;
994
1062
  }
995
1063
  }
996
1064
  return false;
997
1065
  }
998
- resolveParentPaths(request, current = []) {
1066
+ resolveParentPaths(request, parents = []) {
999
1067
  let paths = [
1000
1068
  this.#context.workspaceConfig.workspaceRoot,
1001
1069
  joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
@@ -1013,7 +1081,7 @@ var VirtualFileSystem = class {
1013
1081
  ret.push(path);
1014
1082
  }
1015
1083
  return ret;
1016
- }, current.filter(Boolean).map((p) => this.formatAbsoluteFilePath(toFilePath(p))));
1084
+ }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1017
1085
  }
1018
1086
  /**
1019
1087
  * Select the file system module to use for the operation based on the path or URL.
@@ -1044,7 +1112,7 @@ var VirtualFileSystem = class {
1044
1112
  } else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
1045
1113
  return "fs";
1046
1114
  }
1047
- return null;
1115
+ return void 0;
1048
1116
  }
1049
1117
  /**
1050
1118
  * Clears the resolver cache for a given path.
@@ -1054,208 +1122,93 @@ var VirtualFileSystem = class {
1054
1122
  clearResolverCache(path) {
1055
1123
  this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1056
1124
  }
1057
- };
1058
- var FILE_PREFIX = "file://";
1059
- function toFilePath(pathOrUrl) {
1060
- if (!pathOrUrl) {
1061
- throw new Error("No Path or URL provided to Virtual File System");
1062
- }
1063
- let result = pathOrUrl.toString();
1064
- if (result.startsWith(FILE_PREFIX)) {
1065
- result = result.slice(FILE_PREFIX.length);
1066
- }
1067
- return result;
1068
- }
1069
- chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
1070
- var FS_METHODS = [
1071
- "mkdir",
1072
- "mkdirSync",
1073
- "rmdir",
1074
- "rmdirSync",
1075
- "unlink",
1076
- "unlinkSync",
1077
- "existsSync",
1078
- "realpathSync",
1079
- "writeFileSync",
1080
- "readFileSync",
1081
- "readdirSync",
1082
- "createWriteStream",
1083
- "WriteStream",
1084
- "createReadStream",
1085
- "ReadStream"
1086
- ];
1087
- var FS_PROMISE_METHODS = [
1088
- "mkdir",
1089
- "rm",
1090
- "rmdir",
1091
- "unlink",
1092
- "writeFile",
1093
- "readFile",
1094
- "readdir",
1095
- "stat",
1096
- "lstat"
1097
- ];
1098
- function cloneFS(originalFS) {
1099
- const clonedFS = {
1100
- ...originalFS,
1101
- promises: {
1102
- ...originalFS.promises ?? {}
1125
+ /**
1126
+ * Check if the file exists with different variants (index, extensions).
1127
+ *
1128
+ * @param request - The request path to check.
1129
+ * @param parentPath - An optional parent path to prepend to the request.
1130
+ * @returns The file path if it exists, otherwise false.
1131
+ */
1132
+ checkVariants(request, parentPath) {
1133
+ const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1134
+ let file = this.checkExtensions(path);
1135
+ if (file) {
1136
+ return file;
1103
1137
  }
1104
- };
1105
- for (const method of FS_METHODS) {
1106
- if (originalFS[method]) {
1107
- clonedFS[method] = originalFS[method];
1138
+ file = this.checkIndex(path);
1139
+ if (file) {
1140
+ return file;
1108
1141
  }
1142
+ return false;
1109
1143
  }
1110
- originalFS.promises ??= {};
1111
- for (const method of FS_PROMISE_METHODS) {
1112
- if (originalFS.promises[method]) {
1113
- clonedFS.promises ??= {};
1114
- clonedFS.promises[method] = originalFS.promises[method];
1115
- clonedFS[method] = originalFS.promises[method];
1144
+ /**
1145
+ * Check if the index file exists in the given request path.
1146
+ *
1147
+ * @param request - The request path to check.
1148
+ * @returns The index file path if it exists, otherwise false.
1149
+ */
1150
+ checkIndex(request) {
1151
+ let file = joinPaths.joinPaths(request, "index");
1152
+ if (this.#existsSync(file)) {
1153
+ return file;
1116
1154
  }
1117
- }
1118
- for (const prop in clonedFS) {
1119
- if (isFunction.isFunction(clonedFS[prop])) {
1120
- clonedFS[prop] = clonedFS[prop].bind(originalFS);
1121
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1122
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1123
- }
1155
+ file = this.checkExtensions(file);
1156
+ if (file) {
1157
+ return file;
1124
1158
  }
1159
+ return false;
1125
1160
  }
1126
- for (const prop in clonedFS.promises) {
1127
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1128
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1161
+ /**
1162
+ * Check if the file exists with different extensions.
1163
+ *
1164
+ * @param request - The request path to check.
1165
+ * @param vfs - The file system module to use for checking file existence.
1166
+ * @returns The file path if it exists with any of the checked extensions, otherwise false.
1167
+ */
1168
+ checkExtensions(request) {
1169
+ let file = `${request}.ts`;
1170
+ if (this.#existsSync(file)) {
1171
+ return file;
1129
1172
  }
1173
+ file = `${request}.mts`;
1174
+ if (this.#existsSync(file)) {
1175
+ return file;
1176
+ }
1177
+ file = `${request}.cts`;
1178
+ if (this.#existsSync(file)) {
1179
+ return file;
1180
+ }
1181
+ file = `${request}.tsx`;
1182
+ if (this.#existsSync(file)) {
1183
+ return file;
1184
+ }
1185
+ file = `${request}.js`;
1186
+ if (this.#existsSync(file)) {
1187
+ return file;
1188
+ }
1189
+ file = `${request}.mjs`;
1190
+ if (this.#existsSync(file)) {
1191
+ return file;
1192
+ }
1193
+ file = `${request}.cjs`;
1194
+ if (this.#existsSync(file)) {
1195
+ return file;
1196
+ }
1197
+ file = `${request}.jsx`;
1198
+ if (this.#existsSync(file)) {
1199
+ return file;
1200
+ }
1201
+ file = `${request}.json`;
1202
+ if (this.#existsSync(file)) {
1203
+ return file;
1204
+ }
1205
+ file = `${request}.d.ts`;
1206
+ if (this.#existsSync(file)) {
1207
+ return file;
1208
+ }
1209
+ return false;
1130
1210
  }
1131
- return clonedFS;
1132
- }
1133
- chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
1134
- function patchFS(originalFS, vfs) {
1135
- const clonedFS = cloneFS(originalFS);
1136
- originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
1137
- originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
1138
- originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
1139
- originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
1140
- originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
1141
- originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
1142
- originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
1143
- Object.defineProperty(originalFS, "realpathSync", {
1144
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
1145
- });
1146
- originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
1147
- originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
1148
- originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
1149
- originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
1150
- originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
1151
- originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
1152
- Object.defineProperty(originalFS, "statSync", {
1153
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
1154
- });
1155
- originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
1156
- originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
1157
- Object.defineProperty(originalFS, "lstatSync", {
1158
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
1159
- });
1160
- originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
1161
- originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
1162
- return () => {
1163
- originalFS.mkdirSync = clonedFS.mkdirSync;
1164
- originalFS.mkdir = clonedFS.mkdir;
1165
- originalFS.promises.mkdir = clonedFS.promises.mkdir;
1166
- originalFS.unlinkSync = clonedFS.unlinkSync;
1167
- originalFS.promises.rm = clonedFS.promises.rm;
1168
- originalFS.promises.unlink = clonedFS.promises.unlink;
1169
- originalFS.existsSync = clonedFS.existsSync;
1170
- originalFS.realpathSync = clonedFS.realpathSync;
1171
- originalFS.writeFileSync = clonedFS.writeFileSync;
1172
- originalFS.promises.writeFile = clonedFS.promises.writeFile;
1173
- originalFS.readFileSync = clonedFS.readFileSync;
1174
- originalFS.promises.readFile = clonedFS.promises.readFile;
1175
- originalFS.readdirSync = clonedFS.readdirSync;
1176
- originalFS.promises.readdir = clonedFS.promises.readdir;
1177
- Object.defineProperty(originalFS, "statSync", {
1178
- value: clonedFS.statSync
1179
- });
1180
- originalFS.stat = clonedFS.stat;
1181
- originalFS.promises.stat = clonedFS.promises.stat;
1182
- Object.defineProperty(originalFS, "lstatSync", {
1183
- value: clonedFS.lstatSync
1184
- });
1185
- originalFS.lstat = clonedFS.lstat;
1186
- originalFS.promises.lstat = clonedFS.promises.lstat;
1187
- };
1188
- }
1189
- chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
1190
- function checkVariants(request, vfs, parentPath) {
1191
- const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1192
- let file = checkExtensions(path, vfs);
1193
- if (file) {
1194
- return file;
1195
- }
1196
- file = checkIndex(path, vfs);
1197
- if (file) {
1198
- return file;
1199
- }
1200
- return false;
1201
- }
1202
- chunkPK6SKIKE_cjs.__name(checkVariants, "checkVariants");
1203
- function checkIndex(request, vfs) {
1204
- let file = joinPaths.joinPaths(request, "index");
1205
- if (vfs.fileExistsSync(file)) {
1206
- return file;
1207
- }
1208
- file = checkExtensions(file, vfs);
1209
- if (file) {
1210
- return file;
1211
- }
1212
- return false;
1213
- }
1214
- chunkPK6SKIKE_cjs.__name(checkIndex, "checkIndex");
1215
- function checkExtensions(request, vfs) {
1216
- let file = `${request}.ts`;
1217
- if (vfs.fileExistsSync(file)) {
1218
- return file;
1219
- }
1220
- file = `${request}.mts`;
1221
- if (vfs.fileExistsSync(file)) {
1222
- return file;
1223
- }
1224
- file = `${request}.cts`;
1225
- if (vfs.fileExistsSync(file)) {
1226
- return file;
1227
- }
1228
- file = `${request}.tsx`;
1229
- if (vfs.fileExistsSync(file)) {
1230
- return file;
1231
- }
1232
- file = `${request}.js`;
1233
- if (vfs.fileExistsSync(file)) {
1234
- return file;
1235
- }
1236
- file = `${request}.mjs`;
1237
- if (vfs.fileExistsSync(file)) {
1238
- return file;
1239
- }
1240
- file = `${request}.cjs`;
1241
- if (vfs.fileExistsSync(file)) {
1242
- return file;
1243
- }
1244
- file = `${request}.jsx`;
1245
- if (vfs.fileExistsSync(file)) {
1246
- return file;
1247
- }
1248
- file = `${request}.json`;
1249
- if (vfs.fileExistsSync(file)) {
1250
- return file;
1251
- }
1252
- file = `${request}.d.ts`;
1253
- if (vfs.fileExistsSync(file)) {
1254
- return file;
1255
- }
1256
- return false;
1257
- }
1258
- chunkPK6SKIKE_cjs.__name(checkExtensions, "checkExtensions");
1211
+ };
1259
1212
  function createVfs(context) {
1260
1213
  const vfs = new VirtualFileSystem(context);
1261
1214
  return vfs;
@@ -1263,7 +1216,8 @@ function createVfs(context) {
1263
1216
  chunkPK6SKIKE_cjs.__name(createVfs, "createVfs");
1264
1217
 
1265
1218
  // src/internal/contexts/context.ts
1266
- var cache = /* @__PURE__ */ new WeakMap();
1219
+ var configCache = /* @__PURE__ */ new WeakMap();
1220
+ var parseCache = /* @__PURE__ */ new WeakMap();
1267
1221
  var PowerlinesContext = class _PowerlinesContext {
1268
1222
  static {
1269
1223
  chunkPK6SKIKE_cjs.__name(this, "PowerlinesContext");
@@ -1399,10 +1353,10 @@ var PowerlinesContext = class _PowerlinesContext {
1399
1353
  workspaceRoot: this.workspaceConfig?.workspaceRoot,
1400
1354
  projectRoot: this.config?.projectRoot
1401
1355
  }, {
1402
- maxLength: chunkXFIGAAKN_cjs.PROJECT_ROOT_HASH_LENGTH
1356
+ maxLength: chunkQ2RUDKWY_cjs.PROJECT_ROOT_HASH_LENGTH
1403
1357
  }),
1404
1358
  configHash: murmurhash.murmurhash(this.config, {
1405
- maxLength: chunkXFIGAAKN_cjs.CACHE_HASH_LENGTH
1359
+ maxLength: chunkQ2RUDKWY_cjs.CACHE_HASH_LENGTH
1406
1360
  }),
1407
1361
  builtinIdMap: {},
1408
1362
  virtualFiles: {}
@@ -1464,7 +1418,7 @@ var PowerlinesContext = class _PowerlinesContext {
1464
1418
  * Get the path to the data directory for the project
1465
1419
  */
1466
1420
  get dataPath() {
1467
- return join.joinPaths(this.envPaths.data, "projects", chunkXFIGAAKN_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
1421
+ return join.joinPaths(this.envPaths.data, "projects", chunkQ2RUDKWY_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
1468
1422
  }
1469
1423
  /**
1470
1424
  * Get the path to the cache directory for the project
@@ -1474,7 +1428,7 @@ var PowerlinesContext = class _PowerlinesContext {
1474
1428
  checksum: this.#checksum,
1475
1429
  config: this.meta.configHash
1476
1430
  }, {
1477
- maxLength: chunkXFIGAAKN_cjs.CACHE_HASH_LENGTH
1431
+ maxLength: chunkQ2RUDKWY_cjs.CACHE_HASH_LENGTH
1478
1432
  }));
1479
1433
  }
1480
1434
  /**
@@ -1490,6 +1444,57 @@ var PowerlinesContext = class _PowerlinesContext {
1490
1444
  return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.projectRoot);
1491
1445
  }
1492
1446
  /**
1447
+ * The builtin module id that exist in the Powerlines virtual file system
1448
+ */
1449
+ get builtins() {
1450
+ return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
1451
+ }
1452
+ /**
1453
+ * Get the project root relative to the workspace root
1454
+ */
1455
+ async getBuiltins() {
1456
+ return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
1457
+ const code = await this.fs.readFile(path);
1458
+ return {
1459
+ ...meta,
1460
+ path,
1461
+ code
1462
+ };
1463
+ }));
1464
+ }
1465
+ /**
1466
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1467
+ *
1468
+ * @param code - The source code of the entry file
1469
+ * @param path - A path to write the entry file to
1470
+ * @param options - Optional write file options
1471
+ */
1472
+ async writeEntry(code, path, options = {}) {
1473
+ return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
1474
+ code,
1475
+ variant: "entry"
1476
+ }, defu3__default.default(options, {
1477
+ mode: this.config.output.mode
1478
+ }));
1479
+ }
1480
+ /**
1481
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1482
+ *
1483
+ * @param code - The source code of the builtin file
1484
+ * @param id - The unique identifier of the builtin file
1485
+ * @param path - An optional path to write the builtin file to
1486
+ * @param options - Optional write file options
1487
+ */
1488
+ async writeBuiltin(code, id, path, options = {}) {
1489
+ return this.fs.writeFile(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), {
1490
+ id,
1491
+ code,
1492
+ variant: "builtin"
1493
+ }, defu3__default.default(options, {
1494
+ mode: this.config.output.mode
1495
+ }));
1496
+ }
1497
+ /**
1493
1498
  * Parses the source code and returns a {@link ParseResult} object.
1494
1499
  *
1495
1500
  * @param code - The source code to parse.
@@ -1498,12 +1503,31 @@ var PowerlinesContext = class _PowerlinesContext {
1498
1503
  * @returns The parsed {@link ParseResult} object.
1499
1504
  */
1500
1505
  async parse(code, id, options = {}) {
1501
- return oxcParser.parseAsync(id, code, defu3__default.default(options ?? {}, {
1506
+ if (parseCache.has({
1507
+ code,
1508
+ options
1509
+ })) {
1510
+ return parseCache.get({
1511
+ code,
1512
+ options
1513
+ });
1514
+ }
1515
+ const result = await oxcParser.parseAsync(id, code, defu3__default.default(options ?? {}, {
1502
1516
  lang: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1503
1517
  astType: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1504
1518
  sourceType: "module",
1505
1519
  showSemanticErrors: false
1506
1520
  }));
1521
+ if (result.errors && result.errors.length > 0) {
1522
+ throw new Error(`Powerlines parsing errors in file: ${id}
1523
+ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.codeframe ? ` (${error.codeframe})` : ""}${error.helpMessage ? `
1524
+ Help: ${error.helpMessage}` : ""}`).join("\n")}`);
1525
+ }
1526
+ parseCache.set({
1527
+ code,
1528
+ options
1529
+ }, result);
1530
+ return result;
1507
1531
  }
1508
1532
  /**
1509
1533
  * Update the context using a new user configuration options
@@ -1592,8 +1616,8 @@ var PowerlinesContext = class _PowerlinesContext {
1592
1616
  configFile: config.configFile ?? this.config.configFile,
1593
1617
  command: this.config.inlineConfig?.command
1594
1618
  };
1595
- if (cache.has(cacheKey)) {
1596
- const result = cache.get(cacheKey);
1619
+ if (configCache.has(cacheKey)) {
1620
+ const result = configCache.get(cacheKey);
1597
1621
  this.projectJson = result.projectJson;
1598
1622
  this.packageJson = result.packageJson;
1599
1623
  this.#checksum = result.checksum;
@@ -1608,7 +1632,7 @@ var PowerlinesContext = class _PowerlinesContext {
1608
1632
  if (exists.existsSync(packageJsonPath)) {
1609
1633
  this.packageJson = await json.readJsonFile(packageJsonPath);
1610
1634
  }
1611
- this.#checksum = await chunkXFIGAAKN_cjs.getChecksum(cacheKey.projectRoot);
1635
+ this.#checksum = await chunkQ2RUDKWY_cjs.getChecksum(cacheKey.projectRoot);
1612
1636
  this.resolver = createResolver({
1613
1637
  workspaceRoot: this.workspaceConfig.workspaceRoot,
1614
1638
  projectRoot: cacheKey.projectRoot,
@@ -1618,7 +1642,7 @@ var PowerlinesContext = class _PowerlinesContext {
1618
1642
  });
1619
1643
  const userConfig = await chunkMGEZC2RV_cjs.loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile);
1620
1644
  this.mergeUserConfig(userConfig.config);
1621
- cache.set(cacheKey, {
1645
+ configCache.set(cacheKey, {
1622
1646
  projectJson: this.projectJson,
1623
1647
  packageJson: this.packageJson,
1624
1648
  checksum: this.#checksum,
@@ -2077,7 +2101,7 @@ function resolveModulePath(nodePath, state) {
2077
2101
  return;
2078
2102
  }
2079
2103
  const sourcePath = nodePath.node.value;
2080
- const resolvedPath = state.context?.fs.resolvePath(sourcePath);
2104
+ const resolvedPath = state.context?.fs.resolve(sourcePath);
2081
2105
  if (resolvedPath) {
2082
2106
  nodePath.replaceWith(t__namespace.stringLiteral(
2083
2107
  // Remove the file extension if it exists
@@ -2178,8 +2202,9 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((contex
2178
2202
  async function generateTypes(context) {
2179
2203
  context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
2180
2204
  context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
2181
- const builtinFiles = await Promise.all((await context.fs.listBuiltinFiles()).filter((file) => !context.fs.isMatchingBuiltinId("index", file.id)).map(async (file) => {
2182
- const result = await core.transformAsync(file.contents, {
2205
+ const builtinFiles = await context.getBuiltins();
2206
+ const builtinFilePaths = await Promise.all(builtinFiles.map(async (file) => {
2207
+ const result = await core.transformAsync(file.code.toString(), {
2183
2208
  highlightCode: true,
2184
2209
  code: true,
2185
2210
  ast: false,
@@ -2207,14 +2232,14 @@ async function generateTypes(context) {
2207
2232
  throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
2208
2233
  }
2209
2234
  context.log(types.LogLevelLabel.TRACE, `Writing transformed built-in runtime file ${file.id}.`);
2210
- await context.fs.writeBuiltinFile(file.id, file.path, result.code);
2235
+ await context.writeBuiltin(result.code, file.id, file.path);
2211
2236
  return file.path;
2212
2237
  }));
2213
2238
  const typescriptPath = await resolve.resolvePackage("typescript");
2214
2239
  if (!typescriptPath) {
2215
2240
  throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
2216
2241
  }
2217
- const files = builtinFiles.reduce((ret, fileName) => {
2242
+ const files = builtinFilePaths.reduce((ret, fileName) => {
2218
2243
  const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
2219
2244
  if (!ret.includes(formatted)) {
2220
2245
  ret.push(formatted);
@@ -2249,9 +2274,9 @@ async function generateTypes(context) {
2249
2274
  const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
2250
2275
  const sourceFile2 = sourceFiles?.[0];
2251
2276
  if (sourceFile2?.fileName && !fileName.endsWith(".map")) {
2252
- if (context.fs.isBuiltinFile(sourceFile2.fileName)) {
2277
+ if (builtinFiles.some((file) => file.id === sourceFile2.fileName || file.path === sourceFile2.fileName)) {
2253
2278
  builtinModules += `
2254
- declare module "${context.fs.resolveId(sourceFile2.fileName)}" {
2279
+ declare module "${context.fs.resolve(sourceFile2.fileName)}" {
2255
2280
  ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
2256
2281
  }
2257
2282
  `;
@@ -2277,7 +2302,7 @@ declare module "${context.fs.resolveId(sourceFile2.fileName)}" {
2277
2302
  ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
2278
2303
  }
2279
2304
  context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
2280
- const sourceFile = chunk65DUUIIF_cjs.getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
2305
+ const sourceFile = chunkUQJWVRRE_cjs.getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
2281
2306
  /// <reference types="powerlines/${context.config.build.platform}" />` : ""}
2282
2307
 
2283
2308
  ${chunkMFC7UJHT_cjs.getFileHeader(context, {
@@ -2290,7 +2315,9 @@ ${builtinModules}`.replace(
2290
2315
  /import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
2291
2316
  ""
2292
2317
  ).replaceAll("#private;", "").replace(/__Ω/g, ""));
2293
- await context.fs.writeFileToDisk(sourceFile.id, chunk65DUUIIF_cjs.getString(sourceFile.code));
2318
+ await context.fs.writeFile(sourceFile.id, chunkUQJWVRRE_cjs.getString(sourceFile.code), {
2319
+ mode: "fs"
2320
+ });
2294
2321
  }
2295
2322
  chunkPK6SKIKE_cjs.__name(generateTypes, "generateTypes");
2296
2323
  async function installPackage(context, packageName, dev = false) {
@@ -2454,7 +2481,9 @@ async function initializeTsconfig(context) {
2454
2481
  const tsconfigFilePath = chunkLJZEN4HP_cjs.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2455
2482
  context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
2456
2483
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
2457
- await context.fs.writeFileToDisk(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
2484
+ await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
2485
+ mode: "fs"
2486
+ });
2458
2487
  context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
2459
2488
  }
2460
2489
  chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
@@ -2503,7 +2532,7 @@ async function resolveTsconfig(context) {
2503
2532
  `).join("\n")}
2504
2533
  `);
2505
2534
  }
2506
- await chunkTZFBE35T_cjs.writeFile(context.log, context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
2535
+ await chunkRQICHHZM_cjs.writeFile(context.log, context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
2507
2536
  context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2508
2537
  if (!context.tsconfig) {
2509
2538
  throw new Error("Failed to parse the TypeScript configuration file.");
@@ -2578,8 +2607,8 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
2578
2607
  context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
2579
2608
 
2580
2609
  ${console.formatLogMessage(context.config)}`);
2581
- context.fs[chunkXFIGAAKN_cjs.__VFS_INIT__]();
2582
- await chunkXFIGAAKN_cjs.writeMetaFile(context);
2610
+ context.fs[chunkQ2RUDKWY_cjs.__VFS_INIT__]();
2611
+ await chunkQ2RUDKWY_cjs.writeMetaFile(context);
2583
2612
  context.persistedMeta = context.meta;
2584
2613
  if (!exists.existsSync(context.cachePath)) {
2585
2614
  await helpers.createDirectory(context.cachePath);
@@ -2590,11 +2619,6 @@ ${console.formatLogMessage(context.config)}`);
2590
2619
  await this.callPreHook(context, "prepare");
2591
2620
  if (context.config.projectType === "application") {
2592
2621
  context.log(types.LogLevelLabel.TRACE, "Generating built-in barrel file");
2593
- await context.fs.writeBuiltinFile("index", joinPaths.joinPaths(context.builtinsPath, "index.ts"), `
2594
- ${chunkMFC7UJHT_cjs.getFileHeader(context)}
2595
-
2596
- ${(await context.fs.listBuiltinFiles()).filter((file) => !isParentPath.isParentPath(file.path, joinPaths.joinPaths(context.builtinsPath, "log")) && !isParentPath.isParentPath(file.path, joinPaths.joinPaths(context.builtinsPath, "storage"))).map((file) => `export * from "./${replace.replacePath(file.path, context.builtinsPath).replace(`.${filePathFns.findFileExtensionSafe(file.path)}`, "")}";`).join("\n")}
2597
- `);
2598
2622
  }
2599
2623
  if (context.config.output.dts !== false) {
2600
2624
  await generateTypes(context);
@@ -2605,8 +2629,8 @@ ${console.formatLogMessage(context.config)}`);
2605
2629
  throw new Error("Failed to parse the TypeScript configuration file.");
2606
2630
  }
2607
2631
  await this.callPostHook(context, "prepare");
2608
- await chunkXFIGAAKN_cjs.writeMetaFile(context);
2609
- context.fs[chunkXFIGAAKN_cjs.__VFS_REVERT__]();
2632
+ await chunkQ2RUDKWY_cjs.writeMetaFile(context);
2633
+ context.fs[chunkQ2RUDKWY_cjs.__VFS_REVERT__]();
2610
2634
  });
2611
2635
  this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
2612
2636
  }
@@ -2629,7 +2653,7 @@ ${console.formatLogMessage(context.config)}`);
2629
2653
  for (const file of files) {
2630
2654
  context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
2631
2655
  const template = Handlebars__default.default.compile(file);
2632
- await chunkTZFBE35T_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2656
+ await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2633
2657
  }
2634
2658
  await this.callNormalHook(context, "new");
2635
2659
  if (context.config.projectType === "application") {
@@ -2637,14 +2661,14 @@ ${console.formatLogMessage(context.config)}`);
2637
2661
  for (const file of files2) {
2638
2662
  context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
2639
2663
  const template = Handlebars__default.default.compile(file);
2640
- await chunkTZFBE35T_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2664
+ await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2641
2665
  }
2642
2666
  } else {
2643
2667
  const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
2644
2668
  for (const file of files2) {
2645
2669
  context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
2646
2670
  const template = Handlebars__default.default.compile(file);
2647
- await chunkTZFBE35T_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2671
+ await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2648
2672
  }
2649
2673
  }
2650
2674
  await this.callPostHook(context, "new");
@@ -2765,7 +2789,7 @@ ${console.formatLogMessage(context.config)}`);
2765
2789
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
2766
2790
  await this.#executeEnvironments(async (context) => {
2767
2791
  await this.callHook(context, "finalize");
2768
- context.fs[chunkXFIGAAKN_cjs.__VFS_REVERT__]();
2792
+ context.fs[chunkQ2RUDKWY_cjs.__VFS_REVERT__]();
2769
2793
  });
2770
2794
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
2771
2795
  }
@@ -3053,7 +3077,7 @@ function createUnpluginFactory(variant, decorate) {
3053
3077
  async function resolveId(id, importer, options = {
3054
3078
  isEntry: false
3055
3079
  }) {
3056
- return chunkVRNWPH35_cjs.handleResolveId(api.context, {
3080
+ return chunk7EAV6Q7B_cjs.handleResolveId(api.context, {
3057
3081
  id,
3058
3082
  importer,
3059
3083
  options
@@ -3068,9 +3092,7 @@ function createUnpluginFactory(variant, decorate) {
3068
3092
  async function load(id) {
3069
3093
  const environment = await api.context.getEnvironment();
3070
3094
  if (id) {
3071
- const resolvedPath = environment.fs.resolvePath(id, {
3072
- type: "file"
3073
- });
3095
+ const resolvedPath = environment.fs.resolve(id);
3074
3096
  if (resolvedPath) {
3075
3097
  return environment.fs.readFile(resolvedPath);
3076
3098
  }
@@ -3089,15 +3111,15 @@ function createUnpluginFactory(variant, decorate) {
3089
3111
  async function transform(code, id) {
3090
3112
  const environment = await api.context.getEnvironment();
3091
3113
  let transformed = code;
3092
- let result2 = await api.callPreHook(environment, "transform", chunk65DUUIIF_cjs.getString(transformed), id);
3114
+ let result2 = await api.callPreHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3093
3115
  if (result2) {
3094
3116
  transformed = result2;
3095
3117
  }
3096
- result2 = await api.callNormalHook(environment, "transform", chunk65DUUIIF_cjs.getString(transformed), id);
3118
+ result2 = await api.callNormalHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3097
3119
  if (result2) {
3098
3120
  transformed = result2;
3099
3121
  }
3100
- result2 = await api.callPostHook(environment, "transform", chunk65DUUIIF_cjs.getString(transformed), id);
3122
+ result2 = await api.callPostHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3101
3123
  if (result2) {
3102
3124
  transformed = result2;
3103
3125
  }
@@ -3147,5 +3169,5 @@ function createUnpluginFactory(variant, decorate) {
3147
3169
  chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
3148
3170
 
3149
3171
  exports.createUnpluginFactory = createUnpluginFactory;
3150
- //# sourceMappingURL=chunk-YQG6JE5R.cjs.map
3151
- //# sourceMappingURL=chunk-YQG6JE5R.cjs.map
3172
+ //# sourceMappingURL=chunk-M7WHFUKR.cjs.map
3173
+ //# sourceMappingURL=chunk-M7WHFUKR.cjs.map