powerlines 0.20.0 → 0.22.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 (307) hide show
  1. package/dist/api.cjs +4 -4
  2. package/dist/api.d.cts +7 -8
  3. package/dist/api.d.ts +7 -8
  4. package/dist/api.js +3 -3
  5. package/dist/astro.cjs +10 -10
  6. package/dist/astro.d.cts +1 -2
  7. package/dist/astro.d.ts +1 -2
  8. package/dist/astro.js +7 -7
  9. package/dist/{chunk-WRP6ANCC.js → chunk-237NITCY.js} +20 -5
  10. package/dist/{chunk-LM6YBGC6.cjs → chunk-2HNC5JVK.cjs} +2 -2
  11. package/dist/{chunk-4KCSCJ6E.js → chunk-2Q2PSPZK.js} +1 -1
  12. package/dist/{chunk-24AZZCCW.js → chunk-3FS7K4DZ.js} +1 -1
  13. package/dist/{chunk-OQNYDN5F.cjs → chunk-3JH36WUJ.cjs} +2 -2
  14. package/dist/{chunk-CTSV5JAF.cjs → chunk-44UTUCBG.cjs} +21 -8
  15. package/dist/{chunk-MOH4CWHN.cjs → chunk-6XRDZOE3.cjs} +968 -664
  16. package/dist/{chunk-MZQXGWUK.cjs → chunk-7C2NEC7D.cjs} +2 -2
  17. package/dist/{chunk-SIEHJFKB.js → chunk-A5GTERYN.js} +2 -2
  18. package/dist/chunk-B4KLWFY6.cjs +32 -0
  19. package/dist/{chunk-FBMQTOMN.js → chunk-C5TKY75S.js} +1 -1
  20. package/dist/{chunk-T4AJOD6A.cjs → chunk-DMXXNXLS.cjs} +4 -4
  21. package/dist/{chunk-IHWRGHX6.cjs → chunk-F4BD5CXH.cjs} +2 -2
  22. package/dist/chunk-GRAVJX3I.js +29 -0
  23. package/dist/{chunk-WE7PLY4H.cjs → chunk-HV7SHEHD.cjs} +11 -4
  24. package/dist/{chunk-WJ4CZKXY.js → chunk-JKBJF3UI.js} +1 -1
  25. package/dist/{chunk-2QGVOWKM.js → chunk-L4AXJFX2.js} +19 -6
  26. package/dist/{chunk-VXF37DA2.cjs → chunk-LKYBC6DX.cjs} +4 -4
  27. package/dist/{chunk-A2EZ3M22.js → chunk-M6XGEVJY.js} +1 -1
  28. package/dist/{chunk-FYKDALJL.js → chunk-NZXMP4J5.js} +1 -1
  29. package/dist/{chunk-F4TS44KB.js → chunk-OZU47JET.js} +999 -702
  30. package/dist/{chunk-FCTNMPJF.cjs → chunk-PAMSESZV.cjs} +1 -1
  31. package/dist/{chunk-TY3QAXEY.js → chunk-PDFOF6ZP.js} +11 -4
  32. package/dist/{chunk-IMMNZSFZ.cjs → chunk-PJP4MECA.cjs} +2 -2
  33. package/dist/{chunk-VSZXQLMI.js → chunk-QQGXARP3.js} +1 -1
  34. package/dist/{chunk-6UVRB3IN.cjs → chunk-SQANNMRF.cjs} +22 -7
  35. package/dist/{chunk-2KGMZZ36.js → chunk-SVDPKN3U.js} +1 -1
  36. package/dist/chunk-SVF4ATJR.cjs +8 -0
  37. package/dist/{chunk-VVFIZVYE.cjs → chunk-UVM4JAR3.cjs} +2 -2
  38. package/dist/{chunk-JKF342AW.js → chunk-WU7I52LM.js} +2 -2
  39. package/dist/{chunk-P3BP6LXC.cjs → chunk-WYJGOC3Y.cjs} +2 -2
  40. package/dist/{chunk-KL7HP7JM.cjs → chunk-YG5ORYN2.cjs} +2 -2
  41. package/dist/{chunk-QH3M5FBF.js → chunk-ZPOCM5XZ.js} +1 -1
  42. package/dist/chunk-ZWF7LZXE.js +5 -0
  43. package/dist/config.d.cts +1 -2
  44. package/dist/config.d.ts +1 -2
  45. package/dist/esbuild.cjs +9 -9
  46. package/dist/esbuild.d.cts +1 -2
  47. package/dist/esbuild.d.ts +1 -2
  48. package/dist/esbuild.js +6 -6
  49. package/dist/farm.cjs +5 -5
  50. package/dist/farm.d.cts +1 -2
  51. package/dist/farm.d.ts +1 -2
  52. package/dist/farm.js +4 -4
  53. package/dist/{hooks-CUxY7WKY.d.cts → hooks-CJ1W5lrx.d.cts} +1 -1
  54. package/dist/{hooks-BBZyf9CN.d.ts → hooks-CNEZpkMS.d.ts} +1 -1
  55. package/dist/index.cjs +45 -287
  56. package/dist/index.d.cts +3 -4
  57. package/dist/index.d.ts +3 -4
  58. package/dist/index.js +20 -244
  59. package/dist/lib/build/esbuild.cjs +5 -5
  60. package/dist/lib/build/esbuild.d.cts +1 -3
  61. package/dist/lib/build/esbuild.d.ts +1 -3
  62. package/dist/lib/build/esbuild.js +2 -2
  63. package/dist/lib/build/index.cjs +23 -23
  64. package/dist/lib/build/index.d.cts +2 -4
  65. package/dist/lib/build/index.d.ts +2 -4
  66. package/dist/lib/build/index.js +8 -8
  67. package/dist/lib/build/rolldown.cjs +3 -3
  68. package/dist/lib/build/rolldown.d.cts +1 -3
  69. package/dist/lib/build/rolldown.d.ts +1 -3
  70. package/dist/lib/build/rolldown.js +2 -2
  71. package/dist/lib/build/rollup.cjs +3 -3
  72. package/dist/lib/build/rollup.d.cts +1 -3
  73. package/dist/lib/build/rollup.d.ts +1 -3
  74. package/dist/lib/build/rollup.js +1 -1
  75. package/dist/lib/build/rspack.d.cts +1 -3
  76. package/dist/lib/build/rspack.d.ts +1 -3
  77. package/dist/lib/build/tsup.cjs +6 -6
  78. package/dist/lib/build/tsup.d.cts +1 -3
  79. package/dist/lib/build/tsup.d.ts +1 -3
  80. package/dist/lib/build/tsup.js +3 -3
  81. package/dist/lib/build/unbuild.cjs +5 -5
  82. package/dist/lib/build/unbuild.d.cts +2 -4
  83. package/dist/lib/build/unbuild.d.ts +2 -4
  84. package/dist/lib/build/unbuild.js +2 -2
  85. package/dist/lib/build/vite.cjs +5 -5
  86. package/dist/lib/build/vite.d.cts +1 -3
  87. package/dist/lib/build/vite.d.ts +1 -3
  88. package/dist/lib/build/vite.js +3 -3
  89. package/dist/lib/build/webpack.cjs +2 -2
  90. package/dist/lib/build/webpack.d.cts +1 -3
  91. package/dist/lib/build/webpack.d.ts +1 -3
  92. package/dist/lib/build/webpack.js +1 -1
  93. package/dist/lib/{chunk-K4FER6YK.cjs → chunk-27VJFYDM.cjs} +13 -6
  94. package/dist/lib/{chunk-ZJNDT3GX.js → chunk-3G4C3YAU.js} +12 -5
  95. package/dist/lib/{chunk-TTKY3DR4.js → chunk-43VJVIL2.js} +975 -679
  96. package/dist/lib/{chunk-CLV4J4L7.cjs → chunk-4FX4VOLA.cjs} +2 -3
  97. package/dist/lib/{chunk-DFRWBQQT.js → chunk-5GM5UAUO.js} +3 -4
  98. package/dist/lib/{chunk-S5F4DE65.js → chunk-5SADLYYK.js} +1 -1
  99. package/dist/lib/{chunk-TNHDC2ZQ.cjs → chunk-7XHBIYIN.cjs} +1 -20
  100. package/dist/lib/{chunk-SM3S7DYW.js → chunk-BHDQZ6YX.js} +12 -2
  101. package/dist/lib/{chunk-FGYAS4NB.cjs → chunk-CSJ6KNIX.cjs} +11 -4
  102. package/dist/lib/{chunk-O36FCQM6.cjs → chunk-E2MVGKGH.cjs} +2 -2
  103. package/dist/lib/{chunk-O5LNKYQV.cjs → chunk-FN7673NC.cjs} +2 -2
  104. package/dist/lib/{chunk-HIY6WOU3.cjs → chunk-GDXHCTCX.cjs} +13 -6
  105. package/dist/lib/{chunk-IBONIIAZ.cjs → chunk-HCOHRD3Q.cjs} +19 -6
  106. package/dist/lib/{chunk-OI2V6L7D.js → chunk-HOZ37BFN.js} +2 -3
  107. package/dist/lib/{chunk-4QRL5CNE.js → chunk-HQ5YA43H.js} +11 -4
  108. package/dist/lib/{chunk-IXREPTHZ.js → chunk-IOM7GRZU.js} +1 -1
  109. package/dist/lib/{chunk-WFUO3YPK.js → chunk-L4NEN725.js} +19 -4
  110. package/dist/lib/{chunk-H7V7EPB2.cjs → chunk-LAFEAMNN.cjs} +2 -2
  111. package/dist/lib/{chunk-7Y5MJRWF.js → chunk-LIN4KAV3.js} +57 -34
  112. package/dist/lib/{chunk-MWA3DWY5.cjs → chunk-LMO7PRBP.cjs} +4 -5
  113. package/dist/lib/{chunk-ARCFV3IJ.cjs → chunk-LPA7UJIR.cjs} +955 -657
  114. package/dist/lib/{chunk-OTBLE55Z.cjs → chunk-MPCVQK2D.cjs} +12 -1
  115. package/dist/lib/{chunk-4RUHX7LV.js → chunk-QAXCBFBP.js} +1 -1
  116. package/dist/lib/{chunk-WWNNBLU7.js → chunk-T7RMV2FW.js} +18 -5
  117. package/dist/lib/{chunk-7K7JH3DF.cjs → chunk-ULJVBW4L.cjs} +19 -4
  118. package/dist/lib/{chunk-UDJ37BEE.cjs → chunk-VGSV2BEL.cjs} +57 -34
  119. package/dist/lib/{chunk-GRJJZ5VJ.js → chunk-YH5GOJS3.js} +2 -15
  120. package/dist/lib/{chunk-NU4GDWLL.js → chunk-YV6MDKW4.js} +12 -5
  121. package/dist/lib/{config-DN8Ad0lv.d.cts → config-7vXtXiGg.d.cts} +67 -67
  122. package/dist/lib/{config-Bag1Ft7u.d.ts → config-B9aVEiiX.d.ts} +67 -67
  123. package/dist/lib/config-file.d.cts +1 -3
  124. package/dist/lib/config-file.d.ts +1 -3
  125. package/dist/lib/create-program.d.cts +1 -3
  126. package/dist/lib/create-program.d.ts +1 -3
  127. package/dist/lib/entry.cjs +9 -9
  128. package/dist/lib/entry.d.cts +1 -3
  129. package/dist/lib/entry.d.ts +1 -3
  130. package/dist/lib/entry.js +1 -1
  131. package/dist/lib/{hooks-BVnPAWgt.d.ts → hooks-BxUBzqCb.d.ts} +1 -1
  132. package/dist/lib/{hooks-H2P-7xA4.d.cts → hooks-cvv50JDh.d.cts} +1 -1
  133. package/dist/lib/index.cjs +32 -28
  134. package/dist/lib/index.d.cts +326 -7
  135. package/dist/lib/index.d.ts +326 -7
  136. package/dist/lib/index.js +8 -8
  137. package/dist/lib/logger.d.cts +1 -3
  138. package/dist/lib/logger.d.ts +1 -3
  139. package/dist/lib/typescript/compiler-host.d.cts +1 -3
  140. package/dist/lib/typescript/compiler-host.d.ts +1 -3
  141. package/dist/lib/typescript/import-transformer.d.cts +1 -3
  142. package/dist/lib/typescript/import-transformer.d.ts +1 -3
  143. package/dist/lib/typescript/index.d.cts +1 -3
  144. package/dist/lib/typescript/index.d.ts +1 -3
  145. package/dist/lib/typescript/program.d.cts +1 -3
  146. package/dist/lib/typescript/program.d.ts +1 -3
  147. package/dist/lib/unplugin/factory.cjs +5 -5
  148. package/dist/lib/unplugin/factory.d.cts +7 -9
  149. package/dist/lib/unplugin/factory.d.ts +7 -9
  150. package/dist/lib/unplugin/factory.js +4 -4
  151. package/dist/lib/unplugin/index.cjs +8 -8
  152. package/dist/lib/unplugin/index.d.cts +2 -4
  153. package/dist/lib/unplugin/index.d.ts +2 -4
  154. package/dist/lib/unplugin/index.js +5 -5
  155. package/dist/lib/unplugin/plugin.cjs +3 -3
  156. package/dist/lib/unplugin/plugin.d.cts +1 -3
  157. package/dist/lib/unplugin/plugin.d.ts +1 -3
  158. package/dist/lib/unplugin/plugin.js +2 -2
  159. package/dist/lib/unplugin/resolve-id.cjs +2 -2
  160. package/dist/lib/unplugin/resolve-id.d.cts +1 -3
  161. package/dist/lib/unplugin/resolve-id.d.ts +1 -3
  162. package/dist/lib/unplugin/resolve-id.js +1 -1
  163. package/dist/lib/utilities/bundle.cjs +4 -4
  164. package/dist/lib/utilities/bundle.d.cts +1 -3
  165. package/dist/lib/utilities/bundle.d.ts +1 -3
  166. package/dist/lib/utilities/bundle.js +3 -3
  167. package/dist/lib/utilities/cache.d.cts +1 -3
  168. package/dist/lib/utilities/cache.d.ts +1 -3
  169. package/dist/lib/utilities/file-header.d.cts +1 -3
  170. package/dist/lib/utilities/file-header.d.ts +1 -3
  171. package/dist/lib/utilities/index.cjs +14 -14
  172. package/dist/lib/utilities/index.d.cts +1 -3
  173. package/dist/lib/utilities/index.d.ts +1 -3
  174. package/dist/lib/utilities/index.js +5 -5
  175. package/dist/lib/utilities/meta.cjs +8 -8
  176. package/dist/lib/utilities/meta.d.cts +1 -3
  177. package/dist/lib/utilities/meta.d.ts +1 -3
  178. package/dist/lib/utilities/meta.js +1 -1
  179. package/dist/lib/utilities/resolve-path.d.cts +1 -3
  180. package/dist/lib/utilities/resolve-path.d.ts +1 -3
  181. package/dist/lib/utilities/resolve.cjs +5 -5
  182. package/dist/lib/utilities/resolve.d.cts +1 -3
  183. package/dist/lib/utilities/resolve.d.ts +1 -3
  184. package/dist/lib/utilities/resolve.js +4 -4
  185. package/dist/lib/utilities/source-file.d.cts +1 -3
  186. package/dist/lib/utilities/source-file.d.ts +1 -3
  187. package/dist/lib/utilities/source-map.d.cts +1 -3
  188. package/dist/lib/utilities/source-map.d.ts +1 -3
  189. package/dist/lib/utilities/worker.d.cts +1 -3
  190. package/dist/lib/utilities/worker.d.ts +1 -3
  191. package/dist/lib/utilities/write-file.d.cts +1 -3
  192. package/dist/lib/utilities/write-file.d.ts +1 -3
  193. package/dist/next.cjs +9 -9
  194. package/dist/next.js +6 -6
  195. package/dist/nuxt.cjs +11 -11
  196. package/dist/nuxt.js +8 -8
  197. package/dist/plugin-utils/{chunk-YKIS7BLU.cjs → chunk-5MO4BCOW.cjs} +24 -0
  198. package/dist/plugin-utils/{chunk-HHFA3IEZ.js → chunk-CYVV2MB7.js} +24 -0
  199. package/dist/plugin-utils/chunk-DGUQQKZF.js +41 -0
  200. package/dist/plugin-utils/{chunk-75UVEMIV.cjs → chunk-DZZPNO5H.cjs} +2 -2
  201. package/dist/plugin-utils/{chunk-WEIEQXIJ.cjs → chunk-ECFS7DPV.cjs} +5 -5
  202. package/dist/plugin-utils/{chunk-MQOW6ENT.cjs → chunk-F65J5WOX.cjs} +1 -1
  203. package/dist/plugin-utils/{chunk-IHME6YWJ.js → chunk-GV7O3E7P.js} +1 -1
  204. package/dist/plugin-utils/chunk-HZIY2AV4.cjs +43 -0
  205. package/dist/plugin-utils/{chunk-PK6PYFWY.js → chunk-L277XSSN.js} +1 -1
  206. package/dist/plugin-utils/{chunk-YDYJAGMP.js → chunk-QKMG6ZAU.js} +1 -1
  207. package/dist/plugin-utils/{chunk-5TL6KEQ5.cjs → chunk-UNAGYQRB.cjs} +4 -4
  208. package/dist/plugin-utils/{chunk-432MQOUZ.js → chunk-XIXI67PY.js} +1 -1
  209. package/dist/plugin-utils/{config-pwKiZvzJ.d.cts → context-BseW8r26.d.cts} +406 -406
  210. package/dist/plugin-utils/{config-pwKiZvzJ.d.ts → context-BseW8r26.d.ts} +406 -406
  211. package/dist/plugin-utils/context-helpers.cjs +11 -0
  212. package/dist/plugin-utils/context-helpers.d.cts +29 -0
  213. package/dist/plugin-utils/context-helpers.d.ts +29 -0
  214. package/dist/plugin-utils/context-helpers.js +2 -0
  215. package/dist/plugin-utils/enforce.cjs +5 -5
  216. package/dist/plugin-utils/enforce.d.cts +9 -11
  217. package/dist/plugin-utils/enforce.d.ts +9 -11
  218. package/dist/plugin-utils/enforce.js +4 -4
  219. package/dist/plugin-utils/extend.cjs +4 -4
  220. package/dist/plugin-utils/extend.d.cts +9 -11
  221. package/dist/plugin-utils/extend.d.ts +9 -11
  222. package/dist/plugin-utils/extend.js +3 -3
  223. package/dist/plugin-utils/get-config-path.cjs +2 -2
  224. package/dist/plugin-utils/get-config-path.d.cts +9 -11
  225. package/dist/plugin-utils/get-config-path.d.ts +9 -11
  226. package/dist/plugin-utils/get-config-path.js +1 -1
  227. package/dist/plugin-utils/helpers.cjs +14 -14
  228. package/dist/plugin-utils/helpers.d.cts +7 -9
  229. package/dist/plugin-utils/helpers.d.ts +7 -9
  230. package/dist/plugin-utils/helpers.js +1 -1
  231. package/dist/plugin-utils/index.cjs +27 -22
  232. package/dist/plugin-utils/index.d.cts +10 -11
  233. package/dist/plugin-utils/index.d.ts +10 -11
  234. package/dist/plugin-utils/index.js +6 -5
  235. package/dist/plugin-utils/merge.cjs +3 -3
  236. package/dist/plugin-utils/merge.d.cts +9 -11
  237. package/dist/plugin-utils/merge.d.ts +9 -11
  238. package/dist/plugin-utils/merge.js +2 -2
  239. package/dist/plugin-utils/paths.d.cts +9 -11
  240. package/dist/plugin-utils/paths.d.ts +9 -11
  241. package/dist/{resolved-ohMN-3VJ.d.cts → resolved-D8vIizyA.d.cts} +15 -16
  242. package/dist/{resolved-Sxyrlt6g.d.ts → resolved-DWxXKJYy.d.ts} +15 -16
  243. package/dist/rolldown.cjs +8 -8
  244. package/dist/rolldown.d.cts +1 -2
  245. package/dist/rolldown.d.ts +1 -2
  246. package/dist/rolldown.js +5 -5
  247. package/dist/rollup.cjs +8 -8
  248. package/dist/rollup.d.cts +1 -2
  249. package/dist/rollup.d.ts +1 -2
  250. package/dist/rollup.js +5 -5
  251. package/dist/rspack.cjs +8 -8
  252. package/dist/rspack.d.cts +1 -2
  253. package/dist/rspack.d.ts +1 -2
  254. package/dist/rspack.js +5 -5
  255. package/dist/tsup.cjs +10 -10
  256. package/dist/tsup.js +7 -7
  257. package/dist/types/babel.d.cts +1 -2
  258. package/dist/types/babel.d.ts +1 -2
  259. package/dist/types/build.d.cts +18 -1
  260. package/dist/types/build.d.ts +18 -1
  261. package/dist/types/commands.cjs +2 -2
  262. package/dist/types/commands.d.cts +1 -2
  263. package/dist/types/commands.d.ts +1 -2
  264. package/dist/types/commands.js +1 -1
  265. package/dist/types/config.d.cts +1 -2
  266. package/dist/types/config.d.ts +1 -2
  267. package/dist/types/context.d.cts +1 -2
  268. package/dist/types/context.d.ts +1 -2
  269. package/dist/types/hooks.d.cts +1 -2
  270. package/dist/types/hooks.d.ts +1 -2
  271. package/dist/types/index.cjs +6 -22
  272. package/dist/types/index.d.cts +2 -3
  273. package/dist/types/index.d.ts +2 -3
  274. package/dist/types/index.js +2 -2
  275. package/dist/types/internal.d.cts +2 -3
  276. package/dist/types/internal.d.ts +2 -3
  277. package/dist/types/plugin.d.cts +1 -2
  278. package/dist/types/plugin.d.ts +1 -2
  279. package/dist/types/resolved.d.cts +1 -2
  280. package/dist/types/resolved.d.ts +1 -2
  281. package/dist/types/unplugin.d.cts +1 -2
  282. package/dist/types/unplugin.d.ts +1 -2
  283. package/dist/types/vfs.cjs +4 -20
  284. package/dist/types/vfs.d.cts +47 -54
  285. package/dist/types/vfs.d.ts +47 -54
  286. package/dist/types/vfs.js +1 -1
  287. package/dist/unloader.cjs +8 -8
  288. package/dist/unloader.d.cts +1 -2
  289. package/dist/unloader.d.ts +1 -2
  290. package/dist/unloader.js +5 -5
  291. package/dist/unplugin.cjs +20 -20
  292. package/dist/unplugin.d.cts +2 -3
  293. package/dist/unplugin.d.ts +2 -3
  294. package/dist/unplugin.js +17 -17
  295. package/dist/vite.cjs +9 -9
  296. package/dist/vite.d.cts +1 -2
  297. package/dist/vite.d.ts +1 -2
  298. package/dist/vite.js +6 -6
  299. package/dist/webpack.cjs +8 -8
  300. package/dist/webpack.d.cts +1 -2
  301. package/dist/webpack.d.ts +1 -2
  302. package/dist/webpack.js +5 -5
  303. package/package.json +3 -3
  304. package/dist/chunk-OBYFBPPO.js +0 -9
  305. package/dist/chunk-RF6RSWD4.cjs +0 -16
  306. package/dist/chunk-SECEPZQ3.cjs +0 -32
  307. package/dist/chunk-XBS3AHAK.js +0 -29
