powerlines 0.34.9 → 0.35.1

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 (303) hide show
  1. package/dist/{api-64F6GdFq.d.cts → api-Ch19bYX6.d.cts} +1 -1
  2. package/dist/{api-C8dgNF9j.d.ts → api-DJoWdEeA.d.ts} +1 -1
  3. package/dist/api.cjs +2 -2
  4. package/dist/api.d.cts +3 -3
  5. package/dist/api.d.ts +3 -3
  6. package/dist/api.js +1 -1
  7. package/dist/astro.cjs +4 -4
  8. package/dist/astro.d.cts +2 -2
  9. package/dist/astro.d.ts +2 -2
  10. package/dist/astro.js +3 -3
  11. package/dist/chunk-24F67D36.cjs +12 -0
  12. package/dist/{chunk-WLBT35SV.cjs → chunk-3TJ77HBR.cjs} +5 -5
  13. package/dist/{chunk-3HMEVUF3.js → chunk-4JTXARCZ.js} +3 -3
  14. package/dist/{chunk-JZA7N2M4.js → chunk-4ZM66B4T.js} +3 -3
  15. package/dist/{chunk-MLAI362G.js → chunk-52UMGJQJ.js} +3 -3
  16. package/dist/{chunk-AMPAP7VJ.js → chunk-7GLQATKT.js} +3 -3
  17. package/dist/{chunk-O5QCLZXU.cjs → chunk-AFSF26JE.cjs} +4 -4
  18. package/dist/{chunk-IWD7XNVY.js → chunk-EJZVAP3T.js} +2 -2
  19. package/dist/{chunk-RFPNTMLX.js → chunk-GIOACISS.js} +2 -2
  20. package/dist/{chunk-NJRZDDTZ.cjs → chunk-IJXEMXLH.cjs} +2 -2
  21. package/dist/{chunk-BY2N3ZJV.js → chunk-JEP7MDIY.js} +67 -32
  22. package/dist/{chunk-MBPLCGMU.js → chunk-LUTJ2RSQ.js} +3 -3
  23. package/dist/{chunk-V64P3LPH.cjs → chunk-OOZPDTJM.cjs} +67 -32
  24. package/dist/{chunk-IMRQNWR4.cjs → chunk-QMYQNHIP.cjs} +4 -4
  25. package/dist/chunk-S6KFRQYJ.cjs +12 -0
  26. package/dist/{chunk-BCF2FSIU.cjs → chunk-UMU2MF3G.cjs} +2 -2
  27. package/dist/{context-CD3z3bug.d.ts → context-CWyF5B_6.d.ts} +18 -14
  28. package/dist/{context-CybU4gzB.d.cts → context-HIW4qjIs.d.cts} +18 -14
  29. package/dist/esbuild.cjs +6 -6
  30. package/dist/esbuild.d.cts +2 -2
  31. package/dist/esbuild.d.ts +2 -2
  32. package/dist/esbuild.js +3 -3
  33. package/dist/farm.cjs +3 -3
  34. package/dist/farm.d.cts +2 -2
  35. package/dist/farm.d.ts +2 -2
  36. package/dist/farm.js +2 -2
  37. package/dist/index.cjs +15 -15
  38. package/dist/index.d.cts +4 -4
  39. package/dist/index.d.ts +4 -4
  40. package/dist/index.js +4 -4
  41. package/dist/lib/{api-WGXMngpt.d.ts → api-B8aBolnU.d.ts} +1 -1
  42. package/dist/lib/{api-C-muqDwC.d.cts → api-C6p2jxI9.d.cts} +1 -1
  43. package/dist/lib/build/esbuild.d.cts +2 -2
  44. package/dist/lib/build/esbuild.d.ts +2 -2
  45. package/dist/lib/build/index.d.cts +4 -4
  46. package/dist/lib/build/index.d.ts +4 -4
  47. package/dist/lib/build/rolldown.d.cts +2 -2
  48. package/dist/lib/build/rolldown.d.ts +2 -2
  49. package/dist/lib/build/rollup.d.cts +2 -2
  50. package/dist/lib/build/rollup.d.ts +2 -2
  51. package/dist/lib/build/rspack.d.cts +2 -2
  52. package/dist/lib/build/rspack.d.ts +2 -2
  53. package/dist/lib/build/tsdown.d.cts +2 -2
  54. package/dist/lib/build/tsdown.d.ts +2 -2
  55. package/dist/lib/build/tsup.d.cts +2 -2
  56. package/dist/lib/build/tsup.d.ts +2 -2
  57. package/dist/lib/build/unbuild.d.cts +4 -4
  58. package/dist/lib/build/unbuild.d.ts +4 -4
  59. package/dist/lib/build/vite.d.cts +2 -2
  60. package/dist/lib/build/vite.d.ts +2 -2
  61. package/dist/lib/build/webpack.d.cts +2 -2
  62. package/dist/lib/build/webpack.d.ts +2 -2
  63. package/dist/lib/{chunk-2KYZLGIZ.js → chunk-25C6FCLA.js} +4 -4
  64. package/dist/lib/{chunk-2KYZLGIZ.js.map → chunk-25C6FCLA.js.map} +1 -1
  65. package/dist/lib/{chunk-VPZU5BTK.js → chunk-3BXSIJGU.js} +17 -6
  66. package/dist/lib/chunk-3BXSIJGU.js.map +1 -0
  67. package/dist/lib/{chunk-UWOD2XLX.cjs → chunk-53LK7IG5.cjs} +17 -3
  68. package/dist/lib/chunk-53LK7IG5.cjs.map +1 -0
  69. package/dist/lib/{chunk-RRPFZDGI.cjs → chunk-7XTQMSUB.cjs} +6 -6
  70. package/dist/lib/{chunk-RRPFZDGI.cjs.map → chunk-7XTQMSUB.cjs.map} +1 -1
  71. package/dist/lib/{chunk-HVL3SPVN.js → chunk-FM7R4KTA.js} +40 -30
  72. package/dist/lib/chunk-FM7R4KTA.js.map +1 -0
  73. package/dist/lib/{chunk-VM6LBJ3L.cjs → chunk-NOABJWDK.cjs} +45 -35
  74. package/dist/lib/chunk-NOABJWDK.cjs.map +1 -0
  75. package/dist/lib/{chunk-MBGLVIJD.js → chunk-Q7KX7QCP.js} +3 -3
  76. package/dist/lib/{chunk-MBGLVIJD.js.map → chunk-Q7KX7QCP.js.map} +1 -1
  77. package/dist/lib/{chunk-NXUMUI2Z.js → chunk-TB2ZWKZN.js} +17 -3
  78. package/dist/lib/chunk-TB2ZWKZN.js.map +1 -0
  79. package/dist/lib/{chunk-UZSTEOLF.cjs → chunk-VAIDDF5X.cjs} +19 -8
  80. package/dist/lib/chunk-VAIDDF5X.cjs.map +1 -0
  81. package/dist/lib/{chunk-XXQREHLK.cjs → chunk-VMWMBMXG.cjs} +13 -13
  82. package/dist/lib/{chunk-XXQREHLK.cjs.map → chunk-VMWMBMXG.cjs.map} +1 -1
  83. package/dist/lib/{config-ba1qwxTg.d.ts → config-CGGo9KcK.d.ts} +17 -13
  84. package/dist/lib/{config-Lr7p1CKw.d.cts → config-CYz6Kd4L.d.cts} +17 -13
  85. package/dist/lib/config-file.d.cts +2 -2
  86. package/dist/lib/config-file.d.ts +2 -2
  87. package/dist/lib/contexts/api-context.cjs +5 -5
  88. package/dist/lib/contexts/api-context.d.cts +4 -4
  89. package/dist/lib/contexts/api-context.d.ts +4 -4
  90. package/dist/lib/contexts/api-context.js +4 -4
  91. package/dist/lib/contexts/context.cjs +3 -3
  92. package/dist/lib/contexts/context.d.cts +4 -4
  93. package/dist/lib/contexts/context.d.ts +4 -4
  94. package/dist/lib/contexts/context.js +2 -2
  95. package/dist/lib/contexts/environment-context.cjs +4 -4
  96. package/dist/lib/contexts/environment-context.d.cts +4 -4
  97. package/dist/lib/contexts/environment-context.d.ts +4 -4
  98. package/dist/lib/contexts/environment-context.js +3 -3
  99. package/dist/lib/contexts/index.cjs +7 -7
  100. package/dist/lib/contexts/index.d.cts +4 -4
  101. package/dist/lib/contexts/index.d.ts +4 -4
  102. package/dist/lib/contexts/index.js +4 -4
  103. package/dist/lib/contexts/plugin-context.d.cts +4 -4
  104. package/dist/lib/contexts/plugin-context.d.ts +4 -4
  105. package/dist/lib/entry.d.cts +2 -2
  106. package/dist/lib/entry.d.ts +2 -2
  107. package/dist/lib/fs/index.cjs +2 -2
  108. package/dist/lib/fs/index.d.cts +2 -2
  109. package/dist/lib/fs/index.d.ts +2 -2
  110. package/dist/lib/fs/index.js +1 -1
  111. package/dist/lib/fs/storage/base.d.cts +1 -1
  112. package/dist/lib/fs/storage/base.d.ts +1 -1
  113. package/dist/lib/fs/storage/file-system.d.cts +1 -1
  114. package/dist/lib/fs/storage/file-system.d.ts +1 -1
  115. package/dist/lib/fs/storage/index.d.cts +1 -1
  116. package/dist/lib/fs/storage/index.d.ts +1 -1
  117. package/dist/lib/fs/storage/virtual.d.cts +1 -1
  118. package/dist/lib/fs/storage/virtual.d.ts +1 -1
  119. package/dist/lib/fs/vfs.cjs +2 -2
  120. package/dist/lib/fs/vfs.d.cts +2 -2
  121. package/dist/lib/fs/vfs.d.ts +2 -2
  122. package/dist/lib/fs/vfs.js +1 -1
  123. package/dist/lib/{fs-BkpNEsxT.d.ts → fs-Mx46r7JY.d.cts} +2 -2
  124. package/dist/lib/{fs-BkpNEsxT.d.cts → fs-Mx46r7JY.d.ts} +2 -2
  125. package/dist/lib/index.cjs +10 -10
  126. package/dist/lib/index.d.cts +5 -5
  127. package/dist/lib/index.d.ts +5 -5
  128. package/dist/lib/index.js +5 -5
  129. package/dist/lib/{internal-Cy15nTJD.d.ts → internal-DoGteMoK.d.ts} +2 -2
  130. package/dist/lib/{internal-CSgMKSqU.d.cts → internal-YI5K6rmd.d.cts} +2 -2
  131. package/dist/lib/logger.d.cts +2 -2
  132. package/dist/lib/logger.d.ts +2 -2
  133. package/dist/lib/typescript/import-transformer.d.cts +2 -2
  134. package/dist/lib/typescript/import-transformer.d.ts +2 -2
  135. package/dist/lib/typescript/index.d.cts +2 -2
  136. package/dist/lib/typescript/index.d.ts +2 -2
  137. package/dist/lib/typescript/ts-morph.d.cts +2 -2
  138. package/dist/lib/typescript/ts-morph.d.ts +2 -2
  139. package/dist/lib/unplugin/factory.cjs +6 -6
  140. package/dist/lib/unplugin/factory.d.cts +4 -4
  141. package/dist/lib/unplugin/factory.d.ts +4 -4
  142. package/dist/lib/unplugin/factory.js +5 -5
  143. package/dist/lib/unplugin/helpers.d.cts +2 -2
  144. package/dist/lib/unplugin/helpers.d.ts +2 -2
  145. package/dist/lib/unplugin/index.cjs +6 -6
  146. package/dist/lib/unplugin/index.d.cts +4 -4
  147. package/dist/lib/unplugin/index.d.ts +4 -4
  148. package/dist/lib/unplugin/index.js +5 -5
  149. package/dist/lib/unplugin/plugin.d.cts +4 -4
  150. package/dist/lib/unplugin/plugin.d.ts +4 -4
  151. package/dist/lib/{unplugin-C1FUzEE1.d.ts → unplugin-DYkHIqSU.d.ts} +2 -2
  152. package/dist/lib/{unplugin-DQ_UxGcQ.d.cts → unplugin-Dx_uD4rQ.d.cts} +2 -2
  153. package/dist/lib/utilities/bundle.d.cts +2 -2
  154. package/dist/lib/utilities/bundle.d.ts +2 -2
  155. package/dist/lib/utilities/cache.d.cts +2 -2
  156. package/dist/lib/utilities/cache.d.ts +2 -2
  157. package/dist/lib/utilities/file-header.d.cts +2 -2
  158. package/dist/lib/utilities/file-header.d.ts +2 -2
  159. package/dist/lib/utilities/index.d.cts +2 -2
  160. package/dist/lib/utilities/index.d.ts +2 -2
  161. package/dist/lib/utilities/meta.d.cts +2 -2
  162. package/dist/lib/utilities/meta.d.ts +2 -2
  163. package/dist/lib/utilities/resolve.d.cts +2 -2
  164. package/dist/lib/utilities/resolve.d.ts +2 -2
  165. package/dist/lib/utilities/source-file.d.cts +2 -2
  166. package/dist/lib/utilities/source-file.d.ts +2 -2
  167. package/dist/lib/utilities/source-map.d.cts +2 -2
  168. package/dist/lib/utilities/source-map.d.ts +2 -2
  169. package/dist/lib/utilities/worker.d.cts +2 -2
  170. package/dist/lib/utilities/worker.d.ts +2 -2
  171. package/dist/lib/utilities/write-file.d.cts +2 -2
  172. package/dist/lib/utilities/write-file.d.ts +2 -2
  173. package/dist/next.cjs +4 -4
  174. package/dist/next.js +3 -3
  175. package/dist/nuxt.cjs +7 -7
  176. package/dist/nuxt.d.cts +2 -2
  177. package/dist/nuxt.d.ts +2 -2
  178. package/dist/nuxt.js +5 -5
  179. package/dist/plugin-utils/{chunk-X4BI25Z5.js → chunk-CTG3PTA6.js} +3 -3
  180. package/dist/plugin-utils/chunk-CTG3PTA6.js.map +1 -0
  181. package/dist/plugin-utils/chunk-DO3S34NW.cjs +33 -0
  182. package/dist/plugin-utils/chunk-DO3S34NW.cjs.map +1 -0
  183. package/dist/plugin-utils/{chunk-QQ63YK2G.js → chunk-DYCWCPQP.js} +3 -3
  184. package/dist/plugin-utils/{chunk-QQ63YK2G.js.map → chunk-DYCWCPQP.js.map} +1 -1
  185. package/dist/plugin-utils/{chunk-UXLKUCEY.cjs → chunk-FINF3V34.cjs} +6 -6
  186. package/dist/plugin-utils/{chunk-UXLKUCEY.cjs.map → chunk-FINF3V34.cjs.map} +1 -1
  187. package/dist/plugin-utils/{chunk-VJGI676W.cjs → chunk-IZMPXMCN.cjs} +3 -3
  188. package/dist/plugin-utils/chunk-IZMPXMCN.cjs.map +1 -0
  189. package/dist/plugin-utils/chunk-LRSYWPP2.js +31 -0
  190. package/dist/plugin-utils/chunk-LRSYWPP2.js.map +1 -0
  191. package/dist/plugin-utils/chunk-ORSVDVXT.js +25 -0
  192. package/dist/plugin-utils/chunk-ORSVDVXT.js.map +1 -0
  193. package/dist/plugin-utils/chunk-VW6I3FEY.cjs +27 -0
  194. package/dist/plugin-utils/chunk-VW6I3FEY.cjs.map +1 -0
  195. package/dist/plugin-utils/{context-D7SEhuVP.d.ts → context-BY72cezC.d.cts} +21 -17
  196. package/dist/plugin-utils/{context-D7SEhuVP.d.cts → context-BY72cezC.d.ts} +21 -17
  197. package/dist/plugin-utils/context-helpers.d.cts +2 -2
  198. package/dist/plugin-utils/context-helpers.d.ts +2 -2
  199. package/dist/plugin-utils/enforce.cjs +5 -5
  200. package/dist/plugin-utils/enforce.d.cts +4 -3
  201. package/dist/plugin-utils/enforce.d.ts +4 -3
  202. package/dist/plugin-utils/enforce.js +4 -4
  203. package/dist/plugin-utils/extend.cjs +4 -4
  204. package/dist/plugin-utils/extend.d.cts +6 -3
  205. package/dist/plugin-utils/extend.d.ts +6 -3
  206. package/dist/plugin-utils/extend.js +3 -3
  207. package/dist/plugin-utils/get-config-path.d.cts +2 -2
  208. package/dist/plugin-utils/get-config-path.d.ts +2 -2
  209. package/dist/plugin-utils/helpers.cjs +14 -14
  210. package/dist/plugin-utils/helpers.d.cts +2 -2
  211. package/dist/plugin-utils/helpers.d.ts +2 -2
  212. package/dist/plugin-utils/helpers.js +1 -1
  213. package/dist/plugin-utils/index.cjs +20 -20
  214. package/dist/plugin-utils/index.d.cts +2 -2
  215. package/dist/plugin-utils/index.d.ts +2 -2
  216. package/dist/plugin-utils/index.js +4 -4
  217. package/dist/plugin-utils/merge.cjs +3 -3
  218. package/dist/plugin-utils/merge.d.cts +2 -2
  219. package/dist/plugin-utils/merge.d.ts +2 -2
  220. package/dist/plugin-utils/merge.js +2 -2
  221. package/dist/plugin-utils/paths.d.cts +2 -2
  222. package/dist/plugin-utils/paths.d.ts +2 -2
  223. package/dist/rolldown.cjs +6 -6
  224. package/dist/rolldown.d.cts +2 -2
  225. package/dist/rolldown.d.ts +2 -2
  226. package/dist/rolldown.js +3 -3
  227. package/dist/rollup.cjs +3 -3
  228. package/dist/rollup.d.cts +2 -2
  229. package/dist/rollup.d.ts +2 -2
  230. package/dist/rollup.js +2 -2
  231. package/dist/rspack.cjs +3 -3
  232. package/dist/rspack.d.cts +2 -2
  233. package/dist/rspack.d.ts +2 -2
  234. package/dist/rspack.js +2 -2
  235. package/dist/tsdown.cjs +4 -4
  236. package/dist/tsdown.js +3 -3
  237. package/dist/tsup.cjs +4 -4
  238. package/dist/tsup.js +3 -3
  239. package/dist/types/api.d.cts +3 -3
  240. package/dist/types/api.d.ts +3 -3
  241. package/dist/types/babel.d.cts +2 -2
  242. package/dist/types/babel.d.ts +2 -2
  243. package/dist/types/commands.d.cts +2 -2
  244. package/dist/types/commands.d.ts +2 -2
  245. package/dist/types/config.d.cts +1 -1
  246. package/dist/types/config.d.ts +1 -1
  247. package/dist/types/context.cjs +2 -2
  248. package/dist/types/context.d.cts +2 -2
  249. package/dist/types/context.d.ts +2 -2
  250. package/dist/types/context.js +1 -1
  251. package/dist/types/fs.cjs +3 -3
  252. package/dist/types/fs.d.cts +2 -2
  253. package/dist/types/fs.d.ts +2 -2
  254. package/dist/types/fs.js +1 -1
  255. package/dist/types/hooks.d.cts +2 -2
  256. package/dist/types/hooks.d.ts +2 -2
  257. package/dist/types/index.cjs +5 -5
  258. package/dist/types/index.d.cts +3 -3
  259. package/dist/types/index.d.ts +3 -3
  260. package/dist/types/index.js +2 -2
  261. package/dist/types/internal.d.cts +3 -3
  262. package/dist/types/internal.d.ts +3 -3
  263. package/dist/types/plugin.d.cts +2 -2
  264. package/dist/types/plugin.d.ts +2 -2
  265. package/dist/types/resolved.d.cts +1 -1
  266. package/dist/types/resolved.d.ts +1 -1
  267. package/dist/types/unplugin.d.cts +3 -3
  268. package/dist/types/unplugin.d.ts +3 -3
  269. package/dist/unloader.cjs +3 -3
  270. package/dist/unloader.d.cts +2 -2
  271. package/dist/unloader.d.ts +2 -2
  272. package/dist/unloader.js +2 -2
  273. package/dist/unplugin.cjs +5 -5
  274. package/dist/unplugin.d.cts +3 -3
  275. package/dist/unplugin.d.ts +3 -3
  276. package/dist/unplugin.js +3 -3
  277. package/dist/vite.cjs +6 -6
  278. package/dist/vite.d.cts +2 -2
  279. package/dist/vite.d.ts +2 -2
  280. package/dist/vite.js +3 -3
  281. package/dist/webpack.cjs +6 -6
  282. package/dist/webpack.d.cts +2 -2
  283. package/dist/webpack.d.ts +2 -2
  284. package/dist/webpack.js +3 -3
  285. package/package.json +2 -2
  286. package/dist/chunk-2GKVCE3E.cjs +0 -12
  287. package/dist/chunk-JTZS2TSQ.cjs +0 -12
  288. package/dist/lib/chunk-HVL3SPVN.js.map +0 -1
  289. package/dist/lib/chunk-NXUMUI2Z.js.map +0 -1
  290. package/dist/lib/chunk-UWOD2XLX.cjs.map +0 -1
  291. package/dist/lib/chunk-UZSTEOLF.cjs.map +0 -1
  292. package/dist/lib/chunk-VM6LBJ3L.cjs.map +0 -1
  293. package/dist/lib/chunk-VPZU5BTK.js.map +0 -1
  294. package/dist/plugin-utils/chunk-36OM2X4L.js +0 -30
  295. package/dist/plugin-utils/chunk-36OM2X4L.js.map +0 -1
  296. package/dist/plugin-utils/chunk-DQDBFO67.js +0 -23
  297. package/dist/plugin-utils/chunk-DQDBFO67.js.map +0 -1
  298. package/dist/plugin-utils/chunk-EWPAHNGW.cjs +0 -25
  299. package/dist/plugin-utils/chunk-EWPAHNGW.cjs.map +0 -1
  300. package/dist/plugin-utils/chunk-ID47RJFS.cjs +0 -32
  301. package/dist/plugin-utils/chunk-ID47RJFS.cjs.map +0 -1
  302. package/dist/plugin-utils/chunk-VJGI676W.cjs.map +0 -1
  303. package/dist/plugin-utils/chunk-X4BI25Z5.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/babel/module-resolver-plugin.ts","../../src/internal/helpers/generate-types.ts","../../src/internal/helpers/hooks.ts","../../src/internal/helpers/install.ts","../../src/internal/helpers/install-dependencies.ts","../../src/internal/helpers/resolve-tsconfig.ts","../../src/api.ts","../../src/lib/unplugin/factory.ts"],"names":["resolveModulePath","nodePath","state","isStringLiteral","node","sourcePath","value","resolvedPath","context","fs","resolveSync","replaceWith","stringLiteral","replace","TRANSFORM_FUNCTIONS","matchesPattern","calleePath","pattern","isMemberExpression","isIdentifier","includes","name","split","importVisitors","CallExpression","__name","moduleResolverVisited","has","get","some","isImport","callee","add","moduleResolverBabelPlugin","declare","builder","api","Set","manipulateOptions","opts","filename","pre","visitor","Program","enter","programPath","traverse","exit","post","clear","formatTypes","code","replaceAll","emitTypes","files","log","LogLevelLabel","TRACE","length","program","createProgram","skipAddingFilesFromTsConfig","addSourceFilesAtPaths","result","emitToMemory","emitOnlyDtsFiles","builtinModules","file","getFiles","filePath","endsWith","builtins","builtin","metadata","id","module","resolve","text","trim","diagnosticMessages","getDiagnostics","forEach","diagnostic","getSourceFile","getBaseName","push","getLineNumber","flattenDiagnosticMessageText","getMessageText","toString","diagnosticMessage","join","Error","slice","mergeResults","createDefu","obj","key","isString","callHook","hook","options","args","handlers","selectHooks","DEBUG","chalk","bold","cyanBright","order","results","sequential","Promise","all","map","handler","isFunction","handle","apply","asNextParam","isSet","sequenceArgs","isObject","definedResults","filter","mergedResult","undefined","defu","installPackage","packageName","dev","isPackageListed","getPackageName","cwd","config","projectRoot","skipInstalls","WARN","install","isNumber","exitCode","ERROR","stderr","hasPackageVersion","process","env","POWERLINES_SKIP_VERSION_CHECK","isMatching","doesPackageMatch","getPackageVersion","packageListing","getPackageListing","version","startsWith","installDependencies","dependencies","devDependencies","Object","keys","entries","String","getTsconfigDtsPath","dtsRelativePath","joinPaths","relativePath","workspaceConfig","workspaceRoot","findFilePath","dtsPath","findFileName","resolveTsconfigChanges","tsconfig","getParsedTypeScriptConfig","tsconfigRaw","tsconfigFilePath","getTsconfigFilePath","tsconfigJson","readJsonFile","compilerOptions","output","dts","include","filePattern","isIncludeMatchFound","lib","toLowerCase","esModuleInterop","isolatedModules","build","platform","types","type","initializeTsconfig","isPackageExists","originalTsconfigJson","write","StormJSON","stringify","resolveTsconfig","updateTsconfigJson","Array","isArray","getObjectDiff","ignoreArrayOrder","showOnly","statuses","granularity","changes","getChanges","difference","property","status","diff","field","previous","previousValue","current","currentValue","change","i","whiteBright","titleCase","red","green","PowerlinesAPI","from","PowerlinesAPIContext","$$internal","addPlugin","bind","plugin","plugins","pluginConfig","environment","getEnvironment","withUserConfig","isHighPriority","prepare","inlineConfig","command","withInlineConfig","toArray","entry","title","formatLogMessage","existsSync","cachePath","createDirectory","dataPath","remove","builtinFilePaths","getBuiltins","transformAsync","highlightCode","ast","cloneInputAst","comments","sourceType","configFile","babelrc","envName","mode","caller","transform","babel","path","emitBuiltin","typescriptPath","resolvePackage","reduce","ret","fileName","formatted","replacePath","directives","previousResult","isSetObject","isSetString","directive","getFileHeader","prettierIgnore","normalizedDtsRelativePath","includeValue","JSON","writeMetaFile","persistedMeta","meta","INFO","new","listFiles","powerlinesPath","template","Handlebars","compile","projectType","clean","buildPath","artifactsPath","lint","singleBuild","toEnvironment","docs","deploy","finalize","dispose","Symbol","asyncDispose","outputPath","appendPath","destinationPath","copy","assets","asset","redBright","input","glob","greenBright","ignore","yellowBright","environments","getEnvironmentSafe","resolvedEnvironment","in","dependsOn","required","awaited","isPromiseLike","isPluginConfig","every","isPlugin","resolved","isPluginConfigTuple","isPluginConfigObject","pluginOptions","checkDedupe","pluginPath","Boolean","splits","isInstalled","paths","resolver","import","esmResolve","default","error","isError","message","createUnpluginFactory","variant","decorate","createLog","userConfig","unplugin","buildStart","getWorkspaceRoot","setParseImp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UACAlE,OAAAA,EAASkP;AACX,SAAA;QACAG,IAAAA,EAAM;UACJ5O,MAAAA,EAAQ;YACNlD,EAAAA,EAAI;cACF2G,OAAAA,EAAS;AAAC,gBAAA,IAAA;AAAM,gBAAA;;AAClB;AACF,WAAA;UACAlE,OAAAA,EAASqP;AACX,SAAA;AACAjG,QAAAA,SAAAA;AACA0F,QAAAA,UAAAA;AACAS,QAAAA;AACF,OAAA;AAEA,MAAA,OAAOb,QAAAA,GAAWA,QAAAA,CAASzT,GAAAA,EAAK2B,MAAAA,CAAAA,GAAUA,MAAAA;AAC5C,IAAA,CAAA,CAAA,OAASyR,KAAAA,EAAO;AACdjS,MAAAA,GAAAA,CAAIC,mBAAAA,CAAcmT,KAAAA,EAAQnB,KAAAA,EAAiBE,OAAAA,CAAAA;AAE3C,MAAA,MAAMF,KAAAA;AACR,IAAA;AACF,EAAA,CAAA;AACF;AA9IgBG,wBAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA","file":"chunk-NOABJWDK.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath, PluginPass, Visitor } from \"@babel/core\";\nimport { BabelAPI, declare } from \"@babel/helper-plugin-utils\";\nimport * as t from \"@babel/types\";\nimport { Context } from \"../../types/context\";\n\ntype ModuleResolverPluginPass = PluginPass & {\n context: Context;\n moduleResolverVisited: Set<any>;\n api: BabelAPI;\n};\n\nfunction resolveModulePath(\n nodePath: NodePath<t.StringLiteral | null | undefined>,\n state: ModuleResolverPluginPass\n) {\n if (!t.isStringLiteral(nodePath.node)) {\n return;\n }\n\n const sourcePath = nodePath.node.value;\n // const currentFile = state.file.opts.filename;\n\n const resolvedPath = state.context?.fs.resolveSync(sourcePath);\n if (resolvedPath) {\n nodePath.replaceWith(\n t.stringLiteral(\n // Remove the file extension if it exists\n resolvedPath.replace(/\\.(?:ts|mts|cts)x?$/, \"\")\n )\n );\n }\n}\n\nconst TRANSFORM_FUNCTIONS = [\n \"require\",\n \"require.resolve\",\n \"System.import\",\n\n // Jest methods\n \"jest.genMockFromModule\",\n \"jest.mock\",\n \"jest.unmock\",\n \"jest.doMock\",\n // eslint-disable-next-line @cspell/spellchecker\n \"jest.dontMock\",\n \"jest.setMock\",\n \"jest.requireActual\",\n \"jest.requireMock\",\n\n // Older Jest methods\n \"require.requireActual\",\n \"require.requireMock\"\n];\n\nfunction matchesPattern(\n state: ModuleResolverPluginPass,\n calleePath: NodePath,\n pattern: string\n) {\n const { node } = calleePath;\n\n if (t.isMemberExpression(node)) {\n return calleePath.matchesPattern(pattern);\n }\n\n if (!t.isIdentifier(node) || pattern.includes(\".\")) {\n return false;\n }\n\n const name = pattern.split(\".\")[0];\n\n return node.name === name;\n}\n\nconst importVisitors = {\n CallExpression: (\n nodePath: NodePath<t.CallExpression>,\n state: ModuleResolverPluginPass\n ) => {\n if (state.moduleResolverVisited.has(nodePath)) {\n return;\n }\n\n const calleePath = nodePath.get(\"callee\");\n if (\n (calleePath &&\n TRANSFORM_FUNCTIONS.some(pattern =>\n matchesPattern(state, calleePath, pattern)\n )) ||\n t.isImport(nodePath.node.callee)\n ) {\n state.moduleResolverVisited.add(nodePath);\n resolveModulePath(\n nodePath.get(\"arguments.0\") as NodePath<t.StringLiteral>,\n state\n );\n }\n },\n // eslint-disable-next-line ts/naming-convention\n \"ImportDeclaration|ExportDeclaration|ExportAllDeclaration\": (\n nodePath: NodePath<\n t.ImportDeclaration | t.ExportDeclaration | t.ExportAllDeclaration\n >,\n state: ModuleResolverPluginPass\n ) => {\n if (\n !nodePath ||\n !nodePath.get(\"source\") ||\n state.moduleResolverVisited.has(nodePath)\n ) {\n return;\n }\n\n state.moduleResolverVisited.add(nodePath);\n resolveModulePath(nodePath.get(\"source\"), state);\n }\n} as Visitor<ModuleResolverPluginPass>;\n\nexport const moduleResolverBabelPlugin = (context: Context) => {\n return declare(function builder(api: BabelAPI) {\n let moduleResolverVisited = new Set();\n\n return {\n name: \"powerlines:module-resolver\",\n manipulateOptions(opts) {\n opts.filename ??= \"unknown\";\n },\n\n pre() {\n // We need to keep track of all handled nodes so we do not try to transform them twice,\n // because we run before (enter) and after (exit) all nodes are handled\n moduleResolverVisited = new Set();\n },\n\n visitor: {\n Program: {\n enter(programPath: NodePath<t.Program>, state: PluginPass) {\n programPath.traverse(importVisitors, {\n ...state,\n context,\n moduleResolverVisited,\n api\n } as ModuleResolverPluginPass);\n },\n exit(programPath, state) {\n programPath.traverse(importVisitors, {\n ...state,\n context,\n moduleResolverVisited,\n api\n } as ModuleResolverPluginPass);\n }\n }\n },\n\n post() {\n moduleResolverVisited.clear();\n }\n };\n });\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { flattenDiagnosticMessageText } from \"typescript\";\nimport { createProgram } from \"../../lib/typescript/ts-morph\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats the generated TypeScript types source code.\n *\n * @param code - The generated TypeScript code.\n * @returns The formatted TypeScript code.\n */\nexport function formatTypes(code: string): string {\n return code\n .replace(\n // eslint-disable-next-line regexp/no-super-linear-backtracking\n /import\\s*(?:type\\s*)?\\{?[\\w,\\s]*(?:\\}\\s*)?from\\s*(?:'|\")@?[a-zA-Z0-9-\\\\/.]*(?:'|\");?/g,\n \"\"\n )\n .replaceAll(\"#private;\", \"\")\n .replace(/__Ω/g, \"\");\n}\n\n/**\n * Emits TypeScript declaration types for the provided files using the given TypeScript configuration.\n *\n * @param context - The context containing options and environment paths.\n * @param files - The list of files to generate types for.\n * @returns A promise that resolves to the generated TypeScript declaration types.\n */\nexport async function emitTypes<TContext extends Context>(\n context: TContext,\n files: string[]\n) {\n context.log(\n LogLevelLabel.TRACE,\n `Running the TypeScript compiler for ${\n files.length\n } generated runtime files.`\n );\n\n const program = createProgram(context, {\n skipAddingFilesFromTsConfig: true\n });\n\n program.addSourceFilesAtPaths(files);\n const result = program.emitToMemory({ emitOnlyDtsFiles: true });\n\n let builtinModules = \"\";\n for (const file of result.getFiles()) {\n if (!file.filePath.endsWith(\".map\")) {\n if (\n context.builtins.some(\n builtin =>\n builtin === file.filePath ||\n (context.fs.metadata[builtin]?.id &&\n context.fs.metadata[builtin]?.id === file.filePath)\n )\n ) {\n const module = await context.fs.resolve(file.filePath);\n\n builtinModules += `\n declare module \"${module}\" {\n ${file.text\n .trim()\n .replace(/^\\s*export\\s*declare\\s*/gm, \"export \")\n .replace(/^\\s*declare\\s*/gm, \"\")}\n }\n `;\n }\n }\n }\n\n const diagnosticMessages: string[] = [];\n result.getDiagnostics().forEach(diagnostic => {\n if (diagnostic.getSourceFile()?.getBaseName()) {\n diagnosticMessages.push(\n `${diagnostic.getSourceFile()?.getBaseName()} (${\n (diagnostic.getLineNumber() ?? 0) + 1\n }): ${flattenDiagnosticMessageText(\n diagnostic.getMessageText().toString(),\n \"\\n\"\n )}`\n );\n } else {\n diagnosticMessages.push(\n flattenDiagnosticMessageText(\n diagnostic.getMessageText().toString(),\n \"\\n\"\n )\n );\n }\n });\n\n const diagnosticMessage = diagnosticMessages.join(\"\\n\");\n if (diagnosticMessage) {\n throw new Error(\n `TypeScript compilation failed: \\n\\n${\n diagnosticMessage.length > 5000\n ? `${diagnosticMessage.slice(0, 5000)}...`\n : diagnosticMessage\n }`\n );\n }\n\n return formatTypes(builtinModules);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport { createDefu, defu } from \"defu\";\nimport {\n EnvironmentContext,\n PluginContext,\n SelectHooksOptions\n} from \"../../types/context\";\nimport {\n HookKeys,\n InferHookParameters,\n InferHookReturnType\n} from \"../../types/hooks\";\nimport { ResolvedConfig } from \"../../types/resolved\";\n\nexport type CallHookOptions = SelectHooksOptions &\n (\n | ({\n /**\n * Whether to call the hooks sequentially or in parallel.\n *\n * @defaultValue true\n */\n sequential?: true;\n } & (\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result: \"first\";\n }\n | {\n /**\n * How to handle multiple return values from hooks.\n * - \"merge\": Merge all non-undefined return values (if they are objects).\n * - \"first\": Return the first non-undefined value.\n *\n * @remarks\n * Merging only works if the return values are objects.\n *\n * @defaultValue \"merge\"\n */\n result?: \"merge\" | \"last\";\n\n /**\n * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter\n */\n asNextParam?: false | ((previousResult: any) => MaybePromise<any>);\n }\n ))\n | {\n /**\n * Whether to call the hooks sequentially or in parallel.\n */\n sequential: false;\n }\n );\n\nconst mergeResults = createDefu(<T>(obj: T, key: keyof T, value: any) => {\n if (isString(obj[key]) && isString(value)) {\n obj[key] = `${obj[key] || \"\"}\\n${value || \"\"}`.trim() as T[keyof T];\n\n return true;\n }\n\n return false;\n});\n\n/**\n * Calls a hook with the given context, options, and arguments.\n *\n * @param context - The context to use when calling the hook.\n * @param hook - The hook to call.\n * @param options - Options for calling the hook.\n * @param args - Arguments to pass to the hook.\n * @returns The return value of the hook.\n */\nexport async function callHook<\n TResolvedConfig extends ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>,\n TKey extends HookKeys<ArrayValues<TContext[\"plugins\"]>[\"context\"]> = HookKeys<\n ArrayValues<TContext[\"plugins\"]>[\"context\"]\n >\n>(\n context: TContext,\n hook: TKey,\n options: CallHookOptions,\n ...args: InferHookParameters<PluginContext<TContext[\"config\"]>, TKey>\n): Promise<\n InferHookReturnType<PluginContext<TContext[\"config\"]>, TKey> | undefined\n> {\n const handlers = context.selectHooks(hook, options);\n if (handlers.length > 0) {\n context.log(\n LogLevelLabel.DEBUG,\n ` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(\n `${hook}${options?.order ? ` (${options.order})` : \"\"}`\n )}`\n );\n\n let results = [] as InferHookReturnType<\n PluginContext<TContext[\"config\"]>,\n TKey\n >[];\n if (options?.sequential === false) {\n results = await Promise.all(\n handlers.map(async handler => {\n if (!isFunction(handler.handle)) {\n throw new Error(\n `Plugin hook handler for hook \"${hook}\" is not a function.`\n );\n }\n\n return Promise.resolve(\n // eslint-disable-next-line ts/no-unsafe-call\n handler.handle.apply(handler.context, [...args])\n );\n })\n );\n } else {\n for (const handler of handlers) {\n if (!isFunction(handler.handle)) {\n throw new Error(\n `Plugin hook handler for hook \"${hook}\" is not a function.`\n );\n }\n\n if (options?.result === \"first\" || options?.asNextParam === false) {\n results.push(\n await Promise.resolve(\n // eslint-disable-next-line ts/no-unsafe-call\n handler.handle.apply(handler.context, [...args])\n )\n );\n if (\n options?.result === \"first\" &&\n isSet(results[results.length - 1])\n ) {\n break;\n }\n } else {\n const sequenceArgs = [...args];\n if (results.length > 0 && sequenceArgs.length > 0) {\n sequenceArgs[0] = isFunction(options.asNextParam)\n ? await Promise.resolve(options.asNextParam(results[0]))\n : results[0];\n }\n\n const result = await Promise.resolve(\n // eslint-disable-next-line ts/no-unsafe-call\n handler.handle.apply(handler.context, [...sequenceArgs])\n );\n if (result) {\n if (options?.result === \"last\") {\n results = [result];\n } else if (isString(result)) {\n results = [\n `${isString(results[0]) ? results[0] || \"\" : \"\"}\\n${result || \"\"}`.trim() as InferHookReturnType<\n PluginContext<TContext[\"config\"]>,\n TKey\n >\n ];\n } else if (isObject(result)) {\n results = [\n mergeResults(result, results[0] ?? {}) as InferHookReturnType<\n PluginContext<TContext[\"config\"]>,\n TKey\n >\n ];\n }\n }\n }\n }\n }\n\n const definedResults = results.filter(\n (\n result\n ): result is NonNullable<\n InferHookReturnType<PluginContext<TContext[\"config\"]>, TKey>\n > => isSet(result)\n );\n\n if (definedResults.length > 0) {\n let mergedResult = undefined as\n | InferHookReturnType<PluginContext<TContext[\"config\"]>, TKey>\n | undefined;\n\n for (const result of definedResults) {\n mergedResult = defu(\n result as Record<string, unknown>,\n (mergedResult ?? {}) as Record<string, unknown>\n ) as InferHookReturnType<PluginContext<TContext[\"config\"]>, TKey>;\n }\n\n return mergedResult;\n }\n }\n\n return undefined;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { install } from \"@stryke/fs/install\";\nimport {\n doesPackageMatch,\n getPackageListing,\n isPackageListed\n} from \"@stryke/fs/package-fns\";\nimport {\n getPackageName,\n getPackageVersion,\n hasPackageVersion\n} from \"@stryke/string-format/package\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport type { Context } from \"../../types/context\";\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packageName - The name of the package to install\n * @param dev - Whether to install the package as a dev dependency\n */\nexport async function installPackage(\n context: Context,\n packageName: string,\n dev = false\n) {\n if (\n !(await isPackageListed(getPackageName(packageName), {\n cwd: context.config.projectRoot\n }))\n ) {\n if (context.config.skipInstalls !== true) {\n context.log(\n LogLevelLabel.WARN,\n `The package \"${packageName}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(packageName, {\n cwd: context.config.projectRoot,\n dev\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.log(LogLevelLabel.ERROR, result.stderr);\n throw new Error(\n `An error occurred while installing the package \"${packageName}\"`\n );\n }\n } else {\n context.log(\n LogLevelLabel.WARN,\n `The package \"${packageName}\" is not installed. Since the \"skipInstalls\" option is set to true, it will not be installed automatically.`\n );\n }\n } else if (\n hasPackageVersion(packageName) &&\n !process.env.POWERLINES_SKIP_VERSION_CHECK\n ) {\n const isMatching = await doesPackageMatch(\n getPackageName(packageName),\n getPackageVersion(packageName)!,\n context.config.projectRoot\n );\n if (!isMatching) {\n const packageListing = await getPackageListing(\n getPackageName(packageName),\n {\n cwd: context.config.projectRoot\n }\n );\n if (\n !packageListing?.version.startsWith(\"catalog:\") &&\n !packageListing?.version.startsWith(\"workspace:\")\n ) {\n context.log(\n LogLevelLabel.WARN,\n `The package \"${getPackageName(packageName)}\" is installed but does not match the expected version ${getPackageVersion(\n packageName\n )} (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.`\n );\n }\n }\n }\n}\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packages - The list of packages to install\n */\nexport async function installPackages(\n context: Context,\n packages: Array<{ name: string; dev?: boolean }>\n) {\n return Promise.all(\n packages.map(async pkg => installPackage(context, pkg.name, pkg.dev))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getPackageName } from \"@stryke/string-format/package\";\nimport { Context } from \"../../types/context\";\nimport { installPackage } from \"./install\";\n\n/**\n * Install missing project dependencies.\n *\n * @param context - The build context.\n */\nexport async function installDependencies<TContext extends Context = Context>(\n context: TContext\n): Promise<void> {\n context.log(\n LogLevelLabel.TRACE,\n `Checking and installing missing project dependencies.`\n );\n\n context.dependencies ??= {};\n context.devDependencies ??= {};\n\n if (\n Object.keys(context.dependencies).length === 0 &&\n Object.keys(context.devDependencies).length === 0\n ) {\n context.log(\n LogLevelLabel.TRACE,\n `No dependencies or devDependencies to install. Skipping installation step.`\n );\n return;\n }\n\n context.log(\n LogLevelLabel.DEBUG,\n `The following packages are required: \\nDependencies: \\n${Object.entries(\n context.dependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}\\n\\nDevDependencies: \\n${Object.entries(\n context.devDependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}`\n );\n\n await Promise.all([\n Promise.all(\n Object.entries(context.dependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n false\n )\n )\n ),\n Promise.all(\n Object.entries(context.devDependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n true\n )\n )\n )\n ]);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport {\n getParsedTypeScriptConfig,\n getTsconfigFilePath,\n isIncludeMatchFound\n} from \"../../lib/typescript/tsconfig\";\nimport type { EnvironmentContext } from \"../../types/context\";\nimport { ResolvedConfig } from \"../../types/resolved\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot\n ),\n findFilePath(context.dtsPath)\n ),\n findFileName(context.dtsPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.dtsPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.build.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n context.log(\n LogLevelLabel.TRACE,\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson =\n await resolveTsconfigChanges<TResolvedConfig>(context);\n\n context.log(\n LogLevelLabel.TRACE,\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.log(\n LogLevelLabel.WARN,\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { transformAsync } from \"@babel/core\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger/console\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { install } from \"@stryke/fs/install\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport Handlebars from \"handlebars\";\nimport { moduleResolverBabelPlugin } from \"./internal/babel/module-resolver-plugin\";\nimport { emitTypes, formatTypes } from \"./internal/helpers/generate-types\";\nimport { callHook, CallHookOptions } from \"./internal/helpers/hooks\";\nimport { installDependencies } from \"./internal/helpers/install-dependencies\";\nimport {\n getTsconfigDtsPath,\n initializeTsconfig,\n resolveTsconfig\n} from \"./internal/helpers/resolve-tsconfig\";\nimport { PowerlinesAPIContext } from \"./lib/contexts/api-context\";\nimport {\n getParsedTypeScriptConfig,\n isIncludeMatchFound\n} from \"./lib/typescript/tsconfig\";\nimport { getFileHeader } from \"./lib/utilities/file-header\";\nimport { writeMetaFile } from \"./lib/utilities/meta\";\nimport {\n checkDedupe,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"./plugin-utils/helpers\";\nimport { API } from \"./types/api\";\nimport type {\n BuildInlineConfig,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n InitialUserConfig,\n LintInlineConfig,\n NewInlineConfig,\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n PluginFactory,\n PrepareInlineConfig\n} from \"./types/config\";\nimport type {\n APIContext,\n EnvironmentContext,\n PluginContext\n} from \"./types/context\";\nimport { HookKeys, InferHookParameters } from \"./types/hooks\";\nimport { UNSAFE_APIContext } from \"./types/internal\";\nimport type { Plugin, TypesResult } from \"./types/plugin\";\nimport { EnvironmentResolvedConfig, ResolvedConfig } from \"./types/resolved\";\n\n/**\n * The Powerlines API class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n implements API<TResolvedConfig>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: UNSAFE_APIContext<TResolvedConfig>;\n\n /**\n * The Powerlines context\n */\n public get context(): APIContext<TResolvedConfig> {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines API instance\n *\n * @param context - The Powerlines context\n */\n private constructor(context: APIContext<TResolvedConfig>) {\n this.#context = context as UNSAFE_APIContext<TResolvedConfig>;\n }\n\n /**\n * Initialize a Powerlines API instance\n *\n * @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in\n * @param config - An object containing the configuration required to run Powerlines tasks.\n * @returns A new instance of the Powerlines API\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<PowerlinesAPI<TResolvedConfig>> {\n const api = new PowerlinesAPI<TResolvedConfig>(\n await PowerlinesAPIContext.from(workspaceRoot, config)\n );\n api.#context.$$internal = { api, addPlugin: api.#addPlugin.bind(api) };\n\n for (const plugin of api.context.config.plugins ?? []) {\n await api.#addPlugin(plugin);\n }\n\n if (api.context.plugins.length === 0) {\n api.context.log(\n LogLevelLabel.WARN,\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n );\n }\n\n const pluginConfig = await api.callHook(\"config\", {\n environment: await api.context.getEnvironment(),\n sequential: true,\n result: \"merge\"\n });\n await api.context.withUserConfig(\n pluginConfig as TResolvedConfig[\"userConfig\"],\n { isHighPriority: false }\n );\n\n return api;\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PrepareInlineConfig\n | NewInlineConfig\n | CleanInlineConfig\n | BuildInlineConfig\n | LintInlineConfig\n | DocsInlineConfig\n | DeployInlineConfig = { command: \"prepare\" }\n ) {\n this.context.log(\n LogLevelLabel.TRACE,\n \" 🏗️ Preparing the Powerlines project\"\n );\n\n this.context.log(\n LogLevelLabel.TRACE,\n \" ⚙️ Aggregating configuration options for the Powerlines project\"\n );\n\n await this.context.withInlineConfig(inlineConfig);\n await this.#executeEnvironments(async context => {\n context.log(\n LogLevelLabel.TRACE,\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n context.log(\n LogLevelLabel.DEBUG,\n `The configuration provided ${\n toArray(context.config.entry).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }.`\n );\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.log(\n LogLevelLabel.TRACE,\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage(\n context.config\n )}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"pre\"\n });\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.output.dts !== false) {\n context.log(\n LogLevelLabel.TRACE,\n `Preparing the TypeScript definitions for the Powerlines project.`\n );\n\n if (context.fs.existsSync(context.dtsPath)) {\n await context.fs.remove(context.dtsPath);\n }\n\n context.log(\n LogLevelLabel.TRACE,\n \"Transforming built-ins runtime modules files.\"\n );\n\n const builtinFilePaths = await Promise.all(\n (await context.getBuiltins()).map(async file => {\n const result = await transformAsync(file.code.toString(), {\n highlightCode: true,\n code: true,\n ast: false,\n cloneInputAst: false,\n comments: true,\n sourceType: \"module\",\n configFile: false,\n babelrc: false,\n envName: context.config.mode,\n caller: {\n name: \"powerlines\"\n },\n ...context.config.transform.babel,\n filename: file.path,\n plugins: [\n [\"@babel/plugin-syntax-typescript\"],\n [moduleResolverBabelPlugin(context)]\n ]\n });\n if (!result?.code) {\n throw new Error(\n `Powerlines - Generate Types failed to compile ${file.id}`\n );\n }\n\n context.log(\n LogLevelLabel.TRACE,\n `Writing transformed built-in runtime file ${file.id}.`\n );\n\n await context.emitBuiltin(result.code, file.id, file.path);\n return file.path;\n })\n );\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n const files = builtinFilePaths.reduce<string[]>(\n (ret, fileName) => {\n const formatted = replacePath(\n fileName,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n },\n [] // [joinPaths(typescriptPath, \"lib\", \"lib.esnext.full.d.ts\")]\n );\n\n context.log(\n LogLevelLabel.TRACE,\n \"Parsing TypeScript configuration for the Powerlines project.\"\n );\n\n let types = await emitTypes(context, files);\n\n context.log(\n LogLevelLabel.TRACE,\n `Generating TypeScript declaration file ${context.dtsPath}.`\n );\n\n const directives = [] as string[];\n const asNextParam = (\n previousResult: string | TypesResult | null | undefined\n ) => (isObject(previousResult) ? previousResult.code : previousResult);\n\n let result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"pre\",\n result: \"merge\",\n asNextParam\n },\n types\n );\n if (result) {\n if (isSetObject(result)) {\n types = result.code;\n if (\n Array.isArray(result.directives) &&\n result.directives.length > 0\n ) {\n directives.push(...result.directives);\n }\n } else if (isSetString(result)) {\n types = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"normal\",\n result: \"merge\",\n asNextParam\n },\n types\n );\n if (result) {\n if (isSetObject(result)) {\n types = result.code;\n if (\n Array.isArray(result.directives) &&\n result.directives.length > 0\n ) {\n directives.push(...result.directives);\n }\n } else if (isSetString(result)) {\n types = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"post\",\n result: \"merge\",\n asNextParam\n },\n types\n );\n if (result) {\n if (isSetObject(result)) {\n types = result.code;\n if (\n Array.isArray(result.directives) &&\n result.directives.length > 0\n ) {\n directives.push(...result.directives);\n }\n } else if (isSetString(result)) {\n types = result;\n }\n }\n\n if (types?.trim() || directives.length > 0) {\n await context.fs.write(\n context.dtsPath,\n `${\n directives\n ? `${directives.map(directive => `/// <reference types=\"${directive}\" />`).join(\"\\n\")}\n\n`\n : \"\"\n }${getFileHeader(context, { directive: null, prettierIgnore: false })}\n\n${formatTypes(types)}\n`\n );\n } else {\n const dtsRelativePath = getTsconfigDtsPath(context);\n if (\n context.tsconfig.tsconfigJson.include &&\n isIncludeMatchFound(\n dtsRelativePath,\n context.tsconfig.tsconfigJson.include\n )\n ) {\n const normalizedDtsRelativePath = dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath;\n context.tsconfig.tsconfigJson.include =\n context.tsconfig.tsconfigJson.include.filter(\n includeValue =>\n includeValue?.toString() !== normalizedDtsRelativePath\n );\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n JSON.stringify(context.tsconfig.tsconfigJson, null, 2)\n );\n }\n }\n }\n\n // Re-resolve the tsconfig to ensure it is up to date\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"post\"\n });\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.log(\n LogLevelLabel.INFO,\n \"Powerlines API has been prepared successfully\"\n );\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: NewInlineConfig) {\n this.context.log(\n LogLevelLabel.INFO,\n \"🆕 Creating a new Powerlines project\"\n );\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n context.log(\n LogLevelLabel.TRACE,\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n context.log(LogLevelLabel.TRACE, `Adding template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.projectRoot, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.projectType === \"application\") {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of files) {\n context.log(\n LogLevelLabel.TRACE,\n `Adding application template file: ${file}`\n );\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.projectRoot, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n } else {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of files) {\n context.log(\n LogLevelLabel.TRACE,\n `Adding library template file: ${file}`\n );\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.projectRoot, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"post\"\n });\n });\n\n this.context.log(LogLevelLabel.TRACE, \"Powerlines - New command completed\");\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig: CleanInlineConfig | PrepareInlineConfig = {\n command: \"clean\"\n }\n ) {\n this.context.log(\n LogLevelLabel.INFO,\n \"🧹 Cleaning the previous Powerlines artifacts\"\n );\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n this.context.log(\n LogLevelLabel.TRACE,\n \"Cleaning the project's dist and artifacts directories.\"\n );\n\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.buildPath\n )\n );\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.artifactsPath\n )\n );\n\n await this.callHook(\"clean\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.log(\n LogLevelLabel.TRACE,\n \"Powerlines - Clean command completed\"\n );\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig: LintInlineConfig | BuildInlineConfig = { command: \"lint\" }\n ) {\n this.context.log(LogLevelLabel.INFO, \"📋 Linting the Powerlines project\");\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n if (context.config.lint !== false) {\n await this.callHook(\"lint\", {\n environment: context,\n sequential: false\n });\n }\n });\n\n this.context.log(LogLevelLabel.TRACE, \"Powerlines linting completed\");\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(inlineConfig: BuildInlineConfig = { command: \"build\" }) {\n this.context.log(LogLevelLabel.INFO, \"📦 Building the Powerlines project\");\n\n // const checksum = await this.context.generateChecksum();\n // if (checksum !== this.context.persistedMeta?.checksum) {\n // this.context.log(\n // LogLevelLabel.INFO,\n // \"The Powerlines project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n // );\n\n // await this.prepare(inlineConfig);\n // }\n\n await this.prepare(inlineConfig);\n if (this.context.config.singleBuild) {\n await this.#handleBuild(await this.#context.toEnvironment());\n } else {\n await this.#executeEnvironments(async context => {\n await this.#handleBuild(context);\n });\n }\n\n this.context.log(LogLevelLabel.TRACE, \"Powerlines build completed\");\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig = { command: \"docs\" }) {\n this.context.log(\n LogLevelLabel.INFO,\n \"📓 Generating documentation for the Powerlines project\"\n );\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n context.log(\n LogLevelLabel.TRACE,\n \"Writing documentation for the Powerlines project artifacts.\"\n );\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n await this.callHook(\"docs\", {\n environment: context\n });\n });\n });\n\n this.#context.log(\n LogLevelLabel.TRACE,\n \"Powerlines documentation generation completed\"\n );\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: DeployInlineConfig = { command: \"deploy\" }\n ) {\n this.context.log(LogLevelLabel.INFO, \"📦 Deploying the Powerlines project\");\n\n await this.prepare(inlineConfig);\n await this.#executeEnvironments(async context => {\n await this.callHook(\"deploy\", { environment: context });\n });\n\n this.context.log(LogLevelLabel.TRACE, \"Powerlines deploy completed\");\n }\n\n /**\n * Finalization process\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n this.context.log(\n LogLevelLabel.TRACE,\n \"Powerlines finalize execution started\"\n );\n\n await this.#executeEnvironments(async context => {\n await this.callHook(\"finalize\", { environment: context });\n await context.fs.dispose();\n });\n\n this.context.log(\n LogLevelLabel.TRACE,\n \"Powerlines finalize execution completed\"\n );\n }\n\n /**\n * Invokes the configured plugin hooks\n *\n * @remarks\n * By default, it will call the `\"pre\"`, `\"normal\"`, and `\"post\"` ordered hooks in sequence\n *\n * @param hook - The hook to call\n * @param options - The options to provide to the hook\n * @param args - The arguments to pass to the hook\n * @returns The result of the hook call\n */\n public async callHook<TKey extends HookKeys<PluginContext<TResolvedConfig>>>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig>;\n },\n ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>\n ) {\n return callHook<TResolvedConfig, EnvironmentContext<TResolvedConfig>, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await this.#context.getEnvironment(options?.environment),\n hook,\n { sequential: true, ...options },\n ...args\n );\n }\n\n /**\n * Dispose of the Powerlines API instance\n *\n * @remarks\n * This method will finalize the Powerlines API instance, cleaning up any resources used.\n */\n public async [Symbol.asyncDispose]() {\n await this.finalize();\n }\n\n async #handleBuild(context: EnvironmentContext<TResolvedConfig>) {\n await this.callHook(\"build\", {\n environment: context,\n order: \"pre\"\n });\n await this.callHook(\"build\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.output.buildPath !== context.config.output.outputPath) {\n const sourcePath = appendPath(\n context.config.output.buildPath,\n context.workspaceConfig.workspaceRoot\n );\n const destinationPath = joinPaths(\n appendPath(\n context.config.output.outputPath,\n context.workspaceConfig.workspaceRoot\n ),\n \"dist\"\n );\n\n if (context.fs.existsSync(sourcePath) && sourcePath !== destinationPath) {\n context.log(\n LogLevelLabel.INFO,\n `Copying build output files from project's build directory (${\n context.config.output.buildPath\n }) to the workspace's output directory (${context.config.output.outputPath}).`\n );\n\n await context.fs.copy(sourcePath, destinationPath);\n }\n }\n\n await Promise.all(\n context.config.output.assets.map(async asset => {\n context.log(\n LogLevelLabel.DEBUG,\n `Copying asset(s): ${chalk.redBright(\n context.workspaceConfig.workspaceRoot === asset.input\n ? asset.glob\n : joinPaths(\n replacePath(\n asset.input,\n context.workspaceConfig.workspaceRoot\n ),\n asset.glob\n )\n )} -> ${chalk.greenBright(\n joinPaths(\n replacePath(asset.output, context.workspaceConfig.workspaceRoot),\n asset.glob\n )\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await context.fs.copy(asset, asset.output);\n })\n );\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"post\"\n });\n }\n\n /**\n * Get the configured environments\n *\n * @returns The configured environments\n */\n async #getEnvironments() {\n if (\n !this.context.config.environments ||\n Object.keys(this.context.config.environments).length <= 1\n ) {\n this.context.log(\n LogLevelLabel.DEBUG,\n \"No environments are configured for this Powerlines project. Using the default environment.\"\n );\n\n return [await this.context.getEnvironment()];\n }\n\n this.context.log(\n LogLevelLabel.DEBUG,\n `Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`\n );\n\n return (\n await Promise.all(\n Object.entries(this.context.config.environments).map(\n async ([name, config]) => {\n const environment = await this.context.getEnvironmentSafe(name);\n if (!environment) {\n const resolvedEnvironment = await this.callHook(\n \"configEnvironment\",\n {\n environment: name\n },\n name,\n config\n );\n\n if (resolvedEnvironment) {\n this.context.environments[name] = await this.context.in(\n resolvedEnvironment as EnvironmentResolvedConfig\n );\n }\n }\n\n return this.context.environments[name];\n }\n )\n )\n ).filter(context => isSet(context));\n }\n\n /**\n * Execute a handler function for each environment\n *\n * @param handle - The handler function to execute for each environment\n */\n async #executeEnvironments(\n handle: (context: EnvironmentContext<TResolvedConfig>) => MaybePromise<void>\n ) {\n await Promise.all(\n (await this.#getEnvironments()).map(async context => {\n return Promise.resolve(handle(context));\n })\n );\n }\n\n /**\n * Add a Powerlines plugin used in the build process\n *\n * @param config - The import path of the plugin to add\n */\n async #addPlugin(config: PluginConfig<PluginContext<TResolvedConfig>>) {\n if (config) {\n const result = await this.#initPlugin(config);\n if (!result) {\n return;\n }\n\n for (const plugin of result) {\n if (plugin.dependsOn) {\n for (const required of plugin.dependsOn) {\n await this.#addPlugin(required);\n }\n }\n\n this.context.log(\n LogLevelLabel.DEBUG,\n `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n );\n\n await this.context.addPlugin(plugin);\n }\n }\n }\n\n /**\n * Initialize a Powerlines plugin\n *\n * @param config - The configuration for the plugin\n * @returns The initialized plugin instance, or null if the plugin was a duplicate\n * @throws Will throw an error if the plugin cannot be found or is invalid\n */\n async #initPlugin(\n config: PluginConfig<PluginContext<TResolvedConfig>>\n ): Promise<Plugin<PluginContext<TResolvedConfig>>[] | null> {\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = await Promise.resolve(config);\n }\n\n if (!isPluginConfig(awaited)) {\n throw new Error(\n `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\\`.`\n );\n }\n\n let result!: Plugin<PluginContext<TResolvedConfig>>[];\n if (Array.isArray(awaited) && awaited.every(isPlugin<TResolvedConfig>)) {\n result = awaited;\n } else if (isPlugin<TResolvedConfig>(awaited)) {\n result = [awaited];\n } else if (isFunction(awaited)) {\n result = toArray(await Promise.resolve(awaited()));\n } else if (isSetString(awaited)) {\n const resolved = await this.#resolvePlugin(awaited);\n if (isFunction(resolved)) {\n result = toArray(await Promise.resolve(resolved()));\n } else {\n result = toArray(resolved);\n }\n } else if (isPluginConfigTuple(awaited) || isPluginConfigObject(awaited)) {\n let pluginConfig!:\n | string\n | PluginFactory<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple(awaited)) {\n pluginConfig = awaited[0] as Plugin<PluginContext<TResolvedConfig>>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = (awaited as PluginConfigObject).plugin as Plugin<\n PluginContext<TResolvedConfig>\n >;\n pluginOptions = (awaited as PluginConfigObject).options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await this.#resolvePlugin(pluginConfig);\n if (isFunction(resolved)) {\n result = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n result = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n result = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<TResolvedConfig>)\n ) {\n result = pluginConfig;\n } else if (isPlugin(pluginConfig)) {\n result = toArray(pluginConfig);\n }\n }\n\n if (!result) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (result.length > 0 && !result.every(isPlugin<TResolvedConfig>)) {\n throw new Error(\n `The plugin option ${JSON.stringify(result)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n for (const plugin of result) {\n if (checkDedupe<TResolvedConfig>(plugin, this.context.plugins)) {\n this.context.log(\n LogLevelLabel.TRACE,\n `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n );\n\n return null;\n }\n\n this.context.log(\n LogLevelLabel.TRACE,\n `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n );\n }\n\n return result;\n }\n\n async #resolvePlugin<TOptions>(\n pluginPath: string\n ): Promise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n | ((\n options?: TOptions\n ) => MaybePromise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n >)\n > {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [\n this.context.workspaceConfig.workspaceRoot,\n this.context.config.projectRoot\n ]\n });\n if (!isInstalled && this.context.config.skipInstalls !== true) {\n this.#context.log(\n LogLevelLabel.WARN,\n `The plugin package \"${pluginPath}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: this.context.config.projectRoot\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n this.#context.log(LogLevelLabel.ERROR, result.stderr);\n throw new Error(\n `An error occurred while installing the build plugin package \"${pluginPath}\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(\n this.context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\"))\n );\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(this.context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: 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\\`.`\n );\n }\n }\n }\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { PowerlinesAPI } from \"../../api\";\nimport { UnpluginBuildVariant } from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { InferResolvedConfig } from \"../../types/resolved\";\nimport {\n InferUnpluginOptions,\n PowerlinesUnpluginFactory,\n PowerlinesUnpluginOptions\n} from \"../../types/unplugin\";\nimport { createLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\n\n/**\n * Creates a Powerlines unplugin factory that generates a plugin instance.\n *\n * @param variant - The build variant for which to create the unplugin.\n * @param decorate - An optional function to decorate the unplugin options.\n * @returns The unplugin factory that generates a plugin instance.\n */\nexport function createUnpluginFactory<\n TBuildVariant extends UnpluginBuildVariant,\n TContext extends Context<InferResolvedConfig<TBuildVariant>> = Context<\n InferResolvedConfig<TBuildVariant>\n >\n>(\n variant: TBuildVariant,\n decorate?: (\n api: PowerlinesAPI<TContext[\"config\"]>,\n plugin: Omit<PowerlinesUnpluginOptions<TBuildVariant>, UnpluginBuildVariant>\n ) => InferUnpluginOptions<TBuildVariant>\n): PowerlinesUnpluginFactory<TBuildVariant> {\n return (config, meta) => {\n const log = createLog(\"unplugin\", config);\n log(LogLevelLabel.DEBUG, \"Initializing Unplugin\");\n\n try {\n const userConfig = {\n ...config,\n variant,\n unplugin: meta\n } as TContext[\"config\"][\"userConfig\"];\n\n let api!: PowerlinesAPI<TContext[\"config\"]>;\n\n async function buildStart(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\n\n api = await PowerlinesAPI.from(\n getWorkspaceRoot(process.cwd()),\n userConfig\n );\n setParseImpl(api.context.parse);\n\n log(\n LogLevelLabel.DEBUG,\n \"Preparing build artifacts for the Powerlines project...\"\n );\n\n await api.prepare({\n command: \"build\"\n });\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n options: {\n isEntry: boolean;\n } = { isEntry: false }\n ) {\n return api.context.resolve(id, importer, options);\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<TransformResult> {\n const environment = await api.context.getEnvironment();\n\n let result = await api.callHook(\n \"load\",\n { environment, order: \"pre\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await api.callHook(\n \"load\",\n { environment, order: \"normal\" },\n id\n );\n if (result) {\n return result;\n }\n\n result = await environment.load(id);\n if (result) {\n return result;\n }\n\n return api.callHook(\"load\", { environment, order: \"post\" }, id);\n }\n\n async function transform(\n code: string,\n id: string\n ): Promise<TransformResult> {\n return api.callHook(\n \"transform\",\n {\n environment: await api.context.getEnvironment(),\n result: \"merge\",\n asNextParam: previousResult => getString(previousResult)\n },\n getString(code),\n id\n );\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n await api.callHook(\"writeBundle\", {\n environment: await api.context.getEnvironment()\n });\n }\n\n const result = {\n name: \"powerlines\",\n api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/, /^storm:/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n writeBundle\n } satisfies PowerlinesUnpluginOptions<TBuildVariant>;\n\n return decorate ? decorate(api, result) : result;\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { createPluginContext } from './chunk-6OGQTUXF.js';
