powerlines 0.24.8 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/dist/{api-C32Buv5_.d.ts → api-BTK8aYwE.d.cts} +1 -1
  2. package/dist/{api-wzd5AREv.d.cts → api-eyrYBmQh.d.ts} +1 -1
  3. package/dist/api.cjs +8 -6
  4. package/dist/api.d.cts +20 -22
  5. package/dist/api.d.ts +20 -22
  6. package/dist/api.js +7 -5
  7. package/dist/astro.cjs +12 -10
  8. package/dist/astro.d.cts +19 -21
  9. package/dist/astro.d.ts +19 -21
  10. package/dist/astro.js +10 -8
  11. package/dist/{chunk-JKBJF3UI.js → chunk-2MYPFASJ.js} +2 -0
  12. package/dist/chunk-2VIXD2XB.js +3 -0
  13. package/dist/{chunk-OB7MYWHE.js → chunk-44PO64SX.js} +4 -2
  14. package/dist/chunk-4JCNAKOE.cjs +4 -0
  15. package/dist/{chunk-QH4TS5V4.cjs → chunk-6MFZ436T.cjs} +978 -1032
  16. package/dist/chunk-6ZGIV2SU.cjs +4 -0
  17. package/dist/chunk-7BZQBW77.cjs +4 -0
  18. package/dist/{chunk-JQCWV4DT.js → chunk-7LKYXMB3.js} +2 -0
  19. package/dist/{chunk-SHUYVCID.js → chunk-7QVYU63E.js} +2 -0
  20. package/dist/chunk-AFJCY3R6.js +3 -0
  21. package/dist/chunk-AXIRZAL7.js +3 -0
  22. package/dist/chunk-BTNHSS2P.cjs +13 -0
  23. package/dist/{chunk-FQXHIKCM.cjs → chunk-C2U4ATHO.cjs} +9 -7
  24. package/dist/chunk-DFLNRC3B.cjs +4 -0
  25. package/dist/chunk-DS7OM4NX.cjs +4 -0
  26. package/dist/{chunk-W5X3ZEZ5.js → chunk-EBXVKPUX.js} +2 -0
  27. package/dist/{chunk-X74SYWFL.cjs → chunk-G2EHTXK6.cjs} +9 -7
  28. package/dist/chunk-GIE6OE3X.js +3 -0
  29. package/dist/chunk-HJW7OH6E.js +3 -0
  30. package/dist/{chunk-MOXO6WJO.js → chunk-HSIMIWOH.js} +3 -1
  31. package/dist/{chunk-5IBA5HC2.cjs → chunk-HTJKPEWU.cjs} +6 -4
  32. package/dist/chunk-IHUNA3MO.cjs +4 -0
  33. package/dist/chunk-JU2HWIWS.js +12 -0
  34. package/dist/{chunk-BCHFSOQ4.js → chunk-LQXE5JHF.js} +906 -957
  35. package/dist/chunk-MBBNZS6K.cjs +16 -0
  36. package/dist/{chunk-3TNZWTLG.js → chunk-NNADGQRN.js} +5 -3
  37. package/dist/chunk-OYASPHNL.js +3 -0
  38. package/dist/chunk-PCCFAZML.js +3 -0
  39. package/dist/{chunk-USNT2KNT.cjs → chunk-PK6SKIKE.cjs} +2 -0
  40. package/dist/{chunk-ETKZMGLN.cjs → chunk-PSTCR335.cjs} +2 -0
  41. package/dist/chunk-Q7EJVZVI.cjs +4 -0
  42. package/dist/{chunk-CJSGAITR.js → chunk-S7MXT5A2.js} +3 -1
  43. package/dist/{chunk-7RWEBVQC.cjs → chunk-SDVEUTY2.cjs} +13 -11
  44. package/dist/{chunk-OLCL34MI.js → chunk-SYDUPBME.js} +6 -4
  45. package/dist/chunk-TLHFXGYV.js +3 -0
  46. package/dist/chunk-TP5MEMLG.cjs +12 -0
  47. package/dist/chunk-VNRXLY2T.js +3 -0
  48. package/dist/chunk-VQCQRLGM.cjs +4 -0
  49. package/dist/chunk-XZO6ZJQP.cjs +4 -0
  50. package/dist/{chunk-XP7OML7S.cjs → chunk-YUX7LOBU.cjs} +2 -0
  51. package/dist/chunk-YZZUOOPS.cjs +4 -0
  52. package/dist/chunk-Z5H7LD6W.js +3 -0
  53. package/dist/{chunk-VBR53KGY.js → chunk-Z5UEYORO.js} +5 -3
  54. package/dist/{chunk-PAMSESZV.cjs → chunk-Z6ARQDHR.cjs} +2 -0
  55. package/dist/config.cjs +5 -3
  56. package/dist/config.d.cts +19 -21
  57. package/dist/config.d.ts +19 -21
  58. package/dist/config.js +4 -2
  59. package/dist/{resolved-CSqGKlA5.d.cts → context-TizkCfOv.d.cts} +848 -849
  60. package/dist/{resolved-BABoCnXm.d.ts → context-jhcT1Vi1.d.ts} +848 -849
  61. package/dist/esbuild.cjs +13 -11
  62. package/dist/esbuild.d.cts +19 -21
  63. package/dist/esbuild.d.ts +19 -21
  64. package/dist/esbuild.js +10 -8
  65. package/dist/farm.cjs +9 -7
  66. package/dist/farm.d.cts +19 -21
  67. package/dist/farm.d.ts +19 -21
  68. package/dist/farm.js +8 -6
  69. package/dist/index.cjs +39 -41
  70. package/dist/index.d.cts +30 -55
  71. package/dist/index.d.ts +30 -55
  72. package/dist/index.js +20 -18
  73. package/dist/lib/{api-CDUN9en8.d.ts → api-CCOhyMZo.d.cts} +1 -1
  74. package/dist/lib/{api-BRMITKt-.d.cts → api-CpJJXdtL.d.ts} +1 -1
  75. package/dist/lib/build/esbuild.cjs +5 -5
  76. package/dist/lib/build/esbuild.d.cts +2 -2
  77. package/dist/lib/build/esbuild.d.ts +2 -2
  78. package/dist/lib/build/esbuild.js +2 -2
  79. package/dist/lib/build/index.cjs +25 -25
  80. package/dist/lib/build/index.d.cts +4 -4
  81. package/dist/lib/build/index.d.ts +4 -4
  82. package/dist/lib/build/index.js +9 -9
  83. package/dist/lib/build/rolldown.cjs +3 -3
  84. package/dist/lib/build/rolldown.d.cts +2 -2
  85. package/dist/lib/build/rolldown.d.ts +2 -2
  86. package/dist/lib/build/rolldown.js +2 -2
  87. package/dist/lib/build/rollup.cjs +3 -3
  88. package/dist/lib/build/rollup.d.cts +2 -2
  89. package/dist/lib/build/rollup.d.ts +2 -2
  90. package/dist/lib/build/rollup.js +1 -1
  91. package/dist/lib/build/rspack.cjs +2 -2
  92. package/dist/lib/build/rspack.d.cts +2 -2
  93. package/dist/lib/build/rspack.d.ts +2 -2
  94. package/dist/lib/build/rspack.js +1 -1
  95. package/dist/lib/build/tsup.cjs +6 -6
  96. package/dist/lib/build/tsup.d.cts +2 -2
  97. package/dist/lib/build/tsup.d.ts +2 -2
  98. package/dist/lib/build/tsup.js +3 -3
  99. package/dist/lib/build/unbuild.cjs +5 -5
  100. package/dist/lib/build/unbuild.d.cts +4 -4
  101. package/dist/lib/build/unbuild.d.ts +4 -4
  102. package/dist/lib/build/unbuild.js +2 -2
  103. package/dist/lib/build/vite.cjs +5 -5
  104. package/dist/lib/build/vite.d.cts +2 -2
  105. package/dist/lib/build/vite.d.ts +2 -2
  106. package/dist/lib/build/vite.js +3 -3
  107. package/dist/lib/build/webpack.cjs +2 -2
  108. package/dist/lib/build/webpack.d.cts +2 -2
  109. package/dist/lib/build/webpack.d.ts +2 -2
  110. package/dist/lib/build/webpack.js +1 -1
  111. package/dist/lib/chunk-3T56KQ7U.cjs +49 -0
  112. package/dist/lib/{chunk-PZLO6FZW.js → chunk-3W53W5J2.js} +2 -2
  113. package/dist/lib/chunk-4W6WV35V.js +108 -0
  114. package/dist/lib/chunk-6OYSDQXE.cjs +139 -0
  115. package/dist/lib/{chunk-EV357RFB.cjs → chunk-7MHUTBEC.cjs} +1 -3
  116. package/dist/lib/{chunk-A2NFSQ5K.js → chunk-7OVZZWGY.js} +1 -1
  117. package/dist/lib/chunk-A2NW7WAN.js +47 -0
  118. package/dist/lib/chunk-D6MI2V6R.cjs +115 -0
  119. package/dist/lib/{chunk-VHLINWXG.js → chunk-DLVVEHMU.js} +1 -1
  120. package/dist/lib/{chunk-XLYMVIVD.cjs → chunk-DNQBXFNE.cjs} +10 -10
  121. package/dist/lib/{chunk-UGVHYKKN.js → chunk-DYLE5FD3.js} +39 -2
  122. package/dist/lib/{chunk-AKBAX4FH.js → chunk-EN52JYUK.js} +1 -1
  123. package/dist/lib/{chunk-JYDGFQIV.cjs → chunk-F2CXZUSB.cjs} +1 -1
  124. package/dist/lib/{chunk-7VJ42H2I.cjs → chunk-HRRI4KOM.cjs} +1 -3
  125. package/dist/lib/{chunk-LPRZ3HD4.cjs → chunk-IXTLRVAK.cjs} +3 -3
  126. package/dist/lib/{chunk-SYF7QG2J.js → chunk-J3BW52BU.js} +1 -1
  127. package/dist/lib/chunk-KFDNKOXM.js +56 -0
  128. package/dist/lib/chunk-L56XA427.js +137 -0
  129. package/dist/lib/{chunk-6PPZCPME.cjs → chunk-LOW2TIQ6.cjs} +2 -2
  130. package/dist/lib/{chunk-TMZCGC5U.js → chunk-MI55FDCZ.js} +1 -1
  131. package/dist/lib/{chunk-DUZJ7ZF2.cjs → chunk-MKKWFHGE.cjs} +2 -2
  132. package/dist/lib/{chunk-ISBHXSDH.cjs → chunk-N5XEKCVW.cjs} +1 -1
  133. package/dist/lib/{chunk-XZFEHPYE.js → chunk-N5YLKWC2.js} +1 -1
  134. package/dist/lib/chunk-NIRFKQAD.js +845 -0
  135. package/dist/lib/{chunk-YMHOAMCU.cjs → chunk-NLJR4WIX.cjs} +41 -4
  136. package/dist/lib/{chunk-L3HESXYF.cjs → chunk-NUE5DIH3.cjs} +3 -3
  137. package/dist/lib/chunk-OBA5U4Y2.js +1059 -0
  138. package/dist/lib/{chunk-FQLZZYYO.js → chunk-OEF6EHQV.js} +1 -3
  139. package/dist/lib/{chunk-WTTBXYFQ.js → chunk-OFXWRM3U.js} +2 -2
  140. package/dist/lib/chunk-ONETLSPO.js +85 -0
  141. package/dist/lib/{chunk-2OV26JXJ.cjs → chunk-PQRWG64T.cjs} +3 -3
  142. package/dist/lib/chunk-R33US3PV.cjs +1081 -0
  143. package/dist/lib/{chunk-OA7OL7HF.cjs → chunk-SFEEJZLK.cjs} +38 -66
  144. package/dist/lib/{chunk-H6EOZSIZ.js → chunk-TAVG226Z.js} +1 -1
  145. package/dist/lib/{chunk-DALRRHB4.cjs → chunk-TSFG3WEA.cjs} +1 -1
  146. package/dist/lib/{chunk-RMA2PMP7.cjs → chunk-TZCC5IWH.cjs} +3 -3
  147. package/dist/lib/chunk-VHCBD2IS.js +149 -0
  148. package/dist/lib/{chunk-HY6DNFCT.js → chunk-VODWHWD6.js} +2 -2
  149. package/dist/lib/{chunk-2X5DUDNT.js → chunk-W6GWSJ22.js} +2 -2
  150. package/dist/lib/chunk-WBSA6OG6.cjs +860 -0
  151. package/dist/lib/{chunk-TOCNXURI.cjs → chunk-WCXA5WFX.cjs} +4 -4
  152. package/dist/lib/{chunk-6I5PL7H2.js → chunk-WGSZ4X6N.js} +1 -3
  153. package/dist/lib/{chunk-T2KQZC5K.js → chunk-WLDQUTFD.js} +27 -54
  154. package/dist/lib/{chunk-AOHJEL2Q.js → chunk-WOKPJMGJ.js} +3 -3
  155. package/dist/lib/{chunk-TDJNFAOV.cjs → chunk-X6JDYLWM.cjs} +1 -1
  156. package/dist/lib/chunk-XLHFUATD.cjs +151 -0
  157. package/dist/lib/chunk-XUYQYUWZ.cjs +87 -0
  158. package/dist/lib/chunk-YYEAV24J.cjs +67 -0
  159. package/dist/lib/{config-D8KrE7SZ.d.cts → config-Cqxh4V21.d.cts} +58 -475
  160. package/dist/lib/{config-DBIFdRoq.d.ts → config-D-WwQL-4.d.ts} +58 -475
  161. package/dist/lib/config-file.d.cts +2 -2
  162. package/dist/lib/config-file.d.ts +2 -2
  163. package/dist/lib/contexts/api-context.cjs +12 -7
  164. package/dist/lib/contexts/api-context.d.cts +27 -4
  165. package/dist/lib/contexts/api-context.d.ts +27 -4
  166. package/dist/lib/contexts/api-context.js +11 -6
  167. package/dist/lib/contexts/context.cjs +10 -5
  168. package/dist/lib/contexts/context.d.cts +7 -7
  169. package/dist/lib/contexts/context.d.ts +7 -7
  170. package/dist/lib/contexts/context.js +9 -4
  171. package/dist/lib/contexts/environment-context.cjs +11 -6
  172. package/dist/lib/contexts/environment-context.d.cts +4 -4
  173. package/dist/lib/contexts/environment-context.d.ts +4 -4
  174. package/dist/lib/contexts/environment-context.js +10 -5
  175. package/dist/lib/contexts/index.cjs +14 -9
  176. package/dist/lib/contexts/index.d.cts +4 -4
  177. package/dist/lib/contexts/index.d.ts +4 -4
  178. package/dist/lib/contexts/index.js +11 -6
  179. package/dist/lib/contexts/plugin-context.d.cts +4 -4
  180. package/dist/lib/contexts/plugin-context.d.ts +4 -4
  181. package/dist/lib/entry.cjs +9 -9
  182. package/dist/lib/entry.d.cts +2 -2
  183. package/dist/lib/entry.d.ts +2 -2
  184. package/dist/lib/entry.js +1 -1
  185. package/dist/lib/fs/helpers.cjs +47 -0
  186. package/dist/lib/fs/helpers.d.cts +74 -0
  187. package/dist/lib/fs/helpers.d.ts +74 -0
  188. package/dist/lib/fs/helpers.js +2 -0
  189. package/dist/lib/fs/index.cjs +17 -0
  190. package/dist/lib/fs/index.d.cts +33 -0
  191. package/dist/lib/fs/index.d.ts +33 -0
  192. package/dist/lib/fs/index.js +8 -0
  193. package/dist/lib/fs/storage/base.cjs +11 -0
  194. package/dist/lib/fs/storage/base.d.cts +138 -0
  195. package/dist/lib/fs/storage/base.d.ts +138 -0
  196. package/dist/lib/fs/storage/base.js +2 -0
  197. package/dist/lib/fs/storage/file-system.cjs +13 -0
  198. package/dist/lib/fs/storage/file-system.d.cts +90 -0
  199. package/dist/lib/fs/storage/file-system.d.ts +90 -0
  200. package/dist/lib/fs/storage/file-system.js +4 -0
  201. package/dist/lib/fs/storage/index.cjs +22 -0
  202. package/dist/lib/fs/storage/index.d.cts +6 -0
  203. package/dist/lib/fs/storage/index.d.ts +6 -0
  204. package/dist/lib/fs/storage/index.js +5 -0
  205. package/dist/lib/fs/storage/virtual.cjs +12 -0
  206. package/dist/lib/fs/storage/virtual.d.cts +66 -0
  207. package/dist/lib/fs/storage/virtual.d.ts +66 -0
  208. package/dist/lib/fs/storage/virtual.js +3 -0
  209. package/dist/lib/fs/vfs.cjs +16 -0
  210. package/dist/lib/fs/vfs.d.cts +247 -0
  211. package/dist/lib/fs/vfs.d.ts +247 -0
  212. package/dist/lib/fs/vfs.js +7 -0
  213. package/dist/lib/fs-Dg-aTfiN.d.cts +378 -0
  214. package/dist/lib/fs-Dg-aTfiN.d.ts +378 -0
  215. package/dist/lib/index.cjs +62 -68
  216. package/dist/lib/index.d.cts +18 -356
  217. package/dist/lib/index.d.ts +18 -356
  218. package/dist/lib/index.js +19 -13
  219. package/dist/lib/{internal-CaGANOWK.d.cts → internal-Cl7s1iAA.d.cts} +2 -2
  220. package/dist/lib/{internal-1qCyw7bA.d.ts → internal-W5pvS6e9.d.ts} +2 -2
  221. package/dist/lib/logger.d.cts +2 -2
  222. package/dist/lib/logger.d.ts +2 -2
  223. package/dist/lib/typescript/import-transformer.cjs +7 -45
  224. package/dist/lib/typescript/import-transformer.d.cts +2 -2
  225. package/dist/lib/typescript/import-transformer.d.ts +2 -2
  226. package/dist/lib/typescript/import-transformer.js +2 -47
  227. package/dist/lib/typescript/index.cjs +10 -22
  228. package/dist/lib/typescript/index.d.cts +4 -4
  229. package/dist/lib/typescript/index.d.ts +4 -4
  230. package/dist/lib/typescript/index.js +2 -2
  231. package/dist/lib/typescript/ts-morph.cjs +6 -2
  232. package/dist/lib/typescript/ts-morph.d.cts +28 -4
  233. package/dist/lib/typescript/ts-morph.d.ts +28 -4
  234. package/dist/lib/typescript/ts-morph.js +1 -1
  235. package/dist/lib/unplugin/factory.cjs +14 -9
  236. package/dist/lib/unplugin/factory.d.cts +4 -4
  237. package/dist/lib/unplugin/factory.d.ts +4 -4
  238. package/dist/lib/unplugin/factory.js +13 -8
  239. package/dist/lib/unplugin/helpers.d.cts +2 -2
  240. package/dist/lib/unplugin/helpers.d.ts +2 -2
  241. package/dist/lib/unplugin/index.cjs +16 -11
  242. package/dist/lib/unplugin/index.d.cts +4 -4
  243. package/dist/lib/unplugin/index.d.ts +4 -4
  244. package/dist/lib/unplugin/index.js +14 -9
  245. package/dist/lib/unplugin/plugin.cjs +2 -2
  246. package/dist/lib/unplugin/plugin.d.cts +4 -4
  247. package/dist/lib/unplugin/plugin.d.ts +4 -4
  248. package/dist/lib/unplugin/plugin.js +1 -1
  249. package/dist/lib/{unplugin-CEeJqADD.d.ts → unplugin-Cg2NoKj0.d.ts} +2 -2
  250. package/dist/lib/{unplugin-bUSyjd0S.d.cts → unplugin-trF-VLnO.d.cts} +2 -2
  251. package/dist/lib/utilities/bundle.cjs +4 -4
  252. package/dist/lib/utilities/bundle.d.cts +2 -2
  253. package/dist/lib/utilities/bundle.d.ts +2 -2
  254. package/dist/lib/utilities/bundle.js +3 -3
  255. package/dist/lib/utilities/cache.d.cts +2 -2
  256. package/dist/lib/utilities/cache.d.ts +2 -2
  257. package/dist/lib/utilities/file-header.d.cts +2 -2
  258. package/dist/lib/utilities/file-header.d.ts +2 -2
  259. package/dist/lib/utilities/index.cjs +22 -22
  260. package/dist/lib/utilities/index.d.cts +2 -2
  261. package/dist/lib/utilities/index.d.ts +2 -2
  262. package/dist/lib/utilities/index.js +6 -6
  263. package/dist/lib/utilities/meta.cjs +7 -7
  264. package/dist/lib/utilities/meta.d.cts +2 -2
  265. package/dist/lib/utilities/meta.d.ts +2 -2
  266. package/dist/lib/utilities/meta.js +1 -1
  267. package/dist/lib/utilities/resolve.cjs +5 -5
  268. package/dist/lib/utilities/resolve.d.cts +2 -2
  269. package/dist/lib/utilities/resolve.d.ts +2 -2
  270. package/dist/lib/utilities/resolve.js +4 -4
  271. package/dist/lib/utilities/source-file.d.cts +2 -2
  272. package/dist/lib/utilities/source-file.d.ts +2 -2
  273. package/dist/lib/utilities/source-map.d.cts +2 -2
  274. package/dist/lib/utilities/source-map.d.ts +2 -2
  275. package/dist/lib/utilities/worker.d.cts +2 -2
  276. package/dist/lib/utilities/worker.d.ts +2 -2
  277. package/dist/lib/utilities/write-file.d.cts +2 -2
  278. package/dist/lib/utilities/write-file.d.ts +2 -2
  279. package/dist/next.cjs +11 -9
  280. package/dist/next.js +9 -7
  281. package/dist/nuxt.cjs +13 -11
  282. package/dist/nuxt.js +11 -9
  283. package/dist/plugin-utils/{chunk-JHTLGE4X.js → chunk-K2GWRZPV.js} +1 -1
  284. package/dist/plugin-utils/{chunk-HSYQWNIH.cjs → chunk-VWFJOPKC.cjs} +1 -1
  285. package/dist/plugin-utils/{context-BITGF5LZ.d.cts → context-PtfEjz3_.d.cts} +187 -230
  286. package/dist/plugin-utils/{context-BITGF5LZ.d.ts → context-PtfEjz3_.d.ts} +187 -230
  287. package/dist/plugin-utils/context-helpers.d.cts +1 -2
  288. package/dist/plugin-utils/context-helpers.d.ts +1 -2
  289. package/dist/plugin-utils/enforce.d.cts +1 -2
  290. package/dist/plugin-utils/enforce.d.ts +1 -2
  291. package/dist/plugin-utils/extend.d.cts +1 -2
  292. package/dist/plugin-utils/extend.d.ts +1 -2
  293. package/dist/plugin-utils/get-config-path.d.cts +1 -2
  294. package/dist/plugin-utils/get-config-path.d.ts +1 -2
  295. package/dist/plugin-utils/helpers.d.cts +1 -2
  296. package/dist/plugin-utils/helpers.d.ts +1 -2
  297. package/dist/plugin-utils/index.cjs +2 -2
  298. package/dist/plugin-utils/index.d.cts +1 -2
  299. package/dist/plugin-utils/index.d.ts +1 -2
  300. package/dist/plugin-utils/index.js +1 -1
  301. package/dist/plugin-utils/merge.d.cts +1 -2
  302. package/dist/plugin-utils/merge.d.ts +1 -2
  303. package/dist/plugin-utils/paths.cjs +2 -2
  304. package/dist/plugin-utils/paths.d.cts +2 -3
  305. package/dist/plugin-utils/paths.d.ts +2 -3
  306. package/dist/plugin-utils/paths.js +1 -1
  307. package/dist/rolldown.cjs +9 -7
  308. package/dist/rolldown.d.cts +19 -21
  309. package/dist/rolldown.d.ts +19 -21
  310. package/dist/rolldown.js +8 -6
  311. package/dist/rollup.cjs +9 -7
  312. package/dist/rollup.d.cts +19 -21
  313. package/dist/rollup.d.ts +19 -21
  314. package/dist/rollup.js +8 -6
  315. package/dist/rspack.cjs +9 -7
  316. package/dist/rspack.d.cts +18 -20
  317. package/dist/rspack.d.ts +18 -20
  318. package/dist/rspack.js +8 -6
  319. package/dist/tsup.cjs +12 -10
  320. package/dist/tsup.js +10 -8
  321. package/dist/types/api.cjs +3 -1
  322. package/dist/types/api.cjs.map +1 -0
  323. package/dist/types/api.d.cts +20 -22
  324. package/dist/types/api.d.ts +20 -22
  325. package/dist/types/api.js +3 -1
  326. package/dist/types/api.js.map +1 -0
  327. package/dist/types/babel.cjs +3 -1
  328. package/dist/types/babel.cjs.map +1 -0
  329. package/dist/types/babel.d.cts +17 -19
  330. package/dist/types/babel.d.ts +17 -19
  331. package/dist/types/babel.js +3 -1
  332. package/dist/types/babel.js.map +1 -0
  333. package/dist/types/build.cjs +3 -1
  334. package/dist/types/build.cjs.map +1 -0
  335. package/dist/types/build.js +3 -1
  336. package/dist/types/build.js.map +1 -0
  337. package/dist/types/commands.cjs +5 -3
  338. package/dist/types/commands.cjs.map +1 -0
  339. package/dist/types/commands.d.cts +18 -20
  340. package/dist/types/commands.d.ts +18 -20
  341. package/dist/types/commands.js +4 -2
  342. package/dist/types/commands.js.map +1 -0
  343. package/dist/types/config.cjs +3 -1
  344. package/dist/types/config.cjs.map +1 -0
  345. package/dist/types/config.d.cts +2 -4
  346. package/dist/types/config.d.ts +2 -4
  347. package/dist/types/config.js +3 -1
  348. package/dist/types/config.js.map +1 -0
  349. package/dist/types/context.cjs +5 -3
  350. package/dist/types/context.cjs.map +1 -0
  351. package/dist/types/context.d.cts +8 -10
  352. package/dist/types/context.d.ts +8 -10
  353. package/dist/types/context.js +4 -2
  354. package/dist/types/context.js.map +1 -0
  355. package/dist/types/fs.cjs +10 -4
  356. package/dist/types/fs.cjs.map +1 -0
  357. package/dist/types/fs.d.cts +138 -184
  358. package/dist/types/fs.d.ts +138 -184
  359. package/dist/types/fs.js +4 -2
  360. package/dist/types/fs.js.map +1 -0
  361. package/dist/types/hooks.cjs +3 -1
  362. package/dist/types/hooks.cjs.map +1 -0
  363. package/dist/types/hooks.d.cts +19 -21
  364. package/dist/types/hooks.d.ts +19 -21
  365. package/dist/types/hooks.js +3 -1
  366. package/dist/types/hooks.js.map +1 -0
  367. package/dist/types/index.cjs +26 -20
  368. package/dist/types/index.cjs.map +1 -0
  369. package/dist/types/index.d.cts +13 -15
  370. package/dist/types/index.d.ts +13 -15
  371. package/dist/types/index.js +17 -15
  372. package/dist/types/index.js.map +1 -0
  373. package/dist/types/internal.cjs +2 -0
  374. package/dist/types/internal.cjs.map +1 -0
  375. package/dist/types/internal.d.cts +20 -22
  376. package/dist/types/internal.d.ts +20 -22
  377. package/dist/types/internal.js +2 -0
  378. package/dist/types/internal.js.map +1 -0
  379. package/dist/types/plugin.cjs +5 -3
  380. package/dist/types/plugin.cjs.map +1 -0
  381. package/dist/types/plugin.d.cts +9 -11
  382. package/dist/types/plugin.d.ts +9 -11
  383. package/dist/types/plugin.js +4 -2
  384. package/dist/types/plugin.js.map +1 -0
  385. package/dist/types/resolved.cjs +3 -1
  386. package/dist/types/resolved.cjs.map +1 -0
  387. package/dist/types/resolved.d.cts +7 -9
  388. package/dist/types/resolved.d.ts +7 -9
  389. package/dist/types/resolved.js +3 -1
  390. package/dist/types/resolved.js.map +1 -0
  391. package/dist/types/tsconfig.cjs +3 -1
  392. package/dist/types/tsconfig.cjs.map +1 -0
  393. package/dist/types/tsconfig.js +3 -1
  394. package/dist/types/tsconfig.js.map +1 -0
  395. package/dist/types/typedoc.cjs +3 -1
  396. package/dist/types/typedoc.cjs.map +1 -0
  397. package/dist/types/typedoc.js +3 -1
  398. package/dist/types/typedoc.js.map +1 -0
  399. package/dist/types/unplugin.cjs +3 -1
  400. package/dist/types/unplugin.cjs.map +1 -0
  401. package/dist/types/unplugin.d.cts +11 -13
  402. package/dist/types/unplugin.d.ts +11 -13
  403. package/dist/types/unplugin.js +3 -1
  404. package/dist/types/unplugin.js.map +1 -0
  405. package/dist/unloader.cjs +9 -7
  406. package/dist/unloader.d.cts +19 -21
  407. package/dist/unloader.d.ts +19 -21
  408. package/dist/unloader.js +8 -6
  409. package/dist/unplugin.cjs +20 -20
  410. package/dist/unplugin.d.cts +19 -21
  411. package/dist/unplugin.d.ts +19 -21
  412. package/dist/unplugin.js +10 -10
  413. package/dist/vite.cjs +13 -11
  414. package/dist/vite.d.cts +19 -21
  415. package/dist/vite.d.ts +19 -21
  416. package/dist/vite.js +10 -8
  417. package/dist/webpack.cjs +12 -10
  418. package/dist/webpack.d.cts +19 -21
  419. package/dist/webpack.d.ts +19 -21
  420. package/dist/webpack.js +9 -7
  421. package/package.json +72 -19
  422. package/schemas/fs.capnp +4 -59
  423. package/dist/chunk-2NO7N5OW.cjs +0 -2
  424. package/dist/chunk-7GYTTM4M.cjs +0 -2
  425. package/dist/chunk-AENPRFWJ.cjs +0 -2
  426. package/dist/chunk-AYKZK666.cjs +0 -8
  427. package/dist/chunk-BUR2JQ6G.cjs +0 -11
  428. package/dist/chunk-DRXFQCNC.js +0 -1
  429. package/dist/chunk-FNZDWE4L.js +0 -1
  430. package/dist/chunk-GHJU2KGP.cjs +0 -2
  431. package/dist/chunk-GRU7B3QM.cjs +0 -2
  432. package/dist/chunk-HQFZ64VC.cjs +0 -2
  433. package/dist/chunk-J4BQZHTQ.js +0 -1
  434. package/dist/chunk-JGB5YQ2U.js +0 -1
  435. package/dist/chunk-KALR2O2F.cjs +0 -2
  436. package/dist/chunk-LOUZXJFY.cjs +0 -10
  437. package/dist/chunk-OO3YXM72.js +0 -1
  438. package/dist/chunk-QE3WGMAP.js +0 -1
  439. package/dist/chunk-SMNKPH4T.js +0 -1
  440. package/dist/chunk-T2P533I5.js +0 -1
  441. package/dist/chunk-V3MLQDZQ.js +0 -1
  442. package/dist/chunk-VT7NVLLU.js +0 -5
  443. package/dist/chunk-YRJ4MLVL.cjs +0 -2
  444. package/dist/chunk-ZC43PZXS.cjs +0 -2
  445. package/dist/lib/chunk-3MZQ4MQX.cjs +0 -2360
  446. package/dist/lib/chunk-5JAFU45Z.js +0 -2324
  447. package/dist/lib/chunk-HAXL7QE7.js +0 -154
  448. package/dist/lib/chunk-SAS5EPBD.cjs +0 -107
  449. package/dist/lib/chunk-WUYK74EH.cjs +0 -165
  450. package/dist/lib/chunk-YQ3ODCHV.js +0 -105
  451. package/dist/lib/typescript/compiler-host.cjs +0 -164
  452. package/dist/lib/typescript/compiler-host.d.cts +0 -63
  453. package/dist/lib/typescript/compiler-host.d.ts +0 -63
  454. package/dist/lib/typescript/compiler-host.js +0 -156
  455. package/dist/lib/typescript/program.cjs +0 -27
  456. package/dist/lib/typescript/program.d.cts +0 -68
  457. package/dist/lib/typescript/program.d.ts +0 -68
  458. package/dist/lib/typescript/program.js +0 -2
  459. /package/dist/{chunk-2NCILNCH.cjs → lib/chunk-K2SFTPN3.cjs} +0 -0
  460. /package/dist/{chunk-BLNT5INX.js → lib/chunk-NQAHFTUW.js} +0 -0
