powerlines 0.27.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/dist/{api-CHbGX3BG.d.ts → api-BgDfE1J3.d.ts} +2 -2
  2. package/dist/{api-DGMQopJ5.d.cts → api-D-3EvHyy.d.cts} +2 -2
  3. package/dist/api.cjs +2 -2
  4. package/dist/api.d.cts +5 -2
  5. package/dist/api.d.ts +5 -2
  6. package/dist/api.js +1 -1
  7. package/dist/astro.cjs +4 -4
  8. package/dist/astro.d.cts +4 -1
  9. package/dist/astro.d.ts +4 -1
  10. package/dist/astro.js +3 -3
  11. package/dist/{chunk-PYID3NKT.js → chunk-5CV2NNIR.js} +6 -5
  12. package/dist/chunk-C3APS65S.cjs +12 -0
  13. package/dist/{chunk-HG7JY6AQ.cjs → chunk-DD4XJNKQ.cjs} +7 -6
  14. package/dist/{chunk-RCYXXBJ3.cjs → chunk-ERZWC77E.cjs} +272 -117
  15. package/dist/{chunk-KW66GUWJ.cjs → chunk-FJ67PPIW.cjs} +4 -4
  16. package/dist/{chunk-YULFP33E.cjs → chunk-MRHWIMY2.cjs} +2 -2
  17. package/dist/{chunk-CSJMUAPJ.js → chunk-NHZBSVDJ.js} +3 -3
  18. package/dist/{chunk-2DWFEC7G.js → chunk-QRE6JMCD.js} +271 -116
  19. package/dist/{chunk-P647W2BA.js → chunk-UMZ2WNMA.js} +2 -2
  20. package/dist/{chunk-ISPXQBOL.js → chunk-VJ26HHRE.js} +3 -3
  21. package/dist/{chunk-CF7B5HOG.cjs → chunk-XMYY4XUM.cjs} +4 -4
  22. package/dist/{chunk-BH4JSKPK.js → chunk-Z3HPP53Q.js} +3 -3
  23. package/dist/{context-BjOICcQB.d.cts → context-CDZY3RHt.d.cts} +80 -21
  24. package/dist/{context-BqTYt9FC.d.ts → context-CcPf9RC_.d.ts} +80 -21
  25. package/dist/esbuild.cjs +6 -6
  26. package/dist/esbuild.d.cts +4 -1
  27. package/dist/esbuild.d.ts +4 -1
  28. package/dist/esbuild.js +3 -3
  29. package/dist/farm.cjs +3 -3
  30. package/dist/farm.d.cts +4 -1
  31. package/dist/farm.d.ts +4 -1
  32. package/dist/farm.js +2 -2
  33. package/dist/index.cjs +18 -18
  34. package/dist/index.d.cts +15 -4
  35. package/dist/index.d.ts +15 -4
  36. package/dist/index.js +10 -7
  37. package/dist/lib/{api-_rRpguWX.d.cts → api-BIHEKpyq.d.ts} +2 -2
  38. package/dist/lib/{api-Cxmk8sFc.d.ts → api-Wawenasn.d.cts} +2 -2
  39. package/dist/lib/build/esbuild.cjs +6 -5
  40. package/dist/lib/build/esbuild.d.cts +4 -1
  41. package/dist/lib/build/esbuild.d.ts +4 -1
  42. package/dist/lib/build/esbuild.js +3 -2
  43. package/dist/lib/build/index.cjs +13 -12
  44. package/dist/lib/build/index.d.cts +6 -3
  45. package/dist/lib/build/index.d.ts +6 -3
  46. package/dist/lib/build/index.js +5 -4
  47. package/dist/lib/build/rolldown.d.cts +4 -1
  48. package/dist/lib/build/rolldown.d.ts +4 -1
  49. package/dist/lib/build/rollup.d.cts +4 -1
  50. package/dist/lib/build/rollup.d.ts +4 -1
  51. package/dist/lib/build/rspack.d.cts +4 -1
  52. package/dist/lib/build/rspack.d.ts +4 -1
  53. package/dist/lib/build/tsup.cjs +7 -6
  54. package/dist/lib/build/tsup.d.cts +4 -1
  55. package/dist/lib/build/tsup.d.ts +4 -1
  56. package/dist/lib/build/tsup.js +4 -3
  57. package/dist/lib/build/unbuild.d.cts +6 -3
  58. package/dist/lib/build/unbuild.d.ts +6 -3
  59. package/dist/lib/build/vite.cjs +6 -5
  60. package/dist/lib/build/vite.d.cts +4 -1
  61. package/dist/lib/build/vite.d.ts +4 -1
  62. package/dist/lib/build/vite.js +4 -3
  63. package/dist/lib/build/webpack.d.cts +4 -1
  64. package/dist/lib/build/webpack.d.ts +4 -1
  65. package/dist/lib/{chunk-UNUP4XMO.cjs → chunk-3Y4F37CB.cjs} +2 -2
  66. package/dist/lib/{chunk-Q4D2L67H.cjs → chunk-7VRXU4F7.cjs} +2 -2
  67. package/dist/lib/{chunk-N5YLKWC2.js → chunk-DYGQQI74.js} +2 -10
  68. package/dist/lib/{chunk-HM52GHX3.js → chunk-GD7KTLPU.js} +2 -2
  69. package/dist/lib/{chunk-CU23POMD.js → chunk-GLWPZDAR.js} +1 -1
  70. package/dist/lib/{chunk-HE6HOGLS.js → chunk-GSGF6RL2.js} +154 -26
  71. package/dist/lib/{chunk-4SULM54S.js → chunk-KG4HFVJU.js} +55 -44
  72. package/dist/lib/{chunk-ZDBHX3VV.cjs → chunk-LBR46BPB.cjs} +72 -35
  73. package/dist/lib/{chunk-YB54H3SQ.js → chunk-N22WOZ3U.js} +3 -1
  74. package/dist/lib/{chunk-QR2N3DPP.js → chunk-NZ6NCXM2.js} +1 -1
  75. package/dist/lib/{chunk-AFLI3CLM.js → chunk-OKXWWMEF.js} +1 -1
  76. package/dist/lib/{chunk-R3E56AJ4.cjs → chunk-OYLWPIBP.cjs} +2 -2
  77. package/dist/lib/{chunk-I76RI47U.cjs → chunk-PURLNHXG.cjs} +3 -1
  78. package/dist/lib/{chunk-N5XEKCVW.cjs → chunk-QF3UTBJE.cjs} +2 -11
  79. package/dist/lib/{chunk-QDRITYHV.cjs → chunk-R3XAVNPY.cjs} +2 -2
  80. package/dist/lib/{chunk-Z5JKSYRP.cjs → chunk-S4OH7KW6.cjs} +165 -37
  81. package/dist/lib/{chunk-YGSXCTX2.js → chunk-S6WYOXLM.js} +1 -1
  82. package/dist/lib/chunk-T35JQHYE.js +12 -0
  83. package/dist/lib/{chunk-GKCWJVF7.cjs → chunk-TWABN364.cjs} +10 -10
  84. package/dist/lib/{chunk-UJYCAW2D.cjs → chunk-V2523R33.cjs} +4 -4
  85. package/dist/lib/{chunk-KJDASLW3.js → chunk-VKFXVPY6.js} +1 -1
  86. package/dist/lib/{chunk-AJDYMANR.cjs → chunk-XBSGDSV3.cjs} +2 -2
  87. package/dist/lib/{chunk-7GCAHOJK.js → chunk-XIK3Y6BP.js} +1 -1
  88. package/dist/lib/{chunk-CP77I6WM.js → chunk-Y2DPOC4G.js} +65 -28
  89. package/dist/lib/chunk-YXJJCE6V.cjs +14 -0
  90. package/dist/lib/{chunk-4V5OI73E.cjs → chunk-Z6BSDYUR.cjs} +55 -44
  91. package/dist/lib/{config-DMXVnKGF.d.cts → config-D2dTFLlQ.d.cts} +76 -6
  92. package/dist/lib/{config-B2q8Me0M.d.ts → config-Dzk6j2mr.d.ts} +76 -6
  93. package/dist/lib/config-file.d.cts +4 -1
  94. package/dist/lib/config-file.d.ts +4 -1
  95. package/dist/lib/contexts/api-context.cjs +7 -6
  96. package/dist/lib/contexts/api-context.d.cts +7 -3
  97. package/dist/lib/contexts/api-context.d.ts +7 -3
  98. package/dist/lib/contexts/api-context.js +6 -5
  99. package/dist/lib/contexts/context.cjs +5 -4
  100. package/dist/lib/contexts/context.d.cts +64 -10
  101. package/dist/lib/contexts/context.d.ts +64 -10
  102. package/dist/lib/contexts/context.js +4 -3
  103. package/dist/lib/contexts/environment-context.cjs +6 -5
  104. package/dist/lib/contexts/environment-context.d.cts +7 -3
  105. package/dist/lib/contexts/environment-context.d.ts +7 -3
  106. package/dist/lib/contexts/environment-context.js +5 -4
  107. package/dist/lib/contexts/index.cjs +9 -8
  108. package/dist/lib/contexts/index.d.cts +7 -3
  109. package/dist/lib/contexts/index.d.ts +7 -3
  110. package/dist/lib/contexts/index.js +6 -5
  111. package/dist/lib/contexts/plugin-context.d.cts +6 -3
  112. package/dist/lib/contexts/plugin-context.d.ts +6 -3
  113. package/dist/lib/entry.cjs +10 -9
  114. package/dist/lib/entry.d.cts +4 -1
  115. package/dist/lib/entry.d.ts +4 -1
  116. package/dist/lib/entry.js +2 -1
  117. package/dist/lib/fs/index.cjs +3 -2
  118. package/dist/lib/fs/index.d.cts +4 -1
  119. package/dist/lib/fs/index.d.ts +4 -1
  120. package/dist/lib/fs/index.js +2 -1
  121. package/dist/lib/fs/vfs.cjs +3 -2
  122. package/dist/lib/fs/vfs.d.cts +4 -1
  123. package/dist/lib/fs/vfs.d.ts +4 -1
  124. package/dist/lib/fs/vfs.js +2 -1
  125. package/dist/lib/index.cjs +32 -31
  126. package/dist/lib/index.d.cts +8 -5
  127. package/dist/lib/index.d.ts +8 -5
  128. package/dist/lib/index.js +12 -11
  129. package/dist/lib/{internal-CGIi3MOX.d.ts → internal-Cgp0NF-t.d.ts} +2 -2
  130. package/dist/lib/{internal-CfIJWv8T.d.cts → internal-DC9vYMIn.d.cts} +2 -2
  131. package/dist/lib/logger.d.cts +4 -1
  132. package/dist/lib/logger.d.ts +4 -1
  133. package/dist/lib/typescript/import-transformer.d.cts +4 -1
  134. package/dist/lib/typescript/import-transformer.d.ts +4 -1
  135. package/dist/lib/typescript/index.d.cts +4 -1
  136. package/dist/lib/typescript/index.d.ts +4 -1
  137. package/dist/lib/typescript/ts-morph.d.cts +4 -1
  138. package/dist/lib/typescript/ts-morph.d.ts +4 -1
  139. package/dist/lib/unplugin/factory.cjs +8 -8
  140. package/dist/lib/unplugin/factory.d.cts +6 -3
  141. package/dist/lib/unplugin/factory.d.ts +6 -3
  142. package/dist/lib/unplugin/factory.js +7 -7
  143. package/dist/lib/unplugin/helpers.d.cts +4 -1
  144. package/dist/lib/unplugin/helpers.d.ts +4 -1
  145. package/dist/lib/unplugin/index.cjs +10 -10
  146. package/dist/lib/unplugin/index.d.cts +7 -4
  147. package/dist/lib/unplugin/index.d.ts +7 -4
  148. package/dist/lib/unplugin/index.js +8 -8
  149. package/dist/lib/unplugin/plugin.cjs +2 -2
  150. package/dist/lib/unplugin/plugin.d.cts +8 -18
  151. package/dist/lib/unplugin/plugin.d.ts +8 -18
  152. package/dist/lib/unplugin/plugin.js +1 -1
  153. package/dist/lib/{unplugin-B_F1TZK4.d.cts → unplugin-CvYjC7ZL.d.cts} +2 -2
  154. package/dist/lib/{unplugin-Da9GAj4a.d.ts → unplugin-D7lpyIpN.d.ts} +2 -2
  155. package/dist/lib/utilities/bundle.cjs +5 -4
  156. package/dist/lib/utilities/bundle.d.cts +4 -1
  157. package/dist/lib/utilities/bundle.d.ts +4 -1
  158. package/dist/lib/utilities/bundle.js +4 -3
  159. package/dist/lib/utilities/cache.d.cts +4 -1
  160. package/dist/lib/utilities/cache.d.ts +4 -1
  161. package/dist/lib/utilities/file-header.d.cts +4 -1
  162. package/dist/lib/utilities/file-header.d.ts +4 -1
  163. package/dist/lib/utilities/index.cjs +12 -11
  164. package/dist/lib/utilities/index.d.cts +4 -1
  165. package/dist/lib/utilities/index.d.ts +4 -1
  166. package/dist/lib/utilities/index.js +6 -5
  167. package/dist/lib/utilities/meta.d.cts +4 -1
  168. package/dist/lib/utilities/meta.d.ts +4 -1
  169. package/dist/lib/utilities/resolve.cjs +6 -5
  170. package/dist/lib/utilities/resolve.d.cts +4 -1
  171. package/dist/lib/utilities/resolve.d.ts +4 -1
  172. package/dist/lib/utilities/resolve.js +5 -4
  173. package/dist/lib/utilities/source-file.d.cts +4 -1
  174. package/dist/lib/utilities/source-file.d.ts +4 -1
  175. package/dist/lib/utilities/source-map.d.cts +4 -1
  176. package/dist/lib/utilities/source-map.d.ts +4 -1
  177. package/dist/lib/utilities/worker.d.cts +4 -1
  178. package/dist/lib/utilities/worker.d.ts +4 -1
  179. package/dist/lib/utilities/write-file.d.cts +4 -1
  180. package/dist/lib/utilities/write-file.d.ts +4 -1
  181. package/dist/next.cjs +4 -4
  182. package/dist/next.js +3 -3
  183. package/dist/nuxt.cjs +6 -6
  184. package/dist/nuxt.js +4 -4
  185. package/dist/plugin-utils/chunk-DCJAIIJ5.cjs +14 -0
  186. package/dist/plugin-utils/chunk-FBLNGP3S.js +12 -0
  187. package/dist/plugin-utils/context-helpers.d.cts +4 -1
  188. package/dist/plugin-utils/context-helpers.d.ts +4 -1
  189. package/dist/plugin-utils/{context-y3G_SQPM.d.cts → context-iOcgJtAf.d.cts} +75 -5
  190. package/dist/plugin-utils/{context-y3G_SQPM.d.ts → context-iOcgJtAf.d.ts} +75 -5
  191. package/dist/plugin-utils/enforce.d.cts +4 -1
  192. package/dist/plugin-utils/enforce.d.ts +4 -1
  193. package/dist/plugin-utils/extend.d.cts +4 -1
  194. package/dist/plugin-utils/extend.d.ts +4 -1
  195. package/dist/plugin-utils/get-config-path.d.cts +4 -1
  196. package/dist/plugin-utils/get-config-path.d.ts +4 -1
  197. package/dist/plugin-utils/helpers.d.cts +14 -11
  198. package/dist/plugin-utils/helpers.d.ts +14 -11
  199. package/dist/plugin-utils/index.cjs +2 -2
  200. package/dist/plugin-utils/index.d.cts +4 -1
  201. package/dist/plugin-utils/index.d.ts +4 -1
  202. package/dist/plugin-utils/index.js +1 -1
  203. package/dist/plugin-utils/merge.d.cts +4 -1
  204. package/dist/plugin-utils/merge.d.ts +4 -1
  205. package/dist/plugin-utils/paths.cjs +2 -2
  206. package/dist/plugin-utils/paths.d.cts +5 -1
  207. package/dist/plugin-utils/paths.d.ts +5 -1
  208. package/dist/plugin-utils/paths.js +1 -1
  209. package/dist/rolldown.cjs +3 -3
  210. package/dist/rolldown.d.cts +4 -1
  211. package/dist/rolldown.d.ts +4 -1
  212. package/dist/rolldown.js +2 -2
  213. package/dist/rollup.cjs +3 -3
  214. package/dist/rollup.d.cts +4 -1
  215. package/dist/rollup.d.ts +4 -1
  216. package/dist/rollup.js +2 -2
  217. package/dist/rspack.cjs +3 -3
  218. package/dist/rspack.d.cts +4 -1
  219. package/dist/rspack.d.ts +4 -1
  220. package/dist/rspack.js +2 -2
  221. package/dist/tsup.cjs +4 -4
  222. package/dist/tsup.js +3 -3
  223. package/dist/types/api.d.cts +5 -2
  224. package/dist/types/api.d.ts +5 -2
  225. package/dist/types/babel.d.cts +4 -1
  226. package/dist/types/babel.d.ts +4 -1
  227. package/dist/types/commands.d.cts +4 -1
  228. package/dist/types/commands.d.ts +4 -1
  229. package/dist/types/config.d.cts +4 -1
  230. package/dist/types/config.d.ts +4 -1
  231. package/dist/types/context.cjs +2 -2
  232. package/dist/types/context.d.cts +4 -1
  233. package/dist/types/context.d.ts +4 -1
  234. package/dist/types/context.js +1 -1
  235. package/dist/types/hooks.d.cts +4 -1
  236. package/dist/types/hooks.d.ts +4 -1
  237. package/dist/types/index.cjs +3 -3
  238. package/dist/types/index.d.cts +5 -2
  239. package/dist/types/index.d.ts +5 -2
  240. package/dist/types/index.js +2 -2
  241. package/dist/types/internal.d.cts +5 -2
  242. package/dist/types/internal.d.ts +5 -2
  243. package/dist/types/plugin.d.cts +4 -1
  244. package/dist/types/plugin.d.ts +4 -1
  245. package/dist/types/resolved.d.cts +4 -1
  246. package/dist/types/resolved.d.ts +4 -1
  247. package/dist/types/unplugin.d.cts +5 -2
  248. package/dist/types/unplugin.d.ts +5 -2
  249. package/dist/unloader.cjs +3 -3
  250. package/dist/unloader.d.cts +4 -1
  251. package/dist/unloader.d.ts +4 -1
  252. package/dist/unloader.js +2 -2
  253. package/dist/unplugin.cjs +8 -6
  254. package/dist/unplugin.d.cts +7 -17
  255. package/dist/unplugin.d.ts +7 -17
  256. package/dist/unplugin.js +6 -4
  257. package/dist/vite.cjs +6 -6
  258. package/dist/vite.d.cts +4 -1
  259. package/dist/vite.d.ts +4 -1
  260. package/dist/vite.js +3 -3
  261. package/dist/webpack.cjs +6 -6
  262. package/dist/webpack.d.cts +4 -1
  263. package/dist/webpack.d.ts +4 -1
  264. package/dist/webpack.js +3 -3
  265. package/package.json +24 -21
  266. package/dist/babel-types.d.ts +0 -292
  267. package/dist/chunk-GBIIAZH5.cjs +0 -13
  268. package/dist/chunk-QXHINXRM.js +0 -11
  269. package/dist/chunk-UWLQNNZE.cjs +0 -12
  270. package/dist/config.cjs +0 -13
  271. package/dist/config.d.cts +0 -45
  272. package/dist/config.d.ts +0 -45
  273. package/dist/config.js +0 -4
  274. package/dist/plugin-utils/chunk-K2GWRZPV.js +0 -12
  275. package/dist/plugin-utils/chunk-VWFJOPKC.cjs +0 -14
