powerlines 0.14.1 → 0.14.4

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 (728) hide show
  1. package/README.md +30 -21
  2. package/dist/_virtual/_rolldown/runtime.cjs +29 -0
  3. package/dist/_virtual/_rolldown/runtime.mjs +36 -0
  4. package/dist/api.cjs +10 -0
  5. package/dist/api.d.cts +2 -0
  6. package/dist/api.d.mts +2 -0
  7. package/dist/api.mjs +3 -0
  8. package/dist/astro.cjs +24 -28
  9. package/dist/astro.d.cts +14 -47
  10. package/dist/astro.d.cts.map +1 -0
  11. package/dist/astro.d.mts +25 -0
  12. package/dist/astro.d.mts.map +1 -0
  13. package/dist/astro.mjs +25 -0
  14. package/dist/astro.mjs.map +1 -0
  15. package/dist/config.cjs +9 -0
  16. package/dist/config.d.cts +1 -0
  17. package/dist/config.d.mts +1 -0
  18. package/dist/config.mjs +3 -0
  19. package/dist/constants.cjs +9 -0
  20. package/dist/constants.d.cts +1 -0
  21. package/dist/constants.d.mts +1 -0
  22. package/dist/constants.mjs +3 -0
  23. package/dist/context.cjs +9 -0
  24. package/dist/context.d.cts +1 -0
  25. package/dist/context.d.mts +1 -0
  26. package/dist/context.mjs +3 -0
  27. package/dist/engine.cjs +30 -0
  28. package/dist/engine.d.cts +24 -0
  29. package/dist/engine.d.cts.map +1 -0
  30. package/dist/engine.d.mts +24 -0
  31. package/dist/engine.d.mts.map +1 -0
  32. package/dist/engine.mjs +29 -0
  33. package/dist/engine.mjs.map +1 -0
  34. package/dist/esbuild.cjs +51 -23
  35. package/dist/esbuild.d.cts +13 -45
  36. package/dist/esbuild.d.cts.map +1 -0
  37. package/dist/esbuild.d.mts +25 -0
  38. package/dist/esbuild.d.mts.map +1 -0
  39. package/dist/esbuild.mjs +43 -0
  40. package/dist/esbuild.mjs.map +1 -0
  41. package/dist/farm.cjs +26 -18
  42. package/dist/farm.d.cts +15 -47
  43. package/dist/farm.d.cts.map +1 -0
  44. package/dist/farm.d.mts +25 -0
  45. package/dist/farm.d.mts.map +1 -0
  46. package/dist/farm.mjs +26 -0
  47. package/dist/farm.mjs.map +1 -0
  48. package/dist/index.cjs +40 -91
  49. package/dist/index.d.cts +21 -60
  50. package/dist/index.d.cts.map +1 -0
  51. package/dist/index.d.mts +26 -0
  52. package/dist/index.d.mts.map +1 -0
  53. package/dist/index.mjs +34 -0
  54. package/dist/index.mjs.map +1 -0
  55. package/dist/next.cjs +35 -27
  56. package/dist/next.d.cts +6 -4
  57. package/dist/next.d.cts.map +1 -0
  58. package/dist/{next.d.ts → next.d.mts} +6 -4
  59. package/dist/next.d.mts.map +1 -0
  60. package/dist/next.mjs +36 -0
  61. package/dist/next.mjs.map +1 -0
  62. package/dist/nuxt.cjs +44 -29
  63. package/dist/nuxt.d.cts +19 -10
  64. package/dist/nuxt.d.cts.map +1 -0
  65. package/dist/nuxt.d.mts +29 -0
  66. package/dist/nuxt.d.mts.map +1 -0
  67. package/dist/nuxt.mjs +44 -0
  68. package/dist/nuxt.mjs.map +1 -0
  69. package/dist/package.cjs +18 -0
  70. package/dist/package.mjs +7 -0
  71. package/dist/package.mjs.map +1 -0
  72. package/dist/plugin-utils.cjs +9 -0
  73. package/dist/plugin-utils.d.cts +1 -0
  74. package/dist/plugin-utils.d.mts +1 -0
  75. package/dist/plugin-utils.mjs +3 -0
  76. package/dist/rolldown.cjs +43 -22
  77. package/dist/rolldown.d.cts +10 -43
  78. package/dist/rolldown.d.cts.map +1 -0
  79. package/dist/rolldown.d.mts +24 -0
  80. package/dist/rolldown.d.mts.map +1 -0
  81. package/dist/rolldown.mjs +35 -0
  82. package/dist/rolldown.mjs.map +1 -0
  83. package/dist/rollup.cjs +34 -22
  84. package/dist/rollup.d.cts +11 -43
  85. package/dist/rollup.d.cts.map +1 -0
  86. package/dist/rollup.d.mts +25 -0
  87. package/dist/rollup.d.mts.map +1 -0
  88. package/dist/rollup.mjs +26 -0
  89. package/dist/rollup.mjs.map +1 -0
  90. package/dist/rspack.cjs +34 -22
  91. package/dist/rspack.d.cts +14 -46
  92. package/dist/rspack.d.cts.map +1 -0
  93. package/dist/rspack.d.mts +25 -0
  94. package/dist/rspack.d.mts.map +1 -0
  95. package/dist/rspack.mjs +26 -0
  96. package/dist/rspack.mjs.map +1 -0
  97. package/dist/schemas.cjs +9 -0
  98. package/dist/schemas.d.cts +1 -0
  99. package/dist/schemas.d.mts +1 -0
  100. package/dist/schemas.mjs +3 -0
  101. package/dist/storage.cjs +9 -0
  102. package/dist/storage.d.cts +1 -0
  103. package/dist/storage.d.mts +1 -0
  104. package/dist/storage.mjs +3 -0
  105. package/dist/tsdown.cjs +96 -0
  106. package/dist/tsdown.d.cts +31 -0
  107. package/dist/tsdown.d.cts.map +1 -0
  108. package/dist/tsdown.d.mts +31 -0
  109. package/dist/tsdown.d.mts.map +1 -0
  110. package/dist/tsdown.mjs +82 -0
  111. package/dist/tsdown.mjs.map +1 -0
  112. package/dist/tsup.cjs +67 -24
  113. package/dist/tsup.d.cts +12 -8
  114. package/dist/tsup.d.cts.map +1 -0
  115. package/dist/{tsup.d.ts → tsup.d.mts} +12 -8
  116. package/dist/tsup.d.mts.map +1 -0
  117. package/dist/tsup.mjs +59 -0
  118. package/dist/tsup.mjs.map +1 -0
  119. package/dist/types.cjs +0 -0
  120. package/dist/types.d.cts +8 -0
  121. package/dist/types.d.cts.map +1 -0
  122. package/dist/types.d.mts +8 -0
  123. package/dist/types.d.mts.map +1 -0
  124. package/dist/types.mjs +1 -0
  125. package/dist/typescript.cjs +9 -0
  126. package/dist/typescript.d.cts +1 -0
  127. package/dist/typescript.d.mts +1 -0
  128. package/dist/typescript.mjs +3 -0
  129. package/dist/unbuild.cjs +17 -0
  130. package/dist/unbuild.d.cts +2 -0
  131. package/dist/unbuild.d.mts +2 -0
  132. package/dist/unbuild.mjs +3 -0
  133. package/dist/unloader.cjs +23 -26
  134. package/dist/unloader.d.cts +11 -45
  135. package/dist/unloader.d.cts.map +1 -0
  136. package/dist/unloader.d.mts +22 -0
  137. package/dist/unloader.d.mts.map +1 -0
  138. package/dist/unloader.mjs +23 -0
  139. package/dist/unloader.mjs.map +1 -0
  140. package/dist/unplugin.cjs +105 -37
  141. package/dist/unplugin.d.cts +9 -69
  142. package/dist/unplugin.d.cts.map +1 -0
  143. package/dist/unplugin.d.mts +17 -0
  144. package/dist/unplugin.d.mts.map +1 -0
  145. package/dist/unplugin.mjs +101 -0
  146. package/dist/unplugin.mjs.map +1 -0
  147. package/dist/utils.cjs +25 -0
  148. package/dist/utils.d.cts +3 -0
  149. package/dist/utils.d.mts +3 -0
  150. package/dist/utils.mjs +7 -0
  151. package/dist/vite.cjs +76 -24
  152. package/dist/vite.d.cts +12 -44
  153. package/dist/vite.d.cts.map +1 -0
  154. package/dist/vite.d.mts +25 -0
  155. package/dist/vite.d.mts.map +1 -0
  156. package/dist/vite.mjs +66 -0
  157. package/dist/vite.mjs.map +1 -0
  158. package/dist/webpack.cjs +34 -23
  159. package/dist/webpack.d.cts +10 -43
  160. package/dist/webpack.d.cts.map +1 -0
  161. package/dist/webpack.d.mts +24 -0
  162. package/dist/webpack.d.mts.map +1 -0
  163. package/dist/webpack.mjs +25 -0
  164. package/dist/webpack.mjs.map +1 -0
  165. package/files/application/README.md.hbs +16 -42
  166. package/files/application/package.json.hbs +7 -28
  167. package/files/common/jest.config.ts.hbs +2 -3
  168. package/files/common/tsconfig.json.hbs +5 -10
  169. package/files/common/tsconfig.spec.json.hbs +3 -13
  170. package/files/library/README.md.hbs +11 -34
  171. package/files/library/package.json.hbs +9 -32
  172. package/package.json +253 -342
  173. package/schemas/fs.capnp +42 -0
  174. package/dist/astro.d.ts +0 -58
  175. package/dist/astro.js +0 -11
  176. package/dist/babel-types.d.ts +0 -292
  177. package/dist/chunk-22K72CJ5.cjs +0 -18
  178. package/dist/chunk-2OGPXWHG.js +0 -21
  179. package/dist/chunk-2VIXD2XB.js +0 -3
  180. package/dist/chunk-3IM6CTCB.cjs +0 -12
  181. package/dist/chunk-4AKYOJXA.cjs +0 -20
  182. package/dist/chunk-4FZTGBHW.cjs +0 -12
  183. package/dist/chunk-4HGQJ4KR.js +0 -11
  184. package/dist/chunk-4JCNAKOE.cjs +0 -4
  185. package/dist/chunk-5A5AK6JI.js +0 -31
  186. package/dist/chunk-5S33UKRI.js +0 -9
  187. package/dist/chunk-5VPVJHJO.cjs +0 -18
  188. package/dist/chunk-6TJGZR5X.js +0 -46
  189. package/dist/chunk-6ZGIV2SU.cjs +0 -4
  190. package/dist/chunk-7BZQBW77.cjs +0 -4
  191. package/dist/chunk-7GVRTQLJ.js +0 -16
  192. package/dist/chunk-7HF3SEKY.cjs +0 -24
  193. package/dist/chunk-7QQZH7V2.js +0 -9
  194. package/dist/chunk-7QVYU63E.js +0 -6
  195. package/dist/chunk-AFJCY3R6.js +0 -3
  196. package/dist/chunk-APVMN2H7.cjs +0 -14
  197. package/dist/chunk-AXIRZAL7.js +0 -3
  198. package/dist/chunk-DFLNRC3B.cjs +0 -4
  199. package/dist/chunk-DS7OM4NX.cjs +0 -4
  200. package/dist/chunk-DURCSSLV.js +0 -3
  201. package/dist/chunk-EBMELFCF.js +0 -12
  202. package/dist/chunk-GC3BRYAK.cjs +0 -13
  203. package/dist/chunk-GIE6OE3X.js +0 -3
  204. package/dist/chunk-HJW7OH6E.js +0 -3
  205. package/dist/chunk-IHUNA3MO.cjs +0 -4
  206. package/dist/chunk-KMLFL4CW.js +0 -14
  207. package/dist/chunk-LO77RPRV.js +0 -16
  208. package/dist/chunk-M6XRJI44.js +0 -9
  209. package/dist/chunk-MW2CYPK5.cjs +0 -34
  210. package/dist/chunk-N2RUZCWA.js +0 -9
  211. package/dist/chunk-N6L2CYXV.js +0 -21
  212. package/dist/chunk-NVNMK4CE.js +0 -39
  213. package/dist/chunk-O7GICJVN.cjs +0 -116
  214. package/dist/chunk-OYASPHNL.js +0 -3
  215. package/dist/chunk-P4BOYWXT.js +0 -3570
  216. package/dist/chunk-PJRHRDLS.cjs +0 -3602
  217. package/dist/chunk-PK6SKIKE.cjs +0 -8
  218. package/dist/chunk-Q7EJVZVI.cjs +0 -4
  219. package/dist/chunk-RIOZPUCZ.cjs +0 -34
  220. package/dist/chunk-SIZKRND7.js +0 -12
  221. package/dist/chunk-TLHFXGYV.js +0 -3
  222. package/dist/chunk-TLRPAJU2.cjs +0 -12
  223. package/dist/chunk-TSWMWZ4U.cjs +0 -12
  224. package/dist/chunk-UFEM5JTE.cjs +0 -42
  225. package/dist/chunk-UZQYBO6Z.cjs +0 -52
  226. package/dist/chunk-V7LXFIGK.js +0 -199
  227. package/dist/chunk-VNRXLY2T.js +0 -3
  228. package/dist/chunk-VQCQRLGM.cjs +0 -4
  229. package/dist/chunk-WA6IOZHV.js +0 -109
  230. package/dist/chunk-WCTOTE3T.cjs +0 -201
  231. package/dist/chunk-XBF43VLE.cjs +0 -4
  232. package/dist/chunk-XZO6ZJQP.cjs +0 -4
  233. package/dist/chunk-Y5CDUGSN.cjs +0 -12
  234. package/dist/chunk-YFP5GQWW.js +0 -9
  235. package/dist/chunk-YIWHO6SW.cjs +0 -14
  236. package/dist/chunk-YQXNZNGK.js +0 -31
  237. package/dist/chunk-YTOIG4CV.cjs +0 -24
  238. package/dist/chunk-YZCTXGFH.js +0 -11
  239. package/dist/chunk-Z5H7LD6W.js +0 -3
  240. package/dist/chunk-ZEJHPSLK.cjs +0 -19
  241. package/dist/define-config.cjs +0 -13
  242. package/dist/define-config.d.cts +0 -50
  243. package/dist/define-config.d.ts +0 -50
  244. package/dist/define-config.js +0 -4
  245. package/dist/esbuild.d.ts +0 -57
  246. package/dist/esbuild.js +0 -10
  247. package/dist/extend-plugin.cjs +0 -13
  248. package/dist/extend-plugin.d.cts +0 -48
  249. package/dist/extend-plugin.d.ts +0 -48
  250. package/dist/extend-plugin.js +0 -4
  251. package/dist/farm.d.ts +0 -57
  252. package/dist/farm.js +0 -14
  253. package/dist/hooks-Wrj1dKJ9.d.cts +0 -28
  254. package/dist/hooks-q1Az_C64.d.ts +0 -28
  255. package/dist/index.d.ts +0 -65
  256. package/dist/index.js +0 -40
  257. package/dist/internal/api.cjs +0 -16
  258. package/dist/internal/api.cjs.map +0 -1
  259. package/dist/internal/api.d.cts +0 -192
  260. package/dist/internal/api.d.ts +0 -192
  261. package/dist/internal/api.js +0 -7
  262. package/dist/internal/api.js.map +0 -1
  263. package/dist/lib/build/esbuild.cjs +0 -22
  264. package/dist/lib/build/esbuild.cjs.map +0 -1
  265. package/dist/lib/build/esbuild.d.cts +0 -51
  266. package/dist/lib/build/esbuild.d.ts +0 -51
  267. package/dist/lib/build/esbuild.js +0 -5
  268. package/dist/lib/build/esbuild.js.map +0 -1
  269. package/dist/lib/build/index.cjs +0 -82
  270. package/dist/lib/build/index.cjs.map +0 -1
  271. package/dist/lib/build/index.d.cts +0 -41
  272. package/dist/lib/build/index.d.ts +0 -41
  273. package/dist/lib/build/index.js +0 -13
  274. package/dist/lib/build/index.js.map +0 -1
  275. package/dist/lib/build/rolldown.cjs +0 -14
  276. package/dist/lib/build/rolldown.cjs.map +0 -1
  277. package/dist/lib/build/rolldown.d.cts +0 -42
  278. package/dist/lib/build/rolldown.d.ts +0 -42
  279. package/dist/lib/build/rolldown.js +0 -5
  280. package/dist/lib/build/rolldown.js.map +0 -1
  281. package/dist/lib/build/rollup.cjs +0 -17
  282. package/dist/lib/build/rollup.cjs.map +0 -1
  283. package/dist/lib/build/rollup.d.cts +0 -49
  284. package/dist/lib/build/rollup.d.ts +0 -49
  285. package/dist/lib/build/rollup.js +0 -4
  286. package/dist/lib/build/rollup.js.map +0 -1
  287. package/dist/lib/build/rspack.cjs +0 -13
  288. package/dist/lib/build/rspack.cjs.map +0 -1
  289. package/dist/lib/build/rspack.d.cts +0 -42
  290. package/dist/lib/build/rspack.d.ts +0 -42
  291. package/dist/lib/build/rspack.js +0 -4
  292. package/dist/lib/build/rspack.js.map +0 -1
  293. package/dist/lib/build/tsup.cjs +0 -23
  294. package/dist/lib/build/tsup.cjs.map +0 -1
  295. package/dist/lib/build/tsup.d.cts +0 -51
  296. package/dist/lib/build/tsup.d.ts +0 -51
  297. package/dist/lib/build/tsup.js +0 -6
  298. package/dist/lib/build/tsup.js.map +0 -1
  299. package/dist/lib/build/unbuild.cjs +0 -23
  300. package/dist/lib/build/unbuild.cjs.map +0 -1
  301. package/dist/lib/build/unbuild.d.cts +0 -63
  302. package/dist/lib/build/unbuild.d.ts +0 -63
  303. package/dist/lib/build/unbuild.js +0 -6
  304. package/dist/lib/build/unbuild.js.map +0 -1
  305. package/dist/lib/build/vite.cjs +0 -19
  306. package/dist/lib/build/vite.cjs.map +0 -1
  307. package/dist/lib/build/vite.d.cts +0 -43
  308. package/dist/lib/build/vite.d.ts +0 -43
  309. package/dist/lib/build/vite.js +0 -6
  310. package/dist/lib/build/vite.js.map +0 -1
  311. package/dist/lib/build/webpack.cjs +0 -13
  312. package/dist/lib/build/webpack.cjs.map +0 -1
  313. package/dist/lib/build/webpack.d.cts +0 -42
  314. package/dist/lib/build/webpack.d.ts +0 -42
  315. package/dist/lib/build/webpack.js +0 -4
  316. package/dist/lib/build/webpack.js.map +0 -1
  317. package/dist/lib/chunk-35EO5Y7R.js +0 -50
  318. package/dist/lib/chunk-35EO5Y7R.js.map +0 -1
  319. package/dist/lib/chunk-367E23MI.js +0 -48
  320. package/dist/lib/chunk-367E23MI.js.map +0 -1
  321. package/dist/lib/chunk-3GMJQ5G3.cjs +0 -4
  322. package/dist/lib/chunk-3GMJQ5G3.cjs.map +0 -1
  323. package/dist/lib/chunk-3I2YOM2E.js +0 -58
  324. package/dist/lib/chunk-3I2YOM2E.js.map +0 -1
  325. package/dist/lib/chunk-4BPHC6QQ.js +0 -3
  326. package/dist/lib/chunk-4BPHC6QQ.js.map +0 -1
  327. package/dist/lib/chunk-4XUVP2LL.cjs +0 -39
  328. package/dist/lib/chunk-4XUVP2LL.cjs.map +0 -1
  329. package/dist/lib/chunk-56LQSSQ3.js +0 -62
  330. package/dist/lib/chunk-56LQSSQ3.js.map +0 -1
  331. package/dist/lib/chunk-5PNLONNN.cjs +0 -30
  332. package/dist/lib/chunk-5PNLONNN.cjs.map +0 -1
  333. package/dist/lib/chunk-62ZJYXT3.cjs +0 -54
  334. package/dist/lib/chunk-62ZJYXT3.cjs.map +0 -1
  335. package/dist/lib/chunk-632PWWU7.cjs +0 -57
  336. package/dist/lib/chunk-632PWWU7.cjs.map +0 -1
  337. package/dist/lib/chunk-6BRTJXZ2.js +0 -3333
  338. package/dist/lib/chunk-6BRTJXZ2.js.map +0 -1
  339. package/dist/lib/chunk-6IJTWIVJ.cjs +0 -107
  340. package/dist/lib/chunk-6IJTWIVJ.cjs.map +0 -1
  341. package/dist/lib/chunk-7EAV6Q7B.cjs +0 -78
  342. package/dist/lib/chunk-7EAV6Q7B.cjs.map +0 -1
  343. package/dist/lib/chunk-7LLECRBP.cjs +0 -41
  344. package/dist/lib/chunk-7LLECRBP.cjs.map +0 -1
  345. package/dist/lib/chunk-7QVYU63E.js +0 -6
  346. package/dist/lib/chunk-7QVYU63E.js.map +0 -1
  347. package/dist/lib/chunk-7R23HVGQ.js +0 -27
  348. package/dist/lib/chunk-7R23HVGQ.js.map +0 -1
  349. package/dist/lib/chunk-BEKLDCTV.cjs +0 -95
  350. package/dist/lib/chunk-BEKLDCTV.cjs.map +0 -1
  351. package/dist/lib/chunk-BW3VFCTS.cjs +0 -110
  352. package/dist/lib/chunk-BW3VFCTS.cjs.map +0 -1
  353. package/dist/lib/chunk-CAPN4FSS.js +0 -152
  354. package/dist/lib/chunk-CAPN4FSS.js.map +0 -1
  355. package/dist/lib/chunk-ESYYL5UH.js +0 -105
  356. package/dist/lib/chunk-ESYYL5UH.js.map +0 -1
  357. package/dist/lib/chunk-GJNFAFKR.cjs +0 -66
  358. package/dist/lib/chunk-GJNFAFKR.cjs.map +0 -1
  359. package/dist/lib/chunk-GWYTWFZE.cjs +0 -72
  360. package/dist/lib/chunk-GWYTWFZE.cjs.map +0 -1
  361. package/dist/lib/chunk-HJWJNSSZ.js +0 -3
  362. package/dist/lib/chunk-HJWJNSSZ.js.map +0 -1
  363. package/dist/lib/chunk-HQ6TGY34.js +0 -27
  364. package/dist/lib/chunk-HQ6TGY34.js.map +0 -1
  365. package/dist/lib/chunk-IK3ABDPP.cjs +0 -64
  366. package/dist/lib/chunk-IK3ABDPP.cjs.map +0 -1
  367. package/dist/lib/chunk-JTUL3477.cjs +0 -137
  368. package/dist/lib/chunk-JTUL3477.cjs.map +0 -1
  369. package/dist/lib/chunk-KOCDKJDJ.js +0 -96
  370. package/dist/lib/chunk-KOCDKJDJ.js.map +0 -1
  371. package/dist/lib/chunk-KSBESEOF.js +0 -169
  372. package/dist/lib/chunk-KSBESEOF.js.map +0 -1
  373. package/dist/lib/chunk-LBMMBFQE.js +0 -65
  374. package/dist/lib/chunk-LBMMBFQE.js.map +0 -1
  375. package/dist/lib/chunk-LEIOWD2W.js +0 -28
  376. package/dist/lib/chunk-LEIOWD2W.js.map +0 -1
  377. package/dist/lib/chunk-LJZEN4HP.cjs +0 -110
  378. package/dist/lib/chunk-LJZEN4HP.cjs.map +0 -1
  379. package/dist/lib/chunk-LTVWU4J2.js +0 -47
  380. package/dist/lib/chunk-LTVWU4J2.js.map +0 -1
  381. package/dist/lib/chunk-LYD5OTBI.cjs +0 -3362
  382. package/dist/lib/chunk-LYD5OTBI.cjs.map +0 -1
  383. package/dist/lib/chunk-MAHHHINV.js +0 -67
  384. package/dist/lib/chunk-MAHHHINV.js.map +0 -1
  385. package/dist/lib/chunk-MFC7UJHT.cjs +0 -30
  386. package/dist/lib/chunk-MFC7UJHT.cjs.map +0 -1
  387. package/dist/lib/chunk-MGEZC2RV.cjs +0 -69
  388. package/dist/lib/chunk-MGEZC2RV.cjs.map +0 -1
  389. package/dist/lib/chunk-MVQSM5WM.cjs +0 -73
  390. package/dist/lib/chunk-MVQSM5WM.cjs.map +0 -1
  391. package/dist/lib/chunk-NANLYIUO.cjs +0 -70
  392. package/dist/lib/chunk-NANLYIUO.cjs.map +0 -1
  393. package/dist/lib/chunk-NE46WXNJ.js +0 -58
  394. package/dist/lib/chunk-NE46WXNJ.js.map +0 -1
  395. package/dist/lib/chunk-ODJBZ6PS.js +0 -39
  396. package/dist/lib/chunk-ODJBZ6PS.js.map +0 -1
  397. package/dist/lib/chunk-OF5IJ4WG.js +0 -65
  398. package/dist/lib/chunk-OF5IJ4WG.js.map +0 -1
  399. package/dist/lib/chunk-OO4BIM7N.js +0 -98
  400. package/dist/lib/chunk-OO4BIM7N.js.map +0 -1
  401. package/dist/lib/chunk-PEZXLKQD.cjs +0 -4
  402. package/dist/lib/chunk-PEZXLKQD.cjs.map +0 -1
  403. package/dist/lib/chunk-PK6SKIKE.cjs +0 -8
  404. package/dist/lib/chunk-PK6SKIKE.cjs.map +0 -1
  405. package/dist/lib/chunk-PXSRMP4E.js +0 -39
  406. package/dist/lib/chunk-PXSRMP4E.js.map +0 -1
  407. package/dist/lib/chunk-Q2L3FNJO.js +0 -120
  408. package/dist/lib/chunk-Q2L3FNJO.js.map +0 -1
  409. package/dist/lib/chunk-Q3KJZ3B5.js +0 -161
  410. package/dist/lib/chunk-Q3KJZ3B5.js.map +0 -1
  411. package/dist/lib/chunk-RK2VVGL6.cjs +0 -107
  412. package/dist/lib/chunk-RK2VVGL6.cjs.map +0 -1
  413. package/dist/lib/chunk-RLMEYZ5I.cjs +0 -167
  414. package/dist/lib/chunk-RLMEYZ5I.cjs.map +0 -1
  415. package/dist/lib/chunk-RQICHHZM.cjs +0 -29
  416. package/dist/lib/chunk-RQICHHZM.cjs.map +0 -1
  417. package/dist/lib/chunk-RXQWNSZX.js +0 -37
  418. package/dist/lib/chunk-RXQWNSZX.js.map +0 -1
  419. package/dist/lib/chunk-STAKGAWR.js +0 -86
  420. package/dist/lib/chunk-STAKGAWR.js.map +0 -1
  421. package/dist/lib/chunk-U36VZLW6.cjs +0 -172
  422. package/dist/lib/chunk-U36VZLW6.cjs.map +0 -1
  423. package/dist/lib/chunk-UGRFAVAJ.js +0 -93
  424. package/dist/lib/chunk-UGRFAVAJ.js.map +0 -1
  425. package/dist/lib/chunk-UQJWVRRE.cjs +0 -47
  426. package/dist/lib/chunk-UQJWVRRE.cjs.map +0 -1
  427. package/dist/lib/chunk-V2T4H24I.js +0 -156
  428. package/dist/lib/chunk-V2T4H24I.js.map +0 -1
  429. package/dist/lib/chunk-V5OY4ALI.cjs +0 -56
  430. package/dist/lib/chunk-V5OY4ALI.cjs.map +0 -1
  431. package/dist/lib/chunk-VJN72T2O.js +0 -50
  432. package/dist/lib/chunk-VJN72T2O.js.map +0 -1
  433. package/dist/lib/chunk-W4OMKQ7W.cjs +0 -128
  434. package/dist/lib/chunk-W4OMKQ7W.cjs.map +0 -1
  435. package/dist/lib/chunk-XGH6JWRO.js +0 -3
  436. package/dist/lib/chunk-XGH6JWRO.js.map +0 -1
  437. package/dist/lib/chunk-XQMVE2NH.cjs +0 -4
  438. package/dist/lib/chunk-XQMVE2NH.cjs.map +0 -1
  439. package/dist/lib/chunk-XZD7S5TU.cjs +0 -53
  440. package/dist/lib/chunk-XZD7S5TU.cjs.map +0 -1
  441. package/dist/lib/chunk-YBIWVB66.js +0 -76
  442. package/dist/lib/chunk-YBIWVB66.js.map +0 -1
  443. package/dist/lib/chunk-YF3YHK4X.js +0 -127
  444. package/dist/lib/chunk-YF3YHK4X.js.map +0 -1
  445. package/dist/lib/chunk-YVDJCVE5.cjs +0 -160
  446. package/dist/lib/chunk-YVDJCVE5.cjs.map +0 -1
  447. package/dist/lib/chunk-ZP7PDTVE.cjs +0 -167
  448. package/dist/lib/chunk-ZP7PDTVE.cjs.map +0 -1
  449. package/dist/lib/compiler-CuQLTmTB.d.cts +0 -32
  450. package/dist/lib/compiler-CuQLTmTB.d.ts +0 -32
  451. package/dist/lib/config-DnifzkPt.d.ts +0 -1474
  452. package/dist/lib/config-Ro14HmyO.d.cts +0 -1474
  453. package/dist/lib/config-file.cjs +0 -17
  454. package/dist/lib/config-file.cjs.map +0 -1
  455. package/dist/lib/config-file.d.cts +0 -57
  456. package/dist/lib/config-file.d.ts +0 -57
  457. package/dist/lib/config-file.js +0 -4
  458. package/dist/lib/config-file.js.map +0 -1
  459. package/dist/lib/create-program.cjs +0 -13
  460. package/dist/lib/create-program.cjs.map +0 -1
  461. package/dist/lib/create-program.d.cts +0 -42
  462. package/dist/lib/create-program.d.ts +0 -42
  463. package/dist/lib/create-program.js +0 -4
  464. package/dist/lib/create-program.js.map +0 -1
  465. package/dist/lib/entry.cjs +0 -41
  466. package/dist/lib/entry.cjs.map +0 -1
  467. package/dist/lib/entry.d.cts +0 -69
  468. package/dist/lib/entry.d.ts +0 -69
  469. package/dist/lib/entry.js +0 -4
  470. package/dist/lib/entry.js.map +0 -1
  471. package/dist/lib/hooks-B6Ow5MtE.d.ts +0 -28
  472. package/dist/lib/hooks-CM-BbMzz.d.cts +0 -28
  473. package/dist/lib/index.cjs +0 -281
  474. package/dist/lib/index.cjs.map +0 -1
  475. package/dist/lib/index.d.cts +0 -57
  476. package/dist/lib/index.d.ts +0 -57
  477. package/dist/lib/index.js +0 -28
  478. package/dist/lib/index.js.map +0 -1
  479. package/dist/lib/logger.cjs +0 -17
  480. package/dist/lib/logger.cjs.map +0 -1
  481. package/dist/lib/logger.d.cts +0 -51
  482. package/dist/lib/logger.d.ts +0 -51
  483. package/dist/lib/logger.js +0 -4
  484. package/dist/lib/logger.js.map +0 -1
  485. package/dist/lib/tsconfig-Bz-CiFqD.d.cts +0 -68
  486. package/dist/lib/tsconfig-Bz-CiFqD.d.ts +0 -68
  487. package/dist/lib/typescript/compiler-host.cjs +0 -166
  488. package/dist/lib/typescript/compiler-host.cjs.map +0 -1
  489. package/dist/lib/typescript/compiler-host.d.cts +0 -64
  490. package/dist/lib/typescript/compiler-host.d.ts +0 -64
  491. package/dist/lib/typescript/compiler-host.js +0 -158
  492. package/dist/lib/typescript/compiler-host.js.map +0 -1
  493. package/dist/lib/typescript/import-transformer.cjs +0 -51
  494. package/dist/lib/typescript/import-transformer.cjs.map +0 -1
  495. package/dist/lib/typescript/import-transformer.d.cts +0 -36
  496. package/dist/lib/typescript/import-transformer.d.ts +0 -36
  497. package/dist/lib/typescript/import-transformer.js +0 -49
  498. package/dist/lib/typescript/import-transformer.js.map +0 -1
  499. package/dist/lib/typescript/index.cjs +0 -60
  500. package/dist/lib/typescript/index.cjs.map +0 -1
  501. package/dist/lib/typescript/index.d.cts +0 -35
  502. package/dist/lib/typescript/index.d.ts +0 -35
  503. package/dist/lib/typescript/index.js +0 -7
  504. package/dist/lib/typescript/index.js.map +0 -1
  505. package/dist/lib/typescript/isolated-decl.cjs +0 -13
  506. package/dist/lib/typescript/isolated-decl.cjs.map +0 -1
  507. package/dist/lib/typescript/isolated-decl.d.cts +0 -11
  508. package/dist/lib/typescript/isolated-decl.d.ts +0 -11
  509. package/dist/lib/typescript/isolated-decl.js +0 -4
  510. package/dist/lib/typescript/isolated-decl.js.map +0 -1
  511. package/dist/lib/typescript/program.cjs +0 -29
  512. package/dist/lib/typescript/program.cjs.map +0 -1
  513. package/dist/lib/typescript/program.d.cts +0 -69
  514. package/dist/lib/typescript/program.d.ts +0 -69
  515. package/dist/lib/typescript/program.js +0 -4
  516. package/dist/lib/typescript/program.js.map +0 -1
  517. package/dist/lib/typescript/tsconfig.cjs +0 -33
  518. package/dist/lib/typescript/tsconfig.cjs.map +0 -1
  519. package/dist/lib/typescript/tsconfig.d.cts +0 -61
  520. package/dist/lib/typescript/tsconfig.d.ts +0 -61
  521. package/dist/lib/typescript/tsconfig.js +0 -4
  522. package/dist/lib/typescript/tsconfig.js.map +0 -1
  523. package/dist/lib/unplugin/factory.cjs +0 -23
  524. package/dist/lib/unplugin/factory.cjs.map +0 -1
  525. package/dist/lib/unplugin/factory.d.cts +0 -200
  526. package/dist/lib/unplugin/factory.d.ts +0 -200
  527. package/dist/lib/unplugin/factory.js +0 -14
  528. package/dist/lib/unplugin/factory.js.map +0 -1
  529. package/dist/lib/unplugin/index.cjs +0 -33
  530. package/dist/lib/unplugin/index.cjs.map +0 -1
  531. package/dist/lib/unplugin/index.d.cts +0 -36
  532. package/dist/lib/unplugin/index.d.ts +0 -36
  533. package/dist/lib/unplugin/index.js +0 -16
  534. package/dist/lib/unplugin/index.js.map +0 -1
  535. package/dist/lib/unplugin/plugin.cjs +0 -16
  536. package/dist/lib/unplugin/plugin.cjs.map +0 -1
  537. package/dist/lib/unplugin/plugin.d.cts +0 -55
  538. package/dist/lib/unplugin/plugin.d.ts +0 -55
  539. package/dist/lib/unplugin/plugin.js +0 -7
  540. package/dist/lib/unplugin/plugin.js.map +0 -1
  541. package/dist/lib/unplugin/resolve-id.cjs +0 -13
  542. package/dist/lib/unplugin/resolve-id.cjs.map +0 -1
  543. package/dist/lib/unplugin/resolve-id.d.cts +0 -60
  544. package/dist/lib/unplugin/resolve-id.d.ts +0 -60
  545. package/dist/lib/unplugin/resolve-id.js +0 -4
  546. package/dist/lib/unplugin/resolve-id.js.map +0 -1
  547. package/dist/lib/utilities/bundle.cjs +0 -16
  548. package/dist/lib/utilities/bundle.cjs.map +0 -1
  549. package/dist/lib/utilities/bundle.d.cts +0 -44
  550. package/dist/lib/utilities/bundle.d.ts +0 -44
  551. package/dist/lib/utilities/bundle.js +0 -7
  552. package/dist/lib/utilities/bundle.js.map +0 -1
  553. package/dist/lib/utilities/cache.cjs +0 -18
  554. package/dist/lib/utilities/cache.cjs.map +0 -1
  555. package/dist/lib/utilities/cache.d.cts +0 -7
  556. package/dist/lib/utilities/cache.d.ts +0 -7
  557. package/dist/lib/utilities/cache.js +0 -5
  558. package/dist/lib/utilities/cache.js.map +0 -1
  559. package/dist/lib/utilities/file-header.cjs +0 -17
  560. package/dist/lib/utilities/file-header.cjs.map +0 -1
  561. package/dist/lib/utilities/file-header.d.cts +0 -42
  562. package/dist/lib/utilities/file-header.d.ts +0 -42
  563. package/dist/lib/utilities/file-header.js +0 -4
  564. package/dist/lib/utilities/file-header.js.map +0 -1
  565. package/dist/lib/utilities/index.cjs +0 -159
  566. package/dist/lib/utilities/index.cjs.map +0 -1
  567. package/dist/lib/utilities/index.d.cts +0 -45
  568. package/dist/lib/utilities/index.d.ts +0 -45
  569. package/dist/lib/utilities/index.js +0 -18
  570. package/dist/lib/utilities/index.js.map +0 -1
  571. package/dist/lib/utilities/meta.cjs +0 -37
  572. package/dist/lib/utilities/meta.cjs.map +0 -1
  573. package/dist/lib/utilities/meta.d.cts +0 -68
  574. package/dist/lib/utilities/meta.d.ts +0 -68
  575. package/dist/lib/utilities/meta.js +0 -4
  576. package/dist/lib/utilities/meta.js.map +0 -1
  577. package/dist/lib/utilities/plugin-helpers.cjs +0 -61
  578. package/dist/lib/utilities/plugin-helpers.cjs.map +0 -1
  579. package/dist/lib/utilities/plugin-helpers.d.cts +0 -153
  580. package/dist/lib/utilities/plugin-helpers.d.ts +0 -153
  581. package/dist/lib/utilities/plugin-helpers.js +0 -4
  582. package/dist/lib/utilities/plugin-helpers.js.map +0 -1
  583. package/dist/lib/utilities/resolve-path.cjs +0 -13
  584. package/dist/lib/utilities/resolve-path.cjs.map +0 -1
  585. package/dist/lib/utilities/resolve-path.d.cts +0 -43
  586. package/dist/lib/utilities/resolve-path.d.ts +0 -43
  587. package/dist/lib/utilities/resolve-path.js +0 -4
  588. package/dist/lib/utilities/resolve-path.js.map +0 -1
  589. package/dist/lib/utilities/resolve.cjs +0 -17
  590. package/dist/lib/utilities/resolve.cjs.map +0 -1
  591. package/dist/lib/utilities/resolve.d.cts +0 -44
  592. package/dist/lib/utilities/resolve.d.ts +0 -44
  593. package/dist/lib/utilities/resolve.js +0 -8
  594. package/dist/lib/utilities/resolve.js.map +0 -1
  595. package/dist/lib/utilities/source-file.cjs +0 -21
  596. package/dist/lib/utilities/source-file.cjs.map +0 -1
  597. package/dist/lib/utilities/source-file.d.cts +0 -28
  598. package/dist/lib/utilities/source-file.d.ts +0 -28
  599. package/dist/lib/utilities/source-file.js +0 -4
  600. package/dist/lib/utilities/source-file.js.map +0 -1
  601. package/dist/lib/utilities/source-map.cjs +0 -13
  602. package/dist/lib/utilities/source-map.cjs.map +0 -1
  603. package/dist/lib/utilities/source-map.d.cts +0 -14
  604. package/dist/lib/utilities/source-map.d.ts +0 -14
  605. package/dist/lib/utilities/source-map.js +0 -4
  606. package/dist/lib/utilities/source-map.js.map +0 -1
  607. package/dist/lib/utilities/worker.cjs +0 -18
  608. package/dist/lib/utilities/worker.cjs.map +0 -1
  609. package/dist/lib/utilities/worker.d.cts +0 -58
  610. package/dist/lib/utilities/worker.d.ts +0 -58
  611. package/dist/lib/utilities/worker.js +0 -5
  612. package/dist/lib/utilities/worker.js.map +0 -1
  613. package/dist/lib/utilities/write-file.cjs +0 -13
  614. package/dist/lib/utilities/write-file.cjs.map +0 -1
  615. package/dist/lib/utilities/write-file.d.cts +0 -44
  616. package/dist/lib/utilities/write-file.d.ts +0 -44
  617. package/dist/lib/utilities/write-file.js +0 -4
  618. package/dist/lib/utilities/write-file.js.map +0 -1
  619. package/dist/next.js +0 -10
  620. package/dist/nuxt.d.ts +0 -20
  621. package/dist/nuxt.js +0 -12
  622. package/dist/resolved-DtY60yLh.d.cts +0 -1351
  623. package/dist/resolved-wPXZS7aW.d.ts +0 -1351
  624. package/dist/rolldown.d.ts +0 -57
  625. package/dist/rolldown.js +0 -9
  626. package/dist/rollup.d.ts +0 -57
  627. package/dist/rollup.js +0 -9
  628. package/dist/rspack.d.ts +0 -57
  629. package/dist/rspack.js +0 -9
  630. package/dist/tsup.js +0 -11
  631. package/dist/types/babel.cjs +0 -6
  632. package/dist/types/babel.cjs.map +0 -1
  633. package/dist/types/babel.d.cts +0 -38
  634. package/dist/types/babel.d.ts +0 -38
  635. package/dist/types/babel.js +0 -3
  636. package/dist/types/babel.js.map +0 -1
  637. package/dist/types/build.cjs +0 -6
  638. package/dist/types/build.cjs.map +0 -1
  639. package/dist/types/build.d.cts +0 -111
  640. package/dist/types/build.d.ts +0 -111
  641. package/dist/types/build.js +0 -3
  642. package/dist/types/build.js.map +0 -1
  643. package/dist/types/commands.cjs +0 -13
  644. package/dist/types/commands.cjs.map +0 -1
  645. package/dist/types/commands.d.cts +0 -38
  646. package/dist/types/commands.d.ts +0 -38
  647. package/dist/types/commands.js +0 -4
  648. package/dist/types/commands.js.map +0 -1
  649. package/dist/types/compiler.cjs +0 -6
  650. package/dist/types/compiler.cjs.map +0 -1
  651. package/dist/types/compiler.d.cts +0 -38
  652. package/dist/types/compiler.d.ts +0 -38
  653. package/dist/types/compiler.js +0 -3
  654. package/dist/types/compiler.js.map +0 -1
  655. package/dist/types/config.cjs +0 -6
  656. package/dist/types/config.cjs.map +0 -1
  657. package/dist/types/config.d.cts +0 -38
  658. package/dist/types/config.d.ts +0 -38
  659. package/dist/types/config.js +0 -3
  660. package/dist/types/config.js.map +0 -1
  661. package/dist/types/context.cjs +0 -13
  662. package/dist/types/context.cjs.map +0 -1
  663. package/dist/types/context.d.cts +0 -38
  664. package/dist/types/context.d.ts +0 -38
  665. package/dist/types/context.js +0 -4
  666. package/dist/types/context.js.map +0 -1
  667. package/dist/types/hooks.cjs +0 -6
  668. package/dist/types/hooks.cjs.map +0 -1
  669. package/dist/types/hooks.d.cts +0 -38
  670. package/dist/types/hooks.d.ts +0 -38
  671. package/dist/types/hooks.js +0 -3
  672. package/dist/types/hooks.js.map +0 -1
  673. package/dist/types/index.cjs +0 -58
  674. package/dist/types/index.cjs.map +0 -1
  675. package/dist/types/index.d.cts +0 -42
  676. package/dist/types/index.d.ts +0 -42
  677. package/dist/types/index.js +0 -17
  678. package/dist/types/index.js.map +0 -1
  679. package/dist/types/internal.cjs +0 -4
  680. package/dist/types/internal.cjs.map +0 -1
  681. package/dist/types/internal.d.cts +0 -61
  682. package/dist/types/internal.d.ts +0 -61
  683. package/dist/types/internal.js +0 -3
  684. package/dist/types/internal.js.map +0 -1
  685. package/dist/types/plugin.cjs +0 -13
  686. package/dist/types/plugin.cjs.map +0 -1
  687. package/dist/types/plugin.d.cts +0 -38
  688. package/dist/types/plugin.d.ts +0 -38
  689. package/dist/types/plugin.js +0 -4
  690. package/dist/types/plugin.js.map +0 -1
  691. package/dist/types/resolved.cjs +0 -6
  692. package/dist/types/resolved.cjs.map +0 -1
  693. package/dist/types/resolved.d.cts +0 -38
  694. package/dist/types/resolved.d.ts +0 -38
  695. package/dist/types/resolved.js +0 -3
  696. package/dist/types/resolved.js.map +0 -1
  697. package/dist/types/tsconfig.cjs +0 -6
  698. package/dist/types/tsconfig.cjs.map +0 -1
  699. package/dist/types/tsconfig.d.cts +0 -75
  700. package/dist/types/tsconfig.d.ts +0 -75
  701. package/dist/types/tsconfig.js +0 -3
  702. package/dist/types/tsconfig.js.map +0 -1
  703. package/dist/types/typedoc.cjs +0 -6
  704. package/dist/types/typedoc.cjs.map +0 -1
  705. package/dist/types/typedoc.d.cts +0 -25
  706. package/dist/types/typedoc.d.ts +0 -25
  707. package/dist/types/typedoc.js +0 -3
  708. package/dist/types/typedoc.js.map +0 -1
  709. package/dist/types/unplugin.cjs +0 -6
  710. package/dist/types/unplugin.cjs.map +0 -1
  711. package/dist/types/unplugin.d.cts +0 -54
  712. package/dist/types/unplugin.d.ts +0 -54
  713. package/dist/types/unplugin.js +0 -3
  714. package/dist/types/unplugin.js.map +0 -1
  715. package/dist/types/vfs.cjs +0 -33
  716. package/dist/types/vfs.cjs.map +0 -1
  717. package/dist/types/vfs.d.cts +0 -408
  718. package/dist/types/vfs.d.ts +0 -408
  719. package/dist/types/vfs.js +0 -4
  720. package/dist/types/vfs.js.map +0 -1
  721. package/dist/unloader.d.ts +0 -56
  722. package/dist/unloader.js +0 -9
  723. package/dist/unplugin.d.ts +0 -77
  724. package/dist/unplugin.js +0 -21
  725. package/dist/vite.d.ts +0 -57
  726. package/dist/vite.js +0 -10
  727. package/dist/webpack.d.ts +0 -57
  728. package/dist/webpack.js +0 -9