@@ -1,14 +1,15 @@
1
1
  'use strict';
2
2
 
3
- var chunkETKZMGLN_cjs = require('./chunk-ETKZMGLN.cjs');
4
- var chunkPAMSESZV_cjs = require('./chunk-PAMSESZV.cjs');
5
- var chunkAYKZK666_cjs = require('./chunk-AYKZK666.cjs');
6
- var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
3
+ var chunkPSTCR335_cjs = require('./chunk-PSTCR335.cjs');
4
+ var chunkZ6ARQDHR_cjs = require('./chunk-Z6ARQDHR.cjs');
5
+ var chunkMBBNZS6K_cjs = require('./chunk-MBBNZS6K.cjs');
6
+ var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
7
7
  var core = require('@babel/core');
8
8
  var console = require('@storm-software/config-tools/logger/console');
9
9
  var types = require('@storm-software/config-tools/types');
10
10
  var toArray = require('@stryke/convert/to-array');
11
11
  var copyFile = require('@stryke/fs/copy-file');
12
+ var helpers = require('@stryke/fs/helpers');
12
13
  var install = require('@stryke/fs/install');
13
14
  var listFiles = require('@stryke/fs/list-files');
14
15
  var packageFns = require('@stryke/fs/package-fns');
@@ -27,14 +28,15 @@ var chalk5 = require('chalk');
27
28
  var Handlebars = require('handlebars');
28
29
  var helperPluginUtils = require('@babel/helper-plugin-utils');
29
30
  var t = require('@babel/types');
30
- var ts2 = require('typescript');
31
- var defu6 = require('defu');
31
+ var ts = require('typescript');
32
+ var join = require('@stryke/path/join');
33
+ var defu7 = require('defu');
34
+ var tsMorph = require('ts-morph');
32
35
  var _package = require('@stryke/string-format/package');
33
36
  var superdiff = require('@donedeal0/superdiff');
34
37
  var json = require('@stryke/fs/json');
35
38
  var stormJson = require('@stryke/json/storm-json');
36
39
  var filePathFns = require('@stryke/path/file-path-fns');
37
- var isParentPath = require('@stryke/path/is-parent-path');
38
40
  var titleCase = require('@stryke/string-format/title-case');
39
41
  var exists = require('@stryke/fs/exists');
40
42
  var writeFile$1 = require('@stryke/fs/write-file');
@@ -48,7 +50,6 @@ var murmurhash = require('@stryke/hash/murmurhash');
48
50
  var getUnique = require('@stryke/helpers/get-unique');
49
51
  var omit = require('@stryke/helpers/omit');
50
52
  var isType = require('@stryke/path/is-type');
51
- var join = require('@stryke/path/join');
52
53
  var isNull = require('@stryke/type-checks/is-null');
53
54
  var isString = require('@stryke/type-checks/is-string');
54
55
  var uuid = require('@stryke/unique-id/uuid');
@@ -58,21 +59,20 @@ var isUndefined = require('@stryke/type-checks/is-undefined');
58
59
  var parseTypeDefinition = require('@stryke/convert/parse-type-definition');
59
60
  var isFile = require('@stryke/fs/is-file');
60
61
  var $ = require('@stryke/capnp');
61
- var bufferToString = require('@stryke/convert/buffer-to-string');
62
62
  var buffer = require('@stryke/fs/buffer');
63
63
  var correctPath = require('@stryke/path/correct-path');
64
+ var isParentPath = require('@stryke/path/is-parent-path');
64
65
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
65
- var isBuffer = require('@stryke/type-checks/is-buffer');
66
66
  var flatCache = require('flat-cache');
67
67
  var buffer$1 = require('buffer');
68
- var _fs = require('fs');
69
68
  var logger = require('@storm-software/config-tools/logger');
70
69
  var colors = require('@storm-software/config-tools/utilities/colors');
71
70
  var noop = require('@stryke/helpers/noop');
72
71
  var slash = require('@stryke/path/slash');
73
- var memfs = require('memfs');
74
- var unionfs = require('unionfs');
75
- var tsMorph = require('ts-morph');
72
+ var readFile = require('@stryke/fs/read-file');
73
+ var fs = require('fs');
74
+ var promises = require('fs/promises');
75
+ var path = require('path');
76
76
  require('@stryke/fs/remove-file');
77
77
  var kebabCase = require('@stryke/string-format/kebab-case');
78
78
  var isObject = require('@stryke/type-checks/is-object');
@@ -100,10 +100,9 @@ function _interopNamespace(e) {
100
100
  var chalk5__default = /*#__PURE__*/_interopDefault(chalk5);
101
101
  var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
102
102
  var t__namespace = /*#__PURE__*/_interopNamespace(t);
103
- var ts2__default = /*#__PURE__*/_interopDefault(ts2);
104
- var defu6__default = /*#__PURE__*/_interopDefault(defu6);
103
+ var ts__default = /*#__PURE__*/_interopDefault(ts);
104
+ var defu7__default = /*#__PURE__*/_interopDefault(defu7);
105
105
  var $__namespace = /*#__PURE__*/_interopNamespace($);
106
- var _fs__default = /*#__PURE__*/_interopDefault(_fs);
107
106
 
108
107
  function resolveModulePath(nodePath, state) {
109
108
  if (!t__namespace.isStringLiteral(nodePath.node)) {
@@ -118,7 +117,7 @@ function resolveModulePath(nodePath, state) {
118
117
  ));
119
118
  }
120
119
  }
121
- chunkUSNT2KNT_cjs.__name(resolveModulePath, "resolveModulePath");
120
+ chunkPK6SKIKE_cjs.__name(resolveModulePath, "resolveModulePath");
122
121
  var TRANSFORM_FUNCTIONS = [
123
122
  "require",
124
123
  "require.resolve",
@@ -148,9 +147,9 @@ function matchesPattern(state, calleePath, pattern) {
148
147
  const name = pattern.split(".")[0];
149
148
  return node.name === name;
150
149
  }
151
- chunkUSNT2KNT_cjs.__name(matchesPattern, "matchesPattern");
150
+ chunkPK6SKIKE_cjs.__name(matchesPattern, "matchesPattern");
152
151
  var importVisitors = {
153
- CallExpression: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((nodePath, state) => {
152
+ CallExpression: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
154
153
  if (state.moduleResolverVisited.has(nodePath)) {
155
154
  return;
156
155
  }
@@ -161,7 +160,7 @@ var importVisitors = {
161
160
  }
162
161
  }, "CallExpression"),
163
162
  // eslint-disable-next-line ts/naming-convention
164
- "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((nodePath, state) => {
163
+ "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
165
164
  if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
166
165
  return;
167
166
  }
@@ -169,8 +168,8 @@ var importVisitors = {
169
168
  resolveModulePath(nodePath.get("source"), state);
170
169
  }, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
171
170
  };
