powerlines 0.36.29 → 0.37.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 (323) hide show
  1. package/dist/{context-DU4oqb6r.d.cts → api-CLQePK25.d.cts} +262 -127
  2. package/dist/{context-DmCNtNIs.d.ts → api-DClrDYWk.d.ts} +262 -127
  3. package/dist/api.cjs +4 -4
  4. package/dist/api.d.cts +7 -7
  5. package/dist/api.d.ts +7 -7
  6. package/dist/api.js +3 -3
  7. package/dist/astro.cjs +6 -6
  8. package/dist/astro.d.cts +6 -5
  9. package/dist/astro.d.ts +6 -5
  10. package/dist/astro.js +5 -5
  11. package/dist/{chunk-K4ZR45W7.cjs → chunk-2ZNVD64B.cjs} +4 -4
  12. package/dist/{chunk-7IDSUDJN.js → chunk-3JGCXWAM.js} +3 -3
  13. package/dist/chunk-42ZHOCZJ.cjs +14 -0
  14. package/dist/{chunk-PZZP3VX2.cjs → chunk-4PIVB3SY.cjs} +14 -9
  15. package/dist/{chunk-ZCMOAOQN.cjs → chunk-B6DVCLP5.cjs} +8 -7
  16. package/dist/chunk-CCJQBJKQ.js +12 -0
  17. package/dist/{chunk-VZMAJMBD.js → chunk-DVJEAUGP.js} +5 -5
  18. package/dist/{chunk-3CCAN6GY.cjs → chunk-E4QAO32M.cjs} +176 -128
  19. package/dist/chunk-FON7JDQF.cjs +12 -0
  20. package/dist/{chunk-NSHXFNIL.js → chunk-IBQ5USID.js} +12 -7
  21. package/dist/{chunk-TP4FRF4H.cjs → chunk-JQDMR7OP.cjs} +2 -2
  22. package/dist/{chunk-4VQBXIAH.js → chunk-MI5E6YZI.js} +3 -3
  23. package/dist/chunk-NITQ5IYP.js +22 -0
  24. package/dist/{chunk-JMX44J5R.js → chunk-NM3AFEVI.js} +174 -128
  25. package/dist/{chunk-AJPO5EP7.js → chunk-PQXP7XQK.js} +8 -7
  26. package/dist/{chunk-OCEXXVLR.cjs → chunk-TFRZZNXL.cjs} +6 -6
  27. package/dist/{chunk-JTK4RYSG.js → chunk-U5MNJ4XF.js} +3 -3
  28. package/dist/{chunk-EXY3RCJH.js → chunk-UNIWU6XL.js} +2 -2
  29. package/dist/chunk-V5WOGN7O.cjs +25 -0
  30. package/dist/chunk-XHOP5GXJ.cjs +12 -0
  31. package/dist/esbuild.cjs +8 -8
  32. package/dist/esbuild.d.cts +6 -5
  33. package/dist/esbuild.d.ts +6 -5
  34. package/dist/esbuild.js +5 -5
  35. package/dist/farm.cjs +5 -5
  36. package/dist/farm.d.cts +6 -5
  37. package/dist/farm.d.ts +6 -5
  38. package/dist/farm.js +4 -4
  39. package/dist/index.cjs +30 -22
  40. package/dist/index.d.cts +6 -7
  41. package/dist/index.d.ts +6 -7
  42. package/dist/index.js +6 -6
  43. package/dist/lib/build/esbuild.d.cts +1 -1
  44. package/dist/lib/build/esbuild.d.ts +1 -1
  45. package/dist/lib/build/index.d.cts +2 -3
  46. package/dist/lib/build/index.d.ts +2 -3
  47. package/dist/lib/build/rolldown.d.cts +1 -1
  48. package/dist/lib/build/rolldown.d.ts +1 -1
  49. package/dist/lib/build/rollup.d.cts +1 -1
  50. package/dist/lib/build/rollup.d.ts +1 -1
  51. package/dist/lib/build/rspack.d.cts +1 -1
  52. package/dist/lib/build/rspack.d.ts +1 -1
  53. package/dist/lib/build/tsdown.d.cts +1 -1
  54. package/dist/lib/build/tsdown.d.ts +1 -1
  55. package/dist/lib/build/tsup.d.cts +1 -1
  56. package/dist/lib/build/tsup.d.ts +1 -1
  57. package/dist/lib/build/unbuild.d.cts +2 -3
  58. package/dist/lib/build/unbuild.d.ts +2 -3
  59. package/dist/lib/build/vite.d.cts +1 -1
  60. package/dist/lib/build/vite.d.ts +1 -1
  61. package/dist/lib/build/webpack.d.cts +1 -1
  62. package/dist/lib/build/webpack.d.ts +1 -1
  63. package/dist/lib/chunk-254IMO3A.js +17 -0
  64. package/dist/lib/chunk-254IMO3A.js.map +1 -0
  65. package/dist/lib/{chunk-T3VYM4BO.cjs → chunk-4QMQCXAG.cjs} +6 -6
  66. package/dist/lib/{chunk-T3VYM4BO.cjs.map → chunk-4QMQCXAG.cjs.map} +1 -1
  67. package/dist/lib/chunk-64R4MDJ7.cjs +25 -0
  68. package/dist/lib/chunk-64R4MDJ7.cjs.map +1 -0
  69. package/dist/lib/{chunk-HEMW2YZA.js → chunk-7PD2L3PS.js} +2 -2
  70. package/dist/lib/{chunk-HEMW2YZA.js.map → chunk-7PD2L3PS.js.map} +1 -1
  71. package/dist/lib/{chunk-PWKYZBQQ.js → chunk-FI4QUQV2.js} +4 -4
  72. package/dist/lib/{chunk-PWKYZBQQ.js.map → chunk-FI4QUQV2.js.map} +1 -1
  73. package/dist/lib/{chunk-3RTOKGVV.cjs → chunk-G3BXMS2V.cjs} +47 -48
  74. package/dist/lib/chunk-G3BXMS2V.cjs.map +1 -0
  75. package/dist/lib/chunk-GNEHIBN4.cjs +20 -0
  76. package/dist/lib/chunk-GNEHIBN4.cjs.map +1 -0
  77. package/dist/lib/{chunk-57WHQU5T.cjs → chunk-GZDE4GLY.cjs} +2 -2
  78. package/dist/lib/{chunk-57WHQU5T.cjs.map → chunk-GZDE4GLY.cjs.map} +1 -1
  79. package/dist/lib/chunk-HGE5DAZF.js +22 -0
  80. package/dist/lib/chunk-HGE5DAZF.js.map +1 -0
  81. package/dist/lib/{chunk-GUZKITBG.js → chunk-I7BLJZ4D.js} +5 -5
  82. package/dist/lib/chunk-I7BLJZ4D.js.map +1 -0
  83. package/dist/lib/{chunk-MZQFHBHY.cjs → chunk-QVDESIYV.cjs} +5 -5
  84. package/dist/lib/chunk-QVDESIYV.cjs.map +1 -0
  85. package/dist/lib/{chunk-POY47Z36.js → chunk-TO3SBSXL.js} +35 -36
  86. package/dist/lib/chunk-TO3SBSXL.js.map +1 -0
  87. package/dist/lib/{chunk-XAALLEOG.js → chunk-TWAVU346.js} +27 -29
  88. package/dist/lib/chunk-TWAVU346.js.map +1 -0
  89. package/dist/lib/{chunk-C7KNYLNP.cjs → chunk-UXLXQOJD.cjs} +29 -30
  90. package/dist/lib/chunk-UXLXQOJD.cjs.map +1 -0
  91. package/dist/lib/chunk-WAN5RBXY.cjs +234 -0
  92. package/dist/lib/chunk-WAN5RBXY.cjs.map +1 -0
  93. package/dist/lib/chunk-XDUEQVFC.js +232 -0
  94. package/dist/lib/chunk-XDUEQVFC.js.map +1 -0
  95. package/dist/lib/{config-BSQhtJCR.d.ts → config-BLfOgflT.d.ts} +230 -104
  96. package/dist/lib/{config-CP6f9ozu.d.cts → config-CmG_oSbS.d.cts} +230 -104
  97. package/dist/lib/config-file.d.cts +1 -1
  98. package/dist/lib/config-file.d.ts +1 -1
  99. package/dist/lib/contexts/api-context.cjs +7 -5
  100. package/dist/lib/contexts/api-context.d.cts +2 -3
  101. package/dist/lib/contexts/api-context.d.ts +2 -3
  102. package/dist/lib/contexts/api-context.js +6 -4
  103. package/dist/lib/contexts/context.cjs +3 -2
  104. package/dist/lib/contexts/context.d.cts +2 -3
  105. package/dist/lib/contexts/context.d.ts +2 -3
  106. package/dist/lib/contexts/context.js +2 -1
  107. package/dist/lib/contexts/environment-context.cjs +6 -4
  108. package/dist/lib/contexts/environment-context.d.cts +3 -4
  109. package/dist/lib/contexts/environment-context.d.ts +3 -4
  110. package/dist/lib/contexts/environment-context.js +5 -3
  111. package/dist/lib/contexts/index.cjs +10 -8
  112. package/dist/lib/contexts/index.d.cts +2 -3
  113. package/dist/lib/contexts/index.d.ts +2 -3
  114. package/dist/lib/contexts/index.js +6 -4
  115. package/dist/lib/contexts/plugin-context.cjs +2 -2
  116. package/dist/lib/contexts/plugin-context.d.cts +2 -3
  117. package/dist/lib/contexts/plugin-context.d.ts +2 -3
  118. package/dist/lib/contexts/plugin-context.js +1 -1
  119. package/dist/lib/entry.d.cts +1 -1
  120. package/dist/lib/entry.d.ts +1 -1
  121. package/dist/lib/fs/index.d.cts +1 -1
  122. package/dist/lib/fs/index.d.ts +1 -1
  123. package/dist/lib/fs/vfs.d.cts +1 -1
  124. package/dist/lib/fs/vfs.d.ts +1 -1
  125. package/dist/lib/index.cjs +22 -17
  126. package/dist/lib/index.d.cts +3 -5
  127. package/dist/lib/index.d.ts +3 -5
  128. package/dist/lib/index.js +8 -7
  129. package/dist/lib/{internal-BusfSz8D.d.ts → internal-BfGb9HLc.d.ts} +4 -3
  130. package/dist/lib/{internal-CPKLmt5v.d.cts → internal-CYMrNGHE.d.cts} +4 -3
  131. package/dist/lib/logger.d.cts +1 -1
  132. package/dist/lib/logger.d.ts +1 -1
  133. package/dist/lib/typescript/import-transformer.d.cts +1 -1
  134. package/dist/lib/typescript/import-transformer.d.ts +1 -1
  135. package/dist/lib/typescript/index.d.cts +1 -1
  136. package/dist/lib/typescript/index.d.ts +1 -1
  137. package/dist/lib/typescript/ts-morph.d.cts +1 -1
  138. package/dist/lib/typescript/ts-morph.d.ts +1 -1
  139. package/dist/lib/unplugin/factory.cjs +8 -6
  140. package/dist/lib/unplugin/factory.d.cts +4 -128
  141. package/dist/lib/unplugin/factory.d.ts +4 -128
  142. package/dist/lib/unplugin/factory.js +7 -5
  143. package/dist/lib/unplugin/helpers.cjs +7 -2
  144. package/dist/lib/unplugin/helpers.d.cts +9 -2
  145. package/dist/lib/unplugin/helpers.d.ts +9 -2
  146. package/dist/lib/unplugin/helpers.js +2 -1
  147. package/dist/lib/unplugin/index.cjs +15 -10
  148. package/dist/lib/unplugin/index.d.cts +4 -6
  149. package/dist/lib/unplugin/index.d.ts +4 -6
  150. package/dist/lib/unplugin/index.js +8 -7
  151. package/dist/lib/unplugin/plugin.cjs +4 -3
  152. package/dist/lib/unplugin/plugin.d.cts +2 -4
  153. package/dist/lib/unplugin/plugin.d.ts +2 -4
  154. package/dist/lib/unplugin/plugin.js +3 -2
  155. package/dist/lib/utilities/bundle.d.cts +1 -1
  156. package/dist/lib/utilities/bundle.d.ts +1 -1
  157. package/dist/lib/utilities/cache.d.cts +1 -1
  158. package/dist/lib/utilities/cache.d.ts +1 -1
  159. package/dist/lib/utilities/file-header.d.cts +1 -1
  160. package/dist/lib/utilities/file-header.d.ts +1 -1
  161. package/dist/lib/utilities/index.d.cts +1 -1
  162. package/dist/lib/utilities/index.d.ts +1 -1
  163. package/dist/lib/utilities/meta.d.cts +1 -1
  164. package/dist/lib/utilities/meta.d.ts +1 -1
  165. package/dist/lib/utilities/resolve.d.cts +1 -1
  166. package/dist/lib/utilities/resolve.d.ts +1 -1
  167. package/dist/lib/utilities/source-file.d.cts +1 -1
  168. package/dist/lib/utilities/source-file.d.ts +1 -1
  169. package/dist/lib/utilities/source-map.d.cts +1 -1
  170. package/dist/lib/utilities/source-map.d.ts +1 -1
  171. package/dist/lib/utilities/worker.d.cts +1 -1
  172. package/dist/lib/utilities/worker.d.ts +1 -1
  173. package/dist/lib/utilities/write-file.d.cts +1 -1
  174. package/dist/lib/utilities/write-file.d.ts +1 -1
  175. package/dist/next.cjs +6 -6
  176. package/dist/next.js +5 -5
  177. package/dist/nuxt.cjs +9 -9
  178. package/dist/nuxt.d.cts +4 -3
  179. package/dist/nuxt.d.ts +4 -3
  180. package/dist/nuxt.js +7 -7
  181. package/dist/plugin-utils/{chunk-EJ5XPAJQ.cjs → chunk-2I5L22QB.cjs} +8 -6
  182. package/dist/plugin-utils/chunk-2I5L22QB.cjs.map +1 -0
  183. package/dist/plugin-utils/{chunk-AHZPK4Z5.cjs → chunk-4FLR5DY5.cjs} +7 -7
  184. package/dist/plugin-utils/{chunk-AHZPK4Z5.cjs.map → chunk-4FLR5DY5.cjs.map} +1 -1
  185. package/dist/plugin-utils/{chunk-BWAX3NRG.cjs → chunk-6YOLE5BT.cjs} +34 -21
  186. package/dist/plugin-utils/chunk-6YOLE5BT.cjs.map +1 -0
  187. package/dist/plugin-utils/{chunk-JAG7QJDV.cjs → chunk-ARNNN4GS.cjs} +5 -5
  188. package/dist/plugin-utils/chunk-ARNNN4GS.cjs.map +1 -0
  189. package/dist/plugin-utils/{chunk-FTVPZZJO.js → chunk-I3FSMSLD.js} +32 -20
  190. package/dist/plugin-utils/chunk-I3FSMSLD.js.map +1 -0
  191. package/dist/plugin-utils/{chunk-N4IXPCGY.js → chunk-RZAQTG45.js} +3 -3
  192. package/dist/plugin-utils/{chunk-N4IXPCGY.js.map → chunk-RZAQTG45.js.map} +1 -1
  193. package/dist/plugin-utils/{chunk-JCX2UJYO.js → chunk-XDURJUGS.js} +5 -3
  194. package/dist/plugin-utils/chunk-XDURJUGS.js.map +1 -0
  195. package/dist/plugin-utils/{chunk-WZCGJ7JR.js → chunk-Z2BYI6KW.js} +3 -3
  196. package/dist/plugin-utils/chunk-Z2BYI6KW.js.map +1 -0
  197. package/dist/plugin-utils/{context-GdayEWcl.d.cts → context-BQTlTcfV.d.cts} +444 -76
  198. package/dist/plugin-utils/{context-GdayEWcl.d.ts → context-BQTlTcfV.d.ts} +444 -76
  199. package/dist/plugin-utils/context-helpers.d.cts +11 -2
  200. package/dist/plugin-utils/context-helpers.d.ts +11 -2
  201. package/dist/plugin-utils/enforce.cjs +5 -5
  202. package/dist/plugin-utils/enforce.d.cts +13 -4
  203. package/dist/plugin-utils/enforce.d.ts +13 -4
  204. package/dist/plugin-utils/enforce.js +4 -4
  205. package/dist/plugin-utils/extend.cjs +4 -4
  206. package/dist/plugin-utils/extend.d.cts +11 -2
  207. package/dist/plugin-utils/extend.d.ts +11 -2
  208. package/dist/plugin-utils/extend.js +3 -3
  209. package/dist/plugin-utils/get-config-path.d.cts +11 -2
  210. package/dist/plugin-utils/get-config-path.d.ts +11 -2
  211. package/dist/plugin-utils/helpers.cjs +25 -21
  212. package/dist/plugin-utils/helpers.d.cts +36 -32
  213. package/dist/plugin-utils/helpers.d.ts +36 -32
  214. package/dist/plugin-utils/helpers.js +1 -1
  215. package/dist/plugin-utils/index.cjs +31 -27
  216. package/dist/plugin-utils/index.d.cts +12 -3
  217. package/dist/plugin-utils/index.d.ts +12 -3
  218. package/dist/plugin-utils/index.js +4 -4
  219. package/dist/plugin-utils/merge.cjs +3 -3
  220. package/dist/plugin-utils/merge.d.cts +11 -2
  221. package/dist/plugin-utils/merge.d.ts +11 -2
  222. package/dist/plugin-utils/merge.js +2 -2
  223. package/dist/plugin-utils/paths.d.cts +11 -2
  224. package/dist/plugin-utils/paths.d.ts +11 -2
  225. package/dist/rolldown.cjs +8 -8
  226. package/dist/rolldown.d.cts +6 -5
  227. package/dist/rolldown.d.ts +6 -5
  228. package/dist/rolldown.js +5 -5
  229. package/dist/rollup.cjs +5 -5
  230. package/dist/rollup.d.cts +6 -5
  231. package/dist/rollup.d.ts +6 -5
  232. package/dist/rollup.js +4 -4
  233. package/dist/rspack.cjs +5 -5
  234. package/dist/rspack.d.cts +6 -5
  235. package/dist/rspack.d.ts +6 -5
  236. package/dist/rspack.js +4 -4
  237. package/dist/tsdown.cjs +6 -6
  238. package/dist/tsdown.js +5 -5
  239. package/dist/tsup.cjs +6 -6
  240. package/dist/tsup.js +5 -5
  241. package/dist/types/api.d.cts +5 -5
  242. package/dist/types/api.d.ts +5 -5
  243. package/dist/types/babel.d.cts +6 -5
  244. package/dist/types/babel.d.ts +6 -5
  245. package/dist/types/build.cjs +7 -3
  246. package/dist/types/build.d.cts +19 -13
  247. package/dist/types/build.d.ts +19 -13
  248. package/dist/types/build.js +1 -1
  249. package/dist/types/commands.d.cts +4 -3
  250. package/dist/types/commands.d.ts +4 -3
  251. package/dist/types/config.d.cts +3 -2
  252. package/dist/types/config.d.ts +3 -2
  253. package/dist/types/context.cjs +2 -2
  254. package/dist/types/context.d.cts +3 -2
  255. package/dist/types/context.d.ts +3 -2
  256. package/dist/types/context.js +1 -1
  257. package/dist/types/hooks.cjs +8 -1
  258. package/dist/types/hooks.d.cts +15 -14
  259. package/dist/types/hooks.d.ts +15 -14
  260. package/dist/types/hooks.js +2 -1
  261. package/dist/types/index.cjs +19 -11
  262. package/dist/types/index.d.cts +4 -5
  263. package/dist/types/index.d.ts +4 -5
  264. package/dist/types/index.js +4 -4
  265. package/dist/types/internal.d.cts +8 -6
  266. package/dist/types/internal.d.ts +8 -6
  267. package/dist/types/plugin.cjs +7 -7
  268. package/dist/types/plugin.d.cts +3 -2
  269. package/dist/types/plugin.d.ts +3 -2
  270. package/dist/types/plugin.js +2 -2
  271. package/dist/types/resolved.d.cts +2 -1
  272. package/dist/types/resolved.d.ts +2 -1
  273. package/dist/types/unplugin.d.cts +14 -39
  274. package/dist/types/unplugin.d.ts +14 -39
  275. package/dist/unloader.cjs +5 -5
  276. package/dist/unloader.d.cts +4 -3
  277. package/dist/unloader.d.ts +4 -3
  278. package/dist/unloader.js +4 -4
  279. package/dist/unplugin.cjs +17 -15
  280. package/dist/unplugin.d.cts +18 -13
  281. package/dist/unplugin.d.ts +18 -13
  282. package/dist/unplugin.js +9 -13
  283. package/dist/vite.cjs +8 -8
  284. package/dist/vite.d.cts +6 -5
  285. package/dist/vite.d.ts +6 -5
  286. package/dist/vite.js +5 -5
  287. package/dist/webpack.cjs +8 -8
  288. package/dist/webpack.d.cts +6 -5
  289. package/dist/webpack.d.ts +6 -5
  290. package/dist/webpack.js +5 -5
  291. package/package.json +7 -4
  292. package/dist/api-D0gA4eJU.d.cts +0 -142
  293. package/dist/api-cYTlb0MO.d.ts +0 -142
  294. package/dist/chunk-HJW7OH6E.js +0 -3
  295. package/dist/chunk-J7SXQCBV.cjs +0 -12
  296. package/dist/chunk-U2RJRKLT.js +0 -15
  297. package/dist/chunk-WVLFG7L6.cjs +0 -12
  298. package/dist/chunk-XOMY3USD.cjs +0 -17
  299. package/dist/chunk-XZO6ZJQP.cjs +0 -4
  300. package/dist/lib/api-BeWRTlF3.d.cts +0 -141
  301. package/dist/lib/api-C00m3GB0.d.ts +0 -141
  302. package/dist/lib/chunk-3RTOKGVV.cjs.map +0 -1
  303. package/dist/lib/chunk-A4RSMLXW.cjs +0 -13
  304. package/dist/lib/chunk-A4RSMLXW.cjs.map +0 -1
  305. package/dist/lib/chunk-C7KNYLNP.cjs.map +0 -1
  306. package/dist/lib/chunk-DLX6BNNE.cjs +0 -196
  307. package/dist/lib/chunk-DLX6BNNE.cjs.map +0 -1
  308. package/dist/lib/chunk-GUZKITBG.js.map +0 -1
  309. package/dist/lib/chunk-HDUSUF6L.js +0 -11
  310. package/dist/lib/chunk-HDUSUF6L.js.map +0 -1
  311. package/dist/lib/chunk-MZQFHBHY.cjs.map +0 -1
  312. package/dist/lib/chunk-POY47Z36.js.map +0 -1
  313. package/dist/lib/chunk-XAALLEOG.js.map +0 -1
  314. package/dist/lib/chunk-XHDL2XZB.js +0 -194
  315. package/dist/lib/chunk-XHDL2XZB.js.map +0 -1
  316. package/dist/lib/unplugin-BKtwOoMk.d.ts +0 -18
  317. package/dist/lib/unplugin-BWG1mWFO.d.cts +0 -18
  318. package/dist/plugin-utils/chunk-BWAX3NRG.cjs.map +0 -1
  319. package/dist/plugin-utils/chunk-EJ5XPAJQ.cjs.map +0 -1
  320. package/dist/plugin-utils/chunk-FTVPZZJO.js.map +0 -1
  321. package/dist/plugin-utils/chunk-JAG7QJDV.cjs.map +0 -1
  322. package/dist/plugin-utils/chunk-JCX2UJYO.js.map +0 -1
  323. package/dist/plugin-utils/chunk-WZCGJ7JR.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/build.ts","../../src/types/commands.ts","../../src/types/plugin.ts","../../src/plugin-utils/helpers.ts"],"names":["UNPLUGIN_BUILDER_VARIANTS","BUILDER_VARIANTS","SUPPORTED_COMMANDS","PLUGIN_HOOKS_FIELDS","isPlugin","value","isSetObject","isSetString","name","isUndefined","api","applyToEnvironment","isFunction","dedupe","every","hook","isPluginHookFunction","variant","isPluginConfigObject","plugin","options","isPluginConfigTuple","Array","isArray","length","isPluginConfig","item","isPluginHookObject","handler","isPluginHook","getHookHandler","pluginHook","extractPluginHook","context","undefined","normal","bind","order","isUnpluginHookKey","keys","some","startsWith","isPluginHookField","includes","isUnpluginHookField","field","checkDedupe","plugins","p","addPluginHook","hooksList","map","filter","Boolean","args","apply","push","findInvalidPluginConfig","config","invalidItems","forEach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OAAO,IAAA;AACT,EAAA;AAEA,EAAA,IAAIpC,KAAAA,CAAMC,OAAAA,CAAQmC,MAAAA,CAAAA,EAAqC;AACrD,IAAA,MAAMC,eAAyB,EAAA;AAC9BD,IAAAA,MAAAA,CAAoCE,OAAAA,CAAQlC,CAAAA,IAAAA,KAAAA;AAC3C,MAAA,MAAMmC,OAAAA,GAAUJ,wBAAkC/B,IAAAA,CAAAA;AAClD,MAAA,IAAImC,OAAAA,EAAS;AACXF,QAAAA,YAAAA,CAAaH,IAAAA,CAAI,GAAIK,OAAAA,CAAQV,GAAAA,CAAIW,CAAAA,CAAAA,KAAKC,IAAAA,CAAKC,SAAAA,CAAUF,CAAAA,EAAG,IAAA,EAAM,CAAA,CAAA,CAAA,CAAA;AAChE,MAAA;IACF,CAAA,CAAA;AAEA,IAAA,OAAOH,YAAAA,CAAanC,MAAAA,GAAS,CAAA,GAAImC,YAAAA,GAAe,IAAA;AAClD,EAAA;AAEA,EAAA,OAAO;IAACI,IAAAA,CAAKC,SAAAA,CAAUN,MAAAA,EAAQ,IAAA,EAAM,CAAA;;AACvC;AApBgBD,wBAAAA,CAAAA,uBAAAA,EAAAA,yBAAAA,CAAAA","file":"chunk-6YOLE5BT.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 type { UserConfig as ExternalFarmOptions } from \"@farmfe/core\";\nimport type { Configuration as ExternalRspackOptions } from \"@rspack/core\";\nimport type { BuildOptions as ExternalTsupOptions } from \"@storm-software/tsup/types\";\nimport type { UnbuildOptions as ExternalUnbuildOptions } from \"@storm-software/unbuild/types\";\nimport type { BuildConfig as ExternalBunOptions } from \"bun\";\nimport type { BuildOptions as ExternalESBuildOptions } from \"esbuild\";\nimport type { RolldownOptions as ExternalRolldownOptions } from \"rolldown\";\nimport type {\n RollupOptions as ExternalRollupOptions,\n OutputOptions as ExternalRollupOutputOptions\n} from \"rollup\";\nimport type { UserConfig as ExternalTsdownOptions } from \"tsdown\";\nimport type {\n DepOptimizationOptions,\n UserConfig as ExternalViteUserConfig\n} from \"vite\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\n\nexport type UnpluginBuilderVariant =\n | \"rollup\"\n | \"webpack\"\n | \"rspack\"\n | \"vite\"\n | \"esbuild\"\n | \"farm\"\n | \"unloader\"\n | \"rolldown\"\n | \"bun\";\n\nexport const UNPLUGIN_BUILDER_VARIANTS: UnpluginBuilderVariant[] = [\n \"rollup\",\n \"webpack\",\n \"rspack\",\n \"vite\",\n \"esbuild\",\n \"farm\",\n \"unloader\",\n \"rolldown\",\n \"bun\"\n] as const;\n\nexport type BuilderVariant =\n | UnpluginBuilderVariant\n | \"tsup\"\n | \"tsdown\"\n | \"unbuild\";\n\nexport const BUILDER_VARIANTS: BuilderVariant[] = [\n ...UNPLUGIN_BUILDER_VARIANTS,\n \"tsup\",\n \"tsdown\",\n \"unbuild\"\n] as const;\n\nexport type InferUnpluginVariant<TBuildVariant extends BuilderVariant> =\n TBuildVariant extends \"tsup\"\n ? \"esbuild\"\n : TBuildVariant extends \"tsdown\"\n ? \"rolldown\"\n : TBuildVariant extends \"unbuild\"\n ? \"rollup\"\n : TBuildVariant;\n\nexport interface BuildConfig {\n /**\n * The platform to build the project for\n *\n * @defaultValue \"neutral\"\n */\n platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Array of strings indicating the polyfills to include for the build.\n *\n * @remarks\n * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).\n *\n * @example\n * ```ts\n * {\n * polyfill: ['{projectRoot}/custom-polyfill.ts']\n * }\n * ```\n */\n polyfill?: string[];\n\n /**\n * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.\n *\n * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`\n */\n mainFields?: string[];\n\n /**\n * Array of strings indicating what conditions should be used for module resolution.\n */\n conditions?: string[];\n\n /**\n * Array of strings indicating what file extensions should be used for module resolution.\n *\n * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`\n */\n extensions?: string[];\n\n /**\n * Array of strings indicating what modules should be deduplicated to a single version in the build.\n *\n * @remarks\n * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.\n */\n dedupe?: string[];\n\n /**\n * Array of strings or regular expressions that indicate what modules are builtin for the environment.\n */\n builtins?: (string | RegExp)[];\n\n /**\n * Define global variable replacements.\n *\n * @remarks\n * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.\n *\n * @example\n * ```ts\n * {\n * define: {\n * __VERSION__: '\"1.0.0\"',\n * __DEV__: 'process.env.NODE_ENV !== \"production\"'\n * }\n * }\n * ```\n *\n * @see https://esbuild.github.io/api/#define\n * @see https://vitejs.dev/config/build-options.html#define\n * @see https://github.com/rollup/plugins/tree/master/packages/replace\n */\n define?: Record<string, any>;\n\n /**\n * Global variables that will have import statements injected where necessary\n *\n * @remarks\n * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.\n *\n * @example\n * ```ts\n * {\n * inject: {\n * process: 'process/browser',\n * Buffer: ['buffer', 'Buffer'],\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/inject\n */\n inject?: Record<string, string | string[]>;\n\n /**\n * The alias mappings to use for module resolution during the build process.\n *\n * @remarks\n * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.\n *\n * @example\n * ```ts\n * {\n * alias: {\n * \"@utils\": \"./src/utils\",\n * \"@components\": \"./src/components\"\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/alias\n */\n alias?:\n | Record<string, string>\n | Array<{\n find: string | RegExp;\n replacement: string;\n }>;\n\n /**\n * A list of modules that should not be bundled, even if they are external dependencies.\n *\n * @remarks\n * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.\n */\n external?: (string | RegExp)[];\n\n /**\n * A list of modules that should always be bundled, even if they are external dependencies.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * Should the Powerlines CLI processes skip bundling the `node_modules` directory?\n */\n skipNodeModulesBundle?: boolean;\n\n /**\n * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.\n *\n * @defaultValue false\n */\n keepProcessEnv?: boolean;\n\n /**\n * An optional set of override options to apply to the selected build variant.\n *\n * @remarks\n * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.\n */\n override?: Record<string, any>;\n}\n\nexport type BuildResolvedConfig = Omit<BuildConfig, \"override\">;\n\n// ESBuild\nexport type ESBuildBuildConfig = Omit<\n ExternalESBuildOptions,\n | \"entryPoints\"\n | \"sourceRoot\"\n | \"platform\"\n | \"outdir\"\n | \"env\"\n | \"assets\"\n | \"external\"\n | \"inject\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"logLevel\"\n> &\n BuildConfig;\nexport type ESBuildResolvedBuildConfig = Omit<\n ExternalESBuildOptions,\n \"inject\"\n> &\n BuildResolvedConfig;\n\n// Vite\nexport type ViteBuildConfig = Omit<\n ExternalViteUserConfig,\n | \"entry\"\n | \"entryPoints\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"environments\"\n | \"output\"\n> &\n BuildConfig & {\n /**\n * Optimize deps config\n */\n optimizeDeps?: Omit<DepOptimizationOptions, \"extensions\">;\n };\nexport type ViteResolvedBuildConfig = ExternalViteUserConfig &\n BuildResolvedConfig;\n\n// Webpack\nexport type WebpackBuildConfig = Omit<\n ExternalWebpackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type WebpackResolvedBuildConfig = ExternalWebpackOptions &\n BuildResolvedConfig;\n\n// Rspack\nexport type RspackBuildConfig = Omit<\n ExternalRspackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type RspackResolvedBuildConfig = ExternalRspackOptions &\n BuildResolvedConfig;\n\n// Rollup\nexport type RollupBuildOutputConfig = Omit<\n ExternalRollupOutputOptions,\n \"dir\" | \"format\"\n>;\nexport type RollupBuildConfig = Omit<\n ExternalRollupOptions,\n \"entry\" | \"external\" | \"input\" | \"output\" | \"logLevel\"\n> & {\n output: RollupBuildOutputConfig | RollupBuildOutputConfig[];\n} & BuildConfig;\nexport type RollupResolvedBuildConfig = ExternalRollupOptions &\n BuildResolvedConfig;\n\n// Rolldown\nexport type RolldownBuildConfig = Omit<\n ExternalRolldownOptions,\n \"input\" | \"external\" | \"tsconfig\" | \"logLevel\" | \"output\"\n> &\n BuildConfig;\nexport type RolldownResolvedBuildConfig = ExternalRolldownOptions &\n BuildResolvedConfig;\n\n// Tsup\nexport type TsupBuildConfig = Partial<\n Omit<\n ExternalTsupOptions,\n | \"userOptions\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"clean\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsupResolvedBuildConfig = ExternalTsupOptions & BuildResolvedConfig;\n\n// Tsdown\nexport type TsdownBuildConfig = Partial<\n Omit<\n ExternalTsdownOptions,\n | \"name\"\n | \"outDir\"\n | \"clean\"\n | \"cwd\"\n | \"tsconfig\"\n | \"publicDir\"\n | \"copy\"\n | \"alias\"\n | \"format\"\n | \"platform\"\n | \"env\"\n | \"define\"\n | \"entry\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsdownResolvedBuildConfig = ExternalTsdownOptions &\n BuildResolvedConfig;\n\n// Unbuild\nexport type UnbuildBuildConfig = Partial<\n Omit<\n ExternalUnbuildOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type UnbuildResolvedBuildConfig = ExternalUnbuildOptions &\n BuildResolvedConfig;\n\n// Farm\nexport type FarmBuildConfig = Partial<\n Omit<\n ExternalFarmOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type FarmResolvedBuildConfig = ExternalFarmOptions & BuildResolvedConfig;\n\n// Bun\nexport type BunBuildConfig = Partial<\n Omit<\n ExternalBunOptions,\n \"assets\" | \"platform\" | \"root\" | \"env\" | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type BunResolvedBuildConfig = ExternalBunOptions & BuildResolvedConfig;\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 { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\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 { ArrayValues } from \"@stryke/types/array\";\nimport type { AnyFunction, MaybePromise } from \"@stryke/types/base\";\nimport { LoadResult } from \"rollup\";\nimport type { ExternalIdResult, HookFilter, TransformResult } from \"unplugin\";\nimport type { BuilderVariant, UnpluginBuilderVariant } from \"./build\";\nimport { BUILDER_VARIANTS } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport { SUPPORTED_COMMANDS } 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\";\nimport { InferUnpluginOptions } from \"./unplugin\";\n\nexport interface PluginHookObject<\n THookFunction extends AnyFunction,\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 AnyFunction,\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\nexport type PluginHookFunctions<TContext extends PluginContext> = {\n [TCommandType in CommandType]: (this: TContext) => MaybePromise<void>;\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.\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<DeepPartial<TContext[\"config\"]> & Record<string, any>>;\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<LoadResult>;\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 PluginHooks<TContext extends PluginContext> = {\n [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<\n PluginHookFunctions<TContext>[TPluginHook]\n >;\n} & {\n transform: PluginHook<\n PluginHookFunctions<TContext>[\"transform\"],\n \"code\" | \"id\"\n >;\n load: PluginHook<PluginHookFunctions<TContext>[\"load\"], \"id\">;\n resolveId: PluginHook<PluginHookFunctions<TContext>[\"resolveId\"], \"id\">;\n};\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n> = Partial<PluginHooks<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<any>) => 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 /**\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<DeepPartial<TContext[\"config\"]> & Record<string, any>>\n >\n | (DeepPartial<TContext[\"config\"]> & Record<string, any>);\n} & {\n [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<\n TContext,\n TBuilderVariant\n >;\n};\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuilderVariant;\n\nexport const PLUGIN_HOOKS_FIELDS = [\n ...SUPPORTED_COMMANDS,\n \"config\",\n \"configEnvironment\",\n \"configResolved\",\n \"types\",\n \"buildStart\",\n \"buildEnd\",\n \"transform\",\n \"load\",\n \"resolveId\",\n \"writeBundle\"\n] as const;\n\nexport type PluginHookFields<TContext extends PluginContext = PluginContext> =\n keyof PluginHookFunctions<TContext>;\n\nexport const KNOWN_PLUGIN_FIELDS = [\n ...PLUGIN_NON_HOOK_FIELDS,\n ...PLUGIN_HOOKS_FIELDS,\n ...BUILDER_VARIANTS\n] as const;\n\nexport type PluginFields = ArrayValues<typeof KNOWN_PLUGIN_FIELDS>;\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 { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n BUILDER_VARIANTS,\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant\n} from \"../types/build\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../types/config\";\nimport { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport { ResolvedConfig } from \"../types/resolved\";\nimport { UnpluginOptions } from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n BUILDER_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> = TField extends PluginHookFields\n ? PluginHooksListItem<TContext, TField>[\"handler\"]\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, TField>[\"handler\"]\n : never;\n\ntype HooksListItemForField<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> =\n TField extends PluginHookFields<TContext>\n ? PluginHooksListItem<TContext, Extract<TField, PluginHookFields<TContext>>>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, Extract<TField, UnpluginBuilderVariant>>\n : never;\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TField> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TField>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n): keys is PluginHookFields<TContext> {\n return (\n !isUnpluginHookKey(keys) &&\n PLUGIN_HOOKS_FIELDS.includes(keys as PluginHookFields<TContext>)\n );\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends PluginHooksListItem<TContext, TField> = PluginHooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n) {\n if (\n !checkDedupe(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as HooksListItemForField<\n TContext,\n TField\n >[\"handler\"];\n if (!handler) {\n return;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkAHZPK4Z5_cjs = require('./chunk-AHZPK4Z5.cjs');