@@ -2,13 +2,13 @@
2
2
 
3
3
  var chunk2NZADVP5_cjs = require('./chunk-2NZADVP5.cjs');
4
4
  var chunk4NHFXDTQ_cjs = require('./chunk-4NHFXDTQ.cjs');
5
- var chunkTNHDC2ZQ_cjs = require('./chunk-TNHDC2ZQ.cjs');
6
- var chunk7K7JH3DF_cjs = require('./chunk-7K7JH3DF.cjs');
5
+ var chunk7XHBIYIN_cjs = require('./chunk-7XHBIYIN.cjs');
6
+ var chunkULJVBW4L_cjs = require('./chunk-ULJVBW4L.cjs');
7
7
  var chunkBQU53ZNB_cjs = require('./chunk-BQU53ZNB.cjs');
8
8
  var chunkXW5TELHB_cjs = require('./chunk-XW5TELHB.cjs');
9
9
  var chunkJA4HSQRN_cjs = require('./chunk-JA4HSQRN.cjs');
10
10
  var chunk3OCI4TH7_cjs = require('./chunk-3OCI4TH7.cjs');
11
- var chunkOTBLE55Z_cjs = require('./chunk-OTBLE55Z.cjs');
11
+ var chunkMPCVQK2D_cjs = require('./chunk-MPCVQK2D.cjs');
12
12
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
13
13
  var types = require('@storm-software/config-tools/types');
14
14
  var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
@@ -33,7 +33,7 @@ var isSet = require('@stryke/type-checks/is-set');
33
33
  var isSetObject = require('@stryke/type-checks/is-set-object');
34
34
  var isSetString = require('@stryke/type-checks/is-set-string');
35
35
  var chalk4 = require('chalk');
36
- var defu3 = require('defu');
36
+ var defu2 = require('defu');
37
37
  var Handlebars = require('handlebars');
38
38
  var helperPluginUtils = require('@babel/helper-plugin-utils');
39
39
  var t = require('@babel/types');
@@ -52,17 +52,19 @@ var isNull = require('@stryke/type-checks/is-null');
52
52
  var isString = require('@stryke/type-checks/is-string');
53
53
  var uuid = require('@stryke/unique-id/uuid');
54
54
  var oxcParser = require('oxc-parser');
55
- var isUndefined = require('@stryke/type-checks/is-undefined');
56
- var jiti = require('jiti');
55
+ var $ = require('@stryke/capnp');
57
56
  var bufferToString = require('@stryke/convert/buffer-to-string');
58
- var isParentPath = require('@stryke/path/is-parent-path');
57
+ var buffer = require('@stryke/fs/buffer');
59
58
  var prettyBytes = require('@stryke/string-format/pretty-bytes');
60
59
  var isBuffer = require('@stryke/type-checks/is-buffer');
61
- var memfs = require('memfs');
62
- var buffer = require('buffer');
60
+ var buffer$1 = require('buffer');
63
61
  var fs = require('fs');
64
62
  var prettier = require('prettier');
63
+ var isUndefined = require('@stryke/type-checks/is-undefined');
64
+ var isParentPath = require('@stryke/path/is-parent-path');
65
+ var volume = require('memfs/lib/node/volume');
65
66
  var unionfs = require('unionfs');
