powerlines 0.20.0 → 0.21.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 (301) 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-75UVEMIV.cjs → chunk-DZZPNO5H.cjs} +2 -2
  200. package/dist/plugin-utils/{chunk-WEIEQXIJ.cjs → chunk-ECFS7DPV.cjs} +5 -5
  201. package/dist/plugin-utils/{chunk-MQOW6ENT.cjs → chunk-F65J5WOX.cjs} +1 -1
  202. package/dist/plugin-utils/{chunk-IHME6YWJ.js → chunk-GV7O3E7P.js} +1 -1
  203. package/dist/plugin-utils/{chunk-PK6PYFWY.js → chunk-L277XSSN.js} +1 -1
  204. package/dist/plugin-utils/{chunk-YDYJAGMP.js → chunk-QKMG6ZAU.js} +1 -1
  205. package/dist/plugin-utils/{chunk-5TL6KEQ5.cjs → chunk-UNAGYQRB.cjs} +4 -4
  206. package/dist/plugin-utils/{chunk-432MQOUZ.js → chunk-XIXI67PY.js} +1 -1
  207. package/dist/plugin-utils/{config-pwKiZvzJ.d.cts → config-BzVVjChJ.d.cts} +65 -65
  208. package/dist/plugin-utils/{config-pwKiZvzJ.d.ts → config-BzVVjChJ.d.ts} +65 -65
  209. package/dist/plugin-utils/enforce.cjs +5 -5
  210. package/dist/plugin-utils/enforce.d.cts +1 -3
  211. package/dist/plugin-utils/enforce.d.ts +1 -3
  212. package/dist/plugin-utils/enforce.js +4 -4
  213. package/dist/plugin-utils/extend.cjs +4 -4
  214. package/dist/plugin-utils/extend.d.cts +1 -3
  215. package/dist/plugin-utils/extend.d.ts +1 -3
  216. package/dist/plugin-utils/extend.js +3 -3
  217. package/dist/plugin-utils/get-config-path.cjs +2 -2
  218. package/dist/plugin-utils/get-config-path.d.cts +1 -3
  219. package/dist/plugin-utils/get-config-path.d.ts +1 -3
  220. package/dist/plugin-utils/get-config-path.js +1 -1
  221. package/dist/plugin-utils/helpers.cjs +14 -14
  222. package/dist/plugin-utils/helpers.d.cts +1 -3
  223. package/dist/plugin-utils/helpers.d.ts +1 -3
  224. package/dist/plugin-utils/helpers.js +1 -1
  225. package/dist/plugin-utils/index.cjs +22 -22
  226. package/dist/plugin-utils/index.d.cts +1 -3
  227. package/dist/plugin-utils/index.d.ts +1 -3
  228. package/dist/plugin-utils/index.js +5 -5
  229. package/dist/plugin-utils/merge.cjs +3 -3
  230. package/dist/plugin-utils/merge.d.cts +1 -3
  231. package/dist/plugin-utils/merge.d.ts +1 -3
  232. package/dist/plugin-utils/merge.js +2 -2
  233. package/dist/plugin-utils/paths.d.cts +2 -4
  234. package/dist/plugin-utils/paths.d.ts +2 -4
  235. package/dist/{resolved-ohMN-3VJ.d.cts → resolved-D8vIizyA.d.cts} +15 -16
  236. package/dist/{resolved-Sxyrlt6g.d.ts → resolved-DWxXKJYy.d.ts} +15 -16
  237. package/dist/rolldown.cjs +8 -8
  238. package/dist/rolldown.d.cts +1 -2
  239. package/dist/rolldown.d.ts +1 -2
  240. package/dist/rolldown.js +5 -5
  241. package/dist/rollup.cjs +8 -8
  242. package/dist/rollup.d.cts +1 -2
  243. package/dist/rollup.d.ts +1 -2
  244. package/dist/rollup.js +5 -5
  245. package/dist/rspack.cjs +8 -8
  246. package/dist/rspack.d.cts +1 -2
  247. package/dist/rspack.d.ts +1 -2
  248. package/dist/rspack.js +5 -5
  249. package/dist/tsup.cjs +10 -10
  250. package/dist/tsup.js +7 -7
  251. package/dist/types/babel.d.cts +1 -2
  252. package/dist/types/babel.d.ts +1 -2
  253. package/dist/types/build.d.cts +18 -1
  254. package/dist/types/build.d.ts +18 -1
  255. package/dist/types/commands.cjs +2 -2
  256. package/dist/types/commands.d.cts +1 -2
  257. package/dist/types/commands.d.ts +1 -2
  258. package/dist/types/commands.js +1 -1
  259. package/dist/types/config.d.cts +1 -2
  260. package/dist/types/config.d.ts +1 -2
  261. package/dist/types/context.d.cts +1 -2
  262. package/dist/types/context.d.ts +1 -2
  263. package/dist/types/hooks.d.cts +1 -2
  264. package/dist/types/hooks.d.ts +1 -2
  265. package/dist/types/index.cjs +6 -22
  266. package/dist/types/index.d.cts +2 -3
  267. package/dist/types/index.d.ts +2 -3
  268. package/dist/types/index.js +2 -2
  269. package/dist/types/internal.d.cts +2 -3
  270. package/dist/types/internal.d.ts +2 -3
  271. package/dist/types/plugin.d.cts +1 -2
  272. package/dist/types/plugin.d.ts +1 -2
  273. package/dist/types/resolved.d.cts +1 -2
  274. package/dist/types/resolved.d.ts +1 -2
  275. package/dist/types/unplugin.d.cts +1 -2
  276. package/dist/types/unplugin.d.ts +1 -2
  277. package/dist/types/vfs.cjs +4 -20
  278. package/dist/types/vfs.d.cts +47 -54
  279. package/dist/types/vfs.d.ts +47 -54
  280. package/dist/types/vfs.js +1 -1
  281. package/dist/unloader.cjs +8 -8
  282. package/dist/unloader.d.cts +1 -2
  283. package/dist/unloader.d.ts +1 -2
  284. package/dist/unloader.js +5 -5
  285. package/dist/unplugin.cjs +20 -20
  286. package/dist/unplugin.d.cts +2 -3
  287. package/dist/unplugin.d.ts +2 -3
  288. package/dist/unplugin.js +17 -17
  289. package/dist/vite.cjs +9 -9
  290. package/dist/vite.d.cts +1 -2
  291. package/dist/vite.d.ts +1 -2
  292. package/dist/vite.js +6 -6
  293. package/dist/webpack.cjs +8 -8
  294. package/dist/webpack.d.cts +1 -2
  295. package/dist/webpack.d.ts +1 -2
  296. package/dist/webpack.js +5 -5
  297. package/package.json +3 -3
  298. package/dist/chunk-OBYFBPPO.js +0 -9
  299. package/dist/chunk-RF6RSWD4.cjs +0 -16
  300. package/dist/chunk-SECEPZQ3.cjs +0 -32
  301. package/dist/chunk-XBS3AHAK.js +0 -29
@@ -1,6 +1,6 @@
1
1
  import { PLUGIN_NON_HOOK_FIELDS } from './chunk-JQCWV4DT.js';
2
- import { __VFS_CACHE__, __VFS_RESOLVER__, __VFS_VIRTUAL__, __VFS_UNIFIED__, __VFS_INIT__, __VFS_REVERT__ } from './chunk-OBYFBPPO.js';
3
- import { SUPPORTED_COMMANDS } from './chunk-WJ4CZKXY.js';
2
+ import { __VFS_PATCH__, __VFS_REVERT__ } from './chunk-ZWF7LZXE.js';
3
+ import { SUPPORTED_COMMANDS } from './chunk-JKBJF3UI.js';
4
4
  import { __name } from './chunk-SHUYVCID.js';
5
5
  import { transformAsync } from '@babel/core';
6
6
  import { formatLogMessage } from '@storm-software/config-tools/logger/console';
@@ -13,7 +13,7 @@ import { install } from '@stryke/fs/install';
13
13
  import { listFiles, listFilesSync } from '@stryke/fs/list-files';
14
14
  import { isPackageExists, isPackageListed, doesPackageMatch, getPackageListing } from '@stryke/fs/package-fns';
15
15
  import { resolvePackage } from '@stryke/fs/resolve';
16
- import { joinPaths } from '@stryke/path/join-paths';
16
+ import { joinPaths as joinPaths$1 } from '@stryke/path/join-paths';
17
17
  import { replacePath, replaceExtension } from '@stryke/path/replace';
18
18
  import { isError } from '@stryke/type-checks/is-error';
19
19
  import { isFunction } from '@stryke/type-checks/is-function';
@@ -23,7 +23,7 @@ import { isSet } from '@stryke/type-checks/is-set';
23
23
  import { isSetObject } from '@stryke/type-checks/is-set-object';
24
24
  import { isSetString } from '@stryke/type-checks/is-set-string';
25
25
  import chalk5 from 'chalk';
26
- import defu4, { defu } from 'defu';
26
+ import defu3, { defu } from 'defu';
27
27
  import Handlebars from 'handlebars';
28
28
  import { declare } from '@babel/helper-plugin-utils';
29
29
  import * as t from '@babel/types';
@@ -38,32 +38,34 @@ import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
38
38
  import { omit } from '@stryke/helpers/omit';
39
39
  import { StormJSON } from '@stryke/json/storm-json';
40
40
  import { appendPath } from '@stryke/path/append';
41
- import { findFilePath, findFileDotExtensionSafe, hasFileExtension, relativePath, findFileName } from '@stryke/path/file-path-fns';
41
+ import { findFileDotExtensionSafe, findFilePath, hasFileExtension, relativePath, findFileName } from '@stryke/path/file-path-fns';
42
42
  import { isAbsolutePath, isAbsolute } from '@stryke/path/is-type';
43
- import { joinPaths as joinPaths$1 } from '@stryke/path/join';
43
+ import { joinPaths } from '@stryke/path/join';
44
44
  import { isNull } from '@stryke/type-checks/is-null';
45
45
  import { isString } from '@stryke/type-checks/is-string';
46
46
  import { uuid } from '@stryke/unique-id/uuid';
47
47
  import { parseAsync } from 'oxc-parser';
48
48
  import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
49
49
  import { isFile } from '@stryke/fs/is-file';
50
- import { getLogFn, getLogLevel } from '@storm-software/config-tools/logger';
51
- import { getColor } from '@storm-software/config-tools/utilities/colors';
52
- import { noop } from '@stryke/helpers/noop';
53
- import '@stryke/fs/remove-file';
54
- import { hashDirectory } from '@stryke/hash/hash-files';
55
- import { kebabCase } from '@stryke/string-format/kebab-case';
56
- import { isUndefined } from '@stryke/type-checks/is-undefined';
57
- import { createJiti } from 'jiti';
50
+ import * as $ from '@stryke/capnp';
58
51
  import { bufferToString } from '@stryke/convert/buffer-to-string';
59
- import { isParentPath } from '@stryke/path/is-parent-path';
52
+ import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
60
53
  import { prettyBytes } from '@stryke/string-format/pretty-bytes';
61
54
  import { isBuffer } from '@stryke/type-checks/is-buffer';
62
- import { Volume } from 'memfs';
63
55
  import { Blob } from 'node:buffer';
64
56
  import fs from 'node:fs';
65
57
  import { resolveConfig, format } from 'prettier';
58
+ import { getLogFn, getLogLevel } from '@storm-software/config-tools/logger';
59
+ import { getColor } from '@storm-software/config-tools/utilities/colors';
60
+ import { noop } from '@stryke/helpers/noop';
61
+ import { isUndefined } from '@stryke/type-checks/is-undefined';
62
+ import { isParentPath } from '@stryke/path/is-parent-path';
63
+ import { Volume } from 'memfs/lib/node/volume';
66
64
  import { Union } from 'unionfs';
65
+ import '@stryke/fs/remove-file';
66
+ import { hashDirectory } from '@stryke/hash/hash-files';
67
+ import { kebabCase } from '@stryke/string-format/kebab-case';
68
+ import { createJiti } from 'jiti';
67
69
  import { isObject } from '@stryke/type-checks/is-object';
68
70
  import ts2, { createProgram, createCompilerHost, getPreEmitDiagnostics, getLineAndCharacterOfPosition, flattenDiagnosticMessageText } from 'typescript';
69
71
  import { getPackageName, hasPackageVersion, getPackageVersion } from '@stryke/string-format/package';
@@ -173,7 +175,7 @@ var moduleResolverBabelPlugin = /* @__PURE__ */ __name((context) => {
173
175
  }, "builder"));
174
176
  }, "moduleResolverBabelPlugin");