3
+ var chunk4FLR5DY5_cjs = require('./chunk-4FLR5DY5.cjs');
4
4
  var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
5
5
  var toArray = require('@stryke/convert/to-array');
6
6
  var isFunction = require('@stryke/type-checks/is-function');
@@ -16,12 +16,12 @@ async function enforceBuild(plugin, variant) {
16
16
  }
17
17
  };
18
18
  if (isFunction.isFunction(plugin)) {
19
- return chunkAHZPK4Z5_cjs.extend(plugin, extension);
19
+ return chunk4FLR5DY5_cjs.extend(plugin, extension);
20
20
  }
21
- return chunkAHZPK4Z5_cjs.extend(plugin, () => extension)({});
21
+ return chunk4FLR5DY5_cjs.extend(plugin, () => extension)({});
22
22
  }
23
23
  chunkPK6SKIKE_cjs.__name(enforceBuild, "enforceBuild");
24
24
 
25
25
  exports.enforceBuild = enforceBuild;
26
- //# sourceMappingURL=chunk-JAG7QJDV.cjs.map
27
- //# sourceMappingURL=chunk-JAG7QJDV.cjs.map
26
+ //# sourceMappingURL=chunk-ARNNN4GS.cjs.map
27
+ //# sourceMappingURL=chunk-ARNNN4GS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugin-utils/enforce.ts"],"names":["enforceBuild","plugin","variant","extension","configResolved","allowedVariants","toArray","currentVariant","config","build","includes","Error","Array","isArray","map","v","slice","join","isFunction","extend"],"mappings":";;;;;;;AA+CA,eAAsBA,YAAAA,CAIp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⚡ 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 { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { BuilderVariant } from \"../types/build\";\nimport { PartialPlugin, PluginFactory } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { extend } from \"./extend\";\n\n/**\n * Enforces a specific build variant for a plugin.\n *\n * @param plugin - The plugin or plugin factory to enforce the build variant on.\n * @param variant - The build variant to enforce.\n * @returns A new plugin or plugin factory that enforces the specified build variant.\n */\nexport function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n variant: TBuildVariant | TBuildVariant[]\n): Promise<Plugin<TContext>[]>;\nexport function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: PluginFactory<TContext>,\n variant: TBuildVariant | TBuildVariant[]\n): Promise<PluginFactory<TContext>>;\nexport async function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext>,\n variant: TBuildVariant | TBuildVariant[]\n) {\n const extension = {\n configResolved(this: TContext) {\n const allowedVariants = toArray<TBuildVariant>(variant);\n const currentVariant = this.config?.build?.variant as\n | TBuildVariant\n | undefined;\n\n if (!currentVariant || !allowedVariants.includes(currentVariant)) {\n throw new Error(\n `The plugin requires ${\n Array.isArray(variant)\n ? `the build variants ${variant\n .map(v => `\"${v}\"`)\n .slice(0, -1)\n .join(\", \")}, or ${variant\n .map(v => `\"${v}\"`)\n .slice(-1)\n .join(\"\")}`\n : `the build variant \"${variant}\"`\n }, but received \"${\n currentVariant ?? \"undefined\"\n }\". Please ensure the \\`build.variant\\` is set correctly in your configuration.`\n );\n }\n }\n } as PartialPlugin<TContext>;\n\n // The `extend` function has different overloads for plugin factories vs concrete\n // plugins - narrow here so TypeScript can select the correct overload.\n if (isFunction(plugin)) {\n return extend(plugin, extension);\n }\n\n return extend(plugin, () => extension)({});\n}\n"]}
@@ -5,7 +5,7 @@ import { isSetString } from '@stryke/type-checks/is-set-string';
5
5
  import { isUndefined } from '@stryke/type-checks/is-undefined';