@@ -18,6 +18,7 @@ import { replacePath, replaceExtension } from '@stryke/path/replace';
18
18
  import { isError } from '@stryke/type-checks/is-error';
19
19
  import { isFunction } from '@stryke/type-checks/is-function';
20
20
  import { isNumber } from '@stryke/type-checks/is-number';
21
+ import { isObject } from '@stryke/type-checks/is-object';
21
22
  import { isPromiseLike } from '@stryke/type-checks/is-promise';
22
23
  import { isSet } from '@stryke/type-checks/is-set';
23
24
  import { isSetObject } from '@stryke/type-checks/is-set-object';
@@ -37,8 +38,6 @@ import { StormJSON } from '@stryke/json/storm-json';
37
38
  import { hasFileExtension, findFilePath, findFileName, relativePath, findFileDotExtensionSafe } from '@stryke/path/file-path-fns';
38
39
  import { titleCase } from '@stryke/string-format/title-case';
39
40
  import { existsSync, exists } from '@stryke/fs/exists';
40
- import { writeFileSync, writeFile as writeFile$1 } from '@stryke/fs/write-file';
41
- import { resolveConfig, format } from 'prettier';
42
41
  import { getWorkspaceConfig } from '@storm-software/config-tools/get-config';
43
42
  import { loadConfig } from 'c12';
