@powerlines/plugin-alloy 0.15.3 → 0.15.5

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 (307) hide show
  1. package/dist/{chunk-CbDLau6x.cjs → _virtual/rolldown_runtime.cjs} +9 -6
  2. package/dist/_virtual/rolldown_runtime.mjs +29 -0
  3. package/dist/core/components/index.cjs +6 -8
  4. package/dist/core/components/index.d.cts +3 -6
  5. package/dist/core/components/index.d.mts +3 -6
  6. package/dist/core/components/index.mjs +3 -5
  7. package/dist/core/components/output.cjs +39 -3
  8. package/dist/core/components/output.d.cts +17 -2
  9. package/dist/core/components/output.d.mts +17 -2
  10. package/dist/core/components/output.mjs +37 -2
  11. package/dist/core/components/single-line-comment.cjs +21 -2
  12. package/dist/core/components/single-line-comment.d.cts +21 -3
  13. package/dist/core/components/single-line-comment.d.mts +21 -3
  14. package/dist/core/components/single-line-comment.mjs +19 -1
  15. package/dist/core/components/source-file.cjs +57 -2
  16. package/dist/core/components/source-file.d.cts +30 -3
  17. package/dist/core/components/source-file.d.mts +30 -3
  18. package/dist/core/components/source-file.mjs +54 -1
  19. package/dist/core/contexts/context.cjs +28 -4
  20. package/dist/core/contexts/context.d.cts +25 -2
  21. package/dist/core/contexts/context.d.mts +25 -2
  22. package/dist/core/contexts/context.mjs +24 -1
  23. package/dist/core/contexts/index.cjs +13 -14
  24. package/dist/core/contexts/index.d.cts +2 -5
  25. package/dist/core/contexts/index.d.mts +2 -5
  26. package/dist/core/contexts/index.mjs +2 -3
  27. package/dist/core/contexts/reflection.cjs +67 -9
  28. package/dist/core/contexts/reflection.d.cts +51 -3
  29. package/dist/core/contexts/reflection.d.mts +51 -3
  30. package/dist/core/contexts/reflection.mjs +58 -1
  31. package/dist/core/index.cjs +21 -22
  32. package/dist/core/index.d.cts +5 -10
  33. package/dist/core/index.d.mts +7 -10
  34. package/dist/core/index.mjs +7 -8
  35. package/dist/deepkit/src/utilities.cjs +113 -0
  36. package/dist/deepkit/src/utilities.mjs +109 -0
  37. package/dist/deepkit/src/vendor/core.cjs +20 -0
  38. package/dist/deepkit/src/vendor/core.mjs +11 -0
  39. package/dist/deepkit/src/vendor/type.cjs +20 -0
  40. package/dist/deepkit/src/vendor/type.d.cts +7 -0
  41. package/dist/deepkit/src/vendor/type.d.mts +7 -0
  42. package/dist/deepkit/src/vendor/type.mjs +11 -0
  43. package/dist/helpers/capnp.cjs +276 -19
  44. package/dist/helpers/capnp.d.cts +86 -2
  45. package/dist/helpers/capnp.d.mts +86 -2
  46. package/dist/helpers/capnp.mjs +257 -2
  47. package/dist/helpers/create-builtin.cjs +18 -2
  48. package/dist/helpers/create-builtin.d.cts +14 -1
  49. package/dist/helpers/create-builtin.d.mts +14 -1
  50. package/dist/helpers/create-builtin.mjs +16 -1
  51. package/dist/helpers/index.cjs +23 -25
  52. package/dist/helpers/index.d.cts +4 -6
  53. package/dist/helpers/index.d.mts +4 -6
  54. package/dist/helpers/index.mjs +4 -6
  55. package/dist/helpers/refkey.cjs +15 -2
  56. package/dist/helpers/refkey.d.cts +12 -1
  57. package/dist/helpers/refkey.d.mts +12 -1
  58. package/dist/helpers/refkey.mjs +13 -1
  59. package/dist/helpers/typescript.cjs +45 -3
  60. package/dist/helpers/typescript.d.cts +24 -1
  61. package/dist/helpers/typescript.d.mts +24 -1
  62. package/dist/helpers/typescript.mjs +43 -2
  63. package/dist/index.cjs +114 -123
  64. package/dist/index.d.cts +24 -34
  65. package/dist/index.d.mts +29 -34
  66. package/dist/index.mjs +35 -44
  67. package/dist/markdown/components/index.cjs +7 -12
  68. package/dist/markdown/components/index.d.cts +2 -7
  69. package/dist/markdown/components/index.d.mts +2 -7
  70. package/dist/markdown/components/index.mjs +2 -7
  71. package/dist/markdown/components/markdown-file.cjs +117 -6
  72. package/dist/markdown/components/markdown-file.d.cts +22 -4
  73. package/dist/markdown/components/markdown-file.d.mts +22 -4
  74. package/dist/markdown/components/markdown-file.mjs +114 -4
  75. package/dist/markdown/components/markdown-table.cjs +100 -5
  76. package/dist/markdown/components/markdown-table.d.cts +26 -4
  77. package/dist/markdown/components/markdown-table.d.mts +26 -4
  78. package/dist/markdown/components/markdown-table.mjs +96 -2
  79. package/dist/markdown/contexts/index.cjs +5 -6
  80. package/dist/markdown/contexts/index.d.cts +1 -2
  81. package/dist/markdown/contexts/index.d.mts +1 -2
  82. package/dist/markdown/contexts/index.mjs +1 -2
  83. package/dist/markdown/contexts/markdown-table.cjs +36 -5
  84. package/dist/markdown/contexts/markdown-table.d.cts +36 -1
  85. package/dist/markdown/contexts/markdown-table.d.mts +36 -1
  86. package/dist/markdown/contexts/markdown-table.mjs +31 -1
  87. package/dist/markdown/index.cjs +14 -18
  88. package/dist/markdown/index.d.cts +3 -9
  89. package/dist/markdown/index.d.mts +5 -9
  90. package/dist/markdown/index.mjs +5 -9
  91. package/dist/powerlines/src/lib/utilities/file-header.cjs +13 -0
  92. package/dist/powerlines/src/lib/utilities/file-header.mjs +12 -0
  93. package/dist/powerlines/src/types/babel.d.mts +2 -0
  94. package/dist/powerlines/src/types/build.d.cts +145 -0
  95. package/dist/powerlines/src/types/build.d.mts +145 -0
  96. package/dist/powerlines/src/types/commands.d.cts +8 -0
  97. package/dist/powerlines/src/types/commands.d.mts +9 -0
  98. package/dist/powerlines/src/types/config.d.cts +369 -0
  99. package/dist/powerlines/src/types/config.d.mts +369 -0
  100. package/dist/powerlines/src/types/context.d.cts +362 -0
  101. package/dist/powerlines/src/types/context.d.mts +364 -0
  102. package/dist/powerlines/src/types/fs.d.cts +458 -0
  103. package/dist/powerlines/src/types/fs.d.mts +458 -0
  104. package/dist/powerlines/src/types/hooks.d.mts +2 -0
  105. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  106. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  107. package/dist/powerlines/src/types/resolved.d.cts +81 -0
  108. package/dist/powerlines/src/types/resolved.d.mts +81 -0
  109. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  110. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  111. package/dist/types/components.cjs +0 -1
  112. package/dist/types/components.d.cts +142 -2
  113. package/dist/types/components.d.mts +142 -2
  114. package/dist/types/components.mjs +0 -2
  115. package/dist/types/index.cjs +0 -3
  116. package/dist/types/index.d.cts +2 -4
  117. package/dist/types/index.d.mts +2 -4
  118. package/dist/types/index.mjs +0 -4
  119. package/dist/types/plugin.cjs +0 -1
  120. package/dist/types/plugin.d.cts +41 -2
  121. package/dist/types/plugin.d.mts +41 -2
  122. package/dist/types/plugin.mjs +0 -2
  123. package/dist/typescript/components/builtin-file.cjs +43 -8
  124. package/dist/typescript/components/builtin-file.d.cts +33 -6
  125. package/dist/typescript/components/builtin-file.d.mts +33 -6
  126. package/dist/typescript/components/builtin-file.mjs +41 -7
  127. package/dist/typescript/components/dynamic-import-statement.cjs +24 -2
  128. package/dist/typescript/components/dynamic-import-statement.d.cts +31 -1
  129. package/dist/typescript/components/dynamic-import-statement.d.mts +31 -1
  130. package/dist/typescript/components/dynamic-import-statement.mjs +22 -1
  131. package/dist/typescript/components/entry-file.cjs +38 -6
  132. package/dist/typescript/components/entry-file.d.cts +26 -5
  133. package/dist/typescript/components/entry-file.d.mts +26 -5
  134. package/dist/typescript/components/entry-file.mjs +35 -5
  135. package/dist/typescript/components/index.cjs +43 -49
  136. package/dist/typescript/components/index.d.cts +9 -13
  137. package/dist/typescript/components/index.d.mts +9 -13
  138. package/dist/typescript/components/index.mjs +9 -15
  139. package/dist/typescript/components/record-expression.cjs +11 -2
  140. package/dist/typescript/components/record-expression.d.cts +11 -1
  141. package/dist/typescript/components/record-expression.d.mts +11 -1
  142. package/dist/typescript/components/record-expression.mjs +9 -1
  143. package/dist/typescript/components/tsdoc-reflection.cjs +172 -8
  144. package/dist/typescript/components/tsdoc-reflection.d.cts +17 -4
  145. package/dist/typescript/components/tsdoc-reflection.d.mts +17 -4
  146. package/dist/typescript/components/tsdoc-reflection.mjs +168 -5
  147. package/dist/typescript/components/tsdoc.cjs +475 -23
  148. package/dist/typescript/components/tsdoc.d.cts +151 -3
  149. package/dist/typescript/components/tsdoc.d.mts +151 -3
  150. package/dist/typescript/components/tsdoc.mjs +454 -3
  151. package/dist/typescript/components/typescript-file.cjs +192 -7
  152. package/dist/typescript/components/typescript-file.d.cts +46 -4
  153. package/dist/typescript/components/typescript-file.d.mts +46 -4
  154. package/dist/typescript/components/typescript-file.mjs +188 -4
  155. package/dist/typescript/components/typescript-interface.cjs +68 -8
  156. package/dist/typescript/components/typescript-interface.d.cts +24 -3
  157. package/dist/typescript/components/typescript-interface.d.mts +24 -3
  158. package/dist/typescript/components/typescript-interface.mjs +65 -6
  159. package/dist/typescript/components/typescript-object.cjs +124 -8
  160. package/dist/typescript/components/typescript-object.d.cts +25 -3
  161. package/dist/typescript/components/typescript-object.d.mts +25 -3
  162. package/dist/typescript/components/typescript-object.mjs +121 -6
  163. package/dist/typescript/index.cjs +44 -50
  164. package/dist/typescript/index.d.cts +9 -14
  165. package/dist/typescript/index.d.mts +10 -14
  166. package/dist/typescript/index.mjs +10 -16
  167. package/dist/vendor.cjs +12594 -0
  168. package/dist/vendor.d.cts +1 -0
  169. package/dist/vendor.d.ts +1 -0
  170. package/dist/vendor.js +12424 -0
  171. package/package.json +23 -9
  172. package/dist/builtin-file-BDc5-4_L.mjs +0 -43
  173. package/dist/builtin-file-BxePApb0.d.mts +0 -34
  174. package/dist/builtin-file-Cey2cJy9.cjs +0 -49
  175. package/dist/builtin-file-Cq1ooVDk.d.cts +0 -34
  176. package/dist/capnp-8yVLwAox.cjs +0 -364
  177. package/dist/capnp-C5d2Z3gP.d.cts +0 -87
  178. package/dist/capnp-CNythuSw.mjs +0 -267
  179. package/dist/capnp-DkidugOV.d.mts +0 -87
  180. package/dist/components-BOkkDhM9.cjs +0 -0
  181. package/dist/components-BXrpeD8J.cjs +0 -0
  182. package/dist/components-C3qpgLKV.mjs +0 -1
  183. package/dist/components-C8Qs2PB0.d.cts +0 -142
  184. package/dist/components-CBtEhH9k.mjs +0 -1
  185. package/dist/components-Cj5gaIV0.cjs +0 -0
  186. package/dist/components-HMVhsFQl.mjs +0 -1
  187. package/dist/components-I0ydtjfW.cjs +0 -0
  188. package/dist/components-ajocJcib.mjs +0 -1
  189. package/dist/components-ixU_ICbr.d.mts +0 -142
  190. package/dist/context-BApo1nhP.d.mts +0 -26
  191. package/dist/context-BDGjT3c-.d.cts +0 -26
  192. package/dist/context-BIduC1bB.cjs +0 -44
  193. package/dist/context-BsDdxy5g.d.cts +0 -1668
  194. package/dist/context-Cx38_mgI.mjs +0 -26
  195. package/dist/context-DXy7MPku.d.mts +0 -1668
  196. package/dist/contexts-BSRk0whx.cjs +0 -0
  197. package/dist/contexts-X44bRyOp.mjs +0 -1
  198. package/dist/contexts-XuEdvZdE.mjs +0 -1
  199. package/dist/contexts-uXFW3CIa.cjs +0 -0
  200. package/dist/core-B57eQAue.mjs +0 -1
  201. package/dist/core-DzEmU6tL.cjs +0 -0
  202. package/dist/create-builtin-Bpswa0ZT.d.cts +0 -15
  203. package/dist/create-builtin-CP9mN5P-.mjs +0 -18
  204. package/dist/create-builtin-_3GNADDt.cjs +0 -24
  205. package/dist/create-builtin-wEbNOWNw.d.mts +0 -15
  206. package/dist/dynamic-import-statement-CWK5I_yt.mjs +0 -24
  207. package/dist/dynamic-import-statement-D6f1SnIf.d.mts +0 -32
  208. package/dist/dynamic-import-statement-DVGp5Cvq.cjs +0 -30
  209. package/dist/dynamic-import-statement-Dk3bSR8x.d.cts +0 -32
  210. package/dist/entry-file-B5YXZbGV.d.cts +0 -27
  211. package/dist/entry-file-DijEelFv.cjs +0 -44
  212. package/dist/entry-file-DtjJPVZY.mjs +0 -37
  213. package/dist/entry-file-HWtqk30Z.d.mts +0 -27
  214. package/dist/helpers-BrA1Dy07.mjs +0 -1
  215. package/dist/helpers-Cten3PJk.cjs +0 -0
  216. package/dist/index-BINnViIh.d.mts +0 -1
  217. package/dist/index-BJ8-FA6N.d.cts +0 -1
  218. package/dist/index-BRJ_6A42.d.mts +0 -1
  219. package/dist/index-BXpMZvwA.d.cts +0 -1
  220. package/dist/index-Bi0Yc4v2.d.cts +0 -1
  221. package/dist/index-BrGZHEgX.d.mts +0 -1
  222. package/dist/index-BwFl_eS0.d.mts +0 -1
  223. package/dist/index-C1ihAKnV.d.cts +0 -1
  224. package/dist/index-CLTQPxoD.d.mts +0 -1
  225. package/dist/index-CoUVmp_Q.d.mts +0 -1
  226. package/dist/index-D1aKd2tO.d.cts +0 -1
  227. package/dist/index-D4d_pZLu.d.cts +0 -1
  228. package/dist/index-DBGd4WeR.d.mts +0 -1
  229. package/dist/index-DdxxIAKU.d.cts +0 -1
  230. package/dist/index-Deol7ZWO.d.mts +0 -1
  231. package/dist/index-DpEKQcoR.d.cts +0 -1
  232. package/dist/index-DrZ2Dh-H.d.cts +0 -1
  233. package/dist/index-MEuojd-r.d.cts +0 -1
  234. package/dist/index-bHnO4ZKt.d.mts +0 -1
  235. package/dist/index-lIMqGGJz.d.mts +0 -1
  236. package/dist/markdown-BTQE0AI9.cjs +0 -0
  237. package/dist/markdown-DMddlO1y.mjs +0 -1
  238. package/dist/markdown-file-BVSRcpXO.cjs +0 -128
  239. package/dist/markdown-file-CKkjaqpP.d.mts +0 -23
  240. package/dist/markdown-file-Clh5iU1_.mjs +0 -116
  241. package/dist/markdown-file-EKqcnqeE.d.cts +0 -23
  242. package/dist/markdown-table-2qP_4eLk.mjs +0 -33
  243. package/dist/markdown-table-83GdY7ag.d.mts +0 -27
  244. package/dist/markdown-table-B40X-Kp1.cjs +0 -116
  245. package/dist/markdown-table-BIRzgtYb.d.cts +0 -27
  246. package/dist/markdown-table-BOWM26Kb.cjs +0 -57
  247. package/dist/markdown-table-CZMEY6IR.d.cts +0 -37
  248. package/dist/markdown-table-D-YnljE7.mjs +0 -98
  249. package/dist/markdown-table-kFQoqKQt.d.mts +0 -37
  250. package/dist/output-BlHZS50Y.cjs +0 -45
  251. package/dist/output-C2C9L6Ho.d.cts +0 -18
  252. package/dist/output-CNnPjQlW.mjs +0 -39
  253. package/dist/output-Di6Elv89.d.mts +0 -18
  254. package/dist/plugin-DU0K2-Om.mjs +0 -1
  255. package/dist/plugin-DfBq0RfU.d.cts +0 -40
  256. package/dist/plugin-Fx-uJ4It.cjs +0 -0
  257. package/dist/plugin-LknisCLa.d.mts +0 -40
  258. package/dist/record-expression-BOCZ9iqR.d.mts +0 -12
  259. package/dist/record-expression-DM_zSqE_.d.cts +0 -12
  260. package/dist/record-expression-DNVzCKgo.cjs +0 -17
  261. package/dist/record-expression-DxS_DiPc.mjs +0 -11
  262. package/dist/refkey-B0XSqdGY.d.mts +0 -13
  263. package/dist/refkey-B6A9kh_u.cjs +0 -21
  264. package/dist/refkey-CP7MJMac.d.cts +0 -13
  265. package/dist/refkey-CV0mIj0Y.mjs +0 -15
  266. package/dist/reflection-BSbFFYZO.cjs +0 -108
  267. package/dist/reflection-CBMQ1FQo.mjs +0 -60
  268. package/dist/reflection-CL_Lrq2o.d.cts +0 -52
  269. package/dist/reflection-DLJST1Z7.d.mts +0 -52
  270. package/dist/single-line-comment-BhEed2Bl.d.cts +0 -22
  271. package/dist/single-line-comment-Biwa95Py.mjs +0 -21
  272. package/dist/single-line-comment-CH3Apcm8.d.mts +0 -22
  273. package/dist/single-line-comment-DvU69OGj.cjs +0 -27
  274. package/dist/source-file-BNEo0iAE.d.mts +0 -31
  275. package/dist/source-file-BOgnPw2P.d.cts +0 -31
  276. package/dist/source-file-DK_nFwAK.cjs +0 -63
  277. package/dist/source-file-Dna2E0ro.mjs +0 -56
  278. package/dist/tsdoc-B0TNs3dK.cjs +0 -576
  279. package/dist/tsdoc-CK6J_ap5.d.cts +0 -152
  280. package/dist/tsdoc-QH5nHvck.d.mts +0 -152
  281. package/dist/tsdoc-XXdq_9iS.mjs +0 -456
  282. package/dist/tsdoc-reflection-BizVi_gn.cjs +0 -188
  283. package/dist/tsdoc-reflection-DllAx-qb.d.cts +0 -18
  284. package/dist/tsdoc-reflection-DtWdO7Hk.d.mts +0 -18
  285. package/dist/tsdoc-reflection-IWtPMJjw.mjs +0 -170
  286. package/dist/types-BBEDEYnP.cjs +0 -0
  287. package/dist/types-BWlfXHs2.mjs +0 -1
  288. package/dist/typescript-45caIUPa.mjs +0 -1
  289. package/dist/typescript-BrZsJqvc.mjs +0 -45
  290. package/dist/typescript-CXP7Oa6_.d.cts +0 -25
  291. package/dist/typescript-DG1-qdBQ.d.mts +0 -25
  292. package/dist/typescript-DV5akLQO.cjs +0 -0
  293. package/dist/typescript-DcqKlMoH.cjs +0 -51
  294. package/dist/typescript-file-BDXTfhtE.d.cts +0 -47
  295. package/dist/typescript-file-BljeGTrz.d.mts +0 -47
  296. package/dist/typescript-file-CLL-ELi0.mjs +0 -190
  297. package/dist/typescript-file-HsAUWnQY.cjs +0 -208
  298. package/dist/typescript-interface-CTt8ULTa.d.mts +0 -25
  299. package/dist/typescript-interface-DwHJ9in_.cjs +0 -79
  300. package/dist/typescript-interface-FVDsEsu0.mjs +0 -67
  301. package/dist/typescript-interface-raVgIJpX.d.cts +0 -25
  302. package/dist/typescript-object-D8MHeFId.cjs +0 -135
  303. package/dist/typescript-object-Db0fqsDb.d.cts +0 -26
  304. package/dist/typescript-object-Ju07nQg9.mjs +0 -123
  305. package/dist/typescript-object-USS-Xx2b.d.mts +0 -26
  306. package/dist/utilities-CnaPrauh.mjs +0 -109
  307. package/dist/utilities-llRqOC4l.cjs +0 -133