67
+ var jiti = require('jiti');
66
68
  var isObject = require('@stryke/type-checks/is-object');
67
69
  var ts = require('typescript');
68
70
  var _package = require('@stryke/string-format/package');
@@ -90,9 +92,10 @@ function _interopNamespace(e) {
90
92
  }
91
93
 
92
94
  var chalk4__default = /*#__PURE__*/_interopDefault(chalk4);
93
- var defu3__default = /*#__PURE__*/_interopDefault(defu3);
95
+ var defu2__default = /*#__PURE__*/_interopDefault(defu2);
94
96
  var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
95
97
  var t__namespace = /*#__PURE__*/_interopNamespace(t);
98
+ var $__namespace = /*#__PURE__*/_interopNamespace($);
96
99
  var fs__default = /*#__PURE__*/_interopDefault(fs);
97
100
  var ts__default = /*#__PURE__*/_interopDefault(ts);
98
101
 
@@ -199,7 +202,7 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((contex
199
202
  }, "moduleResolverBabelPlugin");
200
203
  var DEFAULT_ENVIRONMENT = "default";
201
204
  function createEnvironment(name, userConfig) {
202
- return defu3__default.default(userConfig.environments?.[name] ?? {}, {
205
+ return defu2__default.default(userConfig.environments?.[name] ?? {}, {
203
206
  name,
204
207
  title: userConfig.title || titleCase.titleCase(userConfig.name),
205
208
  ssr: false,
@@ -242,94 +245,232 @@ function createDefaultEnvironment(userConfig) {
242
245
  return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
243
246
  }
244
247
  chunkUSNT2KNT_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
245
-
246
- // src/types/commands.ts
247
- var SUPPORTED_COMMANDS = [
248
- "new",
249
- "clean",
250
- "prepare",
251
- "lint",
252
- "test",
253
- "build",
254
- "docs",
255
- "release",
256
- "finalize"
257
- ];
258
-
259
- // src/plugin-utils/helpers.ts
260
- function isPlugin(value) {
261
- 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)) && 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)));
262
- }
263
- chunkUSNT2KNT_cjs.__name(isPlugin, "isPlugin");
264
- function isPluginConfigObject(value) {
265
- 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));
266
- }
267
- chunkUSNT2KNT_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
268
- function isPluginConfigTuple(value) {
269
- 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]));
270
- }
271
- chunkUSNT2KNT_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
272
- function isPluginConfig(value) {
273
- return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
274
- }
275
- chunkUSNT2KNT_cjs.__name(isPluginConfig, "isPluginConfig");
276
- function isPluginHookFunction(value) {
277
- return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
278
- }
279
- chunkUSNT2KNT_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
280
- function isPluginHookObject(value) {
281
- return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
282
- }
283
- chunkUSNT2KNT_cjs.__name(isPluginHookObject, "isPluginHookObject");
284
- function isPluginHook(value) {
285
- return isPluginHookFunction(value) || isPluginHookObject(value);
286
- }
287
- chunkUSNT2KNT_cjs.__name(isPluginHook, "isPluginHook");
288
- function getHookHandler(pluginHook) {
289
- return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
290
- }
291
- chunkUSNT2KNT_cjs.__name(getHookHandler, "getHookHandler");
292
- function isHookExternal(hook) {
293
- return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
294
- }
295
- chunkUSNT2KNT_cjs.__name(isHookExternal, "isHookExternal");
296
- function checkDedupe(plugin, plugins) {
297
- return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
298
- }
299
- chunkUSNT2KNT_cjs.__name(checkDedupe, "checkDedupe");
300
- function addPluginHook(context, plugin, pluginHook, hooksList) {
301
- if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
302
- hooksList.push(isFunction.isFunction(pluginHook) ? {
303
- plugin,
304
- handler: getHookHandler(pluginHook).bind(context)
305
- } : {
306
- plugin,
307
- ...pluginHook,
308
- handler: getHookHandler(pluginHook).bind(context)
309
- });
248
+ BigInt("0xa56c61324b9d6e49");
249
+ var FileMetadata_KeyValuePair = class extends $__namespace.Struct {
250
+ static {
251
+ chunkUSNT2KNT_cjs.__name(this, "FileMetadata_KeyValuePair");
310
252
  }
311
- }
312
- chunkUSNT2KNT_cjs.__name(addPluginHook, "addPluginHook");
313
- function resolveOptions(options) {
314
- return defu3__default.default(options, {
315
- interopDefault: true,
316
- fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
317
- moduleCache: options.mode !== "development"
318
- });
319
- }
320
- chunkUSNT2KNT_cjs.__name(resolveOptions, "resolveOptions");
321
- function createPluginResolver(options) {
322
- return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
323
- ...options
324
- }));
325
- }
326
- chunkUSNT2KNT_cjs.__name(createPluginResolver, "createPluginResolver");
327
- function createResolver(options) {
328
- const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
329
- baseResolver.plugin = createPluginResolver(options);
330
- return baseResolver;
331
- }
332
- chunkUSNT2KNT_cjs.__name(createResolver, "createResolver");
253
+ static _capnp = {
254
+ displayName: "KeyValuePair",
255
+ id: "eabb26cf58b2a14c",
256
+ size: new $__namespace.ObjectSize(0, 2)
257
+ };
258
+ get key() {
259
+ return $__namespace.utils.getText(0, this);
260
+ }
261
+ set key(value) {
262
+ $__namespace.utils.setText(0, value, this);
263
+ }
264
+ get value() {
265
+ return $__namespace.utils.getText(1, this);
266
+ }
267
+ set value(value) {
268
+ $__namespace.utils.setText(1, value, this);
269
+ }
270
+ toString() {
271
+ return "FileMetadata_KeyValuePair_" + super.toString();
272
+ }
273
+ };
274
+ var FileMetadata = class _FileMetadata extends $__namespace.Struct {
275
+ static {
276
+ chunkUSNT2KNT_cjs.__name(this, "FileMetadata");
277
+ }
278
+ static KeyValuePair = FileMetadata_KeyValuePair;
279
+ static _capnp = {
280
+ displayName: "FileMetadata",
281
+ id: "8e2cab5d7e28c7b3",
282
+ size: new $__namespace.ObjectSize(0, 4),
283
+ defaultVariant: "normal"
284
+ };
285
+ static _Properties;
286
+ /**
287
+ * The variant of the file.
288
+ *
289
+ */
290
+ get id() {
291
+ return $__namespace.utils.getText(0, this);
292
+ }
293
+ set id(value) {
294
+ $__namespace.utils.setText(0, value, this);
295
+ }
296
+ /**
297
+ * The output mode of the file.
298
+ *
299
+ */
300
+ get variant() {
301
+ return $__namespace.utils.getText(1, this, _FileMetadata._capnp.defaultVariant);
302
+ }
303
+ set variant(value) {
304
+ $__namespace.utils.setText(1, value, this);
305
+ }
306
+ /**
307
+ * Additional metadata associated with the file.
308
+ *
309
+ */
310
+ get mode() {
311
+ return $__namespace.utils.getText(2, this);
312
+ }
313
+ set mode(value) {
314
+ $__namespace.utils.setText(2, value, this);
315
+ }
316
+ _adoptProperties(value) {
317
+ $__namespace.utils.adopt(value, $__namespace.utils.getPointer(3, this));
318
+ }
319
+ _disownProperties() {
320
+ return $__namespace.utils.disown(this.properties);
321
+ }
322
+ get properties() {
323
+ return $__namespace.utils.getList(3, _FileMetadata._Properties, this);
324
+ }
325
+ _hasProperties() {
326
+ return !$__namespace.utils.isNull($__namespace.utils.getPointer(3, this));
327
+ }
328
+ _initProperties(length) {
329
+ return $__namespace.utils.initList(3, _FileMetadata._Properties, length, this);
330
+ }
331
+ set properties(value) {
332
+ $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(3, this));
333
+ }
334
+ toString() {
335
+ return "FileMetadata_" + super.toString();
336
+ }
337
+ };
338
+ var FileIdentifier = class extends $__namespace.Struct {
339
+ static {
340
+ chunkUSNT2KNT_cjs.__name(this, "FileIdentifier");
341
+ }
342
+ static _capnp = {
343
+ displayName: "FileIdentifier",
344
+ id: "e12b8732389d7406",
345
+ size: new $__namespace.ObjectSize(0, 2)
346
+ };
347
+ /**
348
+ * An additional identifier for the file.
349
+ *
350
+ */
351
+ get path() {
352
+ return $__namespace.utils.getText(0, this);
353
+ }
354
+ set path(value) {
355
+ $__namespace.utils.setText(0, value, this);
356
+ }
357
+ get id() {
358
+ return $__namespace.utils.getText(1, this);
359
+ }
360
+ set id(value) {
361
+ $__namespace.utils.setText(1, value, this);
362
+ }
363
+ toString() {
364
+ return "FileIdentifier_" + super.toString();
365
+ }
366
+ };
367
+ var FileData = class extends $__namespace.Struct {
368
+ static {
369
+ chunkUSNT2KNT_cjs.__name(this, "FileData");
370
+ }
371
+ static _capnp = {
372
+ displayName: "FileData",
373
+ id: "fa6725c8a360f9a2",
374
+ size: new $__namespace.ObjectSize(0, 2)
375
+ };
376
+ /**
377
+ * The contents of the file.
378
+ *
379
+ */
380
+ get path() {
381
+ return $__namespace.utils.getText(0, this);
382
+ }
383
+ set path(value) {
384
+ $__namespace.utils.setText(0, value, this);
385
+ }
386
+ get content() {
387
+ return $__namespace.utils.getText(1, this);
388
+ }
389
+ set content(value) {
390
+ $__namespace.utils.setText(1, value, this);
391
+ }
392
+ toString() {
393
+ return "FileData_" + super.toString();
394
+ }
395
+ };
396
+ var FileSystemData = class _FileSystemData extends $__namespace.Struct {
397
+ static {
398
+ chunkUSNT2KNT_cjs.__name(this, "FileSystemData");
399
+ }
400
+ static _capnp = {
401
+ displayName: "FileSystemData",
402
+ id: "aaa72a672ac0732f",
403
+ size: new $__namespace.ObjectSize(0, 3)
404
+ };
405
+ static _Ids;
406
+ static _Metadata;
407
+ static _Files;
408
+ _adoptIds(value) {
409
+ $__namespace.utils.adopt(value, $__namespace.utils.getPointer(0, this));
410
+ }
411
+ _disownIds() {
412
+ return $__namespace.utils.disown(this.ids);
413
+ }
414
+ get ids() {
415
+ return $__namespace.utils.getList(0, _FileSystemData._Ids, this);
416
+ }
417
+ _hasIds() {
418
+ return !$__namespace.utils.isNull($__namespace.utils.getPointer(0, this));
419
+ }
420
+ _initIds(length) {
421
+ return $__namespace.utils.initList(0, _FileSystemData._Ids, length, this);
422
+ }
423
+ set ids(value) {
424
+ $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(0, this));
425
+ }
426
+ _adoptMetadata(value) {
427
+ $__namespace.utils.adopt(value, $__namespace.utils.getPointer(1, this));
428
+ }
429
+ _disownMetadata() {
430
+ return $__namespace.utils.disown(this.metadata);
431
+ }
432
+ get metadata() {
433
+ return $__namespace.utils.getList(1, _FileSystemData._Metadata, this);
434
+ }
435
+ _hasMetadata() {
436
+ return !$__namespace.utils.isNull($__namespace.utils.getPointer(1, this));
437
+ }
438
+ _initMetadata(length) {
439
+ return $__namespace.utils.initList(1, _FileSystemData._Metadata, length, this);
440
+ }
441
+ set metadata(value) {
442
+ $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(1, this));
443
+ }
444
+ _adoptFiles(value) {
445
+ $__namespace.utils.adopt(value, $__namespace.utils.getPointer(2, this));
446
+ }
447
+ _disownFiles() {
448
+ return $__namespace.utils.disown(this.files);
449
+ }
450
+ get files() {
451
+ return $__namespace.utils.getList(2, _FileSystemData._Files, this);
452
+ }
453
+ _hasFiles() {
454
+ return !$__namespace.utils.isNull($__namespace.utils.getPointer(2, this));
455
+ }
456
+ _initFiles(length) {
457
+ return $__namespace.utils.initList(2, _FileSystemData._Files, length, this);
458
+ }
459
+ set files(value) {
460
+ $__namespace.utils.copyFrom(value, $__namespace.utils.getPointer(2, this));
461
+ }
462
+ toString() {
463
+ return "FileSystemData_" + super.toString();
464
+ }
465
+ };
466
+ FileMetadata._Properties = $__namespace.CompositeList(FileMetadata_KeyValuePair);
467
+ FileSystemData._Ids = $__namespace.CompositeList(FileIdentifier);
468
+ FileSystemData._Metadata = $__namespace.CompositeList(FileMetadata);
469
+ FileSystemData._Files = $__namespace.CompositeList(FileData);
470
+
471
+ // src/types/vfs.ts
472
+ var __VFS_PATCH__ = Symbol("__VFS_PATCH__");
473
+ var __VFS_REVERT__ = Symbol("__VFS_REVERT__");
333
474
  function isBufferEncoding(options) {
334
475
  return isSetString.isSetString(options) || options === null;
335
476
  }
@@ -478,46 +619,201 @@ function patchFS(originalFS, vfs) {
478
619
  };
479
620
  }
480
621
  chunkUSNT2KNT_cjs.__name(patchFS, "patchFS");
