powerlines 0.10.0 → 0.10.2

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-UESICHEO.cjs → chunk-2RHPFVYT.cjs} +17 -18
  6. package/dist/{chunk-75B5EPR4.js → chunk-3Y5CCIJR.js} +3 -3
  7. package/dist/{chunk-YE56I7CZ.cjs → chunk-5XYGZ3DC.cjs} +2 -2
  8. package/dist/{chunk-PFCQFK7H.js → chunk-5Y4JYQ66.js} +3 -3
  9. package/dist/{chunk-H2SX5ZYF.cjs → chunk-66GXB2UY.cjs} +4 -4
  10. package/dist/{chunk-VOB62ELC.js → chunk-6TJGZR5X.js} +4 -4
  11. package/dist/{chunk-BWZCYCIF.js → chunk-6UDHGAAI.js} +3 -3
  12. package/dist/{chunk-ETEQKM36.cjs → chunk-7IWH37DY.cjs} +2 -2
  13. package/dist/{chunk-GI35XXXH.js → chunk-EGSEJQCE.js} +3 -3
  14. package/dist/{chunk-ILVCZATT.js → chunk-GPPJ2CRE.js} +2 -2
  15. package/dist/{chunk-54SOH6E5.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-MXYZKFOD.js → chunk-KYGEWAEG.js} +3 -3
  19. package/dist/{chunk-6X6QQH33.cjs → chunk-L2SAK2JC.cjs} +4 -4
  20. package/dist/chunk-LXMNDUPG.cjs +12 -0
  21. package/dist/{chunk-V56DIXOO.js → chunk-N7NE3VOU.js} +4 -4
  22. package/dist/{chunk-D55IOUF3.js → chunk-OYIM2M74.js} +522 -517
  23. package/dist/{chunk-RRGXS7GZ.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-KCDZ3LCF.js → chunk-S746E63M.js} +3 -3
  27. package/dist/{chunk-FBBWXUGK.js → chunk-SDEBJQDT.js} +12 -13
  28. package/dist/chunk-SL3CXJWD.cjs +34 -0
  29. package/dist/{chunk-I5D3SVUH.cjs → chunk-UHCRNFFC.cjs} +9 -9
  30. package/dist/{chunk-5ST7UKJF.cjs → chunk-UTVZVGM3.cjs} +530 -525
  31. package/dist/{chunk-QIKKQQF7.cjs → chunk-UZQYBO6Z.cjs} +4 -4
  32. package/dist/{chunk-YOHDGH77.js → chunk-VIRKTIPK.js} +3 -3
  33. package/dist/{chunk-WAWIGYB4.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-DOBCIS3U.cjs → chunk-ZBDP43LG.cjs} +6 -6
  37. package/dist/chunk-ZFATNDSY.cjs +12 -0
  38. package/dist/{chunk-4R6CQNB2.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-2D74QBNW.cjs → chunk-M7WHFUKR.cjs} +524 -522
  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-WDNYOFEH.js → chunk-PIFE7MUZ.js} +500 -498
  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 -13
  320. package/dist/chunk-6FRFYMLC.cjs +0 -12
  321. package/dist/chunk-6M3HIMSG.cjs +0 -12
  322. package/dist/chunk-6ODSQSQL.cjs +0 -34
  323. package/dist/chunk-HPXUAQCU.cjs +0 -12
  324. package/dist/chunk-KJHDE76P.cjs +0 -24
  325. package/dist/chunk-R5CZG7XN.js +0 -31
  326. package/dist/chunk-RGMGFYXY.cjs +0 -12
  327. package/dist/chunk-TZ4Y7R4G.cjs +0 -12
  328. package/dist/lib/chunk-26W3IQT6.js.map +0 -1
  329. package/dist/lib/chunk-2D74QBNW.cjs.map +0 -1
  330. package/dist/lib/chunk-2ZYHO243.js.map +0 -1
  331. package/dist/lib/chunk-65DUUIIF.cjs.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-WDNYOFEH.js.map +0 -1
  362. package/dist/lib/chunk-XFIGAAKN.cjs.map +0 -1
  363. package/dist/lib/chunk-XHCRXNQ3.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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkAPVMN2H7_cjs = require('./chunk-APVMN2H7.cjs');
4
- var chunkYE56I7CZ_cjs = require('./chunk-YE56I7CZ.cjs');
4
+ var chunk5XYGZ3DC_cjs = require('./chunk-5XYGZ3DC.cjs');
5
5
  var chunk5VPVJHJO_cjs = require('./chunk-5VPVJHJO.cjs');
6
6
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
7
7
  var console = require('@storm-software/config-tools/logger/console');
@@ -13,8 +13,6 @@ var helpers = require('@stryke/fs/helpers');
13
13
  var install = require('@stryke/fs/install');
14
14
  var listFiles = require('@stryke/fs/list-files');
15
15
  var packageFns = require('@stryke/fs/package-fns');
16
- var filePathFns = require('@stryke/path/file-path-fns');
17
- var isParentPath = require('@stryke/path/is-parent-path');
18
16
  var joinPaths = require('@stryke/path/join-paths');
19
17
  var replace = require('@stryke/path/replace');
20
18
  var isError = require('@stryke/type-checks/is-error');
@@ -30,10 +28,10 @@ var json = require('@stryke/fs/json');
30
28
  var append = require('@stryke/path/append');
31
29
  var defu5 = require('defu');
32
30
  var ts2 = require('typescript');
33
- var titleCase = require('@stryke/string-format/title-case');
34
31
  require('@stryke/fs/remove-file');
35
32
  var hashFiles = require('@stryke/hash/hash-files');
36
33
  var getUnique = require('@stryke/helpers/get-unique');
34
+ var filePathFns = require('@stryke/path/file-path-fns');
37
35
  var kebabCase = require('@stryke/string-format/kebab-case');
38
36
  var isUndefined = require('@stryke/type-checks/is-undefined');
39
37
  var writeFile$1 = require('@stryke/fs/write-file');
@@ -41,10 +39,12 @@ var prettier = require('prettier');
41
39
  var resolve = require('@stryke/fs/resolve');
42
40
  var getConfig = require('@storm-software/config-tools/get-config');
43
41
  var c12 = require('c12');
42
+ var titleCase = require('@stryke/string-format/title-case');
44
43
  var getEnvPaths = require('@stryke/env/get-env-paths');
45
44
  var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
46
45
  var murmurhash = require('@stryke/hash/murmurhash');
47
46
  var omit = require('@stryke/helpers/omit');
47
+ var isType = require('@stryke/path/is-type');
48
48
  var join = require('@stryke/path/join');
49
49
  var isNull = require('@stryke/type-checks/is-null');
50
50
  var isString = require('@stryke/type-checks/is-string');
@@ -56,7 +56,7 @@ var colors = require('@storm-software/config-tools/utilities/colors');
56
56
  var noop = require('@stryke/helpers/noop');
57
57
  var jiti = require('jiti');
58
58
  var bufferToString = require('@stryke/convert/buffer-to-string');
59
- var isType = require('@stryke/path/is-type');
59
+ var isParentPath = require('@stryke/path/is-parent-path');
60
60
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
61
61
  var isBuffer = require('@stryke/type-checks/is-buffer');
62
62
  var memfs = require('memfs');
@@ -184,26 +184,6 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
184
184
  };
185
185
  }
186
186
  chunkPK6SKIKE_cjs.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