172
- var moduleResolverBabelPlugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((context) => {
173
- return helperPluginUtils.declare(/* @__PURE__ */ chunkUSNT2KNT_cjs.__name(function builder(api) {
171
+ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context) => {
172
+ return helperPluginUtils.declare(/* @__PURE__ */ chunkPK6SKIKE_cjs.__name(function builder(api) {
174
173
  let moduleResolverVisited = /* @__PURE__ */ new Set();
175
174
  return {
176
175
  name: "powerlines:module-resolver",
@@ -206,6 +205,108 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((contex
206
205
  };
207
206
  }, "builder"));
208
207
  }, "moduleResolverBabelPlugin");
208
+ var VirtualFileSystemHost = class extends tsMorph.InMemoryFileSystemHost {
209
+ static {
210
+ chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystemHost");
211
+ }
212
+ #context;
213
+ constructor(context) {
214
+ super();
215
+ this.#context = context;
216
+ }
217
+ deleteSync(path) {
218
+ this.#context.fs.removeSync(path);
219
+ }
220
+ readDirSync(dirPath) {
221
+ return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {
222
+ const fullPath = this.#context.fs.resolveSync(join.joinPaths(dirPath, entry));
223
+ if (fullPath) {
224
+ ret.push({
225
+ name: entry,
226
+ isDirectory: this.#context.fs.existsSync(fullPath),
227
+ isFile: this.#context.fs.existsSync(fullPath),
228
+ isSymlink: false
229
+ });
230
+ }
231
+ return ret;
232
+ }, []);
233
+ }
234
+ async readFile(filePath) {
235
+ if (!this.#context.fs.existsSync(filePath)) {
236
+ throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
237
+ }
238
+ return await this.#context.fs.read(filePath);
239
+ }
240
+ readFileSync(filePath) {
241
+ if (!this.#context.fs.existsSync(filePath)) {
242
+ throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
243
+ }
244
+ return this.#context.fs.readSync(filePath);
245
+ }
246
+ async writeFile(filePath, fileText) {
247
+ return this.#context.fs.write(filePath, fileText);
248
+ }
249
+ writeFileSync(filePath, fileText) {
250
+ this.#context.fs.writeSync(filePath, fileText);
251
+ }
252
+ async mkdir(_dirPath) {
253
+ }
254
+ mkdirSync(_dirPath) {
255
+ }
256
+ async move(srcPath, destPath) {
257
+ await this.#context.fs.move(srcPath, destPath);
258
+ }
259
+ moveSync(srcPath, destPath) {
260
+ this.#context.fs.moveSync(srcPath, destPath);
261
+ }
262
+ async copy(srcPath, destPath) {
263
+ await this.#context.fs.copy(srcPath, destPath);
264
+ }
265
+ copySync(srcPath, destPath) {
266
+ this.#context.fs.copySync(srcPath, destPath);
267
+ }
268
+ async fileExists(filePath) {
269
+ return this.#context.fs.exists(filePath);
270
+ }
271
+ fileExistsSync(filePath) {
272
+ return this.#context.fs.existsSync(filePath);
273
+ }
274
+ async directoryExists(dirPath) {
275
+ return this.#context.fs.exists(dirPath);
276
+ }
277
+ directoryExistsSync(dirPath) {
278
+ return this.#context.fs.existsSync(dirPath);
279
+ }
280
+ realpathSync(path) {
281
+ return this.#context.fs.resolveSync(path) || path;
282
+ }
283
+ getCurrentDirectory() {
284
+ return this.#context.workspaceConfig.workspaceRoot;
285
+ }
286
+ async glob(patterns) {
287
+ return this.#context.fs.glob(patterns);
288
+ }
289
+ globSync(patterns) {
290
+ return this.#context.fs.globSync(patterns);
291
+ }
292
+ };
293
+ function createProgram(context, override) {
294
+ context.log(types.LogLevelLabel.TRACE, `Creating ts-morph Project instance with configuration from: ${context.tsconfig.tsconfigFilePath}.`);
295
+ const project = new tsMorph.Project(defu7__default.default(override ?? {}, {
296
+ skipAddingFilesFromTsConfig: false,
297
+ tsConfigFilePath: context.tsconfig.tsconfigFilePath,
298
+ fileSystem: new VirtualFileSystemHost(context),
299
+ compilerOptions: defu7__default.default(context.tsconfig.options ?? {}, {
300
+ lib: [
301
+ "lib.esnext.full.d.ts"
302
+ ]
303
+ })
304
+ }));
305
+ return project;
306
+ }
307
+ chunkPK6SKIKE_cjs.__name(createProgram, "createProgram");
308
+
309
+ // src/internal/helpers/generate-types.ts
209
310
  function formatTypes(code) {
210
311
  return code.replace(
211
312
  // eslint-disable-next-line regexp/no-super-linear-backtracking
@@ -213,11 +314,14 @@ function formatTypes(code) {
213
314
  ""
214
315
  ).replaceAll("#private;", "").replace(/__Ω/g, "");
215
316
  }
216
- chunkUSNT2KNT_cjs.__name(formatTypes, "formatTypes");
317
+ chunkPK6SKIKE_cjs.__name(formatTypes, "formatTypes");
217
318
  async function emitTypes(context, files) {
218
319
  context.log(types.LogLevelLabel.TRACE, `Running the TypeScript compiler for ${files.length} generated runtime files.`);
219
- context.program.addSourceFilesAtPaths(files);
220
- const result = context.program.emitToMemory({
320
+ const program = createProgram(context, {
321
+ skipAddingFilesFromTsConfig: true
322
+ });
323
+ program.addSourceFilesAtPaths(files);
324
+ const result = program.emitToMemory({
221
325
  emitOnlyDtsFiles: true
222
326
  });
223
327
  let builtinModules = "";
@@ -236,9 +340,9 @@ async function emitTypes(context, files) {
236
340
  const diagnosticMessages = [];
237
341
  result.getDiagnostics().forEach((diagnostic) => {
238
342
  if (diagnostic.getSourceFile()?.getBaseName()) {
239
- diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
343
+ diagnosticMessages.push(`${diagnostic.getSourceFile()?.getBaseName()} (${(diagnostic.getLineNumber() ?? 0) + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n")}`);
240
344
  } else {
241
- diagnosticMessages.push(ts2.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
345
+ diagnosticMessages.push(ts.flattenDiagnosticMessageText(diagnostic.getMessageText().toString(), "\n"));
242
346
  }
243
347
  });
244
348
  const diagnosticMessage = diagnosticMessages.join("\n");
@@ -249,7 +353,7 @@ ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : dia
249
353
  }
250
354
  return formatTypes(builtinModules);
251
355
  }
252
- chunkUSNT2KNT_cjs.__name(emitTypes, "emitTypes");
356
+ chunkPK6SKIKE_cjs.__name(emitTypes, "emitTypes");
253
357
  async function callHook(context, hook, options, ...args) {
254
358
  const handlers = context.selectHooks(hook, options);
255
359
  if (handlers.length > 0) {
@@ -277,14 +381,14 @@ async function callHook(context, hook, options, ...args) {
277
381
  if (definedResults.length > 0) {
278
382
  let mergedResult = void 0;
279
383
  for (const result of definedResults) {
280
- mergedResult = defu6.defu(result, mergedResult ?? {});
384
+ mergedResult = defu7.defu(result, mergedResult ?? {});
281
385
  }
282
386
  return mergedResult;
283
387
  }
284
388
  }
285
389
  return void 0;
286
390
  }
287
- chunkUSNT2KNT_cjs.__name(callHook, "callHook");
391
+ chunkPK6SKIKE_cjs.__name(callHook, "callHook");
288
392
  async function installPackage(context, packageName, dev = false) {
289
393
  if (!await packageFns.isPackageListed(_package.getPackageName(packageName), {
290
394
  cwd: context.config.projectRoot
@@ -314,7 +418,7 @@ async function installPackage(context, packageName, dev = false) {
314
418
  }
315
419
  }
316
420
  }
317
- chunkUSNT2KNT_cjs.__name(installPackage, "installPackage");
421
+ chunkPK6SKIKE_cjs.__name(installPackage, "installPackage");
318
422
 
319
423
  // src/internal/helpers/install-dependencies.ts
320
424
  async function installDependencies(context) {
@@ -336,7 +440,7 @@ ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${
336
440
  Promise.all(Object.entries(context.devDependencies).map(async ([name, version]) => installPackage(context, `${_package.getPackageName(name)}@${String(version)}`, true)))
337
441
  ]);
338
442
  }
339
- chunkUSNT2KNT_cjs.__name(installDependencies, "installDependencies");
443
+ chunkPK6SKIKE_cjs.__name(installDependencies, "installDependencies");
340
444
  function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
341
445
  let tsconfigFilePath;
342
446
  if (tsconfig) {
@@ -355,7 +459,7 @@ function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
355
459
  }
356
460
  return tsconfigFilePath;
357
461
  }
358
- chunkUSNT2KNT_cjs.__name(getTsconfigFilePath, "getTsconfigFilePath");
462
+ chunkPK6SKIKE_cjs.__name(getTsconfigFilePath, "getTsconfigFilePath");
359
463
  function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
360
464
  let tsconfigFilePath = tsconfig;
361
465
  if (!exists.existsSync(tsconfigFilePath)) {
@@ -369,7 +473,7 @@ function tryTsconfigFilePath(workspaceRoot, projectRoot, tsconfig) {
369
473
  }
370
474
  return tsconfigFilePath;
371
475
  }
372
- chunkUSNT2KNT_cjs.__name(tryTsconfigFilePath, "tryTsconfigFilePath");
476
+ chunkPK6SKIKE_cjs.__name(tryTsconfigFilePath, "tryTsconfigFilePath");
373
477
  function findMatch(tsconfigType, types, extensions = [
374
478
  ".ts",
375
479
  ".tsx",
@@ -377,7 +481,7 @@ function findMatch(tsconfigType, types, extensions = [
377
481
  ]) {
378
482
  return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
379
483
  }
380
- chunkUSNT2KNT_cjs.__name(findMatch, "findMatch");
484
+ chunkPK6SKIKE_cjs.__name(findMatch, "findMatch");
381
485
  function findIncludeMatch(tsconfigType, types) {
382
486
  return findMatch(tsconfigType, types, [
383
487
  ".ts",
@@ -409,18 +513,18 @@ function findIncludeMatch(tsconfigType, types) {
409
513
  "/**/*.cts"
410
514
  ]);
411
515
  }
412
- chunkUSNT2KNT_cjs.__name(findIncludeMatch, "findIncludeMatch");
516
+ chunkPK6SKIKE_cjs.__name(findIncludeMatch, "findIncludeMatch");
413
517
  function isIncludeMatchFound(tsconfigType, types) {
414
518
  return findIncludeMatch(tsconfigType, types) !== void 0;
415
519
  }
416
- chunkUSNT2KNT_cjs.__name(isIncludeMatchFound, "isIncludeMatchFound");
417
- function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts2__default.default.sys) {
520
+ chunkPK6SKIKE_cjs.__name(isIncludeMatchFound, "isIncludeMatchFound");
521
+ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts__default.default.sys) {
418
522
  const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
419
523
  const tsconfigJson = json.readJsonFileSync(tsconfigFilePath);
420
524
  if (!tsconfigJson) {
421
525
  throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths.joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
422
526
  }
423
- const parsedCommandLine = ts2__default.default.parseJsonConfigFileContent(defu6__default.default(tsconfigRaw ?? {}, tsconfigJson), host, append.appendPath(projectRoot, workspaceRoot));
527
+ const parsedCommandLine = ts__default.default.parseJsonConfigFileContent(defu7__default.default(tsconfigRaw ?? {}, tsconfigJson), host, append.appendPath(projectRoot, workspaceRoot));
424
528
  if (parsedCommandLine.errors.length > 0) {
425
529
  const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
426
530
  ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
@@ -434,7 +538,7 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
434
538
  tsconfigFilePath
435
539
  };
436
540
  }
437
- chunkUSNT2KNT_cjs.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
541
+ chunkPK6SKIKE_cjs.__name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
438
542
  async function writeFile(log, filepath, content, skipFormat = false) {
439
543
  try {
440
544
  if (skipFormat) {
@@ -452,7 +556,7 @@ async function writeFile(log, filepath, content, skipFormat = false) {
452
556
  ${error?.message ? error.message : ""}`);
453
557
  }
454
558
  }
455
- chunkUSNT2KNT_cjs.__name(writeFile, "writeFile");
559
+ chunkPK6SKIKE_cjs.__name(writeFile, "writeFile");
456
560
 
457
561
  // src/internal/helpers/resolve-tsconfig.ts
458
562
  async function resolveTsconfigChanges(context) {
@@ -461,15 +565,10 @@ async function resolveTsconfigChanges(context) {
461
565
  const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
462
566
  tsconfigJson.compilerOptions ??= {};
463
567
  if (context.config.output.dts !== false) {
464
- context.config.output.dts = context.config.output.dts ? isParentPath.isParentPath(context.config.output.dts, context.workspaceConfig.workspaceRoot) ? context.config.output.dts : append.appendPath(context.config.output.dts, context.workspaceConfig.workspaceRoot) : append.appendPath(context.config.projectRoot, context.workspaceConfig.workspaceRoot);
465
- if (filePathFns.findFileExtension(context.config.output.dts) !== "d.ts" && filePathFns.findFileExtension(context.config.output.dts) !== "d.cts" && filePathFns.findFileExtension(context.config.output.dts) !== "d.mts") {
466
- context.config.output.dts = joinPaths.joinPaths(context.config.output.dts, "powerlines.d.ts");
467
- }
468
- const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.config.output.dts)), filePathFns.findFileName(context.config.output.dts));
568
+ const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(context.dtsPath)), filePathFns.findFileName(context.dtsPath));
469
569
  if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
470
- String(context.config.output.dts),
471
- dtsRelativePath,
472
- "storm.d.ts"
570
+ context.dtsPath,
571
+ dtsRelativePath
473
572
  ]))) {
474
573
  tsconfigJson.include ??= [];
475
574
  tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
@@ -484,24 +583,6 @@ async function resolveTsconfigChanges(context) {
484
583
  tsconfigJson.compilerOptions.lib ??= [];
485
584
  tsconfigJson.compilerOptions.lib.push("esnext");
486
585
  }
487
- if (tsconfig.options.module !== ts2__default.default.ModuleKind.ESNext) {
488
- tsconfigJson.compilerOptions.module = "ESNext";
489
- }
490
- if (!tsconfig.options.target || ![
491
- ts2__default.default.ScriptTarget.ESNext,
492
- ts2__default.default.ScriptTarget.ES2024,
493
- ts2__default.default.ScriptTarget.ES2023,
494
- ts2__default.default.ScriptTarget.ES2022,
495
- ts2__default.default.ScriptTarget.ES2021
496
- ].includes(tsconfig.options.target)) {
497
- tsconfigJson.compilerOptions.target = "ESNext";
498
- }
499
- if (tsconfig.options.moduleResolution !== ts2__default.default.ModuleResolutionKind.Bundler) {
500
- tsconfigJson.compilerOptions.moduleResolution = "Bundler";
501
- }
502
- if (tsconfig.options.moduleDetection !== ts2__default.default.ModuleDetectionKind.Force) {
503
- tsconfigJson.compilerOptions.moduleDetection = "force";
504
- }
505
586
  if (tsconfig.options.esModuleInterop !== true) {
506
587
  tsconfigJson.compilerOptions.esModuleInterop = true;
507
588
  }
@@ -516,7 +597,7 @@ async function resolveTsconfigChanges(context) {
516
597
  }
517
598
  return tsconfigJson;
518
599
  }
519
- chunkUSNT2KNT_cjs.__name(resolveTsconfigChanges, "resolveTsconfigChanges");
600
+ chunkPK6SKIKE_cjs.__name(resolveTsconfigChanges, "resolveTsconfigChanges");
520
601
  async function initializeTsconfig(context) {
521
602
  context.log(types.LogLevelLabel.TRACE, "Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
522
603
  if (!packageFns.isPackageExists("typescript")) {
@@ -526,12 +607,10 @@ async function initializeTsconfig(context) {
526
607
  context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
527
608
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
528
609
  context.log(types.LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
529
- await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
530
- mode: "fs"
531
- });
610
+ await writeFile(context.log, tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson));
532
611
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
533
612
  }
534
- chunkUSNT2KNT_cjs.__name(initializeTsconfig, "initializeTsconfig");
613
+ chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
535
614
  async function resolveTsconfig(context) {
536
615
  const updateTsconfigJson = await json.readJsonFile(context.tsconfig.tsconfigFilePath);
537
616
  if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) {
@@ -549,7 +628,7 @@ async function resolveTsconfig(context) {
549
628
  }
550
629
  });
551
630
  const changes = [];
552
- const getChanges = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((difference, property) => {
631
+ const getChanges = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((difference, property) => {
553
632
  if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") {
554
633
  if (difference.diff) {
555
634
  for (const diff of difference.diff) {
@@ -585,10 +664,10 @@ async function resolveTsconfig(context) {
585
664
  context.tsconfig.tsconfigJson.compilerOptions ??= {};
586
665
  context.tsconfig.tsconfigJson.compilerOptions.strict = false;
587
666
  }
588
- chunkUSNT2KNT_cjs.__name(resolveTsconfig, "resolveTsconfig");
667
+ chunkPK6SKIKE_cjs.__name(resolveTsconfig, "resolveTsconfig");
589
668
  var DEFAULT_ENVIRONMENT = "default";
590
669
  function createEnvironment(name, userConfig) {
591
- return defu6__default.default(userConfig.environments?.[name] ?? {}, {
670
+ return defu7__default.default(userConfig.environments?.[name] ?? {}, {
592
671
  name,
593
672
  title: userConfig.title || titleCase.titleCase(userConfig.name),
594
673
  ssr: false,
@@ -626,13 +705,13 @@ function createEnvironment(name, userConfig) {
626
705
  } : void 0
627
706
  }, userConfig);
628
707
  }
629
- chunkUSNT2KNT_cjs.__name(createEnvironment, "createEnvironment");
708
+ chunkPK6SKIKE_cjs.__name(createEnvironment, "createEnvironment");
630
709
  function createDefaultEnvironment(userConfig) {
631
710
  return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
632
711
  }
633
- chunkUSNT2KNT_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
712
+ chunkPK6SKIKE_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
634
713
  async function loadWorkspaceConfig(workspaceRoot, cwd) {
635
- return defu6__default.default({
714
+ return defu7__default.default({
636
715
  workspaceRoot
637
716
  }, await getConfig.getWorkspaceConfig(true, {
638
717
  cwd,
@@ -640,7 +719,7 @@ async function loadWorkspaceConfig(workspaceRoot, cwd) {
640
719
  useDefault: true
641
720
  }));
642
721
  }
643
- chunkUSNT2KNT_cjs.__name(loadWorkspaceConfig, "loadWorkspaceConfig");
722
+ chunkPK6SKIKE_cjs.__name(loadWorkspaceConfig, "loadWorkspaceConfig");
644
723
  async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode = "production", configFile, framework = "powerlines") {
645
724
  let resolvedUserConfig = {};
646
725
  let resolvedUserConfigFile;
@@ -680,73 +759,72 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
680
759
  dotenv: true,
681
760
  jiti
682
761
  });
683
- return defu6__default.default(resolvedUserConfig, isSetObject.isSetObject(result?.config) ? {
762
+ return defu7__default.default(resolvedUserConfig, isSetObject.isSetObject(result?.config) ? {
684
763
  ...result.config,
685
764
  ...result
686
765
  } : {});
687
766
  }
688
- chunkUSNT2KNT_cjs.__name(loadUserConfigFile, "loadUserConfigFile");
767
+ chunkPK6SKIKE_cjs.__name(loadUserConfigFile, "loadUserConfigFile");
689
768
  function resolveOptions(options) {
690
- return defu6__default.default(options, {
691
- debug: options.logLevel === "trace",
769
+ return defu7__default.default(options, {
692
770
  interopDefault: true,
693
771
  fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
694
772
  moduleCache: options.mode !== "development"
695
773
  });
696
774
  }
697
- chunkUSNT2KNT_cjs.__name(resolveOptions, "resolveOptions");
775
+ chunkPK6SKIKE_cjs.__name(resolveOptions, "resolveOptions");
698
776
  function createPluginResolver(options) {
699
777
  return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
700
778
  ...options
701
779
  }));
702
780
  }
703
- chunkUSNT2KNT_cjs.__name(createPluginResolver, "createPluginResolver");
781
+ chunkPK6SKIKE_cjs.__name(createPluginResolver, "createPluginResolver");
704
782
  function createResolver(options) {
705
783
  const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
706
784
  baseResolver.plugin = createPluginResolver(options);
707
785
  return baseResolver;
708
786
  }
709
- chunkUSNT2KNT_cjs.__name(createResolver, "createResolver");
787
+ chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
710
788
  function isPlugin(value) {
711
- return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && chunkPAMSESZV_cjs.SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
789
+ return isSetObject.isSetObject(value) && "name" in value && isSetString.isSetString(value.name) && (isUndefined.isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction.isFunction(value.applyToEnvironment)) && (isUndefined.isUndefined(value.dedupe) || "dedupe" in value && isFunction.isFunction(value.dedupe)) && (isUndefined.isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && chunkZ6ARQDHR_cjs.SUPPORTED_COMMANDS.every((command) => isUndefined.isUndefined(value[command]) || command in value && (isFunction.isFunction(value[command]) || isSetObject.isSetObject(value[command]) && "handler" in value[command] && isFunction.isFunction(value[command].handler)));
712
790
  }
713
- chunkUSNT2KNT_cjs.__name(isPlugin, "isPlugin");
791
+ chunkPK6SKIKE_cjs.__name(isPlugin, "isPlugin");
714
792
  function isPluginConfigObject(value) {
715
793
  return isSetObject.isSetObject(value) && "plugin" in value && ((isSetString.isSetString(value.plugin) || isFunction.isFunction(value.plugin)) && "options" in value && isSetObject.isSetObject(value.options) || isPlugin(value.plugin));
716
794
  }
717
- chunkUSNT2KNT_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
795
+ chunkPK6SKIKE_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
718
796
  function isPluginConfigTuple(value) {
719
797
  return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString.isSetString(value[0]) || isFunction.isFunction(value[0])) && value.length > 1 && isSetObject.isSetObject(value[1]) || isPlugin(value[0]));
720
798
  }
721
- chunkUSNT2KNT_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
799
+ chunkPK6SKIKE_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
722
800
  function isPluginConfig(value) {
723
801
  return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
724
802
  }
725
- chunkUSNT2KNT_cjs.__name(isPluginConfig, "isPluginConfig");
803
+ chunkPK6SKIKE_cjs.__name(isPluginConfig, "isPluginConfig");
726
804
  function isPluginHookFunction(value) {
727
805
  return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
728
806
  }
729
- chunkUSNT2KNT_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
807
+ chunkPK6SKIKE_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
730
808
  function isPluginHookObject(value) {
731
809
  return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
732
810
  }
733
- chunkUSNT2KNT_cjs.__name(isPluginHookObject, "isPluginHookObject");
811
+ chunkPK6SKIKE_cjs.__name(isPluginHookObject, "isPluginHookObject");
734
812
  function isPluginHook(value) {
735
813
  return isPluginHookFunction(value) || isPluginHookObject(value);
736
814
  }
737
- chunkUSNT2KNT_cjs.__name(isPluginHook, "isPluginHook");
815
+ chunkPK6SKIKE_cjs.__name(isPluginHook, "isPluginHook");
738
816
  function getHookHandler(pluginHook) {
739
817
  return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
740
818
  }
741
- chunkUSNT2KNT_cjs.__name(getHookHandler, "getHookHandler");
819
+ chunkPK6SKIKE_cjs.__name(getHookHandler, "getHookHandler");
742
820
  function isHookExternal(hook) {
743
821
  return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
744
822
  }
745
- chunkUSNT2KNT_cjs.__name(isHookExternal, "isHookExternal");
823
+ chunkPK6SKIKE_cjs.__name(isHookExternal, "isHookExternal");
746
824
  function checkDedupe(plugin, plugins) {
747
825
  return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
748
826
  }
749
- chunkUSNT2KNT_cjs.__name(checkDedupe, "checkDedupe");
827
+ chunkPK6SKIKE_cjs.__name(checkDedupe, "checkDedupe");
750
828
  function addPluginHook(context, plugin, pluginHook, hooksList) {
751
829
  if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
752
830
  hooksList.push(isFunction.isFunction(pluginHook) ? {
@@ -759,29 +837,29 @@ function addPluginHook(context, plugin, pluginHook, hooksList) {
759
837
  });
760
838
  }
761
839
  }
762
- chunkUSNT2KNT_cjs.__name(addPluginHook, "addPluginHook");
840
+ chunkPK6SKIKE_cjs.__name(addPluginHook, "addPluginHook");
763
841
  function replacePathTokens(context, path) {
764
842
  if (!path) {
765
843
  return path;
766
844
  }
767
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{distPath}", context.config.output.distPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
845
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replace.replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replace.replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replace.replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
768
846
  }
769
- chunkUSNT2KNT_cjs.__name(replacePathTokens, "replacePathTokens");
847
+ chunkPK6SKIKE_cjs.__name(replacePathTokens, "replacePathTokens");
770
848
  function resolveEntryInputFile(context, typeDefinition) {
771
849
  return replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
772
850
  }
773
- chunkUSNT2KNT_cjs.__name(resolveEntryInputFile, "resolveEntryInputFile");
851
+ chunkPK6SKIKE_cjs.__name(resolveEntryInputFile, "resolveEntryInputFile");
774
852
  function resolveEntryInput(context, typeDefinition) {
775
853
  return {
776
854
  file: resolveEntryInputFile(context, typeDefinition),
777
855
  name: typeDefinition.name
778
856
  };
779
857
  }
780
- chunkUSNT2KNT_cjs.__name(resolveEntryInput, "resolveEntryInput");
858
+ chunkPK6SKIKE_cjs.__name(resolveEntryInput, "resolveEntryInput");
781
859
  function resolveEntryOutput(context, typeDefinition) {
782
860
  return replace.replaceExtension(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(replace.replacePath(typeDefinition.file, joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replace.replacePath(context.config.sourceRoot, context.config.projectRoot)));
783
861
  }
784
- chunkUSNT2KNT_cjs.__name(resolveEntryOutput, "resolveEntryOutput");
862
+ chunkPK6SKIKE_cjs.__name(resolveEntryOutput, "resolveEntryOutput");
785
863
  function resolveEntry(context, typeDefinition) {
786
864
  const input = resolveEntryInput(context, typeDefinition);
787
865
  return {
@@ -790,7 +868,7 @@ function resolveEntry(context, typeDefinition) {
790
868
  output: resolveEntryOutput(context, typeDefinition)
791
869
  };
792
870
  }
793
- chunkUSNT2KNT_cjs.__name(resolveEntry, "resolveEntry");
871
+ chunkPK6SKIKE_cjs.__name(resolveEntry, "resolveEntry");
794
872
  function resolveEntriesSync(context, typeDefinitions) {
795
873
  return typeDefinitions.map((entry) => isString.isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file)).map((typeDefinition) => {
796
874
  const parsed = parseTypeDefinition.parseTypeDefinition(typeDefinition);
@@ -807,30 +885,17 @@ function resolveEntriesSync(context, typeDefinitions) {
807
885
  }));
808
886
  }).flat().filter(Boolean);
809
887
  }
810
- chunkUSNT2KNT_cjs.__name(resolveEntriesSync, "resolveEntriesSync");
888
+ chunkPK6SKIKE_cjs.__name(resolveEntriesSync, "resolveEntriesSync");
811
889
  function getUniqueEntries(entries = []) {
812
890
  return getUnique.getUniqueBy(toArray.toArray(entries), (item) => isSetString.isSetString(item) ? item : murmurhash.murmurhash(item ?? {}, {
813
891
  maxLength: 24
814
892
  }));
815
893
  }
816
- chunkUSNT2KNT_cjs.__name(getUniqueEntries, "getUniqueEntries");
894
+ chunkPK6SKIKE_cjs.__name(getUniqueEntries, "getUniqueEntries");
817
895
  var _capnpFileId = BigInt("0xa56c61324b9d6e49");
818
- var FileType = {
819
- NORMAL: 0,
820
- BUILTIN: 1,
821
- ENTRY: 2,
822
- CHUNK: 3,
823
- PREBUILT: 4,
824
- ASSET: 5
825
- };
826
- var PreserveSignatureType = {
827
- STRICT: 0,
828
- ALLOW_EXTENSION: 1,
829
- EXPORTS_ONLY: 2
830
- };
831
896
  var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
832
897
  static {
833
- chunkUSNT2KNT_cjs.__name(this, "FileMetadata_KeyValuePair");
898
+ chunkPK6SKIKE_cjs.__name(this, "FileMetadata_KeyValuePair");
834
899
  }
835
900
  static _capnp = {
836
901
  displayName: "KeyValuePair",
@@ -855,13 +920,13 @@ var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
855
920
  };
856
921
  var FileMetadata = class _FileMetadata extends $__namespace.Struct {
857
922
  static {
858
- chunkUSNT2KNT_cjs.__name(this, "FileMetadata");
923
+ chunkPK6SKIKE_cjs.__name(this, "FileMetadata");
859
924
  }
860
925
  static KeyValuePair = FileMetadata_KeyValuePair;
861
926
  static _capnp = {
862
927
  displayName: "FileMetadata",
863
928
  id: "8e2cab5d7e28c7b3",
864
- size: new $__namespace.ObjectSize(8, 4),
929
+ size: new $__namespace.ObjectSize(8, 3),
865
930
  defaultType: "normal"
866
931
  };
867
932
  static _Properties;
@@ -876,7 +941,7 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
876
941
  $__namespace.utils.setText(0, value, this);
877
942
  }
878
943
  /**
879
- * The output mode of the file.
944
+ * The timestamp representing the file's creation date.
880
945
  *
881
946
  */
882
947
  get type() {
@@ -886,16 +951,6 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
886
951
  $__namespace.utils.setText(1, value, this);
887
952
  }
888
953
  /**
889
- * The timestamp representing the file's creation date.
890
- *
891
- */
892
- get mode() {
893
- return $__namespace.utils.getText(2, this);
894
- }
895
- set mode(value) {
896
- $__namespace.utils.setText(2, value, this);
897
- }
898
- /**
899
954
  * Additional metadata associated with the file.
900
955
  *
901
956
  */
@@ -906,22 +961,22 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
906
961
  $__namespace.utils.setUint32(0, value, this);
907
962
  }
908
963
  _adoptProperties(value) {
909
- $__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
964
+ $__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
910
965
  }
911
966
  _disownProperties() {
912
967
  return $__namespace.utils.disown(this.properties);
913
968
  }
914
969
  get properties() {
915
- return $__namespace.utils.getList(3, _FileMetadata._Properties, this);
970
+ return $__namespace.utils.getList(2, _FileMetadata._Properties, this);
916
971
  }
917
972
  _hasProperties() {
918
- return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
973
+ return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
919
974
  }
920
975
  _initProperties(length) {
921
- return $__namespace.utils.initList(3, _FileMetadata._Properties, length, this);
976
+ return $__namespace.utils.initList(2, _FileMetadata._Properties, length, this);
922
977
  }
923
978
  set properties(value) {
924
- $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
979
+ $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
925
980
  }
926
981
  toString() {
927
982
  return "FileMetadata_" + super.toString();
@@ -929,7 +984,7 @@ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
929
984
  };
930
985
  var FileId = class extends $__namespace.Struct {
931
986
  static {
932
- chunkUSNT2KNT_cjs.__name(this, "FileId");
987
+ chunkPK6SKIKE_cjs.__name(this, "FileId");
933
988
  }
934
989
  static _capnp = {
935
990
  displayName: "FileId",
@@ -956,13 +1011,13 @@ var FileId = class extends $__namespace.Struct {
956
1011
  return "FileId_" + super.toString();
957
1012
  }
958
1013
  };
959
- var FileData = class extends $__namespace.Struct {
1014
+ var FileStorage = class extends $__namespace.Struct {
960
1015
  static {
961
- chunkUSNT2KNT_cjs.__name(this, "FileData");
1016
+ chunkPK6SKIKE_cjs.__name(this, "FileStorage");
962
1017
  }
963
1018
  static _capnp = {
964
- displayName: "FileData",
965
- id: "fa6725c8a360f9a2",
1019
+ displayName: "FileStorage",
1020
+ id: "9dca66ac858c9ebe",
966
1021
  size: new $__namespace.ObjectSize(0, 2)
967
1022
  };
968
1023
  /**
@@ -982,12 +1037,12 @@ var FileData = class extends $__namespace.Struct {
982
1037
  $__namespace.utils.setText(1, value, this);
983
1038
  }
984
1039
  toString() {
985
- return "FileData_" + super.toString();
1040
+ return "FileStorage_" + super.toString();
986
1041
  }
987
1042
  };
988
1043
  var FileSystem = class _FileSystem extends $__namespace.Struct {
989
1044
  static {
990
- chunkUSNT2KNT_cjs.__name(this, "FileSystem");
1045
+ chunkPK6SKIKE_cjs.__name(this, "FileSystem");
991
1046
  }
992
1047
  static _capnp = {
993
1048
  displayName: "FileSystem",
@@ -995,7 +1050,7 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
995
1050
  size: new $__namespace.ObjectSize(0, 3)
996
1051
  };
997
1052
  static _Ids;
998
- static _Files;
1053
+ static _Storage;
999
1054
  static _Metadata;
1000
1055
  _adoptIds(value) {
1001
1056
  $__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
@@ -1015,22 +1070,22 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
1015
1070
  set ids(value) {
1016
1071
  $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
1017
1072
  }
1018
- _adoptFiles(value) {
1073
+ _adoptStorage(value) {
1019
1074
  $__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
1020
1075
  }
1021
- _disownFiles() {
1022
- return $__namespace.utils.disown(this.files);
1076
+ _disownStorage() {
1077
+ return $__namespace.utils.disown(this.storage);
1023
1078
  }
1024
- get files() {
1025
- return $__namespace.utils.getList(1, _FileSystem._Files, this);
1079
+ get storage() {
1080
+ return $__namespace.utils.getList(1, _FileSystem._Storage, this);
1026
1081
  }
1027
- _hasFiles() {
1082
+ _hasStorage() {
1028
1083
  return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
1029
1084
  }
1030
- _initFiles(length) {
1031
- return $__namespace.utils.initList(1, _FileSystem._Files, length, this);
1085
+ _initStorage(length) {
1086
+ return $__namespace.utils.initList(1, _FileSystem._Storage, length, this);
1032
1087
  }
1033
- set files(value) {
1088
+ set storage(value) {
1034
1089
  $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
1035
1090
  }
1036
1091
  _adoptMetadata(value) {
@@ -1057,9 +1112,9 @@ var FileSystem = class _FileSystem extends $__namespace.Struct {
1057
1112
  };
1058
1113
  FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
1059
1114
  FileSystem._Ids = $__namespace.CompositeList(FileId);
1060
- FileSystem._Files = $__namespace.CompositeList(FileData);
1115
+ FileSystem._Storage = $__namespace.CompositeList(FileStorage);
1061
1116
  FileSystem._Metadata = $__namespace.CompositeList(FileMetadata);
1062
- var createLog = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((name, options = {}) => {
1117
+ var createLog = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((name, options = {}) => {
1063
1118
  const logLevel = options.logLevel === null ? types.LogLevelLabel.SILENT : options.logLevel || types.LogLevelLabel.INFO;
1064
1119
  if (logLevel === types.LogLevelLabel.SILENT) {
1065
1120
  return noop.noop;
@@ -1094,319 +1149,399 @@ var BADGE_COLORS = [
1094
1149
  "#FACC15",
1095
1150
  "#34D399"
1096
1151
  ];
1097
- var extendLog = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((logFn, name) => {
1152
+ var extendLog = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((logFn, name) => {
1098
1153
  return (type, ...args) => logFn(type, ` ${chalk5__default.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase.titleCase(name)} `)} ${args.join(" ")} `);
1099
1154
  }, "extendLog");
1100
- function isBufferEncoding(options) {
1101
- return isSetString.isSetString(options) || options === null;
1102
- }
1103
- chunkUSNT2KNT_cjs.__name(isBufferEncoding, "isBufferEncoding");
1104
- function isPowerlinesWriteFileOptions(options) {
1105
- return !isBufferEncoding(options) && isSetObject.isSetObject(options) && "mode" in options && (options.mode === "fs" || options.mode === "virtual");
1155
+ function isFileError(err) {
1156
+ return isError.isError(err) && "code" in err && err.code;
1106
1157
  }
1107
- chunkUSNT2KNT_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
1108
- function isVirtualFileData(obj) {
1109
- return !!(isSetObject.isSetObject(obj) && "code" in obj && obj.code);
1158
+ chunkPK6SKIKE_cjs.__name(isFileError, "isFileError");
1159
+ function ignoreNotfound(err) {
1160
+ return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
1110
1161
  }
1111
- chunkUSNT2KNT_cjs.__name(isVirtualFileData, "isVirtualFileData");
1162
+ chunkPK6SKIKE_cjs.__name(ignoreNotfound, "ignoreNotfound");
1112
1163
  function toFilePath(path) {
1113
1164
  return correctPath.correctPath(slash.slash(path?.toString() || ".").replace(/^file:\/\//, ""));
1114
1165
  }
1115
- chunkUSNT2KNT_cjs.__name(toFilePath, "toFilePath");
1116
- var FS_METHODS = [
1117
- "mkdir",
1118
- "mkdirSync",
1119
- "rmdir",
1120
- "rmdirSync",
1121
- "unlink",
1122
- "unlinkSync",
1123
- "existsSync",
1124
- "realpathSync",
1125
- "writeFileSync",
1126
- "readFileSync",
1127
- "readdirSync",
1128
- "createWriteStream",
1129
- "WriteStream",
1130
- "createReadStream",
1131
- "ReadStream"
1132
- ];
1133
- var FS_PROMISE_METHODS = [
1134
- "mkdir",
1135
- "rm",
1136
- "rmdir",
1137
- "unlink",
1138
- "writeFile",
1139
- "readFile",
1140
- "readdir",
1141
- "stat",
1142
- "lstat"
1143
- ];
1144
- function cloneFS(originalFS) {
1145
- const clonedFS = {
1146
- ...originalFS,
1147
- promises: {
1148
- ...originalFS.promises ?? {}
1149
- }
1150
- };
1151
- for (const method of FS_METHODS) {
1152
- if (originalFS[method]) {
1153
- clonedFS[method] = originalFS[method];
1154
- }
1155
- }
1156
- originalFS.promises ??= {};
1157
- for (const method of FS_PROMISE_METHODS) {
1158
- if (originalFS.promises[method]) {
1159
- clonedFS.promises ??= {};
1160
- clonedFS.promises[method] = originalFS.promises[method];
1161
- clonedFS[method] = originalFS.promises[method];
1162
- }
1163
- }
1164
- for (const prop in clonedFS) {
1165
- if (isFunction.isFunction(clonedFS[prop])) {
1166
- clonedFS[prop] = clonedFS[prop].bind(originalFS);
1167
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1168
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1169
- }
1170
- }
1171
- }
1172
- for (const prop in clonedFS.promises) {
1173
- if (isFunction.isFunction(clonedFS.promises[prop])) {
1174
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
1175
- }
1176
- }
1177
- return clonedFS;
1178
- }
1179
- chunkUSNT2KNT_cjs.__name(cloneFS, "cloneFS");
1180
- function patchFS(originalFS, vfs) {
1181
- const clonedFS = cloneFS(originalFS);
1182
- originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
1183
- originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
1184
- originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
1185
- originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
1186
- originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
1187
- originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
1188
- originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
1189
- Object.defineProperty(originalFS, "realpathSync", {
1190
- value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
1191
- });
1192
- originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
1193
- originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
1194
- originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
1195
- originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
1196
- originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
1197
- originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
1198
- Object.defineProperty(originalFS, "statSync", {
1199
- value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
1200
- });
1201
- originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
1202
- originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
1203
- Object.defineProperty(originalFS, "lstatSync", {
1204
- value: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
1205
- });
1206
- originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
1207
- originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
1208
- return () => {
1209
- originalFS.mkdirSync = clonedFS.mkdirSync;
1210
- originalFS.mkdir = clonedFS.mkdir;
1211
- originalFS.promises.mkdir = clonedFS.promises.mkdir;
1212
- originalFS.unlinkSync = clonedFS.unlinkSync;
1213
- originalFS.promises.rm = clonedFS.promises.rm;
1214
- originalFS.promises.unlink = clonedFS.promises.unlink;
1215
- originalFS.existsSync = clonedFS.existsSync;
1216
- originalFS.realpathSync = clonedFS.realpathSync;
1217
- originalFS.writeFileSync = clonedFS.writeFileSync;
1218
- originalFS.promises.writeFile = clonedFS.promises.writeFile;
1219
- originalFS.readFileSync = clonedFS.readFileSync;
1220
- originalFS.promises.readFile = clonedFS.promises.readFile;
1221
- originalFS.readdirSync = clonedFS.readdirSync;
1222
- originalFS.promises.readdir = clonedFS.promises.readdir;
1223
- Object.defineProperty(originalFS, "statSync", {
1224
- value: clonedFS.statSync
1225
- });
1226
- originalFS.stat = clonedFS.stat;
1227
- originalFS.promises.stat = clonedFS.promises.stat;
1228
- Object.defineProperty(originalFS, "lstatSync", {
1229
- value: clonedFS.lstatSync
1230
- });
1231
- originalFS.lstat = clonedFS.lstat;
1232
- originalFS.promises.lstat = clonedFS.promises.lstat;
1233
- };
1234
- }
1235
- chunkUSNT2KNT_cjs.__name(patchFS, "patchFS");
1166
+ chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
1236
1167
  function isValidId(id, prefix = "powerlines") {
1237
1168
  return id.replace(/^\\0/, "").startsWith(`${prefix.replace(/:$/, "")}`);
1238
1169
  }
1239
- chunkUSNT2KNT_cjs.__name(isValidId, "isValidId");
1170
+ chunkPK6SKIKE_cjs.__name(isValidId, "isValidId");
1240
1171
  function normalizeId(id, prefix = "powerlines") {
1241
1172
  return `${prefix.replace(/:$/, "")}:${toFilePath(id).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(toFilePath(id)), "")}`;
1242
1173
  }
1243
- chunkUSNT2KNT_cjs.__name(normalizeId, "normalizeId");
1174
+ chunkPK6SKIKE_cjs.__name(normalizeId, "normalizeId");
1244
1175
  function normalizePath(path, builtinsPath, prefix = "powerlines") {
1245
- return isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
1176
+ return isType.isAbsolutePath(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
1246
1177
  }
1247
- chunkUSNT2KNT_cjs.__name(normalizePath, "normalizePath");
1248
- var UnifiedFS = class _UnifiedFS extends unionfs.Union {
1178
+ chunkPK6SKIKE_cjs.__name(normalizePath, "normalizePath");
1179
+ function normalizeKey(key, sep = ":") {
1180
+ if (!key) {
1181
+ return "";
1182
+ }
1183
+ return key.replace(/[:/\\]/g, sep).replace(/^[:/\\]|[:/\\]$/g, "");
1184
+ }
1185
+ chunkPK6SKIKE_cjs.__name(normalizeKey, "normalizeKey");
1186
+ function filterKeyByBase(key, base) {
1187
+ if (base) {
1188
+ return key.startsWith(base) && key[key.length - 1] !== "$";
1189
+ }
1190
+ return key[key.length - 1] !== "$";
1191
+ }
1192
+ chunkPK6SKIKE_cjs.__name(filterKeyByBase, "filterKeyByBase");
1193
+ var BaseStorageAdapter = class {
1249
1194
  static {
1250
- chunkUSNT2KNT_cjs.__name(this, "UnifiedFS");
1195
+ chunkPK6SKIKE_cjs.__name(this, "BaseStorageAdapter");
1251
1196
  }
1252
1197
  /**
1253
- * The internal map of virtual files.
1198
+ * Indicates whether the storage adapter has been disposed.
1254
1199
  */
1255
- #virtualFS = new memfs.Volume();
1200
+ #isDisposed = false;
1256
1201
  /**
1257
- * The physical file system.
1202
+ * Configuration options for the storage adapter.
1258
1203
  */
1259
- #physicalFS = cloneFS(_fs__default.default);
1204
+ options;
1260
1205
  /**
1261
- * The context of the unified file system.
1206
+ * Constructor for the BaseStorageAdapter.
1207
+ *
1208
+ * @param options - Configuration options for the storage adapter.
1262
1209
  */
1263
- #context;
1264
- static create(context, fs2) {
1265
- let result = new _UnifiedFS(context, fs2);
1266
- result = result.use(result.#physicalFS);
1267
- if (result.#context.config.output.mode !== "fs") {
1268
- result = result.use(result.#virtualFS);
1269
- }
1270
- return result;
1210
+ constructor(options = {
1211
+ base: "/"
1212
+ }) {
1213
+ this.options = options;
1214
+ this.options.base = path.resolve(options.base);
1215
+ this.options.isReadOnly = !!options.isReadOnly;
1271
1216
  }
1272
1217
  /**
1273
- * Gets the virtual file system (VFS).
1218
+ * Asynchronously checks if a key exists in the storage.
1219
+ *
1220
+ * @param key - The key to check for existence.
1221
+ * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
1274
1222
  */
1275
- get virtual() {
1276
- return this.#virtualFS;
1223
+ async exists(key) {
1224
+ return this.existsSync(key);
1277
1225
  }
1278
1226
  /**
1279
- * Gets the physical file system (FS).
1227
+ * Asynchronously retrieves the value associated with a given key.
1228
+ *
1229
+ * @param key - The key whose value is to be retrieved.
1230
+ * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
1280
1231
  */
1281
- get physical() {
1282
- return this.#physicalFS;
1232
+ async get(key) {
1233
+ return this.getSync(key);
1283
1234
  }
1284
1235
  /**
1285
- * Creates a new instance of the VirtualFileSystem.
1236
+ * Asynchronously sets the value for a given key.
1286
1237
  *
1287
- * @param context - The context of the virtual file system, typically containing options and logging functions.
1288
- * @param fs - A buffer containing the serialized virtual file system data.
1238
+ * @param key - The key to set the value for.
1239
+ * @param value - The value to set.
1289
1240
  */
1290
- constructor(context, fs2) {
1291
- super();
1292
- this.#context = context;
1293
- if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
1294
- this.#physicalFS.mkdirSync(this.#context.dataPath, {
1295
- recursive: true
1296
- });
1241
+ async set(key, value) {
1242
+ if (!this.options.isReadOnly) {
1243
+ this.setSync(key, value);
1297
1244
  }
1298
- if (!this.#physicalFS.existsSync(this.#context.cachePath)) {
1299
- this.#physicalFS.mkdirSync(this.#context.cachePath, {
1300
- recursive: true
1301
- });
1302
- }
1303
- if (!this.#physicalFS.existsSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.distPath))) {
1304
- this.#physicalFS.mkdirSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.distPath), {
1305
- recursive: true
1306
- });
1245
+ }
1246
+ /**
1247
+ * Asynchronously removes a key from the storage.
1248
+ *
1249
+ * @param key - The key to remove.
1250
+ */
1251
+ async remove(key) {
1252
+ if (!this.options.isReadOnly) {
1253
+ this.removeSync(key);
1307
1254
  }
1308
- if (this.#context.config.output.mode !== "fs") {
1309
- this.#virtualFS = memfs.Volume.fromJSON(fs2._hasFiles() && fs2.files.length > 0 ? fs2.files.values().reduce((ret, file) => {
1310
- ret[file.path] = file.code;
1311
- return ret;
1312
- }, {}) : {});
1313
- if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
1314
- this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
1315
- recursive: true
1316
- });
1317
- }
1318
- if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
1319
- this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
1320
- recursive: true
1321
- });
1322
- }
1323
- if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
1324
- this.#virtualFS.mkdirSync(this.#context.entryPath, {
1325
- recursive: true
1326
- });
1327
- }
1328
- if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
1329
- this.#virtualFS.mkdirSync(this.#context.dtsPath, {
1330
- recursive: true
1331
- });
1332
- }
1333
- } else if (this.#context.config.projectType === "application") {
1334
- if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
1335
- this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
1336
- recursive: true
1337
- });
1338
- }
1339
- if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
1340
- this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
1341
- recursive: true
1342
- });
1255
+ }
1256
+ /**
1257
+ * Synchronously removes all entries from the storage that match the provided base path.
1258
+ *
1259
+ * @param base - The base path to clear keys from.
1260
+ */
1261
+ clearSync(base) {
1262
+ if (!this.options.isReadOnly) {
1263
+ const keys = this.listSync(base || this.options.base);
1264
+ if (!keys.length) {
1265
+ return;
1343
1266
  }
1344
- if (!this.#physicalFS.existsSync(this.#context.entryPath)) {
1345
- this.#physicalFS.mkdirSync(this.#context.entryPath, {
1346
- recursive: true
1347
- });
1267
+ keys.map((key) => this.removeSync(base && !key.startsWith(base) ? join.joinPaths(base, key) : key));
1268
+ }
1269
+ }
1270
+ /**
1271
+ * Asynchronously removes all entries from the storage that match the provided base path.
1272
+ *
1273
+ * @param base - The base path to clear keys from.
1274
+ * @returns A promise that resolves when the operation is complete.
1275
+ */
1276
+ async clear(base) {
1277
+ if (!this.options.isReadOnly) {
1278
+ const keys = await this.list(base || this.options.base);
1279
+ if (!keys.length) {
1280
+ return;
1348
1281
  }
1349
- if (!this.#physicalFS.existsSync(this.#context.dtsPath)) {
1350
- this.#physicalFS.mkdirSync(this.#context.dtsPath, {
1351
- recursive: true
1352
- });
1282
+ await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? join.joinPaths(base, key) : key)));
1283
+ }
1284
+ }
1285
+ /**
1286
+ * Asynchronously lists all keys under a given base path.
1287
+ *
1288
+ * @param base - The base path to list keys from.
1289
+ * @returns A promise that resolves to an array of keys under the specified base path.
1290
+ */
1291
+ async list(base) {
1292
+ return this.listSync(base);
1293
+ }
1294
+ /**
1295
+ * Disposes of the storage adapter, releasing any held resources.
1296
+ *
1297
+ * @returns A promise that resolves when the disposal is complete.
1298
+ */
1299
+ dispose() {
1300
+ return Promise.resolve();
1301
+ }
1302
+ /**
1303
+ * Async dispose method to clean up resources.
1304
+ *
1305
+ * @returns A promise that resolves when disposal is complete.
1306
+ */
1307
+ async [Symbol.asyncDispose]() {
1308
+ return this._dispose();
1309
+ }
1310
+ /**
1311
+ * Resolves a given key to its full path within the storage adapter.
1312
+ *
1313
+ * @param key - The key to resolve.
1314
+ * @returns The resolved full path for the key.
1315
+ */
1316
+ resolve(key = this.options.base) {
1317
+ if (/\.\.:|\.\.$/.test(key)) {
1318
+ throw new Error(`[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`);
1319
+ }
1320
+ return append.appendPath(correctPath.correctPath(key).replace(/:/g, "/"), this.options.base);
1321
+ }
1322
+ /**
1323
+ * Disposes of the storage adapter, releasing any held resources.
1324
+ *
1325
+ * @returns A promise that resolves when the disposal is complete.
1326
+ */
1327
+ async _dispose() {
1328
+ if (!this.#isDisposed) {
1329
+ await Promise.resolve(this.dispose());
1330
+ this.#isDisposed = true;
1331
+ }
1332
+ }
1333
+ };
1334
+
1335
+ // src/lib/fs/storage/file-system.ts
1336
+ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1337
+ static {
1338
+ chunkPK6SKIKE_cjs.__name(this, "FileSystemStorageAdapter");
1339
+ }
1340
+ /**
1341
+ * A name identifying the storage adapter type.
1342
+ */
1343
+ name = "file-system";
1344
+ /**
1345
+ * Constructor for the FileSystemStorageAdapter.
1346
+ *
1347
+ * @param options - Configuration options for the storage adapter.
1348
+ */
1349
+ constructor(options) {
1350
+ super(options);
1351
+ }
1352
+ /**
1353
+ * Synchronously checks if a key exists in the storage.
1354
+ *
1355
+ * @param key - The key to check for existence.
1356
+ * @returns Returns `true` if the key exists, otherwise `false`.
1357
+ */
1358
+ existsSync(key) {
1359
+ return exists.existsSync(this.resolve(key));
1360
+ }
1361
+ /**
1362
+ * Asynchronously checks if a key exists in the storage.
1363
+ *
1364
+ * @param key - The key to check for existence.
1365
+ * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
1366
+ */
1367
+ async exists(key) {
1368
+ return exists.exists(this.resolve(key));
1369
+ }
1370
+ /**
1371
+ * Synchronously retrieves the value associated with a given key.
1372
+ *
1373
+ * @param key - The key whose value is to be retrieved.
1374
+ * @returns The value associated with the key, or `null` if the key does not exist.
1375
+ */
1376
+ getSync(key) {
1377
+ return readFile.readFileSync(this.resolve(key));
1378
+ }
1379
+ /**
1380
+ * Asynchronously retrieves the value associated with a given key.
1381
+ *
1382
+ * @param key - The key whose value is to be retrieved.
1383
+ * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
1384
+ */
1385
+ async get(key) {
1386
+ return readFile.readFile(this.resolve(key));
1387
+ }
1388
+ /**
1389
+ * Synchronously sets the value for a given key.
1390
+ *
1391
+ * @param key - The key to set the value for.
1392
+ * @param value - The value to set.
1393
+ */
1394
+ setSync(key, value) {
1395
+ if (!this.options.isReadOnly) {
1396
+ return writeFile$1.writeFileSync(this.resolve(key), value);
1397
+ }
1398
+ }
1399
+ /**
1400
+ * Asynchronously sets the value for a given key.
1401
+ *
1402
+ * @param key - The key to set the value for.
1403
+ * @param value - The value to set.
1404
+ */
1405
+ async set(key, value) {
1406
+ if (!this.options.isReadOnly) {
1407
+ return writeFile$1.writeFile(this.resolve(key), value);
1408
+ }
1409
+ }
1410
+ /**
1411
+ * Synchronously removes a key from the storage.
1412
+ *
1413
+ * @param key - The key to remove.
1414
+ */
1415
+ removeSync(key) {
1416
+ if (!this.options.isReadOnly) {
1417
+ try {
1418
+ return fs.unlinkSync(this.resolve(key));
1419
+ } catch (err) {
1420
+ return ignoreNotfound(err);
1353
1421
  }
1354
1422
  }
1355
1423
  }