2
- import { PowerlinesContext, isPluginConfig, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-VPZU5BTK.js';
2
+ import { PowerlinesContext, isPluginConfig, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-3BXSIJGU.js';
3
3
  import { __name } from './chunk-7QVYU63E.js';
4
4
  import { resolvePackage } from '@stryke/fs/resolve';
5
5
  import { isFunction } from '@stryke/type-checks/is-function';
@@ -201,5 +201,5 @@ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends P
201
201
  };
202
202
 
203
203
  export { PowerlinesEnvironmentContext };
204
- //# sourceMappingURL=chunk-MBGLVIJD.js.map
205
- //# sourceMappingURL=chunk-MBGLVIJD.js.map
204
+ //# sourceMappingURL=chunk-Q7KX7QCP.js.map
205
+ //# sourceMappingURL=chunk-Q7KX7QCP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/plugin.ts","../../src/lib/contexts/environment-context.ts"],"names":["PLUGIN_NON_HOOK_FIELDS","PowerlinesEnvironmentContext","PowerlinesContext","fromConfig","workspaceConfig","config","context","init","powerlinesPath","resolvePackage","Error","environment","plugins","hooks","addPlugin","plugin","resolvedPlugin","isFunction","applyToEnvironment","result","Promise","resolve","isObject","Object","keys","length","isPluginConfig","$$internal","isPlugin","createPluginContext","push","filter","key","includes","reduce","ret","hook","pluginHook","isPluginHook","isHookExternal","enforce","addPluginHook","order","normal","getHookHandler","bind","selectHooks","options","preOrdered","map","h","find","p","name","handle","handler","preEnforced","postOrdered","postEnforced","resolvedConfig"],"mappings":";;;;;;;;AA2YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA;;;;AClWK,IAAMC,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,iBAAAA,CAAAA;EAlDV;;;;;;AAwDE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElB,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,MAAAA,GAAS,IAAA,CAAKH,OAAAA,CAAQuC,IAAAA,CAC1BC,CAAAA,CAAAA,KAAKA,CAAAA,CAAErC,MAAAA,CAAOsC,IAAAA,KAASH,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA;AAEtC,UAAA,IAAI,CAACtC,MAAAA,EAAQ;AACX,YAAA,MAAM,IAAIL,KAAAA,CACR,CAAA,0CAAA,EAA6CwC,CAAAA,CAAEnC,MAAAA,CAAOsC,IAAI,CAAA,EAAA,CAAI,CAAA;AAElE,UAAA;AAEA,UAAA,OAAO;AACLC,YAAAA,MAAAA,EAAQJ,CAAAA,CAAEK,OAAAA;AACVjD,YAAAA,OAAAA,EAASS,MAAAA,CAAOT;AAClB,WAAA;AACF,QAAA,CAAA,CAAA,CAAA;AAEJ,MAAA;AACF,IAAA;AAEA,IAAA,OAAOa,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKuD,cAAAA,GAAiBtD,MAAAA;AACxB,EAAA;AACF","file":"chunk-MBGLVIJD.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { FunctionLike, MaybePromise } from \"@stryke/types/base\";\nimport type {\n ExternalIdResult,\n HookFilter,\n TransformResult,\n UnpluginOptions\n} from \"unplugin\";\nimport type { UnpluginBuildVariant } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport type { EnvironmentConfig, PluginConfig } from \"./config\";\nimport type {\n BuildPluginContext,\n PluginContext,\n UnresolvedContext\n} from \"./context\";\nimport type { EnvironmentResolvedConfig, ResolvedConfig } from \"./resolved\";\n\nexport interface PluginHookObject<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> {\n /**\n * The order in which the plugin should be applied.\n */\n order?: \"pre\" | \"post\" | null | undefined;\n\n /**\n * A filter to determine when the hook should be called.\n */\n filter?: Pick<HookFilter, TFilter>;\n\n /**\n * The hook function to be called.\n */\n handler: THookFunction;\n}\n\nexport type PluginHook<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> = THookFunction | PluginHookObject<THookFunction, TFilter>;\n\n/**\n * A result returned by the plugin from the `types` hook that describes the declaration types output file.\n */\nexport interface TypesResult {\n directives?: string[];\n code: string;\n}\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type ConfigResult<TContext extends PluginContext = PluginContext> =\n DeepPartial<TContext[\"config\"]> & Record<string, any>;\n\nexport interface BasePluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config: (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>;\n\n /**\n * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @remarks\n * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.\n *\n * @see https://vitejs.dev/guide/api-plugin#configenvironment\n *\n * @param this - The build context.\n * @param name - The name of the environment being configured.\n * @param environment - The Vite-like environment object containing information about the current build environment.\n * @returns A promise that resolves when the hook is complete.\n */\n configEnvironment: (\n this: TContext,\n name: string,\n environment: EnvironmentConfig\n ) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;\n\n /**\n * A hook that is called when the plugin is resolved.\n *\n * @see https://vitejs.dev/guide/api-plugin#configresolved\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n configResolved: (this: TContext) => MaybePromise<void>;\n\n /**\n * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.\n *\n * @param this - The build context.\n * @param code - The source code to generate types for.\n * @returns A promise that resolves when the hook is complete.\n */\n types: (\n this: TContext,\n code: string\n ) => MaybePromise<TypesResult | string | undefined | null>;\n\n /**\n * A hook that is called at the start of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildStart: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called at the end of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildEnd: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>;\n\n /**\n * A hook that is called to write the bundle to disk.\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n writeBundle: (this: TContext) => MaybePromise<void>;\n}\n\nexport type BuildPlugin<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant,\n TOptions extends Required<UnpluginOptions>[TBuildVariant] =\n Required<UnpluginOptions>[TBuildVariant]\n> = {\n [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike\n ? (\n this: ThisParameterType<TOptions[TKey]> & TContext,\n ...args: Parameters<TOptions[TKey]>\n ) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>>\n : TOptions[TKey];\n};\n\nexport type ExternalPluginHookFunctionsVariant<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant\n> = {\n [TKey in keyof BuildPlugin<TContext, TBuildVariant> &\n string as `${TBuildVariant}:${TKey}`]: BuildPlugin<\n TContext,\n TBuildVariant\n >[TKey];\n};\n\nexport type ExternalPluginHookFunctions<TContext extends PluginContext> =\n ExternalPluginHookFunctionsVariant<TContext, \"vite\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"esbuild\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rolldown\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rollup\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"webpack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rspack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"farm\">;\n\nexport type PluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;\n\nexport type PluginHooks<TContext extends PluginContext = PluginContext> = {\n [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<\n BasePluginHookFunctions<TContext>[TKey]\n >;\n} & {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config:\n | PluginHook<\n (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>\n >\n | ConfigResult<TContext>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>,\n \"code\" | \"id\"\n >;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>,\n \"id\"\n >;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>,\n \"id\"\n >;\n};\n\nexport type PluginBuildPlugins<TContext extends PluginContext = PluginContext> =\n {\n [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<\n TContext,\n TBuildVariant\n >;\n };\n\nexport interface Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n>\n extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {\n /**\n * The name of the plugin, for use in deduplication, error messages and logs.\n */\n name: string;\n\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api?: Record<string, any>;\n\n /**\n * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.\n *\n * @remarks\n * The Plugin invocation order is as follows:\n * - `enforce: 'pre'` plugins\n * - `order: 'pre'` plugin hooks\n * - any other plugins (normal)\n * - `order: 'post'` plugin hooks\n * - `enforce: 'post'` plugins\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering\n * @see https://rollupjs.org/plugin-development/#build-hooks\n * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post\n * @see https://esbuild.github.io/plugins/#concepts\n */\n enforce?: \"pre\" | \"post\";\n\n /**\n * A function to determine if two plugins are the same and can be de-duplicated.\n *\n * @remarks\n * If this is not provided, plugins are de-duplicated by comparing their names.\n *\n * @param other - The other plugin to compare against.\n * @returns `true` if the two plugins are the same, `false` otherwise.\n */\n dedupe?: false | ((other: Plugin<TContext>) => boolean);\n\n /**\n * A list of pre-requisite plugins that must be loaded before this plugin can be used.\n */\n dependsOn?: PluginConfig<TContext>[];\n\n /**\n * Define environments where this plugin should be active. By default, the plugin is active in all environments.\n *\n * @param environment - The environment to check.\n * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.\n */\n applyToEnvironment?: (\n environment: EnvironmentResolvedConfig\n ) => boolean | PluginConfig<TContext>;\n}\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"dependsOn\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuildVariant;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport {\n addPluginHook,\n getHookHandler,\n isHookExternal,\n isPlugin,\n isPluginConfig,\n isPluginHook\n} from \"../../plugin-utils/helpers\";\nimport { WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHooksOptions,\n SelectHooksResult\n} from \"../../types/context\";\nimport { BaseHooksList, HookKeys, HooksList } from \"../../types/hooks\";\nimport { Plugin, PLUGIN_NON_HOOK_FIELDS } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements EnvironmentContext<TResolvedConfig>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: HooksList<PluginContext<TResolvedConfig>> = {} as HooksList<\n PluginContext<TResolvedConfig>\n >;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceConfig - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static async fromConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceConfig: WorkspaceConfig,\n config: TResolvedConfig\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig>> {\n const context = new PowerlinesEnvironmentContext<TResolvedConfig>(\n config,\n workspaceConfig\n );\n await context.init();\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * The resolved environment configuration\n */\n public environment!: EnvironmentResolvedConfig;\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentContextPlugin<TResolvedConfig>[] = [];\n\n /**\n * The resolved configuration options\n */\n public override get config(): TResolvedConfig {\n return super.config;\n }\n\n public get hooks(): HooksList<PluginContext<TResolvedConfig>> {\n return this.#hooks;\n }\n\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n let resolvedPlugin = plugin;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = await Promise.resolve(\n plugin.applyToEnvironment(this.environment)\n );\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<TResolvedConfig>(result) ? result : plugin;\n }\n\n const context = createPluginContext<TResolvedConfig>(resolvedPlugin, this);\n\n this.plugins.push({\n plugin: resolvedPlugin,\n context\n });\n\n this.#hooks = Object.keys(resolvedPlugin)\n .filter(\n key =>\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce((ret, key) => {\n const hook = key as keyof HooksList<PluginContext<TResolvedConfig>>;\n const pluginHook = resolvedPlugin[hook as keyof typeof resolvedPlugin];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n if (!isHookExternal(hook)) {\n ret[hook] ??= {};\n if (resolvedPlugin.enforce) {\n ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${resolvedPlugin.enforce}Enforced`]!\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook].normal\n );\n\n return ret;\n }\n\n ret[hook][`${pluginHook.order}Ordered`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${pluginHook.order}Ordered`]!\n );\n } else {\n ret[hook] ??= [];\n ret[hook].push({\n plugin: resolvedPlugin,\n hook: getHookHandler(pluginHook).bind(context)\n } as any);\n }\n\n return ret;\n }, this.hooks);\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends HookKeys<PluginContext<TResolvedConfig>>>(\n hook: TKey,\n options?: SelectHooksOptions\n ): SelectHooksResult<TResolvedConfig, TKey>[] {\n const result = [] as SelectHooksResult<TResolvedConfig, TKey>[];\n\n if (this.hooks[hook]) {\n if (!isHookExternal(hook)) {\n const hooks = this.hooks[hook] as BaseHooksList<\n PluginContext<TResolvedConfig>\n >;\n if (options?.order) {\n if (options?.order === \"pre\") {\n result.push(\n ...(hooks.preOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.preEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else if (options?.order === \"post\") {\n result.push(\n ...(hooks.postOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.postEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else {\n result.push(\n ...(hooks.normal ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n } else {\n result.push(...this.selectHooks(hook, { order: \"pre\" }));\n result.push(...this.selectHooks(hook, { order: \"normal\" }));\n result.push(...this.selectHooks(hook, { order: \"post\" }));\n }\n } else {\n result.push(\n ...this.hooks[hook].map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${h.plugin.name}\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n }\n\n return result;\n }\n\n protected constructor(\n config: TResolvedConfig,\n workspaceConfig: WorkspaceConfig\n ) {\n super(workspaceConfig);\n\n this.resolvedConfig = config;\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/types/plugin.ts","../../src/lib/contexts/environment-context.ts"],"names":["PLUGIN_NON_HOOK_FIELDS","PowerlinesEnvironmentContext","PowerlinesContext","fromConfig","workspaceConfig","config","context","init","powerlinesPath","resolvePackage","Error","environment","plugins","hooks","addPlugin","plugin","resolvedPlugin","isFunction","applyToEnvironment","result","Promise","resolve","isObject","Object","keys","length","isPluginConfig","$$internal","isPlugin","createPluginContext","push","filter","key","includes","reduce","ret","hook","pluginHook","isPluginHook","isHookExternal","enforce","addPluginHook","order","normal","getHookHandler","bind","selectHooks","options","preOrdered","map","h","find","p","name","handle","handler","preEnforced","postOrdered","postEnforced","resolvedConfig"],"mappings":";;;;;;;;AA2YO,IAAMA,sBAAAA,GAAyB;AACpC,EAAA,MAAA;AACA,EAAA,KAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,WAAA;AACA,EAAA;;;;AClWK,IAAMC,4BAAAA,GAAN,MAAMA,6BAAAA,SAGHC,iBAAAA,CAAAA;EAlDV;;;;;;AAwDE,EAAA,MAAA,GAAoD,EAAC;;;;;;;;EAWrD,aAAoBC,UAAAA,CAGlBC,iBACAC,MAAAA,EACwD;AACxD,IAAA,MAAMC,OAAAA,GAAU,IAAIL,6BAAAA,CAClBI,MAAAA,EACAD,eAAAA,CAAAA;AAEF,IAAA,MAAME,QAAQC,IAAAA,EAAI;AAElB,IAAA,MAAMC,cAAAA,GAAiB,MAAMC,cAAAA,CAAe,YAAA,CAAA;AAC5C,IAAA,IAAI,CAACD,cAAAA,EAAgB;AACnB,MAAA,MAAM,IAAIE,MAAM,kDAAA,CAAA;AAClB,IAAA;AAEAJ,IAAAA,OAAAA,CAAQE,cAAAA,GAAiBA,cAAAA;AAEzB,IAAA,OAAOF,OAAAA;AACT,EAAA;;;;AAKOK,EAAAA,WAAAA;;;;AAKAC,EAAAA,OAAAA,GAAuD,EAAA;;;;AAK9D,EAAA,IAAo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,UAAA;AAEA,UAAA,OAAO;AACLC,YAAAA,MAAAA,EAAQJ,CAAAA,CAAEK,OAAAA;AACVjD,YAAAA,OAAAA,EAASS,MAAAA,CAAOT;AAClB,WAAA;AACF,QAAA,CAAA,CAAA,CAAA;AAEJ,MAAA;AACF,IAAA;AAEA,IAAA,OAAOa,MAAAA;AACT,EAAA;AAEA,EAAA,WAAA,CACEd,QACAD,eAAAA,EACA;AACA,IAAA,KAAA,CAAMA,eAAAA,CAAAA;AAEN,IAAA,IAAA,CAAKuD,cAAAA,GAAiBtD,MAAAA;AACxB,EAAA;AACF","file":"chunk-Q7KX7QCP.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { FunctionLike, MaybePromise } from \"@stryke/types/base\";\nimport type {\n ExternalIdResult,\n HookFilter,\n TransformResult,\n UnpluginOptions\n} from \"unplugin\";\nimport type { UnpluginBuildVariant } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport type { EnvironmentConfig, PluginConfig } from \"./config\";\nimport type {\n BuildPluginContext,\n PluginContext,\n UnresolvedContext\n} from \"./context\";\nimport type { EnvironmentResolvedConfig, ResolvedConfig } from \"./resolved\";\n\nexport interface PluginHookObject<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> {\n /**\n * The order in which the plugin should be applied.\n */\n order?: \"pre\" | \"post\" | null | undefined;\n\n /**\n * A filter to determine when the hook should be called.\n */\n filter?: Pick<HookFilter, TFilter>;\n\n /**\n * The hook function to be called.\n */\n handler: THookFunction;\n}\n\nexport type PluginHook<\n THookFunction extends FunctionLike,\n TFilter extends keyof HookFilter = never\n> = THookFunction | PluginHookObject<THookFunction, TFilter>;\n\n/**\n * A result returned by the plugin from the `types` hook that describes the declaration types output file.\n */\nexport interface TypesResult {\n directives?: string[];\n code: string;\n}\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type ConfigResult<TContext extends PluginContext = PluginContext> =\n DeepPartial<TContext[\"config\"]> & Record<string, any>;\n\nexport interface BasePluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config: (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>;\n\n /**\n * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @remarks\n * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.\n *\n * @see https://vitejs.dev/guide/api-plugin#configenvironment\n *\n * @param this - The build context.\n * @param name - The name of the environment being configured.\n * @param environment - The Vite-like environment object containing information about the current build environment.\n * @returns A promise that resolves when the hook is complete.\n */\n configEnvironment: (\n this: TContext,\n name: string,\n environment: EnvironmentConfig\n ) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;\n\n /**\n * A hook that is called when the plugin is resolved.\n *\n * @see https://vitejs.dev/guide/api-plugin#configresolved\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n configResolved: (this: TContext) => MaybePromise<void>;\n\n /**\n * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.\n *\n * @param this - The build context.\n * @param code - The source code to generate types for.\n * @returns A promise that resolves when the hook is complete.\n */\n types: (\n this: TContext,\n code: string\n ) => MaybePromise<TypesResult | string | undefined | null>;\n\n /**\n * A hook that is called at the start of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildStart: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called at the end of the build process.\n *\n * @param this - The build context and unplugin build context.\n * @returns A promise that resolves when the hook is complete.\n */\n buildEnd: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext\n ) => MaybePromise<void>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>;\n\n /**\n * A hook that is called to write the bundle to disk.\n *\n * @param this - The build context.\n * @returns A promise that resolves when the hook is complete.\n */\n writeBundle: (this: TContext) => MaybePromise<void>;\n}\n\nexport type BuildPlugin<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant,\n TOptions extends Required<UnpluginOptions>[TBuildVariant] =\n Required<UnpluginOptions>[TBuildVariant]\n> = {\n [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike\n ? (\n this: ThisParameterType<TOptions[TKey]> & TContext,\n ...args: Parameters<TOptions[TKey]>\n ) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>>\n : TOptions[TKey];\n};\n\nexport type ExternalPluginHookFunctionsVariant<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends UnpluginBuildVariant = UnpluginBuildVariant\n> = {\n [TKey in keyof BuildPlugin<TContext, TBuildVariant> &\n string as `${TBuildVariant}:${TKey}`]: BuildPlugin<\n TContext,\n TBuildVariant\n >[TKey];\n};\n\nexport type ExternalPluginHookFunctions<TContext extends PluginContext> =\n ExternalPluginHookFunctionsVariant<TContext, \"vite\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"esbuild\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rolldown\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rollup\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"webpack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"rspack\"> &\n ExternalPluginHookFunctionsVariant<TContext, \"farm\">;\n\nexport type PluginHookFunctions<\n TContext extends PluginContext = PluginContext\n> = BasePluginHookFunctions<TContext> & ExternalPluginHookFunctions<TContext>;\n\nexport type PluginHooks<TContext extends PluginContext = PluginContext> = {\n [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<\n BasePluginHookFunctions<TContext>[TKey]\n >;\n} & {\n /**\n * A function that returns configuration options to be merged with the build context's options.\n *\n * @remarks\n * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.\n *\n * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.\n *\n * @see https://vitejs.dev/guide/api-plugin#config\n *\n * @param this - The build context.\n * @param config - The partial configuration object to be modified.\n * @returns A promise that resolves to a partial configuration object.\n */\n config:\n | PluginHook<\n (\n this: UnresolvedContext<TContext[\"config\"]>\n ) => MaybePromise<ConfigResult<TContext>>\n >\n | ConfigResult<TContext>;\n\n /**\n * A hook that is called to transform the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param code - The source code to transform.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n transform: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n code: string,\n id: string\n ) => MaybePromise<TransformResult>,\n \"code\" | \"id\"\n >;\n\n /**\n * A hook that is called to load the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @returns A promise that resolves when the hook is complete.\n */\n load: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string\n ) => MaybePromise<TransformResult>,\n \"id\"\n >;\n\n /**\n * A hook that is called to resolve the identifier of the source code.\n *\n * @param this - The build context, unplugin build context, and unplugin context.\n * @param id - The identifier of the source code.\n * @param importer - The importer of the source code.\n * @param options - The options for resolving the identifier.\n * @returns A promise that resolves when the hook is complete.\n */\n resolveId: PluginHook<\n (\n this: BuildPluginContext<TContext[\"config\"]> & TContext,\n id: string,\n importer: string | undefined,\n options: { isEntry: boolean }\n ) => MaybePromise<string | ExternalIdResult | null | undefined>,\n \"id\"\n >;\n};\n\nexport type PluginBuildPlugins<TContext extends PluginContext = PluginContext> =\n {\n [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<\n TContext,\n TBuildVariant\n >;\n };\n\nexport interface Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n>\n extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {\n /**\n * The name of the plugin, for use in deduplication, error messages and logs.\n */\n name: string;\n\n /**\n * An API object that can be used for inter-plugin communication.\n *\n * @see https://rollupjs.org/plugin-development/#direct-plugin-communication\n */\n api?: Record<string, any>;\n\n /**\n * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.\n *\n * @remarks\n * The Plugin invocation order is as follows:\n * - `enforce: 'pre'` plugins\n * - `order: 'pre'` plugin hooks\n * - any other plugins (normal)\n * - `order: 'post'` plugin hooks\n * - `enforce: 'post'` plugins\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering\n * @see https://rollupjs.org/plugin-development/#build-hooks\n * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post\n * @see https://esbuild.github.io/plugins/#concepts\n */\n enforce?: \"pre\" | \"post\";\n\n /**\n * A function to determine if two plugins are the same and can be de-duplicated.\n *\n * @remarks\n * If this is not provided, plugins are de-duplicated by comparing their names.\n *\n * @param other - The other plugin to compare against.\n * @returns `true` if the two plugins are the same, `false` otherwise.\n */\n dedupe?: false | ((other: Plugin<TContext>) => boolean);\n\n /**\n * A list of pre-requisite plugins that must be loaded before this plugin can be used.\n */\n dependsOn?: PluginConfig<TContext>[];\n\n /**\n * Define environments where this plugin should be active. By default, the plugin is active in all environments.\n *\n * @param environment - The environment to check.\n * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.\n */\n applyToEnvironment?: (\n environment: EnvironmentResolvedConfig\n ) => boolean | PluginConfig<TContext>;\n}\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"dependsOn\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuildVariant;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport {\n addPluginHook,\n getHookHandler,\n isHookExternal,\n isPlugin,\n isPluginConfig,\n isPluginHook\n} from \"../../plugin-utils/helpers\";\nimport { WorkspaceConfig } from \"../../types/config\";\nimport {\n EnvironmentContext,\n EnvironmentContextPlugin,\n PluginContext,\n SelectHooksOptions,\n SelectHooksResult\n} from \"../../types/context\";\nimport { BaseHooksList, HookKeys, HooksList } from \"../../types/hooks\";\nimport { Plugin, PLUGIN_NON_HOOK_FIELDS } from \"../../types/plugin\";\nimport {\n EnvironmentResolvedConfig,\n ResolvedConfig\n} from \"../../types/resolved\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n extends PowerlinesContext<TResolvedConfig>\n implements EnvironmentContext<TResolvedConfig>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: HooksList<PluginContext<TResolvedConfig>> = {} as HooksList<\n PluginContext<TResolvedConfig>\n >;\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param workspaceConfig - The root directory of the workspace.\n * @param config - The user configuration options.\n * @returns A promise that resolves to the new context.\n */\n public static async fromConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceConfig: WorkspaceConfig,\n config: TResolvedConfig\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig>> {\n const context = new PowerlinesEnvironmentContext<TResolvedConfig>(\n config,\n workspaceConfig\n );\n await context.init();\n\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n\n context.powerlinesPath = powerlinesPath;\n\n return context;\n }\n\n /**\n * The resolved environment configuration\n */\n public environment!: EnvironmentResolvedConfig;\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentContextPlugin<TResolvedConfig>[] = [];\n\n /**\n * The resolved configuration options\n */\n public override get config(): TResolvedConfig {\n return super.config;\n }\n\n public get hooks(): HooksList<PluginContext<TResolvedConfig>> {\n return this.#hooks;\n }\n\n public async addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>) {\n let resolvedPlugin = plugin;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = await Promise.resolve(\n plugin.applyToEnvironment(this.environment)\n );\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (isPluginConfig(result)) {\n return this.$$internal.addPlugin(result);\n }\n\n resolvedPlugin = isPlugin<TResolvedConfig>(result) ? result : plugin;\n }\n\n const context = createPluginContext<TResolvedConfig>(resolvedPlugin, this);\n\n this.plugins.push({\n plugin: resolvedPlugin,\n context\n });\n\n this.#hooks = Object.keys(resolvedPlugin)\n .filter(\n key =>\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce((ret, key) => {\n const hook = key as keyof HooksList<PluginContext<TResolvedConfig>>;\n const pluginHook = resolvedPlugin[hook as keyof typeof resolvedPlugin];\n if (!isPluginHook(pluginHook)) {\n return ret;\n }\n\n if (!isHookExternal(hook)) {\n ret[hook] ??= {};\n if (resolvedPlugin.enforce) {\n ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${resolvedPlugin.enforce}Enforced`]!\n );\n\n return ret;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n ret[hook].normal ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook].normal\n );\n\n return ret;\n }\n\n ret[hook][`${pluginHook.order}Ordered`] ??= [];\n\n addPluginHook(\n context,\n resolvedPlugin,\n pluginHook,\n ret[hook][`${pluginHook.order}Ordered`]!\n );\n } else {\n ret[hook] ??= [];\n ret[hook].push({\n plugin: resolvedPlugin,\n hook: getHookHandler(pluginHook).bind(context)\n } as any);\n }\n\n return ret;\n }, this.hooks);\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends HookKeys<PluginContext<TResolvedConfig>>>(\n hook: TKey,\n options?: SelectHooksOptions\n ): SelectHooksResult<TResolvedConfig, TKey>[] {\n const result = [] as SelectHooksResult<TResolvedConfig, TKey>[];\n\n if (this.hooks[hook]) {\n if (!isHookExternal(hook)) {\n const hooks = this.hooks[hook] as BaseHooksList<\n PluginContext<TResolvedConfig>\n >;\n if (options?.order) {\n if (options?.order === \"pre\") {\n result.push(\n ...(hooks.preOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.preEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else if (options?.order === \"post\") {\n result.push(\n ...(hooks.postOrdered ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n result.push(\n ...(hooks.postEnforced ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n } else {\n result.push(\n ...(hooks.normal ?? []).map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n h.plugin.name\n }\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n } else {\n result.push(...this.selectHooks(hook, { order: \"pre\" }));\n result.push(...this.selectHooks(hook, { order: \"normal\" }));\n result.push(...this.selectHooks(hook, { order: \"post\" }));\n }\n } else {\n result.push(\n ...this.hooks[hook].map(h => {\n const plugin = this.plugins.find(\n p => p.plugin.name === h.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${h.plugin.name}\".`\n );\n }\n\n return {\n handle: h.handler,\n context: plugin.context\n };\n })\n );\n }\n }\n\n return result;\n }\n\n protected constructor(\n config: TResolvedConfig,\n workspaceConfig: WorkspaceConfig\n ) {\n super(workspaceConfig);\n\n this.resolvedConfig = config;\n }\n}\n"]}
@@ -490,6 +490,20 @@ var VirtualFileSystem = class _VirtualFileSystem {
490
490
  };
491
491
  return ret;
492
492
  }, {});