187
- function getBaseFileHeader(context) {
188
- return `
189
- // Generated with ${titleCase.titleCase(context.config.framework)}
190
- // Note: Do not edit this file manually - it will be overwritten automatically
191
- `;
192
- }
193
- chunkPK6SKIKE_cjs.__name(getBaseFileHeader, "getBaseFileHeader");
194
- function getFileHeader(context, options = {}) {
195
- const { directive = null, prettierIgnore = false } = options;
196
- return `/* eslint-disable */
197
- // biome-ignore lint: disable
198
- ${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
199
-
200
- ${directive}
201
- ` : "\n"}
202
- ${getBaseFileHeader(context)}
203
-
204
- `;
205
- }
206
- chunkPK6SKIKE_cjs.__name(getFileHeader, "getFileHeader");
207
187
  var PROJECT_ROOT_HASH_LENGTH = 45;
208
188
  var CACHE_HASH_LENGTH = 62;
209
189
  function getPrefixedProjectRootHash(name, projectRootHash) {
@@ -228,11 +208,13 @@ chunkPK6SKIKE_cjs.__name(getChecksum, "getChecksum");
228
208
  async function writeMetaFile(context) {
229
209
  const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
230
210
  context.log(types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
231
- await context.fs.writeFileToDisk(metaFilePath, JSON.stringify({
211
+ await context.fs.writeFile(metaFilePath, JSON.stringify({
232
212
  ...context.meta,
233
- builtinIdMap: Object.fromEntries(context.fs.builtinIdMap.entries()),
234
- virtualFiles: context.fs[chunkYE56I7CZ_cjs.__VFS_VIRTUAL__].toJSON(context.artifactsPath)
235
- }, null, 2));
213
+ virtualFiles: context.fs[chunk5XYGZ3DC_cjs.__VFS_VIRTUAL__].toJSON(context.artifactsPath),
214
+ virtualFilesMeta: context.fs.getPartialMeta()
215
+ }, null, 2), {
216
+ mode: "fs"
217
+ });
236
218
  }
237
219
  chunkPK6SKIKE_cjs.__name(writeMetaFile, "writeMetaFile");
238
220
  function isPlugin(value) {
@@ -498,6 +480,154 @@ function createResolver(options) {
498
480
  return baseResolver;
499
481
  }
500
482
  chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
483
+ function isBufferEncoding(options) {
484
+ return isSetString.isSetString(options) || options === null;
485
+ }
486
+ chunkPK6SKIKE_cjs.__name(isBufferEncoding, "isBufferEncoding");
487
+ function isPowerlinesWriteFileOptions(options) {
488
+ return !isBufferEncoding(options) && isSetObject.isSetObject(options) && ("skipFormat" in options || "mode" in options && (options.mode === "fs" || options.mode === "virtual"));
489
+ }
490
+ chunkPK6SKIKE_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
491
+ function isNodeWriteFileOptions(options) {
492
+ return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
493
+ }
494
+ chunkPK6SKIKE_cjs.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
495
+ function isPowerLinesWriteFileData(data) {
496
+ return !!(isSetObject.isSetObject(data) && "code" in data && data.code);
497
+ }
498
+ chunkPK6SKIKE_cjs.__name(isPowerLinesWriteFileData, "isPowerLinesWriteFileData");
499
+ var FILE_PREFIX = "file://";
500
+ function toFilePath(pathOrUrl) {
501
+ if (!pathOrUrl) {
502
+ throw new Error("No Path or URL provided to Virtual File System");
503
+ }
504
+ let result = pathOrUrl.toString();
505
+ if (result.startsWith(FILE_PREFIX)) {
506
+ result = result.slice(FILE_PREFIX.length);
507
+ }
508
+ return result;
509
+ }
510
+ chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
511
+ var FS_METHODS = [
512
+ "mkdir",
513
+ "mkdirSync",
514
+ "rmdir",
515
+ "rmdirSync",
516
+ "unlink",
517
+ "unlinkSync",
518
+ "existsSync",
519
+ "realpathSync",
520
+ "writeFileSync",
521
+ "readFileSync",
522
+ "readdirSync",
523
+ "createWriteStream",
524
+ "WriteStream",
525
+ "createReadStream",
526
+ "ReadStream"
527
+ ];
528
+ var FS_PROMISE_METHODS = [
529
+ "mkdir",
530
+ "rm",
531
+ "rmdir",
532
+ "unlink",
533
+ "writeFile",
534
+ "readFile",
535
+ "readdir",
536
+ "stat",
537
+ "lstat"
538
+ ];
539
+ function cloneFS(originalFS) {
540
+ const clonedFS = {
541
+ ...originalFS,
542
+ promises: {
543
+ ...originalFS.promises ?? {}
544
+ }
545
+ };
546
+ for (const method of FS_METHODS) {
547
+ if (originalFS[method]) {
548
+ clonedFS[method] = originalFS[method];
549
+ }
550
+ }
551
+ originalFS.promises ??= {};
552
+ for (const method of FS_PROMISE_METHODS) {
553
+ if (originalFS.promises[method]) {
554
+ clonedFS.promises ??= {};
555
+ clonedFS.promises[method] = originalFS.promises[method];
556
+ clonedFS[method] = originalFS.promises[method];
557
+ }
558
+ }
559
+ for (const prop in clonedFS) {
560
+ if (isFunction.isFunction(clonedFS[prop])) {
561
+ clonedFS[prop] = clonedFS[prop].bind(originalFS);
562
+ if (isFunction.isFunction(clonedFS.promises[prop])) {
563
+ clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
564
+ }
565
+ }
566
+ }
567
+ for (const prop in clonedFS.promises) {
568
+ if (isFunction.isFunction(clonedFS.promises[prop])) {
569
+ clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
570
+ }
571
+ }
572
+ return clonedFS;
573
+ }
574
+ chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
575
+ function patchFS(originalFS, vfs) {
576
+ const clonedFS = cloneFS(originalFS);
577
+ originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
578
+ originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
579
+ originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
580
+ originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
581
+ originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
582
+ originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
583
+ originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
584
+ Object.defineProperty(originalFS, "realpathSync", {
585
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
586
+ });
587
+ originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
588
+ originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
589
+ originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
590
+ originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
591
+ originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
592
+ originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
593
+ Object.defineProperty(originalFS, "statSync", {
594
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
595
+ });
596
+ originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
597
+ originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
598
+ Object.defineProperty(originalFS, "lstatSync", {
599
+ value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
600
+ });
601
+ originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
602
+ originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
603
+ return () => {
604
+ originalFS.mkdirSync = clonedFS.mkdirSync;
605
+ originalFS.mkdir = clonedFS.mkdir;
606
+ originalFS.promises.mkdir = clonedFS.promises.mkdir;
607
+ originalFS.unlinkSync = clonedFS.unlinkSync;
608
+ originalFS.promises.rm = clonedFS.promises.rm;
609
+ originalFS.promises.unlink = clonedFS.promises.unlink;
610
+ originalFS.existsSync = clonedFS.existsSync;
611
+ originalFS.realpathSync = clonedFS.realpathSync;
612
+ originalFS.writeFileSync = clonedFS.writeFileSync;
613
+ originalFS.promises.writeFile = clonedFS.promises.writeFile;
614
+ originalFS.readFileSync = clonedFS.readFileSync;
615
+ originalFS.promises.readFile = clonedFS.promises.readFile;
616
+ originalFS.readdirSync = clonedFS.readdirSync;
617
+ originalFS.promises.readdir = clonedFS.promises.readdir;
618
+ Object.defineProperty(originalFS, "statSync", {
619
+ value: clonedFS.statSync
620
+ });
621
+ originalFS.stat = clonedFS.stat;
622
+ originalFS.promises.stat = clonedFS.promises.stat;
623
+ Object.defineProperty(originalFS, "lstatSync", {
624
+ value: clonedFS.lstatSync
625
+ });
626
+ originalFS.lstat = clonedFS.lstat;
627
+ originalFS.promises.lstat = clonedFS.promises.lstat;
628
+ };
629
+ }
630
+ chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
501
631
  var VirtualFileSystem = class {
502
632
  static {
503
633
  chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
@@ -505,7 +635,11 @@ var VirtualFileSystem = class {
505
635
  /**
506
636
  * The internal map of virtual files.
507
637
  */
508
- #builtinIdMap = /* @__PURE__ */ new Map();
638
+ #meta = {};
639
+ /**
640
+ * A map of unique identifiers to their virtual file paths.
641
+ */
642
+ #ids = {};
509
643
  /**
510
644
  * A map of virtual file paths to their underlying file content.
511
645
  */
@@ -546,39 +680,88 @@ var VirtualFileSystem = class {
546
680
  */
547
681
  #log;
548
682
  /**
683
+ * Checks if a path exists in the virtual file system (VFS).
684
+ *
685
+ * @param path - The path to check.
686
+ * @returns `true` if the path exists, otherwise `false`.
687
+ */
688
+ #existsSync(path) {
689
+ const formattedPath = this.formatPath(path);
690
+ return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
691
+ }
692
+ /**
549
693
  * Exposes the internal VFS map for advanced usage.
550
694
  */
551
- get [chunkYE56I7CZ_cjs.__VFS_CACHE__]() {
695
+ get [chunk5XYGZ3DC_cjs.__VFS_CACHE__]() {
552
696
  return this.#cachedFS;
553
697
  }
554
698
  /**
555
699
  * Exposes the internal VFS resolver cache for advanced usage.
556
700
  */
557
- get [chunkYE56I7CZ_cjs.__VFS_RESOLVER__]() {
701
+ get [chunk5XYGZ3DC_cjs.__VFS_RESOLVER__]() {
558
702
  return this.#cachedResolver;
559
703
  }
560
704
  /**
561
705
  * Exposes the internal VFS map for advanced usage.
562
706
  */
563
- get [chunkYE56I7CZ_cjs.__VFS_VIRTUAL__]() {
707
+ get [chunk5XYGZ3DC_cjs.__VFS_VIRTUAL__]() {
564
708
  return this.#virtualFS;
565
709
  }
566
710
  /**
567
711
  * Exposes the internal UFS map for advanced usage.
568
712
  */
569
- get [chunkYE56I7CZ_cjs.__VFS_UNIFIED__]() {
713
+ get [chunk5XYGZ3DC_cjs.__VFS_UNIFIED__]() {
570
714
  return this.#unifiedFS;
571
715
  }
572
716
  /**
717
+ * A proxy to access the underlying file metadata.
718
+ */
719
+ get meta() {
720
+ return new Proxy(this.#meta, {
721
+ get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
722
+ if (target[prop]) {
723
+ return {
724
+ id: prop,
725
+ mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
726
+ details: {},
727
+ variant: "normal",
728
+ ...target[prop]
729
+ };
730
+ }
731
+ return void 0;
732
+ }, "get"),
733
+ set: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop, value) => {
734
+ target[prop] = value;
735
+ this.#ids[value.id || prop] = prop;
736
+ return true;
737
+ }, "set"),
738
+ deleteProperty: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
739
+ delete this.#ids[target[prop]?.id || prop];
740
+ delete target[prop];
741
+ return true;
742
+ }, "deleteProperty")
743
+ });
744
+ }
745
+ /**
746
+ * A map of module ids to their file paths.
747
+ */
748
+ get ids() {
749
+ return this.#ids;
750
+ }
751
+ /**
573
752
  * Creates a new instance of the VirtualFileSystem.
574
753
  *
575
754
  * @param context - The context of the virtual file system, typically containing options and logging functions.
576
755
  * @param serialized - A map of files/file contents to populate in cache
577
756
  */
578
- constructor(context, serialized) {
757
+ constructor(context, serialized = {}) {
579
758
  this.#context = context;
580
759
  this.#cachedFS = /* @__PURE__ */ new Map();
581
- this.#builtinIdMap = new Map(Object.entries(serialized?.builtinIdMap ?? {}));
760
+ this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
761
+ this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
762
+ data.id || path,
763
+ path
764
+ ]));
582
765
  if (!this.#fs.existsSync(this.#context.dataPath)) {
583
766
  this.#fs.mkdirSync(this.#context.dataPath, {
584
767
  recursive: true
@@ -644,13 +827,13 @@ var VirtualFileSystem = class {
644
827
  }
645
828
  this.#log = extendLog(this.#context.log, "virtual-file-system");
646
829
  }
647
- [chunkYE56I7CZ_cjs.__VFS_INIT__]() {
830
+ [chunk5XYGZ3DC_cjs.__VFS_INIT__]() {
648
831
  if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
649
832
  this.#revert = patchFS(fs__default.default, this);
650
833
  this.#isPatched = true;
651
834
  }
652
835
  }
653
- [chunkYE56I7CZ_cjs.__VFS_REVERT__]() {
836
+ [chunk5XYGZ3DC_cjs.__VFS_REVERT__]() {
654
837
  if (this.#isPatched && this.#context.config.output.mode !== "fs") {
655
838
  if (!this.#revert) {
656
839
  throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
@@ -660,65 +843,44 @@ var VirtualFileSystem = class {
660
843
  }
661
844
  }
662
845
  /**
663
- * Returns a Map of all runtime file IDs and their corresponding paths in the virtual file system.
664
- *
665
- * @returns A Map where the keys are runtime file IDs (strings) and the values are their corresponding paths (strings).
666
- */
667
- get builtinIdMap() {
668
- return this.#builtinIdMap;
669
- }
670
- /**
671
- * Lists all runtime IDs in the virtual file system.
672
- *
673
- * @returns An array of formatted runtime IDs.
674
- */
675
- get runtimeIds() {
676
- return Array.from(this.builtinIdMap.keys()).map((id) => this.formatRuntimeId(id));
677
- }
678
- /**
679
- * Checks if a given path or ID corresponds to a runtime file.
846
+ * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
680
847
  *
681
- * @param pathOrId - The path or ID to check.
682
- * @param options - Options for resolving the path, such as paths to check.
683
- * @returns `true` if the path or ID corresponds to a runtime file, otherwise `false`.
848
+ * @param pathOrId - The path or id to check.
849
+ * @param options - Optional parameters for resolving the path.
850
+ * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
684
851
  */
685
- isBuiltinFile(pathOrId, options) {
686
- return !!this.builtinIdMap.values().find((path) => path === this.resolvePath(pathOrId, {
852
+ isVirtual(pathOrId, options = {}) {
853
+ if (!pathOrId) {
854
+ return false;
855
+ }
856
+ const resolvedPath = this.resolve(pathOrId, {
687
857
  ...options,
688
858
  type: "file"
689
- }));
690
- }
691
- /**
692
- * Checks if a provided string is a valid runtime ID (does not need to already be created in the file system).
693
- *
694
- * @param id - The ID to check.
695
- * @returns Whether the ID is a valid runtime ID.
696
- */
697
- isValidBuiltinId(id) {
698
- return id.startsWith(`${this.#context.config.output.builtinPrefix}:`);
859
+ });
860
+ if (!resolvedPath) {
861
+ return false;
862
+ }
863
+ return this.meta[resolvedPath]?.mode === "virtual";
699
864
  }