481
- var VirtualFileSystem = class {
622
+ var UnifiedFS = class _UnifiedFS extends unionfs.Union {
482
623
  static {
483
- chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystem");
624
+ chunkUSNT2KNT_cjs.__name(this, "UnifiedFS");
484
625
  }
485
626
  /**
486
627
  * The internal map of virtual files.
487
628
  */
488
- #meta = {};
629
+ #virtualFS = new volume.Volume();
489
630
  /**
490
- * A map of unique identifiers to their virtual file paths.
631
+ * The physical file system.
491
632
  */
492
- #ids = {};
633
+ #physicalFS = cloneFS(fs__default.default);
493
634
  /**
494
- * A map of virtual file paths to their underlying file content.
635
+ * The context of the unified file system.
495
636
  */
496
- #cachedFS = /* @__PURE__ */ new Map();
637
+ #context;
638
+ static create(context, data) {
639
+ let result = new _UnifiedFS(context, data);
640
+ result = result.use(result.#physicalFS);
641
+ if (result.#context.config.output.mode !== "fs") {
642
+ result = result.use(result.#virtualFS);
643
+ }
644
+ return result;
645
+ }
497
646
  /**
498
- * A map of virtual file paths to their underlying file content.
647
+ * Gets the virtual file system (VFS).
499
648
  */
500
- #cachedResolver = /* @__PURE__ */ new Map();
649
+ get virtual() {
650
+ return this.#virtualFS;
651
+ }
501
652
  /**
502
- * The internal map of virtual files.
653
+ * Gets the physical file system (FS).
503
654
  */
504
- #virtualFS = new memfs.Volume();
655
+ get physical() {
656
+ return this.#physicalFS;
657
+ }
505
658
  /**
506
- * The physical file system.
659
+ * Creates a new instance of the VirtualFileSystem.
660
+ *
661
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
662
+ * @param data - A buffer containing the serialized virtual file system data.
507
663
  */
508
- #fs = cloneFS(fs__default.default);
664
+ constructor(context, data) {
665
+ super();
666
+ this.#context = context;
667
+ if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
668
+ this.#physicalFS.mkdirSync(this.#context.dataPath, {
669
+ recursive: true
670
+ });
671
+ }
672
+ if (!this.#physicalFS.existsSync(this.#context.cachePath)) {
673
+ this.#physicalFS.mkdirSync(this.#context.cachePath, {
674
+ recursive: true
675
+ });
676
+ }
677
+ if (!this.#physicalFS.existsSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
678
+ this.#physicalFS.mkdirSync(join.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
679
+ recursive: true
680
+ });
681
+ }
682
+ if (this.#context.config.output.mode !== "fs") {
683
+ this.#virtualFS = volume.Volume.fromJSON(data._hasFiles() && data.files.length > 0 ? data.files.values().reduce((ret, file) => {
684
+ ret[file.path] = file.content;
685
+ return ret;
686
+ }, {}) : {});
687
+ if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
688
+ this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
689
+ recursive: true
690
+ });
691
+ }
692
+ if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
693
+ this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
694
+ recursive: true
695
+ });
696
+ }
697
+ if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
698
+ this.#virtualFS.mkdirSync(this.#context.entryPath, {
699
+ recursive: true
700
+ });
701
+ }
702
+ if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
703
+ this.#virtualFS.mkdirSync(this.#context.dtsPath, {
704
+ recursive: true
705
+ });
706
+ }
707
+ } else if (this.#context.config.projectType === "application") {
708
+ if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
709
+ this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
710
+ recursive: true
711
+ });
712
+ }
713
+ if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
714
+ this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
715
+ recursive: true
716
+ });
717
+ }
718
+ if (!this.#physicalFS.existsSync(this.#context.entryPath)) {
719
+ this.#physicalFS.mkdirSync(this.#context.entryPath, {
720
+ recursive: true
721
+ });
722
+ }
723
+ if (!this.#physicalFS.existsSync(this.#context.dtsPath)) {
724
+ this.#physicalFS.mkdirSync(this.#context.dtsPath, {
725
+ recursive: true
726
+ });
727
+ }
728
+ }
729
+ }
730
+ /**
731
+ * Select the file system module to use for the operation based on the path or URL.
732
+ *
733
+ * @param pathOrUrl - The path to perform the file system operation on.
734
+ * @param options - Options for the operation, such as output mode.
735
+ * @returns The file system module used for the operation.
736
+ */
737
+ resolveFS(pathOrUrl, options = {}) {
738
+ const mode = this.resolveMode(pathOrUrl, options);
739
+ if (mode === "virtual") {
740
+ return {
741
+ ...this.#virtualFS,
742
+ mode: "virtual"
743
+ };
744
+ } else if (mode === "fs") {
745
+ return {
746
+ ...this.#physicalFS,
747
+ mode: "fs"
748
+ };
749
+ }
750
+ return {
751
+ ...this,
752
+ mode: this.#context.config.output.mode
753
+ };
754
+ }
755
+ /**
756
+ * Select the file system module to use for the operation based on the path or URL.
757
+ *
758
+ * @param pathOrUrl - The path to perform the file system operation on.
759
+ * @param options - Options for the operation, such as output mode.
760
+ * @returns The file system module used for the operation.
761
+ */
762
+ resolveMode(pathOrUrl, options = {}) {
763
+ if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
764
+ return "virtual";
765
+ } 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.outputPath))) {
766
+ return "fs";
767
+ }
768
+ return void 0;
769
+ }
770
+ /**
771
+ * Serializes the virtual file system (VFS) to a JSON object.
772
+ *
773
+ * @returns A JSON representation of the virtual file system.
774
+ */
775
+ toJSON() {
776
+ return this.#virtualFS.toJSON();
777
+ }
778
+ };
779
+
780
+ // src/lib/fs/vfs.ts
781
+ var VirtualFileSystem = class _VirtualFileSystem {
782
+ static {
783
+ chunkUSNT2KNT_cjs.__name(this, "VirtualFileSystem");
784
+ }
785
+ /**
786
+ * A map of virtual file IDs to their associated metadata.
787
+ */
788
+ #metadata;
789
+ /**
790
+ * A map of virtual file IDs to their underlying file paths.
791
+ */
792
+ #ids;
793
+ /**
794
+ * A map of underlying file paths to their virtual file IDs.
795
+ */
796
+ #paths;
797
+ /**
798
+ * A map of virtual file paths to their underlying file content.
799
+ */
800
+ #cachedResolver = /* @__PURE__ */ new Map();
509
801
  /**
510
802
  * The unified volume that combines the virtual file system with the real file system.
511
803
  *
512
804
  * @remarks
513
805
  * This volume allows for seamless access to both virtual and real files.
514
806
  */
515
- #unifiedFS = new unionfs.Union();
807
+ #unifiedFS;
516
808
  /**
517
809
  * Indicator specifying if the file system module is patched
518
810
  */
519
811
  #isPatched = false;
520
812
  /**
813
+ * Indicator specifying if the virtual file system (VFS) is disposed
814
+ */
815
+ #isDisposed = false;
816
+ /**
521
817
  * Function to revert require patch
522
818
  */
523
819
  #revert;
@@ -537,160 +833,275 @@ var VirtualFileSystem = class {
537
833
  */
538
834
  #existsSync(path) {
539
835
  const formattedPath = this.formatPath(path);
540
- return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
836
+ return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
541
837
  }
542
838
  /**
543
- * Exposes the internal VFS map for advanced usage.
839
+ * Builds a regular expression from a string pattern for path matching.
840
+ *
841
+ * @param strPattern - The string pattern to convert.
842
+ * @returns A regular expression for matching paths.
544
843
  */
545
- get [chunkTNHDC2ZQ_cjs.__VFS_CACHE__]() {
546
- return this.#cachedFS;
844
+ #buildRegex(strPattern) {
845
+ const token = "::GLOBSTAR::";
846
+ return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
547
847
  }
548
848
  /**
549
- * Exposes the internal VFS resolver cache for advanced usage.
849
+ * Formats a file id by removing the file extension and prepending the runtime prefix.
850
+ *
851
+ * @param id - The file ID to format.
852
+ * @returns The formatted file ID.
550
853
  */
551
- get [chunkTNHDC2ZQ_cjs.__VFS_RESOLVER__]() {
552
- return this.#cachedResolver;
854
+ #formatId(id) {
855
+ const formattedId = toFilePath(id);
856
+ return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
553
857
  }
554
858
  /**
555
- * Exposes the internal VFS map for advanced usage.
859
+ * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
860
+ *
861
+ * @param id - The id to resolve.
862
+ * @returns The resolved file id if it exists, otherwise undefined.
556
863
  */
557
- get [chunkTNHDC2ZQ_cjs.__VFS_VIRTUAL__]() {
558
- return this.#virtualFS;
864
+ #resolveId(id) {
865
+ if (this.#ids[this.#formatId(id)]) {
866
+ return this.#ids[this.#formatId(id)] || false;
867
+ }
868
+ return false;
559
869
  }
560
870
  /**
561
- * Exposes the internal UFS map for advanced usage.
871
+ * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
872
+ *
873
+ * @param path - The path to resolve.
874
+ * @param options - Optional parameters for resolving the path.
875
+ * @returns The resolved file path if it exists, otherwise undefined.
562
876
  */
563
- get [chunkTNHDC2ZQ_cjs.__VFS_UNIFIED__]() {
564
- return this.#unifiedFS;
877
+ #resolvePath(path, options = {}) {
878
+ if (isType.isAbsolutePath(path)) {
879
+ if (this.#existsSync(path)) {
880
+ return path;
881
+ }
882
+ const result = this.#checkVariants(path);
883
+ if (result) {
884
+ return result;
885
+ }
886
+ }
887
+ for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
888
+ const request = joinPaths.joinPaths(parentPath, path);
889
+ if (this.#existsSync(request)) {
890
+ return request;
891
+ }
892
+ const result = this.#checkVariants(request);
893
+ if (result) {
894
+ return result;
895
+ }
896
+ }
897
+ return false;
565
898
  }
566
899
  /**
567
- * A proxy to access the underlying file metadata.
900
+ * Resolves parent paths for a given request.
901
+ *
902
+ * @param request - The request path to resolve parent paths for.
903
+ * @param parents - An optional array of parent paths to consider.
904
+ * @returns An array of resolved parent paths.
568
905
  */
569
- get meta() {
570
- return new Proxy(this.#meta, {
571
- get: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
572
- if (target[prop]) {
573
- return {
574
- id: prop,
575
- mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
576
- details: {},
577
- variant: "normal",
578
- ...target[prop]
579
- };
906
+ #resolveParentPaths(request, parents = []) {
907
+ let paths = [
908
+ this.#context.workspaceConfig.workspaceRoot,
909
+ joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
910
+ ];
911
+ if (this.#context.tsconfig.options.paths) {
912
+ paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
913
+ if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
914
+ ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
580
915
  }
581
- return void 0;
582
- }, "get"),
583
- set: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop, value) => {
584
- target[prop] = value;
585
- this.#ids[value.id || prop] = prop;
586
- return true;
587
- }, "set"),
588
- deleteProperty: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((target, prop) => {
589
- delete this.#ids[target[prop]?.id || prop];
590
- delete target[prop];
591
- return true;
592
- }, "deleteProperty")
593
- });
916
+ return ret;
917
+ }, paths) : paths;
918
+ }
919
+ return paths.reduce((ret, path) => {
920
+ if (!ret.includes(path)) {
921
+ ret.push(path);
922
+ }
923
+ return ret;
924
+ }, parents.filter(Boolean).map((p) => this.formatPath(p)));
594
925
  }
595
926
  /**
596
- * A map of module ids to their file paths.
927
+ * Clears the resolver cache for a given path.
928
+ *
929
+ * @param path - The path to clear the resolver cache for.
597
930
  */
598
- get ids() {
599
- return this.#ids;
931
+ #clearResolverCache(path) {
932
+ this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
600
933
  }
601
934
  /**
602
- * Creates a new instance of the VirtualFileSystem.
935
+ * Check if the file exists with different variants (index, extensions).
603
936
  *
604
- * @param context - The context of the virtual file system, typically containing options and logging functions.
605
- * @param serialized - A map of files/file contents to populate in cache
937
+ * @param request - The request path to check.
938
+ * @param parentPath - An optional parent path to prepend to the request.
939
+ * @returns The file path if it exists, otherwise false.
606
940
  */
607
- constructor(context, serialized = {}) {
608
- this.#context = context;
609
- this.#cachedFS = /* @__PURE__ */ new Map();
610
- this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
611
- this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
612
- data.id || path,
613
- path
614
- ]));
615
- if (!this.#fs.existsSync(this.#context.dataPath)) {
616
- this.#fs.mkdirSync(this.#context.dataPath, {
617
- recursive: true
618
- });
941
+ #checkVariants(request, parentPath) {
942
+ const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
943
+ let file = this.#checkExtensions(path);
944
+ if (file) {
945
+ return file;
619
946
  }
620
- if (!this.#fs.existsSync(this.#context.cachePath)) {
621
- this.#fs.mkdirSync(this.#context.cachePath, {
622
- recursive: true
623
- });
947
+ file = this.#checkIndex(path);
948
+ if (file) {
949
+ return file;
624
950
  }