175
177
  async function loadWorkspaceConfig(workspaceRoot, cwd) {
176
- return defu4({
178
+ return defu3({
177
179
  workspaceRoot
178
180
  }, await getWorkspaceConfig(true, {
179
181
  cwd,
@@ -184,7 +186,7 @@ async function loadWorkspaceConfig(workspaceRoot, cwd) {
184
186
  __name(loadWorkspaceConfig, "loadWorkspaceConfig");
185
187
  async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile, framework = "powerlines") {
186
188
  let resolvedUserConfig = {};
187
- const resolvedUserConfigFile = configFile && existsSync(configFile) ? configFile : configFile && existsSync(joinPaths(projectRoot, configFile)) ? joinPaths(projectRoot, configFile) : existsSync(joinPaths(projectRoot, `${framework}.config.ts`)) ? joinPaths(projectRoot, `${framework}.config.ts`) : existsSync(joinPaths(projectRoot, `${framework}.config.js`)) ? joinPaths(projectRoot, `${framework}.config.js`) : existsSync(joinPaths(projectRoot, `${framework}.config.mts`)) ? joinPaths(projectRoot, `${framework}.config.mts`) : existsSync(joinPaths(projectRoot, `${framework}.config.mjs`)) ? joinPaths(projectRoot, `${framework}.config.mjs`) : void 0;
189
+ const resolvedUserConfigFile = configFile && existsSync(configFile) ? configFile : configFile && existsSync(joinPaths$1(projectRoot, configFile)) ? joinPaths$1(projectRoot, configFile) : existsSync(joinPaths$1(projectRoot, `${framework}.config.ts`)) ? joinPaths$1(projectRoot, `${framework}.config.ts`) : existsSync(joinPaths$1(projectRoot, `${framework}.config.js`)) ? joinPaths$1(projectRoot, `${framework}.config.js`) : existsSync(joinPaths$1(projectRoot, `${framework}.config.mts`)) ? joinPaths$1(projectRoot, `${framework}.config.mts`) : existsSync(joinPaths$1(projectRoot, `${framework}.config.mjs`)) ? joinPaths$1(projectRoot, `${framework}.config.mjs`) : void 0;
188
190
  if (resolvedUserConfigFile) {
189
191
  const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
190
192
  if (resolved) {
@@ -215,7 +217,7 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile,
215
217
  dotenv: true,
216
218
  jiti
217
219
  });
218
- return defu4(resolvedUserConfig, isSetObject(result?.config) ? {
220
+ return defu3(resolvedUserConfig, isSetObject(result?.config) ? {
219
221
  ...result.config,
220
222
  ...result
221
223
  } : {});
@@ -223,7 +225,7 @@ async function loadUserConfigFile(projectRoot, jiti, command, mode, configFile,
223
225
  __name(loadUserConfigFile, "loadUserConfigFile");
224
226
  var DEFAULT_ENVIRONMENT = "default";
225
227
  function createEnvironment(name, userConfig) {
226
- return defu4(userConfig.environments?.[name] ?? {}, {
228
+ return defu3(userConfig.environments?.[name] ?? {}, {
227
229
  name,
228
230
  title: userConfig.title || titleCase(userConfig.name),
229
231
  ssr: false,
@@ -266,8 +268,17 @@ function createDefaultEnvironment(userConfig) {
266
268
  return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
267
269
  }
268
270
  __name(createDefaultEnvironment, "createDefaultEnvironment");
271
+ function replacePathTokens(context, path) {
272
+ if (!path) {
273
+ return path;
274
+ }
275
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
276
+ }
277
+ __name(replacePathTokens, "replacePathTokens");
278
+
279
+ // src/lib/entry.ts
269
280
  function resolveEntryInputFile(context, typeDefinition) {
270
- return replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
281
+ return replacePath(typeDefinition.file, joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot));
271
282
  }
272
283
  __name(resolveEntryInputFile, "resolveEntryInputFile");
273
284
  function resolveEntryInput(context, typeDefinition) {
@@ -278,7 +289,7 @@ function resolveEntryInput(context, typeDefinition) {
278
289
  }
279
290
  __name(resolveEntryInput, "resolveEntryInput");
280
291
  function resolveEntryOutput(context, typeDefinition) {
281
- return replaceExtension(replacePath(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replacePath(context.config.sourceRoot, context.config.projectRoot)));
292
+ return replaceExtension(replacePath(replacePath(replacePath(replacePath(replacePath(typeDefinition.file, joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.sourceRoot)), joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot)), context.config.sourceRoot), context.config.projectRoot), replacePath(context.config.sourceRoot, context.config.projectRoot)));
282
293
  }
283
294
  __name(resolveEntryOutput, "resolveEntryOutput");
284
295
  function resolveEntry(context, typeDefinition) {
@@ -291,7 +302,7 @@ function resolveEntry(context, typeDefinition) {
291
302
  }
292
303
  __name(resolveEntry, "resolveEntry");
293
304
  function resolveEntriesSync(context, typeDefinitions) {
294
- return typeDefinitions.map((typeDefinition) => {
305
+ return typeDefinitions.map((entry) => isString(entry) ? replacePathTokens(context, entry) : replacePathTokens(context, entry.file)).map((typeDefinition) => {
295
306
  const parsed = parseTypeDefinition(typeDefinition);
296
307
  const filePath = appendPath(parsed.file, context.config.projectRoot);
297
308
  if (isFile(filePath)) {
@@ -313,6 +324,228 @@ function getUniqueEntries(entries = []) {
313
324
  }));
314
325
  }
315
326
  __name(getUniqueEntries, "getUniqueEntries");
327
+ var _capnpFileId = BigInt("0xa56c61324b9d6e49");
328
+ var FileMetadata_KeyValuePair = class extends $.Struct {
329
+ static {
330
+ __name(this, "FileMetadata_KeyValuePair");
331
+ }
332
+ static _capnp = {
333
+ displayName: "KeyValuePair",
334
+ id: "eabb26cf58b2a14c",
335
+ size: new $.ObjectSize(0, 2)
336
+ };
337
+ get key() {
338
+ return $.utils.getText(0, this);
339
+ }
340
+ set key(value) {
341
+ $.utils.setText(0, value, this);
342
+ }
343
+ get value() {
344
+ return $.utils.getText(1, this);
345
+ }
346
+ set value(value) {
347
+ $.utils.setText(1, value, this);
348
+ }
349
+ toString() {
350
+ return "FileMetadata_KeyValuePair_" + super.toString();
351
+ }
352
+ };
353
+ var FileMetadata = class _FileMetadata extends $.Struct {
354
+ static {
355
+ __name(this, "FileMetadata");
356
+ }
357
+ static KeyValuePair = FileMetadata_KeyValuePair;
358
+ static _capnp = {
359
+ displayName: "FileMetadata",
360
+ id: "8e2cab5d7e28c7b3",
361
+ size: new $.ObjectSize(0, 4),
362
+ defaultVariant: "normal"
363
+ };
364
+ static _Properties;
365
+ /**
366
+ * The variant of the file.
367
+ *
368
+ */
369
+ get id() {
370
+ return $.utils.getText(0, this);
371
+ }
372
+ set id(value) {
373
+ $.utils.setText(0, value, this);
374
+ }
375
+ /**
376
+ * The output mode of the file.
377
+ *
378
+ */
379
+ get variant() {
380
+ return $.utils.getText(1, this, _FileMetadata._capnp.defaultVariant);
381
+ }
382
+ set variant(value) {
383
+ $.utils.setText(1, value, this);
384
+ }
385
+ /**
386
+ * Additional metadata associated with the file.
387
+ *
388
+ */
389
+ get mode() {
390
+ return $.utils.getText(2, this);
391
+ }
392
+ set mode(value) {
393
+ $.utils.setText(2, value, this);
394
+ }
395
+ _adoptProperties(value) {
396
+ $.utils.adopt(value, $.utils.getPointer(3, this));
397
+ }
398
+ _disownProperties() {
399
+ return $.utils.disown(this.properties);
400
+ }
401
+ get properties() {
402
+ return $.utils.getList(3, _FileMetadata._Properties, this);
403
+ }
404
+ _hasProperties() {
405
+ return !$.utils.isNull($.utils.getPointer(3, this));
406
+ }
407
+ _initProperties(length) {
408
+ return $.utils.initList(3, _FileMetadata._Properties, length, this);
409
+ }
410
+ set properties(value) {
411
+ $.utils.copyFrom(value, $.utils.getPointer(3, this));
412
+ }
413
+ toString() {
414
+ return "FileMetadata_" + super.toString();
415
+ }
416
+ };
417
+ var FileIdentifier = class extends $.Struct {
418
+ static {
419
+ __name(this, "FileIdentifier");
420
+ }
421
+ static _capnp = {
422
+ displayName: "FileIdentifier",
423
+ id: "e12b8732389d7406",
424
+ size: new $.ObjectSize(0, 2)
425
+ };
426
+ /**
427
+ * An additional identifier for the file.
428
+ *
429
+ */
430
+ get path() {
431
+ return $.utils.getText(0, this);
432
+ }
433
+ set path(value) {
434
+ $.utils.setText(0, value, this);
435
+ }
436
+ get id() {
437
+ return $.utils.getText(1, this);
438
+ }
439
+ set id(value) {
440
+ $.utils.setText(1, value, this);
441
+ }
442
+ toString() {
443
+ return "FileIdentifier_" + super.toString();
444
+ }
445
+ };
446
+ var FileData = class extends $.Struct {
447
+ static {
448
+ __name(this, "FileData");
449
+ }
450
+ static _capnp = {
451
+ displayName: "FileData",
452
+ id: "fa6725c8a360f9a2",
453
+ size: new $.ObjectSize(0, 2)
454
+ };
455
+ /**
456
+ * The contents of the file.
457
+ *
458
+ */
459
+ get path() {
460
+ return $.utils.getText(0, this);
461
+ }
462
+ set path(value) {
463
+ $.utils.setText(0, value, this);
464
+ }
465
+ get content() {
466
+ return $.utils.getText(1, this);
467
+ }
468
+ set content(value) {
469
+ $.utils.setText(1, value, this);
470
+ }
471
+ toString() {
472
+ return "FileData_" + super.toString();
473
+ }
474
+ };
475
+ var FileSystemData = class _FileSystemData extends $.Struct {
476
+ static {
477
+ __name(this, "FileSystemData");
478
+ }
479
+ static _capnp = {
480
+ displayName: "FileSystemData",
481
+ id: "aaa72a672ac0732f",
482
+ size: new $.ObjectSize(0, 3)
483
+ };
484
+ static _Ids;
485
+ static _Metadata;
486
+ static _Files;
487
+ _adoptIds(value) {
488
+ $.utils.adopt(value, $.utils.getPointer(0, this));
489
+ }
490
+ _disownIds() {
491
+ return $.utils.disown(this.ids);
492
+ }
493
+ get ids() {
494
+ return $.utils.getList(0, _FileSystemData._Ids, this);
495
+ }
496
+ _hasIds() {
497
+ return !$.utils.isNull($.utils.getPointer(0, this));
498
+ }
499
+ _initIds(length) {
500
+ return $.utils.initList(0, _FileSystemData._Ids, length, this);
501
+ }
502
+ set ids(value) {
503
+ $.utils.copyFrom(value, $.utils.getPointer(0, this));
504
+ }
505
+ _adoptMetadata(value) {
506
+ $.utils.adopt(value, $.utils.getPointer(1, this));
507
+ }
508
+ _disownMetadata() {
509
+ return $.utils.disown(this.metadata);
510
+ }
511
+ get metadata() {
512
+ return $.utils.getList(1, _FileSystemData._Metadata, this);
513
+ }
514
+ _hasMetadata() {
515
+ return !$.utils.isNull($.utils.getPointer(1, this));
516
+ }
517
+ _initMetadata(length) {
518
+ return $.utils.initList(1, _FileSystemData._Metadata, length, this);
519
+ }
520
+ set metadata(value) {
521
+ $.utils.copyFrom(value, $.utils.getPointer(1, this));
522
+ }
523
+ _adoptFiles(value) {
524
+ $.utils.adopt(value, $.utils.getPointer(2, this));
525
+ }
526
+ _disownFiles() {
527
+ return $.utils.disown(this.files);
528
+ }
529
+ get files() {
530
+ return $.utils.getList(2, _FileSystemData._Files, this);
531
+ }
532
+ _hasFiles() {
533
+ return !$.utils.isNull($.utils.getPointer(2, this));
534
+ }
535
+ _initFiles(length) {
536
+ return $.utils.initList(2, _FileSystemData._Files, length, this);
537
+ }
538
+ set files(value) {
539
+ $.utils.copyFrom(value, $.utils.getPointer(2, this));
540
+ }
541
+ toString() {
542
+ return "FileSystemData_" + super.toString();
543
+ }
544
+ };
545
+ FileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);
546
+ FileSystemData._Ids = $.CompositeList(FileIdentifier);
547
+ FileSystemData._Metadata = $.CompositeList(FileMetadata);
548
+ FileSystemData._Files = $.CompositeList(FileData);
316
549
  var createLog = /* @__PURE__ */ __name((name, options = {}) => {
317
550
  const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
318
551
  if (logLevel === LogLevelLabel.SILENT) {
@@ -351,112 +584,6 @@ var BADGE_COLORS = [
351
584
  var extendLog = /* @__PURE__ */ __name((logFn, name) => {
352
585
  return (type, ...args) => logFn(type, ` ${chalk5.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name)} `)} ${args.join(" ")} `);
353
586
  }, "extendLog");
354
- var PROJECT_ROOT_HASH_LENGTH = 45;
355
- var CACHE_HASH_LENGTH = 62;
356
- function getPrefixedProjectRootHash(name, projectRootHash) {
357
- const combined = `${kebabCase(name)}_${projectRootHash}`;
358
- return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
359
- }
360
- __name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
361
- async function getChecksum(path) {
362
- return hashDirectory(path, {
363
- ignore: [
364
- "node_modules",
365
- ".git",
366
- ".nx",
367
- ".cache",
368
- ".storm",
369
- "tmp",
370
- "dist"
371
- ]
372
- });
373
- }
374
- __name(getChecksum, "getChecksum");
375
- async function writeMetaFile(context) {
376
- const metaFilePath = joinPaths(context.dataPath, "meta.json");
377
- context.log(LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
378
- await context.fs.writeFile(metaFilePath, JSON.stringify({
379
- ...context.meta,
380
- virtualFiles: context.fs[__VFS_VIRTUAL__].toJSON(context.artifactsPath),
381
- virtualFilesMeta: context.fs.getPartialMeta()
382
- }, null, 2), {
383
- mode: "fs"
384
- });
385
- }
386
- __name(writeMetaFile, "writeMetaFile");
387
- function isPlugin(value) {
388
- return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && (isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined(value[command]) || command in value && (isFunction(value[command]) || isSetObject(value[command]) && "handler" in value[command] && isFunction(value[command].handler)));
389
- }
390
- __name(isPlugin, "isPlugin");
391
- function isPluginConfigObject(value) {
392
- return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
393
- }
394
- __name(isPluginConfigObject, "isPluginConfigObject");
395
- function isPluginConfigTuple(value) {
396
- return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
397
- }
398
- __name(isPluginConfigTuple, "isPluginConfigTuple");
399
- function isPluginConfig(value) {
400
- return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
401
- }
402
- __name(isPluginConfig, "isPluginConfig");
403
- function isPluginHookFunction(value) {
404
- return isFunction(value) || isSetObject(value) && "handler" in value && isFunction(value.handler);
405
- }
406
- __name(isPluginHookFunction, "isPluginHookFunction");
407
- function isPluginHookObject(value) {
408
- return isSetObject(value) && "handler" in value && isFunction(value.handler);
409
- }
410
- __name(isPluginHookObject, "isPluginHookObject");
411
- function isPluginHook(value) {
412
- return isPluginHookFunction(value) || isPluginHookObject(value);
413
- }
414
- __name(isPluginHook, "isPluginHook");
415
- function getHookHandler(pluginHook) {
416
- return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
417
- }
418
- __name(getHookHandler, "getHookHandler");
419
- function isHookExternal(hook) {
420
- return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
421
- }
422
- __name(isHookExternal, "isHookExternal");
423
- function checkDedupe(plugin, plugins) {
424
- return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
425
- }
426
- __name(checkDedupe, "checkDedupe");
427
- function addPluginHook(context, plugin, pluginHook, hooksList) {
428
- if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
429
- hooksList.push(isFunction(pluginHook) ? {
430
- plugin,
431
- handler: getHookHandler(pluginHook).bind(context)
432
- } : {
433
- plugin,
434
- ...pluginHook,
435
- handler: getHookHandler(pluginHook).bind(context)
436
- });
437
- }
438
- }
439
- __name(addPluginHook, "addPluginHook");
440
- function resolveOptions(options) {
441
- return defu4(options, {
442
- interopDefault: true,
443
- fsCache: options.mode !== "development" ? joinPaths(options.cacheDir, "jiti") : false,
444
- moduleCache: options.mode !== "development"
445
- });
446
- }
447
- __name(resolveOptions, "resolveOptions");
448
- function createPluginResolver(options) {
449
- return createJiti(joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
450
- ...options
451
- }));
452
- }
453
- __name(createPluginResolver, "createPluginResolver");
454
- function createResolver(options) {
455
- const baseResolver = createJiti(joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
456
- baseResolver.plugin = createPluginResolver(options);
457
- return baseResolver;
458
- }
459
- __name(createResolver, "createResolver");
460
587
  function isBufferEncoding(options) {
461
588
  return isSetString(options) || options === null;
462
589
  }
@@ -605,46 +732,201 @@ function patchFS(originalFS, vfs) {
605
732
  };
606
733
  }
607
734
  __name(patchFS, "patchFS");
608
- var VirtualFileSystem = class {
735
+ var UnifiedFS = class _UnifiedFS extends Union {
609
736
  static {
610
- __name(this, "VirtualFileSystem");
737
+ __name(this, "UnifiedFS");
611
738
  }
612
739
  /**
613
740
  * The internal map of virtual files.
614
741
  */
615
- #meta = {};
742
+ #virtualFS = new Volume();
616
743
  /**
617
- * A map of unique identifiers to their virtual file paths.
744
+ * The physical file system.
618
745
  */
619
- #ids = {};
746
+ #physicalFS = cloneFS(fs);
620
747
  /**
621
- * A map of virtual file paths to their underlying file content.
748
+ * The context of the unified file system.
622
749
  */
623
- #cachedFS = /* @__PURE__ */ new Map();
750
+ #context;
751
+ static create(context, data) {
752
+ let result = new _UnifiedFS(context, data);
753
+ result = result.use(result.#physicalFS);
754
+ if (result.#context.config.output.mode !== "fs") {
755
+ result = result.use(result.#virtualFS);
756
+ }
757
+ return result;
758
+ }
624
759
  /**
625
- * A map of virtual file paths to their underlying file content.
760
+ * Gets the virtual file system (VFS).
626
761
  */
627
- #cachedResolver = /* @__PURE__ */ new Map();
762
+ get virtual() {
763
+ return this.#virtualFS;
764
+ }
628
765
  /**
629
- * The internal map of virtual files.
766
+ * Gets the physical file system (FS).
630
767
  */
631
- #virtualFS = new Volume();
768
+ get physical() {
769
+ return this.#physicalFS;
770
+ }
632
771
  /**
633
- * The physical file system.
772
+ * Creates a new instance of the VirtualFileSystem.
773
+ *
774
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
775
+ * @param data - A buffer containing the serialized virtual file system data.
634
776
  */
635
- #fs = cloneFS(fs);
777
+ constructor(context, data) {
778
+ super();
779
+ this.#context = context;
780
+ if (!this.#physicalFS.existsSync(this.#context.dataPath)) {
781
+ this.#physicalFS.mkdirSync(this.#context.dataPath, {
782
+ recursive: true
783
+ });
784
+ }
785
+ if (!this.#physicalFS.existsSync(this.#context.cachePath)) {
786
+ this.#physicalFS.mkdirSync(this.#context.cachePath, {
787
+ recursive: true
788
+ });
789
+ }
790
+ if (!this.#physicalFS.existsSync(joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
791
+ this.#physicalFS.mkdirSync(joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
792
+ recursive: true
793
+ });
794
+ }
795
+ if (this.#context.config.output.mode !== "fs") {
796
+ this.#virtualFS = Volume.fromJSON(data._hasFiles() && data.files.length > 0 ? data.files.values().reduce((ret, file) => {
797
+ ret[file.path] = file.content;
798
+ return ret;
799
+ }, {}) : {});
800
+ if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
801
+ this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
802
+ recursive: true
803
+ });
804
+ }
805
+ if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
806
+ this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
807
+ recursive: true
808
+ });
809
+ }
810
+ if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
811
+ this.#virtualFS.mkdirSync(this.#context.entryPath, {
812
+ recursive: true
813
+ });
814
+ }
815
+ if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
816
+ this.#virtualFS.mkdirSync(this.#context.dtsPath, {
817
+ recursive: true
818
+ });
819
+ }
820
+ } else if (this.#context.config.projectType === "application") {
821
+ if (!this.#physicalFS.existsSync(this.#context.artifactsPath)) {
822
+ this.#physicalFS.mkdirSync(this.#context.artifactsPath, {
823
+ recursive: true
824
+ });
825
+ }
826
+ if (!this.#physicalFS.existsSync(this.#context.builtinsPath)) {
827
+ this.#physicalFS.mkdirSync(this.#context.builtinsPath, {
828
+ recursive: true
829
+ });
830
+ }
831
+ if (!this.#physicalFS.existsSync(this.#context.entryPath)) {
832
+ this.#physicalFS.mkdirSync(this.#context.entryPath, {
833
+ recursive: true
834
+ });
835
+ }
836
+ if (!this.#physicalFS.existsSync(this.#context.dtsPath)) {
837
+ this.#physicalFS.mkdirSync(this.#context.dtsPath, {
838
+ recursive: true
839
+ });
840
+ }
841
+ }
842
+ }
843
+ /**
844
+ * Select the file system module to use for the operation based on the path or URL.
845
+ *
846
+ * @param pathOrUrl - The path to perform the file system operation on.
847
+ * @param options - Options for the operation, such as output mode.
848
+ * @returns The file system module used for the operation.
849
+ */
850
+ resolveFS(pathOrUrl, options = {}) {
851
+ const mode = this.resolveMode(pathOrUrl, options);
852
+ if (mode === "virtual") {
853
+ return {
854
+ ...this.#virtualFS,
855
+ mode: "virtual"
856
+ };
857
+ } else if (mode === "fs") {
858
+ return {
859
+ ...this.#physicalFS,
860
+ mode: "fs"
861
+ };
862
+ }
863
+ return {
864
+ ...this,
865
+ mode: this.#context.config.output.mode
866
+ };
867
+ }
868
+ /**
869
+ * Select the file system module to use for the operation based on the path or URL.
870
+ *
871
+ * @param pathOrUrl - The path to perform the file system operation on.
872
+ * @param options - Options for the operation, such as output mode.
873
+ * @returns The file system module used for the operation.
874
+ */
875
+ resolveMode(pathOrUrl, options = {}) {
876
+ if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
877
+ return "virtual";
878
+ } else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath(toFilePath(pathOrUrl), joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
879
+ return "fs";
880
+ }
881
+ return void 0;
882
+ }
883
+ /**
884
+ * Serializes the virtual file system (VFS) to a JSON object.
885
+ *
886
+ * @returns A JSON representation of the virtual file system.
887
+ */
888
+ toJSON() {
889
+ return this.#virtualFS.toJSON();
890
+ }
891
+ };
892
+
893
+ // src/lib/fs/vfs.ts
894
+ var VirtualFileSystem = class _VirtualFileSystem {
895
+ static {
896
+ __name(this, "VirtualFileSystem");
897
+ }
898
+ /**
899
+ * A map of virtual file IDs to their associated metadata.
900
+ */
901
+ #metadata;
902
+ /**
903
+ * A map of virtual file IDs to their underlying file paths.
904
+ */
905
+ #ids;
906
+ /**
907
+ * A map of underlying file paths to their virtual file IDs.
908
+ */
909
+ #paths;
910
+ /**
911
+ * A map of virtual file paths to their underlying file content.
912
+ */
913
+ #cachedResolver = /* @__PURE__ */ new Map();
636
914
  /**
637
915
  * The unified volume that combines the virtual file system with the real file system.
638
916
  *
639
917
  * @remarks
640
918
  * This volume allows for seamless access to both virtual and real files.
641
919
  */
642
- #unifiedFS = new Union();
920
+ #unifiedFS;
643
921
  /**
644
922
  * Indicator specifying if the file system module is patched
645
923
  */
646
924
  #isPatched = false;
647
925
  /**
926
+ * Indicator specifying if the virtual file system (VFS) is disposed
927
+ */
928
+ #isDisposed = false;
929
+ /**
648
930
  * Function to revert require patch
649
931
  */
650
932
  #revert;
@@ -664,60 +946,224 @@ var VirtualFileSystem = class {
664
946
  */
665
947
  #existsSync(path) {
666
948
  const formattedPath = this.formatPath(path);
667
- return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
949
+ return this.#unifiedFS.virtual.existsSync(formattedPath) || this.#unifiedFS.physical.existsSync(formattedPath) || this.#unifiedFS.resolveFS(path).existsSync(formattedPath);
950
+ }
951
+ /**
952
+ * Builds a regular expression from a string pattern for path matching.
953
+ *
954
+ * @param strPattern - The string pattern to convert.
955
+ * @returns A regular expression for matching paths.
956
+ */
957
+ #buildRegex(strPattern) {
958
+ const token = "::GLOBSTAR::";
959
+ return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
668
960
  }
669
961
  /**
670
- * Exposes the internal VFS map for advanced usage.
962
+ * Formats a file id by removing the file extension and prepending the runtime prefix.
963
+ *
964
+ * @param id - The file ID to format.
965
+ * @returns The formatted file ID.
671
966
  */
672
- get [__VFS_CACHE__]() {
673
- return this.#cachedFS;
967
+ #formatId(id) {
968
+ const formattedId = toFilePath(id);
969
+ return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(findFileDotExtensionSafe(formattedId), "")}`;
674
970
  }
675
971
  /**
676
- * Exposes the internal VFS resolver cache for advanced usage.
972
+ * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
973
+ *
974
+ * @param id - The id to resolve.
975
+ * @returns The resolved file id if it exists, otherwise undefined.
677
976
  */
678
- get [__VFS_RESOLVER__]() {
679
- return this.#cachedResolver;
977
+ #resolveId(id) {
978
+ if (this.#ids[this.#formatId(id)]) {
979
+ return this.#ids[this.#formatId(id)] || false;
980
+ }
981
+ return false;
680
982
  }
681
983
  /**
682
- * Exposes the internal VFS map for advanced usage.
984
+ * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
985
+ *
986
+ * @param path - The path to resolve.
987
+ * @param options - Optional parameters for resolving the path.
988
+ * @returns The resolved file path if it exists, otherwise undefined.
683
989
  */
684
- get [__VFS_VIRTUAL__]() {
685
- return this.#virtualFS;
990
+ #resolvePath(path, options = {}) {
991
+ if (isAbsolutePath(path)) {
992
+ if (this.#existsSync(path)) {
993
+ return path;
994
+ }
995
+ const result = this.#checkVariants(path);
996
+ if (result) {
997
+ return result;
998
+ }
999
+ }
1000
+ for (const parentPath of this.#resolveParentPaths(path, options.paths)) {
1001
+ const request = joinPaths$1(parentPath, path);
1002
+ if (this.#existsSync(request)) {
1003
+ return request;
1004
+ }
1005
+ const result = this.#checkVariants(request);
1006
+ if (result) {
1007
+ return result;
1008
+ }
1009
+ }
1010
+ return false;
1011
+ }
1012
+ /**
1013
+ * Resolves parent paths for a given request.
1014
+ *
1015
+ * @param request - The request path to resolve parent paths for.
1016
+ * @param parents - An optional array of parent paths to consider.
1017
+ * @returns An array of resolved parent paths.
1018
+ */
1019
+ #resolveParentPaths(request, parents = []) {
1020
+ let paths = [
1021
+ this.#context.workspaceConfig.workspaceRoot,
1022
+ joinPaths$1(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
1023
+ ];
1024
+ if (this.#context.tsconfig.options.paths) {
1025
+ 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) => {
1026
+ if (path && !ret.includes(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, path))) {
1027
+ ret.push(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, path));
1028
+ }
1029
+ return ret;
1030
+ }, paths) : paths;
1031
+ }
1032
+ return paths.reduce((ret, path) => {
1033
+ if (!ret.includes(path)) {
1034
+ ret.push(path);
1035
+ }
1036
+ return ret;
1037
+ }, parents.filter(Boolean).map((p) => this.formatPath(p)));
686
1038
  }
687
1039
  /**
688
- * Exposes the internal UFS map for advanced usage.
1040
+ * Clears the resolver cache for a given path.
1041
+ *
1042
+ * @param path - The path to clear the resolver cache for.
1043
+ */
1044
+ #clearResolverCache(path) {
1045
+ this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1046
+ }
1047
+ /**
1048
+ * Check if the file exists with different variants (index, extensions).
1049
+ *
1050
+ * @param request - The request path to check.
1051
+ * @param parentPath - An optional parent path to prepend to the request.
1052
+ * @returns The file path if it exists, otherwise false.
1053
+ */
1054
+ #checkVariants(request, parentPath) {
1055
+ const path = parentPath ? joinPaths$1(parentPath, request) : request;
1056
+ let file = this.#checkExtensions(path);
1057
+ if (file) {
1058
+ return file;
1059
+ }
1060
+ file = this.#checkIndex(path);
1061
+ if (file) {
1062
+ return file;
1063
+ }
1064
+ return false;
1065
+ }
1066
+ /**
1067
+ * Check if the index file exists in the given request path.
1068
+ *
1069
+ * @param request - The request path to check.
1070
+ * @returns The index file path if it exists, otherwise false.
1071
+ */
1072
+ #checkIndex(request) {
1073
+ let file = joinPaths$1(request, "index");
1074
+ if (this.#existsSync(file)) {
1075
+ return file;
1076
+ }
1077
+ file = this.#checkExtensions(file);
1078
+ if (file) {
1079
+ return file;
1080
+ }
1081
+ return false;
1082
+ }
1083
+ /**
1084
+ * Check if the file exists with different extensions.
1085
+ *
1086
+ * @param request - The request path to check.
1087
+ * @returns The file path if it exists with any of the checked extensions, otherwise false.
1088
+ */
1089
+ #checkExtensions(request) {
1090
+ let file = `${request}.ts`;
1091
+ if (this.#existsSync(file)) {
1092
+ return file;
1093
+ }
1094
+ file = `${request}.mts`;
1095
+ if (this.#existsSync(file)) {
1096
+ return file;
1097
+ }
1098
+ file = `${request}.cts`;
1099
+ if (this.#existsSync(file)) {
1100
+ return file;
1101
+ }
1102
+ file = `${request}.tsx`;
1103
+ if (this.#existsSync(file)) {
1104
+ return file;
1105
+ }
1106
+ file = `${request}.js`;
1107
+ if (this.#existsSync(file)) {
1108
+ return file;
1109
+ }
1110
+ file = `${request}.mjs`;
1111
+ if (this.#existsSync(file)) {
1112
+ return file;
1113
+ }
1114
+ file = `${request}.cjs`;
1115
+ if (this.#existsSync(file)) {
1116
+ return file;
1117
+ }
1118
+ file = `${request}.jsx`;
1119
+ if (this.#existsSync(file)) {
1120
+ return file;
1121
+ }
1122
+ file = `${request}.json`;
1123
+ if (this.#existsSync(file)) {
1124
+ return file;
1125
+ }
1126
+ file = `${request}.d.ts`;
1127
+ if (this.#existsSync(file)) {
1128
+ return file;
1129
+ }
1130
+ return false;
1131
+ }
1132
+ /**
1133
+ * Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1134
+ *
1135
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
1136
+ * @returns A promise that resolves to a new virtual file system instance.
1137
+ */
1138
+ static async create(context) {
1139
+ if (!context.config.skipCache && existsSync(joinPaths$1(context.cachePath, "fs.bin"))) {
1140
+ const buffer = await readFileBuffer(joinPaths$1(context.cachePath, "fs.bin"));
1141
+ const message2 = new $.Message(buffer, false);
1142
+ return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
1143
+ }
1144
+ const message = new $.Message();
1145
+ return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
1146
+ }
1147
+ /**
1148
+ * Synchronously creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
1149
+ *
1150
+ * @param context - The context of the virtual file system, typically containing options and logging functions.
1151
+ * @returns A new virtual file system instance.
689
1152
  */
690
- get [__VFS_UNIFIED__]() {
691
- return this.#unifiedFS;
1153
+ static createSync(context) {
1154
+ if (!context.config.skipCache && existsSync(joinPaths$1(context.cachePath, "fs.bin"))) {
1155
+ const buffer = readFileBufferSync(joinPaths$1(context.cachePath, "fs.bin"));
1156
+ const message2 = new $.Message(buffer, false);
1157
+ return new _VirtualFileSystem(context, message2.getRoot(FileSystemData));
1158
+ }
1159
+ const message = new $.Message();
1160
+ return new _VirtualFileSystem(context, message.initRoot(FileSystemData));
692
1161
  }
693
1162
  /**
694
- * A proxy to access the underlying file metadata.
1163
+ * A map of file ids to their metadata.
695
1164
  */
696
- get meta() {
697
- return new Proxy(this.#meta, {
698
- get: /* @__PURE__ */ __name((target, prop) => {
699
- if (target[prop]) {
700
- return {
701
- id: prop,
702
- mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
703
- details: {},
704
- variant: "normal",
705
- ...target[prop]
706
- };
707
- }
708
- return void 0;
709
- }, "get"),
710
- set: /* @__PURE__ */ __name((target, prop, value) => {
711
- target[prop] = value;
712
- this.#ids[value.id || prop] = prop;
713
- return true;
714
- }, "set"),
715
- deleteProperty: /* @__PURE__ */ __name((target, prop) => {
716
- delete this.#ids[target[prop]?.id || prop];
717
- delete target[prop];
718
- return true;
719
- }, "deleteProperty")
720
- });
1165
+ get metadata() {
1166
+ return this.#metadata;
721
1167
  }
722
1168
  /**
723
1169
  * A map of module ids to their file paths.
@@ -726,98 +1172,49 @@ var VirtualFileSystem = class {
726
1172
  return this.#ids;
727
1173
  }
728
1174
  /**
729
- * Creates a new instance of the VirtualFileSystem.
1175
+ * A map of virtual file paths to their IDs.
1176
+ */
1177
+ get paths() {
1178
+ return this.#paths;
1179
+ }
1180
+ /**
1181
+ * Creates a new instance of the {@link VirtualFileSystem}.
730
1182
  *
731
1183
  * @param context - The context of the virtual file system, typically containing options and logging functions.
732
- * @param serialized - A map of files/file contents to populate in cache
1184
+ * @param data - A buffer containing the serialized virtual file system data.
733
1185
  */
734
- constructor(context, serialized = {}) {
1186
+ constructor(context, data) {
735
1187
  this.#context = context;
736
- this.#cachedFS = /* @__PURE__ */ new Map();
737
- this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
738
- this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
739
- data.id || path,
740
- path
741
- ]));
742
- if (!this.#fs.existsSync(this.#context.dataPath)) {
743
- this.#fs.mkdirSync(this.#context.dataPath, {
744
- recursive: true
745
- });
746
- }
747
- if (!this.#fs.existsSync(this.#context.cachePath)) {
748
- this.#fs.mkdirSync(this.#context.cachePath, {
749
- recursive: true
750
- });
751
- }
752
- if (!this.#fs.existsSync(joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
753
- this.#fs.mkdirSync(joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
754
- recursive: true
755
- });
756
- }
757
- this.#unifiedFS = this.#unifiedFS.use(this.#fs);
758
- if (this.#context.config.output.mode !== "fs") {
759
- if (serialized?.virtualFiles && Object.keys(serialized.virtualFiles).length > 0) {
760
- this.#virtualFS = Volume.fromJSON(serialized.virtualFiles);
761
- }
762
- if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
763
- this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
764
- recursive: true
765
- });
766
- }
767
- if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
768
- this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
769
- recursive: true
770
- });
771
- }
772
- if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
773
- this.#virtualFS.mkdirSync(this.#context.entryPath, {
774
- recursive: true
775
- });
776
- }
777
- if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
778
- this.#virtualFS.mkdirSync(this.#context.dtsPath, {
779
- recursive: true
780
- });
781
- }
782
- this.#unifiedFS = this.#unifiedFS.use(this.#virtualFS);
783
- } else if (this.#context.config.projectType === "application") {
784
- if (!this.#fs.existsSync(this.#context.artifactsPath)) {
785
- this.#fs.mkdirSync(this.#context.artifactsPath, {
786
- recursive: true
787
- });
788
- }
789
- if (!this.#fs.existsSync(this.#context.builtinsPath)) {
790
- this.#fs.mkdirSync(this.#context.builtinsPath, {
791
- recursive: true
792
- });
793
- }
794
- if (!this.#fs.existsSync(this.#context.entryPath)) {
795
- this.#fs.mkdirSync(this.#context.entryPath, {
796
- recursive: true
797
- });
798
- }
799
- if (!this.#fs.existsSync(this.#context.dtsPath)) {
800
- this.#fs.mkdirSync(this.#context.dtsPath, {
801
- recursive: true
802
- });
803
- }
804
- }
805
- this.#log = extendLog(this.#context.log, "virtual-file-system");
806
- }
807
- [__VFS_INIT__]() {
808
- if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
809
- this.#revert = patchFS(fs, this);
810
- this.#isPatched = true;
811
- }
812
- }
813
- [__VFS_REVERT__]() {
814
- if (this.#isPatched && this.#context.config.output.mode !== "fs") {
815
- if (!this.#revert) {
816
- throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
817
- }
818
- this.#revert?.();
819
- this.#isPatched = false;
1188
+ this.#unifiedFS = UnifiedFS.create(context, data);
1189
+ this.#metadata = {};
1190
+ if (data._hasMetadata()) {
1191
+ this.#metadata = data.metadata.values().reduce((ret, data2) => {
1192
+ ret[data2.id] = {
1193
+ id: data2.id,
1194
+ variant: data2.variant,
1195
+ mode: data2.mode,
1196
+ properties: data2._hasProperties() ? data2.properties.values().reduce((ret2, item) => {
1197
+ ret2[item.key] = item.value;
1198
+ return ret2;
1199
+ }, {}) : {}
1200
+ };
1201
+ return ret;
1202
+ }, {});
1203
+ }
1204
+ this.#ids = {};
1205
+ this.#paths = {};
1206
+ if (data._hasIds()) {
1207
+ this.#ids = data.ids.values().reduce((ret, data2) => {
1208
+ ret[data2.id] ??= data2.path;
1209
+ ret[data2.path] ??= data2.path;
1210
+ return ret;
1211
+ }, {});
1212
+ this.#paths = data.ids.values().reduce((ret, data2) => {
1213
+ ret[data2.path] ??= data2.id;
1214
+ return ret;
1215
+ }, {});
820
1216
  }