700
865
  /**
701
- * Check if a path or ID corresponds to a virtual file.
866
+ * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
702
867
  *
703
- * @param pathOrId - The path or ID to check.
704
- * @param options - Options for resolving the path, such as paths to check.
705
- * @returns Whether the path or ID corresponds to a virtual file.
868
+ * @param pathOrId - The path or id to check.
869
+ * @param options - Optional parameters for resolving the path.
870
+ * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
706
871
  */
707
- isVirtualFile(pathOrId, options = {}) {
872
+ isFs(pathOrId, options = {}) {
708
873
  if (!pathOrId) {
709
874
  return false;
710
875
  }
711
- const resolvedPath = this.resolvePath(pathOrId, {
876
+ const resolvedPath = this.resolve(pathOrId, {
712
877
  ...options,
713
878
  type: "file"
714
879
  });
715
880
  if (!resolvedPath) {
716
881
  return false;
717
882
  }
718
- if (this.builtinIdMap.values().find((path) => path === resolvedPath)) {
719
- return true;
720
- }
721
- return this.#virtualFS.existsSync(resolvedPath);
883
+ return this.meta[resolvedPath]?.mode === "fs";
722
884
  }
723
885
  /**
724
886
  * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
@@ -732,37 +894,6 @@ var VirtualFileSystem = class {
732
894
  return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
733
895
  }
734
896
  /**
735
- * Checks if a given ID corresponds to a runtime file path.
736
- *
737
- * @param id - The unique identifier for the runtime file.
738
- * @param pathOrId - The path or ID to check.
739
- * @returns `true` if the ID corresponds to the path or ID of a runtime file, otherwise `false`.
740
- */
741
- isMatchingBuiltinId(id, pathOrId) {
742
- const resolvedPath = this.resolvePath(pathOrId);
743
- const resolvedId = this.resolveId(pathOrId);
744
- 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)))));
745
- }
746
- /**
747
- * Lists all runtime files in the virtual file system.
748
- *
749
- * @returns A promise that resolves to an array of runtime files.
750
- */
751
- async listBuiltinFiles() {
752
- const runtimeFiles = [];
753
- for (const [id, path] of this.builtinIdMap.entries()) {
754
- const contents = await this.readFile(path);
755
- if (contents) {
756
- runtimeFiles.push({
757
- id: this.formatRuntimeId(id),
758
- path,
759
- contents
760
- });
761
- }
762
- }
763
- return runtimeFiles;
764
- }
765
- /**
766
897
  * Lists files in a given path.
767
898
  *
768
899
  * @param path - The path to list files from.
@@ -779,7 +910,7 @@ var VirtualFileSystem = class {
779
910
  */