@@ -1,1668 +0,0 @@
1
- import { LogLevelLabel } from "@storm-software/config-tools/types";
2
- import { EnvPaths } from "@stryke/env/get-env-paths";
3
- import { FetchRequestOptions } from "@stryke/http/fetch";
4
- import { FunctionLike, MaybePromise, NonUndefined } from "@stryke/types/base";
5
- import { PackageJson } from "@stryke/types/package-json";
6
- import { Jiti } from "jiti";
7
- import { SourceMap } from "magic-string";
8
- import { ParseResult, ParserOptions } from "oxc-parser";
9
- import { Range } from "semver";
10
- import { Project } from "ts-morph";
11
- import { RequestInfo, Response } from "undici";
12
- import { ExternalIdResult, HookFilter, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage, UnpluginOptions } from "unplugin";
13
- import { Format } from "@storm-software/build-tools/types";
14
- import { StormWorkspaceConfig } from "@storm-software/config/types";
15
- import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
16
- import { AssetGlob } from "@stryke/types/file";
17
- import { PreviewOptions, ResolvedPreviewOptions } from "vite";
18
- import { ResolveOptions } from "@stryke/fs/resolve";
19
- import { ArrayValues } from "@stryke/types/array";
20
- import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
21
- import ts from "typescript";
22
-
23
- //#region ../powerlines/src/types/build.d.ts
24
- type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
25
- interface BuildConfig {
26
- /**
27
- * The platform to build the project for
28
- *
29
- * @defaultValue "neutral"
30
- */
31
- platform?: "node" | "browser" | "neutral";
32
- /**
33
- * Array of strings indicating the polyfills to include for the build.
34
- *
35
- * @remarks
36
- * 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).
37
- *
38
- * @example
39
- * ```ts
40
- * {
41
- * polyfill: ['{projectRoot}/custom-polyfill.ts']
42
- * }
43
- * ```
44
- */
45
- polyfill?: string[];
46
- /**
47
- * 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.
48
- *
49
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
50
- */
51
- mainFields?: string[];
52
- /**
53
- * Array of strings indicating what conditions should be used for module resolution.
54
- */
55
- conditions?: string[];
56
- /**
57
- * Array of strings indicating what file extensions should be used for module resolution.
58
- *
59
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
60
- */
61
- extensions?: string[];
62
- /**
63
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
64
- *
65
- * @remarks
66
- * 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.
67
- */
68
- dedupe?: string[];
69
- /**
70
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
71
- */
72
- builtins?: (string | RegExp)[];
73
- /**
74
- * Define global variable replacements.
75
- *
76
- * @remarks
77
- * 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.
78
- *
79
- * @example
80
- * ```ts
81
- * {
82
- * define: {
83
- * __VERSION__: '"1.0.0"',
84
- * __DEV__: 'process.env.NODE_ENV !== "production"'
85
- * }
86
- * }
87
- * ```
88
- *
89
- * @see https://esbuild.github.io/api/#define
90
- * @see https://vitejs.dev/config/build-options.html#define
91
- * @see https://github.com/rollup/plugins/tree/master/packages/replace
92
- */
93
- define?: Record<string, any>;
94
- /**
95
- * Global variables that will have import statements injected where necessary
96
- *
97
- * @remarks
98
- * 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.
99
- *
100
- * @example
101
- * ```ts
102
- * {
103
- * inject: {
104
- * process: 'process/browser',
105
- * Buffer: ['buffer', 'Buffer'],
106
- * }
107
- * }
108
- * ```
109
- *
110
- * @see https://github.com/rollup/plugins/tree/master/packages/inject
111
- */
112
- inject?: Record<string, string | string[]>;
113
- /**
114
- * The alias mappings to use for module resolution during the build process.
115
- *
116
- * @remarks
117
- * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
118
- *
119
- * @example
120
- * ```ts
121
- * {
122
- * alias: {
123
- * "@utils": "./src/utils",
124
- * "@components": "./src/components"
125
- * }
126
- * }
127
- * ```
128
- *
129
- * @see https://github.com/rollup/plugins/tree/master/packages/alias
130
- */
131
- alias?: Record<string, string> | Array<{
132
- find: string | RegExp;
133
- replacement: string;
134
- }>;
135
- /**
136
- * A list of modules that should not be bundled, even if they are external dependencies.
137
- *
138
- * @remarks
139
- * 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.
140
- */
141
- external?: (string | RegExp)[];
142
- /**
143
- * A list of modules that should always be bundled, even if they are external dependencies.
144
- */
145
- noExternal?: (string | RegExp)[];
146
- /**
147
- * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
148
- */
149
- skipNodeModulesBundle?: boolean;
150
- /**
151
- * 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.
152
- *
153
- * @defaultValue false
154
- */
155
- keepProcessEnv?: boolean;
156
- /**
157
- * An optional set of override options to apply to the selected build variant.
158
- *
159
- * @remarks
160
- * 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.
161
- */
162
- override?: Record<string, any>;
163
- }
164
- type BuildResolvedConfig = Omit<BuildConfig, "override">;
165
- //#endregion
166
- //#region ../powerlines/src/types/fs.d.ts
167
- type StoragePreset = "fs" | "virtual";
168
- /**
169
- * Interface defining the methods and properties for a storage adapter.
170
- */
171
- interface StorageAdapter {
172
- /**
173
- * A name identifying the storage adapter type.
174
- */
175
- name: string;
176
- /**
177
- * Checks if a key exists in the storage.
178
- *
179
- * @param key - The key to check for existence.
180
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
181
- */
182
- exists: (key: string) => Promise<boolean>;
183
- /**
184
- * Synchronously checks if a key exists in the storage.
185
- *
186
- * @param key - The key to check for existence.
187
- * @returns Returns `true` if the key exists, otherwise `false`.
188
- */
189
- existsSync: (key: string) => boolean;
190
- /**
191
- * Read a value associated with a key from the storage.
192
- *
193
- * @param key - The key to read the value for.
194
- * @returns A promise that resolves to the value if found, otherwise `null`.
195
- */
196
- get: (key: string) => Promise<string | null>;
197
- /**
198
- * Synchronously reads the value associated with a key from the storage.
199
- *
200
- * @param key - The key to read the value for.
201
- * @returns The value if found, otherwise `null`.
202
- */
203
- getSync: (key: string) => string | null;
204
- /**
205
- * Writes a value to the storage for the given key.
206
- *
207
- * @param key - The key to associate the value with.
208
- * @param value - The value to store.
209
- */
210
- set: (key: string, value: string) => Promise<void>;
211
- /**
212
- * Synchronously writes a value to the storage for the given key.
213
- *
214
- * @param key - The key to associate the value with.
215
- * @param value - The value to store.
216
- */
217
- setSync: (key: string, value: string) => void;
218
- /**
219
- * Removes a value from the storage.
220
- *
221
- * @param key - The key whose value should be removed.
222
- */
223
- remove: (key: string) => Promise<void>;
224
- /**
225
- * Synchronously removes a value from the storage.
226
- *
227
- * @param key - The key whose value should be removed.
228
- */
229
- removeSync: (key: string) => void;
230
- /**
231
- * Creates a directory at the specified path.
232
- *
233
- * @param dirPath - The path of the directory to create.
234
- */
235
- mkdir: (dirPath: string) => Promise<void>;
236
- /**
237
- * Synchronously creates a directory at the specified path.
238
- *
239
- * @param dirPath - The path of the directory to create.
240
- */
241
- mkdirSync: (dirPath: string) => void;
242
- /**
243
- * Remove all entries from the storage that match the provided base path.
244
- *
245
- * @param base - The base path or prefix to clear entries from.
246
- */
247
- clear: (base?: string) => Promise<void>;
248
- /**
249
- * Synchronously remove all entries from the storage that match the provided base path.
250
- *
251
- * @param base - The base path or prefix to clear entries from.
252
- */
253
- clearSync: (base?: string) => void;
254
- /**
255
- * Lists all keys under the provided base path.
256
- *
257
- * @param base - The base path or prefix to list keys from.
258
- * @returns A promise resolving to the list of keys.
259
- */
260
- list: (base?: string) => Promise<string[]>;
261
- /**
262
- * Synchronously lists all keys under the provided base path.
263
- *
264
- * @param base - The base path or prefix to list keys from.
265
- * @returns The list of keys.
266
- */
267
- listSync: (base?: string) => string[];
268
- /**
269
- * Checks if the given key is a directory.
270
- *
271
- * @param key - The key to check.
272
- * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
273
- */
274
- isDirectory: (key: string) => Promise<boolean>;
275
- /**
276
- * Synchronously checks if the given key is a directory.
277
- *
278
- * @param key - The key to check.
279
- * @returns `true` if the key is a directory, otherwise `false`.
280
- */
281
- isDirectorySync: (key: string) => boolean;
282
- /**
283
- * Checks if the given key is a file.
284
- *
285
- * @param key - The key to check.
286
- * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
287
- */
288
- isFile: (key: string) => Promise<boolean>;
289
- /**
290
- * Synchronously checks if the given key is a file.
291
- *
292
- * @param key - The key to check.
293
- * @returns `true` if the key is a file, otherwise `false`.
294
- */
295
- isFileSync: (key: string) => boolean;
296
- /**
297
- * Releases any resources held by the storage adapter.
298
- */
299
- dispose: () => MaybePromise<void>;
300
- }
301
- /**
302
- * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
303
- */
304
- type StoragePort = Record<string, StorageAdapter>;
305
- interface VirtualFileMetadata {
306
- /**
307
- * The identifier for the file data.
308
- */
309
- id: string;
310
- /**
311
- * The timestamp of the virtual file.
312
- */
313
- timestamp: number;
314
- /**
315
- * The type of the file.
316
- *
317
- * @remarks
318
- * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
319
- * - `builtin`: Indicates that the file is a built-in module provided by the system.
320
- * - `entry`: Indicates that the file is an entry point for execution.
321
- * - `normal`: Indicates that the file is a standard file without any special role.
322
- */
323
- type: string;
324
- /**
325
- * Additional metadata associated with the file.
326
- */
327
- properties: Record<string, string | undefined>;
328
- }
329
- interface VirtualFileData {
330
- /**
331
- * The identifier for the file data.
332
- */
333
- id?: string;
334
- /**
335
- * The contents of the virtual file.
336
- */
337
- code: string;
338
- /**
339
- * The type of the file.
340
- *
341
- * @remarks
342
- * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
343
- * - `builtin`: Indicates that the file is a built-in module provided by the system.
344
- * - `entry`: Indicates that the file is an entry point for execution.
345
- * - `normal`: Indicates that the file is a standard file without any special role.
346
- */
347
- type?: string;
348
- /**
349
- * Additional metadata associated with the file.
350
- */
351
- properties?: Record<string, string | undefined>;
352
- }
353
- interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
354
- /**
355
- * An additional name for the file.
356
- */
357
- path: string;
358
- /**
359
- * The timestamp of the virtual file.
360
- */
361
- timestamp: number;
362
- }
363
- interface WriteOptions {
364
- /**
365
- * Should the file skip formatting before being written?
366
- *
367
- * @defaultValue false
368
- */
369
- skipFormat?: boolean;
370
- /**
371
- * Additional metadata for the file.
372
- */
373
- meta?: Partial<VirtualFileMetadata>;
374
- }
375
- interface ResolveOptions$1 extends ResolveOptions {
376
- /**
377
- * If true, the module is being resolved as an entry point.
378
- */
379
- isEntry?: boolean;
380
- /**
381
- * If true, the resolver will skip using the cache when resolving modules.
382
- */
383
- skipCache?: boolean;
384
- /**
385
- * An array of external modules or patterns to exclude from resolution.
386
- */
387
- external?: (string | RegExp)[];
388
- /**
389
- * An array of modules or patterns to include in the resolution, even if they are marked as external.
390
- */
391
- noExternal?: (string | RegExp)[];
392
- /**
393
- * An array of patterns to match when resolving modules.
394
- */
395
- skipNodeModulesBundle?: boolean;
396
- }
397
- interface VirtualFileSystemInterface {
398
- /**
399
- * The underlying file metadata.
400
- */
401
- metadata: Readonly<Record<string, VirtualFileMetadata>>;
402
- /**
403
- * A map of file paths to their module ids.
404
- */
405
- ids: Readonly<Record<string, string>>;
406
- /**
407
- * A map of module ids to their file paths.
408
- */
409
- paths: Readonly<Record<string, string>>;
410
- /**
411
- * Checks if a file exists in the virtual file system (VFS).
412
- *
413
- * @param path - The path or id of the file.
414
- * @returns `true` if the file exists, otherwise `false`.
415
- */
416
- exists: (path: string) => Promise<boolean>;
417
- /**
418
- * Synchronously Checks if a file exists in the virtual file system (VFS).
419
- *
420
- * @param path - The path or id of the file.
421
- * @returns `true` if the file exists, otherwise `false`.
422
- */
423
- existsSync: (path: string) => boolean;
424
- /**
425
- * Checks if a file is virtual in the virtual file system (VFS).
426
- *
427
- * @param path - The path or id of the file.
428
- * @returns `true` if the file is virtual, otherwise `false`.
429
- */
430
- isVirtual: (path: string) => boolean;
431
- /**
432
- * Checks if the given key is a directory.
433
- *
434
- * @param key - The key to check.
435
- * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
436
- */
437
- isDirectory: (key: string) => Promise<boolean>;
438
- /**
439
- * Synchronously checks if the given key is a directory.
440
- *
441
- * @param key - The key to check.
442
- * @returns `true` if the key is a directory, otherwise `false`.
443
- */
444
- isDirectorySync: (key: string) => boolean;
445
- /**
446
- * Checks if the given key is a file.
447
- *
448
- * @param key - The key to check.
449
- * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
450
- */
451
- isFile: (key: string) => Promise<boolean>;
452
- /**
453
- * Synchronously checks if the given key is a file.
454
- *
455
- * @param key - The key to check.
456
- * @returns `true` if the key is a file, otherwise `false`.
457
- */
458
- isFileSync: (key: string) => boolean;
459
- /**
460
- * Gets the metadata of a file in the virtual file system (VFS).
461
- *
462
- * @param path - The path or id of the file.
463
- * @returns The metadata of the file if it exists, otherwise undefined.
464
- */
465
- getMetadata: (path: string) => VirtualFileMetadata | undefined;
466
- /**
467
- * Lists files in a given path.
468
- *
469
- * @param path - The path to list files from.
470
- * @returns An array of file names in the specified path.
471
- */
472
- listSync: (path: string) => string[];
473
- /**
474
- * Lists files in a given path.
475
- *
476
- * @param path - The path to list files from.
477
- * @returns An array of file names in the specified path.
478
- */
479
- list: (path: string) => Promise<string[]>;
480
- /**
481
- * Removes a file or symbolic link in the virtual file system (VFS).
482
- *
483
- * @param path - The path to the file to remove.
484
- * @returns A promise that resolves when the file is removed.
485
- */
486
- removeSync: (path: string) => void;
487
- /**
488
- * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
489
- *
490
- * @param path - The path to the file to remove.
491
- * @returns A promise that resolves when the file is removed.
492
- */
493
- remove: (path: string) => Promise<void>;
494
- /**
495
- * Reads a file from the virtual file system (VFS).
496
- *
497
- * @param path - The path or id of the file.
498
- * @returns The contents of the file if it exists, otherwise undefined.
499
- */
500
- read: (path: string) => Promise<string | undefined>;
501
- /**
502
- * Reads a file from the virtual file system (VFS).
503
- *
504
- * @param path - The path or id of the file.
505
- */
506
- readSync: (path: string) => string | undefined;
507
- /**
508
- * Writes a file to the virtual file system (VFS).
509
- *
510
- * @param path - The path to the file.
511
- * @param data - The contents of the file.
512
- * @param options - Options for writing the file.
513
- * @returns A promise that resolves when the file is written.
514
- */
515
- write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
516
- /**
517
- * Writes a file to the virtual file system (VFS).
518
- *
519
- * @param path - The path to the file.
520
- * @param data - The contents of the file.
521
- * @param options - Options for writing the file.
522
- */
523
- writeSync: (path: string, data: string, options?: WriteOptions) => void;
524
- /**
525
- * Creates a directory at the specified path.
526
- *
527
- * @param dirPath - The path of the directory to create.
528
- */
529
- mkdir: (dirPath: string) => Promise<void>;
530
- /**
531
- * Synchronously creates a directory at the specified path.
532
- *
533
- * @param dirPath - The path of the directory to create.
534
- */
535
- mkdirSync: (dirPath: string) => void;
536
- /**
537
- * Moves a file from one path to another in the virtual file system (VFS).
538
- *
539
- * @param srcPath - The source path to move
540
- * @param destPath - The destination path to move to
541
- */
542
- move: (srcPath: string, destPath: string) => Promise<void>;
543
- /**
544
- * Synchronously moves a file from one path to another in the virtual file system (VFS).
545
- *
546
- * @param srcPath - The source path to move
547
- * @param destPath - The destination path to move to
548
- */
549
- moveSync: (srcPath: string, destPath: string) => void;
550
- /**
551
- * Copies a file from one path to another in the virtual file system (VFS).
552
- *
553
- * @param srcPath - The source path to copy
554
- * @param destPath - The destination path to copy to
555
- */
556
- copy: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => Promise<void>;
557
- /**
558
- * Synchronously copies a file from one path to another in the virtual file system (VFS).
559
- *
560
- * @param srcPath - The source path to copy
561
- * @param destPath - The destination path to copy to
562
- */
563
- copySync: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => void;
564
- /**
565
- * Glob files in the virtual file system (VFS) based on the provided pattern(s).
566
- *
567
- * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
568
- * @returns An array of file paths matching the provided pattern(s)
569
- */
570
- glob: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => Promise<string[]>;
571
- /**
572
- * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
573
- *
574
- * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
575
- * @returns An array of file paths matching the provided pattern(s)
576
- */
577
- globSync: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => string[];
578
- /**
579
- * A helper function to resolve modules using the Jiti resolver
580
- *
581
- * @remarks
582
- * This function can be used to resolve modules relative to the project root directory.
583
- *
584
- * @example
585
- * ```ts
586
- * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
587
- * ```
588
- *
589
- * @param id - The module to resolve.
590
- * @param importer - An optional path to the importer module.
591
- * @param options - Additional resolution options.
592
- * @returns A promise that resolves to the resolved module path.
593
- */
594
- resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<string | undefined>;
595
- /**
596
- * A synchronous helper function to resolve modules using the Jiti resolver
597
- *
598
- * @remarks
599
- * This function can be used to resolve modules relative to the project root directory.
600
- *
601
- * @example
602
- * ```ts
603
- * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
604
- * ```
605
- *
606
- * @param id - The module to resolve.
607
- * @param importer - An optional path to the importer module.
608
- * @param options - Additional resolution options.
609
- * @returns The resolved module path.
610
- */
611
- resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
612
- /**
613
- * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
614
- */
615
- dispose: () => Promise<void>;
616
- }
617
- //#endregion
618
- //#region ../powerlines/src/types/commands.d.ts
619
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
620
- type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
621
- //#endregion
622
- //#region ../powerlines/src/types/resolved.d.ts
623
- interface ResolvedEntryTypeDefinition extends TypeDefinition {
624
- /**
625
- * The user provided entry point in the source code
626
- */
627
- input?: TypeDefinition;
628
- /**
629
- * An optional name to use in the package export during the build process
630
- */
631
- output?: string;
632
- }
633
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
634
- /**
635
- * The name of the environment
636
- */
637
- name: string;
638
- /**
639
- * Configuration options for the preview server
640
- */
641
- preview?: ResolvedPreviewOptions;
642
- };
643
- type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
644
- type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
645
- assets: ResolvedAssetGlob[];
646
- }> & Pick<OutputConfig, "storage">;
647
- /**
648
- * The resolved options for the Powerlines project configuration.
649
- */
650
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
651
- /**
652
- * The configuration options that were provided inline to the Powerlines CLI.
653
- */
654
- inlineConfig: InlineConfig<TUserConfig>;
655
- /**
656
- * The original configuration options that were provided by the user to the Powerlines process.
657
- */
658
- userConfig: TUserConfig;
659
- /**
660
- * A string identifier for the Powerlines command being executed.
661
- */
662
- command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
663
- /**
664
- * The root directory of the project's source code
665
- *
666
- * @defaultValue "\{projectRoot\}/src"
667
- */
668
- sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
669
- /**
670
- * The root directory of the project.
671
- */
672
- projectRoot: NonUndefined<TUserConfig["root"]>;
673
- /**
674
- * The type of project being built.
675
- */
676
- projectType: NonUndefined<TUserConfig["type"]>;
677
- /**
678
- * The output configuration options to use for the build process
679
- */
680
- output: OutputResolvedConfig;
681
- /**
682
- * Configuration provided to build processes
683
- *
684
- * @remarks
685
- * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
686
- */
687
- build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
688
- /**
689
- * The log level to use for the Powerlines processes.
690
- *
691
- * @defaultValue "info"
692
- */
693
- logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
694
- };
695
- //#endregion
696
- //#region ../powerlines/src/types/plugin.d.ts
697
- interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
698
- /**
699
- * The order in which the plugin should be applied.
700
- */
701
- order?: "pre" | "post" | null | undefined;
702
- /**
703
- * A filter to determine when the hook should be called.
704
- */
705
- filter?: Pick<HookFilter, TFilter>;
706
- /**
707
- * The hook function to be called.
708
- */
709
- handler: THookFunction;
710
- }
711
- type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
712
- /**
713
- * A result returned by the plugin from the `types` hook that describes the declaration types output file.
714
- */
715
- interface TypesResult {
716
- directives?: string[];
717
- code: string;
718
- }
719
- type DeepPartial$1<T> = { [K in keyof T]?: DeepPartial$1<T[K]> };
720
- type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial$1<TContext["config"]> & Record<string, any>;
721
- interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
722
- /**
723
- * A function that returns configuration options to be merged with the build context's options.
724
- *
725
- * @remarks
726
- * 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.
727
- *
728
- * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
729
- *
730
- * @see https://vitejs.dev/guide/api-plugin#config
731
- *
732
- * @param this - The build context.
733
- * @param config - The partial configuration object to be modified.
734
- * @returns A promise that resolves to a partial configuration object.
735
- */
736
- config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
737
- /**
738
- * 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.
739
- *
740
- * @remarks
741
- * 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.
742
- *
743
- * @see https://vitejs.dev/guide/api-plugin#configenvironment
744
- *
745
- * @param this - The build context.
746
- * @param name - The name of the environment being configured.
747
- * @param environment - The Vite-like environment object containing information about the current build environment.
748
- * @returns A promise that resolves when the hook is complete.
749
- */
750
- configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
751
- /**
752
- * A hook that is called when the plugin is resolved.
753
- *
754
- * @see https://vitejs.dev/guide/api-plugin#configresolved
755
- *
756
- * @param this - The build context.
757
- * @returns A promise that resolves when the hook is complete.
758
- */
759
- configResolved: (this: TContext) => MaybePromise<void>;
760
- /**
761
- * 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.
762
- *
763
- * @param this - The build context.
764
- * @param code - The source code to generate types for.
765
- * @returns A promise that resolves when the hook is complete.
766
- */
767
- types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
768
- /**
769
- * A hook that is called at the start of the build process.
770
- *
771
- * @param this - The build context and unplugin build context.
772
- * @returns A promise that resolves when the hook is complete.
773
- */
774
- buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
775
- /**
776
- * A hook that is called at the end of the build process.
777
- *
778
- * @param this - The build context and unplugin build context.
779
- * @returns A promise that resolves when the hook is complete.
780
- */
781
- buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
782
- /**
783
- * A hook that is called to transform the source code.
784
- *
785
- * @param this - The build context, unplugin build context, and unplugin context.
786
- * @param code - The source code to transform.
787
- * @param id - The identifier of the source code.
788
- * @returns A promise that resolves when the hook is complete.
789
- */
790
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
791
- /**
792
- * A hook that is called to load the source code.
793
- *
794
- * @param this - The build context, unplugin build context, and unplugin context.
795
- * @param id - The identifier of the source code.
796
- * @returns A promise that resolves when the hook is complete.
797
- */
798
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
799
- /**
800
- * A hook that is called to resolve the identifier of the source code.
801
- *
802
- * @param this - The build context, unplugin build context, and unplugin context.
803
- * @param id - The identifier of the source code.
804
- * @param importer - The importer of the source code.
805
- * @param options - The options for resolving the identifier.
806
- * @returns A promise that resolves when the hook is complete.
807
- */
808
- resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
809
- isEntry: boolean;
810
- }) => MaybePromise<string | ExternalIdResult | null | undefined>;
811
- /**
812
- * A hook that is called to write the bundle to disk.
813
- *
814
- * @param this - The build context.
815
- * @returns A promise that resolves when the hook is complete.
816
- */
817
- writeBundle: (this: TContext) => MaybePromise<void>;
818
- }
819
- type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant$1 extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant$1] = Required<UnpluginOptions>[TBuildVariant$1]> = { [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey] };
820
- type PluginHooks<TContext extends PluginContext = PluginContext> = { [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]> } & {
821
- /**
822
- * A function that returns configuration options to be merged with the build context's options.
823
- *
824
- * @remarks
825
- * 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.
826
- *
827
- * @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.
828
- *
829
- * @see https://vitejs.dev/guide/api-plugin#config
830
- *
831
- * @param this - The build context.
832
- * @param config - The partial configuration object to be modified.
833
- * @returns A promise that resolves to a partial configuration object.
834
- */
835
- config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
836
- /**
837
- * A hook that is called to transform the source code.
838
- *
839
- * @param this - The build context, unplugin build context, and unplugin context.
840
- * @param code - The source code to transform.
841
- * @param id - The identifier of the source code.
842
- * @returns A promise that resolves when the hook is complete.
843
- */
844
- transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
845
- /**
846
- * A hook that is called to load the source code.
847
- *
848
- * @param this - The build context, unplugin build context, and unplugin context.
849
- * @param id - The identifier of the source code.
850
- * @returns A promise that resolves when the hook is complete.
851
- */
852
- load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
853
- /**
854
- * A hook that is called to resolve the identifier of the source code.
855
- *
856
- * @param this - The build context, unplugin build context, and unplugin context.
857
- * @param id - The identifier of the source code.
858
- * @param importer - The importer of the source code.
859
- * @param options - The options for resolving the identifier.
860
- * @returns A promise that resolves when the hook is complete.
861
- */
862
- resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
863
- isEntry: boolean;
864
- }) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
865
- };
866
- type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = { [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant> };
867
- interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
868
- /**
869
- * The name of the plugin, for use in deduplication, error messages and logs.
870
- */
871
- name: string;
872
- /**
873
- * An API object that can be used for inter-plugin communication.
874
- *
875
- * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
876
- */
877
- api?: Record<string, any>;
878
- /**
879
- * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
880
- *
881
- * @remarks
882
- * The Plugin invocation order is as follows:
883
- * - `enforce: 'pre'` plugins
884
- * - `order: 'pre'` plugin hooks
885
- * - any other plugins (normal)
886
- * - `order: 'post'` plugin hooks
887
- * - `enforce: 'post'` plugins
888
- *
889
- * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
890
- * @see https://rollupjs.org/plugin-development/#build-hooks
891
- * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
892
- * @see https://esbuild.github.io/plugins/#concepts
893
- */
894
- enforce?: "pre" | "post";
895
- /**
896
- * A function to determine if two plugins are the same and can be de-duplicated.
897
- *
898
- * @remarks
899
- * If this is not provided, plugins are de-duplicated by comparing their names.
900
- *
901
- * @param other - The other plugin to compare against.
902
- * @returns `true` if the two plugins are the same, `false` otherwise.
903
- */
904
- dedupe?: false | ((other: Plugin<any>) => boolean);
905
- /**
906
- * A list of pre-requisite plugins that must be loaded before this plugin can be used.
907
- */
908
- /**
909
- * Define environments where this plugin should be active. By default, the plugin is active in all environments.
910
- *
911
- * @param environment - The environment to check.
912
- * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
913
- */
914
- applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
915
- }
916
- //#endregion
917
- //#region ../powerlines/src/types/tsconfig.d.ts
918
- type ReflectionMode = "default" | "explicit" | "never";
919
- type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
920
- /**
921
- * Defines the level of reflection to be used during the transpilation process.
922
- *
923
- * @remarks
924
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
925
- * - `minimal` - Only the essential type information is captured.
926
- * - `normal` - Additional type information is captured, including some contextual data.
927
- * - `verbose` - All available type information is captured, including detailed contextual data.
928
- */
929
- type ReflectionLevel = "minimal" | "normal" | "verbose";
930
- interface DeepkitOptions {
931
- /**
932
- * Either true to activate reflection for all files compiled using this tsconfig,
933
- * or a list of globs/file paths relative to this tsconfig.json.
934
- * Globs/file paths can be prefixed with a ! to exclude them.
935
- */
936
- reflection?: RawReflectionMode;
937
- /**
938
- * Defines the level of reflection to be used during the transpilation process.
939
- *
940
- * @remarks
941
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
942
- * - `minimal` - Only the essential type information is captured.
943
- * - `normal` - Additional type information is captured, including some contextual data.
944
- * - `verbose` - All available type information is captured, including detailed contextual data.
945
- */
946
- reflectionLevel?: ReflectionLevel;
947
- }
948
- type TSCompilerOptions = CompilerOptions & DeepkitOptions;
949
- /**
950
- * The TypeScript compiler configuration.
951
- *
952
- * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
953
- */
954
- interface TSConfig extends Omit<TsConfigJson, "reflection"> {
955
- /**
956
- * Either true to activate reflection for all files compiled using this tsconfig,
957
- * or a list of globs/file paths relative to this tsconfig.json.
958
- * Globs/file paths can be prefixed with a ! to exclude them.
959
- */
960
- reflection?: RawReflectionMode;
961
- /**
962
- * Defines the level of reflection to be used during the transpilation process.
963
- *
964
- * @remarks
965
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
966
- * - `minimal` - Only the essential type information is captured.
967
- * - `normal` - Additional type information is captured, including some contextual data.
968
- * - `verbose` - All available type information is captured, including detailed contextual data.
969
- */
970
- reflectionLevel?: ReflectionLevel;
971
- /**
972
- * Instructs the TypeScript compiler how to compile `.ts` files.
973
- */
974
- compilerOptions?: TSCompilerOptions;
975
- }
976
- type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
977
- originalTsconfigJson: TsConfigJson;
978
- tsconfigJson: TSConfig;
979
- tsconfigFilePath: string;
980
- };
981
- //#endregion
982
- //#region ../powerlines/src/types/config.d.ts
983
- type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
984
- /**
985
- * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
986
- */
987
- type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
988
- type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext> | Plugin<TContext>[]>;
989
- /**
990
- * A configuration tuple for a Powerlines plugin.
991
- */
992
- type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
993
- /**
994
- * A configuration object for a Powerlines plugin.
995
- */
996
- type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
997
- plugin: string | PluginFactory<TContext, TOptions>;
998
- options: TOptions;
999
- } | {
1000
- plugin: Plugin<TContext>;
1001
- options?: never;
1002
- };
1003
- /**
1004
- * A configuration tuple for a Powerlines plugin.
1005
- */
1006
- type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
1007
- type ProjectType = "application" | "library";
1008
- interface DeployConfig {
1009
- /**
1010
- * The deployment variant being used by the Powerlines engine.
1011
- *
1012
- * @example
1013
- * ```ts
1014
- * export default defineConfig({
1015
- * deploy: {
1016
- * variant: "cloudflare"
1017
- * }
1018
- * });
1019
- *
1020
- * ```
1021
- */
1022
- variant?: string;
1023
- }
1024
- interface OutputConfig {
1025
- /**
1026
- * The path to output the final compiled files to
1027
- *
1028
- * @remarks
1029
- * If a value is not provided, Powerlines will attempt to:
1030
- * 1. Use the `outDir` value in the `tsconfig.json` file.
1031
- * 2. Use the `dist` directory in the project root directory.
1032
- *
1033
- * @defaultValue "dist/\{projectRoot\}"
1034
- */
1035
- outputPath?: string;
1036
- /**
1037
- * The output directory path for the project build.
1038
- *
1039
- * @remarks
1040
- * This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
1041
- *
1042
- * @defaultValue "\{projectRoot\}/dist"
1043
- */
1044
- buildPath?: string;
1045
- /**
1046
- * The folder where the generated runtime artifacts will be located
1047
- *
1048
- * @remarks
1049
- * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
1050
- *
1051
- * @defaultValue "\{projectRoot\}/.powerlines"
1052
- */
1053
- artifactsPath?: string;
1054
- /**
1055
- * The path of the generated runtime declaration file relative to the workspace root.
1056
- *
1057
- * @defaultValue "\{projectRoot\}/powerlines.d.ts"
1058
- */
1059
- dts?: string | false;
1060
- /**
1061
- * A prefix to use for identifying builtin modules
1062
- *
1063
- * @remarks
1064
- * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
1065
- *
1066
- * @defaultValue "powerlines"
1067
- */
1068
- builtinPrefix?: string;
1069
- /**
1070
- * The module format of the output files
1071
- *
1072
- * @remarks
1073
- * This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
1074
- *
1075
- * @defaultValue "esm"
1076
- */
1077
- format?: Format | Format[];
1078
- /**
1079
- * A list of assets to copy to the output directory
1080
- *
1081
- * @remarks
1082
- * The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
1083
- */
1084
- assets?: Array<string | AssetGlob>;
1085
- /**
1086
- * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
1087
- *
1088
- * @remarks
1089
- * If a string preset is provided, it must be one of the following values:
1090
- * - `"virtual"`: Uses the local file system for storage.
1091
- * - `"fs"`: Uses an in-memory virtual file system for storage.
1092
- *
1093
- * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
1094
- *
1095
- * @defaultValue "virtual"
1096
- */
1097
- storage?: StoragePort | StoragePreset;
1098
- }
1099
- interface BaseConfig {
1100
- /**
1101
- * The entry point(s) for the application
1102
- */
1103
- entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
1104
- /**
1105
- * Configuration for the output of the build process
1106
- */
1107
- output?: OutputConfig;
1108
- /**
1109
- * Configuration for cleaning the build artifacts
1110
- *
1111
- * @remarks
1112
- * If set to `false`, the cleaning process will be disabled.
1113
- */
1114
- clean?: Record<string, any> | false;
1115
- /**
1116
- * Configuration for linting the source code
1117
- *
1118
- * @remarks
1119
- * If set to `false`, linting will be disabled.
1120
- */
1121
- lint?: Record<string, any> | false;
1122
- /**
1123
- * Configuration for testing the source code
1124
- *
1125
- * @remarks
1126
- * If set to `false`, testing will be disabled.
1127
- */
1128
- test?: Record<string, any> | false;
1129
- /**
1130
- * Configuration for the transformation of the source code
1131
- */
1132
- transform?: Record<string, any>;
1133
- /**
1134
- * Configuration provided to build processes
1135
- *
1136
- * @remarks
1137
- * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1138
- */
1139
- build?: BuildConfig;
1140
- /**
1141
- * Configuration for documentation generation
1142
- *
1143
- * @remarks
1144
- * This configuration will be used by the documentation generation plugins during the `docs` command.
1145
- */
1146
- docs?: Record<string, any>;
1147
- /**
1148
- * Configuration for deploying the source code
1149
- *
1150
- * @remarks
1151
- * If set to `false`, the deployment will be disabled.
1152
- */
1153
- deploy?: DeployConfig | false;
1154
- /**
1155
- * The path to the tsconfig file to be used by the compiler
1156
- *
1157
- * @remarks
1158
- * If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
1159
- *
1160
- * @defaultValue "\{projectRoot\}/tsconfig.json"
1161
- */
1162
- tsconfig?: string;
1163
- /**
1164
- * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
1165
- *
1166
- * @see https://www.typescriptlang.org/tsconfig
1167
- *
1168
- * @remarks
1169
- * If populated, this option takes higher priority than `tsconfig`
1170
- */
1171
- tsconfigRaw?: TSConfig;
1172
- }
1173
- interface EnvironmentConfig extends BaseConfig {
1174
- /**
1175
- * Configuration options for the preview server
1176
- */
1177
- preview?: PreviewOptions;
1178
- /**
1179
- * A flag indicating whether the build is for a Server-Side Rendering environment.
1180
- */
1181
- ssr?: boolean;
1182
- /**
1183
- * Define if this environment is used for Server-Side Rendering
1184
- *
1185
- * @defaultValue "server" (if it isn't the client environment)
1186
- */
1187
- consumer?: "client" | "server";
1188
- }
1189
- interface CommonUserConfig extends BaseConfig {
1190
- /**
1191
- * The name of the project
1192
- */
1193
- name?: string;
1194
- /**
1195
- * The project display title
1196
- *
1197
- * @remarks
1198
- * This option is used in documentation generation and other places where a human-readable title is needed.
1199
- */
1200
- title?: string;
1201
- /**
1202
- * A description of the project
1203
- *
1204
- * @remarks
1205
- * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
1206
- */
1207
- description?: string;
1208
- /**
1209
- * The log level to use for the Powerlines processes.
1210
- *
1211
- * @defaultValue "info"
1212
- */
1213
- logLevel?: LogLevelLabel | null;
1214
- /**
1215
- * A custom logger function to use for logging messages
1216
- */
1217
- customLogger?: LogFn;
1218
- /**
1219
- * Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
1220
- *
1221
- * @defaultValue "production"
1222
- */
1223
- mode?: "development" | "test" | "production";
1224
- /**
1225
- * The type of project being built
1226
- *
1227
- * @defaultValue "application"
1228
- */
1229
- type?: ProjectType;
1230
- /**
1231
- * The root directory of the project
1232
- */
1233
- root: string;
1234
- /**
1235
- * The root directory of the project's source code
1236
- *
1237
- * @defaultValue "\{root\}/src"
1238
- */
1239
- sourceRoot?: string;
1240
- /**
1241
- * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
1242
- *
1243
- * @remarks
1244
- * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
1245
- */
1246
- configFile?: string;
1247
- /**
1248
- * Should the Powerlines CLI processes skip installing missing packages?
1249
- *
1250
- * @remarks
1251
- * This option is useful for CI/CD environments where the installation of packages is handled by a different process.
1252
- *
1253
- * @defaultValue false
1254
- */
1255
- skipInstalls?: boolean;
1256
- /**
1257
- * Should the compiler processes skip any improvements that make use of cache?
1258
- *
1259
- * @defaultValue false
1260
- */
1261
- skipCache?: boolean;
1262
- /**
1263
- * A list of resolvable paths to plugins used during the build process
1264
- */
1265
- plugins?: PluginConfig<any>[];
1266
- /**
1267
- * Environment-specific configurations
1268
- */
1269
- environments?: Record<string, EnvironmentConfig>;
1270
- /**
1271
- * Should a single `build` process be ran for each environment?
1272
- *
1273
- * @remarks
1274
- * This option determines how environments are managed during the `build` process. The available options are:
1275
- *
1276
- * - `false`: A separate build is ran for each environment.
1277
- * - `true`: A single build is ran for all environments.
1278
- *
1279
- * @defaultValue false
1280
- */
1281
- singleBuild?: boolean;
1282
- /**
1283
- * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
1284
- *
1285
- * @remarks
1286
- * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
1287
- *
1288
- * @defaultValue "powerlines"
1289
- */
1290
- framework?: string;
1291
- }
1292
- interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant$1 extends string = any> extends Omit<CommonUserConfig, "build"> {
1293
- /**
1294
- * Configuration provided to build processes
1295
- *
1296
- * @remarks
1297
- * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1298
- */
1299
- build: Omit<TBuildConfig, "override"> & {
1300
- /**
1301
- * The build variant being used by the Powerlines engine.
1302
- */
1303
- variant?: TBuildVariant$1;
1304
- /**
1305
- * An optional set of override options to apply to the selected build variant.
1306
- *
1307
- * @remarks
1308
- * 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.
1309
- */
1310
- override?: Partial<TBuildResolvedConfig>;
1311
- };
1312
- }
1313
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
1314
- /**
1315
- * The configuration provided while executing Powerlines commands.
1316
- */
1317
- type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
1318
- /**
1319
- * A string identifier for the Powerlines command being executed
1320
- */
1321
- command: PowerlinesCommand;
1322
- };
1323
- //#endregion
1324
- //#region ../powerlines/src/types/context.d.ts
1325
- interface MetaInfo {
1326
- /**
1327
- * The checksum generated from the resolved options
1328
- */
1329
- checksum: string;
1330
- /**
1331
- * The build id
1332
- */
1333
- buildId: string;
1334
- /**
1335
- * The release id
1336
- */
1337
- releaseId: string;
1338
- /**
1339
- * The build timestamp
1340
- */
1341
- timestamp: number;
1342
- /**
1343
- * A hash that represents the path to the project root directory
1344
- */
1345
- projectRootHash: string;
1346
- /**
1347
- * A hash that represents the path to the project root directory
1348
- */
1349
- configHash: string;
1350
- }
1351
- interface Resolver extends Jiti {
1352
- plugin: Jiti;
1353
- }
1354
- interface TransformResult$1 {
1355
- code: string;
1356
- map: SourceMap | null;
1357
- }
1358
- /**
1359
- * Options for initializing or updating the context with new configuration values
1360
- */
1361
- interface InitContextOptions {
1362
- /**
1363
- * If false, the plugin will be loaded after all other plugins.
1364
- *
1365
- * @defaultValue true
1366
- */
1367
- isHighPriority: boolean;
1368
- }
1369
- /**
1370
- * Options for fetch requests made via the context's {@link Context.fetch} method
1371
- */
1372
- interface FetchOptions extends FetchRequestOptions {
1373
- /**
1374
- * An indicator specifying that the request should bypass any caching
1375
- */
1376
- skipCache?: boolean;
1377
- }
1378
- /**
1379
- * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
1380
- */
1381
- interface ParseOptions extends ParserOptions {
1382
- /**
1383
- * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1384
- */
1385
- allowReturnOutsideFunction?: boolean;
1386
- }
1387
- /**
1388
- * Options for emitting entry virtual files
1389
- */
1390
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
1391
- /**
1392
- * The unresolved Powerlines context.
1393
- *
1394
- * @remarks
1395
- * This context is used before the user configuration has been fully resolved after the `config`.
1396
- */
1397
- interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1398
- /**
1399
- * The Storm workspace configuration
1400
- */
1401
- workspaceConfig: WorkspaceConfig;
1402
- /**
1403
- * An object containing the options provided to Powerlines
1404
- */
1405
- config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1406
- projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1407
- sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1408
- output: TResolvedConfig["output"];
1409
- };
1410
- /**
1411
- * A logging function for the Powerlines engine
1412
- */
1413
- log: LogFn;
1414
- /**
1415
- * A logging function for fatal messages
1416
- */
1417
- fatal: (message: string | UnpluginMessage) => void;
1418
- /**
1419
- * A logging function for error messages
1420
- */
1421
- error: (message: string | UnpluginMessage) => void;
1422
- /**
1423
- * A logging function for warning messages
1424
- */
1425
- warn: (message: string | UnpluginMessage) => void;
1426
- /**
1427
- * A logging function for informational messages
1428
- */
1429
- info: (message: string | UnpluginMessage) => void;
1430
- /**
1431
- * A logging function for debug messages
1432
- */
1433
- debug: (message: string | UnpluginMessage) => void;
1434
- /**
1435
- * A logging function for trace messages
1436
- */
1437
- trace: (message: string | UnpluginMessage) => void;
1438
- /**
1439
- * The metadata information
1440
- */
1441
- meta: MetaInfo;
1442
- /**
1443
- * The metadata information currently written to disk
1444
- */
1445
- persistedMeta?: MetaInfo;
1446
- /**
1447
- * The Powerlines artifacts directory
1448
- */
1449
- artifactsPath: string;
1450
- /**
1451
- * The path to the Powerlines builtin runtime modules directory
1452
- */
1453
- builtinsPath: string;
1454
- /**
1455
- * The path to the Powerlines entry modules directory
1456
- */
1457
- entryPath: string;
1458
- /**
1459
- * The path to the Powerlines TypeScript declaration files directory
1460
- */
1461
- dtsPath: string;
1462
- /**
1463
- * The path to a directory where the reflection data buffers (used by the build processes) are stored
1464
- */
1465
- dataPath: string;
1466
- /**
1467
- * The path to a directory where the project cache (used by the build processes) is stored
1468
- */
1469
- cachePath: string;
1470
- /**
1471
- * The Powerlines environment paths
1472
- */
1473
- envPaths: EnvPaths;
1474
- /**
1475
- * The file system path to the Powerlines package installation
1476
- */
1477
- powerlinesPath: string;
1478
- /**
1479
- * The relative path to the Powerlines workspace root directory
1480
- */
1481
- relativeToWorkspaceRoot: string;
1482
- /**
1483
- * The project's `package.json` file content
1484
- */
1485
- packageJson: PackageJson & Record<string, any>;
1486
- /**
1487
- * The project's `project.json` file content
1488
- */
1489
- projectJson?: Record<string, any>;
1490
- /**
1491
- * The dependency installations required by the project
1492
- */
1493
- dependencies: Record<string, string | Range>;
1494
- /**
1495
- * The development dependency installations required by the project
1496
- */
1497
- devDependencies: Record<string, string | Range>;
1498
- /**
1499
- * The parsed TypeScript configuration from the `tsconfig.json` file
1500
- */
1501
- tsconfig: ParsedTypeScriptConfig;
1502
- /**
1503
- * The entry points of the source code
1504
- */
1505
- entry: ResolvedEntryTypeDefinition[];
1506
- /**
1507
- * The virtual file system manager used during the build process to reference generated runtime files
1508
- */
1509
- fs: VirtualFileSystemInterface;
1510
- /**
1511
- * The Jiti module resolver
1512
- */
1513
- resolver: Resolver;
1514
- /**
1515
- * The builtin module id that exist in the Powerlines virtual file system
1516
- */
1517
- builtins: string[];
1518
- /**
1519
- * The {@link Project} instance used for type reflection and module manipulation
1520
- *
1521
- * @see https://ts-morph.com/
1522
- *
1523
- * @remarks
1524
- * This instance is created lazily on first access.
1525
- */
1526
- program: Project;
1527
- /**
1528
- * A function to perform HTTP fetch requests
1529
- *
1530
- * @remarks
1531
- * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1532
- *
1533
- * @example
1534
- * ```ts
1535
- * const response = await context.fetch("https://api.example.com/data");
1536
- * const data = await response.json();
1537
- * ```
1538
- *
1539
- * @see https://github.com/nodejs/undici
1540
- *
1541
- * @param input - The URL to fetch.
1542
- * @param options - The fetch request options.
1543
- * @returns A promise that resolves to a response returned by the fetch.
1544
- */
1545
- fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1546
- /**
1547
- * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1548
- *
1549
- * @remarks
1550
- * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1551
- *
1552
- * @example
1553
- * ```ts
1554
- * const ast = context.parse("const x: number = 42;");
1555
- * ```
1556
- *
1557
- * @see https://rollupjs.org/plugin-development/#this-parse
1558
- * @see https://github.com/oxc/oxc
1559
- *
1560
- * @param code - The source code to parse.
1561
- * @param options - The options to pass to the parser.
1562
- * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1563
- */
1564
- parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1565
- /**
1566
- * A helper function to resolve modules using the Jiti resolver
1567
- *
1568
- * @remarks
1569
- * This function can be used to resolve modules relative to the project root directory.
1570
- *
1571
- * @example
1572
- * ```ts
1573
- * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1574
- * ```
1575
- *
1576
- * @param id - The module to resolve.
1577
- * @param importer - An optional path to the importer module.
1578
- * @param options - Additional resolution options.
1579
- * @returns A promise that resolves to the resolved module path.
1580
- */
1581
- resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<ExternalIdResult | undefined>;
1582
- /**
1583
- * A helper function to load modules using the Jiti resolver
1584
- *
1585
- * @remarks
1586
- * This function can be used to load modules relative to the project root directory.
1587
- *
1588
- * @example
1589
- * ```ts
1590
- * const module = await context.load("some-module", "/path/to/importer");
1591
- * ```
1592
- *
1593
- * @param id - The module to load.
1594
- * @returns A promise that resolves to the loaded module.
1595
- */
1596
- load: (id: string) => Promise<TransformResult$1 | undefined>;
1597
- /**
1598
- * The Powerlines builtin virtual files
1599
- */
1600
- getBuiltins: () => Promise<VirtualFile[]>;
1601
- /**
1602
- * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1603
- *
1604
- * @param code - The source code of the builtin file
1605
- * @param id - The unique identifier of the builtin file
1606
- * @param path - An optional path to write the builtin file to
1607
- * @param options - Additional options for writing the builtin file
1608
- */
1609
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
1610
- /**
1611
- * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1612
- *
1613
- * @param code - The source code of the entry file
1614
- * @param path - An optional path to write the entry file to
1615
- * @param options - Additional options for writing the entry file
1616
- */
1617
- emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
1618
- /**
1619
- * A function to update the context fields using a new user configuration options
1620
- */
1621
- withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1622
- /**
1623
- * A function to update the context fields using inline configuration options
1624
- */
1625
- withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1626
- /**
1627
- * Create a new logger instance
1628
- *
1629
- * @param name - The name to use for the logger instance
1630
- * @returns A logger function
1631
- */
1632
- createLog: (name: string | null) => LogFn;
1633
- /**
1634
- * Extend the current logger instance with a new name
1635
- *
1636
- * @param name - The name to use for the extended logger instance
1637
- * @returns A logger function
1638
- */
1639
- extendLog: (name: string) => LogFn;
1640
- /**
1641
- * Generates a checksum representing the current context state
1642
- *
1643
- * @returns A promise that resolves to a string representing the checksum
1644
- */
1645
- generateChecksum: () => Promise<string>;
1646
- }
1647
- type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1648
- /**
1649
- * The fully resolved Powerlines configuration
1650
- */
1651
- config: TResolvedConfig;
1652
- };
1653
- interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1654
- /**
1655
- * The environment specific resolved configuration
1656
- */
1657
- environment: EnvironmentResolvedConfig;
1658
- /**
1659
- * An alternative property name for the {@link log} property
1660
- *
1661
- * @remarks
1662
- * This is provided for compatibility with other logging libraries that expect a `logger` property.
1663
- */
1664
- logger: LogFn;
1665
- }
1666
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1667
- //#endregion
1668
- export { ResolvedConfig as a, Plugin as i, PluginContext as n, ResolvedEntryTypeDefinition as o, UserConfig as r, StoragePreset as s, Context as t };