1217
+ this.#log = extendLog(this.#context.log, "file-system");
821
1218
  }
822
1219
  /**
823
1220
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
@@ -837,7 +1234,7 @@ var VirtualFileSystem = class {
837
1234
  if (!resolvedPath) {
838
1235
  return false;
839
1236
  }
840
- return this.meta[resolvedPath]?.mode === "virtual";
1237
+ return this.metadata[resolvedPath]?.mode === "virtual";
841
1238
  }
842
1239
  /**
843
1240
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
@@ -846,7 +1243,7 @@ var VirtualFileSystem = class {
846
1243
  * @param options - Optional parameters for resolving the path.
847
1244
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
848
1245
  */
849
- isFs(pathOrId, options = {}) {
1246
+ isPhysical(pathOrId, options = {}) {
850
1247
  if (!pathOrId) {
851
1248
  return false;
852
1249
  }
@@ -857,18 +1254,7 @@ var VirtualFileSystem = class {
857
1254
  if (!resolvedPath) {
858
1255
  return false;
859
1256
  }
860
- return this.meta[resolvedPath]?.mode === "fs";
861
- }
862
- /**
863
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
864
- *
865
- * @see https://www.typescriptlang.org/tsconfig#paths
866
- *
867
- * @param pathOrId - The path or ID to check.
868
- * @returns Whether the path or ID corresponds to a virtual file.
869
- */
870
- isTsconfigPath(pathOrId) {
871
- return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
1257
+ return this.metadata[resolvedPath]?.mode === "fs";
872
1258
  }
873
1259
  /**
874
1260
  * Lists files in a given path.
@@ -878,7 +1264,7 @@ var VirtualFileSystem = class {
878
1264
  * @returns An array of file names in the specified path.
879
1265
  */
880
1266
  readdirSync(path, options = "utf8") {
881
- return this.resolveFS(path).readdirSync(toFilePath(path), options);
1267
+ return this.#unifiedFS.resolveFS(path).readdirSync(toFilePath(path), options);
882
1268
  }
883
1269
  /**
884
1270
  * Removes a file in the virtual file system (VFS).
@@ -891,9 +1277,11 @@ var VirtualFileSystem = class {
891
1277
  return;
892
1278
  }
893
1279
  this.#log(LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
894
- this.resolveFS(path, options).unlinkSync(formattedPath);
895
- this.#cachedFS.delete(formattedPath);
896
- this.clearResolverCache(formattedPath);
1280
+ this.#unifiedFS.resolveFS(path, options).unlinkSync(formattedPath);
1281
+ if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
1282
+ delete this.metadata[this.paths[formattedPath]];
1283
+ }
1284
+ this.#clearResolverCache(formattedPath);
897
1285
  }
898
1286
  /**
899
1287
  * Removes a file in the virtual file system (VFS).
@@ -906,10 +1294,12 @@ var VirtualFileSystem = class {
906
1294
  return;
907
1295
  }
908
1296
  this.#log(LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
909
- if (isFunction(this.resolveFS(path, options).promises.unlink)) {
910
- await this.resolveFS(path, options).promises.unlink(formattedPath);
911
- this.#cachedFS.delete(formattedPath);
912
- this.clearResolverCache(formattedPath);
1297
+ if (isFunction(this.#unifiedFS.resolveFS(path, options).promises.unlink)) {
1298
+ await this.#unifiedFS.resolveFS(path, options).promises.unlink(formattedPath);
1299
+ if (this.paths[formattedPath] && this.metadata[this.paths[formattedPath]]) {
1300
+ delete this.metadata[this.paths[formattedPath]];
1301
+ }
1302
+ this.#clearResolverCache(formattedPath);
913
1303
  } else {
914
1304
  this.unlinkSync(formattedPath, options);
915
1305
  }
@@ -926,11 +1316,10 @@ var VirtualFileSystem = class {
926
1316
  return;
927
1317
  }
928
1318
  this.#log(LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
929
- this.resolveFS(path, options).rmdirSync(formattedPath, defu4(options, {
1319
+ this.#unifiedFS.resolveFS(path, options).rmdirSync(formattedPath, defu3(options, {
930
1320
  recursive: true
931
1321
  }));
932
- this.#cachedFS.delete(formattedPath);
933
- this.clearResolverCache(formattedPath);
1322
+ this.#clearResolverCache(formattedPath);
934
1323
  }
935
1324
  /**
936
1325
  * Removes a directory in the virtual file system (VFS).
@@ -945,15 +1334,14 @@ var VirtualFileSystem = class {
945
1334
  return;
946
1335
  }
947
1336
  this.#log(LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
948
- if (isFunction(this.resolveFS(path, options).promises.rm)) {
949
- await this.resolveFS(path, options).promises.rm(formattedPath, defu4(options, {
1337
+ if (isFunction(this.#unifiedFS.resolveFS(path, options).promises.rm)) {
1338
+ await this.#unifiedFS.resolveFS(path, options).promises.rm(formattedPath, defu3(options, {
950
1339
  force: true,
951
1340
  recursive: true
952
1341
  }));
953
- this.#cachedFS.delete(formattedPath);
954
- this.clearResolverCache(formattedPath);
1342
+ this.#clearResolverCache(formattedPath);
955
1343
  } else {
956
- this.rmdirSync(formattedPath, defu4(options ?? {}, {
1344
+ this.rmdirSync(formattedPath, defu3(options ?? {}, {
957
1345
  force: true,
958
1346
  recursive: true
959
1347
  }));
@@ -995,8 +1383,8 @@ var VirtualFileSystem = class {
995
1383
  */
996
1384
  mkdirSync(path, options = {}) {
997
1385
  const filePath = toFilePath(path);
998
- this.clearResolverCache(filePath);
999
- return this.resolveFS(filePath, options).mkdirSync(filePath, defu4(options ?? {}, {
1386
+ this.#clearResolverCache(filePath);
1387
+ return this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu3(options ?? {}, {
1000
1388
  recursive: true
1001
1389
  }));
1002
1390
  }
@@ -1010,16 +1398,16 @@ var VirtualFileSystem = class {
1010
1398
  async mkdir(path, options = {}) {
1011
1399
  let result;
1012
1400
  const filePath = toFilePath(path);
1013
- if (isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
1014
- result = await this.resolveFS(filePath, options).promises.mkdir(filePath, defu4(options ?? {}, {
1401
+ if (isFunction(this.#unifiedFS.resolveFS(filePath, options).promises.mkdir)) {
1402
+ result = await this.#unifiedFS.resolveFS(filePath, options).promises.mkdir(filePath, defu3(options ?? {}, {
1015
1403
  recursive: true
1016
1404
  }));
1017
1405
  } else {
1018
- result = this.resolveFS(filePath, options).mkdirSync(filePath, defu4(options ?? {}, {
1406
+ result = this.#unifiedFS.resolveFS(filePath, options).mkdirSync(filePath, defu3(options ?? {}, {
1019
1407
  recursive: true
1020
1408
  }));
1021
1409
  }
1022
- this.clearResolverCache(filePath);
1410
+ this.#clearResolverCache(filePath);
1023
1411
  return result;
1024
1412
  }
1025
1413
  /**
@@ -1041,7 +1429,7 @@ var VirtualFileSystem = class {
1041
1429
  }
1042
1430
  continue;
1043
1431
  }
1044
- const absPattern = isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1432
+ const absPattern = isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, normalized));
1045
1433
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
1046
1434
  const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
1047
1435
  const stack = [
@@ -1056,7 +1444,7 @@ var VirtualFileSystem = class {
1056
1444
  continue;
1057
1445
  }
1058
1446
  for (const entry of entries) {
1059
- const full = this.formatPath(joinPaths(dir, entry));
1447
+ const full = this.formatPath(joinPaths$1(dir, entry));
1060
1448
  let stats;
1061
1449
  try {
1062
1450
  stats = this.#unifiedFS.lstatSync(full);
@@ -1067,7 +1455,7 @@ var VirtualFileSystem = class {
1067
1455
  if (stats.isDirectory()) {
1068
1456
  stack.push(full);
1069
1457
  } else if (stats.isFile()) {
1070
- if (this.buildRegex(absPattern).test(full)) {
1458
+ if (this.#buildRegex(absPattern).test(full)) {
1071
1459
  const resolved = this.resolve(full, {
1072
1460
  type: "file"
1073
1461
  });
@@ -1100,7 +1488,7 @@ var VirtualFileSystem = class {
1100
1488
  }
1101
1489
  continue;
1102
1490
  }
1103
- const absPattern = isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
1491
+ const absPattern = isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths$1(this.#context.workspaceConfig.workspaceRoot, normalized));
1104
1492
  const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
1105
1493
  const baseDir = firstGlobIdx === -1 ? findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
1106
1494
  const stack = [
@@ -1115,7 +1503,7 @@ var VirtualFileSystem = class {
1115
1503
  continue;
1116
1504
  }
1117
1505
  for (const entry of entries) {
1118
- const full = this.formatPath(joinPaths(dir, entry));
1506
+ const full = this.formatPath(joinPaths$1(dir, entry));
1119
1507
  let stats;
1120
1508
  try {
1121
1509
  stats = this.#unifiedFS.lstatSync(full);
@@ -1126,7 +1514,7 @@ var VirtualFileSystem = class {
1126
1514
  if (stats.isDirectory()) {
1127
1515
  stack.push(full);
1128
1516
  } else if (stats.isFile()) {
1129
- if (this.buildRegex(absPattern).test(full)) {
1517
+ if (this.#buildRegex(absPattern).test(full)) {
1130
1518
  const resolved = this.resolve(full, {
1131
1519
  type: "file"
1132
1520
  });
@@ -1190,7 +1578,7 @@ var VirtualFileSystem = class {
1190
1578
  * @returns An array of file names in the specified path.
1191
1579
  */
1192
1580
  async readdir(pathOrId, options = "utf8") {
1193
- return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
1581
+ return this.#unifiedFS.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
1194
1582
  }
1195
1583
  /**
1196
1584
  * Asynchronously reads a file from the virtual file system (VFS).
@@ -1206,17 +1594,13 @@ var VirtualFileSystem = class {
1206
1594
  type: "file"
1207
1595
  });
1208
1596
  if (filePath) {
1209
- if (this.#cachedFS.has(filePath)) {
1210
- return this.#cachedFS.get(filePath);
1211
- }
1212
1597
  let result;
1213
- if (isFunction(this.resolveFS(filePath).promises.readFile)) {
1214
- result = (await this.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
1598
+ if (isFunction(this.#unifiedFS.resolveFS(filePath).promises.readFile)) {
1599
+ result = (await this.#unifiedFS.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
1215
1600
  } else {
1216
- result = this.resolveFS(filePath).readFileSync(filePath, options);
1601
+ result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1217
1602
  }
1218
1603
  const content = isBuffer(result) ? bufferToString(result) : result;
1219
- this.#cachedFS.set(filePath, content);
1220
1604
  return content;
1221
1605
  }
1222
1606
  return void 0;
@@ -1235,12 +1619,8 @@ var VirtualFileSystem = class {
1235
1619
  type: "file"
1236
1620
  });
1237
1621
  if (filePath) {
1238
- if (this.#cachedFS.has(filePath)) {
1239
- return this.#cachedFS.get(filePath);
1240
- }
1241
- const result = this.resolveFS(filePath).readFileSync(filePath, options);
1622
+ const result = this.#unifiedFS.resolveFS(filePath).readFileSync(filePath, options);
1242
1623
  const content = isBuffer(result) ? bufferToString(result) : result;
1243
- this.#cachedFS.set(filePath, content);
1244
1624
  return content;
1245
1625
  }
1246
1626
  return void 0;
@@ -1268,17 +1648,15 @@ var VirtualFileSystem = class {
1268
1648
  });
1269
1649
  }
1270
1650
  }
1271
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1651
+ const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1272
1652
  this.#log(LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
1273
- this.meta[formattedPath] = {
1274
- path: formattedPath,
1275
- code,
1653
+ this.metadata[formattedPath] = {
1276
1654
  mode: outputMode,
1277
1655
  variant: "normal",
1278
1656
  ...isPowerLinesWriteFileData(data) ? data : {}
1279
1657
  };
1280
- this.clearResolverCache(formattedPath);
1281
- const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1658
+ this.#clearResolverCache(formattedPath);
1659
+ const ifs = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1282
1660
  if (isFunction(ifs.promises.writeFile)) {
1283
1661
  return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
1284
1662
  }
@@ -1297,17 +1675,15 @@ var VirtualFileSystem = class {
1297
1675
  this.mkdirSync(findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1298
1676
  }
1299
1677
  const code = isPowerLinesWriteFileData(data) ? data.code : data;
1300
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1678
+ const outputMode = this.#unifiedFS.resolveMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1301
1679
  this.#log(LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
1302
- this.meta[formattedPath] = {
1303
- path: formattedPath,
1304
- code,
1680
+ this.metadata[formattedPath] = {
1305
1681
  mode: outputMode,
1306
1682
  variant: "normal",
1307
1683
  ...isPowerLinesWriteFileData(data) ? data : {}
1308
1684
  };
1309
- this.clearResolverCache(formattedPath);
1310
- const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1685
+ this.#clearResolverCache(formattedPath);
1686
+ const writeStream = this.#unifiedFS.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1311
1687
  try {
1312
1688
  writeStream.write(code);
1313
1689
  } finally {
@@ -1331,8 +1707,8 @@ var VirtualFileSystem = class {
1331
1707
  */
1332
1708
  getMetadata(pathOrId) {
1333
1709
  const resolved = this.resolve(pathOrId);
1334
- if (resolved && this.meta[resolved]) {
1335
- return this.meta[resolved];
1710
+ if (resolved && this.metadata[resolved]) {
1711
+ return this.metadata[resolved];
1336
1712
  }
1337
1713
  return void 0;
1338
1714
  }
@@ -1347,358 +1723,276 @@ var VirtualFileSystem = class {
1347
1723
  */
1348
1724
  isFile(pathOrId) {
1349
1725
  const resolved = this.resolve(pathOrId);
1350
- 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()));
1726
+ 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()));
1351
1727
  }
1352
1728
  /**
1353
1729
  * Checks if a directory exists in the virtual file system (VFS).
1354
1730
  *
1355
1731
  * @param pathOrId - The path of the directory to check.
1356
1732
  * @returns `true` if the directory exists, otherwise `false`.
1357
- */
1358
- isDirectory(pathOrId) {
1359
- const resolved = this.resolve(pathOrId);
1360
- 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()));
1361
- }
1362
- /**
1363
- * Retrieves the status of a file in the virtual file system (VFS).
1364
- *
1365
- * @param pathOrId - The path or ID of the file to retrieve status for.
1366
- * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1367
- */
1368
- async stat(pathOrId, options) {
1369
- return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1370
- }
1371
- /**
1372
- * Synchronously retrieves the status of a file in the virtual file system (VFS).
1373
- *
1374
- * @param pathOrId - The path or ID of the file to retrieve status for.
1375
- * @returns The file's status information, or false if the file does not exist.
1376
- */
1377
- statSync(pathOrId) {
1378
- return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1379
- }
1380
- /**
1381
- * Retrieves the status of a symbolic link in the virtual file system (VFS).
1382
- *
1383
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1384
- * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1385
- */
1386
- async lstat(pathOrId, options) {
1387
- return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1388
- }
1389
- /**
1390
- * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
1391
- *
1392
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1393
- * @returns The symbolic link's status information, or false if the link does not exist.
1394
- */
1395
- lstatSync(pathOrId, options) {
1396
- return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1397
- }
1398
- /**
1399
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1400
- *
1401
- * @see https://www.typescriptlang.org/tsconfig#paths
1402
- *
1403
- * @param path - The path to check.
1404
- * @returns The resolved file path if it exists, otherwise undefined.
1405
- */
1406
- resolveTsconfigPath(path) {
1407
- if (this.#context.tsconfig.options.paths) {
1408
- for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
1409
- const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
1410
- if (resolvedPath) {
1411
- return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
1412
- }
1413
- }
1414
- }
1415
- return false;
1416
- }
1417
- /**
1418
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1419
- *
1420
- * @see https://www.typescriptlang.org/tsconfig#paths
1421
- *
1422
- * @param path - The path to check.
1423
- * @returns The resolved file path if it exists, otherwise undefined.
1424
- */
1425
- resolveTsconfigPathPackage(path) {
1426
- if (this.#context.tsconfig.options.paths) {
1427
- const tsconfigPathKeys = Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")));
1428
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
1429
- return tsconfigPathKeys[0].replace(/\/\*$/, "");
1430
- }
1431
- }
1432
- return false;
1433
- }
1434
- /**
1435
- * Resolves a path or ID to its real path in the virtual file system (VFS).
1436
- *
1437
- * @param pathOrId - The path or ID to resolve.
1438
- * @returns The resolved real path if it exists, otherwise undefined.
1439
- */
1440
- realpathSync(pathOrId) {
1441
- const filePath = this.resolve(toFilePath(pathOrId));
1442
- if (!filePath) {
1443
- throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1444
- }
1445
- return filePath;
1446
- }
1447
- /**
1448
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1449
- *
1450
- * @param pathOrId - The path or ID to resolve.
1451
- * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1452
- * @returns The resolved file path if it exists, otherwise undefined.
1453
- */
1454
- resolve(pathOrId, options = {}) {
1455
- const formattedPathOrId = toFilePath(pathOrId);
1456
- const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1457
- if (this.#cachedResolver.has(resolverKey)) {
1458
- return this.#cachedResolver.get(resolverKey);
1459
- }
1460
- let result = this.resolveId(formattedPathOrId);
1461
- if (!result) {
1462
- result = this.resolvePath(formattedPathOrId, options);
1463
- }
1464
- if (!result) {
1465
- result = false;
1466
- }
1467
- if (result && options.withExtension === false) {
1468
- return result.replace(/\.[m|c]?[t|j]sx?$/, "");
1469
- }
1470
- this.#cachedResolver.set(resolverKey, result);
1471
- return result;
1472
- }
1473
- /**
1474
- * Retrieves the partial metadata for all files in the virtual file system (VFS).
1475
- *
1476
- * @returns A record containing the partial metadata for all files.
1477
- */
1478
- getPartialMeta() {
1479
- return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject(data)));
1480
- }
1481
- buildRegex(strPattern) {
1482
- const token = "::GLOBSTAR::";
1483
- return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1484
- }
1485
- /**
1486
- * Converts a relative path to an absolute path based on the workspace and project root.
1487
- *
1488
- * @param path - The relative path to convert.
1489
- * @returns The absolute path.
1490
- */
1491
- formatPath(path) {
1492
- const formattedPath = toFilePath(path);
1493
- if (isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1494
- return formattedPath;
1495
- } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1496
- return joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1497
- }
1498
- return formattedPath;
1499
- }
1500
- /**
1501
- * Formats a file id by removing the file extension and prepending the runtime prefix.
1502
- *
1503
- * @param id - The file ID to format.
1504
- * @returns The formatted file ID.
1505
- */
1506
- formatId(id) {
1507
- const formattedId = toFilePath(id);
1508
- return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(findFileDotExtensionSafe(formattedId), "")}`;
1509
- }
1510
- /**
1511
- * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
1512
- *
1513
- * @param id - The id to resolve.
1514
- * @returns The resolved file id if it exists, otherwise undefined.
1515
- */
1516
- resolveId(id) {
1517
- if (this.#ids[this.formatId(id)]) {
1518
- return this.#ids[this.formatId(id)] || false;
1519
- }
1520
- return false;
1521
- }
1522
- /**
1523
- * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1524
- *
1525
- * @param path - The path to resolve.
1526
- * @param options - Optional parameters for resolving the path.
1527
- * @returns The resolved file path if it exists, otherwise undefined.
1528
- */
1529
- resolvePath(path, options = {}) {
1530
- if (isAbsolutePath(path)) {
1531
- if (this.#existsSync(path)) {
1532
- return path;
1533
- }
1534
- const result = this.checkVariants(path);
1535
- if (result) {
1536
- return result;
1537
- }
1538
- }
1539
- for (const parentPath of this.resolveParentPaths(path, options.paths)) {
1540
- const request = joinPaths(parentPath, path);
1541
- if (this.#existsSync(request)) {
1542
- return request;
1543
- }
1544
- const result = this.checkVariants(request);
1545
- if (result) {
1546
- return result;
1547
- }
1548
- }
1549
- return false;
1550
- }
1551
- resolveParentPaths(request, parents = []) {
1552
- let paths = [
1553
- this.#context.workspaceConfig.workspaceRoot,
1554
- joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
1555
- ];
1556
- if (this.#context.tsconfig.options.paths) {
1557
- 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) => {
1558
- if (path && !ret.includes(joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
1559
- ret.push(joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
1560
- }
1561
- return ret;
1562
- }, paths) : paths;
1563
- }
1564
- return paths.reduce((ret, path) => {
1565
- if (!ret.includes(path)) {
1566
- ret.push(path);
1567
- }
1568
- return ret;
1569
- }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1733
+ */
1734
+ isDirectory(pathOrId) {
1735
+ const resolved = this.resolve(pathOrId);
1736
+ 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()));
1570
1737
  }
1571
1738
  /**
1572
- * Select the file system module to use for the operation based on the path or URL.
1739
+ * Retrieves the status of a file in the virtual file system (VFS).
1573
1740
  *
1574
- * @param pathOrUrl - The path to perform the file system operation on.
1575
- * @param options - Options for the operation, such as output mode.
1576
- * @returns The file system module used for the operation.
1741
+ * @param pathOrId - The path or ID of the file to retrieve status for.
1742
+ * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1577
1743
  */
1578
- resolveFS(pathOrUrl, options = {}) {
1579
- const mode = this.resolveOutputMode(pathOrUrl, options);
1580
- if (mode === "virtual") {
1581
- return this.#virtualFS;
1582
- } else if (mode === "fs") {
1583
- return this.#fs;
1584
- }
1585
- return this.#unifiedFS;
1744
+ async stat(pathOrId, options) {
1745
+ return this.#unifiedFS.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1586
1746
  }
1587
1747
  /**
1588
- * Select the file system module to use for the operation based on the path or URL.
1748
+ * Synchronously retrieves the status of a file in the virtual file system (VFS).
1589
1749
  *
1590
- * @param pathOrUrl - The path to perform the file system operation on.
1591
- * @param options - Options for the operation, such as output mode.
1592
- * @returns The file system module used for the operation.
1750
+ * @param pathOrId - The path or ID of the file to retrieve status for.
1751
+ * @returns The file's status information, or false if the file does not exist.
1593
1752
  */
1594
- resolveOutputMode(pathOrUrl, options = {}) {
1595
- if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
1596
- return "virtual";
1597
- } else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath(toFilePath(pathOrUrl), joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
1598
- return "fs";
1599
- }
1600
- return void 0;
1753
+ statSync(pathOrId) {
1754
+ return this.#unifiedFS.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1601
1755
  }
1602
1756
  /**
1603
- * Clears the resolver cache for a given path.
1757
+ * Retrieves the status of a symbolic link in the virtual file system (VFS).
1604
1758
  *
1605
- * @param path - The path to clear the resolver cache for.
1759
+ * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1760
+ * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1606
1761
  */
1607
- clearResolverCache(path) {
1608
- this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1762
+ async lstat(pathOrId, options) {
1763
+ return this.#unifiedFS.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1609
1764
  }
1610
1765
  /**
1611
- * Check if the file exists with different variants (index, extensions).
1766
+ * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
1612
1767
  *
1613
- * @param request - The request path to check.
1614
- * @param parentPath - An optional parent path to prepend to the request.
1615
- * @returns The file path if it exists, otherwise false.
1768
+ * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1769
+ * @returns The symbolic link's status information, or false if the link does not exist.
1616
1770
  */
1617
- checkVariants(request, parentPath) {
1618
- const path = parentPath ? joinPaths(parentPath, request) : request;
1619
- let file = this.checkExtensions(path);
1620
- if (file) {
1621
- return file;
1622
- }
1623
- file = this.checkIndex(path);
1624
- if (file) {
1625
- return file;
1626
- }
1627
- return false;
1771
+ lstatSync(pathOrId, options) {
1772
+ return this.#unifiedFS.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1628
1773
  }
1629
1774
  /**
1630
- * Check if the index file exists in the given request path.
1775
+ * Resolves a path or ID to its real path in the virtual file system (VFS).
1631
1776
  *
1632
- * @param request - The request path to check.
1633
- * @returns The index file path if it exists, otherwise false.
1777
+ * @param pathOrId - The path or ID to resolve.
1778
+ * @returns The resolved real path if it exists, otherwise undefined.
1634
1779
  */
1635
- checkIndex(request) {
1636
- let file = joinPaths(request, "index");
1637
- if (this.#existsSync(file)) {
1638
- return file;
1639
- }
1640
- file = this.checkExtensions(file);
1641
- if (file) {
1642
- return file;
1780
+ realpathSync(pathOrId) {
1781
+ const filePath = this.resolve(toFilePath(pathOrId));
1782
+ if (!filePath) {
1783
+ throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1643
1784
  }
1644
- return false;
1785
+ return filePath;
1645
1786
  }
1646
1787
  /**
1647
- * Check if the file exists with different extensions.
1788
+ * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1648
1789
  *
1649
- * @param request - The request path to check.
1650
- * @param vfs - The file system module to use for checking file existence.
1651
- * @returns The file path if it exists with any of the checked extensions, otherwise false.
1790
+ * @param pathOrId - The path or ID to resolve.
1791
+ * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1792
+ * @returns The resolved file path if it exists, otherwise undefined.
1652
1793
  */
1653
- checkExtensions(request) {
1654
- let file = `${request}.ts`;
1655
- if (this.#existsSync(file)) {
1656
- return file;
1657
- }
1658
- file = `${request}.mts`;
1659
- if (this.#existsSync(file)) {
1660
- return file;
1661
- }
1662
- file = `${request}.cts`;
1663
- if (this.#existsSync(file)) {
1664
- return file;
1794
+ resolve(pathOrId, options = {}) {
1795
+ const formattedPathOrId = toFilePath(pathOrId);
1796
+ const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1797
+ if (this.#cachedResolver.has(resolverKey)) {
1798
+ return this.#cachedResolver.get(resolverKey);
1665
1799
  }
1666
- file = `${request}.tsx`;
1667
- if (this.#existsSync(file)) {
1668
- return file;
1800
+ let result = this.#resolveId(formattedPathOrId);
1801
+ if (!result) {
1802
+ result = this.#resolvePath(formattedPathOrId, options);
1669
1803
  }
1670
- file = `${request}.js`;
1671
- if (this.#existsSync(file)) {
1672
- return file;
1804
+ if (!result) {
1805
+ result = false;
1673
1806
  }
1674
- file = `${request}.mjs`;
1675
- if (this.#existsSync(file)) {
1676
- return file;
1807
+ if (result && options.withExtension === false) {
1808
+ return result.replace(/\.[m|c]?[t|j]sx?$/, "");
1677
1809
  }
1678
- file = `${request}.cjs`;
1679
- if (this.#existsSync(file)) {
1680
- return file;
1810
+ this.#cachedResolver.set(resolverKey, result);
1811
+ return result;
1812
+ }
1813
+ /**
1814
+ * Converts a relative path to an absolute path based on the workspace and project root.
1815
+ *
1816
+ * @param path - The relative path to convert.
1817
+ * @returns The absolute path.
1818
+ */
1819
+ formatPath(path) {
1820
+ const formattedPath = toFilePath(path);
1821
+ if (isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1822
+ return formattedPath;
1823
+ } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1824
+ return joinPaths$1(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1681
1825
  }
1682
- file = `${request}.jsx`;
1683
- if (this.#existsSync(file)) {
1684
- return file;
1826
+ return formattedPath;
1827
+ }
1828
+ /**
1829
+ * Disposes of the virtual file system (VFS) by saving its state to disk.
1830
+ */
1831
+ async dispose() {
1832
+ if (!this.#isDisposed) {
1833
+ this.#isDisposed = true;
1834
+ this.#log(LogLevelLabel.DEBUG, "Disposing virtual file system...");
1835
+ await this.unlink(joinPaths$1(this.#context.cachePath, "fs.bin"));
1836
+ const message = new $.Message();
1837
+ const data = message.initRoot(FileSystemData);
1838
+ const virtualFS = this.#unifiedFS.toJSON();
1839
+ const files = data._initFiles(Object.keys(virtualFS).length);
1840
+ Object.entries(virtualFS).filter(([_, content]) => content).forEach(([path, content], index) => {
1841
+ const fileData = files.get(index);
1842
+ fileData.path = path;
1843
+ fileData.content = content;
1844
+ });
1845
+ const ids = data._initIds(Object.keys(this.ids).length);
1846
+ Object.entries(this.ids).forEach(([id, path], index) => {
1847
+ const fileId = ids.get(index);
1848
+ fileId.id = id;
1849
+ fileId.path = path;
1850
+ });
1851
+ const metadata = data._initMetadata(Object.keys(this.metadata).length);
1852
+ Object.entries(this.metadata).forEach(([id, value], index) => {
1853
+ const fileMetadata = metadata.get(index);
1854
+ fileMetadata.id = id;
1855
+ fileMetadata.mode = value.mode;
1856
+ fileMetadata.variant = value.variant;
1857
+ if (value.properties) {
1858
+ const props = fileMetadata._initProperties(Object.keys(value.properties).length);
1859
+ Object.entries(value.properties).forEach(([key, val], propIndex) => {
1860
+ const propData = props.get(propIndex);
1861
+ propData.key = key;
1862
+ propData.value = val;
1863
+ });
1864
+ }
1865
+ });
1866
+ await writeFileBuffer(joinPaths$1(this.#context.cachePath, "fs.bin"), message.toArrayBuffer());
1685
1867
  }
1686
- file = `${request}.json`;
1687
- if (this.#existsSync(file)) {
1688
- return file;
1868
+ }
1869
+ /**
1870
+ * Initializes the virtual file system (VFS) by patching the file system module if necessary.
1871
+ */
1872
+ [__VFS_PATCH__]() {
1873
+ if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
1874
+ this.#revert = patchFS(fs, this);
1875
+ this.#isPatched = true;
1689
1876
  }
1690
- file = `${request}.d.ts`;
1691
- if (this.#existsSync(file)) {
1692
- return file;
1877
+ }
1878
+ /**
1879
+ * Reverts the file system module to its original state if it was previously patched.
1880
+ */
1881
+ [__VFS_REVERT__]() {
1882
+ if (this.#isPatched && this.#context.config.output.mode !== "fs") {
1883
+ if (!this.#revert) {
1884
+ throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
1885
+ }
1886
+ this.#revert?.();
1887
+ this.#isPatched = false;
1693
1888
  }
1694
- return false;
1889
+ }
1890
+ async [Symbol.asyncDispose]() {
1891
+ return this.dispose();
1695
1892
  }
1696
1893
  };
1697
- function createVfs(context) {
1698
- const vfs = new VirtualFileSystem(context);
1699
- return vfs;
1894
+ var PROJECT_ROOT_HASH_LENGTH = 45;
1895
+ var CACHE_HASH_LENGTH = 62;
1896
+ function getPrefixedProjectRootHash(name, projectRootHash) {
1897
+ const combined = `${kebabCase(name)}_${projectRootHash}`;
1898
+ return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
1899
+ }
1900
+ __name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
1901
+ async function getChecksum(path) {
1902
+ return hashDirectory(path, {
1903
+ ignore: [
1904
+ "node_modules",
1905
+ ".git",
1906
+ ".nx",
1907
+ ".cache",
1908
+ ".storm",
1909
+ "tmp",
1910
+ "dist"
1911
+ ]
1912
+ });
1913
+ }
1914
+ __name(getChecksum, "getChecksum");
1915
+ async function writeMetaFile(context) {
1916
+ const metaFilePath = joinPaths$1(context.dataPath, "meta.json");
1917
+ context.log(LogLevelLabel.DEBUG, `Writing runtime metadata to ${metaFilePath}`);
1918
+ await context.fs.writeFile(metaFilePath, JSON.stringify(context.meta, null, 2), {
1919
+ mode: "fs"
1920
+ });
1921
+ }
1922
+ __name(writeMetaFile, "writeMetaFile");
1923
+ function isPlugin(value) {
1924
+ return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && (isUndefined(value.dependsOn) || "dependsOn" in value && Array.isArray(value.dependsOn) && value.dependsOn.every(isPluginConfig)) && SUPPORTED_COMMANDS.every((command) => isUndefined(value[command]) || command in value && (isFunction(value[command]) || isSetObject(value[command]) && "handler" in value[command] && isFunction(value[command].handler)));
1925
+ }
1926
+ __name(isPlugin, "isPlugin");
1927
+ function isPluginConfigObject(value) {
1928
+ return isSetObject(value) && "plugin" in value && ((isSetString(value.plugin) || isFunction(value.plugin)) && "options" in value && isSetObject(value.options) || isPlugin(value.plugin));
1929
+ }
1930
+ __name(isPluginConfigObject, "isPluginConfigObject");
1931
+ function isPluginConfigTuple(value) {
1932
+ return Array.isArray(value) && (value.length === 1 || value.length === 2) && ((isSetString(value[0]) || isFunction(value[0])) && value.length > 1 && isSetObject(value[1]) || isPlugin(value[0]));
1933
+ }
1934
+ __name(isPluginConfigTuple, "isPluginConfigTuple");
1935
+ function isPluginConfig(value) {
1936
+ return isSetString(value) || isFunction(value) || isPlugin(value) || isPluginConfigObject(value) || isPluginConfigTuple(value);
1937
+ }
1938
+ __name(isPluginConfig, "isPluginConfig");
1939
+ function isPluginHookFunction(value) {
1940
+ return isFunction(value) || isSetObject(value) && "handler" in value && isFunction(value.handler);
1941
+ }
1942
+ __name(isPluginHookFunction, "isPluginHookFunction");
1943
+ function isPluginHookObject(value) {
1944
+ return isSetObject(value) && "handler" in value && isFunction(value.handler);
1945
+ }
1946
+ __name(isPluginHookObject, "isPluginHookObject");
1947
+ function isPluginHook(value) {
1948
+ return isPluginHookFunction(value) || isPluginHookObject(value);
1949
+ }
1950
+ __name(isPluginHook, "isPluginHook");
1951
+ function getHookHandler(pluginHook) {
1952
+ return isFunction(pluginHook) ? pluginHook : pluginHook.handler;
1953
+ }
1954
+ __name(getHookHandler, "getHookHandler");
1955
+ function isHookExternal(hook) {
1956
+ return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
1957
+ }
1958
+ __name(isHookExternal, "isHookExternal");
1959
+ function checkDedupe(plugin, plugins) {
1960
+ return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
1961
+ }
1962
+ __name(checkDedupe, "checkDedupe");
1963
+ function addPluginHook(context, plugin, pluginHook, hooksList) {
1964
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
1965
+ hooksList.push(isFunction(pluginHook) ? {
1966
+ plugin,
1967
+ handler: getHookHandler(pluginHook).bind(context)
1968
+ } : {
1969
+ plugin,
1970
+ ...pluginHook,
1971
+ handler: getHookHandler(pluginHook).bind(context)
1972
+ });
1973
+ }
1974
+ }
1975
+ __name(addPluginHook, "addPluginHook");
1976
+ function resolveOptions(options) {
1977
+ return defu3(options, {
1978
+ interopDefault: true,
1979
+ fsCache: options.mode !== "development" ? joinPaths$1(options.cacheDir, "jiti") : false,
1980
+ moduleCache: options.mode !== "development"
1981
+ });
1982
+ }
1983
+ __name(resolveOptions, "resolveOptions");
1984
+ function createPluginResolver(options) {
1985
+ return createJiti(joinPaths$1(options.workspaceRoot, options.projectRoot), resolveOptions({
1986
+ ...options
1987
+ }));
1988
+ }
1989
+ __name(createPluginResolver, "createPluginResolver");
1990
+ function createResolver(options) {
1991
+ const baseResolver = createJiti(joinPaths$1(options.workspaceRoot, options.projectRoot), resolveOptions(options));
1992
+ baseResolver.plugin = createPluginResolver(options);
1993
+ return baseResolver;
1700
1994
  }
1701
- __name(createVfs, "createVfs");
1995
+ __name(createResolver, "createResolver");
1702
1996
 
1703
1997
  // src/internal/contexts/context.ts
1704
1998
  var configCache = /* @__PURE__ */ new WeakMap();
@@ -1813,7 +2107,7 @@ var PowerlinesContext = class _PowerlinesContext {
1813
2107
  */
1814
2108
  get fs() {
1815
2109
  if (!this.#fs) {
1816
- this.#fs = createVfs(this);
2110
+ this.#fs = VirtualFileSystem.createSync(this);
1817
2111
  }
1818
2112
  return this.#fs;
1819
2113
  }
@@ -1840,9 +2134,7 @@ var PowerlinesContext = class _PowerlinesContext {
1840
2134
  }),
1841
2135
  configHash: murmurhash(this.config, {
1842
2136
  maxLength: CACHE_HASH_LENGTH
1843
- }),
1844
- builtinIdMap: {},
1845
- virtualFiles: {}
2137
+ })
1846
2138
  };
1847
2139
  }
1848
2140
  /**
@@ -1883,31 +2175,31 @@ var PowerlinesContext = class _PowerlinesContext {
1883
2175
  * Get the path to the artifacts directory for the project
1884
2176
  */
1885
2177
  get artifactsPath() {
1886
- return joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsFolder);
2178
+ return joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsFolder);
1887
2179
  }
1888
2180
  /**
1889
2181
  * Get the path to the builtin modules used by the project
1890
2182
  */
1891
2183
  get builtinsPath() {
1892
- return joinPaths$1(this.artifactsPath, "builtins");
2184
+ return joinPaths(this.artifactsPath, "builtins");
1893
2185
  }
1894
2186
  /**
1895
2187
  * Get the path to the entry directory for the project
1896
2188
  */
1897
2189
  get entryPath() {
1898
- return joinPaths$1(this.artifactsPath, "entry");
2190
+ return joinPaths(this.artifactsPath, "entry");
1899
2191
  }
1900
2192
  /**
1901
2193
  * Get the path to the data directory for the project
1902
2194
  */
1903
2195
  get dataPath() {
1904
- return joinPaths$1(this.envPaths.data, "projects", getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
2196
+ return joinPaths(this.envPaths.data, "projects", getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
1905
2197
  }
1906
2198
  /**
1907
2199
  * Get the path to the cache directory for the project
1908
2200
  */
1909
2201
  get cachePath() {
1910
- return joinPaths$1(this.envPaths.cache, "projects", murmurhash({
2202
+ return joinPaths(this.envPaths.cache, "projects", murmurhash({
1911
2203
  checksum: this.#checksum,
1912
2204
  config: this.meta.configHash
1913
2205
  }, {
@@ -1918,7 +2210,7 @@ var PowerlinesContext = class _PowerlinesContext {
1918
2210
  * Get the path to the generated declaration file for the project
1919
2211
  */
1920
2212
  get dtsPath() {
1921
- return this.config.output.dts ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : joinPaths$1(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "storm.d.ts");
2213
+ return this.config.output.dts ? appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "storm.d.ts");
1922
2214
  }
1923
2215
  /**
1924
2216
  * Get the project root relative to the workspace root
@@ -1930,13 +2222,13 @@ var PowerlinesContext = class _PowerlinesContext {
1930
2222
  * The builtin module id that exist in the Powerlines virtual file system
1931
2223
  */
1932
2224
  get builtins() {
1933
- return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
2225
+ return Object.values(this.fs.metadata).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
1934
2226
  }
1935
2227
  /**
1936
- * Get the project root relative to the workspace root
2228
+ * Get the builtin virtual files that exist in the Powerlines virtual file system
1937
2229
  */
1938
2230
  async getBuiltins() {
1939
- return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
2231
+ return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
1940
2232
  const code = await this.fs.readFile(path);
1941
2233
  return {
1942
2234
  ...meta,
@@ -1956,7 +2248,7 @@ var PowerlinesContext = class _PowerlinesContext {
1956
2248
  return this.fs.writeFile(isAbsolute(path) ? path : appendPath(path, this.entryPath), {
1957
2249
  code,
1958
2250
  variant: "entry"
1959
- }, defu4(options, {
2251
+ }, defu3(options, {
1960
2252
  mode: this.config.output.mode
1961
2253
  }));
1962
2254
  }
@@ -1969,11 +2261,11 @@ var PowerlinesContext = class _PowerlinesContext {
1969
2261
  * @param options - Optional write file options
1970
2262
  */
1971
2263
  async writeBuiltin(code, id, path, options = {}) {
1972
- return this.fs.writeFile(path ? isAbsolute(path) ? path : joinPaths$1(this.builtinsPath, path) : appendPath(id, this.builtinsPath), {
2264
+ return this.fs.writeFile(path ? isAbsolute(path) ? path : joinPaths(this.builtinsPath, path) : appendPath(id, this.builtinsPath), {
1973
2265
  id,
1974
2266
  code,
1975
2267
  variant: "builtin"
1976
- }, defu4(options, {
2268
+ }, defu3(options, {
1977
2269
  mode: this.config.output.mode
1978
2270
  }));
1979
2271
  }
@@ -1995,7 +2287,7 @@ var PowerlinesContext = class _PowerlinesContext {
1995
2287
  options
1996
2288
  });
1997
2289
  }
1998
- const result = await parseAsync(id, code, defu4(options ?? {}, {
2290
+ const result = await parseAsync(id, code, defu3(options ?? {}, {
1999
2291
  lang: hasFileExtension(id) ? void 0 : "ts",
2000
2292
  astType: hasFileExtension(id) ? void 0 : "ts",
2001
2293
  sourceType: "module",
@@ -2033,7 +2325,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2033
2325
  }) {
2034
2326
  this.config.inlineConfig = inlineConfig;
2035
2327
  if (inlineConfig.command === "new") {
2036
- const workspacePackageJsonPath = joinPaths$1(this.workspaceConfig.workspaceRoot, "package.json");
2328
+ const workspacePackageJsonPath = joinPaths(this.workspaceConfig.workspaceRoot, "package.json");
2037
2329
  if (!existsSync(workspacePackageJsonPath)) {
2038
2330
  throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
2039
2331
  }
@@ -2156,11 +2448,11 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2156
2448
  this.resolver = result.resolver;
2157
2449
  this.mergeUserConfig(result.userConfig.config, this.config.userConfig);
2158
2450
  } else {
2159
- const projectJsonPath = joinPaths$1(cacheKey.projectRoot, "project.json");
2451
+ const projectJsonPath = joinPaths(cacheKey.projectRoot, "project.json");
2160
2452
  if (existsSync(projectJsonPath)) {
2161
2453
  this.projectJson = await readJsonFile(projectJsonPath);
2162
2454
  }
2163
- const packageJsonPath = joinPaths$1(cacheKey.projectRoot, "package.json");
2455
+ const packageJsonPath = joinPaths(cacheKey.projectRoot, "package.json");
2164
2456
  if (existsSync(packageJsonPath)) {
2165
2457
  this.packageJson = await readJsonFile(packageJsonPath);
2166
2458
  }
@@ -2183,7 +2475,7 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2183
2475
  });
2184
2476
  }
2185
2477
  if (isSetObject(config)) {
2186
- this.resolvedConfig = defu4({
2478
+ this.resolvedConfig = defu3({
2187
2479
  inlineConfig: this.config.inlineConfig,
2188
2480
  userConfig: this.config.userConfig
2189
2481
  }, options.isHighPriority ? this.#getConfigProps(config) : {}, {
@@ -2200,11 +2492,11 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2200
2492
  tsconfig: appendPath("tsconfig.json", cacheKey.projectRoot),
2201
2493
  sourceRoot: this.projectJson?.sourceRoot || appendPath("src", cacheKey.projectRoot),
2202
2494
  output: {
2203
- outputPath: joinPaths$1("dist", cacheKey.projectRoot),
2495
+ outputPath: joinPaths("dist", cacheKey.projectRoot),
2204
2496
  mode: "virtual",
2205
- dts: joinPaths$1(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
2497
+ dts: joinPaths(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
2206
2498
  builtinPrefix: config.framework ?? "powerlines",
2207
- artifactsFolder: joinPaths$1(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
2499
+ artifactsFolder: joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
2208
2500
  assets: [
2209
2501
  {
2210
2502
  glob: "LICENSE"
@@ -2261,12 +2553,12 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2261
2553
  ] : [
2262
2554
  "esm"
2263
2555
  ])));
2264
- this.config.output.outputPath ??= joinPaths$1("dist", this.config.projectRoot || ".");
2556
+ this.config.output.outputPath ??= joinPaths("dist", this.config.projectRoot || ".");
2265
2557
  this.config.output.assets = getUnique(this.config.output.assets.map((asset) => {
2266
2558
  return {
2267
2559
  glob: isSetObject(asset) ? asset.glob : asset,
2268
2560
  input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : appendPath(asset.input, this.workspaceConfig.workspaceRoot),
2269
- output: appendPath(isSetObject(asset) && asset.output ? joinPaths$1(this.config.output.outputPath, replacePath(asset.output, this.config.output.outputPath)) : this.config.output.outputPath, this.workspaceConfig.workspaceRoot),
2561
+ output: appendPath(isSetObject(asset) && asset.output ? joinPaths(this.config.output.outputPath, replacePath(asset.output, this.config.output.outputPath)) : this.config.output.outputPath, this.workspaceConfig.workspaceRoot),
2270
2562
  ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
2271
2563
  };
2272
2564
  }));
@@ -2277,9 +2569,10 @@ ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.co
2277
2569
  ret.push(plugin);
2278
2570
  return ret;
2279
2571
  }, []);
2572
+ this.#fs ??= await VirtualFileSystem.create(this);
2280
2573
  }
2281
2574
  mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
2282
- this.config.userConfig = defu4({
2575
+ this.config.userConfig = defu3({
2283
2576
  entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
2284
2577
  }, omit(from ?? {}, [
2285
2578
  "entry"
@@ -2635,7 +2928,7 @@ async function emitTypes(context, tsconfig, files) {
2635
2928
  const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
2636
2929
  const sourceFile = sourceFiles?.[0];
2637
2930
  if (sourceFile?.fileName && !fileName.endsWith(".map")) {
2638
- if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.meta[file]?.id && context.fs.meta[file]?.id === sourceFile.fileName)) {
2931
+ if (context.builtins.some((file) => file === sourceFile.fileName || context.fs.metadata[file]?.id && context.fs.metadata[file]?.id === sourceFile.fileName)) {
2639
2932
  builtinModules += `
