powerlines 0.23.2 → 0.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/api--9pVSIbm.d.cts +168 -0
  2. package/dist/api-DxPACGY4.d.ts +168 -0
  3. package/dist/api.cjs +3 -3
  4. package/dist/api.d.cts +16 -7
  5. package/dist/api.d.ts +16 -7
  6. package/dist/api.js +2 -2
  7. package/dist/astro.cjs +8 -8
  8. package/dist/astro.d.cts +3 -5
  9. package/dist/astro.d.ts +3 -5
  10. package/dist/astro.js +5 -5
  11. package/dist/{chunk-ZFO3FUM4.cjs → chunk-2FLICTDF.cjs} +2 -2
  12. package/dist/{chunk-JAJ4CI2F.cjs → chunk-3OQXZ5MM.cjs} +2 -2
  13. package/dist/{chunk-KFRKOIP3.js → chunk-5B6P2VUG.js} +1 -1
  14. package/dist/{chunk-GNNF5SG6.cjs → chunk-6ACGI52O.cjs} +2 -2
  15. package/dist/{chunk-JZAQW55G.cjs → chunk-AF5VNWZD.cjs} +2 -2
  16. package/dist/{chunk-J7MZRPLN.cjs → chunk-AIC2EHPW.cjs} +5 -4
  17. package/dist/{chunk-3WDMXRK6.cjs → chunk-AYKZK666.cjs} +1 -1
  18. package/dist/chunk-CHNKTBUA.cjs +32 -0
  19. package/dist/{chunk-M4QJ2474.cjs → chunk-CTSSNO5L.cjs} +4 -4
  20. package/dist/{chunk-5A7FM72H.cjs → chunk-GP6XGAJ4.cjs} +2 -2
  21. package/dist/{chunk-DUYZ3TCT.js → chunk-HLQGKQZY.js} +1 -1
  22. package/dist/{chunk-LKN52AAX.js → chunk-HNJC47JM.js} +1 -1
  23. package/dist/{chunk-IGWSCIES.js → chunk-ISLX4Z3L.js} +3 -2
  24. package/dist/{chunk-J5LKLH5Z.js → chunk-KFSVTJMR.js} +1 -1
  25. package/dist/{chunk-RWVNX2CP.js → chunk-MI3U2GAT.js} +1 -1
  26. package/dist/{chunk-4ODWTALP.js → chunk-N3F54RFW.js} +2 -2
  27. package/dist/{chunk-Q7HBETZW.js → chunk-O2WB6QZ6.js} +1 -1
  28. package/dist/{chunk-DWV5QAGZ.cjs → chunk-OEKSQ22R.cjs} +2997 -2710
  29. package/dist/{chunk-WSLPUUGZ.js → chunk-PTZB4LWS.js} +1 -1
  30. package/dist/{chunk-CPRXGMH2.js → chunk-QSNFMINQ.js} +1 -1
  31. package/dist/{chunk-YQ76DZYD.cjs → chunk-QUZ4T5AX.cjs} +2 -2
  32. package/dist/chunk-UTAJPBVT.js +29 -0
  33. package/dist/{chunk-WG55ZHJL.cjs → chunk-UW3MXOWV.cjs} +2 -2
  34. package/dist/{chunk-F6BDL4HD.js → chunk-VDBKZJV6.js} +1 -1
  35. package/dist/{chunk-J3LN5HOC.cjs → chunk-VFLCP3SA.cjs} +2 -2
  36. package/dist/{chunk-FM4ABZQ2.js → chunk-VT7NVLLU.js} +1 -1
  37. package/dist/{chunk-WDBPA4RQ.cjs → chunk-VXAKPZ3A.cjs} +2 -2
  38. package/dist/{chunk-WXU3KLBP.cjs → chunk-XOI5CY62.cjs} +2 -2
  39. package/dist/{chunk-NH7U3PTV.js → chunk-ZQ7PDXYO.js} +1 -1
  40. package/dist/{chunk-TNYZH6EG.js → chunk-ZYCPZLIG.js} +2982 -2700
  41. package/dist/config.d.cts +3 -5
  42. package/dist/config.d.ts +3 -5
  43. package/dist/esbuild.cjs +7 -7
  44. package/dist/esbuild.d.cts +3 -5
  45. package/dist/esbuild.d.ts +3 -5
  46. package/dist/esbuild.js +4 -4
  47. package/dist/farm.cjs +4 -4
  48. package/dist/farm.d.cts +3 -5
  49. package/dist/farm.d.ts +3 -5
  50. package/dist/farm.js +3 -3
  51. package/dist/index.cjs +54 -33
  52. package/dist/index.d.cts +191 -39
  53. package/dist/index.d.ts +191 -39
  54. package/dist/index.js +18 -17
  55. package/dist/lib/api-B6hfFxVS.d.ts +167 -0
  56. package/dist/lib/api-CD2QlMig.d.cts +167 -0
  57. package/dist/lib/build/esbuild.d.cts +2 -4
  58. package/dist/lib/build/esbuild.d.ts +2 -4
  59. package/dist/lib/build/index.d.cts +4 -5
  60. package/dist/lib/build/index.d.ts +4 -5
  61. package/dist/lib/build/rolldown.d.cts +2 -4
  62. package/dist/lib/build/rolldown.d.ts +2 -4
  63. package/dist/lib/build/rollup.d.cts +2 -4
  64. package/dist/lib/build/rollup.d.ts +2 -4
  65. package/dist/lib/build/rspack.d.cts +2 -4
  66. package/dist/lib/build/rspack.d.ts +2 -4
  67. package/dist/lib/build/tsup.d.cts +2 -4
  68. package/dist/lib/build/tsup.d.ts +2 -4
  69. package/dist/lib/build/unbuild.d.cts +4 -23
  70. package/dist/lib/build/unbuild.d.ts +4 -23
  71. package/dist/lib/build/vite.d.cts +2 -4
  72. package/dist/lib/build/vite.d.ts +2 -4
  73. package/dist/lib/build/webpack.d.cts +2 -4
  74. package/dist/lib/build/webpack.d.ts +2 -4
  75. package/dist/lib/chunk-32Q2PG5D.js +9 -0
  76. package/dist/lib/chunk-35FGUJFD.cjs +2 -0
  77. package/dist/lib/{chunk-LIN4KAV3.js → chunk-52VDUP5J.js} +5 -7
  78. package/dist/lib/chunk-B3EE3VHZ.cjs +127 -0
  79. package/dist/lib/{chunk-UWHGJ4JS.js → chunk-BLNW3ZQA.js} +483 -1776
  80. package/dist/lib/chunk-DX2VAXZB.cjs +11 -0
  81. package/dist/lib/{chunk-VGSV2BEL.cjs → chunk-EFYMNU53.cjs} +6 -12
  82. package/dist/lib/chunk-FBQIPNRV.cjs +146 -0
  83. package/dist/lib/chunk-FFT4PWRM.js +1 -0
  84. package/dist/lib/{chunk-L4NEN725.js → chunk-G7S5PIAC.js} +1 -1
  85. package/dist/lib/chunk-KFJCWNVG.js +120 -0
  86. package/dist/lib/chunk-M2U6XIQ2.js +144 -0
  87. package/dist/lib/chunk-MVIKYHBX.cjs +2 -0
  88. package/dist/lib/chunk-NYNHNTHT.js +1 -0
  89. package/dist/lib/{chunk-A5SB72VO.cjs → chunk-PYQADZVV.cjs} +493 -1779
  90. package/dist/lib/chunk-QP6WX3Q3.js +1190 -0
  91. package/dist/lib/chunk-S7LLEDQM.cjs +1218 -0
  92. package/dist/lib/chunk-UHGGYHSK.cjs +175 -0
  93. package/dist/lib/chunk-YNKFRPUY.js +168 -0
  94. package/dist/lib/{chunk-ULJVBW4L.cjs → chunk-ZBDVQVUK.cjs} +1 -1
  95. package/dist/lib/{config-BoGlIhnH.d.cts → config-DTSdCZsw.d.cts} +650 -633
  96. package/dist/lib/{config-CTej7RMP.d.ts → config-DeUaQYc_.d.ts} +650 -633
  97. package/dist/lib/config-file.d.cts +4 -5
  98. package/dist/lib/config-file.d.ts +4 -5
  99. package/dist/lib/contexts/api-context.cjs +18 -0
  100. package/dist/lib/contexts/api-context.d.cts +69 -0
  101. package/dist/lib/contexts/api-context.d.ts +69 -0
  102. package/dist/lib/contexts/api-context.js +9 -0
  103. package/dist/lib/contexts/context.cjs +15 -0
  104. package/dist/lib/contexts/context.d.cts +255 -0
  105. package/dist/lib/contexts/context.d.ts +255 -0
  106. package/dist/lib/contexts/context.js +6 -0
  107. package/dist/lib/contexts/environment-context.cjs +17 -0
  108. package/dist/lib/contexts/environment-context.d.cts +65 -0
  109. package/dist/lib/contexts/environment-context.d.ts +65 -0
  110. package/dist/lib/contexts/environment-context.js +8 -0
  111. package/dist/lib/contexts/index.cjs +31 -0
  112. package/dist/lib/contexts/index.d.cts +35 -0
  113. package/dist/lib/contexts/index.d.ts +35 -0
  114. package/dist/lib/contexts/index.js +10 -0
  115. package/dist/lib/contexts/plugin-context.cjs +11 -0
  116. package/dist/lib/contexts/plugin-context.d.cts +42 -0
  117. package/dist/lib/contexts/plugin-context.d.ts +42 -0
  118. package/dist/lib/contexts/plugin-context.js +2 -0
  119. package/dist/lib/entry.d.cts +2 -4
  120. package/dist/lib/entry.d.ts +2 -4
  121. package/dist/lib/index.cjs +96 -74
  122. package/dist/lib/index.d.cts +26 -23
  123. package/dist/lib/index.d.ts +26 -23
  124. package/dist/lib/index.js +18 -12
  125. package/dist/lib/internal-CpVMJCaU.d.ts +39 -0
  126. package/dist/lib/internal-ypnrUNZy.d.cts +39 -0
  127. package/dist/lib/logger.d.cts +4 -5
  128. package/dist/lib/logger.d.ts +4 -5
  129. package/dist/lib/typescript/compiler-host.cjs +1 -1
  130. package/dist/lib/typescript/compiler-host.d.cts +5 -5
  131. package/dist/lib/typescript/compiler-host.d.ts +5 -5
  132. package/dist/lib/typescript/compiler-host.js +1 -1
  133. package/dist/lib/typescript/import-transformer.d.cts +2 -4
  134. package/dist/lib/typescript/import-transformer.d.ts +2 -4
  135. package/dist/lib/typescript/index.cjs +29 -24
  136. package/dist/lib/typescript/index.d.cts +6 -6
  137. package/dist/lib/typescript/index.d.ts +6 -6
  138. package/dist/lib/typescript/index.js +3 -2
  139. package/dist/lib/typescript/isolated-decl.d.cts +2 -1
  140. package/dist/lib/typescript/isolated-decl.d.ts +2 -1
  141. package/dist/lib/typescript/program.d.cts +5 -5
  142. package/dist/lib/typescript/program.d.ts +5 -5
  143. package/dist/lib/typescript/ts-morph.cjs +11 -0
  144. package/dist/lib/{create-program.d.ts → typescript/ts-morph.d.cts} +3 -5
  145. package/dist/lib/{create-program.d.cts → typescript/ts-morph.d.ts} +3 -5
  146. package/dist/lib/typescript/ts-morph.js +2 -0
  147. package/dist/lib/unplugin/factory.cjs +8 -4
  148. package/dist/lib/unplugin/factory.d.cts +27 -10
  149. package/dist/lib/unplugin/factory.d.ts +27 -10
  150. package/dist/lib/unplugin/factory.js +7 -3
  151. package/dist/lib/unplugin/helpers.cjs +11 -0
  152. package/dist/lib/unplugin/helpers.d.cts +128 -0
  153. package/dist/lib/unplugin/helpers.d.ts +128 -0
  154. package/dist/lib/unplugin/helpers.js +2 -0
  155. package/dist/lib/unplugin/index.cjs +12 -7
  156. package/dist/lib/unplugin/index.d.cts +6 -8
  157. package/dist/lib/unplugin/index.d.ts +6 -8
  158. package/dist/lib/unplugin/index.js +9 -4
  159. package/dist/lib/unplugin/plugin.cjs +4 -3
  160. package/dist/lib/unplugin/plugin.d.cts +4 -5
  161. package/dist/lib/unplugin/plugin.d.ts +4 -5
  162. package/dist/lib/unplugin/plugin.js +3 -2
  163. package/dist/lib/unplugin/resolve-id.cjs +2 -2
  164. package/dist/lib/unplugin/resolve-id.d.cts +5 -5
  165. package/dist/lib/unplugin/resolve-id.d.ts +5 -5
  166. package/dist/lib/unplugin/resolve-id.js +1 -1
  167. package/dist/lib/utilities/bundle.d.cts +2 -4
  168. package/dist/lib/utilities/bundle.d.ts +2 -4
  169. package/dist/lib/utilities/cache.d.cts +2 -4
  170. package/dist/lib/utilities/cache.d.ts +2 -4
  171. package/dist/lib/utilities/file-header.d.cts +4 -5
  172. package/dist/lib/utilities/file-header.d.ts +4 -5
  173. package/dist/lib/utilities/index.cjs +18 -18
  174. package/dist/lib/utilities/index.d.cts +5 -7
  175. package/dist/lib/utilities/index.d.ts +5 -7
  176. package/dist/lib/utilities/index.js +4 -4
  177. package/dist/lib/utilities/meta.d.cts +4 -5
  178. package/dist/lib/utilities/meta.d.ts +4 -5
  179. package/dist/lib/utilities/resolve-path.d.cts +2 -4
  180. package/dist/lib/utilities/resolve-path.d.ts +2 -4
  181. package/dist/lib/utilities/resolve.d.cts +2 -4
  182. package/dist/lib/utilities/resolve.d.ts +2 -4
  183. package/dist/lib/utilities/source-file.d.cts +2 -4
  184. package/dist/lib/utilities/source-file.d.ts +2 -4
  185. package/dist/lib/utilities/source-map.d.cts +2 -4
  186. package/dist/lib/utilities/source-map.d.ts +2 -4
  187. package/dist/lib/utilities/worker.d.cts +4 -5
  188. package/dist/lib/utilities/worker.d.ts +4 -5
  189. package/dist/lib/utilities/write-file.d.cts +2 -4
  190. package/dist/lib/utilities/write-file.d.ts +2 -4
  191. package/dist/next.cjs +8 -8
  192. package/dist/next.js +5 -5
  193. package/dist/nuxt.cjs +9 -9
  194. package/dist/nuxt.js +6 -6
  195. package/dist/plugin-utils/{context-D1I2JQgs.d.cts → context-DRFZE3XI.d.cts} +535 -518
  196. package/dist/plugin-utils/{context-D1I2JQgs.d.ts → context-DRFZE3XI.d.ts} +535 -518
  197. package/dist/plugin-utils/context-helpers.d.cts +2 -4
  198. package/dist/plugin-utils/context-helpers.d.ts +2 -4
  199. package/dist/plugin-utils/enforce.d.cts +2 -4
  200. package/dist/plugin-utils/enforce.d.ts +2 -4
  201. package/dist/plugin-utils/extend.d.cts +2 -4
  202. package/dist/plugin-utils/extend.d.ts +2 -4
  203. package/dist/plugin-utils/get-config-path.d.cts +2 -4
  204. package/dist/plugin-utils/get-config-path.d.ts +2 -4
  205. package/dist/plugin-utils/helpers.d.cts +2 -4
  206. package/dist/plugin-utils/helpers.d.ts +2 -4
  207. package/dist/plugin-utils/index.d.cts +3 -5
  208. package/dist/plugin-utils/index.d.ts +3 -5
  209. package/dist/plugin-utils/merge.d.cts +4 -5
  210. package/dist/plugin-utils/merge.d.ts +4 -5
  211. package/dist/plugin-utils/paths.d.cts +2 -4
  212. package/dist/plugin-utils/paths.d.ts +2 -4
  213. package/dist/{resolved-DYLxPDut.d.cts → resolved-C00CJgsk.d.cts} +128 -9
  214. package/dist/{resolved-D1ySEdUv.d.ts → resolved-DKFZ11S7.d.ts} +128 -9
  215. package/dist/rolldown.cjs +7 -7
  216. package/dist/rolldown.d.cts +3 -5
  217. package/dist/rolldown.d.ts +3 -5
  218. package/dist/rolldown.js +4 -4
  219. package/dist/rollup.cjs +7 -7
  220. package/dist/rollup.d.cts +3 -5
  221. package/dist/rollup.d.ts +3 -5
  222. package/dist/rollup.js +4 -4
  223. package/dist/rspack.cjs +7 -7
  224. package/dist/rspack.d.cts +3 -5
  225. package/dist/rspack.d.ts +3 -5
  226. package/dist/rspack.js +4 -4
  227. package/dist/tsup.cjs +8 -8
  228. package/dist/tsup.js +5 -5
  229. package/dist/types/api.cjs +4 -0
  230. package/dist/types/api.d.cts +36 -0
  231. package/dist/types/api.d.ts +36 -0
  232. package/dist/types/api.js +1 -0
  233. package/dist/types/babel.d.cts +3 -5
  234. package/dist/types/babel.d.ts +3 -5
  235. package/dist/types/build.d.cts +26 -1
  236. package/dist/types/build.d.ts +26 -1
  237. package/dist/types/commands.d.cts +3 -5
  238. package/dist/types/commands.d.ts +3 -5
  239. package/dist/types/config.d.cts +3 -5
  240. package/dist/types/config.d.ts +3 -5
  241. package/dist/types/context.d.cts +3 -5
  242. package/dist/types/context.d.ts +3 -5
  243. package/dist/types/{vfs.cjs → fs.cjs} +3 -3
  244. package/dist/types/{vfs.d.cts → fs.d.cts} +54 -35
  245. package/dist/types/{vfs.d.ts → fs.d.ts} +54 -35
  246. package/dist/types/fs.js +2 -0
  247. package/dist/types/hooks.d.cts +3 -5
  248. package/dist/types/hooks.d.ts +3 -5
  249. package/dist/types/index.cjs +9 -8
  250. package/dist/types/index.d.cts +8 -9
  251. package/dist/types/index.d.ts +8 -9
  252. package/dist/types/index.js +3 -2
  253. package/dist/types/internal.d.cts +46 -9
  254. package/dist/types/internal.d.ts +46 -9
  255. package/dist/types/plugin.d.cts +3 -5
  256. package/dist/types/plugin.d.ts +3 -5
  257. package/dist/types/resolved.d.cts +3 -5
  258. package/dist/types/resolved.d.ts +3 -5
  259. package/dist/types/tsconfig.d.cts +8 -1
  260. package/dist/types/tsconfig.d.ts +8 -1
  261. package/dist/types/typedoc.d.cts +3 -1
  262. package/dist/types/typedoc.d.ts +3 -1
  263. package/dist/types/unplugin.d.cts +22 -11
  264. package/dist/types/unplugin.d.ts +22 -11
  265. package/dist/unloader.cjs +7 -7
  266. package/dist/unloader.d.cts +12 -14
  267. package/dist/unloader.d.ts +12 -14
  268. package/dist/unloader.js +4 -4
  269. package/dist/unplugin.cjs +18 -18
  270. package/dist/unplugin.d.cts +6 -9
  271. package/dist/unplugin.d.ts +6 -9
  272. package/dist/unplugin.js +15 -15
  273. package/dist/vite.cjs +7 -7
  274. package/dist/vite.d.cts +3 -5
  275. package/dist/vite.d.ts +3 -5
  276. package/dist/vite.js +4 -4
  277. package/dist/webpack.cjs +7 -7
  278. package/dist/webpack.d.cts +3 -5
  279. package/dist/webpack.d.ts +3 -5
  280. package/dist/webpack.js +4 -4
  281. package/package.json +39 -11
  282. package/schemas/fs.capnp +73 -15
  283. package/dist/chunk-RODEAGIJ.cjs +0 -32
  284. package/dist/chunk-SKLSRHBU.js +0 -29
  285. package/dist/hooks-D2UGCryi.d.ts +0 -28
  286. package/dist/hooks-DJG3B-Hw.d.cts +0 -28
  287. package/dist/lib/create-program.cjs +0 -11
  288. package/dist/lib/create-program.js +0 -2
  289. package/dist/lib/hooks-CDLPWf7j.d.cts +0 -28
  290. package/dist/lib/hooks-Cn-IqwYp.d.ts +0 -28
  291. package/dist/types/vfs.js +0 -2
  292. /package/dist/{chunk-KIKTWMI3.cjs → chunk-2NCILNCH.cjs} +0 -0
  293. /package/dist/{chunk-XVLT2RQ2.js → chunk-BLNT5INX.js} +0 -0
  294. /package/dist/{lib/chunk-RJ4277VZ.cjs → chunk-GRU7B3QM.cjs} +0 -0
  295. /package/dist/{lib/chunk-ZBLDAREE.js → chunk-T2P533I5.js} +0 -0
  296. /package/dist/lib/{chunk-CGYAL3S2.cjs → chunk-4EIXDLFP.cjs} +0 -0
  297. /package/dist/lib/{chunk-CXRSMYEX.js → chunk-RD5AUWXN.js} +0 -0
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
4
+ var defu = require('defu');
5
+
6
+ function combineContexts(context, unplugin) {
7
+ return defu.defu(context, unplugin);
8
+ }
9
+ chunkUSNT2KNT_cjs.__name(combineContexts, "combineContexts");
10
+
11
+ exports.combineContexts = combineContexts;
@@ -1,19 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkULJVBW4L_cjs = require('./chunk-ULJVBW4L.cjs');
3
+ var chunkDX2VAXZB_cjs = require('./chunk-DX2VAXZB.cjs');
4
+ var chunkZBDVQVUK_cjs = require('./chunk-ZBDVQVUK.cjs');
4
5
  var chunkJA4HSQRN_cjs = require('./chunk-JA4HSQRN.cjs');