780
911
  unlinkSync(path, options) {
781
912
  const formattedPath = toFilePath(path);
782
- if (!this.fileExistsSync(path)) {
913
+ if (!this.isFile(formattedPath)) {
783
914
  return;
784
915
  }
785
916
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
@@ -794,7 +925,7 @@ var VirtualFileSystem = class {
794
925
  */
795
926
  async unlink(path, options) {
796
927
  const formattedPath = toFilePath(path);
797
- if (!this.fileExistsSync(path)) {
928
+ if (!this.isFile(formattedPath)) {
798
929
  return;
799
930
  }
800
931
  this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
@@ -814,7 +945,7 @@ var VirtualFileSystem = class {
814
945
  */
815
946
  rmdirSync(path, options = {}) {
816
947
  const formattedPath = toFilePath(path);
817
- if (!this.directoryExistsSync(path)) {
948
+ if (!this.isDirectory(formattedPath)) {
818
949
  return;
819
950
  }
820
951
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
@@ -833,7 +964,7 @@ var VirtualFileSystem = class {
833
964
  */
834
965
  async rmdir(path, options = {}) {
835
966
  const formattedPath = toFilePath(path);
836
- if (!this.directoryExistsSync(path)) {
967
+ if (!this.isDirectory(formattedPath)) {
837
968
  return;
838
969
  }
839
970
  this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
@@ -860,7 +991,7 @@ var VirtualFileSystem = class {
860
991
  */
861
992
  async rm(path, options = {}) {
862
993
  this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
863
- if (this.directoryExistsSync(path)) {
994
+ if (this.isDirectory(path)) {
864
995
  return this.rmdir(path, options);
865
996
  }
866
997
  return this.unlink(path, options);
@@ -904,12 +1035,12 @@ var VirtualFileSystem = class {
904
1035
  /**
905
1036
  * Lists files in a given path.
906
1037
  *
907
- * @param path - The path to list files from.
1038
+ * @param pathOrId - The path to list files from.
908
1039
  * @param options - Options for listing files, such as encoding and recursion.
909
1040
  * @returns An array of file names in the specified path.
910
1041
  */
911
- async readdir(path, options = "utf8") {
912
- return this.resolveFS(path).promises.readdir(toFilePath(path), options);
1042
+ async readdir(pathOrId, options = "utf8") {
1043
+ return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
913
1044
  }
914
1045
  /**
915
1046
  * Asynchronously reads a file from the virtual file system (VFS).
@@ -921,7 +1052,7 @@ var VirtualFileSystem = class {
921
1052
  if (!pathOrId) {
922
1053
  return void 0;
923
1054
  }
924
- const filePath = this.resolvePath(toFilePath(pathOrId), {
1055
+ const filePath = this.resolve(toFilePath(pathOrId), {
925
1056
  type: "file"
926
1057
  });
927
1058
  if (filePath) {
@@ -950,7 +1081,7 @@ var VirtualFileSystem = class {
950
1081
  if (!pathOrId) {
951
1082
  return void 0;
952
1083
  }
953
- const filePath = this.resolvePath(toFilePath(pathOrId), {
1084
+ const filePath = this.resolve(toFilePath(pathOrId), {
954
1085
  type: "file"
955
1086
  });
956
1087
  if (filePath) {
@@ -967,137 +1098,80 @@ var VirtualFileSystem = class {
967
1098
  /**
968
1099
  * Writes a file to the virtual file system (VFS).
969
1100
  *
970
- * @param file - The path to the file.
1101
+ * @param path - The path to the file.
971
1102
  * @param data - The contents of the file.
972
1103
  * @param options - Optional parameters for writing the file.
973
1104
  * @returns A promise that resolves when the file is written.
974
1105
  */
975
- async writeFile(file, data = "", options = "utf8") {
976
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(file));
977
- if (!this.directoryExistsSync(filePathFns.findFilePath(absolutePath))) {
978
- await this.mkdir(filePathFns.findFilePath(absolutePath), options);
1106
+ async writeFile(path, data = "", options = "utf8") {
1107
+ const formattedPath = this.formatPath(path);
1108
+ if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
1109
+ await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1110
+ }
1111
+ let code = isPowerLinesWriteFileData(data) ? data.code : data;
1112
+ if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
1113
+ const resolvedConfig = await prettier.resolveConfig(formattedPath);
1114
+ if (resolvedConfig) {
1115
+ code = await prettier.format(code, {
1116
+ absolutePath: formattedPath,
1117
+ ...resolvedConfig
1118
+ });
1119
+ }
979
1120
  }
980
- 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)})`);
981
- this.#cachedFS.set(absolutePath, data.toString());
982
- this.clearResolverCache(absolutePath);
983
- const ifs = this.resolveFS(absolutePath, options);
1121
+ const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1122
+ 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)})`);
1123
+ this.meta[formattedPath] = {
1124
+ path: formattedPath,
1125
+ code,
1126
+ mode: outputMode,
1127
+ variant: "normal",
1128
+ ...isPowerLinesWriteFileData(data) ? data : {}
1129
+ };
1130
+ this.clearResolverCache(formattedPath);
1131
+ const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
984
1132
  if (isFunction.isFunction(ifs.promises.writeFile)) {
985
- return ifs.promises.writeFile(absolutePath, data, omit.omit(options, [
986
- "mode"
987
- ]));
1133
+ return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
988
1134
  }
989
- return ifs.writeFileSync(absolutePath, data, omit.omit(options, [
990
- "mode"
991
- ]));
1135
+ return ifs.writeFileSync(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
992
1136
  }
993
1137
  /**
994
1138
  * Synchronously writes a file to the virtual file system (VFS).
995
1139
  *
996
- * @param file - The file to write.
1140
+ * @param path - The file to write.
997
1141
  * @param data - The contents of the file.
998
1142
  * @param options - Optional parameters for writing the file.
999
1143
  */
1000
- writeFileSync(file, data = "", options = "utf8") {
1001
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(file));
1002
- if (!this.directoryExistsSync(filePathFns.findFilePath(absolutePath))) {
1003
- this.mkdirSync(filePathFns.findFilePath(absolutePath));
1004
- }
1005
- 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)})`);
1006
- this.#cachedFS.set(absolutePath, data.toString());
1007
- this.clearResolverCache(absolutePath);
1008
- const writeStream = this.resolveFS(absolutePath, omit.omit(options, [
1009
- "mode"
1010
- ])).createWriteStream(absolutePath);
1144
+ writeFileSync(path, data = "", options = "utf8") {
1145
+ const formattedPath = this.formatPath(path);
1146
+ if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
1147
+ this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1148
+ }
1149
+ const code = isPowerLinesWriteFileData(data) ? data.code : data;
1150
+ const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1151
+ 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)})`);
1152
+ this.meta[formattedPath] = {
1153
+ path: formattedPath,
1154
+ code,
1155
+ mode: outputMode,
1156
+ variant: "normal",
1157
+ ...isPowerLinesWriteFileData(data) ? data : {}
1158
+ };
1159
+ this.clearResolverCache(formattedPath);
1160
+ const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1011
1161
  try {
1012
- writeStream.write(data);
1162
+ writeStream.write(code);
1013
1163
  } finally {
1014
1164
  writeStream.close();
1015
1165
  }
1016
1166
  }
1017
1167
  /**
1018
- * Writes a runtime file to the virtual file system (VFS).
1019
- *
1020
- * @param id - The unique identifier for the runtime file.
1021
- * @param path - The path to the runtime file.
1022
- * @param contents - The contents of the runtime file.
1023
- * @param options - Optional parameters for writing the runtime file.
1024
- * @returns A promise that resolves when the file is written.
1025
- */
1026
- async writeBuiltinFile(id, path, contents, options = {}) {
1027
- const formattedId = this.formatRuntimeId(id);
1028
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
1029
- this.builtinIdMap.set(formattedId, absolutePath);
1030
- let data = contents;
1031
- if (!options.skipFormat) {
1032
- data = await prettier.format(contents, {
1033
- absolutePath,
1034
- ...await prettier.resolveConfig(absolutePath)
1035
- });
1036
- }
1037
- const _options = defu5__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
1038
- encoding: isSetString.isSetString(options) ? options : "utf8",
1039
- mode: "virtual"
1040
- });
1041
- 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"}`);
1042
- return this.writeFile(absolutePath, data, _options);
1043
- }
1044
- /**
1045
- * Adds an entry file to the virtual file system.
1046
- *
1047
- * @param name - The file name or absolute path of the entry module.
1048
- * @param contents - The contents of the entry file.
1049
- * @param options - Optional parameters for writing the entry file.
1050
- */
1051
- async writeEntryFile(name, contents, options = {}) {
1052
- const absolutePath = this.formatAbsoluteFilePath(isType.isAbsolutePath(toFilePath(name)) ? toFilePath(name) : toFilePath(joinPaths.joinPaths(this.#context.entryPath, name)));
1053
- let data = contents;
1054
- if (!options.skipFormat) {
1055
- data = await prettier.format(contents, {
1056
- absolutePath,
1057
- ...await prettier.resolveConfig(absolutePath)
1058
- });
1059
- }
1060
- const _options = defu5__default.default(isSetString.isSetString(options) ? {} : options ?? {}, {
1061
- encoding: isSetString.isSetString(options) ? options : "utf8",
1062
- mode: "virtual"
1063
- });
1064
- 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"}`);
1065
- return this.writeFile(absolutePath, data, _options);
1066
- }
1067
- /**
1068
- * Writes a file to disk from the physical file system (on disk).
1069
- *
1070
- * @param path - The path to the file to write.
1071
- * @param contents - The contents of the file to write.
1072
- * @param options - Optional parameters for writing the file.
1073
- * @returns A promise that resolves when the file is written.
1074
- */
1075
- async writeFileToDisk(path, contents, options = {}) {
1076
- const absolutePath = this.formatAbsoluteFilePath(toFilePath(path));
1077
- let data = contents;
1078
- if (!options.skipFormat) {
1079
- const resolvedConfig = await prettier.resolveConfig(absolutePath);
1080
- if (resolvedConfig) {
1081
- data = await prettier.format(contents, {
1082
- absolutePath,
1083
- ...resolvedConfig
1084
- });
1085
- }
1086
- }
1087
- return this.writeFile(absolutePath, data, defu5__default.default({
1088
- mode: "fs"
1089
- }, isSetString.isSetString(options) ? {} : options ?? {}, {
1090
- encoding: isSetString.isSetString(options) ? options : "utf8"
1091
- }));
1092
- }
1093
- /**
1094
1168
  * Synchronously checks if a file exists in the virtual file system (VFS).
1095
1169
  *
1096
1170
  * @param pathOrId - The path or ID of the file to check.
1097
1171
  * @returns `true` if the file exists, otherwise `false`.
1098
1172
  */
1099
1173
  existsSync(pathOrId) {
1100
- return this.pathExistsSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId));
1174
+ return this.resolve(pathOrId) !== false;
1101
1175
  }
1102
1176
  /**
1103
1177
  * Checks if a file exists in the virtual file system (VFS).
@@ -1105,32 +1179,22 @@ var VirtualFileSystem = class {
1105
1179
  * @remarks
1106
1180
  * 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.
1107
1181
  *
1108
- * @param path - The path of the file to check.
1182
+ * @param pathOrId - The path of the file to check.
1109
1183
  * @returns `true` if the file exists, otherwise `false`.
1110
1184
  */
1111
- fileExistsSync(path) {
1112
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
1113
- 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();
1185
+ isFile(pathOrId) {
1186
+ const resolved = this.resolve(pathOrId);
1187
+ 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()));
1114
1188
  }
1115
1189
  /**
1116
1190
  * Checks if a directory exists in the virtual file system (VFS).
1117
1191
  *
1118
- * @param path - The path of the directory to check.
1192
+ * @param pathOrId - The path of the directory to check.
1119
1193
  * @returns `true` if the directory exists, otherwise `false`.
1120
1194
  */
1121
- directoryExistsSync(path) {
1122
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
1123
- 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();
1124
- }
1125
- /**
1126
- * Checks if a path exists in the virtual file system (VFS).
1127
- *
1128
- * @param path - The path to check.
1129
- * @returns `true` if the path exists, otherwise `false`.
1130
- */
1131
- pathExistsSync(path) {
1132
- const formattedPath = this.formatAbsoluteFilePath(toFilePath(path));
1133
- return this.isValidBuiltinId(formattedPath) || this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
1195
+ isDirectory(pathOrId) {
1196
+ const resolved = this.resolve(pathOrId);
1197
+ 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()));
1134
1198
  }
1135
1199
  /**
1136
1200
  * Retrieves the status of a file in the virtual file system (VFS).
@@ -1139,7 +1203,7 @@ var VirtualFileSystem = class {
1139
1203
  * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1140
1204
  */
1141
1205
  async stat(pathOrId, options) {
1142
- return this.resolveFS(pathOrId).promises.stat(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1206
+ return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1143
1207
  }
1144
1208
  /**
1145
1209
  * Synchronously retrieves the status of a file in the virtual file system (VFS).
@@ -1148,7 +1212,7 @@ var VirtualFileSystem = class {
1148
1212
  * @returns The file's status information, or false if the file does not exist.
1149
1213
  */
1150
1214
  statSync(pathOrId) {
1151
- return this.resolveFS(pathOrId).statSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId));
1215
+ return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1152
1216
  }
1153
1217
  /**
1154
1218
  * Retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -1157,7 +1221,7 @@ var VirtualFileSystem = class {
1157
1221
  * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1158
1222
  */
1159
1223
  async lstat(pathOrId, options) {
1160
- return this.resolveFS(pathOrId).promises.lstat(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1224
+ return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1161
1225
  }
1162
1226
  /**
1163
1227
  * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
@@ -1166,23 +1230,7 @@ var VirtualFileSystem = class {
1166
1230
  * @returns The symbolic link's status information, or false if the link does not exist.
1167
1231
  */
1168
1232
  lstatSync(pathOrId, options) {
1169
- return this.resolveFS(pathOrId).lstatSync(this.resolvePath(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1170
- }
1171
- /**
1172
- * Resolves a path or ID to a runtime file id in the virtual file system.
1173
- *
1174
- * @param pathOrId - The path or id of the file to resolve.
1175
- * @returns The resolved id of the runtime file if it exists, otherwise false.
1176
- */
1177
- resolveId(pathOrId) {
1178
- if (this.builtinIdMap.has(this.formatRuntimeId(toFilePath(pathOrId)))) {
1179
- return this.formatRuntimeId(toFilePath(pathOrId));
1180
- }
1181
- const filePath = this.resolvePath(toFilePath(pathOrId));
1182
- if (filePath) {
1183
- return this.builtinIdMap.keys().find((id) => this.builtinIdMap.get(id) === filePath) || false;
1184
- }
1185
- return false;
1233
+ return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1186
1234
  }
1187
1235
  /**
1188
1236
  * Resolves a path based on TypeScript's `tsconfig.json` paths.
@@ -1195,9 +1243,9 @@ var VirtualFileSystem = class {
1195
1243
  resolveTsconfigPath(path) {
1196
1244
  if (this.#context.tsconfig.options.paths) {
1197
1245
  for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
1198
- 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));
1246
+ 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));
1199
1247
  if (resolvedPath) {
1200
- return this.formatAbsoluteFilePath(resolvedPath) === this.formatAbsoluteFilePath(path) ? this.formatAbsoluteFilePath(resolvedPath) : this.resolvePathName(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
1248
+ return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
1201
1249
  }
1202
1250
  }
1203
1251
  }
@@ -1227,7 +1275,7 @@ var VirtualFileSystem = class {
1227
1275
  * @returns The resolved real path if it exists, otherwise undefined.
1228
1276
  */
1229
1277
  realpathSync(pathOrId) {
1230
- const filePath = this.resolvePath(toFilePath(pathOrId));
1278
+ const filePath = this.resolve(toFilePath(pathOrId));
1231
1279
  if (!filePath) {
1232
1280
  throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1233
1281
  }
@@ -1240,24 +1288,18 @@ var VirtualFileSystem = class {
1240
1288
  * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1241
1289
  * @returns The resolved file path if it exists, otherwise undefined.
1242
1290
  */
1243
- resolvePath(pathOrId, options = {}) {
1244
- const formattedPath = toFilePath(pathOrId);
1245
- const resolverKey = `${formattedPath}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1291
+ resolve(pathOrId, options = {}) {
1292
+ const formattedPathOrId = toFilePath(pathOrId);
1293
+ const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1246
1294
  if (this.#cachedResolver.has(resolverKey)) {
1247
1295
  return this.#cachedResolver.get(resolverKey);
1248
- } else if (this.#cachedFS.has(formattedPath)) {
1249
- return formattedPath;
1250
1296
  }
1251
- let result = false;
1252
- if (this.isValidBuiltinId(formattedPath)) {
1253
- result = this.builtinIdMap.get(this.formatRuntimeId(formattedPath));
1254
- } else {
1255
- result = this.resolvePathName(formattedPath, options);
1297
+ let result = this.resolveId(formattedPathOrId);
1298
+ if (!result) {
1299
+ result = this.resolvePath(formattedPathOrId, options);
1256
1300
  }
1257
1301
  if (!result) {
1258
1302
  result = false;
1259
- } else {
1260
- result = toFilePath(result);
1261
1303
  }
1262
1304
  if (result && options.withExtension === false) {
1263
1305
  return result.replace(/\.[m|c]?[t|j]sx?$/, "");
@@ -1266,16 +1308,12 @@ var VirtualFileSystem = class {
1266
1308
  return result;
1267
1309
  }
1268
1310
  /**
1269
- * Formats a file path by removing the runtime prefix and leading null character.
1311
+ * Retrieves the partial metadata for all files in the virtual file system (VFS).
1270
1312
  *
1271
- * @param path - The file path to format.
1272
- * @returns The formatted file path.
1313
+ * @returns A record containing the partial metadata for all files.
1273
1314
  */
1274
- formatFilePath(path) {
1275
- if (!isSetString.isSetString(path)) {
1276
- throw new Error(`Invalid path provided. Expected a string or a valid file path.`);
1277
- }
1278
- return path.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "");
1315
+ getPartialMeta() {
1316
+ return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
1279
1317
  }
1280
1318
  /**
1281
1319
  * Converts a relative path to an absolute path based on the workspace and project root.
@@ -1283,56 +1321,67 @@ var VirtualFileSystem = class {
1283
1321
  * @param path - The relative path to convert.
1284
1322
  * @returns The absolute path.
1285
1323
  */
1286
- formatAbsoluteFilePath = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((path) => {
1287
- const formattedPath = this.formatFilePath(path);
1324
+ formatPath(path) {
1325
+ const formattedPath = toFilePath(path);
1288
1326
  if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1289
1327
  return formattedPath;
1290
1328
  } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1291
1329
  return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1292
1330
  }
1293
1331
  return formattedPath;
1294
- }, "formatAbsoluteFilePath");
1332
+ }
1295
1333
  /**
1296
- * Formats a runtime ID by removing the file extension and prepending the runtime prefix.
1334
+ * Formats a file id by removing the file extension and prepending the runtime prefix.
1297
1335
  *
1298
- * @param id - The runtime ID to format.
1299
- * @returns The formatted runtime ID.
1336
+ * @param id - The file ID to format.
1337
+ * @returns The formatted file ID.
1300
1338
  */
1301
- formatRuntimeId(id) {
1302
- return `${this.#context.config.output.builtinPrefix}:${this.formatFilePath(id).replace(/\.[m|c]?[t|j]sx?$/, "")}`;
1339
+ formatId(id) {
1340
+ const formattedId = toFilePath(id);
1341
+ return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileExtensionSafe(formattedId), "")}`;
1303
1342
  }
1304
1343
  /**
1305
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1344
+ * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
1306
1345
  *
1307
- * @param pathOrId - The path or ID to resolve.
1308
- * @returns The resolved file path if it exists, otherwise undefined.
1346
+ * @param id - The id to resolve.
1347
+ * @returns The resolved file id if it exists, otherwise undefined.
1309
1348
  */
1310
- resolvePathName(pathOrId, options = {}) {
1311
- if (pathOrId.startsWith(`${this.#context.config.output.builtinPrefix}:`)) {
1312
- return false;
1349
+ resolveId(id) {
1350
+ if (this.#ids[this.formatId(id)]) {
1351
+ return this.#ids[this.formatId(id)] || false;
1313
1352
  }
1314
- if (isType.isAbsolutePath(pathOrId)) {
1315
- if (options.type === "file" ? this.fileExistsSync(pathOrId) : this.pathExistsSync(pathOrId)) {
1316
- return pathOrId;
1353
+ return false;
1354
+ }
1355
+ /**
1356
+ * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1357
+ *
1358
+ * @param path - The path to resolve.
1359
+ * @param options - Optional parameters for resolving the path.
1360
+ * @returns The resolved file path if it exists, otherwise undefined.
1361
+ */
1362
+ resolvePath(path, options = {}) {
1363
+ if (isType.isAbsolutePath(path)) {
1364
+ if (this.#existsSync(path)) {
1365
+ return path;
1317
1366
  }
1318
- const result = checkVariants(pathOrId, this);
1367
+ const result = this.checkVariants(path);
1319
1368
  if (result) {
1320
1369
  return result;
1321
1370
  }
1322
1371
  }
1323
- for (const path of this.resolveParentPaths(pathOrId, options.paths)) {
1324
- const request = joinPaths.joinPaths(path, pathOrId);
1325
- if (options.type === "file" ? this.fileExistsSync(pathOrId) : this.pathExistsSync(pathOrId)) {
1372
+ for (const parentPath of this.resolveParentPaths(path, options.paths)) {
1373
+ const request = joinPaths.joinPaths(parentPath, path);
1374
+ if (this.#existsSync(request)) {
1326
1375
  return request;
1327
1376
  }
1328
- const result = checkVariants(request, this);
1377
+ const result = this.checkVariants(request);
1329
1378
  if (result) {
1330
1379
  return result;
1331
1380
  }
1332
1381
  }
1333
1382
  return false;
1334
1383
  }
1335
- resolveParentPaths(request, current = []) {
1384
+ resolveParentPaths(request, parents = []) {
1336
1385
  let paths = [
1337
1386
  this.#context.workspaceConfig.workspaceRoot,
1338
1387
  joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
@@ -1350,7 +1399,7 @@ var VirtualFileSystem = class {
1350
1399
  ret.push(path);
1351
1400
  }
1352
1401
  return ret;
1353
- }, current.filter(Boolean).map((p) => this.formatAbsoluteFilePath(toFilePath(p))));
1402
+ }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1354
1403
  }
1355
1404
  /**
1356
1405
  * Select the file system module to use for the operation based on the path or URL.
@@ -1381,7 +1430,7 @@ var VirtualFileSystem = class {
1381
1430
  } 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))) {
1382
1431
  return "fs";
1383
1432
  }
1384
- return null;
1433
+ return void 0;
1385
1434
  }
1386
1435
  /**
1387
1436
  * Clears the resolver cache for a given path.
@@ -1391,208 +1440,93 @@ var VirtualFileSystem = class {
1391
1440
  clearResolverCache(path) {
1392
1441
  this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1393
1442
  }
1394
- };
1395
- var FILE_PREFIX = "file://";
1396
- function toFilePath(pathOrUrl) {
1397
- if (!pathOrUrl) {
1398
- throw new Error("No Path or URL provided to Virtual File System");
1399
- }
1400
- let result = pathOrUrl.toString();
1401
- if (result.startsWith(FILE_PREFIX)) {
1402
- result = result.slice(FILE_PREFIX.length);
1403
- }
1404
- return result;
1405
- }
1406
- chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
1407
- var FS_METHODS = [
1408
- "mkdir",
1409
- "mkdirSync",
1410
- "rmdir",
1411
- "rmdirSync",
1412
- "unlink",
1413
- "unlinkSync",
1414
- "existsSync",
1415
- "realpathSync",
1416
- "writeFileSync",
1417
- "readFileSync",
1418
- "readdirSync",
1419
- "createWriteStream",
1420
- "WriteStream",
1421
- "createReadStream",
1422
- "ReadStream"
1423
- ];
1424
- var FS_PROMISE_METHODS = [
1425
- "mkdir",
1426
- "rm",
1427
- "rmdir",
1428
- "unlink",
1429
- "writeFile",
1430
- "readFile",
1431
- "readdir",
1432
- "stat",
1433
- "lstat"
1434
- ];
1435
- function cloneFS(originalFS) {
1436
- const clonedFS = {
1437
- ...originalFS,
1438
- promises: {
1439
- ...originalFS.promises ?? {}
1443
+ /**
1444
+ * Check if the file exists with different variants (index, extensions).
1445
+ *
1446
+ * @param request - The request path to check.
1447
+ * @param parentPath - An optional parent path to prepend to the request.
1448
+ * @returns The file path if it exists, otherwise false.
1449
+ */
1450
+ checkVariants(request, parentPath) {
1451
+ const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1452
+ let file = this.checkExtensions(path);
1453
+ if (file) {
1454
+ return file;
1440
1455
  }
1441
- };
1442
- for (const method of FS_METHODS) {
1443
- if (originalFS[method]) {
1444
- clonedFS[method] = originalFS[method];
1456
+ file = this.checkIndex(path);
1457
+ if (file) {
1458
+ return file;
1445
1459
  }
1460
+ return false;
1446
1461
  }
1447
- originalFS.promises ??= {};
1448
- for (const method of FS_PROMISE_METHODS) {
1449
- if (originalFS.promises[method]) {
1450
- clonedFS.promises ??= {};
1451
- clonedFS.promises[method] = originalFS.promises[method];
1452
- clonedFS[method] = originalFS.promises[method];
1462
+ /**
1463
+ * Check if the index file exists in the given request path.
1464
+ *
1465
+ * @param request - The request path to check.
1466
+ * @returns The index file path if it exists, otherwise false.
1467
+ */
1468
+ checkIndex(request) {
1469
+ let file = joinPaths.joinPaths(request, "index");
1470
+ if (this.#existsSync(file)) {
1471
+ return file;
1453
1472
  }
1454
- }
1455
- for (const prop in clonedFS) {
1456
- if (isFunction.isFunction(clonedFS[prop])) {
1457
- clonedFS[prop] = clonedFS[prop].bind(originalFS);
1458
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1459
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1460
- }
1473
+ file = this.checkExtensions(file);
1474
+ if (file) {
1475
+ return file;
1461
1476
  }
1477
+ return false;
1462
1478
  }
1463
- for (const prop in clonedFS.promises) {
1464
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1465
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1479
+ /**
1480
+ * Check if the file exists with different extensions.
1481
+ *
1482
+ * @param request - The request path to check.
1483
+ * @param vfs - The file system module to use for checking file existence.
1484
+ * @returns The file path if it exists with any of the checked extensions, otherwise false.
1485
+ */
1486
+ checkExtensions(request) {
1487
+ let file = `${request}.ts`;
1488
+ if (this.#existsSync(file)) {
1489
+ return file;
1466
1490
  }
1491
+ file = `${request}.mts`;
1492
+ if (this.#existsSync(file)) {
1493
+ return file;
1494
+ }
1495
+ file = `${request}.cts`;
1496
+ if (this.#existsSync(file)) {
1497
+ return file;
1498
+ }
1499
+ file = `${request}.tsx`;
1500
+ if (this.#existsSync(file)) {
1501
+ return file;
1502
+ }
1503
+ file = `${request}.js`;
1504
+ if (this.#existsSync(file)) {
1505
+ return file;
1506
+ }
1507
+ file = `${request}.mjs`;
1508
+ if (this.#existsSync(file)) {
1509
+ return file;
1510
+ }
1511
+ file = `${request}.cjs`;
1512
+ if (this.#existsSync(file)) {
1513
+ return file;
1514
+ }
1515
+ file = `${request}.jsx`;
1516
+ if (this.#existsSync(file)) {
1517
+ return file;
1518
+ }
1519
+ file = `${request}.json`;
1520
+ if (this.#existsSync(file)) {
1521
+ return file;
1522
+ }
1523
+ file = `${request}.d.ts`;
1524
+ if (this.#existsSync(file)) {
1525
+ return file;
1526
+ }
1527
+ return false;
1467
1528
  }
1468
- return clonedFS;
1469
- }
1470
- chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
1471
- function patchFS(originalFS, vfs) {
1472
- const clonedFS = cloneFS(originalFS);
1473
- originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
1474
- originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
1475
- originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
1476
- originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
1477
- originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
1478
- originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
1479
- originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
1480
- Object.defineProperty(originalFS, "realpathSync", {
1481
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
1482
- });
1483
- originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
1484
- originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
1485
- originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
1486
- originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
1487
- originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
1488
- originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
1489
- Object.defineProperty(originalFS, "statSync", {
1490
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
1491
- });
1492
- originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
1493
- originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
1494
- Object.defineProperty(originalFS, "lstatSync", {
1495
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
1496
- });
1497
- originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
1498
- originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
1499
- return () => {
1500
- originalFS.mkdirSync = clonedFS.mkdirSync;
1501
- originalFS.mkdir = clonedFS.mkdir;
1502
- originalFS.promises.mkdir = clonedFS.promises.mkdir;
1503
- originalFS.unlinkSync = clonedFS.unlinkSync;
1504
- originalFS.promises.rm = clonedFS.promises.rm;
1505
- originalFS.promises.unlink = clonedFS.promises.unlink;
1506
- originalFS.existsSync = clonedFS.existsSync;
1507
- originalFS.realpathSync = clonedFS.realpathSync;
1508
- originalFS.writeFileSync = clonedFS.writeFileSync;
1509
- originalFS.promises.writeFile = clonedFS.promises.writeFile;
1510
- originalFS.readFileSync = clonedFS.readFileSync;
1511
- originalFS.promises.readFile = clonedFS.promises.readFile;
1512
- originalFS.readdirSync = clonedFS.readdirSync;
1513
- originalFS.promises.readdir = clonedFS.promises.readdir;
1514
- Object.defineProperty(originalFS, "statSync", {
1515
- value: clonedFS.statSync
1516
- });
1517
- originalFS.stat = clonedFS.stat;
1518
- originalFS.promises.stat = clonedFS.promises.stat;
1519
- Object.defineProperty(originalFS, "lstatSync", {
1520
- value: clonedFS.lstatSync
1521
- });
1522
- originalFS.lstat = clonedFS.lstat;
1523
- originalFS.promises.lstat = clonedFS.promises.lstat;
1524
- };
1525
- }
1526
- chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
1527
- function checkVariants(request, vfs, parentPath) {
1528
- const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1529
- let file = checkExtensions(path, vfs);
1530
- if (file) {
1531
- return file;
1532
- }
1533
- file = checkIndex(path, vfs);
1534
- if (file) {
1535
- return file;
1536
- }
1537
- return false;
1538
- }
1539
- chunkPK6SKIKE_cjs.__name(checkVariants, "checkVariants");
1540
- function checkIndex(request, vfs) {
1541
- let file = joinPaths.joinPaths(request, "index");
1542
- if (vfs.fileExistsSync(file)) {
1543
- return file;
1544
- }
1545
- file = checkExtensions(file, vfs);
1546
- if (file) {
1547
- return file;
1548
- }
1549
- return false;
1550
- }
1551
- chunkPK6SKIKE_cjs.__name(checkIndex, "checkIndex");
1552
- function checkExtensions(request, vfs) {
1553
- let file = `${request}.ts`;
1554
- if (vfs.fileExistsSync(file)) {
1555
- return file;
1556
- }
1557
- file = `${request}.mts`;
1558
- if (vfs.fileExistsSync(file)) {
1559
- return file;
1560
- }
1561
- file = `${request}.cts`;
1562
- if (vfs.fileExistsSync(file)) {
1563
- return file;
1564
- }
1565
- file = `${request}.tsx`;
1566
- if (vfs.fileExistsSync(file)) {
1567
- return file;
1568
- }
1569
- file = `${request}.js`;
1570
- if (vfs.fileExistsSync(file)) {
1571
- return file;
1572
- }
1573
- file = `${request}.mjs`;
1574
- if (vfs.fileExistsSync(file)) {
1575
- return file;
1576
- }
1577
- file = `${request}.cjs`;
1578
- if (vfs.fileExistsSync(file)) {
1579
- return file;
1580
- }
1581
- file = `${request}.jsx`;
1582
- if (vfs.fileExistsSync(file)) {
1583
- return file;
1584
- }
1585
- file = `${request}.json`;
1586
- if (vfs.fileExistsSync(file)) {
1587
- return file;
1588
- }
1589
- file = `${request}.d.ts`;
1590
- if (vfs.fileExistsSync(file)) {
1591
- return file;
1592
- }
1593
- return false;
1594
- }
1595
- chunkPK6SKIKE_cjs.__name(checkExtensions, "checkExtensions");
1529
+ };
1596
1530
  function createVfs(context) {
1597
1531
  const vfs = new VirtualFileSystem(context);
1598
1532
  return vfs;
@@ -1828,6 +1762,57 @@ var PowerlinesContext = class _PowerlinesContext {
1828
1762
  return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.projectRoot);
1829
1763
  }
1830
1764
  /**
1765
+ * The builtin module id that exist in the Powerlines virtual file system
1766
+ */
1767
+ get builtins() {
1768
+ return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
1769
+ }
1770
+ /**
1771
+ * Get the project root relative to the workspace root
1772
+ */
1773
+ async getBuiltins() {
1774
+ return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
1775
+ const code = await this.fs.readFile(path);
1776
+ return {
1777
+ ...meta,
1778
+ path,
1779
+ code
1780
+ };
1781
+ }));
1782
+ }
1783
+ /**
1784
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1785
+ *
1786
+ * @param code - The source code of the entry file
1787
+ * @param path - A path to write the entry file to
1788
+ * @param options - Optional write file options
1789
+ */
1790
+ async writeEntry(code, path, options = {}) {
1791
+ return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
1792
+ code,
1793
+ variant: "entry"
1794
+ }, defu5__default.default(options, {
1795
+ mode: this.config.output.mode
1796
+ }));
1797
+ }
1798
+ /**
1799
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1800
+ *
1801
+ * @param code - The source code of the builtin file
1802
+ * @param id - The unique identifier of the builtin file
1803
+ * @param path - An optional path to write the builtin file to
1804
+ * @param options - Optional write file options
1805
+ */
1806
+ async writeBuiltin(code, id, path, options = {}) {
1807
+ return this.fs.writeFile(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), {
1808
+ id,
1809
+ code,
1810
+ variant: "builtin"
1811
+ }, defu5__default.default(options, {
1812
+ mode: this.config.output.mode
1813
+ }));
1814
+ }
1815
+ /**
1831
1816
  * Parses the source code and returns a {@link ParseResult} object.
1832
1817
  *
1833
1818
  * @param code - The source code to parse.
@@ -2420,6 +2405,26 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
2420
2405
  }
2421
2406
  }
2422
2407
  };
2408
+ function getBaseFileHeader(context) {
2409
+ return `
2410
+ // Generated with ${titleCase.titleCase(context.config.framework)}
2411
+ // Note: Do not edit this file manually - it will be overwritten automatically
2412
+ `;
2413
+ }
2414
+ chunkPK6SKIKE_cjs.__name(getBaseFileHeader, "getBaseFileHeader");
2415
+ function getFileHeader(context, options = {}) {
2416
+ const { directive = null, prettierIgnore = false } = options;
2417
+ return `/* eslint-disable */
2418
+ // biome-ignore lint: disable
2419
+ ${prettierIgnore ? `// prettier-ignore` : ""}${directive ? `
2420
+
2421
+ ${directive}
2422
+ ` : "\n"}
2423
+ ${getBaseFileHeader(context)}
2424
+
2425
+ `;
2426
+ }
2427
+ chunkPK6SKIKE_cjs.__name(getFileHeader, "getFileHeader");
2423
2428
  function getString(code) {
2424
2429
  if (!code) {
2425
2430
  return "";
@@ -2454,7 +2459,7 @@ function resolveModulePath(nodePath, state) {
2454
2459
  return;
2455
2460
  }
2456
2461
  const sourcePath = nodePath.node.value;
2457
- const resolvedPath = state.context?.fs.resolvePath(sourcePath);
2462
+ const resolvedPath = state.context?.fs.resolve(sourcePath);
2458
2463
  if (resolvedPath) {
2459
2464
  nodePath.replaceWith(t__namespace.stringLiteral(
2460
2465
  // Remove the file extension if it exists
@@ -2555,8 +2560,9 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((contex
2555
2560
  async function generateTypes(context) {
2556
2561
  context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
2557
2562
  context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
2558
- const builtinFiles = await Promise.all((await context.fs.listBuiltinFiles()).filter((file) => !context.fs.isMatchingBuiltinId("index", file.id)).map(async (file) => {
2559
- const result = await core.transformAsync(file.contents, {
2563
+ const builtinFiles = await context.getBuiltins();
2564
+ const builtinFilePaths = await Promise.all(builtinFiles.map(async (file) => {
2565
+ const result = await core.transformAsync(file.code.toString(), {
2560
2566
  highlightCode: true,
2561
2567
  code: true,
2562
2568
  ast: false,
@@ -2584,14 +2590,14 @@ async function generateTypes(context) {
2584
2590
  throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
2585
2591
  }
2586
2592
  context.log(types.LogLevelLabel.TRACE, `Writing transformed built-in runtime file ${file.id}.`);
2587
- await context.fs.writeBuiltinFile(file.id, file.path, result.code);
2593
+ await context.writeBuiltin(result.code, file.id, file.path);
2588
2594
  return file.path;
2589
2595
  }));
2590
2596
  const typescriptPath = await resolve.resolvePackage("typescript");
2591
2597
  if (!typescriptPath) {
2592
2598
  throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
2593
2599
  }
2594
- const files = builtinFiles.reduce((ret, fileName) => {
2600
+ const files = builtinFilePaths.reduce((ret, fileName) => {
2595
2601
  const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
2596
2602
  if (!ret.includes(formatted)) {
2597
2603
  ret.push(formatted);
@@ -2626,9 +2632,9 @@ async function generateTypes(context) {
2626
2632
  const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
2627
2633
  const sourceFile2 = sourceFiles?.[0];
2628
2634
  if (sourceFile2?.fileName && !fileName.endsWith(".map")) {
2629
- if (context.fs.isBuiltinFile(sourceFile2.fileName)) {
2635
+ if (builtinFiles.some((file) => file.id === sourceFile2.fileName || file.path === sourceFile2.fileName)) {
2630
2636
  builtinModules += `
2631
- declare module "${context.fs.resolveId(sourceFile2.fileName)}" {
2637
+ declare module "${context.fs.resolve(sourceFile2.fileName)}" {
2632
2638
  ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
2633
2639
  }
2634
2640
  `;
@@ -2667,7 +2673,9 @@ ${builtinModules}`.replace(
2667
2673
  /import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
2668
2674
  ""
2669
2675
  ).replaceAll("#private;", "").replace(/__Ω/g, ""));
2670
- await context.fs.writeFileToDisk(sourceFile.id, getString(sourceFile.code));
2676
+ await context.fs.writeFile(sourceFile.id, getString(sourceFile.code), {
2677
+ mode: "fs"
2678
+ });
2671
2679
  }
2672
2680
  chunkPK6SKIKE_cjs.__name(generateTypes, "generateTypes");
2673
2681
  async function installPackage(context, packageName, dev = false) {
@@ -2831,7 +2839,9 @@ async function initializeTsconfig(context) {
2831
2839
  const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2832
2840
  context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
2833
2841
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
2834
- await context.fs.writeFileToDisk(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
2842
+ await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
2843
+ mode: "fs"
2844
+ });
2835
2845
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
2836
2846
  }
2837
2847
  chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
@@ -2955,7 +2965,7 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
2955
2965
  context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
2956
2966
 
2957
2967
  ${console.formatLogMessage(context.config)}`);
2958
- context.fs[chunkYE56I7CZ_cjs.__VFS_INIT__]();
2968
+ context.fs[chunk5XYGZ3DC_cjs.__VFS_INIT__]();
2959
2969
  await writeMetaFile(context);
2960
2970
  context.persistedMeta = context.meta;
2961
2971
  if (!exists.existsSync(context.cachePath)) {
@@ -2967,11 +2977,6 @@ ${console.formatLogMessage(context.config)}`);
2967
2977
  await this.callPreHook(context, "prepare");
2968
2978
  if (context.config.projectType === "application") {
2969
2979
  context.log(types.LogLevelLabel.TRACE, "Generating built-in barrel file");
2970
- await context.fs.writeBuiltinFile("index", joinPaths.joinPaths(context.builtinsPath, "index.ts"), `
2971
- ${getFileHeader(context)}
2972
-
2973
- ${(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")}
2974
- `);
2975
2980
  }
2976
2981
  if (context.config.output.dts !== false) {
2977
2982
  await generateTypes(context);
@@ -2983,7 +2988,7 @@ ${console.formatLogMessage(context.config)}`);
2983
2988
  }
2984
2989
  await this.callPostHook(context, "prepare");
2985
2990
  await writeMetaFile(context);
2986
- context.fs[chunkYE56I7CZ_cjs.__VFS_REVERT__]();
2991
+ context.fs[chunk5XYGZ3DC_cjs.__VFS_REVERT__]();
2987
2992
  });
2988
2993
  this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
2989
2994
  }
@@ -3142,7 +3147,7 @@ ${console.formatLogMessage(context.config)}`);
3142
3147
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
3143
3148
  await this.#executeEnvironments(async (context) => {
3144
3149
  await this.callHook(context, "finalize");
3145
- context.fs[chunkYE56I7CZ_cjs.__VFS_REVERT__]();
3150
+ context.fs[chunk5XYGZ3DC_cjs.__VFS_REVERT__]();
3146
3151
  });
3147
3152
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
3148
3153
  }
@@ -3404,5 +3409,5 @@ Note: Please ensure the plugin package's default export is a class that extends
3404
3409
  exports.PowerlinesAPI = PowerlinesAPI;
3405
3410
  exports.createLog = createLog;
3406
3411
  exports.getString = getString;
3407
- //# sourceMappingURL=chunk-5ST7UKJF.cjs.map
3408
- //# sourceMappingURL=chunk-5ST7UKJF.cjs.map
3412
+ //# sourceMappingURL=chunk-UTVZVGM3.cjs.map
3413
+ //# sourceMappingURL=chunk-UTVZVGM3.cjs.map