625
- if (!this.#fs.existsSync(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
626
- this.#fs.mkdirSync(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
627
- recursive: true
628
- });
951
+ return false;
952
+ }
953
+ /**
954
+ * Check if the index file exists in the given request path.
955
+ *
956
+ * @param request - The request path to check.
957
+ * @returns The index file path if it exists, otherwise false.
958
+ */
959
+ #checkIndex(request) {
960
+ let file = joinPaths.joinPaths(request, "index");
961
+ if (this.#existsSync(file)) {
962
+ return file;
629
963
  }
630
- this.#unifiedFS = this.#unifiedFS.use(this.#fs);
631
- if (this.#context.config.output.mode !== "fs") {
632
- if (serialized?.virtualFiles && Object.keys(serialized.virtualFiles).length > 0) {
633
- this.#virtualFS = memfs.Volume.fromJSON(serialized.virtualFiles);
634
- }
635
- if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
636
- this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
637
- recursive: true
638
- });
639
- }
640
- if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
641
- this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
642
- recursive: true
643
- });
644
- }
645
- if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
646
- this.#virtualFS.mkdirSync(this.#context.entryPath, {
647
- recursive: true
648
- });
649
- }
650
- if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
651
- this.#virtualFS.mkdirSync(this.#context.dtsPath, {
652
- recursive: true
653
- });
654
- }
655
- this.#unifiedFS = this.#unifiedFS.use(this.#virtualFS);
656
- } else if (this.#context.config.projectType === "application") {
657
- if (!this.#fs.existsSync(this.#context.artifactsPath)) {
658
- this.#fs.mkdirSync(this.#context.artifactsPath, {
659
- recursive: true
660
- });
661
- }
662
- if (!this.#fs.existsSync(this.#context.builtinsPath)) {
663
- this.#fs.mkdirSync(this.#context.builtinsPath, {
664
- recursive: true
665
- });
666
- }
667
- if (!this.#fs.existsSync(this.#context.entryPath)) {
668
- this.#fs.mkdirSync(this.#context.entryPath, {
669
- recursive: true
670
- });
671
- }
672
- if (!this.#fs.existsSync(this.#context.dtsPath)) {
673
- this.#fs.mkdirSync(this.#context.dtsPath, {
674
- recursive: true
675
- });
676
- }
964
+ file = this.#checkExtensions(file);
965
+ if (file) {
966
+ return file;
967
+ }
968
+ return false;
969
+ }
970
+ /**
971
+ * Check if the file exists with different extensions.
972
+ *
973
+ * @param request - The request path to check.
974
+ * @returns The file path if it exists with any of the checked extensions, otherwise false.
975
+ */
976
+ #checkExtensions(request) {
977
+ let file = `${request}.ts`;
978
+ if (this.#existsSync(file)) {
979
+ return file;
980
+ }
981
+ file = `${request}.mts`;
982
+ if (this.#existsSync(file)) {
983
+ return file;
984
+ }
985
+ file = `${request}.cts`;
986
+ if (this.#existsSync(file)) {
987
+ return file;
988
+ }
989
+ file = `${request}.tsx`;
990
+ if (this.#existsSync(file)) {
991
+ return file;
992
+ }
993
+ file = `${request}.js`;
994
+ if (this.#existsSync(file)) {
995
+ return file;
996
+ }
997
+ file = `${request}.mjs`;
998
+ if (this.#existsSync(file)) {
999
+ return file;
677
1000
  }
678
- this.#log = chunkJA4HSQRN_cjs.extendLog(this.#context.log, "virtual-file-system");
1001
+ file = `${request}.cjs`;
1002
+ if (this.#existsSync(file)) {
1003
+ return file;
1004
+ }
1005
+ file = `${request}.jsx`;
1006
+ if (this.#existsSync(file)) {
1007
+ return file;
1008
+ }
1009
+ file = `${request}.json`;
1010
+ if (this.#existsSync(file)) {
1011
+ return file;
1012
+ }
1013
+ file = `${request}.d.ts`;
1014
+ if (this.#existsSync(file)) {
1015
+ return file;
1016
+ }
1017
+ return false;
679
1018
  }
680
- [chunkTNHDC2ZQ_cjs.__VFS_INIT__]() {
681
- if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
682
- this.#revert = patchFS(fs__default.default, this);
683
- this.#isPatched = true;
1019
+ /**
1020
+ * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1021
+ *
1022
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
1023
+ * @returns A promise that resolves to a new virtual file system instance.
1024
+ */
1025
+ static async create(context) {
1026
+ if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
1027
+ const buffer$1 = await buffer.readFileBuffer(joinPaths.joinPaths(context.cachePath, "fs.bin"));
1028
+ const message2 = new $__namespace.Message(buffer$1, false);
1029
+ return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
684
1030
  }
1031
+ const message = new $__namespace.Message();
1032
+ return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
685
1033
  }
686
- [chunkTNHDC2ZQ_cjs.__VFS_REVERT__]() {
687
- if (this.#isPatched && this.#context.config.output.mode !== "fs") {
688
- if (!this.#revert) {
689
- throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
690
- }
691
- this.#revert?.();
692
- this.#isPatched = false;
1034
+ /**
1035
+ * Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1036
+ *
1037
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
1038
+ * @returns A new virtual file system instance.
1039
+ */
1040
+ static createSync(context) {
1041
+ if (!context.config.skipCache && exists.existsSync(joinPaths.joinPaths(context.cachePath, "fs.bin"))) {
1042
+ const buffer$1 = buffer.readFileBufferSync(joinPaths.joinPaths(context.cachePath, "fs.bin"));
1043
+ const message2 = new $__namespace.Message(buffer$1, false);
1044
+ return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
1045
+ }
1046
+ const message = new $__namespace.Message();
1047
+ return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
1048
+ }
1049
+ /**
1050
+ * A map of file ids to their metadata.
1051
+ */
1052
+ get metadata() {
1053
+ return this.#metadata;
1054
+ }
1055
+ /**
1056
+ * A map of module ids to their file paths.
1057
+ */
1058
+ get ids() {
1059
+ return this.#ids;
1060
+ }
1061
+ /**
1062
+ * A map of virtual file paths to their IDs.
1063
+ */
1064
+ get paths() {
1065
+ return this.#paths;
1066
+ }
1067
+ /**
1068
+ * Creates a new instance of the {@link VirtualFileSystem}.
1069
+ *
1070
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
1071
+ * @param data - A buffer containing the serialized virtual file system data.
1072
+ */
1073
+ constructor(context, data) {
1074
+ this.#context = context;
1075
+ this.#unifiedFS = UnifiedFS.create(context, data);
1076
+ this.#metadata = {};
1077
+ if (data._hasMetadata()) {
1078
+ this.#metadata = data.metadata.values().reduce((ret, data2) => {
1079
+ ret[data2.id] = {
1080
+ id: data2.id,
1081
+ variant: data2.variant,
1082
+ mode: data2.mode,
1083
+ properties: data2._hasProperties() ? data2.properties.values().reduce((ret2, item) => {
1084
+ ret2[item.key] = item.value;
1085
+ return ret2;
1086
+ }, {}) : {}
1087
+ };
1088
+ return ret;
1089
+ }, {});
1090
+ }
1091
+ this.#ids = {};
1092
+ this.#paths = {};
1093
+ if (data._hasIds()) {
1094
+ this.#ids = data.ids.values().reduce((ret, data2) => {
1095
+ ret[data2.id] ??= data2.path;
1096
+ ret[data2.path] ??= data2.path;
1097
+ return ret;
1098
+ }, {});
1099
+ this.#paths = data.ids.values().reduce((ret, data2) => {
1100
+ ret[data2.path] ??= data2.id;
1101
+ return ret;
1102
+ }, {});
693
1103
  }
1104
+ this.#log = chunkJA4HSQRN_cjs.extendLog(this.#context.log, "file-system");
694
1105
  }
695
1106
  /**
696
1107
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
@@ -710,7 +1121,7 @@ var VirtualFileSystem = class {
710
1121
  if (!resolvedPath) {
711
1122
  return false;
712
1123
  }
713
- return this.meta[resolvedPath]?.mode === "virtual";
1124
+ return this.metadata[resolvedPath]?.mode === "virtual";
714
1125
  }
715
1126
  /**
716
1127
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
@@ -719,7 +1130,7 @@ var VirtualFileSystem = class {
719
1130
  * @param options - Optional parameters for resolving the path.
720
1131
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
721
1132
  */
722
- isFs(pathOrId, options = {}) {
1133
+ isPhysical(pathOrId, options = {}) {
723
1134
  if (!pathOrId) {
724
1135
  return false;
725
1136
  }
@@ -730,18 +1141,7 @@ var VirtualFileSystem = class {
730
1141
  if (!resolvedPath) {
731
1142
  return false;
732
1143
  }
733
- return this.meta[resolvedPath]?.mode === "fs";
734
- }
735
- /**
736
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
737
- *
738
- * @see https://www.typescriptlang.org/tsconfig#paths
739
- *
740
- * @param pathOrId - The path or ID to check.
741
- * @returns Whether the path or ID corresponds to a virtual file.
742
- */
743
- isTsconfigPath(pathOrId) {
744
- return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
1144
+ return this.metadata[resolvedPath]?.mode === "fs";
745
1145
  }
746
1146
  /**
747
1147
  * Lists files in a given path.
@@ -751,7 +1151,7 @@ var VirtualFileSystem = class {
751
1151
  * @returns An array of file names in the specified path.
752
1152
  */
753
1153
  readdirSync(path, options = "utf8") {
754
- return this.resolveFS(path).readdirSync(toFilePath(path), options);
1154
+ return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
755
1155
  }
756
1156
  /**
757
1157
  * Removes a file in the virtual file system (VFS).
@@ -764,9 +1164,11 @@ var VirtualFileSystem = class {
764
1164
  return;
765
1165
  }
766
1166
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
767
- this.resolveFS(path, options).unlinkSync(formattedPath);
768
- this.#cachedFS.delete(formattedPath);
769
- this.clearResolverCache(formattedPath);
1167
+ this.#unifiedFS.resolveFS(path, options).unlinkSync(formattedPath);
1168
+ if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
1169
+ delete this.metadata[this.paths[formattedPath]];
1170
+ }
1171
+ this.#clearResolverCache(formattedPath);
770
1172
  }
771
1173
  /**
772
1174
  * Removes a file in the virtual file system (VFS).
@@ -779,10 +1181,12 @@ var VirtualFileSystem = class {
779
1181
  return;
780
1182
  }
781
1183
  this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
782
- if (isFunction.isFunction(this.resolveFS(path, options).promises.unlink)) {
783
- await this.resolveFS(path, options).promises.unlink(formattedPath);
784
- this.#cachedFS.delete(formattedPath);
785
- this.clearResolverCache(formattedPath);
1184
+ if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
1185
+ await this.#unifiedFS.resolveFS(path, options).promises.unlink(formattedPath);
1186
+ if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
1187
+ delete this.metadata[this.paths[formattedPath]];
1188
+ }
1189
+ this.#clearResolverCache(formattedPath);
786
1190
  } else {
787
1191
  this.unlinkSync(formattedPath, options);
788
1192
  }
@@ -799,11 +1203,10 @@ var VirtualFileSystem = class {
799
1203
  return;
800
1204
  }
801
1205
  this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
802
- this.resolveFS(path, options).rmdirSync(formattedPath, defu3__default.default(options, {
1206
+ this.#unifiedFS.resolveFS(path, options).rmdirSync(formattedPath, defu2__default.default(options, {
803
1207
  recursive: true
804
1208
  }));
805
- this.#cachedFS.delete(formattedPath);
806
- this.clearResolverCache(formattedPath);
1209
+ this.#clearResolverCache(formattedPath);
807
1210
  }
808
1211
  /**
809
1212
  * Removes a directory in the virtual file system (VFS).
@@ -818,15 +1221,14 @@ var VirtualFileSystem = class {
818
1221
  return;
819
1222
  }
820
1223
  this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
821
- if (isFunction.isFunction(this.resolveFS(path, options).promises.rm)) {
822
- await this.resolveFS(path, options).promises.rm(formattedPath, defu3__default.default(options, {
1224
+ if (isFunction.isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
1225
+ await this.#unifiedFS.resolveFS(path, options).promises.rm(formattedPath, defu2__default.default(options, {
823
1226
  force: true,
824
1227
  recursive: true
825
1228
  }));
826
- this.#cachedFS.delete(formattedPath);
827
- this.clearResolverCache(formattedPath);
1229
+ this.#clearResolverCache(formattedPath);
828
1230
  } else {
829
- this.rmdirSync(formattedPath, defu3__default.default(options ?? {}, {
1231
+ this.rmdirSync(formattedPath, defu2__default.default(options ?? {}, {
830
1232
  force: true,
831
1233
  recursive: true
832
1234
  }));
@@ -868,8 +1270,8 @@ var VirtualFileSystem = class {
868
1270
  */
869
1271
  mkdirSync(path, options = {}) {
870
1272
  const filePath = toFilePath(path);
871
- this.clearResolverCache(filePath);
872
- return this.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
1273
+ this.#clearResolverCache(filePath);
1274
+ return this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu2__default.default(options ?? {}, {
873
1275
  recursive: true
874
1276
  }));
875
1277
  }
@@ -883,16 +1285,16 @@ var VirtualFileSystem = class {
883
1285
  async mkdir(path, options = {}) {
884
1286
  let result;
885
1287
  const filePath = toFilePath(path);
886
- if (isFunction.isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
887
- result = await this.resolveFS(filePath, options).promises.mkdir(filePath, defu3__default.default(options ?? {}, {
1288
+ if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath, options).promises.mkdir)) {
1289
+ result = await this.#unifiedFS.resolveFS(filePath, options).promises.mkdir(filePath, defu2__default.default(options ?? {}, {
888
1290
  recursive: true
889
1291
  }));
890
1292
  } else {
891
- result = this.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
1293
+ result = this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu2__default.default(options ?? {}, {
892
1294
  recursive: true
893
1295
  }));
894
1296
  }