1356
1424
  /**
1357
- * Select the file system module to use for the operation based on the path or URL.
1425
+ * Asynchronously removes a key from the storage.
1358
1426
  *
1359
- * @param pathOrUrl - The path to perform the file system operation on.
1360
- * @param options - Options for the operation, such as output mode.
1361
- * @returns The file system module used for the operation.
1427
+ * @param key - The key to remove.
1362
1428
  */
1363
- resolveFS(pathOrUrl, options = {}) {
1364
- const mode = this.resolveMode(pathOrUrl, options);
1365
- if (mode === "virtual") {
1366
- return {
1367
- ...this.#virtualFS,
1368
- mode: "virtual"
1369
- };
1370
- } else if (mode === "fs") {
1371
- return {
1372
- ...this.#physicalFS,
1373
- mode: "fs"
1374
- };
1429
+ async remove(key) {
1430
+ if (!this.options.isReadOnly) {
1431
+ return promises.unlink(this.resolve(key)).catch(ignoreNotfound);
1375
1432
  }
1376
- return {
1377
- ...this,
1378
- mode: this.#context.config.output.mode
1379
- };
1380
1433
  }
1381
1434
  /**
1382
- * Select the file system module to use for the operation based on the path or URL.
1435
+ * Lists all keys under a given base path synchronously.
1383
1436
  *
1384
- * @param pathOrUrl - The path to perform the file system operation on.
1385
- * @param options - Options for the operation, such as output mode.
1386
- * @returns The file system module used for the operation.
1437
+ * @param base - The base path to list keys from.
1438
+ * @returns An array of keys under the specified base path.
1387
1439
  */
1388
- resolveMode(pathOrUrl, options = {}) {
1389
- if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
1390
- return "virtual";
1391
- } 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), join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.distPath))) {
1392
- return "fs";
1440
+ listSync(base) {
1441
+ try {
1442
+ return listFiles.listFilesSync(this.resolve(base), {
1443
+ ignore: this.options.ignore
1444
+ });
1445
+ } catch (err) {
1446
+ return ignoreNotfound(err) ?? [];
1393
1447
  }
1394
- return void 0;
1395
1448
  }
1396
1449
  /**
1397
- * Serializes the virtual file system (VFS) to a JSON object.
1450
+ * Asynchronously lists all keys under a given base path.
1398
1451
  *
1399
- * @returns A JSON representation of the virtual file system.
1452
+ * @param base - The base path to list keys from.
1453
+ * @returns A promise that resolves to an array of keys under the specified base path.
1400
1454
  */
1401
- toJSON() {
1402
- return this.#virtualFS.toJSON();
1455
+ async list(base) {
1456
+ return listFiles.listFiles(this.resolve(base), {
1457
+ ignore: this.options.ignore
1458
+ }).catch(ignoreNotfound).then((r) => r || []);
1459
+ }
1460
+ };
1461
+ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1462
+ static {
1463
+ chunkPK6SKIKE_cjs.__name(this, "VirtualStorageAdapter");
1464
+ }
1465
+ /**
1466
+ * A name identifying the storage adapter type.
1467
+ */
1468
+ name = "virtual";
1469
+ /**
1470
+ * In-memory data storage.
1471
+ */
1472
+ data = /* @__PURE__ */ new Map();
1473
+ /**
1474
+ * Constructor for the VirtualStorageAdapter.
1475
+ *
1476
+ * @param options - Configuration options for the storage adapter.
1477
+ */
1478
+ constructor(options) {
1479
+ super(options);
1480
+ }
1481
+ /**
1482
+ * Synchronously checks if a key exists in the storage.
1483
+ *
1484
+ * @param key - The key to check for existence.
1485
+ * @returns Returns `true` if the key exists, otherwise `false`.
1486
+ */
1487
+ existsSync(key) {
1488
+ return this.data.has(this.resolve(key));
1489
+ }
1490
+ /**
1491
+ * Synchronously retrieves the value associated with a given key.
1492
+ *
1493
+ * @param key - The key whose value is to be retrieved.
1494
+ * @returns The value associated with the key, or `null` if the key does not exist.
1495
+ */
1496
+ getSync(key) {
1497
+ return this.data.get(this.resolve(key)) ?? null;
1498
+ }
1499
+ /**
1500
+ * Synchronously sets the value for a given key.
1501
+ *
1502
+ * @param key - The key to set the value for.
1503
+ * @param value - The value to set.
1504
+ */
1505
+ setSync(key, value) {
1506
+ if (!this.options.isReadOnly) {
1507
+ this.data.set(this.resolve(key), value);
1508
+ }
1509
+ }
1510
+ /**
1511
+ * Synchronously removes a key from the storage.
1512
+ *
1513
+ * @param key - The key to remove.
1514
+ */
1515
+ removeSync(key) {
1516
+ if (!this.options.isReadOnly) {
1517
+ this.data.delete(this.resolve(key));
1518
+ }
1519
+ }
1520
+ /**
1521
+ * Lists all keys under a given base path synchronously.
1522
+ *
1523
+ * @param base - The base path to list keys from.
1524
+ * @returns An array of keys under the specified base path.
1525
+ */
1526
+ listSync(base) {
1527
+ return [
1528
+ ...this.data.keys().filter((key) => !base ? true : isParentPath.isParentPath(key, this.resolve(base)))
1529
+ ];
1530
+ }
1531
+ /**
1532
+ * Disposes of the storage adapter, releasing any held resources.
1533
+ *
1534
+ * @returns A promise that resolves when the disposal is complete.
1535
+ */
1536
+ async dispose() {
1537
+ return this.clear();
1403
1538
  }
1404
1539
  };