@@ -1,3362 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkRQICHHZM_cjs = require('./chunk-RQICHHZM.cjs');
4
- var chunkMFC7UJHT_cjs = require('./chunk-MFC7UJHT.cjs');
5
- var chunkBW3VFCTS_cjs = require('./chunk-BW3VFCTS.cjs');
6
- var chunkRK2VVGL6_cjs = require('./chunk-RK2VVGL6.cjs');
7
- var chunk7EAV6Q7B_cjs = require('./chunk-7EAV6Q7B.cjs');
8
- var chunkLJZEN4HP_cjs = require('./chunk-LJZEN4HP.cjs');
9
- var chunkMGEZC2RV_cjs = require('./chunk-MGEZC2RV.cjs');
10
- var chunk632PWWU7_cjs = require('./chunk-632PWWU7.cjs');
11
- var chunkUQJWVRRE_cjs = require('./chunk-UQJWVRRE.cjs');
12
- var chunkBEKLDCTV_cjs = require('./chunk-BEKLDCTV.cjs');
13
- var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
14
- var types = require('@storm-software/config-tools/types');
15
- var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
16
- var bundleRequire = require('bundle-require');
17
- var console = require('@storm-software/config-tools/logger/console');
18
- var toArray = require('@stryke/convert/to-array');
19
- var copyFile = require('@stryke/fs/copy-file');
20
- var exists = require('@stryke/fs/exists');
21
- var helpers = require('@stryke/fs/helpers');
22
- var install = require('@stryke/fs/install');
23
- var listFiles = require('@stryke/fs/list-files');
24
- var packageFns = require('@stryke/fs/package-fns');
25
- var joinPaths = require('@stryke/path/join-paths');
26
- var replace = require('@stryke/path/replace');
27
- var isError = require('@stryke/type-checks/is-error');
28
- var isFunction = require('@stryke/type-checks/is-function');
29
- var isNumber = require('@stryke/type-checks/is-number');
30
- var isPromise = require('@stryke/type-checks/is-promise');
31
- var isSet = require('@stryke/type-checks/is-set');
32
- var isSetObject = require('@stryke/type-checks/is-set-object');
33
- var isSetString = require('@stryke/type-checks/is-set-string');
34
- var chalk4 = require('chalk');
35
- var Handlebars = require('handlebars');
36
- var resolve = require('@stryke/fs/resolve');
37
- var titleCase = require('@stryke/string-format/title-case');
38
- var defu3 = require('defu');
39
- var getEnvPaths = require('@stryke/env/get-env-paths');
40
- var json = require('@stryke/fs/json');
41
- var murmurhash = require('@stryke/hash/murmurhash');
42
- var getUnique = require('@stryke/helpers/get-unique');
43
- var omit = require('@stryke/helpers/omit');
44
- var append = require('@stryke/path/append');
45
- var filePathFns = require('@stryke/path/file-path-fns');
46
- var isType = require('@stryke/path/is-type');
47
- var join = require('@stryke/path/join');
48
- var isNull = require('@stryke/type-checks/is-null');
49
- var isString = require('@stryke/type-checks/is-string');
50
- var uuid = require('@stryke/unique-id/uuid');
51
- var oxcParser = require('oxc-parser');
52
- var jiti = require('jiti');
53
- var bufferToString = require('@stryke/convert/buffer-to-string');
54
- var isParentPath = require('@stryke/path/is-parent-path');
55
- var prettyBytes = require('@stryke/string-format/pretty-bytes');
56
- var isBuffer = require('@stryke/type-checks/is-buffer');
57
- var isUndefined = require('@stryke/type-checks/is-undefined');
58
- var memfs = require('memfs');
59
- var buffer = require('buffer');
60
- var fs = require('fs');
61
- var prettier = require('prettier');
62
- var unionfs = require('unionfs');
63
- var isObject = require('@stryke/type-checks/is-object');
64
- var core = require('@babel/core');
65
- var ts = require('typescript');
66
- var helperPluginUtils = require('@babel/helper-plugin-utils');
67
- var t = require('@babel/types');
68
- var _package = require('@stryke/string-format/package');
69
- var superdiff = require('@donedeal0/superdiff');
70
- var tsconfig = require('@stryke/fs/tsconfig');
71
- var stormJson = require('@stryke/json/storm-json');
72
-
73
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
74
-
75
- function _interopNamespace(e) {
76
- if (e && e.__esModule) return e;
77
- var n = Object.create(null);
78
- if (e) {
79
- Object.keys(e).forEach(function (k) {
80
- if (k !== 'default') {
81
- var d = Object.getOwnPropertyDescriptor(e, k);
82
- Object.defineProperty(n, k, d.get ? d : {
83
- enumerable: true,
84
- get: function () { return e[k]; }
85
- });
86
- }
87
- });
88
- }
89
- n.default = e;
90
- return Object.freeze(n);
91
- }
92
-
93
- var chalk4__default = /*#__PURE__*/_interopDefault(chalk4);
94
- var Handlebars__default = /*#__PURE__*/_interopDefault(Handlebars);
95
- var defu3__default = /*#__PURE__*/_interopDefault(defu3);
96
- var fs__default = /*#__PURE__*/_interopDefault(fs);
97
- var ts__default = /*#__PURE__*/_interopDefault(ts);
98
- var t__namespace = /*#__PURE__*/_interopNamespace(t);
99
-
100
- var DEFAULT_ENVIRONMENT = "default";
101
- function createEnvironment(name, userConfig) {
102
- return defu3__default.default(userConfig.environments?.[name] ?? {}, {
103
- name,
104
- title: userConfig.title || titleCase.titleCase(userConfig.name),
105
- ssr: false,
106
- mainFields: userConfig.build?.platform === "browser" ? [
107
- "browser",
108
- "module",
109
- "jsnext:main",
110
- "jsnext"
111
- ] : [
112
- "module",
113
- "jsnext:main",
114
- "jsnext"
115
- ],
116
- extensions: [
117
- ".mjs",
118
- ".js",
119
- ".mts",
120
- ".ts",
121
- ".jsx",
122
- ".tsx",
123
- ".json"
124
- ],
125
- consumer: userConfig.build?.platform === "browser" ? "client" : "server",
126
- preview: userConfig.build?.platform === "browser" ? {
127
- port: 5173,
128
- open: true,
129
- strictPort: false,
130
- // https: false,
131
- host: "localhost",
132
- allowedHosts: [
133
- "."
134
- ],
135
- cors: true,
136
- headers: {}
137
- } : void 0
138
- }, userConfig);
139
- }
140
- chunkPK6SKIKE_cjs.__name(createEnvironment, "createEnvironment");
141
- function createDefaultEnvironment(userConfig) {
142
- return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
143
- }
144
- chunkPK6SKIKE_cjs.__name(createDefaultEnvironment, "createDefaultEnvironment");
145
- function resolveOptions(options) {
146
- return defu3__default.default(options, {
147
- interopDefault: true,
148
- fsCache: options.mode !== "development" ? joinPaths.joinPaths(options.cacheDir, "jiti") : false,
149
- moduleCache: options.mode !== "development"
150
- });
151
- }
152
- chunkPK6SKIKE_cjs.__name(resolveOptions, "resolveOptions");
153
- function createPluginResolver(options) {
154
- return jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions({
155
- ...options
156
- }));
157
- }
158
- chunkPK6SKIKE_cjs.__name(createPluginResolver, "createPluginResolver");
159
- function createResolver(options) {
160
- const baseResolver = jiti.createJiti(joinPaths.joinPaths(options.workspaceRoot, options.projectRoot), resolveOptions(options));
161
- baseResolver.plugin = createPluginResolver(options);
162
- return baseResolver;
163
- }
164
- chunkPK6SKIKE_cjs.__name(createResolver, "createResolver");
165
- function isBufferEncoding(options) {
166
- return isSetString.isSetString(options) || options === null;
167
- }
168
- chunkPK6SKIKE_cjs.__name(isBufferEncoding, "isBufferEncoding");
169
- function isPowerlinesWriteFileOptions(options) {
170
- return !isBufferEncoding(options) && isSetObject.isSetObject(options) && ("skipFormat" in options || "mode" in options && (options.mode === "fs" || options.mode === "virtual"));
171
- }
172
- chunkPK6SKIKE_cjs.__name(isPowerlinesWriteFileOptions, "isPowerlinesWriteFileOptions");
173
- function isNodeWriteFileOptions(options) {
174
- return !isUndefined.isUndefined(options) && (isBufferEncoding(options) || !isPowerlinesWriteFileOptions(options));
175
- }
176
- chunkPK6SKIKE_cjs.__name(isNodeWriteFileOptions, "isNodeWriteFileOptions");
177
- function isPowerLinesWriteFileData(data) {
178
- return !!(isSetObject.isSetObject(data) && "code" in data && data.code);
179
- }
180
- chunkPK6SKIKE_cjs.__name(isPowerLinesWriteFileData, "isPowerLinesWriteFileData");
181
- var FILE_PREFIX = "file://";
182
- function toFilePath(pathOrUrl) {
183
- if (!pathOrUrl) {
184
- throw new Error("No Path or URL provided to Virtual File System");
185
- }
186
- let result = pathOrUrl.toString();
187
- if (result.startsWith(FILE_PREFIX)) {
188
- result = result.slice(FILE_PREFIX.length);
189
- }
190
- return result;
191
- }
192
- chunkPK6SKIKE_cjs.__name(toFilePath, "toFilePath");
193
- var FS_METHODS = [
194
- "mkdir",
195
- "mkdirSync",
196
- "rmdir",
197
- "rmdirSync",
198
- "unlink",
199
- "unlinkSync",
200
- "existsSync",
201
- "realpathSync",
202
- "writeFileSync",
203
- "readFileSync",
204
- "readdirSync",
205
- "createWriteStream",
206
- "WriteStream",
207
- "createReadStream",
208
- "ReadStream"
209
- ];
210
- var FS_PROMISE_METHODS = [
211
- "mkdir",
212
- "rm",
213
- "rmdir",
214
- "unlink",
215
- "writeFile",
216
- "readFile",
217
- "readdir",
218
- "stat",
219
- "lstat"
220
- ];
221
- function cloneFS(originalFS) {
222
- const clonedFS = {
223
- ...originalFS,
224
- promises: {
225
- ...originalFS.promises ?? {}
226
- }
227
- };
228
- for (const method of FS_METHODS) {
229
- if (originalFS[method]) {
230
- clonedFS[method] = originalFS[method];
231
- }
232
- }
233
- originalFS.promises ??= {};
234
- for (const method of FS_PROMISE_METHODS) {
235
- if (originalFS.promises[method]) {
236
- clonedFS.promises ??= {};
237
- clonedFS.promises[method] = originalFS.promises[method];
238
- clonedFS[method] = originalFS.promises[method];
239
- }
240
- }
241
- for (const prop in clonedFS) {
242
- if (isFunction.isFunction(clonedFS[prop])) {
243
- clonedFS[prop] = clonedFS[prop].bind(originalFS);
244
- if (isFunction.isFunction(clonedFS.promises[prop])) {
245
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
246
- }
247
- }
248
- }
249
- for (const prop in clonedFS.promises) {
250
- if (isFunction.isFunction(clonedFS.promises[prop])) {
251
- clonedFS.promises[prop] = clonedFS.promises[prop].bind(originalFS);
252
- }
253
- }
254
- return clonedFS;
255
- }
256
- chunkPK6SKIKE_cjs.__name(cloneFS, "cloneFS");
257
- function patchFS(originalFS, vfs) {
258
- const clonedFS = cloneFS(originalFS);
259
- originalFS.mkdirSync = (file, options) => vfs.mkdirSync(toFilePath(file), options);
260
- originalFS.mkdir = (file, options, callback) => vfs.mkdir(toFilePath(file), options, callback);
261
- originalFS.promises.mkdir = async (file, options) => vfs.mkdir(toFilePath(file), options);
262
- originalFS.unlinkSync = (file) => vfs.unlinkSync(toFilePath(file));
263
- originalFS.promises.rm = async (file, options) => vfs.rm(toFilePath(file), options);
264
- originalFS.promises.unlink = async (file) => vfs.unlink(toFilePath(file));
265
- originalFS.existsSync = (file) => vfs.existsSync(toFilePath(file));
266
- Object.defineProperty(originalFS, "realpathSync", {
267
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.realpathSync(toFilePath(file), options), "value")
268
- });
269
- originalFS.writeFileSync = (file, data, options) => vfs.writeFileSync(toFilePath(file), data, options);
270
- originalFS.promises.writeFile = async (file, data, options) => vfs.writeFile(toFilePath(file), data, options);
271
- originalFS.readFileSync = (file, options) => vfs.readFileSync(toFilePath(file), options);
272
- originalFS.promises.readFile = (file, options) => vfs.readFile(toFilePath(file), options);
273
- originalFS.readdirSync = (file, options) => vfs.readdirSync(toFilePath(file), options);
274
- originalFS.promises.readdir = (file, options) => vfs.readdir(toFilePath(file), options);
275
- Object.defineProperty(originalFS, "statSync", {
276
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.statSync(toFilePath(file), options), "value")
277
- });
278
- originalFS.stat = (file, options) => vfs.statSync(toFilePath(file), options);
279
- originalFS.promises.stat = (file, options) => vfs.stat(toFilePath(file), options);
280
- Object.defineProperty(originalFS, "lstatSync", {
281
- value: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((file, options) => vfs.lstatSync(toFilePath(file), options), "value")
282
- });
283
- originalFS.lstat = (file, options) => vfs.lstatSync(toFilePath(file), options);
284
- originalFS.promises.lstat = (file, options) => vfs.lstat(toFilePath(file), options);
285
- return () => {
286
- originalFS.mkdirSync = clonedFS.mkdirSync;
287
- originalFS.mkdir = clonedFS.mkdir;
288
- originalFS.promises.mkdir = clonedFS.promises.mkdir;
289
- originalFS.unlinkSync = clonedFS.unlinkSync;
290
- originalFS.promises.rm = clonedFS.promises.rm;
291
- originalFS.promises.unlink = clonedFS.promises.unlink;
292
- originalFS.existsSync = clonedFS.existsSync;
293
- originalFS.realpathSync = clonedFS.realpathSync;
294
- originalFS.writeFileSync = clonedFS.writeFileSync;
295
- originalFS.promises.writeFile = clonedFS.promises.writeFile;
296
- originalFS.readFileSync = clonedFS.readFileSync;
297
- originalFS.promises.readFile = clonedFS.promises.readFile;
298
- originalFS.readdirSync = clonedFS.readdirSync;
299
- originalFS.promises.readdir = clonedFS.promises.readdir;
300
- Object.defineProperty(originalFS, "statSync", {
301
- value: clonedFS.statSync
302
- });
303
- originalFS.stat = clonedFS.stat;
304
- originalFS.promises.stat = clonedFS.promises.stat;
305
- Object.defineProperty(originalFS, "lstatSync", {
306
- value: clonedFS.lstatSync
307
- });
308
- originalFS.lstat = clonedFS.lstat;
309
- originalFS.promises.lstat = clonedFS.promises.lstat;
310
- };
311
- }
312
- chunkPK6SKIKE_cjs.__name(patchFS, "patchFS");
313
- var VirtualFileSystem = class {
314
- static {
315
- chunkPK6SKIKE_cjs.__name(this, "VirtualFileSystem");
316
- }
317
- /**
318
- * The internal map of virtual files.
319
- */
320
- #meta = {};
321
- /**
322
- * A map of unique identifiers to their virtual file paths.
323
- */
324
- #ids = {};
325
- /**
326
- * A map of virtual file paths to their underlying file content.
327
- */
328
- #cachedFS = /* @__PURE__ */ new Map();
329
- /**
330
- * A map of virtual file paths to their underlying file content.
331
- */
332
- #cachedResolver = /* @__PURE__ */ new Map();
333
- /**
334
- * The internal map of virtual files.
335
- */
336
- #virtualFS = new memfs.Volume();
337
- /**
338
- * The physical file system.
339
- */
340
- #fs = cloneFS(fs__default.default);
341
- /**
342
- * The unified volume that combines the virtual file system with the real file system.
343
- *
344
- * @remarks
345
- * This volume allows for seamless access to both virtual and real files.
346
- */
347
- #unifiedFS = new unionfs.Union();
348
- /**
349
- * Indicator specifying if the file system module is patched
350
- */
351
- #isPatched = false;
352
- /**
353
- * Function to revert require patch
354
- */
355
- #revert;
356
- /**
357
- * The context of the virtual file system.
358
- */
359
- #context;
360
- /**
361
- * The file system's logging function.
362
- */
363
- #log;
364
- /**
365
- * Checks if a path exists in the virtual file system (VFS).
366
- *
367
- * @param path - The path to check.
368
- * @returns `true` if the path exists, otherwise `false`.
369
- */
370
- #existsSync(path) {
371
- const formattedPath = this.formatPath(path);
372
- return this.#virtualFS.existsSync(formattedPath) || this.#fs.existsSync(formattedPath) || this.resolveFS(path).existsSync(formattedPath);
373
- }
374
- /**
375
- * Exposes the internal VFS map for advanced usage.
376
- */
377
- get [chunkBW3VFCTS_cjs.__VFS_CACHE__]() {
378
- return this.#cachedFS;
379
- }
380
- /**
381
- * Exposes the internal VFS resolver cache for advanced usage.
382
- */
383
- get [chunkBW3VFCTS_cjs.__VFS_RESOLVER__]() {
384
- return this.#cachedResolver;
385
- }
386
- /**
387
- * Exposes the internal VFS map for advanced usage.
388
- */
389
- get [chunkBW3VFCTS_cjs.__VFS_VIRTUAL__]() {
390
- return this.#virtualFS;
391
- }
392
- /**
393
- * Exposes the internal UFS map for advanced usage.
394
- */
395
- get [chunkBW3VFCTS_cjs.__VFS_UNIFIED__]() {
396
- return this.#unifiedFS;
397
- }
398
- /**
399
- * A proxy to access the underlying file metadata.
400
- */
401
- get meta() {
402
- return new Proxy(this.#meta, {
403
- get: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
404
- if (target[prop]) {
405
- return {
406
- id: prop,
407
- mode: this.#virtualFS.existsSync(prop) ? "virtual" : this.#fs.existsSync(prop) ? "fs" : this.#context.config.output.mode,
408
- details: {},
409
- variant: "normal",
410
- ...target[prop]
411
- };
412
- }
413
- return void 0;
414
- }, "get"),
415
- set: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop, value) => {
416
- target[prop] = value;
417
- this.#ids[value.id || prop] = prop;
418
- return true;
419
- }, "set"),
420
- deleteProperty: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((target, prop) => {
421
- delete this.#ids[target[prop]?.id || prop];
422
- delete target[prop];
423
- return true;
424
- }, "deleteProperty")
425
- });
426
- }
427
- /**
428
- * A map of module ids to their file paths.
429
- */
430
- get ids() {
431
- return this.#ids;
432
- }
433
- /**
434
- * Creates a new instance of the VirtualFileSystem.
435
- *
436
- * @param context - The context of the virtual file system, typically containing options and logging functions.
437
- * @param serialized - A map of files/file contents to populate in cache
438
- */
439
- constructor(context, serialized = {}) {
440
- this.#context = context;
441
- this.#cachedFS = /* @__PURE__ */ new Map();
442
- this.#meta = Object.fromEntries(Object.entries(serialized.virtualFilesMeta ?? {}));
443
- this.#ids = Object.fromEntries(Object.entries(this.#meta).map(([path, data]) => [
444
- data.id || path,
445
- path
446
- ]));
447
- if (!this.#fs.existsSync(this.#context.dataPath)) {
448
- this.#fs.mkdirSync(this.#context.dataPath, {
449
- recursive: true
450
- });
451
- }
452
- if (!this.#fs.existsSync(this.#context.cachePath)) {
453
- this.#fs.mkdirSync(this.#context.cachePath, {
454
- recursive: true
455
- });
456
- }
457
- if (!this.#fs.existsSync(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
458
- this.#fs.mkdirSync(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath), {
459
- recursive: true
460
- });
461
- }
462
- this.#unifiedFS = this.#unifiedFS.use(this.#fs);
463
- if (this.#context.config.output.mode !== "fs") {
464
- if (serialized?.virtualFiles && Object.keys(serialized.virtualFiles).length > 0) {
465
- this.#virtualFS = memfs.Volume.fromJSON(serialized.virtualFiles);
466
- }
467
- if (!this.#virtualFS.existsSync(this.#context.artifactsPath)) {
468
- this.#virtualFS.mkdirSync(this.#context.artifactsPath, {
469
- recursive: true
470
- });
471
- }
472
- if (!this.#virtualFS.existsSync(this.#context.builtinsPath)) {
473
- this.#virtualFS.mkdirSync(this.#context.builtinsPath, {
474
- recursive: true
475
- });
476
- }
477
- if (!this.#virtualFS.existsSync(this.#context.entryPath)) {
478
- this.#virtualFS.mkdirSync(this.#context.entryPath, {
479
- recursive: true
480
- });
481
- }
482
- if (!this.#virtualFS.existsSync(this.#context.dtsPath)) {
483
- this.#virtualFS.mkdirSync(this.#context.dtsPath, {
484
- recursive: true
485
- });
486
- }
487
- this.#unifiedFS = this.#unifiedFS.use(this.#virtualFS);
488
- } else if (this.#context.config.projectType === "application") {
489
- if (!this.#fs.existsSync(this.#context.artifactsPath)) {
490
- this.#fs.mkdirSync(this.#context.artifactsPath, {
491
- recursive: true
492
- });
493
- }
494
- if (!this.#fs.existsSync(this.#context.builtinsPath)) {
495
- this.#fs.mkdirSync(this.#context.builtinsPath, {
496
- recursive: true
497
- });
498
- }
499
- if (!this.#fs.existsSync(this.#context.entryPath)) {
500
- this.#fs.mkdirSync(this.#context.entryPath, {
501
- recursive: true
502
- });
503
- }
504
- if (!this.#fs.existsSync(this.#context.dtsPath)) {
505
- this.#fs.mkdirSync(this.#context.dtsPath, {
506
- recursive: true
507
- });
508
- }
509
- }
510
- this.#log = chunk632PWWU7_cjs.extendLog(this.#context.log, "virtual-file-system");
511
- }
512
- [chunkBW3VFCTS_cjs.__VFS_INIT__]() {
513
- if (!this.#isPatched && this.#context.config.output.mode !== "fs") {
514
- this.#revert = patchFS(fs__default.default, this);
515
- this.#isPatched = true;
516
- }
517
- }
518
- [chunkBW3VFCTS_cjs.__VFS_REVERT__]() {
519
- if (this.#isPatched && this.#context.config.output.mode !== "fs") {
520
- if (!this.#revert) {
521
- throw new Error("Attempting to revert File System patch prior to calling `__init__` function");
522
- }
523
- this.#revert?.();
524
- this.#isPatched = false;
525
- }
526
- }
527
- /**
528
- * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
529
- *
530
- * @param pathOrId - The path or id to check.
531
- * @param options - Optional parameters for resolving the path.
532
- * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
533
- */
534
- isVirtual(pathOrId, options = {}) {
535
- if (!pathOrId) {
536
- return false;
537
- }
538
- const resolvedPath = this.resolve(pathOrId, {
539
- ...options,
540
- type: "file"
541
- });
542
- if (!resolvedPath) {
543
- return false;
544
- }
545
- return this.meta[resolvedPath]?.mode === "virtual";
546
- }
547
- /**
548
- * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
549
- *
550
- * @param pathOrId - The path or id to check.
551
- * @param options - Optional parameters for resolving the path.
552
- * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
553
- */
554
- isFs(pathOrId, options = {}) {
555
- if (!pathOrId) {
556
- return false;
557
- }
558
- const resolvedPath = this.resolve(pathOrId, {
559
- ...options,
560
- type: "file"
561
- });
562
- if (!resolvedPath) {
563
- return false;
564
- }
565
- return this.meta[resolvedPath]?.mode === "fs";
566
- }
567
- /**
568
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
569
- *
570
- * @see https://www.typescriptlang.org/tsconfig#paths
571
- *
572
- * @param pathOrId - The path or ID to check.
573
- * @returns Whether the path or ID corresponds to a virtual file.
574
- */
575
- isTsconfigPath(pathOrId) {
576
- return !!this.#context.tsconfig.options.paths && Object.keys(this.#context.tsconfig.options.paths).some((path) => pathOrId.startsWith(path.replaceAll("*", "")));
577
- }
578
- /**
579
- * Lists files in a given path.
580
- *
581
- * @param path - The path to list files from.
582
- * @param options - Options for listing files, such as encoding and recursion.
583
- * @returns An array of file names in the specified path.
584
- */
585
- readdirSync(path, options = "utf8") {
586
- return this.resolveFS(path).readdirSync(toFilePath(path), options);
587
- }
588
- /**
589
- * Removes a file in the virtual file system (VFS).
590
- *
591
- * @param path - The path to create the directory at.
592
- */
593
- unlinkSync(path, options) {
594
- const formattedPath = toFilePath(path);
595
- if (!this.isFile(formattedPath)) {
596
- return;
597
- }
598
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing file: ${formattedPath}`);
599
- this.resolveFS(path, options).unlinkSync(formattedPath);
600
- this.#cachedFS.delete(formattedPath);
601
- this.clearResolverCache(formattedPath);
602
- }
603
- /**
604
- * Removes a file in the virtual file system (VFS).
605
- *
606
- * @param path - The path to create the directory at.
607
- */
608
- async unlink(path, options) {
609
- const formattedPath = toFilePath(path);
610
- if (!this.isFile(formattedPath)) {
611
- return;
612
- }
613
- this.#log(types.LogLevelLabel.TRACE, `Removing file: ${formattedPath}`);
614
- if (isFunction.isFunction(this.resolveFS(path, options).promises.unlink)) {
615
- await this.resolveFS(path, options).promises.unlink(formattedPath);
616
- this.#cachedFS.delete(formattedPath);
617
- this.clearResolverCache(formattedPath);
618
- } else {
619
- this.unlinkSync(formattedPath, options);
620
- }
621
- }
622
- /**
623
- * Removes a directory in the virtual file system (VFS).
624
- *
625
- * @param path - The path to create the directory at.
626
- * @param options - Options for creating the directory.
627
- */
628
- rmdirSync(path, options = {}) {
629
- const formattedPath = toFilePath(path);
630
- if (!this.isDirectory(formattedPath)) {
631
- return;
632
- }
633
- this.#log(types.LogLevelLabel.TRACE, `Synchronously removing directory: ${formattedPath}`);
634
- this.resolveFS(path, options).rmdirSync(formattedPath, defu3__default.default(options, {
635
- recursive: true
636
- }));
637
- this.#cachedFS.delete(formattedPath);
638
- this.clearResolverCache(formattedPath);
639
- }
640
- /**
641
- * Removes a directory in the virtual file system (VFS).
642
- *
643
- * @param path - The path to create the directory at.
644
- * @param options - Options for creating the directory.
645
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
646
- */
647
- async rmdir(path, options = {}) {
648
- const formattedPath = toFilePath(path);
649
- if (!this.isDirectory(formattedPath)) {
650
- return;
651
- }
652
- this.#log(types.LogLevelLabel.TRACE, `Removing directory: ${formattedPath}`);
653
- if (isFunction.isFunction(this.resolveFS(path, options).promises.rm)) {
654
- await this.resolveFS(path, options).promises.rm(formattedPath, defu3__default.default(options, {
655
- force: true,
656
- recursive: true
657
- }));
658
- this.#cachedFS.delete(formattedPath);
659
- this.clearResolverCache(formattedPath);
660
- } else {
661
- this.rmdirSync(formattedPath, defu3__default.default(options ?? {}, {
662
- force: true,
663
- recursive: true
664
- }));
665
- }
666
- }
667
- /**
668
- * Removes a file in the virtual file system (VFS).
669
- *
670
- * @param path - The path to the file to remove.
671
- * @param options - Options for removing the file.
672
- * @returns A promise that resolves when the file is removed.
673
- */
674
- async rm(path, options = {}) {
675
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
676
- if (this.isDirectory(path)) {
677
- return this.rmdir(path, options);
678
- }
679
- return this.unlink(path, options);
680
- }
681
- /**
682
- * Synchronously removes a file or directory in the virtual file system (VFS).
683
- *
684
- * @param path - The path to the file or directory to remove.
685
- * @param options - Options for removing the file or directory.
686
- */
687
- rmSync(path, options = {}) {
688
- this.#log(types.LogLevelLabel.TRACE, `Removing: ${toFilePath(path)}`);
689
- if (this.isDirectory(path)) {
690
- return this.rmdirSync(path, options);
691
- }
692
- return this.unlinkSync(path, options);
693
- }
694
- /**
695
- * Creates a directory in the virtual file system (VFS).
696
- *
697
- * @param path - The path to create the directory at.
698
- * @param options - Options for creating the directory.
699
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
700
- */
701
- mkdirSync(path, options = {}) {
702
- const filePath = toFilePath(path);
703
- this.clearResolverCache(filePath);
704
- return this.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
705
- recursive: true
706
- }));
707
- }
708
- /**
709
- * Creates a directory in the virtual file system (VFS).
710
- *
711
- * @param path - The path to create the directory at.
712
- * @param options - Options for creating the directory.
713
- * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
714
- */
715
- async mkdir(path, options = {}) {
716
- let result;
717
- const filePath = toFilePath(path);
718
- if (isFunction.isFunction(this.resolveFS(filePath, options).promises.mkdir)) {
719
- result = await this.resolveFS(filePath, options).promises.mkdir(filePath, defu3__default.default(options ?? {}, {
720
- recursive: true
721
- }));
722
- } else {
723
- result = this.resolveFS(filePath, options).mkdirSync(filePath, defu3__default.default(options ?? {}, {
724
- recursive: true
725
- }));
726
- }
727
- this.clearResolverCache(filePath);
728
- return result;
729
- }
730
- /**
731
- * Glob files in the virtual file system (VFS) based on the provided pattern(s).
732
- *
733
- * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
734
- * @returns An array of file paths matching the provided pattern(s)
735
- */
736
- async glob(patterns) {
737
- const results = [];
738
- for (const pattern of toArray.toArray(patterns)) {
739
- const normalized = this.formatPath(pattern);
740
- if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
741
- const resolved = this.resolve(normalized, {
742
- type: "file"
743
- });
744
- if (resolved && !results.includes(resolved)) {
745
- results.push(resolved);
746
- }
747
- continue;
748
- }
749
- const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
750
- const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
751
- const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
752
- const stack = [
753
- baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot
754
- ];
755
- while (stack.length) {
756
- const dir = stack.pop();
757
- let entries = [];
758
- try {
759
- entries = await this.readdir(dir);
760
- } catch {
761
- continue;
762
- }
763
- for (const entry of entries) {
764
- const full = this.formatPath(joinPaths.joinPaths(dir, entry));
765
- let stats;
766
- try {
767
- stats = this.#unifiedFS.lstatSync(full);
768
- } catch {
769
- stats = void 0;
770
- }
771
- if (!stats) continue;
772
- if (stats.isDirectory()) {
773
- stack.push(full);
774
- } else if (stats.isFile()) {
775
- if (this.buildRegex(absPattern).test(full)) {
776
- const resolved = this.resolve(full, {
777
- type: "file"
778
- });
779
- if (resolved && !results.includes(resolved)) {
780
- results.push(resolved);
781
- }
782
- }
783
- }
784
- }
785
- }
786
- }
787
- return results;
788
- }
789
- /**
790
- * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
791
- *
792
- * @param patterns - A pattern (or multiple patterns) to use to determine the file paths to return
793
- * @returns An array of file paths matching the provided pattern(s)
794
- */
795
- globSync(patterns) {
796
- const results = [];
797
- for (const pattern of toArray.toArray(patterns)) {
798
- const normalized = this.formatPath(pattern);
799
- if (!/[*?[\]{}]/.test(normalized) && !normalized.includes("**")) {
800
- const resolved = this.resolve(normalized, {
801
- type: "file"
802
- });
803
- if (resolved && !results.includes(resolved)) {
804
- results.push(resolved);
805
- }
806
- continue;
807
- }
808
- const absPattern = isType.isAbsolutePath(normalized) ? normalized : this.formatPath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, normalized));
809
- const firstGlobIdx = absPattern.search(/[*?[\]{}]/);
810
- const baseDir = firstGlobIdx === -1 ? filePathFns.findFilePath(absPattern) : absPattern.slice(0, Math.max(0, absPattern.lastIndexOf("/", firstGlobIdx)));
811
- const stack = [
812
- baseDir && isType.isAbsolutePath(baseDir) ? baseDir : this.#context.workspaceConfig.workspaceRoot
813
- ];
814
- while (stack.length) {
815
- const dir = stack.pop();
816
- let entries = [];
817
- try {
818
- entries = this.readdirSync(dir);
819
- } catch {
820
- continue;
821
- }
822
- for (const entry of entries) {
823
- const full = this.formatPath(joinPaths.joinPaths(dir, entry));
824
- let stats;
825
- try {
826
- stats = this.#unifiedFS.lstatSync(full);
827
- } catch {
828
- stats = void 0;
829
- }
830
- if (!stats) continue;
831
- if (stats.isDirectory()) {
832
- stack.push(full);
833
- } else if (stats.isFile()) {
834
- if (this.buildRegex(absPattern).test(full)) {
835
- const resolved = this.resolve(full, {
836
- type: "file"
837
- });
838
- if (resolved && !results.includes(resolved)) {
839
- results.push(resolved);
840
- }
841
- }
842
- }
843
- }
844
- }
845
- }
846
- return results;
847
- }
848
- /**
849
- * Moves a file from one path to another in the virtual file system (VFS).
850
- *
851
- * @param srcPath - The source path to move
852
- * @param destPath - The destination path to move to
853
- */
854
- async move(srcPath, destPath) {
855
- const content = await this.readFile(srcPath);
856
- await this.writeFile(destPath, content);
857
- await this.rm(srcPath);
858
- }
859
- /**
860
- * Synchronously moves a file from one path to another in the virtual file system (VFS).
861
- *
862
- * @param srcPath - The source path to move
863
- * @param destPath - The destination path to move to
864
- */
865
- moveSync(srcPath, destPath) {
866
- const content = this.readFileSync(srcPath);
867
- this.writeFileSync(destPath, content);
868
- this.rmSync(srcPath);
869
- }
870
- /**
871
- * Copies a file from one path to another in the virtual file system (VFS).
872
- *
873
- * @param srcPath - The source path to copy
874
- * @param destPath - The destination path to copy to
875
- */
876
- async copy(srcPath, destPath) {
877
- const content = await this.readFile(srcPath);
878
- await this.writeFile(destPath, content);
879
- }
880
- /**
881
- * Synchronously copies a file from one path to another in the virtual file system (VFS).
882
- *
883
- * @param srcPath - The source path to copy
884
- * @param destPath - The destination path to copy to
885
- */
886
- copySync(srcPath, destPath) {
887
- const content = this.readFileSync(srcPath);
888
- this.writeFileSync(destPath, content);
889
- }
890
- /**
891
- * Lists files in a given path.
892
- *
893
- * @param pathOrId - The path to list files from.
894
- * @param options - Options for listing files, such as encoding and recursion.
895
- * @returns An array of file names in the specified path.
896
- */
897
- async readdir(pathOrId, options = "utf8") {
898
- return this.resolveFS(pathOrId).promises.readdir(toFilePath(pathOrId), options);
899
- }
900
- /**
901
- * Asynchronously reads a file from the virtual file system (VFS).
902
- *
903
- * @param pathOrId - The path or ID of the file to read.
904
- * @returns A promise that resolves to the contents of the file as a string, or undefined if the file does not exist.
905
- */
906
- async readFile(pathOrId, options = "utf8") {
907
- if (!pathOrId) {
908
- return void 0;
909
- }
910
- const filePath = this.resolve(toFilePath(pathOrId), {
911
- type: "file"
912
- });
913
- if (filePath) {
914
- if (this.#cachedFS.has(filePath)) {
915
- return this.#cachedFS.get(filePath);
916
- }
917
- let result;
918
- if (isFunction.isFunction(this.resolveFS(filePath).promises.readFile)) {
919
- result = (await this.resolveFS(filePath).promises.readFile(filePath, options))?.toString("utf8");
920
- } else {
921
- result = this.resolveFS(filePath).readFileSync(filePath, options);
922
- }
923
- const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
924
- this.#cachedFS.set(filePath, content);
925
- return content;
926
- }
927
- return void 0;
928
- }
929
- /**
930
- * Synchronously reads a file from the virtual file system (VFS).
931
- *
932
- * @param pathOrId - The path or ID of the file to read.
933
- * @returns The contents of the file as a string, or undefined if the file does not exist.
934
- */
935
- readFileSync(pathOrId, options = "utf8") {
936
- if (!pathOrId) {
937
- return void 0;
938
- }
939
- const filePath = this.resolve(toFilePath(pathOrId), {
940
- type: "file"
941
- });
942
- if (filePath) {
943
- if (this.#cachedFS.has(filePath)) {
944
- return this.#cachedFS.get(filePath);
945
- }
946
- const result = this.resolveFS(filePath).readFileSync(filePath, options);
947
- const content = isBuffer.isBuffer(result) ? bufferToString.bufferToString(result) : result;
948
- this.#cachedFS.set(filePath, content);
949
- return content;
950
- }
951
- return void 0;
952
- }
953
- /**
954
- * Writes a file to the virtual file system (VFS).
955
- *
956
- * @param path - The path to the file.
957
- * @param data - The contents of the file.
958
- * @param options - Optional parameters for writing the file.
959
- * @returns A promise that resolves when the file is written.
960
- */
961
- async writeFile(path, data = "", options = "utf8") {
962
- const formattedPath = this.formatPath(path);
963
- if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
964
- await this.mkdir(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
965
- }
966
- let code = isPowerLinesWriteFileData(data) ? data.code : data;
967
- if ((!isPowerlinesWriteFileOptions(options) || !options.skipFormat) && isSetString.isSetString(code)) {
968
- const resolvedConfig = await prettier.resolveConfig(formattedPath);
969
- if (resolvedConfig) {
970
- code = await prettier.format(code, {
971
- absolutePath: formattedPath,
972
- ...resolvedConfig
973
- });
974
- }
975
- }
976
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
977
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
978
- this.meta[formattedPath] = {
979
- path: formattedPath,
980
- code,
981
- mode: outputMode,
982
- variant: "normal",
983
- ...isPowerLinesWriteFileData(data) ? data : {}
984
- };
985
- this.clearResolverCache(formattedPath);
986
- const ifs = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
987
- if (isFunction.isFunction(ifs.promises.writeFile)) {
988
- return ifs.promises.writeFile(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
989
- }
990
- return ifs.writeFileSync(formattedPath, code, isNodeWriteFileOptions(options) ? options : "utf8");
991
- }
992
- /**
993
- * Synchronously writes a file to the virtual file system (VFS).
994
- *
995
- * @param path - The file to write.
996
- * @param data - The contents of the file.
997
- * @param options - Optional parameters for writing the file.
998
- */
999
- writeFileSync(path, data = "", options = "utf8") {
1000
- const formattedPath = this.formatPath(path);
1001
- if (!this.isDirectory(filePathFns.findFilePath(formattedPath))) {
1002
- this.mkdirSync(filePathFns.findFilePath(formattedPath), isPowerlinesWriteFileOptions(options) ? options : void 0);
1003
- }
1004
- const code = isPowerLinesWriteFileData(data) ? data.code : data;
1005
- const outputMode = this.resolveOutputMode(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0);
1006
- this.#log(types.LogLevelLabel.TRACE, `Writing ${formattedPath} file to the ${outputMode === "fs" ? "" : "virtual "}file system (size: ${prettyBytes.prettyBytes(new buffer.Blob(toArray.toArray(code)).size)})`);
1007
- this.meta[formattedPath] = {
1008
- path: formattedPath,
1009
- code,
1010
- mode: outputMode,
1011
- variant: "normal",
1012
- ...isPowerLinesWriteFileData(data) ? data : {}
1013
- };
1014
- this.clearResolverCache(formattedPath);
1015
- const writeStream = this.resolveFS(formattedPath, isPowerlinesWriteFileOptions(options) ? options : void 0).createWriteStream(formattedPath);
1016
- try {
1017
- writeStream.write(code);
1018
- } finally {
1019
- writeStream.close();
1020
- }
1021
- }
1022
- /**
1023
- * Synchronously checks if a file exists in the virtual file system (VFS).
1024
- *
1025
- * @param pathOrId - The path or ID of the file to check.
1026
- * @returns `true` if the file exists, otherwise `false`.
1027
- */
1028
- existsSync(pathOrId) {
1029
- return this.resolve(pathOrId) !== false;
1030
- }
1031
- /**
1032
- * Retrieves the metadata of a file in the virtual file system (VFS).
1033
- *
1034
- * @param pathOrId - The path or ID of the file to retrieve metadata for.
1035
- * @returns The metadata of the file, or undefined if the file does not exist.
1036
- */
1037
- getMetadata(pathOrId) {
1038
- const resolved = this.resolve(pathOrId);
1039
- if (resolved && this.meta[resolved]) {
1040
- return this.meta[resolved];
1041
- }
1042
- return void 0;
1043
- }
1044
- /**
1045
- * Checks if a file exists in the virtual file system (VFS).
1046
- *
1047
- * @remarks
1048
- * This is a base method used by {@link existsSync} - it does not try to resolve the path prior to checking if it exists or not.
1049
- *
1050
- * @param pathOrId - The path of the file to check.
1051
- * @returns `true` if the file exists, otherwise `false`.
1052
- */
1053
- isFile(pathOrId) {
1054
- const resolved = this.resolve(pathOrId);
1055
- 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()));
1056
- }
1057
- /**
1058
- * Checks if a directory exists in the virtual file system (VFS).
1059
- *
1060
- * @param pathOrId - The path of the directory to check.
1061
- * @returns `true` if the directory exists, otherwise `false`.
1062
- */
1063
- isDirectory(pathOrId) {
1064
- const resolved = this.resolve(pathOrId);
1065
- 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()));
1066
- }
1067
- /**
1068
- * Retrieves the status of a file in the virtual file system (VFS).
1069
- *
1070
- * @param pathOrId - The path or ID of the file to retrieve status for.
1071
- * @returns A promise that resolves to the file's status information, or false if the file does not exist.
1072
- */
1073
- async stat(pathOrId, options) {
1074
- return this.resolveFS(pathOrId).promises.stat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1075
- }
1076
- /**
1077
- * Synchronously retrieves the status of a file in the virtual file system (VFS).
1078
- *
1079
- * @param pathOrId - The path or ID of the file to retrieve status for.
1080
- * @returns The file's status information, or false if the file does not exist.
1081
- */
1082
- statSync(pathOrId) {
1083
- return this.resolveFS(pathOrId).statSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId));
1084
- }
1085
- /**
1086
- * Retrieves the status of a symbolic link in the virtual file system (VFS).
1087
- *
1088
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1089
- * @returns A promise that resolves to the symbolic link's status information, or false if the link does not exist.
1090
- */
1091
- async lstat(pathOrId, options) {
1092
- return this.resolveFS(pathOrId).promises.lstat(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1093
- }
1094
- /**
1095
- * Synchronously retrieves the status of a symbolic link in the virtual file system (VFS).
1096
- *
1097
- * @param pathOrId - The path or ID of the symbolic link to retrieve status for.
1098
- * @returns The symbolic link's status information, or false if the link does not exist.
1099
- */
1100
- lstatSync(pathOrId, options) {
1101
- return this.resolveFS(pathOrId).lstatSync(this.resolve(toFilePath(pathOrId)) || toFilePath(pathOrId), options);
1102
- }
1103
- /**
1104
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1105
- *
1106
- * @see https://www.typescriptlang.org/tsconfig#paths
1107
- *
1108
- * @param path - The path to check.
1109
- * @returns The resolved file path if it exists, otherwise undefined.
1110
- */
1111
- resolveTsconfigPath(path) {
1112
- if (this.#context.tsconfig.options.paths) {
1113
- for (const tsconfigPathKey of Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")))) {
1114
- const resolvedPath = this.#context.tsconfig.options.paths[tsconfigPathKey]?.find((tsconfigPath) => this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, tsconfigPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), ""))) || this.formatPath(tsconfigPath) === this.formatPath(path));
1115
- if (resolvedPath) {
1116
- return this.formatPath(resolvedPath) === this.formatPath(path) ? this.formatPath(resolvedPath) : this.resolvePath(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, resolvedPath.replaceAll("*", ""), path.replace(tsconfigPathKey.replaceAll("*", ""), "")));
1117
- }
1118
- }
1119
- }
1120
- return false;
1121
- }
1122
- /**
1123
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
1124
- *
1125
- * @see https://www.typescriptlang.org/tsconfig#paths
1126
- *
1127
- * @param path - The path to check.
1128
- * @returns The resolved file path if it exists, otherwise undefined.
1129
- */
1130
- resolveTsconfigPathPackage(path) {
1131
- if (this.#context.tsconfig.options.paths) {
1132
- const tsconfigPathKeys = Object.keys(this.#context.tsconfig.options.paths).filter((tsconfigPath) => path.startsWith(tsconfigPath.replaceAll("*", "")));
1133
- if (tsconfigPathKeys.length > 0 && tsconfigPathKeys[0]) {
1134
- return tsconfigPathKeys[0].replace(/\/\*$/, "");
1135
- }
1136
- }
1137
- return false;
1138
- }
1139
- /**
1140
- * Resolves a path or ID to its real path in the virtual file system (VFS).
1141
- *
1142
- * @param pathOrId - The path or ID to resolve.
1143
- * @returns The resolved real path if it exists, otherwise undefined.
1144
- */
1145
- realpathSync(pathOrId) {
1146
- const filePath = this.resolve(toFilePath(pathOrId));
1147
- if (!filePath) {
1148
- throw new Error(`File not found: ${toFilePath(pathOrId)}`);
1149
- }
1150
- return filePath;
1151
- }
1152
- /**
1153
- * Resolves a path or ID parameter to a corresponding virtual file path in the virtual file system (VFS).
1154
- *
1155
- * @param pathOrId - The path or ID to resolve.
1156
- * @param options - Optional parameters for resolving the path, such as whether to include the file extension.
1157
- * @returns The resolved file path if it exists, otherwise undefined.
1158
- */
1159
- resolve(pathOrId, options = {}) {
1160
- const formattedPathOrId = toFilePath(pathOrId);
1161
- const resolverKey = `${formattedPathOrId}${options.withExtension ? "-ext" : ""}${options.paths ? `-${murmurhash.murmurhash(options.paths)}` : ""}${options.type ? `-${options.type}` : ""}`;
1162
- if (this.#cachedResolver.has(resolverKey)) {
1163
- return this.#cachedResolver.get(resolverKey);
1164
- }
1165
- let result = this.resolveId(formattedPathOrId);
1166
- if (!result) {
1167
- result = this.resolvePath(formattedPathOrId, options);
1168
- }
1169
- if (!result) {
1170
- result = false;
1171
- }
1172
- if (result && options.withExtension === false) {
1173
- return result.replace(/\.[m|c]?[t|j]sx?$/, "");
1174
- }
1175
- this.#cachedResolver.set(resolverKey, result);
1176
- return result;
1177
- }
1178
- /**
1179
- * Retrieves the partial metadata for all files in the virtual file system (VFS).
1180
- *
1181
- * @returns A record containing the partial metadata for all files.
1182
- */
1183
- getPartialMeta() {
1184
- return Object.fromEntries(Object.entries(this.#meta).filter(([_, data]) => isSetObject.isSetObject(data)));
1185
- }
1186
- buildRegex(strPattern) {
1187
- const token = "::GLOBSTAR::";
1188
- return new RegExp(`^${this.formatPath(strPattern).replace(/\*\*/g, token).replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, "[^/]*").replace(/\?/g, "[^/]").replace(new RegExp(token, "g"), ".*")}$`);
1189
- }
1190
- /**
1191
- * Converts a relative path to an absolute path based on the workspace and project root.
1192
- *
1193
- * @param path - The relative path to convert.
1194
- * @returns The absolute path.
1195
- */
1196
- formatPath(path) {
1197
- const formattedPath = toFilePath(path);
1198
- if (isType.isAbsolutePath(formattedPath) || formattedPath.startsWith(this.#context.workspaceConfig.workspaceRoot)) {
1199
- return formattedPath;
1200
- } else if (formattedPath.startsWith(this.#context.config.projectRoot)) {
1201
- return joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, formattedPath);
1202
- }
1203
- return formattedPath;
1204
- }
1205
- /**
1206
- * Formats a file id by removing the file extension and prepending the runtime prefix.
1207
- *
1208
- * @param id - The file ID to format.
1209
- * @returns The formatted file ID.
1210
- */
1211
- formatId(id) {
1212
- const formattedId = toFilePath(id);
1213
- return `${this.#context.config.output.builtinPrefix}:${formattedId.replace(new RegExp(`^${this.#context.config.output.builtinPrefix}:`), "").replace(/^\\0/, "").replace(filePathFns.findFileDotExtensionSafe(formattedId), "")}`;
1214
- }
1215
- /**
1216
- * Resolves an id parameter to a corresponding virtual file path in the virtual file system (VFS).
1217
- *
1218
- * @param id - The id to resolve.
1219
- * @returns The resolved file id if it exists, otherwise undefined.
1220
- */
1221
- resolveId(id) {
1222
- if (this.#ids[this.formatId(id)]) {
1223
- return this.#ids[this.formatId(id)] || false;
1224
- }
1225
- return false;
1226
- }
1227
- /**
1228
- * Resolves a path parameter to a corresponding virtual file path in the virtual file system (VFS).
1229
- *
1230
- * @param path - The path to resolve.
1231
- * @param options - Optional parameters for resolving the path.
1232
- * @returns The resolved file path if it exists, otherwise undefined.
1233
- */
1234
- resolvePath(path, options = {}) {
1235
- if (isType.isAbsolutePath(path)) {
1236
- if (this.#existsSync(path)) {
1237
- return path;
1238
- }
1239
- const result = this.checkVariants(path);
1240
- if (result) {
1241
- return result;
1242
- }
1243
- }
1244
- for (const parentPath of this.resolveParentPaths(path, options.paths)) {
1245
- const request = joinPaths.joinPaths(parentPath, path);
1246
- if (this.#existsSync(request)) {
1247
- return request;
1248
- }
1249
- const result = this.checkVariants(request);
1250
- if (result) {
1251
- return result;
1252
- }
1253
- }
1254
- return false;
1255
- }
1256
- resolveParentPaths(request, parents = []) {
1257
- let paths = [
1258
- this.#context.workspaceConfig.workspaceRoot,
1259
- joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.projectRoot)
1260
- ];
1261
- if (this.#context.tsconfig.options.paths) {
1262
- 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) => {
1263
- if (path && !ret.includes(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path))) {
1264
- ret.push(joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, path));
1265
- }
1266
- return ret;
1267
- }, paths) : paths;
1268
- }
1269
- return paths.reduce((ret, path) => {
1270
- if (!ret.includes(path)) {
1271
- ret.push(path);
1272
- }
1273
- return ret;
1274
- }, parents.filter(Boolean).map((p) => this.formatPath(p)));
1275
- }
1276
- /**
1277
- * Select the file system module to use for the operation based on the path or URL.
1278
- *
1279
- * @param pathOrUrl - The path to perform the file system operation on.
1280
- * @param options - Options for the operation, such as output mode.
1281
- * @returns The file system module used for the operation.
1282
- */
1283
- resolveFS(pathOrUrl, options = {}) {
1284
- const mode = this.resolveOutputMode(pathOrUrl, options);
1285
- if (mode === "virtual") {
1286
- return this.#virtualFS;
1287
- } else if (mode === "fs") {
1288
- return this.#fs;
1289
- }
1290
- return this.#unifiedFS;
1291
- }
1292
- /**
1293
- * Select the file system module to use for the operation based on the path or URL.
1294
- *
1295
- * @param pathOrUrl - The path to perform the file system operation on.
1296
- * @param options - Options for the operation, such as output mode.
1297
- * @returns The file system module used for the operation.
1298
- */
1299
- resolveOutputMode(pathOrUrl, options = {}) {
1300
- if (options.mode === "virtual" && this.#context.config.output.mode !== "fs" && isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.artifactsPath)) {
1301
- return "virtual";
1302
- } else if (options.mode === "fs" || this.#context.config.output.mode === "fs" || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.dataPath) || isParentPath.isParentPath(toFilePath(pathOrUrl), this.#context.cachePath) || isParentPath.isParentPath(toFilePath(pathOrUrl), joinPaths.joinPaths(this.#context.workspaceConfig.workspaceRoot, this.#context.config.output.outputPath))) {
1303
- return "fs";
1304
- }
1305
- return void 0;
1306
- }
1307
- /**
1308
- * Clears the resolver cache for a given path.
1309
- *
1310
- * @param path - The path to clear the resolver cache for.
1311
- */
1312
- clearResolverCache(path) {
1313
- this.#cachedResolver.keys().filter((key) => key.startsWith(toFilePath(path))).forEach((key) => this.#cachedResolver.delete(key));
1314
- }
1315
- /**
1316
- * Check if the file exists with different variants (index, extensions).
1317
- *
1318
- * @param request - The request path to check.
1319
- * @param parentPath - An optional parent path to prepend to the request.
1320
- * @returns The file path if it exists, otherwise false.
1321
- */
1322
- checkVariants(request, parentPath) {
1323
- const path = parentPath ? joinPaths.joinPaths(parentPath, request) : request;
1324
- let file = this.checkExtensions(path);
1325
- if (file) {
1326
- return file;
1327
- }
1328
- file = this.checkIndex(path);
1329
- if (file) {
1330
- return file;
1331
- }
1332
- return false;
1333
- }
1334
- /**
1335
- * Check if the index file exists in the given request path.
1336
- *
1337
- * @param request - The request path to check.
1338
- * @returns The index file path if it exists, otherwise false.
1339
- */
1340
- checkIndex(request) {
1341
- let file = joinPaths.joinPaths(request, "index");
1342
- if (this.#existsSync(file)) {
1343
- return file;
1344
- }
1345
- file = this.checkExtensions(file);
1346
- if (file) {
1347
- return file;
1348
- }
1349
- return false;
1350
- }
1351
- /**
1352
- * Check if the file exists with different extensions.
1353
- *
1354
- * @param request - The request path to check.
1355
- * @param vfs - The file system module to use for checking file existence.
1356
- * @returns The file path if it exists with any of the checked extensions, otherwise false.
1357
- */
1358
- checkExtensions(request) {
1359
- let file = `${request}.ts`;
1360
- if (this.#existsSync(file)) {
1361
- return file;
1362
- }
1363
- file = `${request}.mts`;
1364
- if (this.#existsSync(file)) {
1365
- return file;
1366
- }
1367
- file = `${request}.cts`;
1368
- if (this.#existsSync(file)) {
1369
- return file;
1370
- }
1371
- file = `${request}.tsx`;
1372
- if (this.#existsSync(file)) {
1373
- return file;
1374
- }
1375
- file = `${request}.js`;
1376
- if (this.#existsSync(file)) {
1377
- return file;
1378
- }
1379
- file = `${request}.mjs`;
1380
- if (this.#existsSync(file)) {
1381
- return file;
1382
- }
1383
- file = `${request}.cjs`;
1384
- if (this.#existsSync(file)) {
1385
- return file;
1386
- }
1387
- file = `${request}.jsx`;
1388
- if (this.#existsSync(file)) {
1389
- return file;
1390
- }
1391
- file = `${request}.json`;
1392
- if (this.#existsSync(file)) {
1393
- return file;
1394
- }
1395
- file = `${request}.d.ts`;
1396
- if (this.#existsSync(file)) {
1397
- return file;
1398
- }
1399
- return false;
1400
- }
1401
- };
1402
- function createVfs(context) {
1403
- const vfs = new VirtualFileSystem(context);
1404
- return vfs;
1405
- }
1406
- chunkPK6SKIKE_cjs.__name(createVfs, "createVfs");
1407
-
1408
- // src/internal/contexts/context.ts
1409
- var configCache = /* @__PURE__ */ new WeakMap();
1410
- var parseCache = /* @__PURE__ */ new WeakMap();
1411
- var PowerlinesContext = class _PowerlinesContext {
1412
- static {
1413
- chunkPK6SKIKE_cjs.__name(this, "PowerlinesContext");
1414
- }
1415
- #workspaceConfig;
1416
- #checksum = null;
1417
- #buildId = uuid.uuid();
1418
- #releaseId = uuid.uuid();
1419
- #timestamp = Date.now();
1420
- #envPaths;
1421
- #fs;
1422
- #tsconfig;
1423
- #getConfigProps(config = {}) {
1424
- return {
1425
- variant: config.build?.variant,
1426
- projectType: config.type,
1427
- projectRoot: config.root,
1428
- name: config.name,
1429
- title: config.title,
1430
- description: config.description,
1431
- sourceRoot: config.sourceRoot,
1432
- configFile: config.configFile,
1433
- customLogger: config.customLogger,
1434
- logLevel: config.logLevel,
1435
- tsconfig: config.tsconfig,
1436
- tsconfigRaw: config.tsconfigRaw,
1437
- skipCache: config.skipCache,
1438
- skipInstalls: config.skipInstalls,
1439
- entry: config.entry,
1440
- output: config.output,
1441
- plugins: config.plugins,
1442
- mode: config.mode,
1443
- lint: config.lint,
1444
- transform: config.transform,
1445
- build: config.build,
1446
- override: config.override,
1447
- framework: config.framework
1448
- };
1449
- }
1450
- /**
1451
- * Create a new Storm context from the workspace root and user config.
1452
- *
1453
- * @param workspaceRoot - The root directory of the workspace.
1454
- * @param config - The user configuration options.
1455
- * @returns A promise that resolves to the new context.
1456
- */
1457
- static async from(workspaceRoot, config) {
1458
- const context = new _PowerlinesContext(await chunkMGEZC2RV_cjs.loadWorkspaceConfig(workspaceRoot, config.root));
1459
- await context.withUserConfig(config);
1460
- context.powerlinesPath = await resolve.resolvePackage("powerlines");
1461
- if (!context.powerlinesPath) {
1462
- throw new Error("Could not resolve `powerlines` package location.");
1463
- }
1464
- return context;
1465
- }
1466
- /**
1467
- * An object containing the dependencies that should be installed for the project
1468
- */
1469
- dependencies = {};
1470
- /**
1471
- * An object containing the development dependencies that should be installed for the project
1472
- */
1473
- devDependencies = {};
1474
- /**
1475
- * The persisted meta information about the current build
1476
- */
1477
- persistedMeta = void 0;
1478
- /**
1479
- * The path to the Powerlines package
1480
- */
1481
- powerlinesPath;
1482
- /**
1483
- * The parsed `package.json` file for the project
1484
- */
1485
- packageJson;
1486
- /**
1487
- * The parsed `project.json` file for the project
1488
- */
1489
- projectJson = void 0;
1490
- /**
1491
- * The module resolver for the project
1492
- */
1493
- resolver;
1494
- /**
1495
- * The resolved entry type definitions for the project
1496
- */
1497
- get entry() {
1498
- return chunkBEKLDCTV_cjs.resolveEntriesSync(this, toArray.toArray(this.config.entry));
1499
- }
1500
- /**
1501
- * The TypeScript configuration parsed from the tsconfig file
1502
- */
1503
- get tsconfig() {
1504
- if (!this.#tsconfig) {
1505
- this.#tsconfig = {
1506
- tsconfigFilePath: this.config.tsconfig
1507
- };
1508
- }
1509
- return this.#tsconfig;
1510
- }
1511
- /**
1512
- * Sets the TypeScript configuration parsed from the tsconfig file
1513
- */
1514
- set tsconfig(value) {
1515
- this.#tsconfig = value;
1516
- }
1517
- /**
1518
- * The virtual file system interface for the project
1519
- */
1520
- get fs() {
1521
- if (!this.#fs) {
1522
- this.#fs = createVfs(this);
1523
- }
1524
- return this.#fs;
1525
- }
1526
- /**
1527
- * Get the checksum of the project's current state
1528
- */
1529
- get checksum() {
1530
- return this.#checksum;
1531
- }
1532
- /**
1533
- * The meta information about the current build
1534
- */
1535
- get meta() {
1536
- return {
1537
- buildId: this.#buildId,
1538
- releaseId: this.#releaseId,
1539
- checksum: this.#checksum,
1540
- timestamp: this.#timestamp,
1541
- projectRootHash: murmurhash.murmurhash({
1542
- workspaceRoot: this.workspaceConfig?.workspaceRoot,
1543
- projectRoot: this.config?.projectRoot
1544
- }, {
1545
- maxLength: chunkBW3VFCTS_cjs.PROJECT_ROOT_HASH_LENGTH
1546
- }),
1547
- configHash: murmurhash.murmurhash(this.config, {
1548
- maxLength: chunkBW3VFCTS_cjs.CACHE_HASH_LENGTH
1549
- }),
1550
- builtinIdMap: {},
1551
- virtualFiles: {}
1552
- };
1553
- }
1554
- /**
1555
- * The resolved configuration options
1556
- */
1557
- get config() {
1558
- return this.resolvedConfig ?? {};
1559
- }
1560
- /**
1561
- * The logger function
1562
- */
1563
- get log() {
1564
- if (!this.logFn) {
1565
- this.logFn = this.createLog();
1566
- }
1567
- return this.logFn;
1568
- }
1569
- /**
1570
- * The workspace configuration
1571
- */
1572
- get workspaceConfig() {
1573
- return this.#workspaceConfig;
1574
- }
1575
- /**
1576
- * The environment paths for the project
1577
- */
1578
- get envPaths() {
1579
- if (!this.#envPaths) {
1580
- this.#envPaths = getEnvPaths.getEnvPaths({
1581
- orgId: "storm-software",
1582
- appId: "powerlines",
1583
- workspaceRoot: this.workspaceConfig.workspaceRoot
1584
- });
1585
- }
1586
- return this.#envPaths;
1587
- }
1588
- /**
1589
- * Get the path to the artifacts directory for the project
1590
- */
1591
- get artifactsPath() {
1592
- return join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, this.config.output.artifactsFolder);
1593
- }
1594
- /**
1595
- * Get the path to the builtin modules used by the project
1596
- */
1597
- get builtinsPath() {
1598
- return join.joinPaths(this.artifactsPath, "builtins");
1599
- }
1600
- /**
1601
- * Get the path to the entry directory for the project
1602
- */
1603
- get entryPath() {
1604
- return join.joinPaths(this.artifactsPath, "entry");
1605
- }
1606
- /**
1607
- * Get the path to the data directory for the project
1608
- */
1609
- get dataPath() {
1610
- return join.joinPaths(this.envPaths.data, "projects", chunkBW3VFCTS_cjs.getPrefixedProjectRootHash(this.config.name, this.meta.projectRootHash));
1611
- }
1612
- /**
1613
- * Get the path to the cache directory for the project
1614
- */
1615
- get cachePath() {
1616
- return join.joinPaths(this.envPaths.cache, "projects", murmurhash.murmurhash({
1617
- checksum: this.#checksum,
1618
- config: this.meta.configHash
1619
- }, {
1620
- maxLength: chunkBW3VFCTS_cjs.CACHE_HASH_LENGTH
1621
- }));
1622
- }
1623
- /**
1624
- * Get the path to the generated declaration file for the project
1625
- */
1626
- get dtsPath() {
1627
- return this.config.output.dts ? append.appendPath(this.config.output.dts, this.workspaceConfig.workspaceRoot) : join.joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot, "storm.d.ts");
1628
- }
1629
- /**
1630
- * Get the project root relative to the workspace root
1631
- */
1632
- get relativeToWorkspaceRoot() {
1633
- return getWorkspaceRoot.relativeToWorkspaceRoot(this.config.projectRoot);
1634
- }
1635
- /**
1636
- * The builtin module id that exist in the Powerlines virtual file system
1637
- */
1638
- get builtins() {
1639
- return Object.values(this.fs.meta).filter((meta) => meta && meta.variant === "builtin").map((meta) => meta?.id).filter(Boolean);
1640
- }
1641
- /**
1642
- * Get the project root relative to the workspace root
1643
- */
1644
- async getBuiltins() {
1645
- return Promise.all(Object.entries(this.fs.meta).filter(([, meta]) => meta && meta.variant === "builtin").map(async ([path, meta]) => {
1646
- const code = await this.fs.readFile(path);
1647
- return {
1648
- ...meta,
1649
- path,
1650
- code
1651
- };
1652
- }));
1653
- }
1654
- /**
1655
- * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1656
- *
1657
- * @param code - The source code of the entry file
1658
- * @param path - A path to write the entry file to
1659
- * @param options - Optional write file options
1660
- */
1661
- async writeEntry(code, path, options = {}) {
1662
- return this.fs.writeFile(isType.isAbsolute(path) ? path : append.appendPath(path, this.entryPath), {
1663
- code,
1664
- variant: "entry"
1665
- }, defu3__default.default(options, {
1666
- mode: this.config.output.mode
1667
- }));
1668
- }
1669
- /**
1670
- * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1671
- *
1672
- * @param code - The source code of the builtin file
1673
- * @param id - The unique identifier of the builtin file
1674
- * @param path - An optional path to write the builtin file to
1675
- * @param options - Optional write file options
1676
- */
1677
- async writeBuiltin(code, id, path, options = {}) {
1678
- return this.fs.writeFile(path ? isType.isAbsolute(path) ? path : join.joinPaths(this.builtinsPath, path) : append.appendPath(id, this.builtinsPath), {
1679
- id,
1680
- code,
1681
- variant: "builtin"
1682
- }, defu3__default.default(options, {
1683
- mode: this.config.output.mode
1684
- }));
1685
- }
1686
- /**
1687
- * Parses the source code and returns a {@link ParseResult} object.
1688
- *
1689
- * @param code - The source code to parse.
1690
- * @param id - The unique identifier for the source file.
1691
- * @param options - Optional parser options.
1692
- * @returns The parsed {@link ParseResult} object.
1693
- */
1694
- async parse(code, id, options = {}) {
1695
- if (parseCache.has({
1696
- code,
1697
- options
1698
- })) {
1699
- return parseCache.get({
1700
- code,
1701
- options
1702
- });
1703
- }
1704
- const result = await oxcParser.parseAsync(id, code, defu3__default.default(options ?? {}, {
1705
- lang: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1706
- astType: filePathFns.hasFileExtension(id) ? void 0 : "ts",
1707
- sourceType: "module",
1708
- showSemanticErrors: false
1709
- }));
1710
- if (result.errors && result.errors.length > 0) {
1711
- throw new Error(`Powerlines parsing errors in file: ${id}
1712
- ${result.errors.map((error) => ` [${error.severity}] ${error.message}${error.codeframe ? ` (${error.codeframe})` : ""}${error.helpMessage ? `
1713
- Help: ${error.helpMessage}` : ""}`).join("\n")}`);
1714
- }
1715
- parseCache.set({
1716
- code,
1717
- options
1718
- }, result);
1719
- return result;
1720
- }
1721
- /**
1722
- * Update the context using a new user configuration options
1723
- *
1724
- * @param userConfig - The new user configuration options.
1725
- */
1726
- async withUserConfig(userConfig, options = {
1727
- isHighPriority: true
1728
- }) {
1729
- this.mergeUserConfig(userConfig);
1730
- await this.init(this.config.userConfig, options);
1731
- }
1732
- /**
1733
- * Update the context using a new inline configuration options
1734
- *
1735
- * @param inlineConfig - The new inline configuration options.
1736
- */
1737
- async withInlineConfig(inlineConfig, options = {
1738
- isHighPriority: true
1739
- }) {
1740
- this.config.inlineConfig = inlineConfig;
1741
- if (inlineConfig.command === "new") {
1742
- const workspacePackageJsonPath = join.joinPaths(this.workspaceConfig.workspaceRoot, "package.json");
1743
- if (!exists.existsSync(workspacePackageJsonPath)) {
1744
- throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
1745
- }
1746
- this.packageJson = await json.readJsonFile(workspacePackageJsonPath);
1747
- this.workspaceConfig.repository ??= isSetString.isSetString(this.packageJson?.repository) ? this.packageJson.repository : this.packageJson?.repository?.url;
1748
- }
1749
- await this.init(this.config.inlineConfig, options);
1750
- }
1751
- /**
1752
- * Create a new logger instance
1753
- *
1754
- * @param name - The name to use for the logger instance
1755
- * @returns A logger function
1756
- */
1757
- createLog(name = null) {
1758
- return chunk632PWWU7_cjs.createLog(name, {
1759
- ...this.config,
1760
- logLevel: isNull.isNull(this.config.logLevel) ? "silent" : this.config.logLevel
1761
- });
1762
- }
1763
- /**
1764
- * Extend the current logger instance with a new name
1765
- *
1766
- * @param name - The name to use for the extended logger instance
1767
- * @returns A logger function
1768
- */
1769
- extendLog(name) {
1770
- return chunk632PWWU7_cjs.extendLog(this.log, name);
1771
- }
1772
- /**
1773
- * Creates a new StormContext instance.
1774
- *
1775
- * @param workspaceConfig - The workspace configuration.
1776
- */
1777
- constructor(workspaceConfig) {
1778
- this.#workspaceConfig = workspaceConfig;
1779
- this.#envPaths = getEnvPaths.getEnvPaths({
1780
- orgId: "storm-software",
1781
- appId: "powerlines",
1782
- workspaceRoot: workspaceConfig.workspaceRoot
1783
- });
1784
- }
1785
- /**
1786
- * The resolved configuration for this context
1787
- */
1788
- resolvedConfig = {};
1789
- /**
1790
- * A logger function specific to this context
1791
- */
1792
- logFn;
1793
- /**
1794
- * Initialize the context with the provided configuration options
1795
- *
1796
- * @param config - The partial user configuration to use for initialization.
1797
- */
1798
- async init(config = {}, options = {
1799
- isHighPriority: true
1800
- }) {
1801
- const cacheKey = {
1802
- projectRoot: config.root ?? this.config.projectRoot ?? this.config.userConfig?.root ?? this.config.inlineConfig?.root,
1803
- mode: (config.mode ?? this.config.mode) || this.workspaceConfig.mode,
1804
- skipCache: config.skipCache ?? this.config.skipCache ?? false,
1805
- configFile: config.configFile ?? this.config.configFile,
1806
- command: this.config.inlineConfig?.command
1807
- };
1808
- if (configCache.has(cacheKey)) {
1809
- const result = configCache.get(cacheKey);
1810
- this.projectJson = result.projectJson;
1811
- this.packageJson = result.packageJson;
1812
- this.#checksum = result.checksum;
1813
- this.resolver = result.resolver;
1814
- this.mergeUserConfig(result.userConfig.config, this.config.userConfig);
1815
- } else {
1816
- const projectJsonPath = join.joinPaths(cacheKey.projectRoot, "project.json");
1817
- if (exists.existsSync(projectJsonPath)) {
1818
- this.projectJson = await json.readJsonFile(projectJsonPath);
1819
- }
1820
- const packageJsonPath = join.joinPaths(cacheKey.projectRoot, "package.json");
1821
- if (exists.existsSync(packageJsonPath)) {
1822
- this.packageJson = await json.readJsonFile(packageJsonPath);
1823
- }
1824
- this.#checksum = await chunkBW3VFCTS_cjs.getChecksum(cacheKey.projectRoot);
1825
- this.resolver = createResolver({
1826
- workspaceRoot: this.workspaceConfig.workspaceRoot,
1827
- projectRoot: cacheKey.projectRoot,
1828
- cacheDir: this.cachePath,
1829
- mode: cacheKey.mode,
1830
- skipCache: cacheKey.skipCache
1831
- });
1832
- const userConfig = await chunkMGEZC2RV_cjs.loadUserConfigFile(cacheKey.projectRoot, this.resolver, cacheKey.command, cacheKey.mode, cacheKey.configFile);
1833
- this.mergeUserConfig(userConfig.config);
1834
- configCache.set(cacheKey, {
1835
- projectJson: this.projectJson,
1836
- packageJson: this.packageJson,
1837
- checksum: this.#checksum,
1838
- resolver: this.resolver,
1839
- userConfig
1840
- });
1841
- }
1842
- if (isSetObject.isSetObject(config)) {
1843
- this.resolvedConfig = defu3__default.default({
1844
- inlineConfig: this.config.inlineConfig,
1845
- userConfig: this.config.userConfig
1846
- }, options.isHighPriority ? this.#getConfigProps(config) : {}, {
1847
- command: this.config.inlineConfig?.command,
1848
- ...this.#getConfigProps(this.config.inlineConfig)
1849
- }, this.#getConfigProps(this.config.userConfig), {
1850
- mode: this.workspaceConfig?.mode,
1851
- logLevel: this.workspaceConfig?.logLevel,
1852
- skipCache: this.workspaceConfig?.skipCache
1853
- }, {
1854
- name: this.projectJson?.name || this.packageJson?.name,
1855
- version: this.packageJson?.version,
1856
- description: this.packageJson?.description,
1857
- tsconfig: append.appendPath("tsconfig.json", cacheKey.projectRoot),
1858
- sourceRoot: this.projectJson?.sourceRoot || append.appendPath("src", cacheKey.projectRoot),
1859
- output: {
1860
- outputPath: join.joinPaths("dist", cacheKey.projectRoot),
1861
- mode: "virtual",
1862
- dts: join.joinPaths(cacheKey.projectRoot, `${config.framework ?? "powerlines"}.d.ts`),
1863
- builtinPrefix: config.framework ?? "powerlines",
1864
- artifactsFolder: join.joinPaths(cacheKey.projectRoot, `.${config.framework ?? "powerlines"}`),
1865
- assets: [
1866
- {
1867
- glob: "LICENSE"
1868
- },
1869
- {
1870
- input: cacheKey.projectRoot,
1871
- glob: "*.md"
1872
- },
1873
- {
1874
- input: cacheKey.projectRoot,
1875
- glob: "package.json"
1876
- }
1877
- ]
1878
- }
1879
- }, options.isHighPriority ? {} : this.#getConfigProps(config), {
1880
- inlineConfig: {},
1881
- userConfig: {},
1882
- framework: "powerlines",
1883
- platform: "neutral",
1884
- mode: "production",
1885
- projectType: "application",
1886
- logLevel: "info",
1887
- preview: false,
1888
- environments: {},
1889
- transform: {
1890
- babel: {
1891
- plugins: [],
1892
- presets: []
1893
- }
1894
- },
1895
- lint: {
1896
- eslint: {}
1897
- },
1898
- build: {
1899
- target: "esnext"
1900
- },
1901
- override: {}
1902
- });
1903
- }
1904
- this.config.entry = chunkBEKLDCTV_cjs.getUniqueEntries(this.config.entry);
1905
- if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) {
1906
- this.config.name = this.config.name.split("/").filter(Boolean)[1];
1907
- }
1908
- this.config.title ??= titleCase.titleCase(this.config.name);
1909
- if (this.config.build.external) {
1910
- this.config.build.external = getUnique.getUnique(this.config.build.external);
1911
- }
1912
- if (this.config.build.noExternal) {
1913
- this.config.build.noExternal = getUnique.getUnique(this.config.build.noExternal);
1914
- }
1915
- this.config.output.format = getUnique.getUnique(toArray.toArray(this.config.output?.format ?? (this.config.projectType === "library" ? [
1916
- "cjs",
1917
- "esm"
1918
- ] : [
1919
- "esm"
1920
- ])));
1921
- this.config.output.outputPath ??= join.joinPaths("dist", this.config.projectRoot || ".");
1922
- this.config.output.assets = getUnique.getUnique(this.config.output.assets.map((asset) => {
1923
- return {
1924
- glob: isSetObject.isSetObject(asset) ? asset.glob : asset,
1925
- input: isString.isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : append.appendPath(asset.input, this.workspaceConfig.workspaceRoot),
1926
- output: append.appendPath(isSetObject.isSetObject(asset) && asset.output ? join.joinPaths(this.config.output.outputPath, replace.replacePath(asset.output, this.config.output.outputPath)) : this.config.output.outputPath, this.workspaceConfig.workspaceRoot),
1927
- ignore: isSetObject.isSetObject(asset) && asset.ignore ? toArray.toArray(asset.ignore) : void 0
1928
- };
1929
- }));
1930
- this.config.plugins = (this.config.plugins ?? []).filter(Boolean).reduce((ret, plugin) => {
1931
- if (chunkRK2VVGL6_cjs.isPlugin(plugin) && chunkRK2VVGL6_cjs.checkDedupe(plugin, ret.filter((p) => chunkRK2VVGL6_cjs.isPlugin(p)))) {
1932
- return ret;
1933
- }
1934
- ret.push(plugin);
1935
- return ret;
1936
- }, []);
1937
- }
1938
- mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
1939
- this.config.userConfig = defu3__default.default({
1940
- entry: Array.isArray(from.entry) && from.entry.length > 0 ? from.entry : Array.isArray(into?.entry) && into.entry.length > 0 ? into.entry : []
1941
- }, omit.omit(from ?? {}, [
1942
- "entry"
1943
- ]), omit.omit(into ?? {}, [
1944
- "entry"
1945
- ]));
1946
- if (this.config.userConfig.output?.format) {
1947
- this.config.userConfig.output.format = getUnique.getUnique(toArray.toArray(this.config.userConfig.output?.format));
1948
- }
1949
- this.config.userConfig.plugins = (this.config.userConfig.plugins ?? []).filter(Boolean).reduce((ret, plugin) => {
1950
- if (chunkRK2VVGL6_cjs.isPlugin(plugin) && chunkRK2VVGL6_cjs.checkDedupe(plugin, ret.filter((p) => chunkRK2VVGL6_cjs.isPlugin(p)))) {
1951
- return ret;
1952
- }
1953
- ret.push(plugin);
1954
- return ret;
1955
- }, []);
1956
- }
1957
- };
1958
-
1959
- // src/types/plugin.ts
1960
- var PLUGIN_NON_HOOK_FIELDS = [
1961
- "name",
1962
- "enforce",
1963
- "dedupe",
1964
- "dependsOn",
1965
- "applyToEnvironment"
1966
- ];
1967
- async function callHook(context, hook, options, ...args) {
1968
- const handlers = context.selectHooks(hook, options);
1969
- if (handlers.length > 0) {
1970
- context.log(types.LogLevelLabel.DEBUG, ` \u{1F9E9} Calling plugin hook: ${chalk4__default.default.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
1971
- let results = [];
1972
- if (options?.sequential === false) {
1973
- results = await Promise.all(handlers.map(async (handler) => {
1974
- if (!isFunction.isFunction(handler)) {
1975
- throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
1976
- }
1977
- return Promise.resolve(handler.apply(null, ...args));
1978
- }));
1979
- } else {
1980
- for (const handler of handlers) {
1981
- if (!isFunction.isFunction(handler)) {
1982
- throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
1983
- }
1984
- results.push(await Promise.resolve(handler.apply(null, ...args)));
1985
- if (options?.result === "first" && isSet.isSet(results[results.length - 1])) {
1986
- break;
1987
- }
1988
- }
1989
- }
1990
- const definedResults = results.filter((result) => isSet.isSet(result));
1991
- if (definedResults.length > 0) {
1992
- let mergedResult = void 0;
1993
- for (const result of definedResults) {
1994
- mergedResult = defu3.defu(result, mergedResult ?? {});
1995
- }
1996
- return mergedResult;
1997
- }
1998
- }
1999
- return void 0;
2000
- }
2001
- chunkPK6SKIKE_cjs.__name(callHook, "callHook");
2002
-
2003
- // src/internal/contexts/plugin-context.ts
2004
- function createPluginContext(plugin, environment) {
2005
- const normalizeMessage = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((message) => {
2006
- return isString.isString(message) ? message : message.message;
2007
- }, "normalizeMessage");
2008
- const log = environment.extendLog(plugin.name);
2009
- const callHookFn = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name(async (hook, options, ...args) => {
2010
- return callHook(environment, hook, {
2011
- sequential: true,
2012
- ...options
2013
- }, ...args);
2014
- }, "callHookFn");
2015
- return new Proxy({}, {
2016
- get(_, prop) {
2017
- if (prop === "$$internal") {
2018
- return {
2019
- environment,
2020
- callHook: callHookFn
2021
- };
2022
- }
2023
- if (prop === "log" || prop === "logger") {
2024
- return log;
2025
- }
2026
- if (prop === "error") {
2027
- return (message) => {
2028
- log(types.LogLevelLabel.ERROR, normalizeMessage(message));
2029
- };
2030
- }
2031
- if (prop === "warn") {
2032
- return (message) => {
2033
- log(types.LogLevelLabel.WARN, normalizeMessage(message));
2034
- };
2035
- }
2036
- return environment[prop];
2037
- },
2038
- set(_, prop, value) {
2039
- if ([
2040
- "$$internal",
2041
- "environment",
2042
- "config",
2043
- "log",
2044
- "logger",
2045
- "error",
2046
- "warn",
2047
- "plugins",
2048
- "hooks",
2049
- "addPlugin",
2050
- "selectHooks"
2051
- ].includes(prop)) {
2052
- log(types.LogLevelLabel.WARN, `Cannot set read-only property "${String(prop)}"`);
2053
- return false;
2054
- }
2055
- environment[prop] = value;
2056
- return true;
2057
- }
2058
- });
2059
- }
2060
- chunkPK6SKIKE_cjs.__name(createPluginContext, "createPluginContext");
2061
-
2062
- // src/internal/contexts/environment-context.ts
2063
- var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
2064
- static {
2065
- chunkPK6SKIKE_cjs.__name(this, "PowerlinesEnvironmentContext");
2066
- }
2067
- #hooks = {};
2068
- /**
2069
- * Create a new Storm context from the workspace root and user config.
2070
- *
2071
- * @param workspaceConfig - The root directory of the workspace.
2072
- * @param config - The user configuration options.
2073
- * @returns A promise that resolves to the new context.
2074
- */
2075
- static async fromConfig(workspaceConfig, config) {
2076
- const context = new _PowerlinesEnvironmentContext(config, workspaceConfig);
2077
- await context.init();
2078
- context.powerlinesPath = await resolve.resolvePackage("powerlines");
2079
- if (!context.powerlinesPath) {
2080
- throw new Error("Could not resolve `powerlines` package location.");
2081
- }
2082
- return context;
2083
- }
2084
- environment;
2085
- plugins = [];
2086
- /**
2087
- * The resolved configuration options
2088
- */
2089
- get config() {
2090
- return super.config;
2091
- }
2092
- get hooks() {
2093
- return this.#hooks;
2094
- }
2095
- async addPlugin(plugin) {
2096
- let resolvedPlugin = plugin;
2097
- if (plugin.applyToEnvironment) {
2098
- const result = await Promise.resolve(plugin.applyToEnvironment(this.environment));
2099
- if (!result || isObject.isObject(result) && Object.keys(result).length === 0) {
2100
- return;
2101
- }
2102
- resolvedPlugin = chunkRK2VVGL6_cjs.isPlugin(result) ? result : plugin;
2103
- }
2104
- const context = createPluginContext(resolvedPlugin, this);
2105
- this.plugins.push({
2106
- plugin: resolvedPlugin,
2107
- context
2108
- });
2109
- this.#hooks = Object.keys(resolvedPlugin).filter((key) => !PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
2110
- const hook = key;
2111
- const pluginHook = resolvedPlugin[hook];
2112
- if (!chunkRK2VVGL6_cjs.isPluginHook(pluginHook)) {
2113
- return ret;
2114
- }
2115
- if (!chunkRK2VVGL6_cjs.isHookExternal(hook)) {
2116
- ret[hook] ??= {};
2117
- if (resolvedPlugin.enforce) {
2118
- ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];
2119
- chunkRK2VVGL6_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${resolvedPlugin.enforce}Enforced`]);
2120
- return ret;
2121
- }
2122
- if (isFunction.isFunction(pluginHook) || !pluginHook.order) {
2123
- ret[hook].normal ??= [];
2124
- chunkRK2VVGL6_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook].normal);
2125
- return ret;
2126
- }
2127
- ret[hook][`${pluginHook.order}Ordered`] ??= [];
2128
- chunkRK2VVGL6_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${pluginHook.order}Ordered`]);
2129
- } else {
2130
- ret[hook] ??= [];
2131
- ret[hook].push({
2132
- plugin: resolvedPlugin,
2133
- hook: chunkRK2VVGL6_cjs.getHookHandler(pluginHook).bind(context)
2134
- });
2135
- }
2136
- return ret;
2137
- }, this.hooks);
2138
- }
2139
- /**
2140
- * Retrieves the hook handlers for a specific hook name
2141
- */
2142
- selectHooks(hook, options) {
2143
- const handlers = [];
2144
- if (this.hooks[hook]) {
2145
- if (!chunkRK2VVGL6_cjs.isHookExternal(hook)) {
2146
- const hooks = this.hooks[hook];
2147
- if (options?.order) {
2148
- if (options?.order === "pre") {
2149
- handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
2150
- handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
2151
- } else if (options?.order === "post") {
2152
- handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
2153
- handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
2154
- } else {
2155
- handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
2156
- }
2157
- } else {
2158
- handlers.push(...this.selectHooks(hook, {
2159
- order: "pre"
2160
- }));
2161
- handlers.push(...this.selectHooks(hook, {
2162
- order: "normal"
2163
- }));
2164
- handlers.push(...this.selectHooks(hook, {
2165
- order: "post"
2166
- }));
2167
- }
2168
- } else {
2169
- handlers.push(...this.hooks[hook].map((h) => h.handler));
2170
- }
2171
- }
2172
- return handlers;
2173
- }
2174
- constructor(config, workspaceConfig) {
2175
- super(workspaceConfig);
2176
- this.resolvedConfig = config;
2177
- }
2178
- };
2179
-
2180
- // src/internal/contexts/api-context.ts
2181
- var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext {
2182
- static {
2183
- chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPIContext");
2184
- }
2185
- #environments = {};
2186
- #plugins = [];
2187
- #log;
2188
- /**
2189
- * Create a new Storm context from the workspace root and user config.
2190
- *
2191
- * @param workspaceRoot - The root directory of the workspace.
2192
- * @param config - The user configuration options.
2193
- * @returns A promise that resolves to the new context.
2194
- */
2195
- static async from(workspaceRoot, config) {
2196
- const context = new _PowerlinesAPIContext(await chunkMGEZC2RV_cjs.loadWorkspaceConfig(workspaceRoot, config.root));
2197
- await context.withUserConfig(config);
2198
- context.powerlinesPath = await resolve.resolvePackage("powerlines");
2199
- if (!context.powerlinesPath) {
2200
- throw new Error("Could not resolve `powerlines` package location.");
2201
- }
2202
- return context;
2203
- }
2204
- /**
2205
- * A record of all environments by name
2206
- */
2207
- get environments() {
2208
- return this.#environments;
2209
- }
2210
- get log() {
2211
- if (!this.#log) {
2212
- this.#log = this.createLog("engine");
2213
- }
2214
- return this.#log;
2215
- }
2216
- get plugins() {
2217
- return this.#plugins;
2218
- }
2219
- constructor(workspaceConfig) {
2220
- super(workspaceConfig);
2221
- }
2222
- /**
2223
- * Initialize the context with the provided configuration options
2224
- *
2225
- * @param config - The partial user configuration to use for initialization.
2226
- */
2227
- async init(config = {}) {
2228
- await super.init(config);
2229
- await Promise.all(toArray.toArray(this.config.userConfig.environments && Object.keys(this.config.userConfig.environments).length > 0 ? Object.keys(this.config.userConfig.environments).map((name) => createEnvironment(name, this.config.userConfig)) : createDefaultEnvironment(this.config.userConfig)).map(async (env) => {
2230
- this.#environments[env.name] = await this.in(env);
2231
- }));
2232
- }
2233
- /**
2234
- * A function to copy the context and update the fields for a specific environment
2235
- *
2236
- * @param environment - The environment configuration to use.
2237
- * @returns A new context instance with the updated environment.
2238
- */
2239
- async in(environment) {
2240
- let context;
2241
- if (this.environments[environment.name]) {
2242
- context = this.environments[environment.name];
2243
- } else {
2244
- context = await PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig, this.config);
2245
- }
2246
- if (isSetObject.isSetObject(this.config.inlineConfig)) {
2247
- await context.withInlineConfig(this.config.inlineConfig);
2248
- }
2249
- context.environment = environment;
2250
- context.plugins = [];
2251
- for (const plugin of this.plugins) {
2252
- await context.addPlugin(plugin);
2253
- }
2254
- return context;
2255
- }
2256
- async addPlugin(plugin) {
2257
- this.plugins.push(plugin);
2258
- await Promise.all(Object.keys(this.environments).map(async (name) => {
2259
- await this.environments[name].addPlugin(plugin);
2260
- }));
2261
- }
2262
- async getEnvironment(name) {
2263
- let environment;
2264
- if (name) {
2265
- environment = this.environments[name];
2266
- }
2267
- if (Object.keys(this.environments).length === 1) {
2268
- environment = this.environments[Object.keys(this.environments)[0]];
2269
- this.log(types.LogLevelLabel.DEBUG, `Applying the only configured environment: ${chalk4__default.default.bold.cyanBright(environment?.environment.name)}`);
2270
- }
2271
- if (!environment) {
2272
- if (name) {
2273
- throw new Error(`Environment "${name}" not found.`);
2274
- }
2275
- environment = await this.in(createDefaultEnvironment(this.config.userConfig));
2276
- this.log(types.LogLevelLabel.WARN, `No environment specified, and no default environment found. Using a temporary default environment: ${chalk4__default.default.bold.cyanBright(environment?.environment.name)}`);
2277
- }
2278
- return environment;
2279
- }
2280
- async getEnvironmentSafe(name) {
2281
- try {
2282
- return await this.getEnvironment(name);
2283
- } catch {
2284
- return void 0;
2285
- }
2286
- }
2287
- };
2288
- function resolveModulePath(nodePath, state) {
2289
- if (!t__namespace.isStringLiteral(nodePath.node)) {
2290
- return;
2291
- }
2292
- const sourcePath = nodePath.node.value;
2293
- const resolvedPath = state.context?.fs.resolve(sourcePath);
2294
- if (resolvedPath) {
2295
- nodePath.replaceWith(t__namespace.stringLiteral(
2296
- // Remove the file extension if it exists
2297
- resolvedPath.replace(/\.(?:ts|mts|cts)x?$/, "")
2298
- ));
2299
- }
2300
- }
2301
- chunkPK6SKIKE_cjs.__name(resolveModulePath, "resolveModulePath");
2302
- var TRANSFORM_FUNCTIONS = [
2303
- "require",
2304
- "require.resolve",
2305
- "System.import",
2306
- // Jest methods
2307
- "jest.genMockFromModule",
2308
- "jest.mock",
2309
- "jest.unmock",
2310
- "jest.doMock",
2311
- // eslint-disable-next-line @cspell/spellchecker
2312
- "jest.dontMock",
2313
- "jest.setMock",
2314
- "jest.requireActual",
2315
- "jest.requireMock",
2316
- // Older Jest methods
2317
- "require.requireActual",
2318
- "require.requireMock"
2319
- ];
2320
- function matchesPattern(state, calleePath, pattern) {
2321
- const { node } = calleePath;
2322
- if (t__namespace.isMemberExpression(node)) {
2323
- return calleePath.matchesPattern(pattern);
2324
- }
2325
- if (!t__namespace.isIdentifier(node) || pattern.includes(".")) {
2326
- return false;
2327
- }
2328
- const name = pattern.split(".")[0];
2329
- return node.name === name;
2330
- }
2331
- chunkPK6SKIKE_cjs.__name(matchesPattern, "matchesPattern");
2332
- var importVisitors = {
2333
- CallExpression: /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
2334
- if (state.moduleResolverVisited.has(nodePath)) {
2335
- return;
2336
- }
2337
- const calleePath = nodePath.get("callee");
2338
- if (calleePath && TRANSFORM_FUNCTIONS.some((pattern) => matchesPattern(state, calleePath, pattern)) || t__namespace.isImport(nodePath.node.callee)) {
2339
- state.moduleResolverVisited.add(nodePath);
2340
- resolveModulePath(nodePath.get("arguments.0"), state);
2341
- }
2342
- }, "CallExpression"),
2343
- // eslint-disable-next-line ts/naming-convention
2344
- "ImportDeclaration|ExportDeclaration|ExportAllDeclaration": /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((nodePath, state) => {
2345
- if (!nodePath || !nodePath.get("source") || state.moduleResolverVisited.has(nodePath)) {
2346
- return;
2347
- }
2348
- state.moduleResolverVisited.add(nodePath);
2349
- resolveModulePath(nodePath.get("source"), state);
2350
- }, "ImportDeclaration|ExportDeclaration|ExportAllDeclaration")
2351
- };
2352
- var moduleResolverBabelPlugin = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((context) => {
2353
- return helperPluginUtils.declare(/* @__PURE__ */ chunkPK6SKIKE_cjs.__name(function builder(api) {
2354
- let moduleResolverVisited = /* @__PURE__ */ new Set();
2355
- return {
2356
- name: "powerlines:module-resolver",
2357
- manipulateOptions(opts) {
2358
- opts.filename ??= "unknown";
2359
- },
2360
- pre() {
2361
- moduleResolverVisited = /* @__PURE__ */ new Set();
2362
- },
2363
- visitor: {
2364
- Program: {
2365
- enter(programPath, state) {
2366
- programPath.traverse(importVisitors, {
2367
- ...state,
2368
- context,
2369
- moduleResolverVisited,
2370
- api
2371
- });
2372
- },
2373
- exit(programPath, state) {
2374
- programPath.traverse(importVisitors, {
2375
- ...state,
2376
- context,
2377
- moduleResolverVisited,
2378
- api
2379
- });
2380
- }
2381
- }
2382
- },
2383
- post() {
2384
- moduleResolverVisited.clear();
2385
- }
2386
- };
2387
- }, "builder"));
2388
- }, "moduleResolverBabelPlugin");
2389
-
2390
- // src/internal/helpers/generate-types.ts
2391
- async function generateTypes(context) {
2392
- context.log(types.LogLevelLabel.TRACE, `Preparing the TypeScript definitions for the Powerlines project.`);
2393
- context.log(types.LogLevelLabel.TRACE, "Transforming built-ins runtime modules files.");
2394
- const builtinFiles = await context.getBuiltins();
2395
- const builtinFilePaths = await Promise.all(builtinFiles.map(async (file) => {
2396
- const result = await core.transformAsync(file.code.toString(), {
2397
- highlightCode: true,
2398
- code: true,
2399
- ast: false,
2400
- cloneInputAst: false,
2401
- comments: true,
2402
- sourceType: "module",
2403
- configFile: false,
2404
- babelrc: false,
2405
- envName: context.config.mode,
2406
- caller: {
2407
- name: "powerlines"
2408
- },
2409
- ...context.config.transform.babel,
2410
- filename: file.path,
2411
- plugins: [
2412
- [
2413
- "@babel/plugin-syntax-typescript"
2414
- ],
2415
- [
2416
- moduleResolverBabelPlugin(context)
2417
- ]
2418
- ]
2419
- });
2420
- if (!result?.code) {
2421
- throw new Error(`Powerlines - Generate Types failed to compile ${file.id}`);
2422
- }
2423
- context.log(types.LogLevelLabel.TRACE, `Writing transformed built-in runtime file ${file.id}.`);
2424
- await context.writeBuiltin(result.code, file.id, file.path);
2425
- return file.path;
2426
- }));
2427
- const typescriptPath = await resolve.resolvePackage("typescript");
2428
- if (!typescriptPath) {
2429
- throw new Error("Could not resolve TypeScript package location. Please ensure TypeScript is installed.");
2430
- }
2431
- const files = builtinFilePaths.reduce((ret, fileName) => {
2432
- const formatted = replace.replacePath(fileName, context.workspaceConfig.workspaceRoot);
2433
- if (!ret.includes(formatted)) {
2434
- ret.push(formatted);
2435
- }
2436
- return ret;
2437
- }, [
2438
- joinPaths.joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")
2439
- ]);
2440
- context.log(types.LogLevelLabel.TRACE, "Parsing TypeScript configuration for the Powerlines project.");
2441
- const resolvedTsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.tsconfig.tsconfigFilePath, defu3__default.default({
2442
- compilerOptions: {
2443
- strict: false,
2444
- noEmit: false,
2445
- declaration: true,
2446
- declarationMap: false,
2447
- emitDeclarationOnly: true,
2448
- skipLibCheck: true
2449
- },
2450
- exclude: [
2451
- "node_modules",
2452
- "dist"
2453
- ],
2454
- include: files
2455
- }, context.config.tsconfigRaw ?? {}));
2456
- resolvedTsconfig.options.configFilePath = joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.tsconfig.tsconfigFilePath);
2457
- resolvedTsconfig.options.pathsBasePath = context.workspaceConfig.workspaceRoot;
2458
- resolvedTsconfig.options.suppressOutputPathCheck = true;
2459
- context.log(types.LogLevelLabel.TRACE, "Creating the TypeScript compiler host");
2460
- const program = ts.createProgram(files, resolvedTsconfig.options, ts.createCompilerHost(resolvedTsconfig.options));
2461
- context.log(types.LogLevelLabel.TRACE, `Running TypeScript compiler on ${builtinFiles.length} built-in runtime files.`);
2462
- let builtinModules = "";
2463
- const emitResult = program.emit(void 0, (fileName, text, _, __, sourceFiles, _data) => {
2464
- const sourceFile2 = sourceFiles?.[0];
2465
- if (sourceFile2?.fileName && !fileName.endsWith(".map")) {
2466
- if (builtinFiles.some((file) => file.id === sourceFile2.fileName || file.path === sourceFile2.fileName)) {
2467
- builtinModules += `
2468
- declare module "${context.fs.resolve(sourceFile2.fileName)}" {
2469
- ${text.trim().replace(/^\s*export\s*declare\s*/gm, "export ").replace(/^\s*declare\s*/gm, "")}
2470
- }
2471
- `;
2472
- }
2473
- }
2474
- }, void 0, true);
2475
- const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
2476
- const diagnosticMessages = [];
2477
- diagnostics.forEach((diagnostic) => {
2478
- if (diagnostic.file) {
2479
- const { line, character } = ts.getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
2480
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
2481
- diagnosticMessages.push(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
2482
- } else {
2483
- const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
2484
- diagnosticMessages.push(message);
2485
- }
2486
- });
2487
- const diagnosticMessage = diagnosticMessages.join("\n");
2488
- if (diagnosticMessage) {
2489
- throw new Error(`TypeScript compilation failed:
2490
-
2491
- ${diagnosticMessage.length > 5e3 ? `${diagnosticMessage.slice(0, 5e3)}...` : diagnosticMessage}`);
2492
- }
2493
- context.log(types.LogLevelLabel.TRACE, `Generating TypeScript declaration file in ${context.config.output.dts}.`);
2494
- const sourceFile = chunkUQJWVRRE_cjs.getSourceFile(String(context.config.output.dts), `/// <reference types="powerlines/shared" />${context.config.build.platform !== "neutral" ? `
2495
- /// <reference types="powerlines/${context.config.build.platform}" />` : ""}
2496
-
2497
- ${chunkMFC7UJHT_cjs.getFileHeader(context, {
2498
- directive: null,
2499
- prettierIgnore: false
2500
- })}
2501
-
2502
- ${builtinModules}`.replace(
2503
- // eslint-disable-next-line regexp/no-super-linear-backtracking
2504
- /import\s*(?:type\s*)?\{?[\w,\s]*(?:\}\s*)?from\s*(?:'|")@?[a-zA-Z0-9-\\/.]*(?:'|");?/g,
2505
- ""
2506
- ).replaceAll("#private;", "").replace(/__Ω/g, ""));
2507
- await context.fs.writeFile(sourceFile.id, chunkUQJWVRRE_cjs.getString(sourceFile.code), {
2508
- mode: "fs"
2509
- });
2510
- }
2511
- chunkPK6SKIKE_cjs.__name(generateTypes, "generateTypes");
2512
- async function installPackage(context, packageName, dev = false) {
2513
- if (!await packageFns.isPackageListed(_package.getPackageName(packageName), {
2514
- cwd: context.config.projectRoot
2515
- })) {
2516
- if (context.config.skipInstalls !== true && !process.env.POWERLINES_LOCAL) {
2517
- context.log(types.LogLevelLabel.WARN, `The package "${packageName}" is not installed. It will be installed automatically.`);
2518
- const result = await install.install(packageName, {
2519
- cwd: context.config.projectRoot,
2520
- dev
2521
- });
2522
- if (isNumber.isNumber(result.exitCode) && result.exitCode > 0) {
2523
- context.log(types.LogLevelLabel.ERROR, result.stderr);
2524
- throw new Error(`An error occurred while installing the package "${packageName}"`);
2525
- }
2526
- } else {
2527
- context.log(types.LogLevelLabel.WARN, `The package "${packageName}" is not installed. Since the "skipInstalls" option is set to true, it will not be installed automatically.`);
2528
- }
2529
- } else if (_package.hasPackageVersion(packageName) && !process.env.POWERLINES_SKIP_VERSION_CHECK) {
2530
- const isMatching = await packageFns.doesPackageMatch(_package.getPackageName(packageName), _package.getPackageVersion(packageName), context.config.projectRoot);
2531
- if (!isMatching) {
2532
- const packageListing = await packageFns.getPackageListing(_package.getPackageName(packageName), {
2533
- cwd: context.config.projectRoot
2534
- });
2535
- if (!packageListing?.version.startsWith("catalog:") && !packageListing?.version.startsWith("workspace:")) {
2536
- context.log(types.LogLevelLabel.WARN, `The package "${_package.getPackageName(packageName)}" is installed but does not match the expected version ${_package.getPackageVersion(packageName)} (installed version: ${packageListing?.version || "<Unknown>"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`);
2537
- }
2538
- }
2539
- }
2540
- }
2541
- chunkPK6SKIKE_cjs.__name(installPackage, "installPackage");
2542
-
2543
- // src/internal/helpers/install-dependencies.ts
2544
- async function installDependencies(context) {
2545
- context.log(types.LogLevelLabel.TRACE, `Checking and installing missing project dependencies.`);
2546
- context.dependencies ??= {};
2547
- context.log(types.LogLevelLabel.TRACE, `The following packages are required:
2548
- Dependencies:
2549
- ${Object.entries(context.dependencies).map(([name, version]) => `- ${name}@${String(version)}`).join(" \n")}
2550
-
2551
- DevDependencies:
2552
- ${Object.entries(context.devDependencies).map(([name, version]) => `- ${name}@${String(version)}`).join(" \n")}`);
2553
- await Promise.all([
2554
- Promise.all(Object.entries(context.dependencies).map(async ([name, version]) => installPackage(context, `${_package.getPackageName(name)}@${String(version)}`, false))),
2555
- Promise.all(Object.entries(context.devDependencies).map(async ([name, version]) => installPackage(context, `${_package.getPackageName(name)}@${String(version)}`, true)))
2556
- ]);
2557
- }
2558
- chunkPK6SKIKE_cjs.__name(installDependencies, "installDependencies");
2559
- async function resolveTsconfigChanges(context) {
2560
- const tsconfig$1 = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
2561
- const tsconfigFilePath = chunkLJZEN4HP_cjs.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2562
- const tsconfigJson = await json.readJsonFile(tsconfigFilePath);
2563
- tsconfigJson.compilerOptions ??= {};
2564
- const extendedTsconfig = await tsconfig.loadTsConfig(tsconfigFilePath);
2565
- extendedTsconfig.compilerOptions ??= {};
2566
- if (tsconfigJson.reflection !== true) {
2567
- tsconfigJson.reflection = true;
2568
- }
2569
- if (tsconfig$1.options.experimentalDecorators !== true) {
2570
- tsconfigJson.compilerOptions.experimentalDecorators = true;
2571
- }
2572
- if (tsconfig$1.options.emitDecoratorMetadata !== true) {
2573
- tsconfigJson.compilerOptions.emitDecoratorMetadata = true;
2574
- }
2575
- if (context.config.output.dts) {
2576
- const dtsFilePath = context.config.output.dts ? context.config.output.dts.startsWith(context.workspaceConfig.workspaceRoot) ? context.config.output.dts : joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.dts) : joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, "storm.d.ts");
2577
- const dtsRelativePath = joinPaths.joinPaths(filePathFns.relativePath(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot), filePathFns.findFilePath(dtsFilePath)), filePathFns.findFileName(dtsFilePath));
2578
- if (!tsconfigJson.include?.some((filePattern) => chunkLJZEN4HP_cjs.isIncludeMatchFound(filePattern, [
2579
- dtsFilePath,
2580
- dtsRelativePath,
2581
- "storm.d.ts"
2582
- ]))) {
2583
- tsconfigJson.include ??= [];
2584
- tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
2585
- }
2586
- }
2587
- if (!tsconfig$1.options.lib?.some((lib) => [
2588
- "lib.esnext.d.ts",
2589
- "lib.es2021.d.ts",
2590
- "lib.es2022.d.ts",
2591
- "lib.es2023.d.ts"
2592
- ].includes(lib.toLowerCase()))) {
2593
- tsconfigJson.compilerOptions.lib ??= [];
2594
- tsconfigJson.compilerOptions.lib.push("esnext");
2595
- }
2596
- if (tsconfig$1.options.module !== ts__default.default.ModuleKind.ESNext) {
2597
- tsconfigJson.compilerOptions.module = "ESNext";
2598
- }
2599
- if (!tsconfig$1.options.target || ![
2600
- ts__default.default.ScriptTarget.ESNext,
2601
- ts__default.default.ScriptTarget.ES2024,
2602
- ts__default.default.ScriptTarget.ES2023,
2603
- ts__default.default.ScriptTarget.ES2022,
2604
- ts__default.default.ScriptTarget.ES2021
2605
- ].includes(tsconfig$1.options.target)) {
2606
- tsconfigJson.compilerOptions.target = "ESNext";
2607
- }
2608
- if (tsconfig$1.options.moduleResolution !== ts__default.default.ModuleResolutionKind.Bundler) {
2609
- tsconfigJson.compilerOptions.moduleResolution = "Bundler";
2610
- }
2611
- if (tsconfig$1.options.moduleDetection !== ts__default.default.ModuleDetectionKind.Force) {
2612
- tsconfigJson.compilerOptions.moduleDetection = "force";
2613
- }
2614
- if (tsconfig$1.options.allowSyntheticDefaultImports !== true) {
2615
- tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;
2616
- }
2617
- if (tsconfig$1.options.noImplicitOverride !== true) {
2618
- tsconfigJson.compilerOptions.noImplicitOverride = true;
2619
- }
2620
- if (tsconfig$1.options.noUncheckedIndexedAccess !== true) {
2621
- tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;
2622
- }
2623
- if (tsconfig$1.options.skipLibCheck !== true) {
2624
- tsconfigJson.compilerOptions.skipLibCheck = true;
2625
- }
2626
- if (tsconfig$1.options.resolveJsonModule !== true) {
2627
- tsconfigJson.compilerOptions.resolveJsonModule = true;
2628
- }
2629
- if (tsconfig$1.options.isolatedModules !== true) {
2630
- tsconfigJson.compilerOptions.isolatedModules = true;
2631
- }
2632
- if (tsconfig$1.options.verbatimModuleSyntax !== false) {
2633
- tsconfigJson.compilerOptions.verbatimModuleSyntax = false;
2634
- }
2635
- if (tsconfig$1.options.allowJs !== true) {
2636
- tsconfigJson.compilerOptions.allowJs = true;
2637
- }
2638
- if (tsconfig$1.options.esModuleInterop !== true) {
2639
- tsconfigJson.compilerOptions.esModuleInterop = true;
2640
- }
2641
- if (tsconfig$1.options.declaration !== true) {
2642
- tsconfigJson.compilerOptions.declaration = true;
2643
- }
2644
- if (context.environment.consumer === "client") {
2645
- if (tsconfig$1.options.jsx !== ts__default.default.JsxEmit.ReactJSX) {
2646
- tsconfigJson.compilerOptions.jsx = "react-jsx";
2647
- }
2648
- if (!tsconfig$1.options.lib?.some((lib) => lib.toLowerCase() !== "dom")) {
2649
- tsconfigJson.compilerOptions.lib ??= [];
2650
- tsconfigJson.compilerOptions.lib.push("dom");
2651
- }
2652
- if (!tsconfig$1.options.lib?.some((lib) => lib.toLowerCase() !== "dom.iterable")) {
2653
- tsconfigJson.compilerOptions.lib ??= [];
2654
- tsconfigJson.compilerOptions.lib.push("dom.iterable");
2655
- }
2656
- } else if (context.config.build.platform === "node") {
2657
- if (!tsconfig$1.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
2658
- tsconfigJson.compilerOptions.types ??= [];
2659
- tsconfigJson.compilerOptions.types.push("node");
2660
- }
2661
- }
2662
- return tsconfigJson;
2663
- }
2664
- chunkPK6SKIKE_cjs.__name(resolveTsconfigChanges, "resolveTsconfigChanges");
2665
- async function initializeTsconfig(context) {
2666
- context.log(types.LogLevelLabel.TRACE, "Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
2667
- if (!packageFns.isPackageExists("typescript")) {
2668
- throw new Error('The TypeScript package is not installed. Please install the package using the command: "npm install typescript --save-dev"');
2669
- }
2670
- const tsconfigFilePath = chunkLJZEN4HP_cjs.getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2671
- context.tsconfig.originalTsconfigJson = await json.readJsonFile(tsconfigFilePath);
2672
- context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
2673
- await context.fs.writeFile(tsconfigFilePath, stormJson.StormJSON.stringify(context.tsconfig.tsconfigJson), {
2674
- mode: "fs"
2675
- });
2676
- context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
2677
- }
2678
- chunkPK6SKIKE_cjs.__name(initializeTsconfig, "initializeTsconfig");
2679
- async function resolveTsconfig(context) {
2680
- const updateTsconfigJson = await json.readJsonFile(context.tsconfig.tsconfigFilePath);
2681
- if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) {
2682
- delete updateTsconfigJson.compilerOptions.types;
2683
- }
2684
- const result = superdiff.getObjectDiff(context.tsconfig.originalTsconfigJson, updateTsconfigJson, {
2685
- ignoreArrayOrder: true,
2686
- showOnly: {
2687
- statuses: [
2688
- "added",
2689
- "deleted",
2690
- "updated"
2691
- ],
2692
- granularity: "deep"
2693
- }
2694
- });
2695
- const changes = [];
2696
- const getChanges = /* @__PURE__ */ chunkPK6SKIKE_cjs.__name((difference, property) => {
2697
- if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") {
2698
- if (difference.diff) {
2699
- for (const diff of difference.diff) {
2700
- getChanges(diff, property ? `${property}.${difference.property}` : difference.property);
2701
- }
2702
- } else {
2703
- changes.push({
2704
- field: property ? `${property}.${difference.property}` : difference.property,
2705
- status: difference.status,
2706
- previous: difference.status === "added" ? "---" : stormJson.StormJSON.stringify(difference.previousValue),
2707
- current: difference.status === "deleted" ? "---" : stormJson.StormJSON.stringify(difference.currentValue)
2708
- });
2709
- }
2710
- }
2711
- }, "getChanges");
2712
- for (const diff of result.diff) {
2713
- getChanges(diff);
2714
- }
2715
- if (changes.length > 0) {
2716
- context.log(types.LogLevelLabel.WARN, `Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
2717
-
2718
- ${changes.map((change, i) => `${chalk4__default.default.bold.whiteBright(`${i + 1}. ${titleCase.titleCase(change.status)} the ${change.field} field: `)}
2719
- ${chalk4__default.default.red(` - Previous: ${change.previous} `)}
2720
- ${chalk4__default.default.green(` - Updated: ${change.current} `)}
2721
- `).join("\n")}
2722
- `);
2723
- }
2724
- await chunkRQICHHZM_cjs.writeFile(context.log, context.tsconfig.tsconfigFilePath, stormJson.StormJSON.stringify(updateTsconfigJson));
2725
- context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2726
- if (!context.tsconfig) {
2727
- throw new Error("Failed to parse the TypeScript configuration file.");
2728
- }
2729
- context.tsconfig.tsconfigJson.compilerOptions ??= {};
2730
- context.tsconfig.tsconfigJson.compilerOptions.strict = false;
2731
- }
2732
- chunkPK6SKIKE_cjs.__name(resolveTsconfig, "resolveTsconfig");
2733
-
2734
- // src/internal/api.ts
2735
- var PowerlinesAPI = class _PowerlinesAPI {
2736
- static {
2737
- chunkPK6SKIKE_cjs.__name(this, "PowerlinesAPI");
2738
- }
2739
- /**
2740
- * The Powerlines context
2741
- */
2742
- #context;
2743
- /**
2744
- * The Powerlines context
2745
- */
2746
- get context() {
2747
- return this.#context;
2748
- }
2749
- /**
2750
- * Create a new Powerlines API instance
2751
- *
2752
- * @param context - The Powerlines context
2753
- */
2754
- constructor(context) {
2755
- this.#context = context;
2756
- }
2757
- /**
2758
- * Initialize the Powerlines API
2759
- */
2760
- static async from(workspaceRoot, config) {
2761
- const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
2762
- for (const plugin of api.context.config.plugins ?? []) {
2763
- await api.#addPlugin(plugin);
2764
- }
2765
- if (api.context.plugins.length === 0) {
2766
- api.context.log(types.LogLevelLabel.WARN, "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
2767
- }
2768
- const pluginConfig = await callHook(await api.context.getEnvironment(), "config", {
2769
- sequential: true,
2770
- result: "merge"
2771
- });
2772
- await api.context.withUserConfig(pluginConfig, {
2773
- isHighPriority: false
2774
- });
2775
- return api;
2776
- }
2777
- /**
2778
- * Prepare the Powerlines API
2779
- */
2780
- async prepare(inlineConfig = {
2781
- command: "prepare"
2782
- }) {
2783
- this.context.log(types.LogLevelLabel.TRACE, " \u{1F3D7}\uFE0F Preparing the Powerlines project");
2784
- this.context.log(types.LogLevelLabel.TRACE, " \u2699\uFE0F Aggregating configuration options for the Powerlines project");
2785
- await this.context.withInlineConfig(inlineConfig);
2786
- await this.#executeEnvironments(async (context) => {
2787
- context.log(types.LogLevelLabel.TRACE, `Initializing the processing options for the Powerlines project.`);
2788
- await this.callPreHook(context, "configResolved");
2789
- await initializeTsconfig(context);
2790
- await this.callNormalHook(context, "configResolved");
2791
- context.log(types.LogLevelLabel.DEBUG, `The configuration provided ${toArray.toArray(context.config.entry).length} entry point(s), Powerlines has found ${context.entry.length} entry files(s) for the ${context.config.title} project${context.entry.length > 0 && context.entry.length < 10 ? `:
2792
- ${context.entry.map((entry) => `- ${entry.input.file || entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}.`);
2793
- await resolveTsconfig(context);
2794
- await installDependencies(context);
2795
- await this.callPostHook(context, "configResolved");
2796
- context.log(types.LogLevelLabel.TRACE, `Powerlines configuration has been resolved:
2797
-
2798
- ${console.formatLogMessage(context.config)}`);
2799
- context.fs[chunkBW3VFCTS_cjs.__VFS_INIT__]();
2800
- await chunkBW3VFCTS_cjs.writeMetaFile(context);
2801
- context.persistedMeta = context.meta;
2802
- if (!exists.existsSync(context.cachePath)) {
2803
- await helpers.createDirectory(context.cachePath);
2804
- }
2805
- if (!exists.existsSync(context.dataPath)) {
2806
- await helpers.createDirectory(context.dataPath);
2807
- }
2808
- await this.callPreHook(context, "prepare");
2809
- if (context.config.projectType === "application") {
2810
- context.log(types.LogLevelLabel.TRACE, "Generating built-in barrel file");
2811
- }
2812
- if (context.config.output.dts !== false) {
2813
- await generateTypes(context);
2814
- }
2815
- await this.callNormalHook(context, "prepare");
2816
- context.tsconfig = chunkLJZEN4HP_cjs.getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
2817
- if (!context.tsconfig) {
2818
- throw new Error("Failed to parse the TypeScript configuration file.");
2819
- }
2820
- await this.callPostHook(context, "prepare");
2821
- await chunkBW3VFCTS_cjs.writeMetaFile(context);
2822
- context.fs[chunkBW3VFCTS_cjs.__VFS_REVERT__]();
2823
- });
2824
- this.context.log(types.LogLevelLabel.INFO, "Powerlines API has been prepared successfully");
2825
- }
2826
- /**
2827
- * Create a new Powerlines project
2828
- *
2829
- * @remarks
2830
- * This method will create a new Powerlines project in the current directory.
2831
- *
2832
- * @param inlineConfig - The inline configuration for the new command
2833
- * @returns A promise that resolves when the project has been created
2834
- */
2835
- async new(inlineConfig) {
2836
- this.context.log(types.LogLevelLabel.INFO, "\u{1F195} Creating a new Powerlines project");
2837
- await this.prepare(inlineConfig);
2838
- await this.#executeEnvironments(async (context) => {
2839
- context.log(types.LogLevelLabel.TRACE, `Initializing the processing options for the Powerlines project.`);
2840
- await this.callPreHook(context, "new");
2841
- const files = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/common/**/*.hbs"));
2842
- for (const file of files) {
2843
- context.log(types.LogLevelLabel.TRACE, `Adding template file: ${file}`);
2844
- const template = Handlebars__default.default.compile(file);
2845
- await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2846
- }
2847
- await this.callNormalHook(context, "new");
2848
- if (context.config.projectType === "application") {
2849
- const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/application/**/*.hbs"));
2850
- for (const file of files2) {
2851
- context.log(types.LogLevelLabel.TRACE, `Adding application template file: ${file}`);
2852
- const template = Handlebars__default.default.compile(file);
2853
- await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2854
- }
2855
- } else {
2856
- const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
2857
- for (const file of files2) {
2858
- context.log(types.LogLevelLabel.TRACE, `Adding library template file: ${file}`);
2859
- const template = Handlebars__default.default.compile(file);
2860
- await chunkRQICHHZM_cjs.writeFile(context.log, joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
2861
- }
2862
- }
2863
- await this.callPostHook(context, "new");
2864
- });
2865
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines - New command completed");
2866
- }
2867
- /**
2868
- * Clean any previously prepared artifacts
2869
- *
2870
- * @remarks
2871
- * This method will remove the previous Powerlines artifacts from the project.
2872
- *
2873
- * @param inlineConfig - The inline configuration for the clean command
2874
- * @returns A promise that resolves when the clean command has completed
2875
- */
2876
- async clean(inlineConfig = {
2877
- command: "clean"
2878
- }) {
2879
- this.context.log(types.LogLevelLabel.INFO, "\u{1F9F9} Cleaning the previous Powerlines artifacts");
2880
- await this.prepare(inlineConfig);
2881
- await this.#executeEnvironments(async (context) => {
2882
- await callHook(context, "clean", {
2883
- sequential: true
2884
- });
2885
- });
2886
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines - Clean command completed");
2887
- }
2888
- /**
2889
- * Lint the project
2890
- *
2891
- * @param inlineConfig - The inline configuration for the lint command
2892
- * @returns A promise that resolves when the lint command has completed
2893
- */
2894
- async lint(inlineConfig = {
2895
- command: "lint"
2896
- }) {
2897
- this.context.log(types.LogLevelLabel.INFO, "\u{1F4CB} Linting the Powerlines project");
2898
- await this.prepare(inlineConfig);
2899
- await this.#executeEnvironments(async (context) => {
2900
- if (context.config.lint !== false) {
2901
- await this.callHook(context, "lint");
2902
- }
2903
- });
2904
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines linting completed");
2905
- }
2906
- /**
2907
- * Build the project
2908
- *
2909
- * @remarks
2910
- * This method will build the Powerlines project, generating the necessary artifacts.
2911
- *
2912
- * @param inlineConfig - The inline configuration for the build command
2913
- * @returns A promise that resolves when the build command has completed
2914
- */
2915
- async build(inlineConfig = {
2916
- command: "build"
2917
- }) {
2918
- this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Building the Powerlines project");
2919
- await this.prepare(inlineConfig);
2920
- await this.#executeEnvironments(async (context) => {
2921
- await this.callPreHook(context, "build");
2922
- await this.callNormalHook(context, "build");
2923
- await Promise.all(context.config.output.assets.map(async (asset) => {
2924
- context.log(types.LogLevelLabel.DEBUG, `Copying asset(s): ${chalk4__default.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths.joinPaths(replace.replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk4__default.default.greenBright(joinPaths.joinPaths(replace.replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk4__default.default.yellowBright(i)).join(", ")})` : ""}`);
2925
- await copyFile.copyFiles(asset, asset.output);
2926
- }));
2927
- await this.callPostHook(context, "build");
2928
- });
2929
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines build completed");
2930
- }
2931
- /**
2932
- * Prepare the documentation for the project
2933
- *
2934
- * @param inlineConfig - The inline configuration for the docs command
2935
- * @returns A promise that resolves when the documentation generation has completed
2936
- */
2937
- async docs(inlineConfig = {
2938
- command: "docs"
2939
- }) {
2940
- this.context.log(types.LogLevelLabel.INFO, "\u{1F4D3} Generating documentation for the Powerlines project");
2941
- await this.prepare(inlineConfig);
2942
- await this.#executeEnvironments(async (context) => {
2943
- context.log(types.LogLevelLabel.TRACE, "Writing documentation for the Powerlines project artifacts.");
2944
- await this.prepare(inlineConfig);
2945
- await this.#executeEnvironments(async (context2) => {
2946
- await this.callHook(context2, "docs");
2947
- });
2948
- });
2949
- this.#context.log(types.LogLevelLabel.TRACE, "Powerlines documentation generation completed");
2950
- }
2951
- /**
2952
- * Release the project
2953
- *
2954
- * @remarks
2955
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for release.
2956
- *
2957
- * @param inlineConfig - The inline configuration for the release command
2958
- */
2959
- async release(inlineConfig = {
2960
- command: "release"
2961
- }) {
2962
- this.context.log(types.LogLevelLabel.INFO, "\u{1F4E6} Releasing the Powerlines project");
2963
- await this.prepare(inlineConfig);
2964
- await this.#executeEnvironments(async (context) => {
2965
- await this.callHook(context, "release");
2966
- });
2967
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines release completed");
2968
- }
2969
- /**
2970
- * Finalization process
2971
- *
2972
- * @remarks
2973
- * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
2974
- *
2975
- * @returns A promise that resolves when the finalization process has completed
2976
- */
2977
- async finalize() {
2978
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution started");
2979
- await this.#executeEnvironments(async (context) => {
2980
- await this.callHook(context, "finalize");
2981
- context.fs[chunkBW3VFCTS_cjs.__VFS_REVERT__]();
2982
- });
2983
- this.context.log(types.LogLevelLabel.TRACE, "Powerlines finalize execution completed");
2984
- }
2985
- /**
2986
- * Calls a hook in parallel
2987
- *
2988
- * @param hook - The hook to call
2989
- * @param options - Options for calling the hook
2990
- * @param args - The arguments to pass to the hook
2991
- * @returns The result of the hook call
2992
- */
2993
- async callHookParallel(hook, options, ...args) {
2994
- return callHook(isSetObject.isSetObject(options?.environment) ? options.environment : await this.#context.getEnvironment(options?.environment), hook, {
2995
- ...options,
2996
- sequential: false
2997
- }, ...args);
2998
- }
2999
- /**
3000
- * Calls a hook in sequence
3001
- *
3002
- * @param hook - The hook to call
3003
- * @param options - Options for calling the hook
3004
- * @param args - The arguments to pass to the hook
3005
- * @returns The result of the hook call
3006
- */
3007
- async callHookSequential(hook, options, ...args) {
3008
- return callHook(isSetObject.isSetObject(options?.environment) ? options.environment : await this.#context.getEnvironment(options?.environment), hook, {
3009
- ...options,
3010
- sequential: true
3011
- }, ...args);
3012
- }
3013
- /**
3014
- * Calls the `"pre"` ordered hooks in sequence
3015
- *
3016
- * @param environment - The environment to use for the hook call
3017
- * @param hook - The hook to call
3018
- * @param args - The arguments to pass to the hook
3019
- * @returns The result of the hook call
3020
- */
3021
- async callPreHook(environment, hook, ...args) {
3022
- return this.callHookSequential(hook, {
3023
- order: "pre",
3024
- environment
3025
- }, ...args);
3026
- }
3027
- /**
3028
- * Calls the `"post"` ordered hooks in sequence
3029
- *
3030
- * @param environment - The environment to use for the hook call
3031
- * @param hook - The hook to call
3032
- * @param args - The arguments to pass to the hook
3033
- * @returns The result of the hook call
3034
- */
3035
- async callPostHook(environment, hook, ...args) {
3036
- return this.callHookSequential(hook, {
3037
- order: "post",
3038
- environment
3039
- }, ...args);
3040
- }
3041
- /**
3042
- * Calls a hook in sequence
3043
- *
3044
- * @param environment - The environment to use for the hook call
3045
- * @param hook - The hook to call
3046
- * @param args - The arguments to pass to the hook
3047
- * @returns The result of the hook call
3048
- */
3049
- async callNormalHook(environment, hook, ...args) {
3050
- return this.callHookSequential(hook, {
3051
- order: "normal",
3052
- environment
3053
- }, ...args);
3054
- }
3055
- /**
3056
- * Calls the `"pre"` and `"post"` ordered hooks, as well as the normal hooks in sequence
3057
- *
3058
- * @param environment - The environment to use for the hook call
3059
- * @param hook - The hook to call
3060
- * @param args - The arguments to pass to the hook
3061
- * @returns The result of the hook call
3062
- */
3063
- async callHook(environment, hook, ...args) {
3064
- return this.callHookSequential(hook, {
3065
- environment
3066
- }, ...args);
3067
- }
3068
- async [Symbol.asyncDispose]() {
3069
- await this.finalize();
3070
- }
3071
- /**
3072
- * Get the configured environments
3073
- *
3074
- * @returns The configured environments
3075
- */
3076
- async #getEnvironments() {
3077
- if (!this.context.config.environments || Object.keys(this.context.config.environments).length <= 1) {
3078
- this.context.log(types.LogLevelLabel.DEBUG, "No environments are configured for this Powerlines project. Using the default environment.");
3079
- return [
3080
- await this.context.getEnvironment()
3081
- ];
3082
- }
3083
- this.context.log(types.LogLevelLabel.DEBUG, `Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`);
3084
- return (await Promise.all(Object.entries(this.context.config.environments).map(async ([name, config]) => {
3085
- const environment = await this.context.getEnvironmentSafe(name);
3086
- if (!environment) {
3087
- const resolvedEnvironment = await this.callHookParallel("configEnvironment", {
3088
- environment: name
3089
- }, name, config);
3090
- if (resolvedEnvironment) {
3091
- this.context.environments[name] = await this.context.in(resolvedEnvironment);
3092
- }
3093
- }
3094
- return this.context.environments[name];
3095
- }))).filter((context) => isSet.isSet(context));
3096
- }
3097
- /**
3098
- * Execute a handler function for each environment
3099
- *
3100
- * @param handle - The handler function to execute for each environment
3101
- */
3102
- async #executeEnvironments(handle) {
3103
- await Promise.all((await this.#getEnvironments()).map(async (context) => {
3104
- return Promise.resolve(handle(context));
3105
- }));
3106
- }
3107
- /**
3108
- * Add a Powerlines plugin used in the build process
3109
- *
3110
- * @param config - The import path of the plugin to add
3111
- */
3112
- async #addPlugin(config) {
3113
- if (config) {
3114
- const plugin = await this.#initPlugin(config);
3115
- if (!plugin) {
3116
- return;
3117
- }
3118
- if (plugin.dependsOn) {
3119
- for (const required of plugin.dependsOn) {
3120
- await this.#addPlugin(required);
3121
- }
3122
- }
3123
- this.context.log(types.LogLevelLabel.DEBUG, `Successfully initialized the ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin`);
3124
- await this.context.addPlugin(plugin);
3125
- }
3126
- }
3127
- /**
3128
- * Initialize a Powerlines plugin
3129
- *
3130
- * @param config - The configuration for the plugin
3131
- * @returns The initialized plugin instance, or null if the plugin was a duplicate
3132
- * @throws Will throw an error if the plugin cannot be found or is invalid
3133
- */
3134
- async #initPlugin(config) {
3135
- let awaited = config;
3136
- if (isPromise.isPromiseLike(config)) {
3137
- awaited = await Promise.resolve(config);
3138
- }
3139
- if (!chunkRK2VVGL6_cjs.isPluginConfig(awaited)) {
3140
- throw new Error(`Invalid plugin specified in the configuration - ${JSON.stringify(awaited)}. Please ensure the value is a plugin name, an object with the \`plugin\` and \`props\` properties, or an instance of \`Plugin\`.`);
3141
- }
3142
- let plugin;
3143
- if (chunkRK2VVGL6_cjs.isPlugin(awaited)) {
3144
- plugin = awaited;
3145
- } else if (isFunction.isFunction(awaited)) {
3146
- plugin = await Promise.resolve(awaited());
3147
- } else if (isSetString.isSetString(awaited)) {
3148
- const resolved = await this.#resolvePlugin(awaited);
3149
- if (isFunction.isFunction(resolved)) {
3150
- plugin = await Promise.resolve(resolved());
3151
- } else {
3152
- plugin = resolved;
3153
- }
3154
- } else if (chunkRK2VVGL6_cjs.isPluginConfigTuple(awaited) || chunkRK2VVGL6_cjs.isPluginConfigObject(awaited)) {
3155
- let pluginConfig;
3156
- let pluginOptions;
3157
- if (chunkRK2VVGL6_cjs.isPluginConfigTuple(awaited)) {
3158
- pluginConfig = awaited[0];
3159
- pluginOptions = awaited?.length === 2 ? awaited[1] : void 0;
3160
- } else {
3161
- pluginConfig = awaited.plugin;
3162
- pluginOptions = awaited.options;
3163
- }
3164
- if (isSetString.isSetString(pluginConfig)) {
3165
- const resolved = await this.#resolvePlugin(pluginConfig);
3166
- if (isFunction.isFunction(resolved)) {
3167
- plugin = await Promise.resolve(pluginOptions ? resolved(pluginOptions) : resolved());
3168
- } else {
3169
- plugin = resolved;
3170
- }
3171
- } else if (isFunction.isFunction(pluginConfig)) {
3172
- plugin = await Promise.resolve(pluginConfig(pluginOptions));
3173
- } else if (chunkRK2VVGL6_cjs.isPlugin(pluginConfig)) {
3174
- plugin = pluginConfig;
3175
- }
3176
- }
3177
- if (!plugin) {
3178
- throw new Error(`The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`);
3179
- }
3180
- if (!chunkRK2VVGL6_cjs.isPlugin(plugin)) {
3181
- throw new Error(`The plugin option ${JSON.stringify(plugin)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);
3182
- }
3183
- if (chunkRK2VVGL6_cjs.checkDedupe(plugin, this.context.plugins)) {
3184
- this.context.log(types.LogLevelLabel.TRACE, `Duplicate ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
3185
- return null;
3186
- }
3187
- this.context.log(types.LogLevelLabel.TRACE, `Initializing the ${chalk4__default.default.bold.cyanBright(plugin.name)} plugin...`);
3188
- return plugin;
3189
- }
3190
- async #resolvePlugin(pluginPath) {
3191
- if (pluginPath.startsWith("@") && pluginPath.split("/").filter(Boolean).length > 2) {
3192
- const splits = pluginPath.split("/").filter(Boolean);
3193
- pluginPath = `${splits[0]}/${splits[1]}`;
3194
- }
3195
- const isInstalled = packageFns.isPackageExists(pluginPath, {
3196
- paths: [
3197
- this.context.workspaceConfig.workspaceRoot,
3198
- this.context.config.projectRoot
3199
- ]
3200
- });
3201
- if (!isInstalled && this.context.config.skipInstalls !== true) {
3202
- this.#context.log(types.LogLevelLabel.WARN, `The plugin package "${pluginPath}" is not installed. It will be installed automatically.`);
3203
- const result = await install.install(pluginPath, {
3204
- cwd: this.context.config.projectRoot
3205
- });
3206
- if (isNumber.isNumber(result.exitCode) && result.exitCode > 0) {
3207
- this.#context.log(types.LogLevelLabel.ERROR, result.stderr);
3208
- throw new Error(`An error occurred while installing the build plugin package "${pluginPath}" `);
3209
- }
3210
- }
3211
- try {
3212
- const module = await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(joinPaths.joinPaths(pluginPath, "plugin")));
3213
- const result = module.plugin ?? module.default;
3214
- if (!result) {
3215
- throw new Error(`The plugin package "${pluginPath}" does not export a valid module.`);
3216
- }
3217
- return result;
3218
- } catch (error) {
3219
- try {
3220
- const module = await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(pluginPath));
3221
- const result = module.plugin ?? module.default;
3222
- if (!result) {
3223
- throw new Error(`The plugin package "${pluginPath}" does not export a valid module.`);
3224
- }
3225
- return result;
3226
- } catch {
3227
- if (!isInstalled) {
3228
- throw new Error(`The plugin package "${pluginPath}" is not installed. Please install the package using the command: "npm install ${pluginPath} --save-dev"`);
3229
- } else {
3230
- throw new Error(`An error occurred while importing the build plugin package "${pluginPath}":
3231
- ${isError.isError(error) ? error.message : String(error)}
3232
-
3233
- Note: Please ensure the plugin package's default export is a class that extends \`Plugin\` with a constructor that excepts a single arguments of type \`PluginOptions\`.`);
3234
- }
3235
- }
3236
- }
3237
- }
3238
- };
3239
-
3240
- // src/lib/unplugin/factory.ts
3241
- function createUnpluginFactory(variant, decorate) {
3242
- return (config, meta) => {
3243
- const log = chunk632PWWU7_cjs.createLog("unplugin", config);
3244
- log(types.LogLevelLabel.DEBUG, "Initializing Unplugin");
3245
- try {
3246
- const userConfig = {
3247
- ...config,
3248
- variant,
3249
- unplugin: meta
3250
- };
3251
- let api;
3252
- let resolvePatterns = [];
3253
- async function buildStart() {
3254
- log(types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
3255
- const workspaceRoot = getWorkspaceRoot.getWorkspaceRoot(process.cwd());
3256
- api = await PowerlinesAPI.from(workspaceRoot, userConfig);
3257
- if (api.context.config.build.skipNodeModulesBundle) {
3258
- resolvePatterns = bundleRequire.tsconfigPathsToRegExp(api.context.tsconfig.options.paths ?? []);
3259
- }
3260
- log(types.LogLevelLabel.DEBUG, "Preparing build artifacts for the Powerlines project...");
3261
- await api.prepare({
3262
- command: "build"
3263
- });
3264
- }
3265
- chunkPK6SKIKE_cjs.__name(buildStart, "buildStart");
3266
- async function resolveId(id, importer, options = {
3267
- isEntry: false
3268
- }) {
3269
- return chunk7EAV6Q7B_cjs.handleResolveId(api.context, {
3270
- id,
3271
- importer,
3272
- options
3273
- }, {
3274
- skipNodeModulesBundle: api.context.config.build.skipNodeModulesBundle,
3275
- external: api.context.config.build.external,
3276
- noExternal: api.context.config.build.noExternal,
3277
- resolvePatterns
3278
- });
3279
- }
3280
- chunkPK6SKIKE_cjs.__name(resolveId, "resolveId");
3281
- async function load(id) {
3282
- const environment = await api.context.getEnvironment();
3283
- if (id) {
3284
- const resolvedPath = environment.fs.resolve(id);
3285
- if (resolvedPath) {
3286
- return environment.fs.readFile(resolvedPath);
3287
- }
3288
- }
3289
- let result2 = await api.callPreHook(environment, "load", id);
3290
- if (result2) {
3291
- return result2;
3292
- }
3293
- result2 = await api.callNormalHook(environment, "load", id);
3294
- if (result2) {
3295
- return result2;
3296
- }
3297
- return api.callPostHook(environment, "load", id);
3298
- }
3299
- chunkPK6SKIKE_cjs.__name(load, "load");
3300
- async function transform(code, id) {
3301
- const environment = await api.context.getEnvironment();
3302
- let transformed = code;
3303
- let result2 = await api.callPreHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3304
- if (result2) {
3305
- transformed = result2;
3306
- }
3307
- result2 = await api.callNormalHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3308
- if (result2) {
3309
- transformed = result2;
3310
- }
3311
- result2 = await api.callPostHook(environment, "transform", chunkUQJWVRRE_cjs.getString(transformed), id);
3312
- if (result2) {
3313
- transformed = result2;
3314
- }
3315
- return transformed;
3316
- }
3317
- chunkPK6SKIKE_cjs.__name(transform, "transform");
3318
- async function writeBundle() {
3319
- log(types.LogLevelLabel.DEBUG, "Finalizing Powerlines project output...");
3320
- const environment = await api.context.getEnvironment();
3321
- await api.callHook(environment, "writeBundle");
3322
- }
3323
- chunkPK6SKIKE_cjs.__name(writeBundle, "writeBundle");
3324
- const result = {
3325
- name: "powerlines",
3326
- resolveId: {
3327
- filter: {
3328
- id: {
3329
- include: [
3330
- /.*/
3331
- ]
3332
- }
3333
- },
3334
- handler: resolveId
3335
- },
3336
- load: {
3337
- filter: {
3338
- id: {
3339
- include: [
3340
- /.*/,
3341
- /^storm:/
3342
- ]
3343
- }
3344
- },
3345
- handler: load
3346
- },
3347
- transform,
3348
- buildStart,
3349
- writeBundle
3350
- };
3351
- return decorate ? decorate(api, result) : result;
3352
- } catch (error) {
3353
- log(types.LogLevelLabel.FATAL, error?.message);
3354
- throw error;
3355
- }
3356
- };
3357
- }
3358
- chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
3359
-
3360
- exports.createUnpluginFactory = createUnpluginFactory;
3361
- //# sourceMappingURL=chunk-LYD5OTBI.cjs.map
3362
- //# sourceMappingURL=chunk-LYD5OTBI.cjs.map