895
- this.clearResolverCache(filePath);
1297
+ this.#clearResolverCache(filePath);
896
1298
  return result;
897
1299
  }
898
1300
  /**
@@ -940,7 +1342,7 @@ var VirtualFileSystem = class {
940
1342
  if (stats.isDirectory()) {
941
1343
  stack.push(full);
942
1344
  } else if (stats.isFile()) {
943
- if (this.buildRegex(absPattern).test(full)) {
1345
+ if (this.#buildRegex(absPattern).test(full)) {
944
1346
  const resolved = this.resolve(full, {
945
1347
  type: "file"
946
1348
  });
@@ -999,7 +1401,7 @@ var VirtualFileSystem = class {
999
1401
  if (stats.isDirectory()) {
1000
1402
  stack.push(full);
1001
1403
  } else if (stats.isFile()) {
1002
- if (this.buildRegex(absPattern).test(full)) {
1404
+ if (this.#buildRegex(absPattern).test(full)) {
1003
1405
  const resolved = this.resolve(full, {
1004
1406
  type: "file"
1005
1407
  });
@@ -1063,7 +1465,7 @@ var VirtualFileSystem = class {
1063
1465
  * @returns An array of file names in the specified path.
1064
1466
  */
1065
1467
  async readdir(pathOrId, options = "utf8") {
1066
- return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
1468
+ return this.#unifiedFS.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
1067
1469
  }
1068
1470
  /**
1069
1471
  * Asynchronously reads a file from the virtual file system (VFS).
@@ -1079,17 +1481,13 @@ var VirtualFileSystem = class {
1079
1481
  type: "file"
1080
1482
  });
1081
1483
  if (filePath) {
1082
- if (this.#cachedFS.has(filePath)) {
1083
- return this.#cachedFS.get(filePath);
1084
- }
1085
1484
  let result;
1086
- if (isFunction.isFunction(this.resolveFS(filePath).promises.readFile)) {
1087
- result = (await this.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
1485
+ if (isFunction.isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
1486
+ result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
1088
1487
  } else {
1089
- result = this.resolveFS(filePath).readFileSync(filePath, options);
1488
+ result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1090
1489
  }
1091
1490
  const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
1092
- this.#cachedFS.set(filePath, content);
1093
1491
  return content;
1094
1492
  }
1095
1493
  return void 0;
@@ -1108,12 +1506,8 @@ var VirtualFileSystem = class {
1108
1506
  type: "file"
1109
1507
  });
1110
1508
  if (filePath) {
1111
- if (this.#cachedFS.has(filePath)) {
1112
- return this.#cachedFS.get(filePath);
1113
- }
1114
- const result = this.resolveFS(filePath).readFileSync(filePath, options);
1509
+ const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1115
1510
  const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
1116
- this.#cachedFS.set(filePath, content);
1117
1511
  return content;
1118
1512
  }
1119
1513
  return void 0;
@@ -1141,17 +1535,15 @@ var VirtualFileSystem = class {
1141
1535
  });
1142
1536
  }
1143
1537
  }
1144
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1145
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
1146
- this.meta[formattedPath] = {
1147
- path: formattedPath,
1148
- code,
1538
+ const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1539
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
1540
+ this.metadata[formattedPath] = {
1149
1541
  mode: outputMode,
1150
1542
  variant: "normal",
1151
1543
  ...isPowerLinesWriteFileData(data) ? data : {}
1152
1544
  };
1153
- this.clearResolverCache(formattedPath);
1154
- const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1545
+ this.#clearResolverCache(formattedPath);
1546
+ const ifs = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1155
1547
  if (isFunction.isFunction(ifs.promises.writeFile)) {
1156
1548
  return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
1157
1549
  }
@@ -1170,17 +1562,15 @@ var VirtualFileSystem = class {
1170
1562
  this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1171
1563
  }
1172
1564
  const code = isPowerLinesWriteFileData(data) ? data.code : data;
1173
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1174
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
1175
- this.meta[formattedPath] = {
1176
- path: formattedPath,
1177
- code,
1565
+ const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1566
+ this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer$1.Blob(toArray.toArray(code)).size)})`);
1567
+ this.metadata[formattedPath] = {
1178
1568
  mode: outputMode,
1179
1569
  variant: "normal",
1180
1570
  ...isPowerLinesWriteFileData(data) ? data : {}
1181
1571
  };
1182
- this.clearResolverCache(formattedPath);
1183
- const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1572
+ this.#clearResolverCache(formattedPath);
1573
+ const writeStream = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1184
1574
  try {
1185
1575
  writeStream.write(code);
1186
1576
  } finally {
@@ -1204,8 +1594,8 @@ var VirtualFileSystem = class {
1204
1594
  */
1205
1595
  getMetadata(pathOrId) {
1206
1596
  const resolved = this.resolve(pathOrId);
1207
- if (resolved && this.meta[resolved]) {
1208
- return this.meta[resolved];
1597
+ if (resolved && this.metadata[resolved]) {
1598
+ return this.metadata[resolved];
1209
1599
  }
1210
1600
  return void 0;
1211
1601
  }
@@ -1217,361 +1607,265 @@ var VirtualFileSystem = class {
1217
1607
  *
1218
1608
  * @param pathOrId - The path of the file to check.
1219
1609
  * @returns `true` if the file exists, otherwise `false`.
1220
- */
1221
- isFile(pathOrId) {
1222
- const resolved = this.resolve(pathOrId);
1223
- return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isFile() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isFile() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isFile()));
1224
- }
1225
- /**
1226
- * Checks if a directory exists in the virtual file system (VFS).
1227
- *
1228
- * @param pathOrId - The path of the directory to check.
1229
- * @returns `true` if the directory exists, otherwise `false`.
1230
- */
1231
- isDirectory(pathOrId) {
1232
- const resolved = this.resolve(pathOrId);
1233
- return !!(resolved && (this.#virtualFS.existsSync(resolved) && this.#virtualFS.lstatSync(resolved).isDirectory() || this.#fs.existsSync(resolved) && this.#fs.lstatSync(resolved).isDirectory() || this.resolveFS(resolved).existsSync(resolved) && this.resolveFS(resolved).lstatSync(resolved).isDirectory()));
1234
- }
1235
- /**
1236
- * Retrieves the status of a file in the virtual file system (VFS).
1237
- *
1238
- * @param pathOrId - The path or ID of the file to retrieve status for.
1239
- * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1240
- */
1241
- async stat(pathOrId, options) {
1242
- return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1243
- }
1244
- /**
1245
- * Synchronously retrieves the status of a file in the virtual file system (VFS).
1246
- *
1247
- * @param pathOrId - The path or ID of the file to retrieve status for.
1248
- * @returns The file's status information, or false if the file does not exist.
1249
- */
1250
- statSync(pathOrId) {
1251
- return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1252
- }
1253
- /**
1254
- * Retrieves the status of a symbolic link in the virtual file system (VFS).
1255
- *
1256
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1257
- * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1258
- */
1259
- async lstat(pathOrId, options) {
1260
- return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1261
- }
1262
- /**
1263
- * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
1264
- *
1265
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1266
- * @returns The symbolic link's status information, or false if the link does not exist.
1267
- */
1268
- lstatSync(pathOrId, options) {
1269
- return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1270
- }
1271
- /**
1272
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1273
- *
1274
- * @see https://www.typescriptlang.org/tsconfig#paths
1275
- *
1276
- * @param path - The path to check.
1277
- * @returns The resolved file path if it exists, otherwise undefined.
1278
- */
1279
- resolveTsconfigPath(path) {
1280
- if (this.#context.tsconfig.options.paths) {
1281
- for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
1282
- const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
1283
- if (resolvedPath) {
1284
- return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
1285
- }
1286
- }
1287
- }
1288
- return false;
1289
- }
1290
- /**
1291
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1292
- *
1293
- * @see https://www.typescriptlang.org/tsconfig#paths
1294
- *
1295
- * @param path - The path to check.
1296
- * @returns The resolved file path if it exists, otherwise undefined.
1297
- */
1298
- resolveTsconfigPathPackage(path) {
1299
- if (this.#context.tsconfig.options.paths) {
1300
- const tsconfigPathKeys = Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")));
1301
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
1302
- return tsconfigPathKeys[0].replace(/\/\*$/, "");
1303
- }
1304
- }
1305
- return false;
1306
- }
1307
- /**
1308
- * Resolves a path or ID to its real path in the virtual file system (VFS).
1309
- *
1310
- * @param pathOrId - The path or ID to resolve.
1311
- * @returns The resolved real path if it exists, otherwise undefined.
1312
- */
1313
- realpathSync(pathOrId) {
1314
- const filePath = this.resolve(toFilePath(pathOrId));
1315
- if (!filePath) {
1316
- throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1317
- }
1318
- return filePath;
1319
- }
1320
- /**
1321
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1322
- *
1323
- * @param pathOrId - The path or ID to resolve.
1324
- * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1325
- * @returns The resolved file path if it exists, otherwise undefined.
1326
- */
1327
- resolve(pathOrId, options = {}) {
1328
- const formattedPathOrId = toFilePath(pathOrId);
1329
- const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1330
- if (this.#cachedResolver.has(resolverKey)) {
1331
- return this.#cachedResolver.get(resolverKey);
1332
- }
1333
- let result = this.resolveId(formattedPathOrId);
1334
- if (!result) {
1335
- result = this.resolvePath(formattedPathOrId, options);
1336
- }
1337
- if (!result) {
1338
- result = false;
1339
- }
1340
- if (result && options.withExtension === false) {
1341
- return result.replace(/\.[m|c]?[t|j]sx?$/, "");
1342
- }
1343
- this.#cachedResolver.set(resolverKey, result);
1344
- return result;
1345
- }
1346
- /**
1347
- * Retrieves the partial metadata for all files in the virtual file system (VFS).
1348
- *
1349
- * @returns A record containing the partial metadata for all files.
1350
- */
1351
- getPartialMeta() {
1352
- return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
1353
- }
1354
- buildRegex(strPattern) {
1355
- const token = "::GLOBSTAR::";
1356
- return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1357
- }
1358
- /**
1359
- * Converts a relative path to an absolute path based on the workspace and project root.
1360
- *
1361
- * @param path - The relative path to convert.
1362
- * @returns The absolute path.
1363
- */
1364
- formatPath(path) {
1365
- const formattedPath = toFilePath(path);
1366
- if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1367
- return formattedPath;
1368
- } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1369
- return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1370
- }
1371
- return formattedPath;
1372
- }
1373
- /**
1374
- * Formats a file id by removing the file extension and prepending the runtime prefix.
1375
- *
1376
- * @param id - The file ID to format.
1377
- * @returns The formatted file ID.
1378
- */
1379
- formatId(id) {
1380
- const formattedId = toFilePath(id);
1381
- return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
1382
- }
1383
- /**
1384
- * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
1385
- *
1386
- * @param id - The id to resolve.
1387
- * @returns The resolved file id if it exists, otherwise undefined.
1388
- */
1389
- resolveId(id) {
1390
- if (this.#ids[this.formatId(id)]) {
1391
- return this.#ids[this.formatId(id)] || false;
1392
- }
1393
- return false;
1394
- }
1395
- /**
1396
- * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1397
- *
1398
- * @param path - The path to resolve.
1399
- * @param options - Optional parameters for resolving the path.
1400
- * @returns The resolved file path if it exists, otherwise undefined.
1401
- */
1402
- resolvePath(path, options = {}) {
1403
- if (isType.isAbsolutePath(path)) {
1404
- if (this.#existsSync(path)) {
1405
- return path;
1406
- }
1407
- const result = this.checkVariants(path);
1408
- if (result) {
1409
- return result;
1410
- }
1411
- }
1412
- for (const parentPath of this.resolveParentPaths(path, options.paths)) {
1413
- const request = joinPaths.joinPaths(parentPath, path);
1414
- if (this.#existsSync(request)) {
1415
- return request;
1416
- }
1417
- const result = this.checkVariants(request);
1418
- if (result) {
1419
- return result;
1420
- }
1421
- }
1422
- return false;
1423
- }
1424
- resolveParentPaths(request, parents = []) {
1425
- let paths = [
1426
- this.#context.workspaceConfig.workspaceRoot,
1427
- joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
1428
- ];
1429
- if (this.#context.tsconfig.options.paths) {
1430
- paths = this.#context.tsconfig.options.paths ? Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => request.startsWith(tsconfigPath.replaceAll("*", ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().reduce((ret, path) => {
1431
- if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
1432
- ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
1433
- }
1434
- return ret;
1435
- }, paths) : paths;
1436
- }
1437
- return paths.reduce((ret, path) => {
1438
- if (!ret.includes(path)) {
1439
- ret.push(path);
1440
- }
1441
- return ret;
1442
- }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1610
+ */
1611
+ isFile(pathOrId) {
1612
+ const resolved = this.resolve(pathOrId);
1613
+ 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()));
1443
1614
  }