5
6
  var chunk3OCI4TH7_cjs = require('./chunk-3OCI4TH7.cjs');
6
7
  var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
7
8
  var types = require('@storm-software/config-tools/types');
8
- var omit = require('@stryke/helpers/omit');
9
9
  var filePathFns = require('@stryke/path/file-path-fns');
10
10
  var replace = require('@stryke/path/replace');
11
11
  var isString = require('@stryke/type-checks/is-string');
12
- var defu = require('defu');
13
-
14
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
-
16
- var defu__default = /*#__PURE__*/_interopDefault(defu);
17
12
 
18
13
  function createUnplugin(context, options = {}) {
19
14
  const ctx = context;
@@ -48,7 +43,7 @@ function createUnplugin(context, options = {}) {
48
43
  if (result) {
49
44
  return result;
50
45
  }
51
- result = await chunkULJVBW4L_cjs.handleResolveId(ctx, {
46
+ result = await chunkZBDVQVUK_cjs.handleResolveId(ctx, {
52
47
  id,
53
48
  importer,
54
49
  options: opts
@@ -74,7 +69,7 @@ function createUnplugin(context, options = {}) {
74
69
  entry.output ||= entry.output?.replace(filePathFns.findFileName(entry.output, {
75
70
  withExtension: true
76
71
  }), entry.file);
77
- await ctx.writeEntry(`
72
+ await ctx.emitEntry(`
78
73
  ${ctx.config.build.polyfill.map((p) => `import "${p}";`).join("\n")}
79
74
 
80
75
  export * from "${isString.isString(resolved) ? resolved : resolved.id}";
@@ -120,9 +115,7 @@ export * from "${isString.isString(resolved) ? resolved : resolved.id}";
120
115
  async function transform(code, id) {
121
116
  let transformed = code;
122
117
  for (const handler of ctx.$$internal.environment.selectHooks("transform")) {
123
- const result = await handler.apply(defu__default.default(ctx, omit.omit(this, [
124
- "parse"
125
- ])), [
118
+ const result = await handler.apply(chunkDX2VAXZB_cjs.combineContexts(ctx, this), [
126
119
  chunk3OCI4TH7_cjs.getString(transformed),
127
120
  id
128
121
  ]);
@@ -149,6 +142,7 @@ export * from "${isString.isString(resolved) ? resolved : resolved.id}";
149
142
  chunkUSNT2KNT_cjs.__name(writeBundle, "writeBundle");
150
143
  return {
151
144
  name: "powerlines",
145
+ api: ctx.$$internal.api,
152
146
  resolveId: {
153
147
  filter: {
154
148
  id: {
@@ -0,0 +1,146 @@
1
+ 'use strict';
2
+
3
+ var chunkB3EE3VHZ_cjs = require('./chunk-B3EE3VHZ.cjs');
4
+ var chunkPYQADZVV_cjs = require('./chunk-PYQADZVV.cjs');
5
+ var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
6
+ var resolve = require('@stryke/fs/resolve');
7
+ var isFunction = require('@stryke/type-checks/is-function');
8
+ var isObject = require('@stryke/type-checks/is-object');
9
+
10
+ // src/types/plugin.ts
11
+ var PLUGIN_NON_HOOK_FIELDS = [
12
+ "name",
13
+ "enforce",
14
+ "dedupe",
15
+ "dependsOn",
16
+ "applyToEnvironment"
17
+ ];
18
+
19
+ // src/lib/contexts/environment-context.ts
20
+ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends chunkPYQADZVV_cjs.PowerlinesContext {
21
+ static {
22
+ chunkUSNT2KNT_cjs.__name(this, "PowerlinesEnvironmentContext");
23
+ }
24
+ /**
25
+ * The hooks registered by plugins in this environment
26
+ */
27
+ #hooks = {};
28
+ /**
29
+ * Create a new Storm context from the workspace root and user config.
30
+ *
31
+ * @param workspaceConfig - The root directory of the workspace.
32
+ * @param config - The user configuration options.
33
+ * @returns A promise that resolves to the new context.
34
+ */
35
+ static async fromConfig(workspaceConfig, config) {
36
+ const context = new _PowerlinesEnvironmentContext(config, workspaceConfig);
37
+ await context.init();
38
+ context.powerlinesPath = await resolve.resolvePackage("powerlines");
39
+ if (!context.powerlinesPath) {
40
+ throw new Error("Could not resolve `powerlines` package location.");
41
+ }
42
+ return context;
43
+ }
44
+ /**
45
+ * The resolved environment configuration
46
+ */
47
+ environment;
48
+ /**
49
+ * The list of plugins applied to this environment
50
+ */
51
+ plugins = [];
52
+ /**
53
+ * The resolved configuration options
54
+ */
55
+ get config() {
56
+ return super.config;
57
+ }
58
+ get hooks() {
59
+ return this.#hooks;
60
+ }
61
+ async addPlugin(plugin) {
62
+ let resolvedPlugin = plugin;
63
+ if (plugin.applyToEnvironment) {
64
+ const result = await Promise.resolve(plugin.applyToEnvironment(this.environment));
65
+ if (!result || isObject.isObject(result) && Object.keys(result).length === 0) {
66
+ return;
67
+ }
68
+ resolvedPlugin = chunkPYQADZVV_cjs.isPlugin(result) ? result : plugin;
69
+ }
70
+ const context = chunkB3EE3VHZ_cjs.createPluginContext(resolvedPlugin, this);
71
+ this.plugins.push({
72
+ plugin: resolvedPlugin,
73
+ context
74
+ });
75
+ this.#hooks = Object.keys(resolvedPlugin).filter((key) => !PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
76
+ const hook = key;
77
+ const pluginHook = resolvedPlugin[hook];
78
+ if (!chunkPYQADZVV_cjs.isPluginHook(pluginHook)) {
79
+ return ret;
80
+ }
81
+ if (!chunkPYQADZVV_cjs.isHookExternal(hook)) {
82
+ ret[hook] ??= {};
83
+ if (resolvedPlugin.enforce) {
84
+ ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];
85
+ chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${resolvedPlugin.enforce}Enforced`]);
86
+ return ret;
87
+ }
88
+ if (isFunction.isFunction(pluginHook) || !pluginHook.order) {
89
+ ret[hook].normal ??= [];
90
+ chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook].normal);
91
+ return ret;
92
+ }
93
+ ret[hook][`${pluginHook.order}Ordered`] ??= [];
94
+ chunkPYQADZVV_cjs.addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${pluginHook.order}Ordered`]);
95
+ } else {
96
+ ret[hook] ??= [];
97
+ ret[hook].push({
98
+ plugin: resolvedPlugin,
99
+ hook: chunkPYQADZVV_cjs.getHookHandler(pluginHook).bind(context)
100
+ });
101
+ }
102
+ return ret;
103
+ }, this.hooks);
104
+ }
105
+ /**
106
+ * Retrieves the hook handlers for a specific hook name
107
+ */
108
+ selectHooks(hook, options) {
109
+ const handlers = [];
110
+ if (this.hooks[hook]) {
111
+ if (!chunkPYQADZVV_cjs.isHookExternal(hook)) {
112
+ const hooks = this.hooks[hook];
113
+ if (options?.order) {
114
+ if (options?.order === "pre") {
115
+ handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
116
+ handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
117
+ } else if (options?.order === "post") {
118
+ handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
119
+ handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
120
+ } else {
121
+ handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
122
+ }
123
+ } else {
124
+ handlers.push(...this.selectHooks(hook, {
125
+ order: "pre"
126
+ }));
127
+ handlers.push(...this.selectHooks(hook, {
128
+ order: "normal"
129
+ }));
130
+ handlers.push(...this.selectHooks(hook, {
131
+ order: "post"
132
+ }));
133
+ }
134
+ } else {
135
+ handlers.push(...this.hooks[hook].map((h) => h.handler));
136
+ }
137
+ }
138
+ return handlers;
139
+ }
140
+ constructor(config, workspaceConfig) {
141
+ super(workspaceConfig);
142
+ this.resolvedConfig = config;
143
+ }
144
+ };
145
+
146
+ exports.PowerlinesEnvironmentContext = PowerlinesEnvironmentContext;
@@ -0,0 +1 @@
1
+
@@ -71,7 +71,7 @@ async function handleResolveId(context, args, options = {}) {
71
71
  args.importer
72
72
  ] : []
73
73
  });
74
- if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.variant === "builtin") {
74
+ if (match(args.id, options.noExternal) || resolvedPath && context.fs.metadata[resolvedPath]?.type === "builtin") {
75
75
  return void 0;
76
76
  }
77
77
  if (match(args.id, options.external) || args.id.startsWith("node:")) {
@@ -0,0 +1,120 @@
1
+ import { __name } from './chunk-SHUYVCID.js';
2
+ import { LogLevelLabel } from '@storm-software/config-tools/types';
3
+ import { isString } from '@stryke/type-checks/is-string';
4
+ import { isFunction } from '@stryke/type-checks/is-function';
5
+ import { isSet } from '@stryke/type-checks/is-set';
6
+ import chalk from 'chalk';
7
+ import { defu } from 'defu';
8
+
9
+ async function callHook(context, hook, options, ...args) {
10
+ const handlers = context.selectHooks(hook, options);
11
+ if (handlers.length > 0) {
12
+ context.log(LogLevelLabel.DEBUG, ` \u{1F9E9} Calling plugin hook: ${chalk.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
13
+ let results = [];
14
+ if (options?.sequential === false) {
15
+ results = await Promise.all(handlers.map(async (handler) => {
16
+ if (!isFunction(handler)) {
17
+ throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
18
+ }
19
+ return Promise.resolve(handler.apply(null, ...args));
20
+ }));
21
+ } else {
22
+ for (const handler of handlers) {
23
+ if (!isFunction(handler)) {
24
+ throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
25
+ }
26
+ results.push(await Promise.resolve(handler.apply(null, ...args)));
27
+ if (options?.result === "first" && isSet(results[results.length - 1])) {
28
+ break;
29
+ }
30
+ }
31
+ }
32
+ const definedResults = results.filter((result) => isSet(result));
33
+ if (definedResults.length > 0) {
34
+ let mergedResult = void 0;
35
+ for (const result of definedResults) {
36
+ mergedResult = defu(result, mergedResult ?? {});
37
+ }
38
+ return mergedResult;
39
+ }
40
+ }
41
+ return void 0;
42
+ }
43
+ __name(callHook, "callHook");
44
+
45
+ // src/lib/contexts/plugin-context.ts
46
+ function createPluginContext(plugin, environment) {
47
+ const normalizeMessage = /* @__PURE__ */ __name((message) => {
48
+ return isString(message) ? message : message.message;
49
+ }, "normalizeMessage");
50
+ const log = environment.extendLog(plugin.name);
51
+ const callHookFn = /* @__PURE__ */ __name(async (hook, options, ...args) => {
52
+ return callHook(environment, hook, {
53
+ sequential: true,
54
+ ...options
55
+ }, ...args);
56
+ }, "callHookFn");
57
+ return new Proxy({}, {
58
+ get(_, prop) {
59
+ if (prop === "$$internal") {
60
+ return {
61
+ ...environment.$$internal,
62
+ environment,
63
+ callHook: callHookFn
64
+ };
65
+ }
66
+ if (prop === "log" || prop === "logger") {
67
+ return log;
68
+ }
69
+ if (prop === "error") {
70
+ return (message) => {
71
+ log(LogLevelLabel.ERROR, normalizeMessage(message));
72
+ };
73
+ }
74
+ if (prop === "warn") {
75
+ return (message) => {
76
+ log(LogLevelLabel.WARN, normalizeMessage(message));
77
+ };
78
+ }
79
+ if (prop === "info") {
80
+ return (message) => {
81
+ log(LogLevelLabel.INFO, normalizeMessage(message));
82
+ };
83
+ }
84
+ if (prop === "debug") {
85
+ return (message) => {
86
+ log(LogLevelLabel.DEBUG, normalizeMessage(message));
87
+ };
88
+ }
89
+ if (prop === "trace") {
90
+ return (message) => {
91
+ log(LogLevelLabel.TRACE, normalizeMessage(message));
92
+ };
93
+ }
94
+ return environment[prop];
95
+ },
96
+ set(_, prop, value) {
97
+ if ([
98
+ "$$internal",
99
+ "environment",
100
+ "config",
101
+ "log",
102
+ "logger",
103
+ "error",
104
+ "warn",
105
+ "plugins",
106
+ "hooks",
107
+ "addPlugin",
108
+ "selectHooks"
109
+ ].includes(prop)) {
110
+ log(LogLevelLabel.WARN, `Cannot set read-only property "${String(prop)}"`);
111
+ return false;
112
+ }
113
+ environment[prop] = value;
114
+ return true;
115
+ }
116
+ });
117
+ }
118
+ __name(createPluginContext, "createPluginContext");
119
+
120
+ export { callHook, createPluginContext };
@@ -0,0 +1,144 @@
1
+ import { createPluginContext } from './chunk-KFJCWNVG.js';
2
+ import { PowerlinesContext, isPlugin, isPluginHook, isHookExternal, addPluginHook, getHookHandler } from './chunk-BLNW3ZQA.js';
3
+ import { __name } from './chunk-SHUYVCID.js';
4
+ import { resolvePackage } from '@stryke/fs/resolve';
5
+ import { isFunction } from '@stryke/type-checks/is-function';
6
+ import { isObject } from '@stryke/type-checks/is-object';
7
+
8
+ // src/types/plugin.ts
9
+ var PLUGIN_NON_HOOK_FIELDS = [
10
+ "name",
11
+ "enforce",
12
+ "dedupe",
13
+ "dependsOn",
14
+ "applyToEnvironment"
15
+ ];
16
+
17
+ // src/lib/contexts/environment-context.ts
18
+ var PowerlinesEnvironmentContext = class _PowerlinesEnvironmentContext extends PowerlinesContext {
19
+ static {
20
+ __name(this, "PowerlinesEnvironmentContext");
21
+ }
22
+ /**
23
+ * The hooks registered by plugins in this environment
24
+ */
25
+ #hooks = {};
26
+ /**
27
+ * Create a new Storm context from the workspace root and user config.
28
+ *
29
+ * @param workspaceConfig - The root directory of the workspace.
30
+ * @param config - The user configuration options.
31
+ * @returns A promise that resolves to the new context.
32
+ */
33
+ static async fromConfig(workspaceConfig, config) {
34
+ const context = new _PowerlinesEnvironmentContext(config, workspaceConfig);
35
+ await context.init();
36
+ context.powerlinesPath = await resolvePackage("powerlines");
37
+ if (!context.powerlinesPath) {
38
+ throw new Error("Could not resolve `powerlines` package location.");
39
+ }
40
+ return context;
41
+ }
42
+ /**
43
+ * The resolved environment configuration
44
+ */
45
+ environment;
46
+ /**
47
+ * The list of plugins applied to this environment
48
+ */
49
+ plugins = [];
50
+ /**
51
+ * The resolved configuration options
52
+ */
53
+ get config() {
54
+ return super.config;
55
+ }
56
+ get hooks() {
57
+ return this.#hooks;
58
+ }
59
+ async addPlugin(plugin) {
60
+ let resolvedPlugin = plugin;
61
+ if (plugin.applyToEnvironment) {
62
+ const result = await Promise.resolve(plugin.applyToEnvironment(this.environment));
63
+ if (!result || isObject(result) && Object.keys(result).length === 0) {
64
+ return;
65
+ }
66
+ resolvedPlugin = isPlugin(result) ? result : plugin;
67
+ }
68
+ const context = createPluginContext(resolvedPlugin, this);
69
+ this.plugins.push({
70
+ plugin: resolvedPlugin,
71
+ context
72
+ });
73
+ this.#hooks = Object.keys(resolvedPlugin).filter((key) => !PLUGIN_NON_HOOK_FIELDS.includes(key)).reduce((ret, key) => {
74
+ const hook = key;
75
+ const pluginHook = resolvedPlugin[hook];
76
+ if (!isPluginHook(pluginHook)) {
77
+ return ret;
78
+ }
79
+ if (!isHookExternal(hook)) {
80
+ ret[hook] ??= {};
81
+ if (resolvedPlugin.enforce) {
82
+ ret[hook][`${resolvedPlugin.enforce}Enforced`] ??= [];
83
+ addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${resolvedPlugin.enforce}Enforced`]);
84
+ return ret;
85
+ }
86
+ if (isFunction(pluginHook) || !pluginHook.order) {
87
+ ret[hook].normal ??= [];
88
+ addPluginHook(context, resolvedPlugin, pluginHook, ret[hook].normal);
89
+ return ret;
90
+ }
91
+ ret[hook][`${pluginHook.order}Ordered`] ??= [];
92
+ addPluginHook(context, resolvedPlugin, pluginHook, ret[hook][`${pluginHook.order}Ordered`]);
93
+ } else {
94
+ ret[hook] ??= [];
95
+ ret[hook].push({
96
+ plugin: resolvedPlugin,
97
+ hook: getHookHandler(pluginHook).bind(context)
98
+ });
99
+ }
100
+ return ret;
101
+ }, this.hooks);
102
+ }
103
+ /**
104
+ * Retrieves the hook handlers for a specific hook name
105
+ */
106
+ selectHooks(hook, options) {
107
+ const handlers = [];
108
+ if (this.hooks[hook]) {
109
+ if (!isHookExternal(hook)) {
110
+ const hooks = this.hooks[hook];
111
+ if (options?.order) {
112
+ if (options?.order === "pre") {
113
+ handlers.push(...(hooks.preOrdered ?? []).map((h) => h.handler));
114
+ handlers.push(...(hooks.preEnforced ?? []).map((h) => h.handler));
115
+ } else if (options?.order === "post") {
116
+ handlers.push(...(hooks.postOrdered ?? []).map((h) => h.handler));
117
+ handlers.push(...(hooks.postEnforced ?? []).map((h) => h.handler));
118
+ } else {
119
+ handlers.push(...(hooks.normal ?? []).map((h) => h.handler));
120
+ }
121
+ } else {
122
+ handlers.push(...this.selectHooks(hook, {
123
+ order: "pre"
124
+ }));
125
+ handlers.push(...this.selectHooks(hook, {
126
+ order: "normal"
127
+ }));
128
+ handlers.push(...this.selectHooks(hook, {
129
+ order: "post"
130
+ }));
131
+ }
132
+ } else {
133
+ handlers.push(...this.hooks[hook].map((h) => h.handler));
134
+ }
135
+ }
136
+ return handlers;
137
+ }
138
+ constructor(config, workspaceConfig) {
139
+ super(workspaceConfig);
140
+ this.resolvedConfig = config;
141
+ }
142
+ };
143
+
144
+ export { PowerlinesEnvironmentContext };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1 @@
1
+