44
43
  import { getEnvPaths } from '@stryke/env/get-env-paths';
@@ -47,33 +46,37 @@ import { hashDirectory } from '@stryke/hash/hash-files';
47
46
  import { murmurhash } from '@stryke/hash/murmurhash';
48
47
  import { getUnique, getUniqueBy } from '@stryke/helpers/get-unique';
49
48
  import { omit } from '@stryke/helpers/omit';
49
+ import { fetchRequest } from '@stryke/http/fetch';
50
50
  import { isAbsolutePath, isAbsolute } from '@stryke/path/is-type';
51
51
  import { isNull } from '@stryke/type-checks/is-null';
52
52
  import { isString } from '@stryke/type-checks/is-string';
53
53
  import { uuid } from '@stryke/unique-id/uuid';
54
54
  import { tsconfigPathsToRegExp, match } from 'bundle-require';
55
+ import { create } from 'flat-cache';
56
+ import { parse } from 'oxc-parser';
57
+ import { Response } from 'undici';
55
58
  import { createJiti } from 'jiti';
56
59
  import { isUndefined } from '@stryke/type-checks/is-undefined';
57
60
  import { parseTypeDefinition } from '@stryke/convert/parse-type-definition';
58
61
  import { isFile } from '@stryke/fs/is-file';