1444
1615
  /**
1445
- * Select the file system module to use for the operation based on the path or URL.
1616
+ * Checks if a directory exists in the virtual file system (VFS).
1446
1617
  *
1447
- * @param pathOrUrl - The path to perform the file system operation on.
1448
- * @param options - Options for the operation, such as output mode.
1449
- * @returns The file system module used for the operation.
1618
+ * @param pathOrId - The path of the directory to check.
1619
+ * @returns `true` if the directory exists, otherwise `false`.
1450
1620
  */
1451
- resolveFS(pathOrUrl, options = {}) {
1452
- const mode = this.resolveOutputMode(pathOrUrl, options);
1453
- if (mode === "virtual") {
1454
- return this.#virtualFS;
1455
- } else if (mode === "fs") {
1456
- return this.#fs;
1457
- }
1458
- return this.#unifiedFS;
1621
+ isDirectory(pathOrId) {
1622
+ const resolved = this.resolve(pathOrId);
1623
+ 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()));
1459
1624
  }
1460
1625
  /**
1461
- * Select the file system module to use for the operation based on the path or URL.
1626
+ * Retrieves the status of a file in the virtual file system (VFS).
1462
1627
  *
1463
- * @param pathOrUrl - The path to perform the file system operation on.
1464
- * @param options - Options for the operation, such as output mode.
1465
- * @returns The file system module used for the operation.
1628
+ * @param pathOrId - The path or ID of the file to retrieve status for.
1629
+ * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1466
1630
  */
1467
- resolveOutputMode(pathOrUrl, options = {}) {
1468
- if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
1469
- return "virtual";
1470
- } else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
1471
- return "fs";
1472
- }
1473
- return void 0;
1631
+ async stat(pathOrId, options) {
1632
+ return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1474
1633
  }
1475
1634
  /**
1476
- * Clears the resolver cache for a given path.
1635
+ * Synchronously retrieves the status of a file in the virtual file system (VFS).
1477
1636
  *
1478
- * @param path - The path to clear the resolver cache for.
1637
+ * @param pathOrId - The path or ID of the file to retrieve status for.
1638
+ * @returns The file's status information, or false if the file does not exist.
1479
1639
  */
1480
- clearResolverCache(path) {
1481
- this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1640
+ statSync(pathOrId) {
1641
+ return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1482
1642
  }
1483
1643
  /**
1484
- * Check if the file exists with different variants (index, extensions).
1644
+ * Retrieves the status of a symbolic link in the virtual file system (VFS).
1485
1645
  *
1486
- * @param request - The request path to check.
1487
- * @param parentPath - An optional parent path to prepend to the request.
1488
- * @returns The file path if it exists, otherwise false.
1646
+ * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1647
+ * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1489
1648
  */
1490
- checkVariants(request, parentPath) {
1491
- const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1492
- let file = this.checkExtensions(path);
1493
- if (file) {
1494
- return file;
1495
- }
1496
- file = this.checkIndex(path);
1497
- if (file) {
1498
- return file;
1499
- }
1500
- return false;
1649
+ async lstat(pathOrId, options) {
1650
+ return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1501
1651
  }
1502
1652
  /**
1503
- * Check if the index file exists in the given request path.
1653
+ * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
1504
1654
  *
1505
- * @param request - The request path to check.
1506
- * @returns The index file path if it exists, otherwise false.
1655
+ * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1656
+ * @returns The symbolic link's status information, or false if the link does not exist.
1507
1657
  */
1508
- checkIndex(request) {
1509
- let file = joinPaths.joinPaths(request, "index");
1510
- if (this.#existsSync(file)) {
1511
- return file;
1512
- }
1513
- file = this.checkExtensions(file);
1514
- if (file) {
1515
- return file;
1516
- }
1517
- return false;
1658
+ lstatSync(pathOrId, options) {
1659
+ return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1518
1660
  }
1519
1661
  /**
1520
- * Check if the file exists with different extensions.
1662
+ * Resolves a path or ID to its real path in the virtual file system (VFS).
1521
1663
  *
1522
- * @param request - The request path to check.
1523
- * @param vfs - The file system module to use for checking file existence.
1524
- * @returns The file path if it exists with any of the checked extensions, otherwise false.
1664
+ * @param pathOrId - The path or ID to resolve.
1665
+ * @returns The resolved real path if it exists, otherwise undefined.
1525
1666
  */
1526
- checkExtensions(request) {
1527
- let file = `${request}.ts`;
1528
- if (this.#existsSync(file)) {
1529
- return file;
1530
- }
1531
- file = `${request}.mts`;
1532
- if (this.#existsSync(file)) {
1533
- return file;
1667
+ realpathSync(pathOrId) {
1668
+ const filePath = this.resolve(toFilePath(pathOrId));
1669
+ if (!filePath) {
1670
+ throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1534
1671
  }
1535
- file = `${request}.cts`;
1536
- if (this.#existsSync(file)) {
1537
- return file;
1672
+ return filePath;
1673
+ }
1674
+ /**
1675
+ * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1676
+ *
1677
+ * @param pathOrId - The path or ID to resolve.
1678
+ * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1679
+ * @returns The resolved file path if it exists, otherwise undefined.
1680
+ */
1681
+ resolve(pathOrId, options = {}) {
1682
+ const formattedPathOrId = toFilePath(pathOrId);
1683
+ const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1684
+ if (this.#cachedResolver.has(resolverKey)) {
1685
+ return this.#cachedResolver.get(resolverKey);
1538
1686
  }
1539
- file = `${request}.tsx`;
1540
- if (this.#existsSync(file)) {
1541
- return file;
1687
+ let result = this.#resolveId(formattedPathOrId);
1688
+ if (!result) {
1689
+ result = this.#resolvePath(formattedPathOrId, options);
1542
1690
  }
1543
- file = `${request}.js`;
1544
- if (this.#existsSync(file)) {
1545
- return file;
1691
+ if (!result) {
1692
+ result = false;
1546
1693
  }
1547
- file = `${request}.mjs`;
1548
- if (this.#existsSync(file)) {
1549
- return file;
1694
+ if (result && options.withExtension === false) {
1695
+ return result.replace(/\.[m|c]?[t|j]sx?$/, "");
1550
1696
  }
1551
- file = `${request}.cjs`;
1552
- if (this.#existsSync(file)) {
1553
- return file;
1697
+ this.#cachedResolver.set(resolverKey, result);
1698
+ return result;
1699
+ }
1700
+ /**
1701
+ * Converts a relative path to an absolute path based on the workspace and project root.
1702
+ *
1703
+ * @param path - The relative path to convert.
1704
+ * @returns The absolute path.
1705
+ */
1706
+ formatPath(path) {
1707
+ const formattedPath = toFilePath(path);
1708
+ if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1709
+ return formattedPath;
1710
+ } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1711
+ return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1554
1712
  }
1555
- file = `${request}.jsx`;
1556
- if (this.#existsSync(file)) {
1557
- return file;
1713
+ return formattedPath;
1714
+ }
1715
+ /**
1716
+ * Disposes of the virtual file system (VFS) by saving its state to disk.
1717
+ */
1718
+ async dispose() {
1719
+ if (!this.#isDisposed) {
1720
+ this.#isDisposed = true;
1721
+ this.#log(types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
1722
+ await this.unlink(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"));
1723
+ const message = new $__namespace.Message();
1724
+ const data = message.initRoot(FileSystemData);
1725
+ const virtualFS = this.#unifiedFS.toJSON();
1726
+ const files = data._initFiles(Object.keys(virtualFS).length);
1727
+ Object.entries(virtualFS).filter(([_, content]) => content).forEach(([path, content], index) => {
1728
+ const fileData = files.get(index);
1729
+ fileData.path = path;
1730
+ fileData.content = content;
1731
+ });
1732
+ const ids = data._initIds(Object.keys(this.ids).length);
1733
+ Object.entries(this.ids).forEach(([id, path], index) => {
1734
+ const fileId = ids.get(index);
1735
+ fileId.id = id;
1736
+ fileId.path = path;
1737
+ });
1738
+ const metadata = data._initMetadata(Object.keys(this.metadata).length);
1739
+ Object.entries(this.metadata).forEach(([id, value], index) => {
1740
+ const fileMetadata = metadata.get(index);
1741
+ fileMetadata.id = id;
1742
+ fileMetadata.mode = value.mode;
1743
+ fileMetadata.variant = value.variant;
1744
+ if (value.properties) {
1745
+ const props = fileMetadata._initProperties(Object.keys(value.properties).length);
1746
+ Object.entries(value.properties).forEach(([key, val], propIndex) => {
1747
+ const propData = props.get(propIndex);
1748
+ propData.key = key;
1749
+ propData.value = val;
1750
+ });
1751
+ }
1752
+ });
1753
+ await buffer.writeFileBuffer(joinPaths.joinPaths(this.#context.cachePath, "fs.bin"), message.toArrayBuffer());
1558
1754
  }
1559
- file = `${request}.json`;
1560
- if (this.#existsSync(file)) {
1561
- return file;
1755
+ }
1756
+ /**
1757
+ * Initializes the virtual file system (VFS) by patching the file system module if necessary.
1758
+ */
1759
+ [__VFS_PATCH__]() {
1760
+ if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
1761
+ this.#revert = patchFS(fs__default.default, this);
1762
+ this.#isPatched = true;
1562
1763
  }
1563
- file = `${request}.d.ts`;
1564
- if (this.#existsSync(file)) {
1565
- return file;
1764
+ }
1765
+ /**
1766
+ * Reverts the file system module to its original state if it was previously patched.
1767
+ */
1768
+ [__VFS_REVERT__]() {
1769
+ if (this.#isPatched && this.#context.config.output.mode !== "fs") {
1770
+ if (!this.#revert) {
1771
+ throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
1772
+ }
1773
+ this.#revert?.();
1774
+ this.#isPatched = false;
1566
1775
  }
1567
- return false;
1776
+ }
1777
+ async [Symbol.asyncDispose]() {
1778
+ return this.dispose();
1568
1779
  }
1569
1780
  };
1570
- function createVfs(context) {
1571
- const vfs = new VirtualFileSystem(context);
1572
- return vfs;
1781
+
1782
+ // src/types/commands.ts
1783
+ var SUPPORTED_COMMANDS = [
1784
+ "new",
1785
+ "clean",
1786
+ "prepare",
1787
+ "lint",
1788
+ "test",
1789
+ "build",
1790
+ "docs",
1791
+ "deploy",
1792
+ "finalize"
1793
+ ];
1794
+
1795
+ // src/plugin-utils/helpers.ts
1796
+ function isPlugin(value) {
1797
+ 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)) && 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)));
1798
+ }
1799
+ chunkUSNT2KNT_cjs.__name(isPlugin, "isPlugin");
1800
+ function isPluginConfigObject(value) {
1801
+ 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));
1802
+ }
1803
+ chunkUSNT2KNT_cjs.__name(isPluginConfigObject, "isPluginConfigObject");
1804
+ function isPluginConfigTuple(value) {
1805
+ 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]));
1573
1806
  }
1574
- chunkUSNT2KNT_cjs.__name(createVfs, "createVfs");
1807
+ chunkUSNT2KNT_cjs.__name(isPluginConfigTuple, "isPluginConfigTuple");
1808
+ function isPluginConfig(value) {
1809
+ return isSetString.isSetString(value) || isFunction.isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
1810
+ }
1811
+ chunkUSNT2KNT_cjs.__name(isPluginConfig, "isPluginConfig");
1812
+ function isPluginHookFunction(value) {
1813
+ return isFunction.isFunction(value) || isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
1814
+ }
1815
+ chunkUSNT2KNT_cjs.__name(isPluginHookFunction, "isPluginHookFunction");
1816
+ function isPluginHookObject(value) {
1817
+ return isSetObject.isSetObject(value) && "handler" in value && isFunction.isFunction(value.handler);
1818
+ }
1819
+ chunkUSNT2KNT_cjs.__name(isPluginHookObject, "isPluginHookObject");
1820
+ function isPluginHook(value) {
1821
+ return isPluginHookFunction(value) || isPluginHookObject(value);
1822
+ }
1823
+ chunkUSNT2KNT_cjs.__name(isPluginHook, "isPluginHook");
1824
+ function getHookHandler(pluginHook) {
1825
+ return isFunction.isFunction(pluginHook) ? pluginHook : pluginHook.handler;
1826
+ }
1827
+ chunkUSNT2KNT_cjs.__name(getHookHandler, "getHookHandler");
1828
+ function isHookExternal(hook) {
1829
+ return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
1830
+ }
1831
+ chunkUSNT2KNT_cjs.__name(isHookExternal, "isHookExternal");
1832
+ function checkDedupe(plugin, plugins) {
1833
+ return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction.isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
1834
+ }
1835
+ chunkUSNT2KNT_cjs.__name(checkDedupe, "checkDedupe");
1836
+ function addPluginHook(context, plugin, pluginHook, hooksList) {
1837
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
1838
+ hooksList.push(isFunction.isFunction(pluginHook) ? {
1839
+ plugin,
1840
+ handler: getHookHandler(pluginHook).bind(context)
1841
+ } : {
1842
+ plugin,
1843
+ ...pluginHook,
1844
+ handler: getHookHandler(pluginHook).bind(context)
1845
+ });
1846
+ }
1847
+ }
1848
+ chunkUSNT2KNT_cjs.__name(addPluginHook, "addPluginHook");
1849
+ function resolveOptions(options) {
1850
+ return defu2__default.default(options, {
1851
+ interopDefault: true,
1852
+ fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
1853
+ moduleCache: options.mode !== "development"
1854
+ });
1855
+ }
1856
+ chunkUSNT2KNT_cjs.__name(resolveOptions, "resolveOptions");
1857
+ function createPluginResolver(options) {
1858
+ return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
1859
+ ...options
1860
+ }));
1861
+ }
1862
+ chunkUSNT2KNT_cjs.__name(createPluginResolver, "createPluginResolver");
1863
+ function createResolver(options) {
1864
+ const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
1865
+ baseResolver.plugin = createPluginResolver(options);
1866
+ return baseResolver;
1867
+ }
1868
+ chunkUSNT2KNT_cjs.__name(createResolver, "createResolver");
1575
1869
 