493
+ if (context.config.skipCache !== true) {
494
+ Object.entries(this.#metadata).filter(([, value]) => value.type === "entry").forEach(([id, value]) => {
495
+ this.#context.entry ??= [];
496
+ this.#context.entry.push({
497
+ file: id,
498
+ name: value.properties.name,
499
+ output: value.properties.output,
500
+ input: value.properties["input.file"] ? {
501
+ file: value.properties["input.file"],
502
+ name: value.properties["input.name"]
503
+ } : void 0
504
+ });
505
+ });
506
+ }
493
507
  }
494
508
  this.#ids = {};
495
509
  this.#paths = {};
@@ -1092,7 +1106,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1092
1106
  fileMetadata.timestamp = value.timestamp ?? BigInt(Date.now());
1093
1107
  if (value.properties) {
1094
1108
  const props = fileMetadata._initProperties(Object.keys(value.properties).length);
1095
- Object.entries(value.properties).forEach(([key, val], index2) => {
1109
+ Object.entries(value.properties).filter(([, val]) => isSetString(val)).forEach(([key, val], index2) => {
1096
1110
  const prop = props.get(index2);
1097
1111
  prop.key = key;
1098
1112
  prop.value = val;
@@ -1136,5 +1150,5 @@ var VirtualFileSystem = class _VirtualFileSystem {
1136
1150
  };
1137
1151
 
1138
1152
  export { VirtualFileSystem };
1139
- //# sourceMappingURL=chunk-NXUMUI2Z.js.map
1140
- //# sourceMappingURL=chunk-NXUMUI2Z.js.map
1153
+ //# sourceMappingURL=chunk-TB2ZWKZN.js.map
1154
+ //# sourceMappingURL=chunk-TB2ZWKZN.js.map