59
62
  import * as $ from '@stryke/capnp';
60
63
  import { readFileBuffer, readFileBufferSync, writeFileBuffer } from '@stryke/fs/buffer';
61
- import { correctPath, toAbsolutePath } from '@stryke/path/correct-path';
62
64
  import { isParentPath } from '@stryke/path/is-parent-path';
63
65
  import { prettyBytes } from '@stryke/string-format/pretty-bytes';
64
- import { create } from 'flat-cache';
65
66
  import { Blob } from 'node:buffer';
67
+ import { resolveConfig, format } from 'prettier';
66
68
  import { getLogFn, getLogLevel } from '@storm-software/config-tools/logger';
67
69
  import { getColor } from '@storm-software/config-tools/utilities/colors';
68
70
  import { noop } from '@stryke/helpers/noop';
71
+ import { correctPath } from '@stryke/path/correct-path';
69
72
  import { slash } from '@stryke/path/slash';
70
73
  import { readFileSync, readFile } from '@stryke/fs/read-file';
74
+ import { writeFileSync, writeFile } from '@stryke/fs/write-file';
71
75
  import { unlinkSync } from 'node:fs';
72
76
  import { unlink } from 'node:fs/promises';
73
77
  import { resolve } from 'node:path';
74
78
  import '@stryke/fs/remove-file';
75
79
  import { kebabCase } from '@stryke/string-format/kebab-case';
76
- import { isObject } from '@stryke/type-checks/is-object';
77
80
 
78
81
  function resolveModulePath(nodePath, state) {
79
82
  if (!t.isStringLiteral(nodePath.node)) {
@@ -335,7 +338,9 @@ async function callHook(context, hook, options, ...args) {
335
338
  if (!isFunction(handler)) {
336
339
  throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
337
340
  }
338
- return Promise.resolve(handler.apply(null, ...args));
341
+ return Promise.resolve(handler.apply(null, [
342
+ ...args
343
+ ]));
339
344
  }));
340
345
  } else {
341
346
  for (const handler of handlers) {
@@ -343,7 +348,9 @@ async function callHook(context, hook, options, ...args) {
343
348
  throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
344
349
  }
345
350
  if (options?.result === "first" || options?.asNextParam === false) {
346
- results.push(await Promise.resolve(handler.apply(null, ...args)));
351
+ results.push(await Promise.resolve(handler.apply(null, [
352
+ ...args
353
+ ])));
347
354
  if (options?.result === "first" && isSet(results[results.length - 1])) {
348
355
  break;
349
356
  }
@@ -355,12 +362,22 @@ async function callHook(context, hook, options, ...args) {
355
362
  sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
356
363
  }
357
364
  const result = await Promise.resolve(
358
- // eslint-disable-next-line ts/no-unsafe-call
359
- handler.apply(null, ...sequenceArgs)
365
+ // eslint-disable-next-line ts/no-unsafe-call, no-useless-call
366
+ handler.apply(null, [
367
+ ...sequenceArgs
368
+ ])
360
369
  );
361
- results = [
362
- result
363
- ];
370
+ if (result) {
371
+ if (options?.result === "last") {
372
+ results = [
373
+ result
374
+ ];
375
+ } else {
376
+ results = [
377
+ defu(result, results[0] ?? {})
378
+ ];
379
+ }
380
+ }
364
381
  }
365
382
  }
366
383
  }