2640
2933
  declare module "${context.fs.resolve(sourceFile.fileName)}" {
2641
2934
  ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
@@ -2724,7 +3017,7 @@ function getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig = "tsconfig.js
2724
3017
  if (!existsSync(tsconfigFilePath)) {
2725
3018
  tsconfigFilePath = appendPath(tsconfig, workspaceRoot);
2726
3019
  if (!existsSync(tsconfigFilePath)) {
2727
- tsconfigFilePath = appendPath(tsconfig, joinPaths(workspaceRoot, projectRoot));
3020
+ tsconfigFilePath = appendPath(tsconfig, joinPaths$1(workspaceRoot, projectRoot));
2728
3021
  if (!existsSync(tsconfigFilePath)) {
2729
3022
  throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${tsconfig}, ${appendPath(tsconfig, projectRoot)}, ${appendPath(tsconfig, workspaceRoot)}, or ${tsconfigFilePath}`);
2730
3023
  }
@@ -2782,9 +3075,9 @@ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfi
2782
3075
  const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
2783
3076
  const tsconfigJson = readJsonFileSync(tsconfigFilePath);
2784
3077
  if (!tsconfigJson) {
2785
- throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
3078
+ throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths$1(projectRoot, tsconfig ?? "tsconfig.json")}`);
2786
3079
  }
2787
- const parsedCommandLine = ts2.parseJsonConfigFileContent(defu4(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
3080
+ const parsedCommandLine = ts2.parseJsonConfigFileContent(defu3(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
2788
3081
  if (parsedCommandLine.errors.length > 0) {
2789
3082
  const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
2790
3083
  ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
@@ -2836,8 +3129,8 @@ async function resolveTsconfigChanges(context) {
2836
3129
  tsconfigJson.compilerOptions.emitDecoratorMetadata = true;
2837
3130
  }
2838
3131
  if (context.config.output.dts) {
2839
- const dtsFilePath = context.config.output.dts ? context.config.output.dts.startsWith(context.workspaceConfig.workspaceRoot) ? context.config.output.dts : joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.dts) : joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, "storm.d.ts");
2840
- const dtsRelativePath = joinPaths(relativePath(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(dtsFilePath)), findFileName(dtsFilePath));
3132
+ const dtsFilePath = context.config.output.dts ? context.config.output.dts.startsWith(context.workspaceConfig.workspaceRoot) ? context.config.output.dts : joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.output.dts) : joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, "storm.d.ts");
3133
+ const dtsRelativePath = joinPaths$1(relativePath(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(dtsFilePath)), findFileName(dtsFilePath));
2841
3134
  if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
2842
3135
  dtsFilePath,
2843
3136
  dtsRelativePath,
@@ -3076,10 +3369,13 @@ ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.outpu
3076
3369
  await resolveTsconfig(context);
3077
3370
  await installDependencies(context);
3078
3371
  await this.callPostHook(context, "configResolved");
3372
+ if (context.config.build.polyfill) {
3373
+ context.config.build.polyfill = context.config.build.polyfill.map((polyfill) => replacePathTokens(context, polyfill));
3374
+ }
3079
3375
  context.log(LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
3080
3376
 
3081
3377
  ${formatLogMessage(context.config)}`);
3082
- context.fs[__VFS_INIT__]();
3378
+ context.fs[__VFS_PATCH__]();
3083
3379
  await writeMetaFile(context);
3084
3380
  context.persistedMeta = context.meta;
3085
3381
  if (!existsSync(context.cachePath)) {
@@ -3136,10 +3432,10 @@ ${formatLogMessage(context.config)}`);
3136
3432
  }
3137
3433
  return ret;
3138
3434
  }, [
3139
- joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
3435
+ joinPaths$1(typescriptPath, "lib", "lib.esnext.full.d.ts")
3140
3436
  ]);
3141
3437
  context.log(LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
3142
- const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu4({
3438
+ const resolvedTsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu3({
3143
3439
  compilerOptions: {
3144
3440
  strict: false,
3145
3441
  noEmit: false,
@@ -3154,7 +3450,7 @@ ${formatLogMessage(context.config)}`);
3154
3450
  ],
3155
3451
  include: files
3156
3452
  }, context.config.tsconfigRaw ?? {}));
3157
- resolvedTsconfig.options.configFilePath = joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
3453
+ resolvedTsconfig.options.configFilePath = joinPaths$1(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
3158
3454
  resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
3159
3455
  resolvedTsconfig.options.suppressOutputPathCheck = true;
3160
3456
  let generatedTypes = await emitTypes(context, resolvedTsconfig, files);
@@ -3230,26 +3526,26 @@ ${formatTypes(generatedTypes)}
3230
3526
  await this.#executeEnvironments(async (context) => {
3231
3527
  context.log(LogLevelLabel.TRACE, `Initializing the processing options for the Powerlines project.`);
3232
3528
  await this.callPreHook(context, "new");
3233
- const files = await listFiles(joinPaths(context.powerlinesPath, "files/common/**/*.hbs"));
3529
+ const files = await listFiles(joinPaths$1(context.powerlinesPath, "files/common/**/*.hbs"));
3234
3530
  for (const file of files) {
3235
3531
  context.log(LogLevelLabel.TRACE, `Adding template file: ${file}`);
3236
3532
  const template = Handlebars.compile(file);
3237
- await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3533
+ await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3238
3534
  }
3239
3535
  await this.callNormalHook(context, "new");
3240
3536
  if (context.config.projectType === "application") {
3241
- const files2 = await listFiles(joinPaths(context.powerlinesPath, "files/application/**/*.hbs"));
3537
+ const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/application/**/*.hbs"));
3242
3538
  for (const file of files2) {
3243
3539
  context.log(LogLevelLabel.TRACE, `Adding application template file: ${file}`);
3244
3540
  const template = Handlebars.compile(file);
3245
- await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3541
+ await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3246
3542
  }
3247
3543
  } else {
3248
- const files2 = await listFiles(joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
3544
+ const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/library/**/*.hbs"));
3249
3545
  for (const file of files2) {
3250
3546
  context.log(LogLevelLabel.TRACE, `Adding library template file: ${file}`);
3251
3547
  const template = Handlebars.compile(file);
3252
- await writeFile(context.log, joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3548
+ await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3253
3549
  }
3254
3550
  }
3255
3551
  await this.callPostHook(context, "new");
@@ -3313,7 +3609,7 @@ ${formatTypes(generatedTypes)}
3313
3609
  await this.callPreHook(context, "build");
3314
3610
  await this.callNormalHook(context, "build");
3315
3611
  await Promise.all(context.config.output.assets.map(async (asset) => {
3316
- context.log(LogLevelLabel.DEBUG, `Copying asset(s): ${chalk5.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths(replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5.greenBright(joinPaths(replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5.yellowBright(i)).join(", ")})` : ""}`);
3612
+ context.log(LogLevelLabel.DEBUG, `Copying asset(s): ${chalk5.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths$1(replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5.greenBright(joinPaths$1(replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5.yellowBright(i)).join(", ")})` : ""}`);
3317
3613
  await copyFiles(asset, asset.output);
3318
3614
  }));
3319
3615
  await this.callPostHook(context, "build");
@@ -3341,22 +3637,22 @@ ${formatTypes(generatedTypes)}
3341
3637
  this.#context.log(LogLevelLabel.TRACE, "Powerlines documentation generation completed");
3342
3638
  }
3343
3639
  /**
3344
- * Release the project
3640
+ * Deploy the project source code
3345
3641
  *
3346
3642
  * @remarks
3347
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for release.
3643
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
3348
3644
  *
3349
- * @param inlineConfig - The inline configuration for the release command
3645
+ * @param inlineConfig - The inline configuration for the deploy command
3350
3646
  */
3351
- async release(inlineConfig = {
3352
- command: "release"
3647
+ async deploy(inlineConfig = {
3648
+ command: "deploy"
3353
3649
  }) {
3354
- this.context.log(LogLevelLabel.INFO, "\u{1F4E6} Releasing the Powerlines project");
3650
+ this.context.log(LogLevelLabel.INFO, "\u{1F4E6} Deploying the Powerlines project");
3355
3651
  await this.prepare(inlineConfig);
3356
3652
  await this.#executeEnvironments(async (context) => {
3357
- await this.callHook(context, "release");
3653
+ await this.callHook(context, "deploy");
3358
3654
  });
3359
- this.context.log(LogLevelLabel.TRACE, "Powerlines release completed");
3655
+ this.context.log(LogLevelLabel.TRACE, "Powerlines deploy completed");
3360
3656
  }
3361
3657
  /**
3362
3658
  * Finalization process
@@ -3371,6 +3667,7 @@ ${formatTypes(generatedTypes)}
3371
3667
  await this.#executeEnvironments(async (context) => {
3372
3668
  await this.callHook(context, "finalize");
3373
3669
  context.fs[__VFS_REVERT__]();
3670
+ await context.fs.dispose();
3374
3671
  });
3375
3672
  this.context.log(LogLevelLabel.TRACE, "Powerlines finalize execution completed");
3376
3673
  }
@@ -3601,7 +3898,7 @@ ${formatTypes(generatedTypes)}
3601
3898
  }
3602
3899
  }
3603
3900
  try {
3604
- const module = await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(joinPaths(pluginPath, "plugin")));
3901
+ const module = await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(joinPaths$1(pluginPath, "plugin")));
3605
3902
  const result = module.plugin ?? module.default;
3606
3903
  if (!result) {
3607
3904
  throw new Error(`The plugin package "${pluginPath}" does not export a valid module.`);
@@ -3629,4 +3926,4 @@ Note: Please ensure the plugin package's default export is a class that extends
3629
3926
  }
3630
3927
  };
3631
3928
 
3632
- export { PowerlinesAPI, createLog };
3929
+ export { FileData, FileIdentifier, FileMetadata, FileMetadata_KeyValuePair, FileSystemData, PowerlinesAPI, _capnpFileId, createLog };