powerlines 0.24.8 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/dist/{api-C32Buv5_.d.ts → api-BTK8aYwE.d.cts} +1 -1
  2. package/dist/{api-wzd5AREv.d.cts → api-eyrYBmQh.d.ts} +1 -1
  3. package/dist/api.cjs +8 -6
  4. package/dist/api.d.cts +20 -22
  5. package/dist/api.d.ts +20 -22
  6. package/dist/api.js +7 -5
  7. package/dist/astro.cjs +12 -10
  8. package/dist/astro.d.cts +19 -21
  9. package/dist/astro.d.ts +19 -21
  10. package/dist/astro.js +10 -8
  11. package/dist/{chunk-JKBJF3UI.js → chunk-2MYPFASJ.js} +2 -0
  12. package/dist/chunk-2VIXD2XB.js +3 -0
  13. package/dist/{chunk-OB7MYWHE.js → chunk-44PO64SX.js} +4 -2
  14. package/dist/chunk-4JCNAKOE.cjs +4 -0
  15. package/dist/{chunk-QH4TS5V4.cjs → chunk-6MFZ436T.cjs} +978 -1032
  16. package/dist/chunk-6ZGIV2SU.cjs +4 -0
  17. package/dist/chunk-7BZQBW77.cjs +4 -0
  18. package/dist/{chunk-JQCWV4DT.js → chunk-7LKYXMB3.js} +2 -0
  19. package/dist/{chunk-SHUYVCID.js → chunk-7QVYU63E.js} +2 -0
  20. package/dist/chunk-AFJCY3R6.js +3 -0
  21. package/dist/chunk-AXIRZAL7.js +3 -0
  22. package/dist/chunk-BTNHSS2P.cjs +13 -0
  23. package/dist/{chunk-FQXHIKCM.cjs → chunk-C2U4ATHO.cjs} +9 -7
  24. package/dist/chunk-DFLNRC3B.cjs +4 -0
  25. package/dist/chunk-DS7OM4NX.cjs +4 -0
  26. package/dist/{chunk-W5X3ZEZ5.js → chunk-EBXVKPUX.js} +2 -0
  27. package/dist/{chunk-X74SYWFL.cjs → chunk-G2EHTXK6.cjs} +9 -7
  28. package/dist/chunk-GIE6OE3X.js +3 -0
  29. package/dist/chunk-HJW7OH6E.js +3 -0
  30. package/dist/{chunk-MOXO6WJO.js → chunk-HSIMIWOH.js} +3 -1
  31. package/dist/{chunk-5IBA5HC2.cjs → chunk-HTJKPEWU.cjs} +6 -4
  32. package/dist/chunk-IHUNA3MO.cjs +4 -0
  33. package/dist/chunk-JU2HWIWS.js +12 -0
  34. package/dist/{chunk-BCHFSOQ4.js → chunk-LQXE5JHF.js} +906 -957
  35. package/dist/chunk-MBBNZS6K.cjs +16 -0
  36. package/dist/{chunk-3TNZWTLG.js → chunk-NNADGQRN.js} +5 -3
  37. package/dist/chunk-OYASPHNL.js +3 -0
  38. package/dist/chunk-PCCFAZML.js +3 -0
  39. package/dist/{chunk-USNT2KNT.cjs → chunk-PK6SKIKE.cjs} +2 -0
  40. package/dist/{chunk-ETKZMGLN.cjs → chunk-PSTCR335.cjs} +2 -0
  41. package/dist/chunk-Q7EJVZVI.cjs +4 -0
  42. package/dist/{chunk-CJSGAITR.js → chunk-S7MXT5A2.js} +3 -1
  43. package/dist/{chunk-7RWEBVQC.cjs → chunk-SDVEUTY2.cjs} +13 -11
  44. package/dist/{chunk-OLCL34MI.js → chunk-SYDUPBME.js} +6 -4
  45. package/dist/chunk-TLHFXGYV.js +3 -0
  46. package/dist/chunk-TP5MEMLG.cjs +12 -0
  47. package/dist/chunk-VNRXLY2T.js +3 -0
  48. package/dist/chunk-VQCQRLGM.cjs +4 -0
  49. package/dist/chunk-XZO6ZJQP.cjs +4 -0
  50. package/dist/{chunk-XP7OML7S.cjs → chunk-YUX7LOBU.cjs} +2 -0
  51. package/dist/chunk-YZZUOOPS.cjs +4 -0
  52. package/dist/chunk-Z5H7LD6W.js +3 -0
  53. package/dist/{chunk-VBR53KGY.js → chunk-Z5UEYORO.js} +5 -3
  54. package/dist/{chunk-PAMSESZV.cjs → chunk-Z6ARQDHR.cjs} +2 -0
  55. package/dist/config.cjs +5 -3
  56. package/dist/config.d.cts +19 -21
  57. package/dist/config.d.ts +19 -21
  58. package/dist/config.js +4 -2
  59. package/dist/{resolved-CSqGKlA5.d.cts → context-TizkCfOv.d.cts} +848 -849
  60. package/dist/{resolved-BABoCnXm.d.ts → context-jhcT1Vi1.d.ts} +848 -849
  61. package/dist/esbuild.cjs +13 -11
  62. package/dist/esbuild.d.cts +19 -21
  63. package/dist/esbuild.d.ts +19 -21
  64. package/dist/esbuild.js +10 -8
  65. package/dist/farm.cjs +9 -7
  66. package/dist/farm.d.cts +19 -21
  67. package/dist/farm.d.ts +19 -21
  68. package/dist/farm.js +8 -6
  69. package/dist/index.cjs +39 -41
  70. package/dist/index.d.cts +30 -55
  71. package/dist/index.d.ts +30 -55
  72. package/dist/index.js +20 -18
  73. package/dist/lib/{api-CDUN9en8.d.ts → api-CCOhyMZo.d.cts} +1 -1
  74. package/dist/lib/{api-BRMITKt-.d.cts → api-CpJJXdtL.d.ts} +1 -1
  75. package/dist/lib/build/esbuild.cjs +5 -5
  76. package/dist/lib/build/esbuild.d.cts +2 -2
  77. package/dist/lib/build/esbuild.d.ts +2 -2
  78. package/dist/lib/build/esbuild.js +2 -2
  79. package/dist/lib/build/index.cjs +25 -25
  80. package/dist/lib/build/index.d.cts +4 -4
  81. package/dist/lib/build/index.d.ts +4 -4
  82. package/dist/lib/build/index.js +9 -9
  83. package/dist/lib/build/rolldown.cjs +3 -3
  84. package/dist/lib/build/rolldown.d.cts +2 -2
  85. package/dist/lib/build/rolldown.d.ts +2 -2
  86. package/dist/lib/build/rolldown.js +2 -2
  87. package/dist/lib/build/rollup.cjs +3 -3
  88. package/dist/lib/build/rollup.d.cts +2 -2
  89. package/dist/lib/build/rollup.d.ts +2 -2
  90. package/dist/lib/build/rollup.js +1 -1
  91. package/dist/lib/build/rspack.cjs +2 -2
  92. package/dist/lib/build/rspack.d.cts +2 -2
  93. package/dist/lib/build/rspack.d.ts +2 -2
  94. package/dist/lib/build/rspack.js +1 -1
  95. package/dist/lib/build/tsup.cjs +6 -6
  96. package/dist/lib/build/tsup.d.cts +2 -2
  97. package/dist/lib/build/tsup.d.ts +2 -2
  98. package/dist/lib/build/tsup.js +3 -3
  99. package/dist/lib/build/unbuild.cjs +5 -5
  100. package/dist/lib/build/unbuild.d.cts +4 -4
  101. package/dist/lib/build/unbuild.d.ts +4 -4
  102. package/dist/lib/build/unbuild.js +2 -2
  103. package/dist/lib/build/vite.cjs +5 -5
  104. package/dist/lib/build/vite.d.cts +2 -2
  105. package/dist/lib/build/vite.d.ts +2 -2
  106. package/dist/lib/build/vite.js +3 -3
  107. package/dist/lib/build/webpack.cjs +2 -2
  108. package/dist/lib/build/webpack.d.cts +2 -2
  109. package/dist/lib/build/webpack.d.ts +2 -2
  110. package/dist/lib/build/webpack.js +1 -1
  111. package/dist/lib/chunk-3T56KQ7U.cjs +49 -0
  112. package/dist/lib/{chunk-PZLO6FZW.js → chunk-3W53W5J2.js} +2 -2
  113. package/dist/lib/chunk-4W6WV35V.js +108 -0
  114. package/dist/lib/chunk-6OYSDQXE.cjs +139 -0
  115. package/dist/lib/{chunk-EV357RFB.cjs → chunk-7MHUTBEC.cjs} +1 -3
  116. package/dist/lib/{chunk-A2NFSQ5K.js → chunk-7OVZZWGY.js} +1 -1
  117. package/dist/lib/chunk-A2NW7WAN.js +47 -0
  118. package/dist/lib/chunk-D6MI2V6R.cjs +115 -0
  119. package/dist/lib/{chunk-VHLINWXG.js → chunk-DLVVEHMU.js} +1 -1
  120. package/dist/lib/{chunk-XLYMVIVD.cjs → chunk-DNQBXFNE.cjs} +10 -10
  121. package/dist/lib/{chunk-UGVHYKKN.js → chunk-DYLE5FD3.js} +39 -2
  122. package/dist/lib/{chunk-AKBAX4FH.js → chunk-EN52JYUK.js} +1 -1
  123. package/dist/lib/{chunk-JYDGFQIV.cjs → chunk-F2CXZUSB.cjs} +1 -1
  124. package/dist/lib/{chunk-7VJ42H2I.cjs → chunk-HRRI4KOM.cjs} +1 -3
  125. package/dist/lib/{chunk-LPRZ3HD4.cjs → chunk-IXTLRVAK.cjs} +3 -3
  126. package/dist/lib/{chunk-SYF7QG2J.js → chunk-J3BW52BU.js} +1 -1
  127. package/dist/lib/chunk-KFDNKOXM.js +56 -0
  128. package/dist/lib/chunk-L56XA427.js +137 -0
  129. package/dist/lib/{chunk-6PPZCPME.cjs → chunk-LOW2TIQ6.cjs} +2 -2
  130. package/dist/lib/{chunk-TMZCGC5U.js → chunk-MI55FDCZ.js} +1 -1
  131. package/dist/lib/{chunk-DUZJ7ZF2.cjs → chunk-MKKWFHGE.cjs} +2 -2
  132. package/dist/lib/{chunk-ISBHXSDH.cjs → chunk-N5XEKCVW.cjs} +1 -1
  133. package/dist/lib/{chunk-XZFEHPYE.js → chunk-N5YLKWC2.js} +1 -1
  134. package/dist/lib/chunk-NIRFKQAD.js +845 -0
  135. package/dist/lib/{chunk-YMHOAMCU.cjs → chunk-NLJR4WIX.cjs} +41 -4
  136. package/dist/lib/{chunk-L3HESXYF.cjs → chunk-NUE5DIH3.cjs} +3 -3
  137. package/dist/lib/chunk-OBA5U4Y2.js +1059 -0
  138. package/dist/lib/{chunk-FQLZZYYO.js → chunk-OEF6EHQV.js} +1 -3
  139. package/dist/lib/{chunk-WTTBXYFQ.js → chunk-OFXWRM3U.js} +2 -2
  140. package/dist/lib/chunk-ONETLSPO.js +85 -0
  141. package/dist/lib/{chunk-2OV26JXJ.cjs → chunk-PQRWG64T.cjs} +3 -3
  142. package/dist/lib/chunk-R33US3PV.cjs +1081 -0
  143. package/dist/lib/{chunk-OA7OL7HF.cjs → chunk-SFEEJZLK.cjs} +38 -66
  144. package/dist/lib/{chunk-H6EOZSIZ.js → chunk-TAVG226Z.js} +1 -1
  145. package/dist/lib/{chunk-DALRRHB4.cjs → chunk-TSFG3WEA.cjs} +1 -1
  146. package/dist/lib/{chunk-RMA2PMP7.cjs → chunk-TZCC5IWH.cjs} +3 -3
  147. package/dist/lib/chunk-VHCBD2IS.js +149 -0
  148. package/dist/lib/{chunk-HY6DNFCT.js → chunk-VODWHWD6.js} +2 -2
  149. package/dist/lib/{chunk-2X5DUDNT.js → chunk-W6GWSJ22.js} +2 -2
  150. package/dist/lib/chunk-WBSA6OG6.cjs +860 -0
  151. package/dist/lib/{chunk-TOCNXURI.cjs → chunk-WCXA5WFX.cjs} +4 -4
  152. package/dist/lib/{chunk-6I5PL7H2.js → chunk-WGSZ4X6N.js} +1 -3
  153. package/dist/lib/{chunk-T2KQZC5K.js → chunk-WLDQUTFD.js} +27 -54
  154. package/dist/lib/{chunk-AOHJEL2Q.js → chunk-WOKPJMGJ.js} +3 -3
  155. package/dist/lib/{chunk-TDJNFAOV.cjs → chunk-X6JDYLWM.cjs} +1 -1
  156. package/dist/lib/chunk-XLHFUATD.cjs +151 -0
  157. package/dist/lib/chunk-XUYQYUWZ.cjs +87 -0
  158. package/dist/lib/chunk-YYEAV24J.cjs +67 -0
  159. package/dist/lib/{config-D8KrE7SZ.d.cts → config-Cqxh4V21.d.cts} +58 -475
  160. package/dist/lib/{config-DBIFdRoq.d.ts → config-D-WwQL-4.d.ts} +58 -475
  161. package/dist/lib/config-file.d.cts +2 -2
  162. package/dist/lib/config-file.d.ts +2 -2
  163. package/dist/lib/contexts/api-context.cjs +12 -7
  164. package/dist/lib/contexts/api-context.d.cts +27 -4
  165. package/dist/lib/contexts/api-context.d.ts +27 -4
  166. package/dist/lib/contexts/api-context.js +11 -6
  167. package/dist/lib/contexts/context.cjs +10 -5
  168. package/dist/lib/contexts/context.d.cts +7 -7
  169. package/dist/lib/contexts/context.d.ts +7 -7
  170. package/dist/lib/contexts/context.js +9 -4
  171. package/dist/lib/contexts/environment-context.cjs +11 -6
  172. package/dist/lib/contexts/environment-context.d.cts +4 -4
  173. package/dist/lib/contexts/environment-context.d.ts +4 -4
  174. package/dist/lib/contexts/environment-context.js +10 -5
  175. package/dist/lib/contexts/index.cjs +14 -9
  176. package/dist/lib/contexts/index.d.cts +4 -4
  177. package/dist/lib/contexts/index.d.ts +4 -4
  178. package/dist/lib/contexts/index.js +11 -6
  179. package/dist/lib/contexts/plugin-context.d.cts +4 -4
  180. package/dist/lib/contexts/plugin-context.d.ts +4 -4
  181. package/dist/lib/entry.cjs +9 -9
  182. package/dist/lib/entry.d.cts +2 -2
  183. package/dist/lib/entry.d.ts +2 -2
  184. package/dist/lib/entry.js +1 -1
  185. package/dist/lib/fs/helpers.cjs +47 -0
  186. package/dist/lib/fs/helpers.d.cts +74 -0
  187. package/dist/lib/fs/helpers.d.ts +74 -0
  188. package/dist/lib/fs/helpers.js +2 -0
  189. package/dist/lib/fs/index.cjs +17 -0
  190. package/dist/lib/fs/index.d.cts +33 -0
  191. package/dist/lib/fs/index.d.ts +33 -0
  192. package/dist/lib/fs/index.js +8 -0
  193. package/dist/lib/fs/storage/base.cjs +11 -0
  194. package/dist/lib/fs/storage/base.d.cts +138 -0
  195. package/dist/lib/fs/storage/base.d.ts +138 -0
  196. package/dist/lib/fs/storage/base.js +2 -0
  197. package/dist/lib/fs/storage/file-system.cjs +13 -0
  198. package/dist/lib/fs/storage/file-system.d.cts +90 -0
  199. package/dist/lib/fs/storage/file-system.d.ts +90 -0
  200. package/dist/lib/fs/storage/file-system.js +4 -0
  201. package/dist/lib/fs/storage/index.cjs +22 -0
  202. package/dist/lib/fs/storage/index.d.cts +6 -0
  203. package/dist/lib/fs/storage/index.d.ts +6 -0
  204. package/dist/lib/fs/storage/index.js +5 -0
  205. package/dist/lib/fs/storage/virtual.cjs +12 -0
  206. package/dist/lib/fs/storage/virtual.d.cts +66 -0
  207. package/dist/lib/fs/storage/virtual.d.ts +66 -0
  208. package/dist/lib/fs/storage/virtual.js +3 -0
  209. package/dist/lib/fs/vfs.cjs +16 -0
  210. package/dist/lib/fs/vfs.d.cts +247 -0
  211. package/dist/lib/fs/vfs.d.ts +247 -0
  212. package/dist/lib/fs/vfs.js +7 -0
  213. package/dist/lib/fs-Dg-aTfiN.d.cts +378 -0
  214. package/dist/lib/fs-Dg-aTfiN.d.ts +378 -0
  215. package/dist/lib/index.cjs +62 -68
  216. package/dist/lib/index.d.cts +18 -356
  217. package/dist/lib/index.d.ts +18 -356
  218. package/dist/lib/index.js +19 -13
  219. package/dist/lib/{internal-CaGANOWK.d.cts → internal-Cl7s1iAA.d.cts} +2 -2
  220. package/dist/lib/{internal-1qCyw7bA.d.ts → internal-W5pvS6e9.d.ts} +2 -2
  221. package/dist/lib/logger.d.cts +2 -2
  222. package/dist/lib/logger.d.ts +2 -2
  223. package/dist/lib/typescript/import-transformer.cjs +7 -45
  224. package/dist/lib/typescript/import-transformer.d.cts +2 -2
  225. package/dist/lib/typescript/import-transformer.d.ts +2 -2
  226. package/dist/lib/typescript/import-transformer.js +2 -47
  227. package/dist/lib/typescript/index.cjs +10 -22
  228. package/dist/lib/typescript/index.d.cts +4 -4
  229. package/dist/lib/typescript/index.d.ts +4 -4
  230. package/dist/lib/typescript/index.js +2 -2
  231. package/dist/lib/typescript/ts-morph.cjs +6 -2
  232. package/dist/lib/typescript/ts-morph.d.cts +28 -4
  233. package/dist/lib/typescript/ts-morph.d.ts +28 -4
  234. package/dist/lib/typescript/ts-morph.js +1 -1
  235. package/dist/lib/unplugin/factory.cjs +14 -9
  236. package/dist/lib/unplugin/factory.d.cts +4 -4
  237. package/dist/lib/unplugin/factory.d.ts +4 -4
  238. package/dist/lib/unplugin/factory.js +13 -8
  239. package/dist/lib/unplugin/helpers.d.cts +2 -2
  240. package/dist/lib/unplugin/helpers.d.ts +2 -2
  241. package/dist/lib/unplugin/index.cjs +16 -11
  242. package/dist/lib/unplugin/index.d.cts +4 -4
  243. package/dist/lib/unplugin/index.d.ts +4 -4
  244. package/dist/lib/unplugin/index.js +14 -9
  245. package/dist/lib/unplugin/plugin.cjs +2 -2
  246. package/dist/lib/unplugin/plugin.d.cts +4 -4
  247. package/dist/lib/unplugin/plugin.d.ts +4 -4
  248. package/dist/lib/unplugin/plugin.js +1 -1
  249. package/dist/lib/{unplugin-CEeJqADD.d.ts → unplugin-Cg2NoKj0.d.ts} +2 -2
  250. package/dist/lib/{unplugin-bUSyjd0S.d.cts → unplugin-trF-VLnO.d.cts} +2 -2
  251. package/dist/lib/utilities/bundle.cjs +4 -4
  252. package/dist/lib/utilities/bundle.d.cts +2 -2
  253. package/dist/lib/utilities/bundle.d.ts +2 -2
  254. package/dist/lib/utilities/bundle.js +3 -3
  255. package/dist/lib/utilities/cache.d.cts +2 -2
  256. package/dist/lib/utilities/cache.d.ts +2 -2
  257. package/dist/lib/utilities/file-header.d.cts +2 -2
  258. package/dist/lib/utilities/file-header.d.ts +2 -2
  259. package/dist/lib/utilities/index.cjs +22 -22
  260. package/dist/lib/utilities/index.d.cts +2 -2
  261. package/dist/lib/utilities/index.d.ts +2 -2
  262. package/dist/lib/utilities/index.js +6 -6
  263. package/dist/lib/utilities/meta.cjs +7 -7
  264. package/dist/lib/utilities/meta.d.cts +2 -2
  265. package/dist/lib/utilities/meta.d.ts +2 -2
  266. package/dist/lib/utilities/meta.js +1 -1
  267. package/dist/lib/utilities/resolve.cjs +5 -5
  268. package/dist/lib/utilities/resolve.d.cts +2 -2
  269. package/dist/lib/utilities/resolve.d.ts +2 -2
  270. package/dist/lib/utilities/resolve.js +4 -4
  271. package/dist/lib/utilities/source-file.d.cts +2 -2
  272. package/dist/lib/utilities/source-file.d.ts +2 -2
  273. package/dist/lib/utilities/source-map.d.cts +2 -2
  274. package/dist/lib/utilities/source-map.d.ts +2 -2
  275. package/dist/lib/utilities/worker.d.cts +2 -2
  276. package/dist/lib/utilities/worker.d.ts +2 -2
  277. package/dist/lib/utilities/write-file.d.cts +2 -2
  278. package/dist/lib/utilities/write-file.d.ts +2 -2
  279. package/dist/next.cjs +11 -9
  280. package/dist/next.js +9 -7
  281. package/dist/nuxt.cjs +13 -11
  282. package/dist/nuxt.js +11 -9
  283. package/dist/plugin-utils/{chunk-JHTLGE4X.js → chunk-K2GWRZPV.js} +1 -1
  284. package/dist/plugin-utils/{chunk-HSYQWNIH.cjs → chunk-VWFJOPKC.cjs} +1 -1
  285. package/dist/plugin-utils/{context-BITGF5LZ.d.cts → context-PtfEjz3_.d.cts} +187 -230
  286. package/dist/plugin-utils/{context-BITGF5LZ.d.ts → context-PtfEjz3_.d.ts} +187 -230
  287. package/dist/plugin-utils/context-helpers.d.cts +1 -2
  288. package/dist/plugin-utils/context-helpers.d.ts +1 -2
  289. package/dist/plugin-utils/enforce.d.cts +1 -2
  290. package/dist/plugin-utils/enforce.d.ts +1 -2
  291. package/dist/plugin-utils/extend.d.cts +1 -2
  292. package/dist/plugin-utils/extend.d.ts +1 -2
  293. package/dist/plugin-utils/get-config-path.d.cts +1 -2
  294. package/dist/plugin-utils/get-config-path.d.ts +1 -2
  295. package/dist/plugin-utils/helpers.d.cts +1 -2
  296. package/dist/plugin-utils/helpers.d.ts +1 -2
  297. package/dist/plugin-utils/index.cjs +2 -2
  298. package/dist/plugin-utils/index.d.cts +1 -2
  299. package/dist/plugin-utils/index.d.ts +1 -2
  300. package/dist/plugin-utils/index.js +1 -1
  301. package/dist/plugin-utils/merge.d.cts +1 -2
  302. package/dist/plugin-utils/merge.d.ts +1 -2
  303. package/dist/plugin-utils/paths.cjs +2 -2
  304. package/dist/plugin-utils/paths.d.cts +2 -3
  305. package/dist/plugin-utils/paths.d.ts +2 -3
  306. package/dist/plugin-utils/paths.js +1 -1
  307. package/dist/rolldown.cjs +9 -7
  308. package/dist/rolldown.d.cts +19 -21
  309. package/dist/rolldown.d.ts +19 -21
  310. package/dist/rolldown.js +8 -6
  311. package/dist/rollup.cjs +9 -7
  312. package/dist/rollup.d.cts +19 -21
  313. package/dist/rollup.d.ts +19 -21
  314. package/dist/rollup.js +8 -6
  315. package/dist/rspack.cjs +9 -7
  316. package/dist/rspack.d.cts +18 -20
  317. package/dist/rspack.d.ts +18 -20
  318. package/dist/rspack.js +8 -6
  319. package/dist/tsup.cjs +12 -10
  320. package/dist/tsup.js +10 -8
  321. package/dist/types/api.cjs +3 -1
  322. package/dist/types/api.cjs.map +1 -0
  323. package/dist/types/api.d.cts +20 -22
  324. package/dist/types/api.d.ts +20 -22
  325. package/dist/types/api.js +3 -1
  326. package/dist/types/api.js.map +1 -0
  327. package/dist/types/babel.cjs +3 -1
  328. package/dist/types/babel.cjs.map +1 -0
  329. package/dist/types/babel.d.cts +17 -19
  330. package/dist/types/babel.d.ts +17 -19
  331. package/dist/types/babel.js +3 -1
  332. package/dist/types/babel.js.map +1 -0
  333. package/dist/types/build.cjs +3 -1
  334. package/dist/types/build.cjs.map +1 -0
  335. package/dist/types/build.js +3 -1
  336. package/dist/types/build.js.map +1 -0
  337. package/dist/types/commands.cjs +5 -3
  338. package/dist/types/commands.cjs.map +1 -0
  339. package/dist/types/commands.d.cts +18 -20
  340. package/dist/types/commands.d.ts +18 -20
  341. package/dist/types/commands.js +4 -2
  342. package/dist/types/commands.js.map +1 -0
  343. package/dist/types/config.cjs +3 -1
  344. package/dist/types/config.cjs.map +1 -0
  345. package/dist/types/config.d.cts +2 -4
  346. package/dist/types/config.d.ts +2 -4
  347. package/dist/types/config.js +3 -1
  348. package/dist/types/config.js.map +1 -0
  349. package/dist/types/context.cjs +5 -3
  350. package/dist/types/context.cjs.map +1 -0
  351. package/dist/types/context.d.cts +8 -10
  352. package/dist/types/context.d.ts +8 -10
  353. package/dist/types/context.js +4 -2
  354. package/dist/types/context.js.map +1 -0
  355. package/dist/types/fs.cjs +10 -4
  356. package/dist/types/fs.cjs.map +1 -0
  357. package/dist/types/fs.d.cts +138 -184
  358. package/dist/types/fs.d.ts +138 -184
  359. package/dist/types/fs.js +4 -2
  360. package/dist/types/fs.js.map +1 -0
  361. package/dist/types/hooks.cjs +3 -1
  362. package/dist/types/hooks.cjs.map +1 -0
  363. package/dist/types/hooks.d.cts +19 -21
  364. package/dist/types/hooks.d.ts +19 -21
  365. package/dist/types/hooks.js +3 -1
  366. package/dist/types/hooks.js.map +1 -0
  367. package/dist/types/index.cjs +26 -20
  368. package/dist/types/index.cjs.map +1 -0
  369. package/dist/types/index.d.cts +13 -15
  370. package/dist/types/index.d.ts +13 -15
  371. package/dist/types/index.js +17 -15
  372. package/dist/types/index.js.map +1 -0
  373. package/dist/types/internal.cjs +2 -0
  374. package/dist/types/internal.cjs.map +1 -0
  375. package/dist/types/internal.d.cts +20 -22
  376. package/dist/types/internal.d.ts +20 -22
  377. package/dist/types/internal.js +2 -0
  378. package/dist/types/internal.js.map +1 -0
  379. package/dist/types/plugin.cjs +5 -3
  380. package/dist/types/plugin.cjs.map +1 -0
  381. package/dist/types/plugin.d.cts +9 -11
  382. package/dist/types/plugin.d.ts +9 -11
  383. package/dist/types/plugin.js +4 -2
  384. package/dist/types/plugin.js.map +1 -0
  385. package/dist/types/resolved.cjs +3 -1
  386. package/dist/types/resolved.cjs.map +1 -0
  387. package/dist/types/resolved.d.cts +7 -9
  388. package/dist/types/resolved.d.ts +7 -9
  389. package/dist/types/resolved.js +3 -1
  390. package/dist/types/resolved.js.map +1 -0
  391. package/dist/types/tsconfig.cjs +3 -1
  392. package/dist/types/tsconfig.cjs.map +1 -0
  393. package/dist/types/tsconfig.js +3 -1
  394. package/dist/types/tsconfig.js.map +1 -0
  395. package/dist/types/typedoc.cjs +3 -1
  396. package/dist/types/typedoc.cjs.map +1 -0
  397. package/dist/types/typedoc.js +3 -1
  398. package/dist/types/typedoc.js.map +1 -0
  399. package/dist/types/unplugin.cjs +3 -1
  400. package/dist/types/unplugin.cjs.map +1 -0
  401. package/dist/types/unplugin.d.cts +11 -13
  402. package/dist/types/unplugin.d.ts +11 -13
  403. package/dist/types/unplugin.js +3 -1
  404. package/dist/types/unplugin.js.map +1 -0
  405. package/dist/unloader.cjs +9 -7
  406. package/dist/unloader.d.cts +19 -21
  407. package/dist/unloader.d.ts +19 -21
  408. package/dist/unloader.js +8 -6
  409. package/dist/unplugin.cjs +20 -20
  410. package/dist/unplugin.d.cts +19 -21
  411. package/dist/unplugin.d.ts +19 -21
  412. package/dist/unplugin.js +10 -10
  413. package/dist/vite.cjs +13 -11
  414. package/dist/vite.d.cts +19 -21
  415. package/dist/vite.d.ts +19 -21
  416. package/dist/vite.js +10 -8
  417. package/dist/webpack.cjs +12 -10
  418. package/dist/webpack.d.cts +19 -21
  419. package/dist/webpack.d.ts +19 -21
  420. package/dist/webpack.js +9 -7
  421. package/package.json +72 -19
  422. package/schemas/fs.capnp +4 -59
  423. package/dist/chunk-2NO7N5OW.cjs +0 -2
  424. package/dist/chunk-7GYTTM4M.cjs +0 -2
  425. package/dist/chunk-AENPRFWJ.cjs +0 -2
  426. package/dist/chunk-AYKZK666.cjs +0 -8
  427. package/dist/chunk-BUR2JQ6G.cjs +0 -11
  428. package/dist/chunk-DRXFQCNC.js +0 -1
  429. package/dist/chunk-FNZDWE4L.js +0 -1
  430. package/dist/chunk-GHJU2KGP.cjs +0 -2
  431. package/dist/chunk-GRU7B3QM.cjs +0 -2
  432. package/dist/chunk-HQFZ64VC.cjs +0 -2
  433. package/dist/chunk-J4BQZHTQ.js +0 -1
  434. package/dist/chunk-JGB5YQ2U.js +0 -1
  435. package/dist/chunk-KALR2O2F.cjs +0 -2
  436. package/dist/chunk-LOUZXJFY.cjs +0 -10
  437. package/dist/chunk-OO3YXM72.js +0 -1
  438. package/dist/chunk-QE3WGMAP.js +0 -1
  439. package/dist/chunk-SMNKPH4T.js +0 -1
  440. package/dist/chunk-T2P533I5.js +0 -1
  441. package/dist/chunk-V3MLQDZQ.js +0 -1
  442. package/dist/chunk-VT7NVLLU.js +0 -5
  443. package/dist/chunk-YRJ4MLVL.cjs +0 -2
  444. package/dist/chunk-ZC43PZXS.cjs +0 -2
  445. package/dist/lib/chunk-3MZQ4MQX.cjs +0 -2360
  446. package/dist/lib/chunk-5JAFU45Z.js +0 -2324
  447. package/dist/lib/chunk-HAXL7QE7.js +0 -154
  448. package/dist/lib/chunk-SAS5EPBD.cjs +0 -107
  449. package/dist/lib/chunk-WUYK74EH.cjs +0 -165
  450. package/dist/lib/chunk-YQ3ODCHV.js +0 -105
  451. package/dist/lib/typescript/compiler-host.cjs +0 -164
  452. package/dist/lib/typescript/compiler-host.d.cts +0 -63
  453. package/dist/lib/typescript/compiler-host.d.ts +0 -63
  454. package/dist/lib/typescript/compiler-host.js +0 -156
  455. package/dist/lib/typescript/program.cjs +0 -27
  456. package/dist/lib/typescript/program.d.cts +0 -68
  457. package/dist/lib/typescript/program.d.ts +0 -68
  458. package/dist/lib/typescript/program.js +0 -2
  459. /package/dist/{chunk-2NCILNCH.cjs → lib/chunk-K2SFTPN3.cjs} +0 -0
  460. /package/dist/{chunk-BLNT5INX.js → lib/chunk-NQAHFTUW.js} +0 -0