@@ -526,33 +543,20 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
526
543
  };
527
544
  }
528
545
  __name(getParsedTypeScriptConfig, "getParsedTypeScriptConfig");
529
- async function writeFile(log, filepath, content, skipFormat = false) {
530
- try {
531
- if (skipFormat) {
532
- await writeFile$1(filepath, content);
533
- } else {
534
- const config = await resolveConfig(filepath);
535
- const formatted = await format(content, {
536
- ...config ?? {},
537
- filepath
538
- });
539
- await writeFile$1(filepath, formatted || "");
540
- }
541
- } catch (error) {
542
- log(LogLevelLabel.ERROR, `Failed to write file ${filepath} to disk
543
- ${error?.message ? error.message : ""}`);
544
- }
545
- }
546
- __name(writeFile, "writeFile");
547
546
 
548
547
  // src/internal/helpers/resolve-tsconfig.ts
548
+ function getTsconfigDtsPath(context) {
549
+ const dtsRelativePath = joinPaths$1(relativePath(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
550
+ return dtsRelativePath;
551
+ }
552
+ __name(getTsconfigDtsPath, "getTsconfigDtsPath");
549
553
  async function resolveTsconfigChanges(context) {
550
554
  const tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw);
551
555
  const tsconfigFilePath = getTsconfigFilePath(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
552
556
  const tsconfigJson = await readJsonFile(tsconfigFilePath);
553
557
  tsconfigJson.compilerOptions ??= {};
554
558
  if (context.config.output.dts !== false) {
555
- const dtsRelativePath = joinPaths$1(relativePath(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot), findFilePath(context.dtsPath)), findFileName(context.dtsPath));
559
+ const dtsRelativePath = getTsconfigDtsPath(context);
556
560
  if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [
557
561
  context.dtsPath,
558
562
  dtsRelativePath
@@ -594,7 +598,7 @@ async function initializeTsconfig(context) {
594
598
  context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
595
599
  context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
596
600
  context.log(LogLevelLabel.TRACE, "Writing updated TypeScript configuration (tsconfig.json) file to disk.");
597
- await writeFile(context.log, tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
601
+ await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
598
602
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
599
603
  }
600
604
  __name(initializeTsconfig, "initializeTsconfig");
@@ -643,13 +647,11 @@ async function resolveTsconfig(context) {
643
647
  `).join("\n")}
644
648
  `);
645
649
  }
646
- await writeFile(context.log, context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
650
+ await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
647
651
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
648
652
  if (!context.tsconfig) {
649
653
  throw new Error("Failed to parse the TypeScript configuration file.");
650
654
  }
651
- context.tsconfig.tsconfigJson.compilerOptions ??= {};
652
- context.tsconfig.tsconfigJson.compilerOptions.strict = false;
653
655
  }
654
656
  __name(resolveTsconfig, "resolveTsconfig");
655
657
  var DEFAULT_ENVIRONMENT = "default";
@@ -829,7 +831,7 @@ function replacePathTokens(context, path) {
829
831
  if (!path) {
830
832
  return path;
831
833
  }
832
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
834
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
833
835
  }
834
836
  __name(replacePathTokens, "replacePathTokens");
835
837
  function resolveEntryInputFile(context, typeDefinition) {
@@ -1391,7 +1393,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1391
1393
  */
1392
1394
  async set(key, value) {
1393
1395
  if (!this.options.isReadOnly) {
1394
- return writeFile$1(this.resolve(key), value);
1396
+ return writeFile(this.resolve(key), value);
1395
1397
  }
1396
1398
  }
1397
1399
  /**
@@ -1574,7 +1576,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
1574
1576
  * @returns The normalized module id.
1575
1577
  */
1576
1578
  #normalizeId(id) {
1577
- return normalizeId(id, this.#context.config.output.builtinPrefix);
1579
+ let normalized = id;
1580
+ if (isParentPath(normalized, this.#context.builtinsPath)) {
1581
+ normalized = replacePath(normalized, this.#context.builtinsPath);
1582
+ }
1583
+ return normalizeId(normalized, this.#context.config.output.builtinPrefix);
1578
1584
  }
1579
1585
  /**
1580
1586
  * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.
@@ -1583,7 +1589,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
1583
1589
  * @returns The normalized path.
1584
1590
  */
1585
1591
  #normalizePath(path) {
1586
- return normalizePath(path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
1592
+ return normalizePath(path.includes("{") || path.includes("}") ? replacePathTokens(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.output.builtinPrefix);
1587
1593
  }
1588
1594
  /**
1589
1595
  * Builds a regular expression from a string pattern for path matching.
@@ -2088,15 +2094,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2088
2094
  }
2089
2095
  }
2090
2096
  const { relativeKey, adapter } = this.#getStorage(path);
2091
- this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
2092
- const id = options?.meta?.id || this.#normalizeId(path);
2097
+ this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(code)).size)})`);
2098
+ const id = options?.meta?.id || this.#normalizeId(relativeKey);
2093
2099
  this.#metadata[id] = {
2094
2100
  variant: "normal",
2095
2101
  timestamp: Date.now(),
2096
2102
  ...options.meta ?? {}
2097
2103
  };
2098
- this.#paths[id] = this.#normalizePath(path);
2099
- this.#ids[this.#normalizePath(path)] = id;
2104
+ this.#paths[id] = this.#normalizePath(relativeKey);
2105
+ this.#ids[this.#normalizePath(relativeKey)] = id;
2100
2106
  return adapter.set(relativeKey, code);
2101
2107
  }
2102
2108
  /**
@@ -2108,15 +2114,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2108
2114
  */
2109
2115
  writeSync(path, data = "", options = {}) {
2110
2116
  const { relativeKey, adapter } = this.#getStorage(path);
2111
- this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(path)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(data)).size)})`);
2112
- const id = options?.meta?.id || this.#normalizeId(path);
2117
+ this.#log(LogLevelLabel.TRACE, `Writing ${this.#normalizePath(relativeKey)} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${prettyBytes(new Blob(toArray(data)).size)})`);
2118
+ const id = options?.meta?.id || this.#normalizeId(relativeKey);
2113
2119
  this.#metadata[id] = {
2114
2120
  variant: "normal",
2115
2121
  timestamp: Date.now(),
2116
2122
  ...options.meta ?? {}
2117
2123
  };
2118
- this.#paths[id] = this.#normalizePath(path);
2119
- this.#ids[this.#normalizePath(path)] = id;
2124
+ this.#paths[id] = this.#normalizePath(relativeKey);
2125
+ this.#ids[this.#normalizePath(relativeKey)] = id;
2120
2126
  return adapter.setSync(relativeKey, data);
2121
2127
  }
2122
2128
  /**
@@ -2149,11 +2155,15 @@ var VirtualFileSystem = class _VirtualFileSystem {
2149
2155
  * @returns A promise that resolves to the resolved module path.
2150
2156
  */
2151
2157
  async resolve(id, importer, options = {}) {
2152
- if (isAbsolutePath(id)) {
2153
- return id;
2158
+ let path = id;
2159
+ if (path.includes("{") || path.includes("}")) {
2160
+ path = replacePathTokens(this.#context, path);
2161
+ }
2162
+ if (isAbsolutePath(path)) {
2163
+ return path;
2154
2164
  }
2155
2165
  const resolverCacheKey = murmurhash({
2156
- id: this.#normalizeId(id),
2166
+ path: this.#normalizeId(path),
2157
2167
  importer,
2158
2168
  options
2159
2169
  });
@@ -2164,7 +2174,7 @@ var VirtualFileSystem = class _VirtualFileSystem {
2164
2174
  return result;
2165
2175
  }
2166
2176
  }
2167
- result = this.paths[this.#normalizeId(id)];
2177
+ result = this.paths[this.#normalizeId(path)];
2168
2178
  if (!result) {
2169
2179
  const paths = options.paths ?? [];
2170
2180
  if (importer && !paths.includes(importer)) {
@@ -2173,8 +2183,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
2173
2183
  paths.push(this.#context.workspaceConfig.workspaceRoot);
2174
2184
  paths.push(appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
2175
2185
  paths.push(appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
2176
- paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2177
- for (const combination of getResolutionCombinations(id, {
2186
+ paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2187
+ for (const combination of getResolutionCombinations(path, {
2178
2188
  paths
2179
2189
  })) {
2180
2190
  const { relativeKey, adapter } = this.#getStorage(combination);
@@ -2183,19 +2193,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
2183
2193
  break;
2184
2194
  }
2185
2195
  }
2186
- try {
2187
- result = await resolve$1(id, {
2188
- ...options,
2189
- paths
2190
- });
2191
- } catch {
2196
+ if (!result) {
2197
+ try {
2198
+ result = await resolve$1(path, {
2199
+ ...options,
2200
+ paths
2201
+ });
2202
+ } catch {
2203
+ }
2192
2204
  }
2193
2205
  }
2194
- if (result) {
2195
- result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2196
- if (!this.#context.config.skipCache) {
2197
- this.resolverCache.set(resolverCacheKey, result);
2198
- }
2206
+ if (result && !this.#context.config.skipCache) {
2207
+ this.resolverCache.set(resolverCacheKey, result);
2199
2208
  }
2200
2209
  return result;
2201
2210
  }
@@ -2216,17 +2225,21 @@ var VirtualFileSystem = class _VirtualFileSystem {
2216
2225
  * @returns The resolved module path.
2217
2226
  */
2218
2227
  resolveSync(id, importer, options = {}) {
2219
- if (isAbsolutePath(id)) {
2220
- return id;
2228
+ let path = id;
2229
+ if (path.includes("{") || path.includes("}")) {
2230
+ path = replacePathTokens(this.#context, path);
2231
+ }
2232
+ if (isAbsolutePath(path)) {
2233
+ return path;
2221
2234
  }
2222
2235
  let result;
2223
2236
  if (!this.#context.config.skipCache) {
2224
- result = this.resolverCache.get(this.#normalizeId(id));
2237
+ result = this.resolverCache.get(this.#normalizeId(path));
2225
2238
  if (result) {
2226
2239
  return result;
2227
2240
  }
2228
2241
  }
2229
- result = this.paths[this.#normalizeId(id)];
2242
+ result = this.paths[this.#normalizeId(path)];
2230
2243
  if (!result) {
2231
2244
  const paths = options.paths ?? [];
2232
2245
  if (importer && !paths.includes(importer)) {
@@ -2235,8 +2248,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
2235
2248
  paths.push(this.#context.workspaceConfig.workspaceRoot);
2236
2249
  paths.push(appendPath(this.#context.config.projectRoot, this.#context.workspaceConfig.workspaceRoot));
2237
2250
  paths.push(appendPath(this.#context.config.sourceRoot, this.#context.workspaceConfig.workspaceRoot));
2238
- paths.push(...Object.keys(this.#context.tsconfig.options.paths ?? {}).filter((tsconfigPath) => id.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig.options.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2239
- for (const combination of getResolutionCombinations(id, {
2251
+ paths.push(...Object.keys(this.#context.tsconfig?.options?.paths ?? {}).filter((tsconfigPath) => path.startsWith(tsconfigPath.replace(/\*$/, ""))).map((tsconfigPath) => this.#context.tsconfig?.options?.paths?.[tsconfigPath]).flat().filter(Boolean).map((tsconfigPath) => appendPath(tsconfigPath, this.#context.workspaceConfig.workspaceRoot)));
2252
+ for (const combination of getResolutionCombinations(path, {
2240
2253
  paths
2241
2254
  })) {
2242
2255
  const { relativeKey, adapter } = this.#getStorage(combination);
@@ -2245,18 +2258,18 @@ var VirtualFileSystem = class _VirtualFileSystem {
2245
2258
  break;
2246
2259
  }
2247
2260
  }
2248
- try {
2249
- result = resolveSync(id, {
2250
- paths
2251
- });
2252
- } catch {
2261
+ if (!result) {
2262
+ try {
2263
+ result = resolveSync(path, {
2264
+ ...options,
2265
+ paths
2266
+ });
2267
+ } catch {
2268
+ }
2253
2269
  }
2254
2270
  }
2255
- if (result) {
2256
- result = toAbsolutePath(appendPath(result, this.#context.config.projectRoot), this.#context.workspaceConfig.workspaceRoot);
2257
- if (!this.#context.config.skipCache) {
2258
- this.resolverCache.set(this.#normalizeId(id), result);
2259
- }
2271
+ if (result && !this.#context.config.skipCache) {
2272
+ this.resolverCache.set(this.#normalizeId(path), result);
2260
2273
  }
2261
2274
  return result;
2262
2275
  }
@@ -2369,7 +2382,8 @@ var PowerlinesContext = class _PowerlinesContext {
2369
2382
  #fs;
2370
2383
  #tsconfig;
2371
2384
  #program;
2372
- #resolvePatterns = [];
2385
+ #parserCache;
2386
+ #requestCache;
2373
2387
  #getConfigProps(config = {}) {
2374
2388
  return {
2375
2389
  variant: config.build?.variant,
@@ -2393,7 +2407,8 @@ var PowerlinesContext = class _PowerlinesContext {
2393
2407
  lint: config.lint,
2394
2408
  transform: config.transform,
2395
2409
  build: config.build,
2396
- framework: config.framework
2410
+ framework: config.framework,
2411
+ ...config
2397
2412
  };
2398
2413
  }
2399
2414
  /**
@@ -2441,6 +2456,10 @@ var PowerlinesContext = class _PowerlinesContext {
2441
2456
  */
2442
2457
  resolver;
2443
2458
  /**
2459
+ * The resolved configuration options
2460
+ */
2461
+ resolvePatterns = [];
2462
+ /**
2444
2463
  * Internal context fields and methods
2445
2464
  *
2446
2465
  * @internal
@@ -2472,7 +2491,7 @@ var PowerlinesContext = class _PowerlinesContext {
2472
2491
  */
2473
2492
  set tsconfig(value) {
2474
2493
  this.#tsconfig = value;
2475
- this.#resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});
2494
+ this.resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});
2476
2495
  }
2477
2496
  /**
2478
2497
  * The virtual file system interface for the project
@@ -2613,6 +2632,123 @@ var PowerlinesContext = class _PowerlinesContext {
2613
2632
  return this.#program;
2614
2633
  }
2615
2634
  /**
2635
+ * Gets the parser cache.
2636
+ */
2637
+ get parserCache() {
2638
+ if (!this.#parserCache) {
2639
+ this.#parserCache = create({
2640
+ cacheId: "parser",
2641
+ cacheDir: this.cachePath,
2642
+ ttl: 2 * 60 * 60 * 1e3,
2643
+ lruSize: 5e3,
2644
+ persistInterval: 250
2645
+ });
2646
+ }
2647
+ return this.#parserCache;
2648
+ }
2649
+ /**
2650
+ * Gets the request cache.
2651
+ */
2652
+ get requestCache() {
2653
+ if (!this.#requestCache) {
2654
+ this.#requestCache = create({
2655
+ cacheId: "http",
2656
+ cacheDir: this.cachePath,
2657
+ ttl: 5 * 60 * 1e3,
2658
+ lruSize: 5e3,
2659
+ persistInterval: 250
2660
+ });
2661
+ }
2662
+ return this.#requestCache;
2663
+ }
2664
+ /**
2665
+ * A function to perform HTTP fetch requests
2666
+ *
2667
+ * @remarks
2668
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
2669
+ *
2670
+ * @example
2671
+ * ```ts
2672
+ * const response = await context.fetch("https://api.example.com/data");
2673
+ * const data = await response.json();
2674
+ * ```
2675
+ *
2676
+ * @see https://github.com/nodejs/undici
2677
+ *
2678
+ * @param input - The URL to fetch.
2679
+ * @param options - The fetch request options.
2680
+ * @returns A promise that resolves to a response returned by the fetch.
2681
+ */
2682
+ async fetch(input, options = {}) {
2683
+ const cacheKey = murmurhash({
2684
+ input: input.toString(),
2685
+ options: JSON.stringify(options)
2686
+ });
2687
+ if (!this.config.skipCache && !options.skipCache) {
2688
+ const cached = this.requestCache.get(cacheKey);
2689
+ if (cached) {
2690
+ return new Response(cached.body, {
2691
+ status: cached.status,
2692
+ statusText: cached.statusText,
2693
+ headers: cached.headers
2694
+ });
2695
+ }
2696
+ }
2697
+ const result = await fetchRequest(input, options);
2698
+ if (!this.config.skipCache && !options.skipCache) {
2699
+ try {
2700
+ this.requestCache.set(cacheKey, {
2701
+ body: await result.text(),
2702
+ status: result.status,
2703
+ statusText: result.statusText,
2704
+ headers: Object.fromEntries(result.headers.entries())
2705
+ });
2706
+ } catch {
2707
+ }
2708
+ }
2709
+ return result;
2710
+ }
2711
+ /**
2712
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
2713
+ *
2714
+ * @remarks
2715
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
2716
+ *
2717
+ * @example
2718
+ * ```ts
2719
+ * const ast = context.parse("const x: number = 42;");
2720
+ * ```
2721
+ *
2722
+ * @see https://rollupjs.org/plugin-development/#this-parse
2723
+ * @see https://github.com/oxc/oxc
2724
+ *
2725
+ * @param code - The source code to parse.
2726
+ * @param options - The options to pass to the parser.
2727
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
2728
+ */
2729
+ async parse(code, options = {}) {
2730
+ const cacheKey = murmurhash({
2731
+ code,
2732
+ options
2733
+ });
2734
+ let result;
2735
+ if (!this.config.skipCache) {
2736
+ result = this.parserCache.get(cacheKey);
2737
+ if (result) {
2738
+ return result;
2739
+ }
2740
+ }
2741
+ result = await parse(`source.${options.lang || "ts"}`, code, {
2742
+ ...options,
2743
+ sourceType: "module",
2744
+ showSemanticErrors: this.config.mode === "development"
2745
+ });
2746
+ if (!this.config.skipCache) {
2747
+ this.parserCache.set(cacheKey, result);
2748
+ }
2749
+ return result;
2750
+ }
2751
+ /**
2616
2752
  * A helper function to resolve modules in the Virtual File System
2617
2753
  *
2618
2754
  * @remarks
@@ -2657,7 +2793,7 @@ var PowerlinesContext = class _PowerlinesContext {
2657
2793
  };
2658
2794
  }
2659
2795
  if (this.config.build.skipNodeModulesBundle) {
2660
- if (match(moduleId, this.#resolvePatterns) || match(moduleId, this.config.build.noExternal)) {
2796
+ if (match(moduleId, this.resolvePatterns) || match(moduleId, this.config.build.noExternal)) {
2661
2797
  return void 0;
2662
2798
  }
2663
2799
  if (match(moduleId, this.config.build.external) || moduleId.startsWith("node:")) {
@@ -2851,6 +2987,26 @@ var PowerlinesContext = class _PowerlinesContext {
2851
2987
  return extendLog(this.log, name);
2852
2988
  }
2853
2989
  /**
2990
+ * Generates a checksum representing the current context state
2991
+ *
2992
+ * @param root - The root directory of the project to generate the checksum for
2993
+ * @returns A promise that resolves to a string representing the checksum
2994
+ */
2995
+ async generateChecksum(root = this.config.projectRoot) {
2996
+ this.#checksum = await hashDirectory(root, {
2997
+ ignore: [
2998
+ "node_modules",
2999
+ ".git",
3000
+ ".nx",
3001
+ ".cache",
3002
+ ".storm",
3003
+ "tmp",
3004
+ "dist"
3005
+ ]
3006
+ });
3007
+ return this.#checksum;
3008
+ }
3009
+ /**
2854
3010
  * Creates a new StormContext instance.
2855
3011
  *
2856
3012
  * @param workspaceConfig - The workspace configuration.
@@ -2872,26 +3028,6 @@ var PowerlinesContext = class _PowerlinesContext {
2872
3028
  */
2873
3029
  logFn;
2874
3030
  /**
2875
- * Generates a checksum representing the current context state
2876
- *
2877
- * @param root - The root directory of the project to generate the checksum for
2878
- * @returns A promise that resolves to a string representing the checksum
2879
- */
2880
- async generateChecksum(root = this.config.projectRoot) {
2881
- this.#checksum = await hashDirectory(root, {
2882
- ignore: [
2883
- "node_modules",
2884
- ".git",
2885
- ".nx",
2886
- ".cache",
2887
- ".storm",
2888
- "tmp",
2889
- "dist"
2890
- ]
2891
- });
2892
- return this.#checksum;
2893
- }
2894
- /**
2895
3031
  * Initialize the context with the provided configuration options
2896
3032
  *
2897
3033
  * @param config - The partial user configuration to use for initialization.
@@ -3613,9 +3749,13 @@ ${formatLogMessage(context.config)}`);
3613
3749
  let generatedTypes = await emitTypes(context, files);
3614
3750
  context.log(LogLevelLabel.TRACE, `Generating TypeScript declaration file ${context.dtsPath}.`);
3615
3751
  const directives = [];
3752
+ const asNextParam = /* @__PURE__ */ __name((previousResult) => isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
3616
3753
  let result = await this.callHook("generateTypes", {
3617
3754
  environment: context,
3618
- order: "pre"
3755
+ sequential: true,
3756
+ order: "pre",
3757
+ result: "merge",
3758
+ asNextParam
3619
3759
  }, generatedTypes);
3620
3760
  if (result) {
3621
3761
  if (isSetObject(result)) {
@@ -3629,7 +3769,10 @@ ${formatLogMessage(context.config)}`);
3629
3769
  }
3630
3770
  result = await this.callHook("generateTypes", {
3631
3771
  environment: context,
3632
- order: "normal"
3772
+ sequential: true,
3773
+ order: "normal",
3774
+ result: "merge",
3775
+ asNextParam
3633
3776
  }, generatedTypes);
3634
3777
  if (result) {
3635
3778
  if (isSetObject(result)) {
@@ -3643,7 +3786,10 @@ ${formatLogMessage(context.config)}`);
3643
3786
  }
3644
3787
  result = await this.callHook("generateTypes", {
3645
3788
  environment: context,
3646
- order: "post"
3789
+ sequential: true,
3790
+ order: "post",
3791
+ result: "merge",
3792
+ asNextParam
3647
3793
  }, generatedTypes);
3648
3794
  if (result) {
3649
3795
  if (isSetObject(result)) {
@@ -3655,15 +3801,24 @@ ${formatLogMessage(context.config)}`);
3655
3801
  generatedTypes = result;
3656
3802
  }
3657
3803
  }
3658
- await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3804
+ if (generatedTypes?.trim() || directives.length > 0) {
3805
+ await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
3659
3806
 
3660
3807
  ` : ""}${getFileHeader(context, {
3661
- directive: null,
3662
- prettierIgnore: false
3663
- })}
3808
+ directive: null,
3809
+ prettierIgnore: false
3810
+ })}
3664
3811
 
3665
3812
  ${formatTypes(generatedTypes)}
3666
3813
  `);
3814
+ } else {
3815
+ const dtsRelativePath = getTsconfigDtsPath(context);
3816
+ if (context.tsconfig.tsconfigJson.include && isIncludeMatchFound(dtsRelativePath, context.tsconfig.tsconfigJson.include)) {
3817
+ const normalizedDtsRelativePath = dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath;
3818
+ context.tsconfig.tsconfigJson.include = context.tsconfig.tsconfigJson.include.filter((includeValue) => includeValue?.toString() !== normalizedDtsRelativePath);
3819
+ await context.fs.write(context.tsconfig.tsconfigFilePath, JSON.stringify(context.tsconfig.tsconfigJson, null, 2));
3820
+ }
3821
+ }
3667
3822
  }
3668
3823
  context.tsconfig = getParsedTypeScriptConfig(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.tsconfig);
3669
3824
  if (!context.tsconfig) {
@@ -3700,7 +3855,7 @@ ${formatTypes(generatedTypes)}
3700
3855
  for (const file of files) {
3701
3856
  context.log(LogLevelLabel.TRACE, `Adding template file: ${file}`);
3702
3857
  const template = Handlebars.compile(file);
3703
- await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3858
+ await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3704
3859
  }
3705
3860
  await this.callHook("new", {
3706
3861
  environment: context,
@@ -3711,14 +3866,14 @@ ${formatTypes(generatedTypes)}
3711
3866
  for (const file of files2) {
3712
3867
  context.log(LogLevelLabel.TRACE, `Adding application template file: ${file}`);
3713
3868
  const template = Handlebars.compile(file);
3714
- await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3869
+ await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3715
3870
  }
3716
3871
  } else {
3717
3872
  const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/library/**/*.hbs"));
3718
3873
  for (const file of files2) {
3719
3874
  context.log(LogLevelLabel.TRACE, `Adding library template file: ${file}`);
3720
3875
  const template = Handlebars.compile(file);
3721
- await writeFile(context.log, joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3876
+ await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
3722
3877
  }
3723
3878
  }
3724
3879
  await this.callHook("new", {
@@ -4075,5 +4230,5 @@ Note: Please ensure the plugin package's default export is a class that extends
4075
4230
  };
4076
4231
 
4077
4232
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId, createLog, extendLog };
4078
- //# sourceMappingURL=chunk-2DWFEC7G.js.map
4079
- //# sourceMappingURL=chunk-2DWFEC7G.js.map
4233
+ //# sourceMappingURL=chunk-QRE6JMCD.js.map
4234
+ //# sourceMappingURL=chunk-QRE6JMCD.js.map