6
6
 
7
7
  // src/types/build.ts
8
- var UNPLUGIN_BUILD_VARIANTS = [
8
+ var UNPLUGIN_BUILDER_VARIANTS = [
9
9
  "rollup",
10
10
  "webpack",
11
11
  "rspack",
@@ -13,7 +13,14 @@ var UNPLUGIN_BUILD_VARIANTS = [
13
13
  "esbuild",
14
14
  "farm",
15
15
  "unloader",
16
- "rolldown"
16
+ "rolldown",
17
+ "bun"
18
+ ];
19
+ var BUILDER_VARIANTS = [
20
+ ...UNPLUGIN_BUILDER_VARIANTS,
21
+ "tsup",
22
+ "tsdown",
23
+ "unbuild"
17
24
  ];
18
25
 
19
26
  // src/types/commands.ts
@@ -28,11 +35,12 @@ var SUPPORTED_COMMANDS = [
28
35
  "deploy",
29
36
  "finalize"
30
37
  ];
31
- var KNOWN_HOOKS = [
38
+ var PLUGIN_HOOKS_FIELDS = [
32
39
  ...SUPPORTED_COMMANDS,
33
40
  "config",
34
41
  "configEnvironment",
35
42
  "configResolved",
43
+ "types",
36
44
  "buildStart",
37
45
  "buildEnd",
38
46
  "transform",
@@ -43,7 +51,7 @@ var KNOWN_HOOKS = [
43
51
 
44
52
  // src/plugin-utils/helpers.ts
45
53
  function isPlugin(value) {
46
- return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.api) || "api" in value && isSetObject(value.api)) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && KNOWN_HOOKS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && UNPLUGIN_BUILD_VARIANTS.every((variant) => isUndefined(value[variant]) || variant in value && isSetObject(value[variant]));
54
+ return isSetObject(value) && "name" in value && isSetString(value.name) && (isUndefined(value.api) || "api" in value && isSetObject(value.api)) && (isUndefined(value.applyToEnvironment) || "applyToEnvironment" in value && isFunction(value.applyToEnvironment)) && (isUndefined(value.dedupe) || "dedupe" in value && isFunction(value.dedupe)) && PLUGIN_HOOKS_FIELDS.every((hook) => isUndefined(value[hook]) || hook in value && (isPluginHookFunction(value[hook]) || hook === "config" && isSetObject(value[hook]))) && BUILDER_VARIANTS.every((variant) => isUndefined(value[variant]) || variant in value && isSetObject(value[variant]));
47
55
  }
48
56
  __name(isPlugin, "isPlugin");
49
57
  function isPluginConfigObject(value) {
@@ -86,27 +94,31 @@ function extractPluginHook(context, plugin, hook) {
86
94
  };
87
95
  }
88
96
  __name(extractPluginHook, "extractPluginHook");
89
- function isHookExternal(hook) {
90
- return hook.startsWith("vite:") || hook.startsWith("esbuild:") || hook.startsWith("rolldown:") || hook.startsWith("rollup:") || hook.startsWith("webpack:") || hook.startsWith("rspack:") || hook.startsWith("farm:");
97
+ function isUnpluginHookKey(keys) {
98
+ return UNPLUGIN_BUILDER_VARIANTS.some((variant) => keys.startsWith(`${variant}:`));
99
+ }
100
+ __name(isUnpluginHookKey, "isUnpluginHookKey");
101
+ function isPluginHookField(keys) {
102
+ return !isUnpluginHookKey(keys) && PLUGIN_HOOKS_FIELDS.includes(keys);
91
103
  }
92
- __name(isHookExternal, "isHookExternal");
93
- function isHookInternal(hook) {
94
- return !isHookExternal(hook);
104
+ __name(isPluginHookField, "isPluginHookField");
105
+ function isUnpluginHookField(field) {
106
+ return !isPluginHookField(field) && UNPLUGIN_BUILDER_VARIANTS.includes(field);
95
107
  }
96
- __name(isHookInternal, "isHookInternal");
108
+ __name(isUnpluginHookField, "isUnpluginHookField");
97
109
  function checkDedupe(plugin, plugins) {
98
110
  return plugin.dedupe === false || plugins.some((p) => p.dedupe !== false && (isFunction(p.dedupe) && p.dedupe(plugin) || p.name === plugin.name));
99
111
  }
100
112
  __name(checkDedupe, "checkDedupe");
101
113
  function addPluginHook(context, plugin, pluginHook, hooksList) {
102
- if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin))) {
103
- hooksList.push(isFunction(pluginHook) ? {
104
- plugin,
105
- handler: getHookHandler(pluginHook).bind(context)
106
- } : {
114
+ if (!checkDedupe(plugin, hooksList.map((hook) => hook.plugin).filter(Boolean))) {
115
+ const handler = /* @__PURE__ */ __name((...args) => getHookHandler(pluginHook).apply(context, args), "handler");
116
+ if (!handler) {
117
+ return;
118
+ }
119
+ hooksList.push({
107
120
  plugin,
108
- ...pluginHook,
109
- handler: getHookHandler(pluginHook).bind(context)
121
+ handler
110
122
  });
111
123
  }
112
124
  }
@@ -131,6 +143,6 @@ function findInvalidPluginConfig(config) {
131
143
  }
132
144
  __name(findInvalidPluginConfig, "findInvalidPluginConfig");
133
145
 
134
- export { addPluginHook, checkDedupe, extractPluginHook, findInvalidPluginConfig, getHookHandler, isHookExternal, isHookInternal, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookFunction, isPluginHookObject };
135
- //# sourceMappingURL=chunk-FTVPZZJO.js.map
136
- //# sourceMappingURL=chunk-FTVPZZJO.js.map
146
+ export { addPluginHook, checkDedupe, extractPluginHook, findInvalidPluginConfig, getHookHandler, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey };
147
+ //# sourceMappingURL=chunk-I3FSMSLD.js.map
148
+ //# sourceMappingURL=chunk-I3FSMSLD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/build.ts","../../src/types/commands.ts","../../src/types/plugin.ts","../../src/plugin-utils/helpers.ts"],"names":["UNPLUGIN_BUILDER_VARIANTS","BUILDER_VARIANTS","SUPPORTED_COMMANDS","PLUGIN_HOOKS_FIELDS","isPlugin","value","isSetObject","isSetString","name","isUndefined","api","applyToEnvironment","isFunction","dedupe","every","hook","isPluginHookFunction","variant","isPluginConfigObject","plugin","options","isPluginConfigTuple","Array","isArray","length","isPluginConfig","item","isPluginHookObject","handler","isPluginHook","getHookHandler","pluginHook","extractPluginHook","context","undefined","normal","bind","order","isUnpluginHookKey","keys","some","startsWith","isPluginHookField","includes","isUnpluginHookField","field","checkDedupe","plugins","p","addPluginHook","hooksList","map","filter","Boolean","args","apply","push","findInvalidPluginConfig","config","invalidItems","forEach","invalid","i","JSON","stringify"],"mappings":";;;;;;;AA+CO,IAAMA,yBAAAA,GAAsD;AACjE,EAAA,QAAA;AACA,EAAA,SAAA;AACA,EAAA,QAAA;AACA,EAAA,MAAA;AACA,EAAA,SAAA;AACA,EAAA,MAAA;AACA,EAAA,UAAA;AACA,EAAA,UAAA;AACA,EAAA;;AASK,IAAMC,gBAAAA,GAAqC;AAC7CD,EAAAA,GAAAA,yBAAAA;AACH,EAAA,MAAA;AACA,EAAA,QAAA;AACA,EAAA;;;;AC/CK,IAAME,kBAAAA,GAAqB;AAChC,EAAA,KAAA;AACA,EAAA,OAAA;AACA,EAAA,SAAA;AACA,EAAA,MAAA;AACA,EAAA,MAAA;AACA,EAAA,OAAA;AACA,EAAA,MAAA;AACA,EAAA,QAAA;AACA,EAAA;;AC8RK,IAAMC,mBAAAA,GAAsB;AAC9BD,EAAAA,GAAAA,kBAAAA;AACH,EAAA,QAAA;AACA,EAAA,mBAAA;AACA,EAAA,gBAAA;AACA,EAAA,OAAA;AACA,EAAA,YAAA;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,CAAAA,uBAAAA,EAAAA,yBAAAA,CAAAA","file":"chunk-I3FSMSLD.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 { UserConfig as ExternalFarmOptions } from \"@farmfe/core\";\nimport type { Configuration as ExternalRspackOptions } from \"@rspack/core\";\nimport type { BuildOptions as ExternalTsupOptions } from \"@storm-software/tsup/types\";\nimport type { UnbuildOptions as ExternalUnbuildOptions } from \"@storm-software/unbuild/types\";\nimport type { BuildConfig as ExternalBunOptions } from \"bun\";\nimport type { BuildOptions as ExternalESBuildOptions } from \"esbuild\";\nimport type { RolldownOptions as ExternalRolldownOptions } from \"rolldown\";\nimport type {\n RollupOptions as ExternalRollupOptions,\n OutputOptions as ExternalRollupOutputOptions\n} from \"rollup\";\nimport type { UserConfig as ExternalTsdownOptions } from \"tsdown\";\nimport type {\n DepOptimizationOptions,\n UserConfig as ExternalViteUserConfig\n} from \"vite\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\n\nexport type UnpluginBuilderVariant =\n | \"rollup\"\n | \"webpack\"\n | \"rspack\"\n | \"vite\"\n | \"esbuild\"\n | \"farm\"\n | \"unloader\"\n | \"rolldown\"\n | \"bun\";\n\nexport const UNPLUGIN_BUILDER_VARIANTS: UnpluginBuilderVariant[] = [\n \"rollup\",\n \"webpack\",\n \"rspack\",\n \"vite\",\n \"esbuild\",\n \"farm\",\n \"unloader\",\n \"rolldown\",\n \"bun\"\n] as const;\n\nexport type BuilderVariant =\n | UnpluginBuilderVariant\n | \"tsup\"\n | \"tsdown\"\n | \"unbuild\";\n\nexport const BUILDER_VARIANTS: BuilderVariant[] = [\n ...UNPLUGIN_BUILDER_VARIANTS,\n \"tsup\",\n \"tsdown\",\n \"unbuild\"\n] as const;\n\nexport type InferUnpluginVariant<TBuildVariant extends BuilderVariant> =\n TBuildVariant extends \"tsup\"\n ? \"esbuild\"\n : TBuildVariant extends \"tsdown\"\n ? \"rolldown\"\n : TBuildVariant extends \"unbuild\"\n ? \"rollup\"\n : TBuildVariant;\n\nexport interface BuildConfig {\n /**\n * The platform to build the project for\n *\n * @defaultValue \"neutral\"\n */\n platform?: \"node\" | \"browser\" | \"neutral\";\n\n /**\n * Array of strings indicating the polyfills to include for the build.\n *\n * @remarks\n * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).\n *\n * @example\n * ```ts\n * {\n * polyfill: ['{projectRoot}/custom-polyfill.ts']\n * }\n * ```\n */\n polyfill?: string[];\n\n /**\n * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.\n *\n * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`\n */\n mainFields?: string[];\n\n /**\n * Array of strings indicating what conditions should be used for module resolution.\n */\n conditions?: string[];\n\n /**\n * Array of strings indicating what file extensions should be used for module resolution.\n *\n * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`\n */\n extensions?: string[];\n\n /**\n * Array of strings indicating what modules should be deduplicated to a single version in the build.\n *\n * @remarks\n * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.\n */\n dedupe?: string[];\n\n /**\n * Array of strings or regular expressions that indicate what modules are builtin for the environment.\n */\n builtins?: (string | RegExp)[];\n\n /**\n * Define global variable replacements.\n *\n * @remarks\n * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.\n *\n * @example\n * ```ts\n * {\n * define: {\n * __VERSION__: '\"1.0.0\"',\n * __DEV__: 'process.env.NODE_ENV !== \"production\"'\n * }\n * }\n * ```\n *\n * @see https://esbuild.github.io/api/#define\n * @see https://vitejs.dev/config/build-options.html#define\n * @see https://github.com/rollup/plugins/tree/master/packages/replace\n */\n define?: Record<string, any>;\n\n /**\n * Global variables that will have import statements injected where necessary\n *\n * @remarks\n * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.\n *\n * @example\n * ```ts\n * {\n * inject: {\n * process: 'process/browser',\n * Buffer: ['buffer', 'Buffer'],\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/inject\n */\n inject?: Record<string, string | string[]>;\n\n /**\n * The alias mappings to use for module resolution during the build process.\n *\n * @remarks\n * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.\n *\n * @example\n * ```ts\n * {\n * alias: {\n * \"@utils\": \"./src/utils\",\n * \"@components\": \"./src/components\"\n * }\n * }\n * ```\n *\n * @see https://github.com/rollup/plugins/tree/master/packages/alias\n */\n alias?:\n | Record<string, string>\n | Array<{\n find: string | RegExp;\n replacement: string;\n }>;\n\n /**\n * A list of modules that should not be bundled, even if they are external dependencies.\n *\n * @remarks\n * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.\n */\n external?: (string | RegExp)[];\n\n /**\n * A list of modules that should always be bundled, even if they are external dependencies.\n */\n noExternal?: (string | RegExp)[];\n\n /**\n * Should the Powerlines CLI processes skip bundling the `node_modules` directory?\n */\n skipNodeModulesBundle?: boolean;\n\n /**\n * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.\n *\n * @defaultValue false\n */\n keepProcessEnv?: boolean;\n\n /**\n * An optional set of override options to apply to the selected build variant.\n *\n * @remarks\n * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.\n */\n override?: Record<string, any>;\n}\n\nexport type BuildResolvedConfig = Omit<BuildConfig, \"override\">;\n\n// ESBuild\nexport type ESBuildBuildConfig = Omit<\n ExternalESBuildOptions,\n | \"entryPoints\"\n | \"sourceRoot\"\n | \"platform\"\n | \"outdir\"\n | \"env\"\n | \"assets\"\n | \"external\"\n | \"inject\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"logLevel\"\n> &\n BuildConfig;\nexport type ESBuildResolvedBuildConfig = Omit<\n ExternalESBuildOptions,\n \"inject\"\n> &\n BuildResolvedConfig;\n\n// Vite\nexport type ViteBuildConfig = Omit<\n ExternalViteUserConfig,\n | \"entry\"\n | \"entryPoints\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"environments\"\n | \"output\"\n> &\n BuildConfig & {\n /**\n * Optimize deps config\n */\n optimizeDeps?: Omit<DepOptimizationOptions, \"extensions\">;\n };\nexport type ViteResolvedBuildConfig = ExternalViteUserConfig &\n BuildResolvedConfig;\n\n// Webpack\nexport type WebpackBuildConfig = Omit<\n ExternalWebpackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type WebpackResolvedBuildConfig = ExternalWebpackOptions &\n BuildResolvedConfig;\n\n// Rspack\nexport type RspackBuildConfig = Omit<\n ExternalRspackOptions,\n \"name\" | \"entry\" | \"entryPoints\" | \"tsconfig\" | \"tsconfigRaw\"\n> &\n BuildConfig;\nexport type RspackResolvedBuildConfig = ExternalRspackOptions &\n BuildResolvedConfig;\n\n// Rollup\nexport type RollupBuildOutputConfig = Omit<\n ExternalRollupOutputOptions,\n \"dir\" | \"format\"\n>;\nexport type RollupBuildConfig = Omit<\n ExternalRollupOptions,\n \"entry\" | \"external\" | \"input\" | \"output\" | \"logLevel\"\n> & {\n output: RollupBuildOutputConfig | RollupBuildOutputConfig[];\n} & BuildConfig;\nexport type RollupResolvedBuildConfig = ExternalRollupOptions &\n BuildResolvedConfig;\n\n// Rolldown\nexport type RolldownBuildConfig = Omit<\n ExternalRolldownOptions,\n \"input\" | \"external\" | \"tsconfig\" | \"logLevel\" | \"output\"\n> &\n BuildConfig;\nexport type RolldownResolvedBuildConfig = ExternalRolldownOptions &\n BuildResolvedConfig;\n\n// Tsup\nexport type TsupBuildConfig = Partial<\n Omit<\n ExternalTsupOptions,\n | \"userOptions\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"clean\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsupResolvedBuildConfig = ExternalTsupOptions & BuildResolvedConfig;\n\n// Tsdown\nexport type TsdownBuildConfig = Partial<\n Omit<\n ExternalTsdownOptions,\n | \"name\"\n | \"outDir\"\n | \"clean\"\n | \"cwd\"\n | \"tsconfig\"\n | \"publicDir\"\n | \"copy\"\n | \"alias\"\n | \"format\"\n | \"platform\"\n | \"env\"\n | \"define\"\n | \"entry\"\n | \"external\"\n | \"noExternal\"\n | \"skipNodeModulesBundle\"\n >\n> &\n BuildConfig;\nexport type TsdownResolvedBuildConfig = ExternalTsdownOptions &\n BuildResolvedConfig;\n\n// Unbuild\nexport type UnbuildBuildConfig = Partial<\n Omit<\n ExternalUnbuildOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type UnbuildResolvedBuildConfig = ExternalUnbuildOptions &\n BuildResolvedConfig;\n\n// Farm\nexport type FarmBuildConfig = Partial<\n Omit<\n ExternalFarmOptions,\n | \"tsconfig\"\n | \"tsconfigRaw\"\n | \"assets\"\n | \"outputPath\"\n | \"mode\"\n | \"format\"\n | \"platform\"\n | \"projectRoot\"\n | \"env\"\n | \"entry\"\n | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type FarmResolvedBuildConfig = ExternalFarmOptions & BuildResolvedConfig;\n\n// Bun\nexport type BunBuildConfig = Partial<\n Omit<\n ExternalBunOptions,\n \"assets\" | \"platform\" | \"root\" | \"env\" | \"entryPoints\"\n >\n> &\n BuildConfig;\nexport type BunResolvedBuildConfig = ExternalBunOptions & BuildResolvedConfig;\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 { ArrayValues } from \"@stryke/types/array\";\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { Context } from \"./context\";\n\nexport const SUPPORTED_COMMANDS = [\n \"new\",\n \"clean\",\n \"prepare\",\n \"lint\",\n \"test\",\n \"build\",\n \"docs\",\n \"deploy\",\n \"finalize\"\n] as const;\n\nexport type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;\nexport type Commands<TContext extends Context = Context> = Record<\n CommandType,\n (this: TContext) => MaybePromise<void>\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 { ArrayValues } from \"@stryke/types/array\";\nimport type { AnyFunction, MaybePromise } from \"@stryke/types/base\";\nimport { LoadResult } from \"rollup\";\nimport type { ExternalIdResult, HookFilter, TransformResult } from \"unplugin\";\nimport type { BuilderVariant, UnpluginBuilderVariant } from \"./build\";\nimport { BUILDER_VARIANTS } from \"./build\";\nimport type { CommandType } from \"./commands\";\nimport { SUPPORTED_COMMANDS } 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\";\nimport { InferUnpluginOptions } from \"./unplugin\";\n\nexport interface PluginHookObject<\n THookFunction extends AnyFunction,\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 AnyFunction,\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\nexport type PluginHookFunctions<TContext extends PluginContext> = {\n [TCommandType in CommandType]: (this: TContext) => MaybePromise<void>;\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.\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<DeepPartial<TContext[\"config\"]> & Record<string, any>>;\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<LoadResult>;\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 PluginHooks<TContext extends PluginContext> = {\n [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<\n PluginHookFunctions<TContext>[TPluginHook]\n >;\n} & {\n transform: PluginHook<\n PluginHookFunctions<TContext>[\"transform\"],\n \"code\" | \"id\"\n >;\n load: PluginHook<PluginHookFunctions<TContext>[\"load\"], \"id\">;\n resolveId: PluginHook<PluginHookFunctions<TContext>[\"resolveId\"], \"id\">;\n};\n\ntype DeepPartial<T> = {\n [K in keyof T]?: DeepPartial<T[K]>;\n};\n\nexport type Plugin<\n TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>\n> = Partial<PluginHooks<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<any>) => 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 /**\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<DeepPartial<TContext[\"config\"]> & Record<string, any>>\n >\n | (DeepPartial<TContext[\"config\"]> & Record<string, any>);\n} & {\n [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<\n TContext,\n TBuilderVariant\n >;\n};\n\nexport const PLUGIN_NON_HOOK_FIELDS = [\n \"name\",\n \"api\",\n \"enforce\",\n \"dedupe\",\n \"applyToEnvironment\"\n] as const;\n\nexport type PluginNonHookFields =\n | ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n | UnpluginBuilderVariant;\n\nexport const PLUGIN_HOOKS_FIELDS = [\n ...SUPPORTED_COMMANDS,\n \"config\",\n \"configEnvironment\",\n \"configResolved\",\n \"types\",\n \"buildStart\",\n \"buildEnd\",\n \"transform\",\n \"load\",\n \"resolveId\",\n \"writeBundle\"\n] as const;\n\nexport type PluginHookFields<TContext extends PluginContext = PluginContext> =\n keyof PluginHookFunctions<TContext>;\n\nexport const KNOWN_PLUGIN_FIELDS = [\n ...PLUGIN_NON_HOOK_FIELDS,\n ...PLUGIN_HOOKS_FIELDS,\n ...BUILDER_VARIANTS\n] as const;\n\nexport type PluginFields = ArrayValues<typeof KNOWN_PLUGIN_FIELDS>;\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 { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n BUILDER_VARIANTS,\n UNPLUGIN_BUILDER_VARIANTS,\n UnpluginBuilderVariant\n} from \"../types/build\";\nimport {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../types/config\";\nimport { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport {\n HookFields,\n PluginHooksListItem,\n UnpluginHooksListItem\n} from \"../types/hooks\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport { ResolvedConfig } from \"../types/resolved\";\nimport { UnpluginOptions } from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n ) &&\n BUILDER_VARIANTS.every(\n variant =>\n isUndefined((value as Plugin<TContext>)[variant]) ||\n (variant in value && isSetObject((value as Plugin<TContext>)[variant]))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> = TField extends PluginHookFields\n ? PluginHooksListItem<TContext, TField>[\"handler\"]\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, TField>[\"handler\"]\n : never;\n\ntype HooksListItemForField<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n> =\n TField extends PluginHookFields<TContext>\n ? PluginHooksListItem<TContext, Extract<TField, PluginHookFields<TContext>>>\n : TField extends UnpluginBuilderVariant\n ? UnpluginHooksListItem<TContext, Extract<TField, UnpluginBuilderVariant>>\n : never;\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TField extends HookFields<TContext> = HookFields<TContext>\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TField> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TField>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n): keys is PluginHookFields<TContext> {\n return (\n !isUnpluginHookKey(keys) &&\n PLUGIN_HOOKS_FIELDS.includes(keys as PluginHookFields<TContext>)\n );\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function checkDedupe<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe === false ||\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) || p.name === plugin.name)\n )\n );\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends PluginHooksListItem<TContext, TField> = PluginHooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n) {\n if (\n !checkDedupe(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as HooksListItemForField<\n TContext,\n TField\n >[\"handler\"];\n if (!handler) {\n return;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { merge } from './chunk-JCX2UJYO.js';
1
+ import { merge } from './chunk-XDURJUGS.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { toArray } from '@stryke/convert/to-array';
4
4
  import { isFunction } from '@stryke/type-checks/is-function';
@@ -27,5 +27,5 @@ function extend(plugin, extension) {
27
27
  __name(extend, "extend");
28
28
 
29
29
  export { extend };
30
- //# sourceMappingURL=chunk-N4IXPCGY.js.map
31
- //# sourceMappingURL=chunk-N4IXPCGY.js.map
30
+ //# sourceMappingURL=chunk-RZAQTG45.js.map
31
+ //# sourceMappingURL=chunk-RZAQTG45.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugin-utils/extend.ts"],"names":["extend","plugin","extension","isFunction","options","pluginResult","toArray","Promise","resolve","extensionResult","map","p","e","merge","flat","result"],"mappings":";;;;;AA8DO,SAASA,MAAAA,CACdC,QACAC,SAAAA,EAAwE;AAExE,EAAA,IAAIC,UAAAA,CAAWF,MAAAA,CAAAA,EAAS;AACtB,IAAA,IAAIE,UAAAA,CAAWD,SAAAA,CAAAA,EAAY;AACzB,MAAA,OAAO,OAAOE,OAAAA,KAAAA;AACZ,QAAA,MAAMC,YAAAA,GAAeC,QAAQ,MAAMC,OAAAA,CAAQC,QAAQP,MAAAA,CAAOG,OAAAA,CAAAA,CAAAA,CAAAA;AAC1D,QAAA,MAAMK,eAAAA,GAAkBH,QACtB,MAAMC,OAAAA,CAAQC,QAAQN,SAAAA,CAAUE,OAAAA,CAAAA,CAAAA,CAAAA;AAGlC,QAAA,OAAOC,YAAAA,CACJK,GAAAA,CAAIC,CAAAA,CAAAA,KAAKF,gBAAgBC,GAAAA,CAAIE,CAAAA,CAAAA,KAAKC,KAAAA,CAAMF,CAAAA,EAAGC,CAAAA,CAAAA,CAAAA,EAC3CE,IAAAA,EAAI;AACT,MAAA,CAAA;AACF,IAAA;AAEA,IAAA,OAAO,OAAOV,OAAAA,KAAAA;AACZ,MAAA,MAAMW,MAAAA,GAAST,QAAQ,MAAMC,OAAAA,CAAQC,QAAQP,MAAAA,CAAOG,OAAAA,CAAAA,CAAAA,CAAAA;AAEpD,MAAA,OAAOW,OAAOL,GAAAA,CAAIC,CAAAA,MAAKE,KAAAA,CAAMF,CAAAA,EAAGT,SAAAA,CAAAA,CAAAA;AAClC,IAAA,CAAA;EACF,CAAA,MAAA,IAAWC,UAAAA,CAAWD,SAAAA,CAAAA,EAAY;AAChC,IAAA,OAAO,OAAOE,OAAAA,KAAAA;AACZ,MAAA,MAAMW,MAAAA,GAAST,QAAQ,MAAMC,OAAAA,CAAQC,QAAQN,SAAAA,CAAUE,OAAAA,CAAAA,CAAAA,CAAAA;AAEvD,MAAA,OAAOW,OACJL,GAAAA,CAAIE,CAAAA,CAAAA,KAAKN,OAAAA,CAAQL,MAAAA,CAAAA,CAAQS,GAAAA,CAAIC,CAAAA,CAAAA,KAAKE,MAAMF,CAAAA,EAAGC,CAAAA,CAAAA,CAAAA,EAC3CE,IAAAA,EAAI;AACT,IAAA,CAAA;AACF,EAAA;AAEA,EAAA,OAAOR,OAAAA,CAAQL,MAAAA,CAAAA,CAAQS,GAAAA,CAAIC,CAAAA,CAAAA,KAAKE,KAAAA,CAAMF,CAAAA,EAAGT,SAAAA,CAAAA,CAAAA;AAC3C;AAlCgBF,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-N4IXPCGY.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 { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport {\n PartialPlugin,\n PartialPluginFactory,\n PluginFactory\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { merge } from \"./merge\";\n\n/**\n * Adds additional helper functionality to a plugin via a plugin builder function.\n *\n * @param plugin - The base plugin object or factory function to extend.\n * @param extension - The plugin extension object or factory function. This function receives the plugin options and returns a plugin object.\n * @returns A function accepting the plugin options and returning the extended plugin.\n */\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown,\n TExtensionOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TPluginOptions & TExtensionOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPlugin<TContext>\n): PluginFactory<TContext, TPluginOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TExtensionOptions = unknown\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TExtensionOptions>;\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPlugin<TContext>\n): Plugin<TContext>[];\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext, any>,\n extension: PartialPlugin<TContext> | PartialPluginFactory<TContext, any>\n): PluginFactory<TContext, any> | Plugin<TContext>[] {\n if (isFunction(plugin)) {\n if (isFunction(extension)) {\n return async (options: any) => {\n const pluginResult = toArray(await Promise.resolve(plugin(options)));\n const extensionResult = toArray(\n await Promise.resolve(extension(options))\n );\n\n return pluginResult\n .map(p => extensionResult.map(e => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return async (options: any) => {\n const result = toArray(await Promise.resolve(plugin(options)));\n\n return result.map(p => merge(p, extension) as Plugin<TContext>);\n };\n } else if (isFunction(extension)) {\n return async (options: any) => {\n const result = toArray(await Promise.resolve(extension(options)));\n\n return result\n .map(e => toArray(plugin).map(p => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return toArray(plugin).map(p => merge(p, extension) as Plugin<TContext>);\n}\n"]}
1
+ {"version":3,"sources":["../../src/plugin-utils/extend.ts"],"names":["extend","plugin","extension","isFunction","options","pluginResult","toArray","Promise","resolve","extensionResult","map","p","e","merge","flat","result"],"mappings":";;;;;AA8DO,SAASA,MAAAA,CACdC,QACAC,SAAAA,EAAwE;A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,CAAAA,CAAAA,CAAAA,EAC3CE,IAAAA,EAAI;AACT,IAAA,CAAA;AACF,EAAA;AAEA,EAAA,OAAOR,OAAAA,CAAQL,MAAAA,CAAAA,CAAQS,GAAAA,CAAIC,CAAAA,CAAAA,KAAKE,KAAAA,CAAMF,CAAAA,EAAGT,SAAAA,CAAAA,CAAAA;AAC3C;AAlCgBF,MAAAA,CAAAA,MAAAA,EAAAA,QAAAA,CAAAA","file":"chunk-RZAQTG45.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 { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport {\n PartialPlugin,\n PartialPluginFactory,\n PluginFactory\n} from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { merge } from \"./merge\";\n\n/**\n * Adds additional helper functionality to a plugin via a plugin builder function.\n *\n * @param plugin - The base plugin object or factory function to extend.\n * @param extension - The plugin extension object or factory function. This function receives the plugin options and returns a plugin object.\n * @returns A function accepting the plugin options and returning the extended plugin.\n */\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown,\n TExtensionOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TPluginOptions & TExtensionOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TPluginOptions = unknown\n>(\n plugin: PluginFactory<TContext, TPluginOptions>,\n extension: PartialPlugin<TContext>\n): PluginFactory<TContext, TPluginOptions>;\nexport function extend<\n TContext extends PluginContext = PluginContext,\n TExtensionOptions = unknown\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPluginFactory<TContext, TExtensionOptions>\n): PluginFactory<TContext, TExtensionOptions>;\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n extension: PartialPlugin<TContext>\n): Plugin<TContext>[];\nexport function extend<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext, any>,\n extension: PartialPlugin<TContext> | PartialPluginFactory<TContext, any>\n): PluginFactory<TContext, any> | Plugin<TContext>[] {\n if (isFunction(plugin)) {\n if (isFunction(extension)) {\n return async (options: any) => {\n const pluginResult = toArray(await Promise.resolve(plugin(options)));\n const extensionResult = toArray(\n await Promise.resolve(extension(options))\n );\n\n return pluginResult\n .map(p => extensionResult.map(e => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return async (options: any) => {\n const result = toArray(await Promise.resolve(plugin(options)));\n\n return result.map(p => merge(p, extension) as Plugin<TContext>);\n };\n } else if (isFunction(extension)) {\n return async (options: any) => {\n const result = toArray(await Promise.resolve(extension(options)));\n\n return result\n .map(e => toArray(plugin).map(p => merge(p, e) as Plugin<TContext>))\n .flat();\n };\n }\n\n return toArray(plugin).map(p => merge(p, extension) as Plugin<TContext>);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { isPluginHook, getHookHandler } from './chunk-FTVPZZJO.js';
1
+ import { isPluginHook, getHookHandler } from './chunk-I3FSMSLD.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import defu, { createDefu } from 'defu';
4
4
 
@@ -9,7 +9,9 @@ var mergePlugin = createDefu((obj, key, value) => {
9
9
  ...value,
10
10
  handler: /* @__PURE__ */ __name(async (...params) => {
11
11
  const [resultA, resultB] = await Promise.all([
12
+ // eslint-disable-next-line ts/no-unsafe-call
12
13
  getHookHandler(obj[key])(...params),
14
+ // eslint-disable-next-line ts/no-unsafe-call
13
15
  getHookHandler(value)(...params)
14
16
  ]);
15
17
  return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;
@@ -25,5 +27,5 @@ function merge(pluginA, pluginB) {
25
27
  __name(merge, "merge");
26
28
 
27
29
  export { merge };
28
- //# sourceMappingURL=chunk-JCX2UJYO.js.map
29
- //# sourceMappingURL=chunk-JCX2UJYO.js.map
30
+ //# sourceMappingURL=chunk-XDURJUGS.js.map
31
+ //# sourceMappingURL=chunk-XDURJUGS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugin-utils/merge.ts"],"names":["mergePlugin","createDefu","obj","key","value","isPluginHook","handler","params","resultA","resultB","Promise","all","getHookHandler","defu","merge","pluginA","pluginB"],"mappings":";;;;AAmCA,IAAMA,WAAAA,GAAcC,UAAAA,CAAW,CAACC,GAAAA,EAAKC,KAAKC,KAAAA,KAAAA;AACxC,EAAA,IAAIC,aAAaH,GAAAA,CAAIC,GAAAA,CAAI,CAAA,IAAKE,YAAAA,CAAaD,KAAAA,CAAAA,EAAQ;AACjDF,IAAAA,GAAAA,CAAIC,GAAAA,CAAAA,GAAO;AACT,MAAA,GAAGD,IAAIC,GAAAA,CAAAA;MACP,GAAGC,KAAAA;AACHE,MAAAA,OAAAA,mCAAmBC,MAAAA,KAAAA;AACjB,QAAA,MAAM,CAACC,OAAAA,EAASC,OAAAA,CAAAA,GAAW,MAAMC,QAAQC,GAAAA,CAAI;;AAE1CC,UAAAA,cAAAA,CAAeV,GAAAA,CAAIC,GAAAA,CAAI,CAAA,CAAA,GAAaI,MAAAA,CAAAA;;UAEpCK,cAAAA,CAAeR,KAAAA,CAAAA,CAAAA,GAAkBG,MAAAA;AACnC,SAAA,CAAA;AAED,QAAA,OAAOE,WAAWD,OAAAA,GAAUK,IAAAA,CAAKL,OAAAA,EAASC,OAAAA,IAAWD,OAAAA,IAAWC,OAAAA;MAClE,CAAA,EATS,SAAA;AAUX,KAAA;AACA,IAAA,OAAO,IAAA;AACT,EAAA;AAEA,EAAA,OAAO,KAAA;AACT,CAAA,CAAA;AASO,SAASK,KAAAA,CACdC,SACAC,OAAAA,EAAmD;AAEnD,EAAA,OAAOhB,WAAAA,CAAYe,SAASC,OAAAA,CAAAA;AAK9B;AATgBF,MAAAA,CAAAA,KAAAA,EAAAA,OAAAA,CAAAA","file":"chunk-XDURJUGS.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 defu, { createDefu } from \"defu\";\nimport { PartialPlugin } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { extend } from './chunk-N4IXPCGY.js';
1
+ import { extend } from './chunk-RZAQTG45.js';
2
2
  import { __name } from './chunk-7QVYU63E.js';
3
3
  import { toArray } from '@stryke/convert/to-array';
4
4
  import { isFunction } from '@stryke/type-checks/is-function';
@@ -21,5 +21,5 @@ async function enforceBuild(plugin, variant) {
21
21
  __name(enforceBuild, "enforceBuild");
22
22
 
23
23
  export { enforceBuild };
24
- //# sourceMappingURL=chunk-WZCGJ7JR.js.map
25
- //# sourceMappingURL=chunk-WZCGJ7JR.js.map
24
+ //# sourceMappingURL=chunk-Z2BYI6KW.js.map
25
+ //# sourceMappingURL=chunk-Z2BYI6KW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/plugin-utils/enforce.ts"],"names":["enforceBuild","plugin","variant","extension","configResolved","allowedVariants","toArray","currentVariant","config","build","includes","Error","Array","isArray","map","v","slice","join","isFunction","extend"],"mappings":";;;;;AA+CA,eAAsBA,YAAAA,CAIpBC,QACAC,OAAAA,EAAwC;AAExC,EAAA,MAAMC,SAAAA,GAAY;IAChBC,cAAAA,GAAAA;AACE,MAAA,MAAMC,eAAAA,GAAkBC,QAAuBJ,OAAAA,CAAAA;AAC/C,MAAA,MAAMK,cAAAA,GAAiB,IAAA,CAAKC,MAAAA,EAAQC,KAAAA,EAAOP,OAAAA;AAI3C,MAAA,IAAI,CAACK,cAAAA,IAAkB,CAACF,eAAAA,CAAgBK,QAAAA,CAASH,cAAAA,CAAAA,EAAiB;AAChE,QAAA,MAAM,IAAII,MACR,CAAA,oBAAA,EACEC,KAAAA,CAAMC,QAAQX,OAAAA,CAAAA,GACV,sBAAsBA,OAAAA,CACnBY,GAAAA,CAAIC,CAAAA,CAAAA,KAAK,CAAA,CAAA,EAAIA,CAAAA,CAAAA,CAAAA,CAAI,CAAA,CACjBC,MAAM,CAAA,EAAG,EAAC,EACVC,IAAAA,CAAK,IAAA,CAAA,CAAA,KAAA,EAAaf,OAAAA,CAClBY,IAAIC,CAAAA,CAAAA,KAAK,IAAIA,CAAAA,CAAAA,CAAAA,CAAI,EACjBC,KAAAA,CAAM,EAAC,EACPC,IAAAA,CAAK,EAAA,CAAA,CAAA,CAAA,GACR,CAAA,mBAAA,EAAsBf,OAAAA,CAAAA,CAAAA,CAAU,CAAA,gBAAA,EAEpCK,cAAAA,IAAkB,WAAA,CAAA,8EAAA,CAC4D,CAAA;AAEpF,MAAA;AACF,IAAA;AACF,GAAA;AAIA,EAAA,IAAIW,UAAAA,CAAWjB,MAAAA,CAAAA,EAAS;AACtB,IAAA,OAAOkB,MAAAA,CAAOlB,QAAQE,SAAAA,CAAAA;AACxB,EAAA;AAEA,EAAA,OAAOgB,OAAOlB,MAAAA,EAAQ,MAAME,SAAAA,CAAAA,CAAW,EAAC,CAAA;AAC1C;AAzCsBH,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA","file":"chunk-Z2BYI6KW.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 { toArray } from \"@stryke/convert/to-array\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { BuilderVariant } from \"../types/build\";\nimport { PartialPlugin, PluginFactory } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { extend } from \"./extend\";\n\n/**\n * Enforces a specific build variant for a plugin.\n *\n * @param plugin - The plugin or plugin factory to enforce the build variant on.\n * @param variant - The build variant to enforce.\n * @returns A new plugin or plugin factory that enforces the specified build variant.\n */\nexport function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[],\n variant: TBuildVariant | TBuildVariant[]\n): Promise<Plugin<TContext>[]>;\nexport function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: PluginFactory<TContext>,\n variant: TBuildVariant | TBuildVariant[]\n): Promise<PluginFactory<TContext>>;\nexport async function enforceBuild<\n TContext extends PluginContext = PluginContext,\n TBuildVariant extends BuilderVariant = BuilderVariant\n>(\n plugin: Plugin<TContext> | Plugin<TContext>[] | PluginFactory<TContext>,\n variant: TBuildVariant | TBuildVariant[]\n) {\n const extension = {\n configResolved(this: TContext) {\n const allowedVariants = toArray<TBuildVariant>(variant);\n const currentVariant = this.config?.build?.variant as\n | TBuildVariant\n | undefined;\n\n if (!currentVariant || !allowedVariants.includes(currentVariant)) {\n throw new Error(\n `The plugin requires ${\n Array.isArray(variant)\n ? `the build variants ${variant\n .map(v => `\"${v}\"`)\n .slice(0, -1)\n .join(\", \")}, or ${variant\n .map(v => `\"${v}\"`)\n .slice(-1)\n .join(\"\")}`\n : `the build variant \"${variant}\"`\n }, but received \"${\n currentVariant ?? \"undefined\"\n }\". Please ensure the \\`build.variant\\` is set correctly in your configuration.`\n );\n }\n }\n } as PartialPlugin<TContext>;\n\n // The `extend` function has different overloads for plugin factories vs concrete\n // plugins - narrow here so TypeScript can select the correct overload.\n if (isFunction(plugin)) {\n return extend(plugin, extension);\n }\n\n return extend(plugin, () => extension)({});\n}\n"]}