@@ -0,0 +1,1059 @@
1
+ import { FileSystemStorageAdapter } from './chunk-L56XA427.js';
2
+ import { VirtualStorageAdapter } from './chunk-ONETLSPO.js';
3
+ import { normalizeId, normalizePath, normalizeKey, filterKeyByBase } from './chunk-KFDNKOXM.js';
4
+ import { extendLog } from './chunk-ENRLU4UR.js';
5
+ import { __name } from './chunk-SHUYVCID.js';
6
+ import { LogLevelLabel } from '@storm-software/config-tools/types';
7
+ import * as $ from '@stryke/capnp';
8
+ import { toArray } from '@stryke/convert/to-array';
9
+ import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
10
+ import { existsSync } from '@stryke/fs/exists';
11
+ import { getResolutionCombinations, resolve, resolveSync } from '@stryke/fs/resolve';
12
+ import { appendPath } from '@stryke/path/append';
13
+ import { toAbsolutePath } from '@stryke/path/correct-path';
14
+ import { hasFileExtension, findFilePath, findFileName } from '@stryke/path/file-path-fns';
15
+ import { isParentPath } from '@stryke/path/is-parent-path';
16
+ import { isAbsolutePath } from '@stryke/path/is-type';
17
+ import { joinPaths } from '@stryke/path/join-paths';
18
+ import { replacePath } from '@stryke/path/replace';
19
+ import { prettyBytes } from '@stryke/string-format/pretty-bytes';
20
+ import { isSetObject } from '@stryke/type-checks/is-set-object';
21
+ import { create } from 'flat-cache';
22
+ import { Blob } from 'node:buffer';
23
+ import { resolveConfig, format } from 'prettier';
24
+
25
+ BigInt("0xa56c61324b9d6e49");
26
+ var FileMetadata_KeyValuePair = class extends $.Struct {
27
+ static {
28
+ __name(this, "FileMetadata_KeyValuePair");
29
+ }
30
+ static _capnp = {
31
+ displayName: "KeyValuePair",
32
+ id: "eabb26cf58b2a14c",
33
+ size: new $.ObjectSize(0, 2)
34
+ };
35
+ get key() {
36
+ return $.utils.getText(0, this);
37
+ }
38
+ set key(value) {
39
+ $.utils.setText(0, value, this);
40
+ }
41
+ get value() {
42
+ return $.utils.getText(1, this);
43
+ }
44
+ set value(value) {
45
+ $.utils.setText(1, value, this);
46
+ }
47
+ toString() {
48
+ return "FileMetadata_KeyValuePair_" + super.toString();
49
+ }
50
+ };
51
+ var FileMetadata = class _FileMetadata extends $.Struct {
52
+ static {
53
+ __name(this, "FileMetadata");
54
+ }
55
+ static KeyValuePair = FileMetadata_KeyValuePair;
56
+ static _capnp = {
57
+ displayName: "FileMetadata",
58
+ id: "8e2cab5d7e28c7b3",
59
+ size: new $.ObjectSize(8, 3),
60
+ defaultType: "normal"
61
+ };
62
+ static _Properties;
63
+ /**
64
+ * The type of the file.
65
+ *
66
+ */
67
+ get id() {
68
+ return $.utils.getText(0, this);
69
+ }
70
+ set id(value) {
71
+ $.utils.setText(0, value, this);
72
+ }
73
+ /**
74
+ * The timestamp representing the file's creation date.
75
+ *
76
+ */
77
+ get type() {
78
+ return $.utils.getText(1, this, _FileMetadata._capnp.defaultType);
79
+ }
80
+ set type(value) {
81
+ $.utils.setText(1, value, this);
82
+ }
83
+ /**
84
+ * Additional metadata associated with the file.
85
+ *
86
+ */
87
+ get timestamp() {
88
+ return $.utils.getUint32(0, this);
89
+ }
90
+ set timestamp(value) {
91
+ $.utils.setUint32(0, value, this);
92
+ }
93
+ _adoptProperties(value) {
94
+ $.utils.adopt(value, $.utils.getPointer(2, this));
95
+ }
96
+ _disownProperties() {
97
+ return $.utils.disown(this.properties);
98
+ }
99
+ get properties() {
100
+ return $.utils.getList(2, _FileMetadata._Properties, this);
101
+ }
102
+ _hasProperties() {
103
+ return !$.utils.isNull($.utils.getPointer(2, this));
104
+ }
105
+ _initProperties(length) {
106
+ return $.utils.initList(2, _FileMetadata._Properties, length, this);
107
+ }
108
+ set properties(value) {
109
+ $.utils.copyFrom(value, $.utils.getPointer(2, this));
110
+ }
111
+ toString() {
112
+ return "FileMetadata_" + super.toString();
113
+ }
114
+ };
115
+ var FileId = class extends $.Struct {
116
+ static {
117
+ __name(this, "FileId");
118
+ }
119
+ static _capnp = {
120
+ displayName: "FileId",
121
+ id: "990d6a471072f997",
122
+ size: new $.ObjectSize(0, 2)
123
+ };
124
+ /**
125
+ * A virtual (or actual) path to the file in the file system.
126
+ *
127
+ */
128
+ get id() {
129
+ return $.utils.getText(0, this);
130
+ }
131
+ set id(value) {
132
+ $.utils.setText(0, value, this);
133
+ }
134
+ get path() {
135
+ return $.utils.getText(1, this);
136
+ }
137
+ set path(value) {
138
+ $.utils.setText(1, value, this);
139
+ }
140
+ toString() {
141
+ return "FileId_" + super.toString();
142
+ }
143
+ };
144
+ var FileStorage = class extends $.Struct {
145
+ static {
146
+ __name(this, "FileStorage");
147
+ }
148
+ static _capnp = {
149
+ displayName: "FileStorage",
150
+ id: "9dca66ac858c9ebe",
151
+ size: new $.ObjectSize(0, 2)
152
+ };
153
+ /**
154
+ * A virtual (or actual) path to the file in the file system.
155
+ *
156
+ */
157
+ get path() {
158
+ return $.utils.getText(0, this);
159
+ }
160
+ set path(value) {
161
+ $.utils.setText(0, value, this);
162
+ }
163
+ get code() {
164
+ return $.utils.getText(1, this);
165
+ }
166
+ set code(value) {
167
+ $.utils.setText(1, value, this);
168
+ }
169
+ toString() {
170
+ return "FileStorage_" + super.toString();
171
+ }
172
+ };
173
+ var FileSystem = class _FileSystem extends $.Struct {
174
+ static {
175
+ __name(this, "FileSystem");
176
+ }
177
+ static _capnp = {
178
+ displayName: "FileSystem",
179
+ id: "ae0c23d43e56abcf",
180
+ size: new $.ObjectSize(0, 3)
181
+ };
182
+ static _Ids;
183
+ static _Storage;
184
+ static _Metadata;
185
+ _adoptIds(value) {
186
+ $.utils.adopt(value, $.utils.getPointer(0, this));
187
+ }
188
+ _disownIds() {
189
+ return $.utils.disown(this.ids);
190
+ }
191
+ get ids() {
192
+ return $.utils.getList(0, _FileSystem._Ids, this);
193
+ }
194
+ _hasIds() {
195
+ return !$.utils.isNull($.utils.getPointer(0, this));
196
+ }
197
+ _initIds(length) {
198
+ return $.utils.initList(0, _FileSystem._Ids, length, this);
199
+ }
200
+ set ids(value) {
201
+ $.utils.copyFrom(value, $.utils.getPointer(0, this));
202
+ }
203
+ _adoptStorage(value) {
204
+ $.utils.adopt(value, $.utils.getPointer(1, this));
205
+ }
206
+ _disownStorage() {
207
+ return $.utils.disown(this.storage);
208
+ }
209
+ get storage() {
210
+ return $.utils.getList(1, _FileSystem._Storage, this);
211
+ }
212
+ _hasStorage() {
213
+ return !$.utils.isNull($.utils.getPointer(1, this));
214
+ }
215
+ _initStorage(length) {
216
+ return $.utils.initList(1, _FileSystem._Storage, length, this);
217
+ }
218
+ set storage(value) {
219
+ $.utils.copyFrom(value, $.utils.getPointer(1, this));
220
+ }
221
+ _adoptMetadata(value) {
222
+ $.utils.adopt(value, $.utils.getPointer(2, this));
223
+ }
224
+ _disownMetadata() {
225
+ return $.utils.disown(this.metadata);
226
+ }
227
+ get metadata() {
228
+ return $.utils.getList(2, _FileSystem._Metadata, this);
229
+ }
230
+ _hasMetadata() {
231
+ return !$.utils.isNull($.utils.getPointer(2, this));
232
+ }
233
+ _initMetadata(length) {
234
+ return $.utils.initList(2, _FileSystem._Metadata, length, this);
235
+ }
236
+ set metadata(value) {
237
+ $.utils.copyFrom(value, $.utils.getPointer(2, this));
238
+ }
239
+ toString() {
240
+ return "FileSystem_" + super.toString();
241
+ }
242
+ };
243
+ FileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);
244
+ FileSystem._Ids = $.CompositeList(FileId);
245
+ FileSystem._Storage = $.CompositeList(FileStorage);
246
+ FileSystem._Metadata = $.CompositeList(FileMetadata);
247
+
248
+ // src/types/fs.ts
249
+ var StoragePreset = /* @__PURE__ */ (function(StoragePreset2) {
250
+ StoragePreset2["VIRTUAL"] = "virtual";
251
+ StoragePreset2["FS"] = "fs";
252
+ return StoragePreset2;
253
+ })({});
254
+
255
+ // src/lib/fs/vfs.ts
256
+ var VirtualFileSystem = class _VirtualFileSystem {
257
+ static {
258
+ __name(this, "VirtualFileSystem");
259
+ }
260
+ /**
261
+ * A map of virtual file IDs to their associated metadata.
262
+ */
263
+ #metadata;
264
+ /**
265
+ * A map of virtual file IDs to their underlying file paths.
266
+ */
267
+ #ids;
268
+ /**
269
+ * A map of underlying file paths to their virtual file IDs.
270
+ */
271
+ #paths;
272
+ /**
273
+ * The unified volume that combines the virtual file system with the real file system.
274
+ *
275
+ * @remarks
276
+ * This volume allows for seamless access to both virtual and real files.
277
+ */
278
+ #storage = {
279
+ "": new FileSystemStorageAdapter()
280
+ };
281
+ /**
282
+ * A cache for module resolution results.
283
+ */
284
+ #resolverCache;
285
+ /**
286
+ * Indicator specifying if the virtual file system (VFS) is disposed
287
+ */
288
+ #isDisposed = false;
289
+ /**
290
+ * The context of the virtual file system.
291
+ */
292
+ #context;
293
+ /**
294
+ * The file system's logging function.
295
+ */
296
+ #log;
297
+ /**
298
+ * Normalizes a given module id by resolving it against the built-ins path.
299
+ *
300
+ * @param id - The module id to normalize.
301
+ * @returns The normalized module id.
302
+ */
303
+ #normalizeId(id) {
304
+ return normalizeId(id, this.#context.config.output.builtinPrefix);
305
+ }
306
+ /**
307
+ * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
308
+ *
309
+ * @param path - The path to normalize.
310
+ * @returns The normalized path.
311
+ */
312
+ #normalizePath(path) {
313
+ return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
314
+ }
315
+ /**
316
+ * Builds a regular expression from a string pattern for path matching.
317
+ *
318
+ * @param path - The string pattern to convert.
319
+ * @returns A regular expression for matching paths.
320
+ */
321
+ #buildRegex(path) {
322
+ const token = "::GLOBSTAR::";
323
+ return new RegExp(`^${this.#normalizePath(path).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
324
+ }
325
+ /**
326
+ * Gets the storage adapter and relative key for a given key.
327
+ *
328
+ * @param key - The key to get the storage adapter for.
329
+ * @returns The storage adapter and relative key for the given key.
330
+ */
331
+ #getStorage(key) {
332
+ const path = this.resolveSync(this.#normalizePath(key)) || key;
333
+ for (const base of Object.keys(this.#storage).filter(Boolean).sort().reverse()) {
334
+ if (isParentPath(path, base)) {
335
+ return {
336
+ base,
337
+ relativeKey: replacePath(path, base),
338
+ adapter: this.#storage[base]
339
+ };
340
+ }
341
+ }
342
+ return {
343
+ base: "",
344
+ relativeKey: path,
345
+ adapter: this.#storage[""]
346
+ };
347
+ }
348
+ /**
349
+ * Gets all storage adapters that match a given base key.
350
+ *
351
+ * @param base - The base key to match storage adapters against.
352
+ * @param includeParent - Whether to include parent storage adapters.
353
+ * @returns An array of storage adapters that match the given base key.
354
+ */
355
+ #getStorages(base = "", includeParent = false) {
356
+ return Object.keys(this.#storage).sort().reverse().filter((key) => isParentPath(key, base) || includeParent && isParentPath(base, key)).map((key) => ({
357
+ relativeBase: base.length > key.length ? base.slice(key.length) : void 0,
358
+ base: key,
359
+ adapter: this.#storage[key]
360
+ }));
361
+ }
362
+ /**
363
+ * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
364
+ *
365
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
366
+ * @returns A promise that resolves to a new virtual file system instance.
367
+ */
368
+ static async create(context) {
369
+ if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
370
+ const buffer = await readFileBuffer(joinPaths(context.dataPath, "fs.bin"));
371
+ const message2 = new $.Message(buffer, false);
372
+ const fs = message2.getRoot(FileSystem);
373
+ const result = new _VirtualFileSystem(context, fs);
374
+ if (fs._hasStorage() && fs.storage.length > 0) {
375
+ await Promise.all(fs.storage.values().map(async (file) => {
376
+ await result.write(file.path, file.code);
377
+ }));
378
+ }
379
+ }
380
+ const message = new $.Message();
381
+ return new _VirtualFileSystem(context, message.initRoot(FileSystem));
382
+ }
383
+ /**
384
+ * Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
385
+ *
386
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
387
+ * @returns A new virtual file system instance.
388
+ */
389
+ static createSync(context) {
390
+ if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
391
+ const buffer = readFileBufferSync(joinPaths(context.dataPath, "fs.bin"));
392
+ const message2 = new $.Message(buffer, false);
393
+ const fs = message2.getRoot(FileSystem);
394
+ const result = new _VirtualFileSystem(context, fs);
395
+ if (fs._hasStorage() && fs.storage.length > 0) {
396
+ fs.storage.values().map((file) => {
397
+ result.writeSync(file.path, file.code);
398
+ });
399
+ }
400
+ }
401
+ const message = new $.Message();
402
+ return new _VirtualFileSystem(context, message.initRoot(FileSystem));
403
+ }
404
+ /**
405
+ * A map of file ids to their metadata.
406
+ */
407
+ get metadata() {
408
+ return new Proxy(this.#metadata, {
409
+ get: /* @__PURE__ */ __name((target, prop) => {
410
+ return target[this.#normalizeId(prop)];
411
+ }, "get")
412
+ });
413
+ }
414
+ /**
415
+ * A map of file paths to their module ids.
416
+ */
417
+ get ids() {
418
+ return new Proxy(this.#paths, {
419
+ get: /* @__PURE__ */ __name((target, prop) => {
420
+ return target[this.#normalizePath(prop)];
421
+ }, "get")
422
+ });
423
+ }
424
+ /**
425
+ * A map of module ids to their file paths.
426
+ */
427
+ get paths() {
428
+ return new Proxy(this.#paths, {
429
+ get: /* @__PURE__ */ __name((target, prop) => {
430
+ return target[this.#normalizeId(prop)];
431
+ }, "get")
432
+ });
433
+ }
434
+ /**
435
+ * Gets the resolver cache.
436
+ */
437
+ get resolverCache() {
438
+ if (!this.#resolverCache) {
439
+ this.#resolverCache = create({
440
+ cacheId: "module-resolution",
441
+ cacheDir: this.#context.cachePath,
442
+ ttl: 60 * 60 * 1e3,
443
+ lruSize: 5e3,
444
+ persistInterval: 100
445
+ });
446
+ }
447
+ return this.#resolverCache;
448
+ }
449
+ /**
450
+ * Creates a new instance of the {@link VirtualFileSystem}.
451
+ *
452
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
453
+ * @param fs - A buffer containing the serialized virtual file system data.
454
+ */
455
+ constructor(context, fs) {
456
+ this.#context = context;
457
+ if (isSetObject(this.#context.config.output.storage)) {
458
+ this.#storage = {
459
+ ...this.#storage,
460
+ ...this.#context.config.output.storage
461
+ };
462
+ }
463
+ this.#storage.virtual ??= new VirtualStorageAdapter({
464
+ base: "/_virtual"
465
+ });
466
+ if (this.#context.config.output.storage !== StoragePreset.FS) {
467
+ this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter({
468
+ base: this.#context.artifactsPath
469
+ });
470
+ this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter({
471
+ base: this.#context.builtinsPath
472
+ });
473
+ this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter({
474
+ base: this.#context.entryPath
475
+ });
476
+ }
477
+ this.#metadata = {};
478
+ if (fs._hasMetadata()) {
479
+ this.#metadata = fs.metadata.values().reduce((ret, metadata) => {
480
+ ret[metadata.id] = {
481
+ id: metadata.id,
482
+ type: metadata.type,
483
+ timestamp: metadata.timestamp || Date.now(),
484
+ properties: metadata._hasProperties() ? metadata.properties.values().reduce((ret2, item) => {
485
+ ret2[item.key] = item.value;
486
+ return ret2;
487
+ }, {}) : {}
488
+ };
489
+ return ret;
490
+ }, {});
491
+ }
492
+ this.#ids = {};
493
+ this.#paths = {};
494
+ if (fs._hasIds()) {
495
+ this.#ids = fs.ids.values().reduce((ret, identifier) => {
496
+ ret[identifier.path] ??= identifier.id;
497
+ return ret;
498
+ }, {});
499
+ this.#paths = fs.ids.values().reduce((ret, identifier) => {
500
+ ret[identifier.id] ??= identifier.path;
501
+ return ret;
502
+ }, {});
503
+ }
504
+ this.#log = extendLog(this.#context.log, "file-system");
505
+ }
506
+ /**
507
+ * Asynchronously checks if a file exists in the virtual file system (VFS).
508
+ *
509
+ * @param path - The path to the file.
510
+ * @returns A promise that resolves to `true` if the file exists, otherwise `false`.
511
+ */
512
+ async exists(path) {
513
+ const { relativeKey, adapter } = this.#getStorage(path);
514
+ return adapter.exists(relativeKey);
515
+ }
516
+ /**
517
+ * Synchronously checks if a file exists in the virtual file system (VFS).
518
+ *
519
+ * @param path - The path to the file.
520
+ * @returns `true` if the file exists, otherwise `false`.
521
+ */
522
+ existsSync(path) {
523
+ const { relativeKey, adapter } = this.#getStorage(path);
524
+ return adapter.existsSync(relativeKey);
525
+ }
526
+ /**
527
+ * Checks if a file is virtual in the virtual file system (VFS).
528
+ *
529
+ * @param path - The path to the file.
530
+ * @returns `true` if the file is virtual, otherwise `false`.
531
+ */
532
+ isVirtual(path) {
533
+ const resolved = this.resolveSync(path);
534
+ if (!resolved) {
535
+ return false;
536
+ }
537
+ return this.#getStorage(resolved)?.adapter?.name === "virtual";
538
+ }
539
+ /**
540
+ * Lists files in a given path.
541
+ *
542
+ * @param path - The path to list files from.
543
+ * @returns An array of file names in the specified path.
544
+ */
545
+ listSync(path) {
546
+ let maskedMounts = [];
547
+ const allKeys = [];
548
+ for (const storage of this.#getStorages(path, true)) {
549
+ for (const key of storage.adapter.listSync(storage.relativeBase)) {
550
+ if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
551
+ allKeys.push(`${storage.base}${normalizeKey(key)}`);
552
+ }
553
+ }
554
+ maskedMounts = [
555
+ storage.base,
556
+ ...maskedMounts.filter((p) => !p.startsWith(storage.base))
557
+ ];
558
+ }
559
+ return allKeys.filter((key) => filterKeyByBase(key, path));
560
+ }
561
+ /**
562
+ * Lists files in a given path.
563
+ *
564
+ * @param path - The path to list files from.
565
+ * @returns An array of file names in the specified path.
566
+ */
567
+ async list(path) {
568
+ let maskedMounts = [];
569
+ const allKeys = [];
570
+ for (const storage of this.#getStorages(path, true)) {
571
+ for (const key of await storage.adapter.list(storage.relativeBase)) {
572
+ if (!maskedMounts.some((p) => `${storage.base}${normalizeKey(key)}`.startsWith(p))) {
573
+ allKeys.push(`${storage.base}${normalizeKey(key)}`);
574
+ }
575
+ }
576
+ maskedMounts = [
577
+ storage.base,
578
+ ...maskedMounts.filter((p) => !p.startsWith(storage.base))
579
+ ];
580
+ }
581
+ return allKeys.filter((key) => filterKeyByBase(key, path));
582
+ }
583
+ /**
584
+ * Removes a file in the virtual file system (VFS).
585
+ *
586
+ * @param path - The path to create the directory at.
587
+ */
588
+ async remove(path) {
589
+ const normalizedPath = this.#normalizePath(path);
590
+ this.#log(LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
591
+ const { relativeKey, adapter } = this.#getStorage(normalizedPath);
592
+ if (hasFileExtension(normalizedPath)) {
593
+ await adapter.remove(relativeKey);
594
+ } else {
595
+ await adapter.clear(relativeKey);
596
+ }
597
+ const id = this.#ids[normalizedPath];
598
+ if (id && this.#metadata[id]) {
599
+ delete this.#metadata[id];
600
+ delete this.#ids[normalizedPath];
601
+ delete this.#paths[id];
602
+ }
603
+ }
604
+ /**
605
+ * Removes a file in the virtual file system (VFS).
606
+ *
607
+ * @param path - The path to create the directory at.
608
+ */
609
+ removeSync(path) {
610
+ const normalizedPath = this.#normalizePath(path);
611
+ this.#log(LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
612
+ const { relativeKey, adapter } = this.#getStorage(normalizedPath);
613
+ if (hasFileExtension(normalizedPath)) {
614
+ adapter.removeSync(relativeKey);
615
+ } else {
616
+ adapter.clearSync(relativeKey);
617
+ }
618
+ const id = this.#ids[normalizedPath];
619
+ if (id && this.#metadata[id]) {
620
+ delete this.#metadata[id];
621
+ delete this.#ids[normalizedPath];
622
+ delete this.#paths[id];
623
+ }
624
+ }
625
+ /**
626
+ * Glob files in the virtual file system (VFS) based on the provided pattern(s).
627
+ *
628
+ * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
629
+ * @returns An array of file paths matching the provided pattern(s)
630
+ */
631
+ async glob(patterns) {
632
+ const results = [];
633
+ for (const pattern of toArray(patterns)) {
634
+ const normalized = this.#normalizePath(pattern);
635
+ if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
636
+ const resolved = this.resolveSync(normalized);
637
+ if (resolved && !results.includes(resolved)) {
638
+ results.push(resolved);
639
+ }
640
+ continue;
641
+ }
642
+ const absPattern = isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
643
+ const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
644
+ const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
645
+ await Promise.all((await this.list(baseDir && isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot)).map(async (file) => {
646
+ if (this.#buildRegex(absPattern).test(file)) {
647
+ const resolved = this.resolveSync(file);
648
+ if (resolved && !results.includes(resolved)) {
649
+ results.push(resolved);
650
+ }
651
+ }
652
+ }));
653
+ }
654
+ return results;
655
+ }
656
+ /**
657
+ * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
658
+ *
659
+ * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
660
+ * @returns An array of file paths matching the provided pattern(s)
661
+ */
662
+ globSync(patterns) {
663
+ const results = [];
664
+ for (const pattern of toArray(patterns)) {
665
+ const normalized = this.#normalizePath(pattern);
666
+ if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
667
+ const resolved = this.resolveSync(normalized);
668
+ if (resolved && !results.includes(resolved)) {
669
+ results.push(resolved);
670
+ }
671
+ continue;
672
+ }
673
+ const absPattern = isAbsolutePath(normalized) ? normalized : this.#normalizePath(joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
674
+ const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
675
+ const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
676
+ const files = this.listSync(baseDir && isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot);
677
+ for (const file of files) {
678
+ if (this.#buildRegex(absPattern).test(file)) {
679
+ const resolved = this.resolveSync(file);
680
+ if (resolved && !results.includes(resolved)) {
681
+ results.push(resolved);
682
+ }
683
+ }
684
+ }
685
+ }
686
+ return results;
687
+ }
688
+ /**
689
+ * Copies a file from one path to another in the virtual file system (VFS).
690
+ *
691
+ * @param srcPath - The source path to copy
692
+ * @param destPath - The destination path to copy to
693
+ */
694
+ async copy(srcPath, destPath) {
695
+ if (hasFileExtension(srcPath)) {
696
+ const content = await this.read(srcPath);
697
+ if (content !== void 0) {
698
+ await this.write(hasFileExtension(destPath) ? destPath : joinPaths(destPath, findFileName(srcPath)), content);
699
+ }
700
+ } else {
701
+ await Promise.all((await this.list(srcPath)).map(async (file) => {
702
+ const relativePath = file.replace(this.#normalizePath(srcPath), "");
703
+ const destinationPath = this.#normalizePath(appendPath(destPath, relativePath));
704
+ const content = await this.read(file);
705
+ if (content !== void 0) {
706
+ await this.write(destinationPath, content);
707
+ }
708
+ }));
709
+ }
710
+ }
711
+ /**
712
+ * Synchronously copies a file from one path to another in the virtual file system (VFS).
713
+ *
714
+ * @param srcPath - The source path to copy
715
+ * @param destPath - The destination path to copy to
716
+ */
717
+ copySync(srcPath, destPath) {
718
+ if (hasFileExtension(srcPath)) {
719
+ const content = this.readSync(srcPath);
720
+ if (content !== void 0) {
721
+ this.writeSync(hasFileExtension(destPath) ? destPath : joinPaths(destPath, findFileName(srcPath)), content);
722
+ }
723
+ } else {
724
+ this.listSync(srcPath).forEach((file) => {
725
+ const relativePath = file.replace(this.#normalizePath(srcPath), "");
726
+ const destinationPath = this.#normalizePath(appendPath(destPath, relativePath));
727
+ const content = this.readSync(file);
728
+ if (content !== void 0) {
729
+ this.writeSync(destinationPath, content);
730
+ }
731
+ });
732
+ }
733
+ }
734
+ /**
735
+ * Moves a file (or files) from one path to another in the virtual file system (VFS).
736
+ *
737
+ * @param srcPath - The source path to move
738
+ * @param destPath - The destination path to move to
739
+ */
740
+ async move(srcPath, destPath) {
741
+ if (hasFileExtension(srcPath)) {
742
+ await this.copy(srcPath, destPath);
743
+ await this.remove(srcPath);
744
+ } else {
745
+ await Promise.all((await this.list(srcPath)).map(async (file) => {
746
+ await this.copy(file, destPath);
747
+ await this.remove(file);
748
+ }));
749
+ }
750
+ }
751
+ /**
752
+ * Synchronously moves a file (or files) from one path to another in the virtual file system (VFS).
753
+ *
754
+ * @param srcPath - The source path to move
755
+ * @param destPath - The destination path to move to
756
+ */
757
+ moveSync(srcPath, destPath) {
758
+ if (hasFileExtension(srcPath)) {
759
+ this.copySync(srcPath, destPath);
760
+ this.removeSync(srcPath);
761
+ } else {
762
+ this.listSync(srcPath).forEach((file) => {
763
+ this.copySync(file, destPath);
764
+ this.removeSync(file);
765
+ });
766
+ }
767
+ }
768
+ /**
769
+ * Asynchronously reads a file from the virtual file system (VFS).
770
+ *
771
+ * @param path - The path or ID of the file to read.
772
+ * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
773
+ */
774
+ async read(path) {
775
+ const filePath = await this.resolve(path);
776
+ if (!filePath) {
777
+ return void 0;
778
+ }
779
+ const { relativeKey, adapter } = this.#getStorage(filePath);
780
+ this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
781
+ return await adapter.get(relativeKey) ?? void 0;
782
+ }
783
+ /**
784
+ * Synchronously reads a file from the virtual file system (VFS).
785
+ *
786
+ * @param path - The path or ID of the file to read.
787
+ * @returns The contents of the file as a string, or undefined if the file does not exist.
788
+ */
789
+ readSync(path) {
790
+ const filePath = this.resolveSync(path);
791
+ if (!filePath) {
792
+ return void 0;
793
+ }
794
+ const { relativeKey, adapter } = this.#getStorage(filePath);
795
+ this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
796
+ return adapter.getSync(relativeKey) ?? void 0;
797
+ }
798
+ /**
799
+ * Writes a file to the virtual file system (VFS).
800
+ *
801
+ * @param path - The path to the file.
802
+ * @param data - The contents of the file.
803
+ * @param options - Optional parameters for writing the file.
804
+ * @returns A promise that resolves when the file is written.
805
+ */
806
+ async write(path, data = "", options = {}) {
807
+ let code = data;
808
+ if (!options.skipFormat) {
809
+ const resolvedConfig = await resolveConfig(this.#normalizePath(path));
810
+ if (resolvedConfig) {
811
+ code = await format(data, {
812
+ absolutePath: this.#normalizePath(path),
813
+ ...resolvedConfig
814
+ });
815
+ }
816
+ }
817
+ const { relativeKey, adapter } = this.#getStorage(path);
818
+ this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
819
+ const id = options?.meta?.id || this.#normalizeId(path);
820
+ this.#metadata[id] = {
821
+ variant: "normal",
822
+ timestamp: Date.now(),
823
+ ...options.meta ?? {}
824
+ };
825
+ this.#paths[id] = this.#normalizePath(path);
826
+ this.#ids[this.#normalizePath(path)] = id;
827
+ return adapter.set(relativeKey, code);
828
+ }
829
+ /**
830
+ * Synchronously writes a file to the virtual file system (VFS).
831
+ *
832
+ * @param path - The file to write.
833
+ * @param data - The contents of the file.
834
+ * @param options - Optional parameters for writing the file.
835
+ */
836
+ writeSync(path, data = "", options = {}) {
837
+ const { relativeKey, adapter } = this.#getStorage(path);
838
+ this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(data)).size)})`);
839
+ const id = options?.meta?.id || this.#normalizeId(path);
840
+ this.#metadata[id] = {
841
+ variant: "normal",
842
+ timestamp: Date.now(),
843
+ ...options.meta ?? {}
844
+ };
845
+ this.#paths[id] = this.#normalizePath(path);
846
+ this.#ids[this.#normalizePath(path)] = id;
847
+ return adapter.setSync(relativeKey, data);
848
+ }
849
+ /**
850
+ * Retrieves the metadata of a file in the virtual file system (VFS).
851
+ *
852
+ * @param pathOrId - The path or ID of the file to retrieve metadata for.
853
+ * @returns The metadata of the file, or undefined if the file does not exist.
854
+ */
855
+ getMetadata(pathOrId) {
856
+ const resolved = this.resolveSync(pathOrId);
857
+ if (resolved && this.metadata[resolved]) {
858
+ return this.metadata[resolved];
859
+ }
860
+ return void 0;
861
+ }
862
+ /**
863
+ * A helper function to resolve modules in the virtual file system (VFS).
864
+ *
865
+ * @remarks
866
+ * This function can be used to resolve modules relative to the project root directory.
867
+ *
868
+ * @example
869
+ * ```ts
870
+ * const resolved = await context.resolvePath("some-module", "/path/to/importer");
871
+ * ```
872
+ *
873
+ * @param id - The module to resolve.
874
+ * @param importer - An optional path to the importer module.
875
+ * @param options - Additional resolution options.
876
+ * @returns A promise that resolves to the resolved module path.
877
+ */
878
+ async resolve(id, importer, options = {}) {
879
+ if (isAbsolutePath(id)) {
880
+ return id;
881
+ }
882
+ let result;
883
+ if (!this.#context.config.skipCache) {
884
+ result = this.resolverCache.get(this.#normalizeId(id));
885
+ if (result) {
886
+ return result;
887
+ }
888
+ }
889
+ result = this.paths[this.#normalizeId(id)];
890
+ if (!result) {
891
+ const paths = options.paths ?? [];
892
+ if (importer && !paths.includes(importer)) {
893
+ paths.push(importer);
894
+ }
895
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
896
+ paths.push(appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
897
+ paths.push(appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
898
+ paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
899
+ for (const combination of getResolutionCombinations(id, {
900
+ paths
901
+ })) {
902
+ const { relativeKey, adapter } = this.#getStorage(combination);
903
+ if (await adapter.exists(relativeKey)) {
904
+ result = combination;
905
+ break;
906
+ }
907
+ }
908
+ try {
909
+ result = await resolve(id, {
910
+ paths
911
+ });
912
+ } catch {
913
+ }
914
+ }
915
+ if (result) {
916
+ result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
917
+ if (!this.#context.config.skipCache) {
918
+ this.resolverCache.set(this.#normalizeId(id), result);
919
+ }
920
+ }
921
+ return result;
922
+ }
923
+ /**
924
+ * A synchronous helper function to resolve modules using the Jiti resolver
925
+ *
926
+ * @remarks
927
+ * This function can be used to resolve modules relative to the project root directory.
928
+ *
929
+ * @example
930
+ * ```ts
931
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
932
+ * ```
933
+ *
934
+ * @param id - The module to resolve.
935
+ * @param importer - An optional path to the importer module.
936
+ * @param options - Additional resolution options.
937
+ * @returns The resolved module path.
938
+ */
939
+ resolveSync(id, importer, options = {}) {
940
+ if (isAbsolutePath(id)) {
941
+ return id;
942
+ }
943
+ let result;
944
+ if (!this.#context.config.skipCache) {
945
+ result = this.resolverCache.get(this.#normalizeId(id));
946
+ if (result) {
947
+ return result;
948
+ }
949
+ }
950
+ result = this.paths[this.#normalizeId(id)];
951
+ if (!result) {
952
+ const paths = options.paths ?? [];
953
+ if (importer && !paths.includes(importer)) {
954
+ paths.push(importer);
955
+ }
956
+ paths.push(this.#context.workspaceConfig.workspaceRoot);
957
+ paths.push(appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
958
+ paths.push(appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
959
+ paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
960
+ for (const combination of getResolutionCombinations(id, {
961
+ paths
962
+ })) {
963
+ const { relativeKey, adapter } = this.#getStorage(combination);
964
+ if (adapter.existsSync(relativeKey)) {
965
+ result = combination;
966
+ break;
967
+ }
968
+ }
969
+ try {
970
+ result = resolveSync(id, {
971
+ paths
972
+ });
973
+ } catch {
974
+ }
975
+ }
976
+ if (result) {
977
+ result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
978
+ if (!this.#context.config.skipCache) {
979
+ this.resolverCache.set(this.#normalizeId(id), result);
980
+ }
981
+ }
982
+ return result;
983
+ }
984
+ /**
985
+ * Disposes of the virtual file system (VFS) by saving its state to disk.
986
+ */
987
+ async dispose() {
988
+ if (!this.#isDisposed) {
989
+ this.#isDisposed = true;
990
+ this.#log(LogLevelLabel.DEBUG, "Disposing virtual file system...");
991
+ await this.remove(joinPaths(this.#context.dataPath, "fs.bin"));
992
+ const message = new $.Message();
993
+ const fs = message.initRoot(FileSystem);
994
+ const paths = await this.list();
995
+ const storage = fs._initStorage(paths.length);
996
+ await Promise.all(paths.map(async (path, index) => {
997
+ const code = await this.read(path);
998
+ const fd = storage.get(index);
999
+ fd.path = path;
1000
+ fd.code = code || "";
1001
+ }));
1002
+ const ids = fs._initIds(Object.keys(this.ids).length);
1003
+ Object.entries(this.ids).filter(([, path]) => path).forEach(([id, path], index) => {
1004
+ const fileId = ids.get(index);
1005
+ fileId.id = id;
1006
+ fileId.path = path;
1007
+ });
1008
+ const metadata = fs._initMetadata(Object.keys(this.metadata).length);
1009
+ Object.entries(this.metadata).filter(([, value]) => value).forEach(([id, value], index) => {
1010
+ const fileMetadata = metadata.get(index);
1011
+ fileMetadata.id = id;
1012
+ fileMetadata.type = value.type;
1013
+ fileMetadata.timestamp = value.timestamp ?? BigInt(Date.now());
1014
+ if (value.properties) {
1015
+ const props = fileMetadata._initProperties(Object.keys(value.properties).length);
1016
+ Object.entries(value.properties).forEach(([key, val], index2) => {
1017
+ const prop = props.get(index2);
1018
+ prop.key = key;
1019
+ prop.value = val;
1020
+ });
1021
+ }
1022
+ });
1023
+ await writeFileBuffer(joinPaths(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
1024
+ if (!this.#context.config.skipCache) {
1025
+ this.#resolverCache.save(true);
1026
+ }
1027
+ await Promise.all(this.#getStorages().map(async (storage2) => storage2.adapter.dispose()));
1028
+ this.#log(LogLevelLabel.TRACE, "Virtual file system has been disposed.");
1029
+ }
1030
+ }
1031
+ // /**
1032
+ // * Initializes the virtual file system (VFS) by patching the file system module if necessary.
1033
+ // */
1034
+ // public [__VFS_PATCH__]() {
1035
+ // if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
1036
+ // this.#revert = patchFS(fs, this);
1037
+ // this.#isPatched = true;
1038
+ // }
1039
+ // }
1040
+ // /**
1041
+ // * Reverts the file system module to its original state if it was previously patched.
1042
+ // */
1043
+ // public [__VFS_REVERT__]() {
1044
+ // if (this.#isPatched && this.#context.config.output.mode !== "fs") {
1045
+ // if (!this.#revert) {
1046
+ // throw new Error(
1047
+ // "Attempting to revert File System patch prior to calling `__init__` function"
1048
+ // );
1049
+ // }
1050
+ // this.#revert?.();
1051
+ // this.#isPatched = false;
1052
+ // }
1053
+ // }
1054
+ async [Symbol.asyncDispose]() {
1055
+ return this.dispose();
1056
+ }
1057
+ };
1058
+
1059
+ export { VirtualFileSystem };