1405
1540
 
1406
1541
  // src/lib/fs/vfs.ts
1407
1542
  var VirtualFileSystem = class _VirtualFileSystem {
1408
1543
  static {
1409
- chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystem");
1544
+ chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
1410
1545
  }
1411
1546
  /**
1412
1547
  * A map of virtual file IDs to their associated metadata.
@@ -1421,29 +1556,23 @@ var VirtualFileSystem = class _VirtualFileSystem {
1421
1556
  */
1422
1557
  #paths;
1423
1558
  /**
1424
- * A cache for module resolution results.
1425
- */
1426
- #resolverCache;
1427
- /**
1428
1559
  * The unified volume that combines the virtual file system with the real file system.
1429
1560
  *
1430
1561
  * @remarks
1431
1562
  * This volume allows for seamless access to both virtual and real files.
1432
1563
  */
1433
- #unifiedFS;
1564
+ #storage = {
1565
+ "": new FileSystemStorageAdapter()
1566
+ };
1434
1567
  /**
1435
- * Indicator specifying if the file system module is patched
1568
+ * A cache for module resolution results.
1436
1569
  */
1437
- #isPatched = false;
1570
+ #resolverCache;
1438
1571
  /**
1439
1572
  * Indicator specifying if the virtual file system (VFS) is disposed
1440
1573
  */
1441
1574
  #isDisposed = false;
1442
1575
  /**
1443
- * Function to revert require patch
1444
- */
1445
- #revert;
1446
- /**
1447
1576
  * The context of the virtual file system.
1448
1577
  */
1449
1578
  #context;
@@ -1452,15 +1581,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
1452
1581
  */
1453
1582
  #log;
1454
1583
  /**
1455
- * Checks if a path exists in the virtual file system (VFS).
1456
- *
1457
- * @param path - The path to check.
1458
- * @returns `true` if the path exists, otherwise `false`.
1459
- */
1460
- #existsSync(path) {
1461
- return this.#unifiedFS.virtual.existsSync(this.#normalizePath(path)) || this.#unifiedFS.physical.existsSync(this.#normalizePath(path)) || this.#unifiedFS.resolveFS(path).existsSync(this.#normalizePath(path));
1462
- }
1463
- /**
1464
1584
  * Normalizes a given module id by resolving it against the built-ins path.
1465
1585
  *
1466
1586
  * @param id - The module id to normalize.
@@ -1489,6 +1609,43 @@ var VirtualFileSystem = class _VirtualFileSystem {
1489
1609
  return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1490
1610
  }
1491
1611
  /**
1612
+ * Gets the storage adapter and relative key for a given key.
1613
+ *
1614
+ * @param key - The key to get the storage adapter for.
1615
+ * @returns The storage adapter and relative key for the given key.
1616
+ */
1617
+ #getStorage(key) {
1618
+ const path = this.resolveSync(this.#normalizePath(key)) || key;
1619
+ for (const base of Object.keys(this.#storage).filter(Boolean).sort().reverse()) {
1620
+ if (isParentPath.isParentPath(path, base)) {
1621
+ return {
1622
+ base,
1623
+ relativeKey: replace.replacePath(path, base),
1624
+ adapter: this.#storage[base]
1625
+ };
1626
+ }
1627
+ }
1628
+ return {
1629
+ base: "",
1630
+ relativeKey: path,
1631
+ adapter: this.#storage[""]
1632
+ };
1633
+ }
1634
+ /**
1635
+ * Gets all storage adapters that match a given base key.
1636
+ *
1637
+ * @param base - The base key to match storage adapters against.
1638
+ * @param includeParent - Whether to include parent storage adapters.
1639
+ * @returns An array of storage adapters that match the given base key.
1640
+ */
1641
+ #getStorages(base = "", includeParent = false) {
1642
+ return Object.keys(this.#storage).sort().reverse().filter((key) => isParentPath.isParentPath(key, base) || includeParent && isParentPath.isParentPath(base, key)).map((key) => ({
1643
+ relativeBase: base.length > key.length ? base.slice(key.length) : void 0,
1644
+ base: key,
1645
+ adapter: this.#storage[key]
1646
+ }));
1647
+ }
1648
+ /**
1492
1649
  * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1493
1650
  *
1494
1651
  * @param context - The context of the virtual file system, typically containing options and logging functions.
@@ -1498,7 +1655,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
1498
1655
  if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
1499
1656
  const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.dataPath, "fs.bin"));
1500
1657
  const message2 = new $__namespace.Message(buffer$1, false);
1501
- return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
1658
+ const fs = message2.getRoot(FileSystem);
1659
+ const result = new _VirtualFileSystem(context, fs);
1660
+ if (fs._hasStorage() && fs.storage.length > 0) {
1661
+ await Promise.all(fs.storage.values().map(async (file) => {
1662
+ await result.write(file.path, file.code);
1663
+ }));
1664
+ }
1502
1665
  }
1503
1666
  const message = new $__namespace.Message();
1504
1667
  return new _VirtualFileSystem(context, message.initRoot(FileSystem));
@@ -1513,7 +1676,13 @@ var VirtualFileSystem = class _VirtualFileSystem {
1513
1676
  if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.dataPath, "fs.bin"))) {
1514
1677
  const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.dataPath, "fs.bin"));
1515
1678
  const message2 = new $__namespace.Message(buffer$1, false);
1516
- return new _VirtualFileSystem(context, message2.getRoot(FileSystem));
1679
+ const fs = message2.getRoot(FileSystem);
1680
+ const result = new _VirtualFileSystem(context, fs);
1681
+ if (fs._hasStorage() && fs.storage.length > 0) {
1682
+ fs.storage.values().map((file) => {
1683
+ result.writeSync(file.path, file.code);
1684
+ });
1685
+ }
1517
1686
  }
1518
1687
  const message = new $__namespace.Message();
1519
1688
  return new _VirtualFileSystem(context, message.initRoot(FileSystem));
@@ -1523,7 +1692,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1523
1692
  */