1576
1870
  // src/internal/contexts/context.ts
1577
1871
  var configCache = /* @__PURE__ */ new WeakMap();
@@ -1662,7 +1956,7 @@ var PowerlinesContext = class _PowerlinesContext {
1662
1956
  * The resolved entry type definitions for the project
1663
1957
  */
1664
1958
  get entry() {
1665
- return chunkOTBLE55Z_cjs.resolveEntriesSync(this, toArray.toArray(this.config.entry));
1959
+ return chunkMPCVQK2D_cjs.resolveEntriesSync(this, toArray.toArray(this.config.entry));
1666
1960
  }
1667
1961
  /**
1668
1962
  * The TypeScript configuration parsed from the tsconfig file
@@ -1686,7 +1980,7 @@ var PowerlinesContext = class _PowerlinesContext {
1686
1980
  */
1687
1981
  get fs() {
1688
1982
  if (!this.#fs) {
1689
- this.#fs = createVfs(this);
1983
+ this.#fs = VirtualFileSystem.createSync(this);
1690
1984
  }
1691
1985
  return this.#fs;
1692
1986
  }
@@ -1709,13 +2003,11 @@ var PowerlinesContext = class _PowerlinesContext {
1709
2003
  workspaceRoot: this.workspaceConfig?.workspaceRoot,
1710
2004
  projectRoot: this.config?.projectRoot
1711
2005
  }, {
1712
- maxLength: chunkTNHDC2ZQ_cjs.PROJECT_ROOT_HASH_LENGTH
2006
+ maxLength: chunk7XHBIYIN_cjs.PROJECT_ROOT_HASH_LENGTH
1713
2007
  }),
1714
2008
  configHash: murmurhash.murmurhash(this.config, {
1715
- maxLength: chunkTNHDC2ZQ_cjs.CACHE_HASH_LENGTH
1716
- }),
1717
- builtinIdMap: {},
1718
- virtualFiles: {}
2009
+ maxLength: chunk7XHBIYIN_cjs.CACHE_HASH_LENGTH
2010
+ })
1719
2011
  };
1720
2012
  }
1721
2013
  /**
@@ -1774,7 +2066,7 @@ var PowerlinesContext = class _PowerlinesContext {
1774
2066
  * Get the path to the data directory for the project
1775
2067
  */
1776
2068
  get dataPath() {
1777
- return join.joinPaths(this.envPaths.data, "projects", chunkTNHDC2ZQ_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
2069
+ return join.joinPaths(this.envPaths.data, "projects", chunk7XHBIYIN_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
1778
2070
  }
1779
2071
  /**
1780
2072
  * Get the path to the cache directory for the project
@@ -1784,7 +2076,7 @@ var PowerlinesContext = class _PowerlinesContext {
1784
2076
  checksum: this.#checksum,
1785
2077
  config: this.meta.configHash
1786
2078
  }, {
1787
- maxLength: chunkTNHDC2ZQ_cjs.CACHE_HASH_LENGTH
2079
+ maxLength: chunk7XHBIYIN_cjs.CACHE_HASH_LENGTH
1788
2080
  }));
1789
2081
  }
1790
2082
  /**
@@ -1803,13 +2095,13 @@ var PowerlinesContext = class _PowerlinesContext {
1803
2095
  * The builtin module id that exist in the Powerlines virtual file system
1804
2096
  */
1805
2097
  get builtins() {
1806
- return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
2098
+ return Object.values(this.fs.metadata).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
1807
2099
  }
1808
2100
  /**
1809
- * Get the project root relative to the workspace root
2101
+ * Get the builtin virtual files that exist in the Powerlines virtual file system
1810
2102
  */
1811
2103
  async getBuiltins() {
1812
- return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
2104
+ return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
1813
2105
  const code = await this.fs.readFile(path);
1814
2106
  return {
1815
2107
  ...meta,
@@ -1829,7 +2121,7 @@ var PowerlinesContext = class _PowerlinesContext {
1829
2121
  return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
1830
2122
  code,
1831
2123
  variant: "entry"
1832
- }, defu3__default.default(options, {
2124
+ }, defu2__default.default(options, {
1833
2125
  mode: this.config.output.mode
1834
2126
  }));
1835
2127
  }
@@ -1846,7 +2138,7 @@ var PowerlinesContext = class _PowerlinesContext {
1846
2138
  id,
1847
2139
  code,
1848
2140
  variant: "builtin"
1849
- }, defu3__default.default(options, {
2141
+ }, defu2__default.default(options, {
1850
2142
  mode: this.config.output.mode
1851
2143
  }));
1852
2144
  }
@@ -1868,7 +2160,7 @@ var PowerlinesContext = class _PowerlinesContext {
1868
2160
  options
1869
2161
  });
1870
2162
  }
1871
- const result = await oxcParser.parseAsync(id, code, defu3__default.default(options ?? {}, {
2163
+ const result = await oxcParser.parseAsync(id, code, defu2__default.default(options ?? {}, {
1872
2164
  lang: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1873
2165
  astType: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1874
2166
  sourceType: "module",
@@ -2037,7 +2329,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2037
2329
  if (exists.existsSync(packageJsonPath)) {
2038
2330
  this.packageJson = await json.readJsonFile(packageJsonPath);
2039
2331
  }
2040
- this.#checksum = await chunkTNHDC2ZQ_cjs.getChecksum(cacheKey.projectRoot);
2332
+ this.#checksum = await chunk7XHBIYIN_cjs.getChecksum(cacheKey.projectRoot);
2041
2333
  this.resolver = createResolver({
2042
2334
  workspaceRoot: this.workspaceConfig.workspaceRoot,
2043
2335
  projectRoot: cacheKey.projectRoot,
@@ -2056,7 +2348,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2056
2348
  });
2057
2349
  }
2058
2350
  if (isSetObject.isSetObject(config)) {
2059
- this.resolvedConfig = defu3__default.default({
2351
+ this.resolvedConfig = defu2__default.default({
2060
2352
  inlineConfig: this.config.inlineConfig,
2061
2353
  userConfig: this.config.userConfig
2062
2354
  }, options.isHighPriority ? this.#getConfigProps(config) : {}, {
@@ -2117,7 +2409,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2117
2409
  }
2118
2410
  });
2119
2411
  }
2120
- this.config.entry = chunkOTBLE55Z_cjs.getUniqueEntries(this.config.entry);
2412
+ this.config.entry = chunkMPCVQK2D_cjs.getUniqueEntries(this.config.entry);
2121
2413
  if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) {
2122
2414
  this.config.name = this.config.name.split("/").filter(Boolean)[1];
2123
2415
  }
@@ -2150,9 +2442,10 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2150
2442
  ret.push(plugin);
2151
2443
  return ret;
2152
2444
  }, []);
2445
+ this.#fs ??= await VirtualFileSystem.create(this);
2153
2446
  }
2154
2447
  mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
2155
- this.config.userConfig = defu3__default.default({
2448
+ this.config.userConfig = defu2__default.default({
2156
2449
  entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
2157
2450
  }, omit.omit(from ?? {}, [
2158
2451
  "entry"
@@ -2207,7 +2500,7 @@ async function callHook(context, hook, options, ...args) {
2207
2500
  if (definedResults.length > 0) {
2208
2501
  let mergedResult = void 0;
2209
2502
  for (const result of definedResults) {
2210
- mergedResult = defu3.defu(result, mergedResult ?? {});
2503
+ mergedResult = defu2.defu(result, mergedResult ?? {});
2211
2504
  }
2212
2505
  return mergedResult;
2213
2506
  }
@@ -2517,7 +2810,7 @@ async function emitTypes(context, tsconfig, files) {
2517
2810
  const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
2518
2811
  const sourceFile = sourceFiles?.[0];
2519
2812
  if (sourceFile?.fileName && !fileName.endsWith(".map")) {
2520
- if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.meta[file]?.id && context.fs.meta[file]?.id === sourceFile.fileName)) {
2813
+ if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.metadata[file]?.id && context.fs.metadata[file]?.id === sourceFile.fileName)) {
2521
2814
  builtinModules += `
2522
2815
  declare module "${context.fs.resolve(sourceFile.fileName)}" {
2523
2816
  ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
@@ -2836,11 +3129,14 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
2836
3129
  await resolveTsconfig(context);
2837
3130
  await installDependencies(context);
2838
3131
  await this.callPostHook(context, "configResolved");
3132
+ if (context.config.build.polyfill) {
3133
+ context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => chunkMPCVQK2D_cjs.replacePathTokens(context, polyfill));
3134
+ }
2839
3135
  context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
2840
3136
 
2841
3137
  ${console.formatLogMessage(context.config)}`);
2842
- context.fs[chunkTNHDC2ZQ_cjs.__VFS_INIT__]();
2843
- await chunkTNHDC2ZQ_cjs.writeMetaFile(context);
3138
+ context.fs[__VFS_PATCH__]();
3139
+ await chunk7XHBIYIN_cjs.writeMetaFile(context);
2844
3140
  context.persistedMeta = context.meta;
2845
3141
  if (!exists.existsSync(context.cachePath)) {
2846
3142
  await helpers.createDirectory(context.cachePath);
@@ -2899,7 +3195,7 @@ ${console.formatLogMessage(context.config)}`);
2899
3195
  joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
2900
3196
  ]);
2901
3197
  context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
2902
- const resolvedTsconfig = chunkBQU53ZNB_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu3__default.default({
3198
+ const resolvedTsconfig = chunkBQU53ZNB_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu2__default.default({
2903
3199
  compilerOptions: {
2904
3200
  strict: false,
2905
3201
  noEmit: false,
@@ -2970,8 +3266,8 @@ ${formatTypes(generatedTypes)}
2970
3266
  throw new Error("Failed to parse the TypeScript configuration file.");
2971
3267
  }
2972
3268
  await this.callPostHook(context, "prepare");
2973
- await chunkTNHDC2ZQ_cjs.writeMetaFile(context);
2974
- context.fs[chunkTNHDC2ZQ_cjs.__VFS_REVERT__]();
3269
+ await chunk7XHBIYIN_cjs.writeMetaFile(context);
3270
+ context.fs[__VFS_REVERT__]();
2975
3271
  });
2976
3272
  this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
2977
3273
  }
@@ -3101,22 +3397,22 @@ ${formatTypes(generatedTypes)}
3101
3397
  this.#context.log(types.LogLevelLabel.TRACE, "Powerlines documentation generation completed");
3102
3398
  }
3103
3399
  /**
3104
- * Release the project
3400
+ * Deploy the project source code
3105
3401
  *
3106
3402
  * @remarks
3107
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for release.
3403
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
3108
3404
  *
3109
- * @param inlineConfig - The inline configuration for the release command
3405
+ * @param inlineConfig - The inline configuration for the deploy command
3110
3406
  */
3111
- async release(inlineConfig = {
3112
- command: "release"
3407
+ async deploy(inlineConfig = {
3408
+ command: "deploy"
3113
3409
  }) {
3114
- this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Releasing the Powerlines project");
3410
+ this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Deploying the Powerlines project");
3115
3411
  await this.prepare(inlineConfig);
3116
3412
  await this.#executeEnvironments(async (context) => {
3117
- await this.callHook(context, "release");
3413
+ await this.callHook(context, "deploy");
3118
3414
  });
3119
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines release completed");
3415
+ this.context.log(types.LogLevelLabel.TRACE, "Powerlines deploy completed");
3120
3416
  }
3121
3417
  /**
3122
3418
  * Finalization process
@@ -3130,7 +3426,8 @@ ${formatTypes(generatedTypes)}
3130
3426
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
3131
3427
  await this.#executeEnvironments(async (context) => {
3132
3428
  await this.callHook(context, "finalize");
3133
- context.fs[chunkTNHDC2ZQ_cjs.__VFS_REVERT__]();
3429
+ context.fs[__VFS_REVERT__]();
3430
+ await context.fs.dispose();
3134
3431
  });
3135
3432
  this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
3136
3433
  }
@@ -3418,7 +3715,7 @@ function createUnpluginFactory(variant, decorate) {
3418
3715
  async function resolveId(id, importer, options = {
3419
3716
  isEntry: false
3420
3717
  }) {
3421
- return chunk7K7JH3DF_cjs.handleResolveId(api.context, {
3718
+ return chunkULJVBW4L_cjs.handleResolveId(api.context, {
3422
3719
  id,
3423
3720
  importer,
3424
3721
  options
@@ -3509,4 +3806,5 @@ function createUnpluginFactory(variant, decorate) {
3509
3806
  }
3510
3807
  chunkUSNT2KNT_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
3511
3808
 
3809
+ exports.VirtualFileSystem = VirtualFileSystem;
3512
3810
  exports.createUnpluginFactory = createUnpluginFactory;