1524
1693
  get metadata() {
1525
1694
  return new Proxy(this.#metadata, {
1526
- get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
1695
+ get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
1527
1696
  return target[this.#normalizeId(prop)];
1528
1697
  }, "get")
1529
1698
  });
@@ -1533,7 +1702,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1533
1702
  */
1534
1703
  get ids() {
1535
1704
  return new Proxy(this.#paths, {
1536
- get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
1705
+ get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
1537
1706
  return target[this.#normalizePath(prop)];
1538
1707
  }, "get")
1539
1708
  });
@@ -1543,11 +1712,14 @@ var VirtualFileSystem = class _VirtualFileSystem {
1543
1712
  */
1544
1713
  get paths() {
1545
1714
  return new Proxy(this.#paths, {
1546
- get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
1715
+ get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
1547
1716
  return target[this.#normalizeId(prop)];
1548
1717
  }, "get")
1549
1718
  });
1550
1719
  }
1720
+ /**
1721
+ * Gets the resolver cache.
1722
+ */
1551
1723
  get resolverCache() {
1552
1724
  if (!this.#resolverCache) {
1553
1725
  this.#resolverCache = flatCache.create({
@@ -1566,16 +1738,34 @@ var VirtualFileSystem = class _VirtualFileSystem {
1566
1738
  * @param context - The context of the virtual file system, typically containing options and logging functions.
1567
1739
  * @param fs - A buffer containing the serialized virtual file system data.
1568
1740
  */
1569
- constructor(context, fs2) {
1741
+ constructor(context, fs) {
1570
1742
  this.#context = context;
1571
- this.#unifiedFS = UnifiedFS.create(context, fs2);
1743
+ if (isSetObject.isSetObject(this.#context.config.output.storage)) {
1744
+ this.#storage = {
1745
+ ...this.#storage,
1746
+ ...this.#context.config.output.storage
1747
+ };
1748
+ }
1749
+ this.#storage.virtual ??= new VirtualStorageAdapter({
1750
+ base: "/_virtual"
1751
+ });
1752
+ if (this.#context.config.output.storage !== chunkMBBNZS6K_cjs.StoragePreset.FS) {
1753
+ this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter({
1754
+ base: this.#context.artifactsPath
1755
+ });
1756
+ this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter({
1757
+ base: this.#context.builtinsPath
1758
+ });
1759
+ this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter({
1760
+ base: this.#context.entryPath
1761
+ });
1762
+ }
1572
1763
  this.#metadata = {};
1573
- if (fs2._hasMetadata()) {
1574
- this.#metadata = fs2.metadata.values().reduce((ret, metadata) => {
1764
+ if (fs._hasMetadata()) {
1765
+ this.#metadata = fs.metadata.values().reduce((ret, metadata) => {
1575
1766
  ret[metadata.id] = {
1576
1767
  id: metadata.id,
1577
1768
  type: metadata.type,
1578
- mode: metadata.mode,
1579
1769
  timestamp: metadata.timestamp || Date.now(),
1580
1770
  properties: metadata._hasProperties() ? metadata.properties.values().reduce((ret2, item) => {
1581
1771
  ret2[item.key] = item.value;
@@ -1587,12 +1777,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
1587
1777
  }
1588
1778
  this.#ids = {};
1589
1779
  this.#paths = {};
1590
- if (fs2._hasIds()) {
1591
- this.#ids = fs2.ids.values().reduce((ret, identifier) => {
1780
+ if (fs._hasIds()) {
1781
+ this.#ids = fs.ids.values().reduce((ret, identifier) => {
1592
1782
  ret[identifier.path] ??= identifier.id;
1593
1783
  return ret;
1594
1784
  }, {});
1595
- this.#paths = fs2.ids.values().reduce((ret, identifier) => {
1785
+ this.#paths = fs.ids.values().reduce((ret, identifier) => {
1596
1786
  ret[identifier.id] ??= identifier.path;
1597
1787
  return ret;
1598
1788
  }, {});
@@ -1600,187 +1790,123 @@ var VirtualFileSystem = class _VirtualFileSystem {
1600
1790
  this.#log = extendLog(this.#context.log, "file-system");
1601
1791
  }
1602
1792
  /**
1603
- * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
1793
+ * Asynchronously checks if a file exists in the virtual file system (VFS).
1604
1794
  *
1605
- * @param pathOrId - The path or id to check.
1606
- * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
1607
- */
1608
- isVirtual(pathOrId, importer, options = {}) {
1609
- if (!pathOrId) {
1610
- return false;
1611
- }
1612
- const resolvedPath = this.resolveSync(pathOrId, importer, options);
1613
- if (!resolvedPath) {
1614
- return false;
1615
- }
1616
- return this.metadata[resolvedPath]?.mode === "virtual";
1617
- }
1618
- /**
1619
- * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
1620
- *
1621
- * @param pathOrId - The path or id to check.
1622
- * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
1623
- */
1624
- isPhysical(pathOrId, importer, options = {}) {
1625
- if (!pathOrId) {
1626
- return false;
1627
- }
1628
- const resolvedPath = this.resolveSync(pathOrId, importer, options);
1629
- if (!resolvedPath) {
1630
- return false;
1631
- }
1632
- return this.metadata[resolvedPath]?.mode === "fs";
1633
- }
1634
- /**
1635
- * Lists files in a given path.
1636
- *
1637
- * @param path - The path to list files from.
1638
- * @param options - Options for listing files, such as encoding and recursion.
1639
- * @returns An array of file names in the specified path.
1640
- */
1641
- readdirSync(path, options = "utf8") {
1642
- return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
1643
- }
1644
- /**
1645
- * Removes a file in the virtual file system (VFS).
1646
- *
1647
- * @param path - The path to create the directory at.
1648
- */
1649
- unlinkSync(path, options) {
1650
- if (!this.isFile(this.#normalizePath(path))) {
1651
- return;
1652
- }
1653
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${this.#normalizePath(path)}`);
1654
- this.#unifiedFS.resolveFS(path, options).unlinkSync(this.#normalizePath(path));
1655
- if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
1656
- delete this.#metadata[this.#ids[this.#normalizePath(path)]];
1657
- delete this.#ids[this.#normalizePath(path)];
1658
- delete this.#paths[this.#normalizeId(path)];
1659
- this.#resolverCache.delete(this.#normalizePath(path));
1660
- }
1661
- }
1662
- /**
1663
- * Removes a file in the virtual file system (VFS).
1664
- *
1665
- * @param path - The path to create the directory at.
1795
+ * @param path - The path to the file.
1796
+ * @returns A promise that resolves to `true` if the file exists, otherwise `false`.
1666
1797
  */
1667
- async unlink(path, options) {
1668
- if (!this.isFile(this.#normalizePath(path))) {
1669
- return;
1670
- }
1671
- this.#log(types.LogLevelLabel.TRACE, `Removing file: ${this.#normalizePath(path)}`);
1672
- if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
1673
- await this.#unifiedFS.resolveFS(path, options).promises.unlink(this.#normalizePath(path));
1674
- if (this.#ids[this.#normalizePath(path)] && this.#metadata[this.#ids[this.#normalizePath(path)]]) {
1675
- delete this.#metadata[this.#ids[this.#normalizePath(path)]];
1676
- }
1677
- } else {
1678
- this.unlinkSync(this.#normalizePath(path), options);
1679
- }
1798
+ async exists(path) {
1799
+ const { relativeKey, adapter } = this.#getStorage(path);
1800
+ return adapter.exists(relativeKey);
1680
1801
  }
1681
1802
  /**
1682
- * Removes a directory in the virtual file system (VFS).
1803
+ * Synchronously checks if a file exists in the virtual file system (VFS).
1683
1804
  *
1684
- * @param path - The path to create the directory at.
1685
- * @param options - Options for creating the directory.
1805
+ * @param path - The path to the file.
1806
+ * @returns `true` if the file exists, otherwise `false`.
1686
1807
  */
1687
- rmdirSync(path, options = {}) {
1688
- if (!this.isDirectory(this.#normalizePath(path))) {
1689
- return;
1690
- }
1691
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${this.#normalizePath(path)}`);
1692
- this.#unifiedFS.resolveFS(path, options).rmdirSync(this.#normalizePath(path), defu6__default.default(options, {
1693
- recursive: true
1694
- }));
1808
+ existsSync(path) {
1809
+ const { relativeKey, adapter } = this.#getStorage(path);
1810
+ return adapter.existsSync(relativeKey);
1695
1811
  }
1696
1812
  /**
1697
- * Removes a directory in the virtual file system (VFS).
1813
+ * Checks if a file is virtual in the virtual file system (VFS).
1698
1814
  *
1699
- * @param path - The path to create the directory at.
1700
- * @param options - Options for creating the directory.
1701
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
1815
+ * @param path - The path to the file.
1816
+ * @returns `true` if the file is virtual, otherwise `false`.
1702
1817
  */
1703
- async rmdir(path, options = {}) {
1704
- if (!this.isDirectory(this.#normalizePath(path))) {
1705
- return;
1706
- }
1707
- this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${this.#normalizePath(path)}`);
1708
- if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
1709
- await this.#unifiedFS.resolveFS(path, options).promises.rm(this.#normalizePath(path), defu6__default.default(options, {
1710
- force: true,
1711
- recursive: true
1712
- }));
1713
- } else {
1714
- this.rmdirSync(this.#normalizePath(path), defu6__default.default(options ?? {}, {
1715
- force: true,
1716
- recursive: true
1717
- }));
1818
+ isVirtual(path) {
1819
+ const resolved = this.resolveSync(path);
1820
+ if (!resolved) {
1821
+ return false;
1718
1822
  }
1823
+ return this.#getStorage(resolved)?.adapter?.name === "virtual";
1719
1824
  }
1720
1825
  /**
1721
- * Removes a file in the virtual file system (VFS).
1826
+ * Lists files in a given path.
1722
1827
  *
1723
- * @param path - The path to the file to remove.
1724
- * @param options - Options for removing the file.
1725
- * @returns A promise that resolves when the file is removed.
1828
+ * @param path - The path to list files from.
1829
+ * @returns An array of file names in the specified path.
1726
1830
  */
1727
- async rm(path, options = {}) {
1728
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
1729
- if (this.isDirectory(this.#normalizePath(path))) {
1730
- return this.rmdir(this.#normalizePath(path), options);
1831
+ listSync(path) {
1832
+ let maskedMounts = [];
1833
+ const allKeys = [];
1834
+ for (const storage of this.#getStorages(path, true)) {
1835
+ for (const key of storage.adapter.listSync(storage.relativeBase)) {
1836
+ if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
1837
+ allKeys.push(`${storage.base}${normalizeKey(key)}`);
1838
+ }
1839
+ }
1840
+ maskedMounts = [
1841
+ storage.base,
1842
+ ...maskedMounts.filter((p) => !p.startsWith(storage.base))
1843
+ ];
1731
1844
  }
1732
- return this.unlink(this.#normalizePath(path), options);
1845
+ return allKeys.filter((key) => filterKeyByBase(key, path));
1733
1846
  }
1734
1847
  /**
1735
- * Synchronously removes a file or directory in the virtual file system (VFS).
1848
+ * Lists files in a given path.
1736
1849
  *
1737
- * @param path - The path to the file or directory to remove.
1738
- * @param options - Options for removing the file or directory.
1850
+ * @param path - The path to list files from.
1851
+ * @returns An array of file names in the specified path.
1739
1852
  */
1740
- rmSync(path, options = {}) {
1741
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${this.#normalizePath(path)}`);
1742
- if (this.isDirectory(this.#normalizePath(path))) {
1743
- return this.rmdirSync(this.#normalizePath(path), options);
1853
+ async list(path) {
1854
+ let maskedMounts = [];
1855
+ const allKeys = [];
1856
+ for (const storage of this.#getStorages(path, true)) {
1857
+ for (const key of await storage.adapter.list(storage.relativeBase)) {
1858
+ if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
1859
+ allKeys.push(`${storage.base}${normalizeKey(key)}`);
1860
+ }
1861
+ }
1862
+ maskedMounts = [
1863
+ storage.base,
1864
+ ...maskedMounts.filter((p) => !p.startsWith(storage.base))
1865
+ ];
1744
1866
  }
1745
- return this.unlinkSync(this.#normalizePath(path), options);
1867
+ return allKeys.filter((key) => filterKeyByBase(key, path));
1746
1868
  }
1747
1869
  /**
1748
- * Creates a directory in the virtual file system (VFS).
1870
+ * Removes a file in the virtual file system (VFS).
1749
1871
  *
1750
1872
  * @param path - The path to create the directory at.
1751
- * @param options - Options for creating the directory.
1752
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
1753
- */
1754
- mkdirSync(path, options = {}) {
1755
- return this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
1756
- "mode"
1757
- ]), {
1758
- recursive: true
1759
- }));
1873
+ */
1874
+ async remove(path) {
1875
+ const normalizedPath = this.#normalizePath(path);
1876
+ this.#log(types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
1877
+ const { relativeKey, adapter } = this.#getStorage(normalizedPath);
1878
+ if (filePathFns.hasFileExtension(normalizedPath)) {
1879
+ await adapter.remove(relativeKey);
1880
+ } else {
1881
+ await adapter.clear(relativeKey);
1882
+ }
1883
+ const id = this.#ids[normalizedPath];
1884
+ if (id && this.#metadata[id]) {
1885
+ delete this.#metadata[id];
1886
+ delete this.#ids[normalizedPath];
1887
+ delete this.#paths[id];
1888
+ }
1760
1889
  }
1761
1890
  /**
1762
- * Creates a directory in the virtual file system (VFS).
1891
+ * Removes a file in the virtual file system (VFS).
1763
1892
  *
1764
1893
  * @param path - The path to create the directory at.
1765
- * @param options - Options for creating the directory.
1766
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
1767
1894
  */
1768
- async mkdir(path, options = {}) {
1769
- let result;
1770
- if (isFunction.isFunction(this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir)) {
1771
- result = await this.#unifiedFS.resolveFS(this.#normalizePath(path), options).promises.mkdir(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
1772
- "mode"
1773
- ]), {
1774
- recursive: true
1775
- }));
1895
+ removeSync(path) {
1896
+ const normalizedPath = this.#normalizePath(path);
1897
+ this.#log(types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
1898
+ const { relativeKey, adapter } = this.#getStorage(normalizedPath);
1899
+ if (filePathFns.hasFileExtension(normalizedPath)) {
1900
+ adapter.removeSync(relativeKey);
1776
1901
  } else {
1777
- result = this.#unifiedFS.resolveFS(this.#normalizePath(path), options).mkdirSync(this.#normalizePath(path), defu6__default.default(omit.omit(options, [
1778
- "mode"
1779
- ]), {
1780
- recursive: true
1781
- }));
1902
+ adapter.clearSync(relativeKey);
1903
+ }
1904
+ const id = this.#ids[normalizedPath];
1905
+ if (id && this.#metadata[id]) {
1906
+ delete this.#metadata[id];
1907
+ delete this.#ids[normalizedPath];
1908
+ delete this.#paths[id];
1782
1909
  }
1783
- return result;
1784
1910
  }
1785
1911
  /**
1786
1912
  * Glob files in the virtual file system (VFS) based on the provided pattern(s).
@@ -1802,38 +1928,14 @@ var VirtualFileSystem = class _VirtualFileSystem {
1802
1928
  const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1803
1929
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
1804
1930
  const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
1805
- const stack = [
1806
- baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot
1807
- ];
1808
- while (stack.length) {
1809
- const dir = stack.pop();
1810
- let entries = [];
1811
- try {
1812
- entries = await this.readdir(dir);
1813
- } catch {
1814
- continue;
1815
- }
1816
- for (const entry of entries) {
1817
- const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
1818
- let stats;
1819
- try {
1820
- stats = this.#unifiedFS.lstatSync(full);
1821
- } catch {
1822
- stats = void 0;
1823
- }
1824
- if (!stats) continue;
1825
- if (stats.isDirectory()) {
1826
- stack.push(full);
1827
- } else if (stats.isFile()) {
1828
- if (this.#buildRegex(absPattern).test(full)) {
1829
- const resolved = this.resolveSync(full);
1830
- if (resolved && !results.includes(resolved)) {
1831
- results.push(resolved);
1832
- }
1833
- }
1931
+ await Promise.all((await this.list(baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot)).map(async (file) => {
1932
+ if (this.#buildRegex(absPattern).test(file)) {
1933
+ const resolved = this.resolveSync(file);
1934
+ if (resolved && !results.includes(resolved)) {
1935
+ results.push(resolved);
1834
1936
  }
1835
1937
  }
1836
- }
1938
+ }));
1837
1939
  }
1838
1940
  return results;
1839
1941
  }
@@ -1857,35 +1959,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
1857
1959
  const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1858
1960
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
1859
1961
  const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
1860
- const stack = [
1861
- baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot
1862
- ];
1863
- while (stack.length) {
1864
- const dir = stack.pop();
1865
- let entries = [];
1866
- try {
1867
- entries = this.readdirSync(dir);
1868
- } catch {
1869
- continue;
1870
- }
1871
- for (const entry of entries) {
1872
- const full = this.#normalizePath(joinPaths.joinPaths(dir, entry));
1873
- let stats;
1874
- try {
1875
- stats = this.#unifiedFS.lstatSync(full);
1876
- } catch {
1877
- stats = void 0;
1878
- }
1879
- if (!stats) continue;
1880
- if (stats.isDirectory()) {
1881
- stack.push(full);
1882
- } else if (stats.isFile()) {
1883
- if (this.#buildRegex(absPattern).test(full)) {
1884
- const resolved = this.resolveSync(full);
1885
- if (resolved && !results.includes(resolved)) {
1886
- results.push(resolved);
1887
- }
1888
- }
1962
+ const files = this.listSync(baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot);
1963
+ for (const file of files) {
1964
+ if (this.#buildRegex(absPattern).test(file)) {
1965
+ const resolved = this.resolveSync(file);
1966
+ if (resolved && !results.includes(resolved)) {
1967
+ results.push(resolved);
1889
1968
  }
1890
1969
  }
1891
1970
  }
@@ -1893,36 +1972,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
1893
1972
  return results;
1894
1973
  }
1895
1974
  /**
1896
- * Moves a file from one path to another in the virtual file system (VFS).
1897
- *
1898
- * @param srcPath - The source path to move
1899
- * @param destPath - The destination path to move to
1900
- */
1901
- async move(srcPath, destPath) {
1902
- const content = await this.readFile(srcPath);
1903
- await this.writeFile(destPath, content);
1904
- await this.rm(srcPath);
1905
- }
1906
- /**
1907
- * Synchronously moves a file from one path to another in the virtual file system (VFS).
1908
- *
1909
- * @param srcPath - The source path to move
1910
- * @param destPath - The destination path to move to
1911
- */
1912
- moveSync(srcPath, destPath) {
1913
- const content = this.readFileSync(srcPath);
1914
- this.writeFileSync(destPath, content);
1915
- this.rmSync(srcPath);
1916
- }
1917
- /**
1918
1975
  * Copies a file from one path to another in the virtual file system (VFS).
1919
1976
  *
1920
1977
  * @param srcPath - The source path to copy
1921
1978
  * @param destPath - The destination path to copy to
1922
1979
  */
1923
1980
  async copy(srcPath, destPath) {
1924
- const content = await this.readFile(srcPath);
1925
- await this.writeFile(destPath, content);
1981
+ if (filePathFns.hasFileExtension(srcPath)) {
1982
+ const content = await this.read(srcPath);
1983
+ if (content !== void 0) {
1984
+ await this.write(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
1985
+ }
1986
+ } else {
1987
+ await Promise.all((await this.list(srcPath)).map(async (file) => {
1988
+ const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
1989
+ const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
1990
+ const content = await this.read(file);
1991
+ if (content !== void 0) {
1992
+ await this.write(destinationPath, content);
1993
+ }
1994
+ }));
1995
+ }
1926
1996
  }
1927
1997
  /**
1928
1998
  * Synchronously copies a file from one path to another in the virtual file system (VFS).
@@ -1931,51 +2001,85 @@ var VirtualFileSystem = class _VirtualFileSystem {
1931
2001
  * @param destPath - The destination path to copy to
1932
2002
  */
1933
2003
  copySync(srcPath, destPath) {
1934
- const content = this.readFileSync(srcPath);
1935
- this.writeFileSync(destPath, content);
2004
+ if (filePathFns.hasFileExtension(srcPath)) {
2005
+ const content = this.readSync(srcPath);
2006
+ if (content !== void 0) {
2007
+ this.writeSync(filePathFns.hasFileExtension(destPath) ? destPath : joinPaths.joinPaths(destPath, filePathFns.findFileName(srcPath)), content);
2008
+ }
2009
+ } else {
2010
+ this.listSync(srcPath).forEach((file) => {
2011
+ const relativePath2 = file.replace(this.#normalizePath(srcPath), "");
2012
+ const destinationPath = this.#normalizePath(append.appendPath(destPath, relativePath2));
2013
+ const content = this.readSync(file);
2014
+ if (content !== void 0) {
2015
+ this.writeSync(destinationPath, content);
2016
+ }
2017
+ });
2018
+ }
1936
2019
  }
1937
2020
  /**
1938
- * Lists files in a given path.
2021
+ * Moves a file (or files) from one path to another in the virtual file system (VFS).
1939
2022
  *
1940
- * @param pathOrId - The path to list files from.
1941
- * @param options - Options for listing files, such as encoding and recursion.
1942
- * @returns An array of file names in the specified path.
2023
+ * @param srcPath - The source path to move
2024
+ * @param destPath - The destination path to move to
2025
+ */
2026
+ async move(srcPath, destPath) {
2027
+ if (filePathFns.hasFileExtension(srcPath)) {
2028
+ await this.copy(srcPath, destPath);
2029
+ await this.remove(srcPath);
2030
+ } else {
2031
+ await Promise.all((await this.list(srcPath)).map(async (file) => {
2032
+ await this.copy(file, destPath);
2033
+ await this.remove(file);
2034
+ }));
2035
+ }
2036
+ }
2037
+ /**
2038
+ * Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).
2039
+ *
2040
+ * @param srcPath - The source path to move
2041
+ * @param destPath - The destination path to move to
1943
2042
  */
1944
- async readdir(pathOrId, options = "utf8") {
1945
- return this.#unifiedFS.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
2043
+ moveSync(srcPath, destPath) {
2044
+ if (filePathFns.hasFileExtension(srcPath)) {
2045
+ this.copySync(srcPath, destPath);
2046
+ this.removeSync(srcPath);
2047
+ } else {
2048
+ this.listSync(srcPath).forEach((file) => {
2049
+ this.copySync(file, destPath);
2050
+ this.removeSync(file);
2051
+ });
2052
+ }
1946
2053
  }
1947
2054
  /**
1948
2055
  * Asynchronously reads a file from the virtual file system (VFS).
1949
2056
  *
1950
- * @param pathOrId - The path or ID of the file to read.
2057
+ * @param path - The path or ID of the file to read.
1951
2058
  * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
1952
2059
  */
1953
- async readFile(pathOrId, options = "utf8") {
1954
- const filePath = await this.resolve(pathOrId);
1955
- if (filePath && this.isFile(filePath)) {
1956
- let result;
1957
- if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
1958
- result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
1959
- } else {
1960
- result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1961
- }
1962
- return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2060
+ async read(path) {
2061
+ const filePath = await this.resolve(path);
2062
+ if (!filePath) {
2063
+ return void 0;
1963
2064
  }
1964
- return void 0;
2065
+ const { relativeKey, adapter } = this.#getStorage(filePath);
2066
+ this.#log(types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
2067
+ return await adapter.get(relativeKey) ?? void 0;
1965
2068
  }
1966
2069
  /**
1967
2070
  * Synchronously reads a file from the virtual file system (VFS).
1968
2071
  *
1969
- * @param pathOrId - The path or ID of the file to read.
2072
+ * @param path - The path or ID of the file to read.
1970
2073
  * @returns The contents of the file as a string, or undefined if the file does not exist.
1971
2074
  */
1972
- readFileSync(pathOrId, options = "utf8") {
1973
- const filePath = this.resolveSync(pathOrId);
1974
- if (filePath && this.isFile(filePath)) {
1975
- const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1976
- return isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
2075
+ readSync(path) {
2076
+ const filePath = this.resolveSync(path);
2077
+ if (!filePath) {
2078
+ return void 0;
1977
2079
  }
1978
- return void 0;
2080
+ const { relativeKey, adapter } = this.#getStorage(filePath);
2081
+ this.#log(types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
2082
+ return adapter.getSync(relativeKey) ?? void 0;
1979
2083
  }
1980
2084
  /**
1981
2085
  * Writes a file to the virtual file system (VFS).
@@ -1985,41 +2089,28 @@ var VirtualFileSystem = class _VirtualFileSystem {
1985
2089
  * @param options - Optional parameters for writing the file.
1986
2090
  * @returns A promise that resolves when the file is written.
1987
2091
  */
1988
- async writeFile(path, data = "", options = "utf8") {
1989
- if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
1990
- await this.mkdir(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
1991
- }
1992
- const metadata = isVirtualFileData(data) ? data : {};
1993
- metadata.id = this.#normalizeId(path);
1994
- let code = isVirtualFileData(data) ? metadata.code : data;
1995
- if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
2092
+ async write(path, data = "", options = {}) {
2093
+ let code = data;
2094
+ if (!options.skipFormat) {
1996
2095
  const resolvedConfig = await prettier.resolveConfig(this.#normalizePath(path));
1997
2096
  if (resolvedConfig) {
1998
- code = await prettier.format(code, {
2097
+ code = await prettier.format(data, {
1999
2098
  absolutePath: this.#normalizePath(path),
2000
2099
  ...resolvedConfig
2001
2100
  });
2002
2101
  }
2003
2102
  }
2004
- const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
2005
- this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2006
- this.#metadata[metadata.id] = {
2007
- mode: outputMode,
2103
+ const { relativeKey, adapter } = this.#getStorage(path);
2104
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2105
+ const id = options?.meta?.id || this.#normalizeId(path);
2106
+ this.#metadata[id] = {
2008
2107
  variant: "normal",
2009
2108
  timestamp: Date.now(),
2010
- ...metadata
2109
+ ...options.meta ?? {}
2011
2110
  };
2012
- this.#paths[metadata.id] = this.#normalizePath(path);
2013
- this.#ids[this.#normalizePath(path)] = metadata.id;
2014
- const ifs = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
2015
- if (isFunction.isFunction(ifs.promises.writeFile)) {
2016
- return ifs.promises.writeFile(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
2017
- "mode"
2018
- ]) : "utf8");
2019
- }
2020
- return ifs.writeFileSync(this.#normalizePath(path), code, isSetObject.isSetObject(options) ? omit.omit(options, [
2021
- "mode"
2022
- ]) : "utf8");
2111
+ this.#paths[id] = this.#normalizePath(path);
2112
+ this.#ids[this.#normalizePath(path)] = id;
2113
+ return adapter.set(relativeKey, code);
2023
2114
  }
2024
2115
  /**
2025
2116
  * Synchronously writes a file to the virtual file system (VFS).
@@ -2028,38 +2119,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
2028
2119
  * @param data - The contents of the file.
2029
2120
  * @param options - Optional parameters for writing the file.
2030
2121
  */
2031
- writeFileSync(path, data = "", options = "utf8") {
2032
- if (!this.isDirectory(filePathFns.findFilePath(this.#normalizePath(path)))) {
2033
- this.mkdirSync(filePathFns.findFilePath(this.#normalizePath(path)), isPowerlinesWriteFileOptions(options) ? options : void 0);
2034
- }
2035
- const metadata = isVirtualFileData(data) ? data : {};
2036
- metadata.id = this.#normalizeId(path);
2037
- const code = isVirtualFileData(data) ? metadata.code : data;
2038
- const outputMode = this.#unifiedFS.resolveMode(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0);
2039
- this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
2040
- this.#metadata[metadata.id] = {
2041
- mode: outputMode,
2122
+ writeSync(path, data = "", options = {}) {
2123
+ const { relativeKey, adapter } = this.#getStorage(path);
2124
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(data)).size)})`);
2125
+ const id = options?.meta?.id || this.#normalizeId(path);
2126
+ this.#metadata[id] = {
2042
2127
  variant: "normal",
2043
2128
  timestamp: Date.now(),
2044
- ...metadata
2129
+ ...options.meta ?? {}
2045
2130
  };
2046
- this.#paths[metadata.id] = this.#normalizePath(path);
2047
- this.#ids[this.#normalizePath(path)] = metadata.id;
2048
- const writeStream = this.#unifiedFS.resolveFS(this.#normalizePath(path), isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(this.#normalizePath(path));
2049
- try {
2050
- writeStream.write(code);
2051
- } finally {
2052
- writeStream.close();
2053
- }
2054
- }
2055
- /**
2056
- * Synchronously checks if a file exists in the virtual file system (VFS).
2057
- *
2058
- * @param pathOrId - The path or ID of the file to check.
2059
- * @returns `true` if the file exists, otherwise `false`.
2060
- */
2061
- existsSync(pathOrId) {
2062
- return !!this.resolveSync(pathOrId);
2131
+ this.#paths[id] = this.#normalizePath(path);
2132
+ this.#ids[this.#normalizePath(path)] = id;
2133
+ return adapter.setSync(relativeKey, data);
2063
2134
  }
2064
2135
  /**
2065
2136
  * Retrieves the metadata of a file in the virtual file system (VFS).
@@ -2075,78 +2146,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
2075
2146
  return void 0;
2076
2147
  }
2077
2148
  /**
2078
- * Checks if a file exists in the virtual file system (VFS).
2079
- *
2080
- * @remarks
2081
- * 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.
2082
- *
2083
- * @param pathOrId - The path of the file to check.
2084
- * @returns `true` if the file exists, otherwise `false`.
2085
- */
2086
- isFile(pathOrId) {
2087
- const resolved = this.resolveSync(pathOrId);
2088
- return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isFile() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isFile() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isFile()));
2089
- }
2090
- /**
2091
- * Checks if a directory exists in the virtual file system (VFS).
2092
- *
2093
- * @param pathOrId - The path of the directory to check.
2094
- * @returns `true` if the directory exists, otherwise `false`.
2095
- */
2096
- isDirectory(pathOrId) {
2097
- const resolved = this.resolveSync(pathOrId);
2098
- return !!(resolved && (this.#unifiedFS.virtual.existsSync(resolved) && this.#unifiedFS.virtual.lstatSync(resolved).isDirectory() || this.#unifiedFS.physical.existsSync(resolved) && this.#unifiedFS.physical.lstatSync(resolved).isDirectory() || this.#unifiedFS.resolveFS(resolved).existsSync(resolved) && this.#unifiedFS.resolveFS(resolved).lstatSync(resolved).isDirectory()));
2099
- }
2100
- /**
2101
- * Retrieves the status of a file in the virtual file system (VFS).
2102
- *
2103
- * @param pathOrId - The path or ID of the file to retrieve status for.
2104
- * @returns A promise that resolves to the file's status information, or false if the file does not exist.
2105
- */
2106
- async stat(pathOrId, options) {
2107
- return this.#unifiedFS.resolveFS(pathOrId).promises.stat(await this.resolve(pathOrId) || pathOrId, options);
2108
- }
2109
- /**
2110
- * Synchronously retrieves the status of a file in the virtual file system (VFS).
2111
- *
2112
- * @param pathOrId - The path or ID of the file to retrieve status for.
2113
- * @returns The file's status information, or false if the file does not exist.
2114
- */
2115
- statSync(pathOrId) {
2116
- return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolveSync(pathOrId) || pathOrId);
2117
- }
2118
- /**
2119
- * Retrieves the status of a symbolic link in the virtual file system (VFS).
2120
- *
2121
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
2122
- * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
2123
- */
2124
- async lstat(pathOrId, options) {
2125
- return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(await this.resolve(pathOrId) || pathOrId, options);
2126
- }
2127
- /**
2128
- * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
2129
- *
2130
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
2131
- * @returns The symbolic link's status information, or false if the link does not exist.
2132
- */
2133
- lstatSync(pathOrId, options) {
2134
- return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolveSync(pathOrId) || pathOrId, options);
2135
- }
2136
- /**
2137
- * Resolves a path or ID to its real path in the virtual file system (VFS).
2138
- *
2139
- * @param pathOrId - The path or ID to resolve.
2140
- * @returns The resolved real path if it exists, otherwise undefined.
2141
- */
2142
- realpathSync(pathOrId) {
2143
- const filePath = this.resolveSync(pathOrId);
2144
- if (!filePath) {
2145
- throw new Error(`File not found: ${pathOrId}`);
2146
- }
2147
- return filePath;
2148
- }
2149
- /**
2150
2149
  * A helper function to resolve modules in the virtual file system (VFS).
2151
2150
  *
2152
2151
  * @remarks
@@ -2163,9 +2162,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2163
2162
  * @returns A promise that resolves to the resolved module path.
2164
2163
  */
2165
2164
  async resolve(id, importer, options = {}) {
2166
- let result = this.resolverCache.get(this.#normalizeId(id));
2167
- if (result) {
2168
- return result;
2165
+ if (isType.isAbsolutePath(id)) {
2166
+ return id;
2167
+ }
2168
+ let result;
2169
+ if (!this.#context.config.skipCache) {
2170
+ result = this.resolverCache.get(this.#normalizeId(id));
2171
+ if (result) {
2172
+ return result;
2173
+ }
2169
2174
  }
2170
2175
  result = this.paths[this.#normalizeId(id)];
2171
2176
  if (!result) {
@@ -2180,8 +2185,10 @@ var VirtualFileSystem = class _VirtualFileSystem {
2180
2185
  for (const combination of resolve.getResolutionCombinations(id, {
2181
2186
  paths
2182
2187
  })) {
2183
- if (this.#existsSync(combination)) {
2188
+ const { relativeKey, adapter } = this.#getStorage(combination);
2189
+ if (await adapter.exists(relativeKey)) {
2184
2190
  result = combination;
2191
+ break;
2185
2192
  }
2186
2193
  }
2187
2194
  try {
@@ -2193,7 +2200,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
2193
2200
  }
2194
2201
  if (result) {
2195
2202
  result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2196
- this.resolverCache.set(this.#normalizeId(id), result);
2203
+ if (!this.#context.config.skipCache) {
2204
+ this.resolverCache.set(this.#normalizeId(id), result);
2205
+ }
2197
2206
  }
2198
2207
  return result;
2199
2208
  }
@@ -2214,9 +2223,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2214
2223
  * @returns The resolved module path.
2215
2224
  */
2216
2225
  resolveSync(id, importer, options = {}) {
2217
- let result = this.resolverCache.get(this.#normalizeId(id));
2218
- if (result) {
2219
- return result;
2226
+ if (isType.isAbsolutePath(id)) {
2227
+ return id;
2228
+ }
2229
+ let result;
2230
+ if (!this.#context.config.skipCache) {
2231
+ result = this.resolverCache.get(this.#normalizeId(id));
2232
+ if (result) {
2233
+ return result;
2234
+ }
2220
2235
  }
2221
2236
  result = this.paths[this.#normalizeId(id)];
2222
2237
  if (!result) {
@@ -2225,14 +2240,16 @@ var VirtualFileSystem = class _VirtualFileSystem {
2225
2240
  paths.push(importer);
2226
2241
  }
2227
2242
  paths.push(this.#context.workspaceConfig.workspaceRoot);
2228
- paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot));
2229
- paths.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.sourceRoot));
2230
- paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2243
+ paths.push(append.appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
2244
+ paths.push(append.appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
2245
+ paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => append.appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2231
2246
  for (const combination of resolve.getResolutionCombinations(id, {
2232
2247
  paths
2233
2248
  })) {
2234
- if (this.#existsSync(combination)) {
2249
+ const { relativeKey, adapter } = this.#getStorage(combination);
2250
+ if (adapter.existsSync(relativeKey)) {
2235
2251
  result = combination;
2252
+ break;
2236
2253
  }
2237
2254
  }
2238
2255
  try {
@@ -2244,7 +2261,9 @@ var VirtualFileSystem = class _VirtualFileSystem {
2244
2261
  }
2245
2262
  if (result) {
2246
2263
  result = correctPath.toAbsolutePath(append.appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2247
- this.resolverCache.set(this.#normalizeId(id), result);
2264
+ if (!this.#context.config.skipCache) {
2265
+ this.resolverCache.set(this.#normalizeId(id), result);
2266
+ }
2248
2267
  }
2249
2268
  return result;
2250
2269
  }
@@ -2255,27 +2274,27 @@ var VirtualFileSystem = class _VirtualFileSystem {
2255
2274
  if (!this.#isDisposed) {
2256
2275
  this.#isDisposed = true;
2257
2276
  this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
2258
- await this.unlink(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"));
2277
+ await this.remove(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"));
2259
2278
  const message = new $__namespace.Message();
2260
- const fs2 = message.initRoot(FileSystem);
2261
- const virtualFiles = Object.entries(this.#unifiedFS.toJSON()).filter(([, code]) => code);
2262
- const files = fs2._initFiles(virtualFiles.length);
2263
- virtualFiles.filter(([, code]) => code).forEach(([path, code], index) => {
2264
- const fd = files.get(index);
2279
+ const fs = message.initRoot(FileSystem);
2280
+ const paths = await this.list();
2281
+ const storage = fs._initStorage(paths.length);
2282
+ await Promise.all(paths.map(async (path, index) => {
2283
+ const code = await this.read(path);
2284
+ const fd = storage.get(index);
2265
2285
  fd.path = path;
2266
2286
  fd.code = code || "";
2267
- });
2268
- const ids = fs2._initIds(Object.keys(this.ids).length);
2287
+ }));
2288
+ const ids = fs._initIds(Object.keys(this.ids).length);
2269
2289
  Object.entries(this.ids).filter(([, path]) => path).forEach(([id, path], index) => {
2270
2290
  const fileId = ids.get(index);
2271
2291
  fileId.id = id;
2272
2292
  fileId.path = path;
2273
2293
  });
2274
- const metadata = fs2._initMetadata(Object.keys(this.metadata).length);
2294
+ const metadata = fs._initMetadata(Object.keys(this.metadata).length);
2275
2295
  Object.entries(this.metadata).filter(([, value]) => value).forEach(([id, value], index) => {
2276
2296
  const fileMetadata = metadata.get(index);
2277
2297
  fileMetadata.id = id;
2278
- fileMetadata.mode = value.mode;
2279
2298
  fileMetadata.type = value.type;
2280
2299
  fileMetadata.timestamp = value.timestamp ?? BigInt(Date.now());
2281
2300
  if (value.properties) {
@@ -2288,155 +2307,59 @@ var VirtualFileSystem = class _VirtualFileSystem {
2288
2307
  }
2289
2308
  });
2290
2309
  await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
2291
- this.#resolverCache.save(true);
2292
- this.#log(types.LogLevelLabel.DEBUG, "Virtual file system disposed.");
2293
- }
2294
- }
2295
- /**
2296
- * Initializes the virtual file system (VFS) by patching the file system module if necessary.
2297
- */
2298
- [chunkAYKZK666_cjs.__VFS_PATCH__]() {
2299
- if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
2300
- this.#revert = patchFS(_fs__default.default, this);
2301
- this.#isPatched = true;
2302
- }
2303
- }
2304
- /**
2305
- * Reverts the file system module to its original state if it was previously patched.
2306
- */
2307
- [chunkAYKZK666_cjs.__VFS_REVERT__]() {
2308
- if (this.#isPatched && this.#context.config.output.mode !== "fs") {
2309
- if (!this.#revert) {
2310
- throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
2311
- }
2312
- this.#revert?.();
2313
- this.#isPatched = false;
2314
- }
2315
- }
2310
+ if (!this.#context.config.skipCache) {
2311
+ this.#resolverCache.save(true);
2312
+ }
2313
+ await Promise.all(this.#getStorages().map(async (storage2) => storage2.adapter.dispose()));
2314
+ this.#log(types.LogLevelLabel.TRACE, "Virtual file system has been disposed.");
2315
+ }
2316
+ }
2317
+ // /**
2318
+ // * Initializes the virtual file system (VFS) by patching the file system module if necessary.
2319
+ // */
2320
+ // public [__VFS_PATCH__]() {
2321
+ // if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
2322
+ // this.#revert = patchFS(fs, this);
2323
+ // this.#isPatched = true;
2324
+ // }
2325
+ // }
2326
+ // /**
2327
+ // * Reverts the file system module to its original state if it was previously patched.
2328
+ // */
2329
+ // public [__VFS_REVERT__]() {
2330
+ // if (this.#isPatched && this.#context.config.output.mode !== "fs") {
2331
+ // if (!this.#revert) {
2332
+ // throw new Error(
2333
+ // "Attempting to revert File System patch prior to calling `__init__` function"
2334
+ // );
2335
+ // }
2336
+ // this.#revert?.();
2337
+ // this.#isPatched = false;
2338
+ // }
2339
+ // }
2316
2340
  async [Symbol.asyncDispose]() {
2317
2341
  return this.dispose();
2318
2342
  }
2319
2343
  };
2320
- var VirtualFileSystemHost = class VirtualFileSystemHost2 extends tsMorph.InMemoryFileSystemHost {
2321
- static {
2322
- chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystemHost");
2323
- }
2324
- #fs;
2325
- constructor(fs2) {
2326
- super();
2327
- this.#fs = fs2;
2328
- }
2329
- deleteSync(path) {
2330
- this.#fs.rmSync(path);
2331
- }
2332
- readDirSync(dirPath) {
2333
- return this.#fs.readdirSync(dirPath).reduce((ret, entry) => {
2334
- const fullPath = this.#fs.resolveSync(join.joinPaths(dirPath, entry));
2335
- if (fullPath) {
2336
- ret.push({
2337
- name: entry,
2338
- isDirectory: this.#fs.isDirectory(fullPath),
2339
- isFile: this.#fs.isFile(fullPath),
2340
- isSymlink: false
2341
- });
2342
- }
2343
- return ret;
2344
- }, []);
2345
- }
2346
- async readFile(filePath) {
2347
- if (!this.#fs.existsSync(filePath)) {
2348
- throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
2349
- }
2350
- return await this.#fs.readFile(filePath);
2351
- }
2352
- readFileSync(filePath) {
2353
- if (!this.#fs.existsSync(filePath)) {
2354
- throw new Error(`File not found: '${filePath}'. Please check the path and try again.`);
2355
- }
2356
- return this.#fs.readFileSync(filePath);
2357
- }
2358
- async writeFile(filePath, fileText) {
2359
- return this.#fs.writeFile(filePath, fileText);
2360
- }
2361
- writeFileSync(filePath, fileText) {
2362
- this.#fs.writeFileSync(filePath, fileText);
2363
- }
2364
- async mkdir(dirPath) {
2365
- await this.#fs.mkdir(dirPath);
2366
- }
2367
- mkdirSync(dirPath) {
2368
- this.#fs.mkdirSync(dirPath);
2369
- }
2370
- async move(srcPath, destPath) {
2371
- await this.#fs.move(srcPath, destPath);
2372
- }
2373
- moveSync(srcPath, destPath) {
2374
- this.#fs.moveSync(srcPath, destPath);
2375
- }
2376
- async copy(srcPath, destPath) {
2377
- await this.#fs.copy(srcPath, destPath);
2378
- }
2379
- copySync(srcPath, destPath) {
2380
- this.#fs.copySync(srcPath, destPath);
2381
- }
2382
- async fileExists(filePath) {
2383
- return this.#fs.isFile(filePath);
2384
- }
2385
- fileExistsSync(filePath) {
2386
- return this.#fs.isFile(filePath);
2387
- }
2388
- async directoryExists(dirPath) {
2389
- return this.#fs.isDirectory(dirPath);
2390
- }
2391
- directoryExistsSync(dirPath) {
2392
- return this.#fs.isDirectory(dirPath);
2393
- }
2394
- realpathSync(path) {
2395
- return this.#fs.resolveSync(path) || path;
2396
- }
2397
- getCurrentDirectory() {
2398
- return "/";
2399
- }
2400
- async glob(patterns) {
2401
- return this.#fs.glob(patterns);
2402
- }
2403
- globSync(patterns) {
2404
- return this.#fs.globSync(patterns);
2405
- }
2406
- };
2407
- function createProgram(context, override) {
2408
- const project = new tsMorph.Project({
2409
- compilerOptions: {
2410
- ...context.tsconfig.options
2411
- },
2412
- tsConfigFilePath: context.tsconfig.tsconfigFilePath,
2413
- fileSystem: new VirtualFileSystemHost(context.fs),
2414
- ...override
2415
- });
2416
- return project;
2417
- }
2418
- chunkUSNT2KNT_cjs.__name(createProgram, "createProgram");
2419
2344
  var PROJECT_ROOT_HASH_LENGTH = 45;
2420
2345
  var CACHE_HASH_LENGTH = 62;
2421
2346
  function getPrefixedProjectRootHash(name, projectRootHash) {
2422
2347
  const combined = `${kebabCase.kebabCase(name)}_${projectRootHash}`;
2423
2348
  return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
2424
2349
  }
2425
- chunkUSNT2KNT_cjs.__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
2350
+ chunkPK6SKIKE_cjs.__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
2426
2351
  async function writeMetaFile(context) {
2427
2352
  const metaFilePath = joinPaths.joinPaths(context.dataPath, "meta.json");
2428
2353
  context.log(types.LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
2429
- await context.fs.writeFile(metaFilePath, JSON.stringify(context.meta, null, 2), {
2430
- mode: "fs"
2431
- });
2354
+ await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
2432
2355
  }
2433
- chunkUSNT2KNT_cjs.__name(writeMetaFile, "writeMetaFile");
2356
+ chunkPK6SKIKE_cjs.__name(writeMetaFile, "writeMetaFile");
2434
2357
 
2435
2358
  // src/lib/contexts/context.ts
2436
2359
  var configCache = /* @__PURE__ */ new WeakMap();
2437
2360
  var PowerlinesContext = class _PowerlinesContext {
2438
2361
  static {
2439
- chunkUSNT2KNT_cjs.__name(this, "PowerlinesContext");
2362
+ chunkPK6SKIKE_cjs.__name(this, "PowerlinesContext");
2440
2363
  }
2441
2364
  /**
2442
2365
  * Internal reference to the API instance
@@ -2631,7 +2554,7 @@ var PowerlinesContext = class _PowerlinesContext {
2631
2554
  * Get the path to the artifacts directory for the project
2632
2555
  */
2633
2556
  get artifactsPath() {
2634
- return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsFolder);
2557
+ return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsPath);
2635
2558
  }
2636
2559
  /**
2637
2560
  * Get the path to the builtin modules used by the project
@@ -2771,7 +2694,7 @@ var PowerlinesContext = class _PowerlinesContext {
2771
2694
  if (!resolvedId) {
2772
2695
  return void 0;
2773
2696
  }
2774
- const code = await this.fs.readFile(resolvedId);
2697
+ const code = await this.fs.read(resolvedId);
2775
2698
  if (!code) {
2776
2699
  return void 0;
2777
2700
  }
@@ -2785,7 +2708,7 @@ var PowerlinesContext = class _PowerlinesContext {
2785
2708
  */
2786
2709
  async getBuiltins() {
2787
2710
  return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "builtin").map(async ([path, meta]) => {
2788
- const code = await this.fs.readFile(path);
2711
+ const code = await this.fs.read(path);
2789
2712
  return {
2790
2713
  ...meta,
2791
2714
  path,
@@ -2801,11 +2724,8 @@ var PowerlinesContext = class _PowerlinesContext {
2801
2724
  * @param options - Optional write file options
2802
2725
  */
2803
2726
  async emitEntry(code, path, options = {}) {
2804
- return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
2805
- code,
2727
+ return this.fs.write(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), code, defu7__default.default(options, {
2806
2728
  type: "entry"
2807
- }, defu6__default.default(options, {
2808
- mode: this.config.output.mode
2809
2729
  }));
2810
2730
  }
2811
2731
  /**
@@ -2817,12 +2737,8 @@ var PowerlinesContext = class _PowerlinesContext {
2817
2737
  * @param options - Optional write file options
2818
2738
  */
2819
2739
  async emitBuiltin(code, id, path, options = {}) {
2820
- return this.fs.writeFile(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), {
2821
- id,
2822
- code,
2740
+ return this.fs.write(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), code, defu7__default.default(options, {
2823
2741
  type: "builtin"
2824
- }, defu6__default.default(options, {
2825
- mode: this.config.output.mode
2826
2742
  }));
2827
2743
  }
2828
2744
  /**
@@ -3016,9 +2932,9 @@ var PowerlinesContext = class _PowerlinesContext {
3016
2932
  userConfig
3017
2933
  });
3018
2934
  }
3019
- this.config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.projectRoot, config.tsconfig);
2935
+ config.tsconfig ??= getTsconfigFilePath(this.workspaceConfig.workspaceRoot, cacheKey.projectRoot, config.tsconfig);
3020
2936
  if (isSetObject.isSetObject(config)) {
3021
- this.resolvedConfig = defu6__default.default({
2937
+ this.resolvedConfig = defu7__default.default({
3022
2938
  inlineConfig: this.config.inlineConfig,
3023
2939
  userConfig: this.config.userConfig
3024
2940
  }, options.isHighPriority ? this.#getConfigProps(config) : {}, {
@@ -3033,12 +2949,11 @@ var PowerlinesContext = class _PowerlinesContext {
3033
2949
  version: this.packageJson?.version,
3034
2950
  description: this.packageJson?.description,
3035
2951
  sourceRoot: this.projectJson?.sourceRoot || append.appendPath("src", cacheKey.projectRoot),
3036
- output: {
2952
+ output: defu7__default.default(config.output ?? {}, {
3037
2953
  outputPath: cacheKey.projectRoot ? join.joinPaths(this.workspaceConfig?.directories?.build || "dist", cacheKey.projectRoot) : this.workspaceConfig?.directories?.build || "dist",
3038
- mode: "virtual",
2954
+ artifactsPath: join.joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
3039
2955
  dts: join.joinPaths(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
3040
2956
  builtinPrefix: config.framework ?? "powerlines",
3041
- artifactsFolder: join.joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
3042
2957
  assets: [
3043
2958
  {
3044
2959
  glob: "LICENSE"
@@ -3052,7 +2967,7 @@ var PowerlinesContext = class _PowerlinesContext {
3052
2967
  glob: "package.json"
3053
2968
  }
3054
2969
  ]
3055
- }
2970
+ })
3056
2971
  }, options.isHighPriority ? {} : this.#getConfigProps(config), {
3057
2972
  inlineConfig: {},
3058
2973
  userConfig: {},
@@ -3097,10 +3012,10 @@ var PowerlinesContext = class _PowerlinesContext {
3097
3012
  ])));
3098
3013
  if (this.config.projectRoot && this.config.projectRoot !== "." && this.config.projectRoot !== "./" && this.config.projectRoot !== this.workspaceConfig.workspaceRoot) {
3099
3014
  this.config.output.outputPath ??= join.joinPaths("dist", this.config.projectRoot);
3100
- this.config.output.distPath ??= join.joinPaths(this.config.projectRoot, "dist");
3015
+ this.config.output.buildPath ??= join.joinPaths(this.config.projectRoot, "dist");
3101
3016
  } else {
3102
3017
  this.config.output.outputPath ??= "dist";
3103
- this.config.output.distPath ??= "dist";
3018
+ this.config.output.buildPath ??= "dist";
3104
3019
  }
3105
3020
  this.config.output.assets = getUnique.getUnique(this.config.output.assets.map((asset) => {
3106
3021
  return {
@@ -3138,7 +3053,7 @@ var PowerlinesContext = class _PowerlinesContext {
3138
3053
  this.#fs ??= await VirtualFileSystem.create(this);
3139
3054
  }
3140
3055
  mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
3141
- this.config.userConfig = defu6__default.default({
3056
+ this.config.userConfig = defu7__default.default({
3142
3057
  entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
3143
3058
  }, omit.omit(from ?? {}, [
3144
3059
  "entry"
@@ -3158,11 +3073,11 @@ var PowerlinesContext = class _PowerlinesContext {
3158
3073
  }
3159
3074
  };
3160
3075
  function createPluginContext(plugin, environment) {
3161
- const normalizeMessage = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((message) => {
3076
+ const normalizeMessage = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => {
3162
3077
  return isString.isString(message) ? message : message.message;
3163
3078
  }, "normalizeMessage");
3164
3079
  const log = environment.extendLog(plugin.name);
3165
- const callHookFn = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async (hook, options, ...args) => {
3080
+ const callHookFn = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(async (hook, options, ...args) => {
3166
3081
  return callHook(environment, hook, {
3167
3082
  sequential: true,
3168
3083
  ...options
@@ -3229,12 +3144,12 @@ function createPluginContext(plugin, environment) {
3229
3144
  }
3230
3145
  });
3231
3146
  }
3232
- chunkUSNT2KNT_cjs.__name(createPluginContext, "createPluginContext");
3147
+ chunkPK6SKIKE_cjs.__name(createPluginContext, "createPluginContext");
3233
3148
 
3234
3149
  // src/lib/contexts/environment-context.ts
3235
3150
  var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
3236
3151
  static {
3237
- chunkUSNT2KNT_cjs.__name(this, "PowerlinesEnvironmentContext");
3152
+ chunkPK6SKIKE_cjs.__name(this, "PowerlinesEnvironmentContext");
3238
3153
  }
3239
3154
  /**
3240
3155
  * The hooks registered by plugins in this environment
@@ -3287,7 +3202,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
3287
3202
  plugin: resolvedPlugin,
3288
3203
  context
3289
3204
  });
3290
- this.#hooks = Object.keys(resolvedPlugin).filter((key) => !chunkETKZMGLN_cjs.PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
3205
+ this.#hooks = Object.keys(resolvedPlugin).filter((key) => !chunkPSTCR335_cjs.PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
3291
3206
  const hook = key;
3292
3207
  const pluginHook = resolvedPlugin[hook];
3293
3208
  if (!isPluginHook(pluginHook)) {
@@ -3361,7 +3276,7 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
3361
3276
  // src/lib/contexts/api-context.ts
3362
3277
  var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext {
3363
3278
  static {
3364
- chunkUSNT2KNT_cjs.__name(this, "PowerlinesAPIContext");
3279
+ chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPIContext");
3365
3280
  }
3366
3281
  #environments = {};
3367
3282
  #plugins = [];
@@ -3434,12 +3349,49 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
3434
3349
  }
3435
3350
  return context;
3436
3351
  }
3352
+ /**
3353
+ * Update the context using a new user configuration options
3354
+ *
3355
+ * @param userConfig - The new user configuration options.
3356
+ */
3357
+ async withUserConfig(userConfig, options = {
3358
+ isHighPriority: true
3359
+ }) {
3360
+ await super.withUserConfig(userConfig, options);
3361
+ await Promise.all(Object.keys(this.#environments).map(async (name) => {
3362
+ await this.#environments[name].withUserConfig(userConfig, options);
3363
+ }));
3364
+ }
3365
+ /**
3366
+ * Update the context using a new inline configuration options
3367
+ *
3368
+ * @param inlineConfig - The new inline configuration options.
3369
+ */
3370
+ async withInlineConfig(inlineConfig, options = {
3371
+ isHighPriority: true
3372
+ }) {
3373
+ await super.withInlineConfig(inlineConfig, options);
3374
+ await Promise.all(Object.keys(this.#environments).map(async (name) => {
3375
+ await this.#environments[name].withInlineConfig(inlineConfig, options);
3376
+ }));
3377
+ }
3378
+ /**
3379
+ * Add a plugin to the API context and all environments
3380
+ *
3381
+ * @param plugin - The plugin to add.
3382
+ */
3437
3383
  async addPlugin(plugin) {
3438
3384
  this.plugins.push(plugin);
3439
3385
  await Promise.all(Object.keys(this.environments).map(async (name) => {
3440
3386
  await this.environments[name].addPlugin(plugin);
3441
3387
  }));
3442
3388
  }
3389
+ /**
3390
+ * Get an environment by name, or the default environment if no name is provided
3391
+ *
3392
+ * @param name - The name of the environment to retrieve.
3393
+ * @returns The requested environment context.
3394
+ */
3443
3395
  async getEnvironment(name) {
3444
3396
  let environment;
3445
3397
  if (name) {
@@ -3472,7 +3424,7 @@ function getBaseFileHeader(context) {
3472
3424
  // Note: Do not edit this file manually - it will be overwritten automatically
3473
3425
  `;
3474
3426
  }
3475
- chunkUSNT2KNT_cjs.__name(getBaseFileHeader, "getBaseFileHeader");
3427
+ chunkPK6SKIKE_cjs.__name(getBaseFileHeader, "getBaseFileHeader");
3476
3428
  function getFileHeader(context, options = {}) {
3477
3429
  const { directive = null, prettierIgnore = false } = options;
3478
3430
  return `/* eslint-disable */
@@ -3485,12 +3437,12 @@ ${getBaseFileHeader(context)}
3485
3437
 
3486
3438
  `;
3487
3439
  }
3488
- chunkUSNT2KNT_cjs.__name(getFileHeader, "getFileHeader");
3440
+ chunkPK6SKIKE_cjs.__name(getFileHeader, "getFileHeader");
3489
3441
 
3490
3442
  // src/api.ts
3491
3443
  var PowerlinesAPI = class _PowerlinesAPI {
3492
3444
  static {
3493
- chunkUSNT2KNT_cjs.__name(this, "PowerlinesAPI");
3445
+ chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPI");
3494
3446
  }
3495
3447
  /**
3496
3448
  * The Powerlines context
@@ -3561,21 +3513,17 @@ ${console.formatLogMessage(context.config)}`);
3561
3513
  await writeMetaFile(context);
3562
3514
  context.persistedMeta = context.meta;
3563
3515
  if (!context.fs.existsSync(context.cachePath)) {
3564
- await context.fs.mkdir(context.cachePath, {
3565
- mode: "fs"
3566
- });
3516
+ await helpers.createDirectory(context.cachePath);
3567
3517
  }
3568
3518
  if (!context.fs.existsSync(context.dataPath)) {
3569
- await context.fs.mkdir(context.dataPath, {
3570
- mode: "fs"
3571
- });
3519
+ await helpers.createDirectory(context.dataPath);
3572
3520
  }
3573
3521
  await this.callPreHook(context, "prepare");
3574
3522
  await this.callNormalHook(context, "prepare");
3575
3523
  if (context.config.output.dts !== false) {
3576
3524
  context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
3577
3525
  if (context.fs.existsSync(context.dtsPath)) {
3578
- await context.fs.unlink(context.dtsPath);
3526
+ await context.fs.remove(context.dtsPath);
3579
3527
  }
3580
3528
  context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
3581
3529
  const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
@@ -3662,7 +3610,7 @@ ${console.formatLogMessage(context.config)}`);
3662
3610
  generatedTypes = result;
3663
3611
  }
3664
3612
  }
3665
- await context.fs.writeFile(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3613
+ await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3666
3614
 
3667
3615
  ` : ""}${getFileHeader(context, {
3668
3616
  directive: null,
@@ -3670,9 +3618,7 @@ ${console.formatLogMessage(context.config)}`);
3670
3618
  })}
3671
3619
 
3672
3620
  ${formatTypes(generatedTypes)}
3673
- `, {
3674
- mode: "fs"
3675
- });
3621
+ `);
3676
3622
  }
3677
3623
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
3678
3624
  if (!context.tsconfig) {
@@ -3740,8 +3686,8 @@ ${formatTypes(generatedTypes)}
3740
3686
  await this.prepare(inlineConfig);
3741
3687
  await this.#executeEnvironments(async (context) => {
3742
3688
  this.context.log(types.LogLevelLabel.TRACE, "Cleaning the project's dist and artifacts directories.");
3743
- await context.fs.rmdir(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.distPath));
3744
- await context.fs.rmdir(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.artifactsFolder));
3689
+ await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
3690
+ await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.artifactsPath));
3745
3691
  await callHook(context, "clean", {
3746
3692
  sequential: true
3747
3693
  });
@@ -3783,11 +3729,11 @@ ${formatTypes(generatedTypes)}
3783
3729
  await this.#executeEnvironments(async (context) => {
3784
3730
  await this.callPreHook(context, "build");
3785
3731
  await this.callNormalHook(context, "build");
3786
- if (context.config.output.distPath !== context.config.output.outputPath) {
3787
- const sourcePath = append.appendPath(context.config.output.distPath, context.workspaceConfig.workspaceRoot);
3732
+ if (context.config.output.buildPath !== context.config.output.outputPath) {
3733
+ const sourcePath = append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot);
3788
3734
  const destinationPath = joinPaths.joinPaths(append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
3789
3735
  if (sourcePath !== destinationPath) {
3790
- context.log(types.LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.distPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
3736
+ context.log(types.LogLevelLabel.INFO, `Copying build output files from project's build directory (${context.config.output.buildPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
3791
3737
  await copyFile.copyFiles({
3792
3738
  input: sourcePath,
3793
3739
  glob: "**/*"
@@ -4117,14 +4063,14 @@ Note: Please ensure the plugin package's default export is a class that extends
4117
4063
  }
4118
4064
  };
4119
4065
 
4120
- exports.FileData = FileData;
4121
4066
  exports.FileId = FileId;
4122
4067
  exports.FileMetadata = FileMetadata;
4123
4068
  exports.FileMetadata_KeyValuePair = FileMetadata_KeyValuePair;
4069
+ exports.FileStorage = FileStorage;
4124
4070
  exports.FileSystem = FileSystem;
4125
- exports.FileType = FileType;
4126
4071
  exports.PowerlinesAPI = PowerlinesAPI;
4127
- exports.PreserveSignatureType = PreserveSignatureType;
4128
4072
  exports._capnpFileId = _capnpFileId;
4129
4073
  exports.createLog = createLog;
4130
4074
  exports.extendLog = extendLog;
4075
+ //# sourceMappingURL=chunk-6MFZ436T.cjs.map
4076
+ //# sourceMappingURL=chunk-6MFZ436T.cjs.map