@powerlines/core 0.48.32 → 0.48.34

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 (453) hide show
  1. package/dist/{chunk-C_NdSu1c.cjs → _virtual/_rolldown/runtime.cjs} +1 -6
  2. package/dist/constants/api.d.cts +6 -2
  3. package/dist/constants/api.d.cts.map +1 -0
  4. package/dist/constants/api.d.mts +6 -2
  5. package/dist/constants/api.d.mts.map +1 -0
  6. package/dist/constants/commands.d.cts +5 -2
  7. package/dist/constants/commands.d.cts.map +1 -0
  8. package/dist/constants/commands.d.mts +5 -2
  9. package/dist/constants/commands.d.mts.map +1 -0
  10. package/dist/constants/devtools.d.cts +13 -2
  11. package/dist/constants/devtools.d.cts.map +1 -0
  12. package/dist/constants/devtools.d.mts +13 -2
  13. package/dist/constants/devtools.d.mts.map +1 -0
  14. package/dist/constants/environments.d.cts +10 -2
  15. package/dist/constants/environments.d.cts.map +1 -0
  16. package/dist/constants/environments.d.mts +10 -2
  17. package/dist/constants/environments.d.mts.map +1 -0
  18. package/dist/constants/extensions.d.cts +5 -2
  19. package/dist/constants/extensions.d.cts.map +1 -0
  20. package/dist/constants/extensions.d.mts +5 -2
  21. package/dist/constants/extensions.d.mts.map +1 -0
  22. package/dist/constants/fs.d.cts +7 -2
  23. package/dist/constants/fs.d.cts.map +1 -0
  24. package/dist/constants/fs.d.mts +7 -2
  25. package/dist/constants/fs.d.mts.map +1 -0
  26. package/dist/constants/hooks.d.cts +5 -2
  27. package/dist/constants/hooks.d.cts.map +1 -0
  28. package/dist/constants/hooks.d.mts +5 -2
  29. package/dist/constants/hooks.d.mts.map +1 -0
  30. package/dist/constants/index.d.cts +10 -10
  31. package/dist/constants/index.d.mts +10 -10
  32. package/dist/constants/log-level.d.cts +67 -2
  33. package/dist/constants/log-level.d.cts.map +1 -0
  34. package/dist/constants/log-level.d.mts +67 -2
  35. package/dist/constants/log-level.d.mts.map +1 -0
  36. package/dist/constants/meta.d.cts +6 -2
  37. package/dist/constants/meta.d.cts.map +1 -0
  38. package/dist/constants/meta.d.mts +6 -2
  39. package/dist/constants/meta.d.mts.map +1 -0
  40. package/dist/constants/plugin.d.cts +9 -2
  41. package/dist/constants/plugin.d.cts.map +1 -0
  42. package/dist/constants/plugin.d.mts +9 -2
  43. package/dist/constants/plugin.d.mts.map +1 -0
  44. package/dist/context/base-context.cjs +2 -2
  45. package/dist/context/base-context.d.cts +81 -2
  46. package/dist/context/base-context.d.cts.map +1 -0
  47. package/dist/context/base-context.d.mts +81 -2
  48. package/dist/context/base-context.d.mts.map +1 -0
  49. package/dist/context/context.cjs +2 -2
  50. package/dist/context/context.d.cts +373 -2
  51. package/dist/context/context.d.cts.map +1 -0
  52. package/dist/context/context.d.mts +373 -2
  53. package/dist/context/context.d.mts.map +1 -0
  54. package/dist/context/environment-context.d.cts +5 -2
  55. package/dist/context/environment-context.d.cts.map +1 -1
  56. package/dist/context/environment-context.d.mts +5 -2
  57. package/dist/context/environment-context.d.mts.map +1 -1
  58. package/dist/context/execution-context.cjs +2 -2
  59. package/dist/context/execution-context.d.cts +6 -2
  60. package/dist/context/execution-context.d.cts.map +1 -1
  61. package/dist/context/execution-context.d.mts +6 -2
  62. package/dist/context/execution-context.d.mts.map +1 -1
  63. package/dist/context/index.d.cts +2 -2
  64. package/dist/context/index.d.mts +2 -2
  65. package/dist/context/plugin-context.d.cts +3 -1
  66. package/dist/context/plugin-context.d.cts.map +1 -1
  67. package/dist/context/plugin-context.d.mts +3 -1
  68. package/dist/context/plugin-context.d.mts.map +1 -1
  69. package/dist/index.cjs +1 -1
  70. package/dist/index.d.cts +32 -24
  71. package/dist/index.d.mts +32 -24
  72. package/dist/index.mjs +1 -1
  73. package/dist/lib/config.cjs +2 -2
  74. package/dist/lib/config.d.cts +140 -2
  75. package/dist/lib/config.d.cts.map +1 -0
  76. package/dist/lib/config.d.mts +140 -2
  77. package/dist/lib/config.d.mts.map +1 -0
  78. package/dist/lib/context-helpers.d.cts +16 -2
  79. package/dist/lib/context-helpers.d.cts.map +1 -0
  80. package/dist/lib/context-helpers.d.mts +16 -2
  81. package/dist/lib/context-helpers.d.mts.map +1 -0
  82. package/dist/lib/entry.d.cts +47 -2
  83. package/dist/lib/entry.d.cts.map +1 -0
  84. package/dist/lib/entry.d.mts +47 -2
  85. package/dist/lib/entry.d.mts.map +1 -0
  86. package/dist/lib/environment.cjs +2 -2
  87. package/dist/lib/environment.d.cts +2 -1
  88. package/dist/lib/environment.d.cts.map +1 -1
  89. package/dist/lib/environment.d.mts +2 -1
  90. package/dist/lib/environment.d.mts.map +1 -1
  91. package/dist/lib/events.d.cts +10 -2
  92. package/dist/lib/events.d.cts.map +1 -0
  93. package/dist/lib/events.d.mts +10 -2
  94. package/dist/lib/events.d.mts.map +1 -0
  95. package/dist/lib/generate-types.cjs +1 -1
  96. package/dist/lib/generate-types.d.cts +66 -2
  97. package/dist/lib/generate-types.d.cts.map +1 -0
  98. package/dist/lib/generate-types.d.mts +66 -2
  99. package/dist/lib/generate-types.d.mts.map +1 -0
  100. package/dist/lib/generate-types.mjs +1 -1
  101. package/dist/lib/generate-types.mjs.map +1 -1
  102. package/dist/lib/hooks.cjs +2 -2
  103. package/dist/lib/hooks.d.cts +28 -2
  104. package/dist/lib/hooks.d.cts.map +1 -0
  105. package/dist/lib/hooks.d.mts +28 -2
  106. package/dist/lib/hooks.d.mts.map +1 -0
  107. package/dist/lib/index.cjs +1 -1
  108. package/dist/lib/index.d.cts +23 -23
  109. package/dist/lib/index.d.mts +23 -23
  110. package/dist/lib/index.mjs +1 -1
  111. package/dist/lib/install-dependencies.d.cts +12 -2
  112. package/dist/lib/install-dependencies.d.cts.map +1 -0
  113. package/dist/lib/install-dependencies.d.mts +12 -2
  114. package/dist/lib/install-dependencies.d.mts.map +1 -0
  115. package/dist/lib/meta.cjs +2 -1
  116. package/dist/lib/meta.d.cts +33 -2
  117. package/dist/lib/meta.d.cts.map +1 -0
  118. package/dist/lib/meta.d.mts +33 -2
  119. package/dist/lib/meta.d.mts.map +1 -0
  120. package/dist/lib/meta.mjs +2 -1
  121. package/dist/lib/meta.mjs.map +1 -1
  122. package/dist/lib/plugins.cjs +3 -3
  123. package/dist/lib/plugins.d.cts +39 -2
  124. package/dist/lib/plugins.d.cts.map +1 -0
  125. package/dist/lib/plugins.d.mts +39 -2
  126. package/dist/lib/plugins.d.mts.map +1 -0
  127. package/dist/lib/plugins.mjs +1 -1
  128. package/dist/lib/plugins.mjs.map +1 -1
  129. package/dist/lib/resolver.cjs +2 -2
  130. package/dist/lib/resolver.d.cts +20 -2
  131. package/dist/lib/resolver.d.cts.map +1 -0
  132. package/dist/lib/resolver.d.mts +20 -2
  133. package/dist/lib/resolver.d.mts.map +1 -0
  134. package/dist/lib/schemas.cjs +1 -1
  135. package/dist/lib/schemas.d.cts +1 -1
  136. package/dist/lib/schemas.d.mts +1 -1
  137. package/dist/lib/schemas.mjs +1 -1
  138. package/dist/lib/streaming-channel.d.cts +126 -2
  139. package/dist/lib/streaming-channel.d.cts.map +1 -0
  140. package/dist/lib/streaming-channel.d.mts +126 -2
  141. package/dist/lib/streaming-channel.d.mts.map +1 -0
  142. package/dist/lib/typescript/index.d.cts +2 -2
  143. package/dist/lib/typescript/index.d.mts +2 -2
  144. package/dist/lib/typescript/ts-morph.cjs +2 -2
  145. package/dist/lib/typescript/ts-morph.d.cts +38 -2
  146. package/dist/lib/typescript/ts-morph.d.cts.map +1 -0
  147. package/dist/lib/typescript/ts-morph.d.mts +38 -2
  148. package/dist/lib/typescript/ts-morph.d.mts.map +1 -0
  149. package/dist/lib/typescript/tsconfig.cjs +4 -4
  150. package/dist/lib/typescript/tsconfig.d.cts +77 -2
  151. package/dist/lib/typescript/tsconfig.d.cts.map +1 -0
  152. package/dist/lib/typescript/tsconfig.d.mts +77 -2
  153. package/dist/lib/typescript/tsconfig.d.mts.map +1 -0
  154. package/dist/lib/unplugin/helpers.d.cts +23 -2
  155. package/dist/lib/unplugin/helpers.d.cts.map +1 -0
  156. package/dist/lib/unplugin/helpers.d.mts +23 -2
  157. package/dist/lib/unplugin/helpers.d.mts.map +1 -0
  158. package/dist/lib/unplugin/index.d.cts +3 -3
  159. package/dist/lib/unplugin/index.d.mts +3 -3
  160. package/dist/lib/unplugin/module-resolution.cjs +2 -2
  161. package/dist/lib/unplugin/module-resolution.d.cts +41 -2
  162. package/dist/lib/unplugin/module-resolution.d.cts.map +1 -0
  163. package/dist/lib/unplugin/module-resolution.d.mts +41 -2
  164. package/dist/lib/unplugin/module-resolution.d.mts.map +1 -0
  165. package/dist/lib/unplugin/plugin.d.cts +40 -2
  166. package/dist/lib/unplugin/plugin.d.cts.map +1 -0
  167. package/dist/lib/unplugin/plugin.d.mts +40 -2
  168. package/dist/lib/unplugin/plugin.d.mts.map +1 -0
  169. package/dist/lib/utilities/file-header.d.cts +41 -2
  170. package/dist/lib/utilities/file-header.d.cts.map +1 -0
  171. package/dist/lib/utilities/file-header.d.mts +41 -2
  172. package/dist/lib/utilities/file-header.d.mts.map +1 -0
  173. package/dist/lib/utilities/format.cjs +2 -2
  174. package/dist/lib/utilities/format.d.cts +24 -2
  175. package/dist/lib/utilities/format.d.cts.map +1 -0
  176. package/dist/lib/utilities/format.d.mts +24 -2
  177. package/dist/lib/utilities/format.d.mts.map +1 -0
  178. package/dist/lib/utilities/index.d.cts +5 -5
  179. package/dist/lib/utilities/index.d.mts +5 -5
  180. package/dist/lib/utilities/source-file.cjs +2 -2
  181. package/dist/lib/utilities/source-file.d.cts +30 -2
  182. package/dist/lib/utilities/source-file.d.cts.map +1 -0
  183. package/dist/lib/utilities/source-file.d.mts +30 -2
  184. package/dist/lib/utilities/source-file.d.mts.map +1 -0
  185. package/dist/lib/utilities/source-map.cjs +2 -2
  186. package/dist/lib/utilities/source-map.d.cts +16 -2
  187. package/dist/lib/utilities/source-map.d.cts.map +1 -0
  188. package/dist/lib/utilities/source-map.d.mts +16 -2
  189. package/dist/lib/utilities/source-map.d.mts.map +1 -0
  190. package/dist/lib/utilities/write-file.d.cts +15 -2
  191. package/dist/lib/utilities/write-file.d.cts.map +1 -0
  192. package/dist/lib/utilities/write-file.d.mts +15 -2
  193. package/dist/lib/utilities/write-file.d.mts.map +1 -0
  194. package/dist/lib/vfs.cjs +3 -3
  195. package/dist/lib/vfs.d.cts +321 -2
  196. package/dist/lib/vfs.d.cts.map +1 -0
  197. package/dist/lib/vfs.d.mts +321 -2
  198. package/dist/lib/vfs.d.mts.map +1 -0
  199. package/dist/lib/vfs.mjs +1 -1
  200. package/dist/plugin-base.d.cts +3 -1
  201. package/dist/plugin-base.d.cts.map +1 -1
  202. package/dist/plugin-base.d.mts +3 -1
  203. package/dist/plugin-base.d.mts.map +1 -1
  204. package/dist/plugin-utils/build-helpers.d.cts +2 -1
  205. package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
  206. package/dist/plugin-utils/build-helpers.d.mts +2 -1
  207. package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
  208. package/dist/plugin-utils/combine-plugins.d.cts +1 -1
  209. package/dist/plugin-utils/combine-plugins.d.mts +1 -1
  210. package/dist/plugin-utils/context-helpers.d.cts +1 -1
  211. package/dist/plugin-utils/context-helpers.d.mts +1 -1
  212. package/dist/plugin-utils/enable-plugin.d.cts +2 -1
  213. package/dist/plugin-utils/enable-plugin.d.cts.map +1 -1
  214. package/dist/plugin-utils/enable-plugin.d.mts +2 -1
  215. package/dist/plugin-utils/enable-plugin.d.mts.map +1 -1
  216. package/dist/plugin-utils/extend.d.cts +3 -1
  217. package/dist/plugin-utils/extend.d.cts.map +1 -1
  218. package/dist/plugin-utils/extend.d.mts +3 -1
  219. package/dist/plugin-utils/extend.d.mts.map +1 -1
  220. package/dist/plugin-utils/filter.cjs +2 -2
  221. package/dist/plugin-utils/filter.d.cts +1 -1
  222. package/dist/plugin-utils/filter.d.mts +1 -1
  223. package/dist/plugin-utils/format-package-json.d.cts +1 -1
  224. package/dist/plugin-utils/format-package-json.d.mts +1 -1
  225. package/dist/plugin-utils/get-config-path.d.cts +1 -1
  226. package/dist/plugin-utils/get-config-path.d.mts +1 -1
  227. package/dist/plugin-utils/helpers.d.cts +5 -1
  228. package/dist/plugin-utils/helpers.d.cts.map +1 -1
  229. package/dist/plugin-utils/helpers.d.mts +5 -1
  230. package/dist/plugin-utils/helpers.d.mts.map +1 -1
  231. package/dist/plugin-utils/install.d.cts +1 -1
  232. package/dist/plugin-utils/install.d.mts +1 -1
  233. package/dist/plugin-utils/logging.cjs +2 -2
  234. package/dist/plugin-utils/logging.d.cts +3 -1
  235. package/dist/plugin-utils/logging.d.cts.map +1 -1
  236. package/dist/plugin-utils/logging.d.mts +3 -1
  237. package/dist/plugin-utils/logging.d.mts.map +1 -1
  238. package/dist/plugin-utils/merge.cjs +2 -2
  239. package/dist/plugin-utils/merge.d.cts +3 -1
  240. package/dist/plugin-utils/merge.d.cts.map +1 -1
  241. package/dist/plugin-utils/merge.d.mts +3 -1
  242. package/dist/plugin-utils/merge.d.mts.map +1 -1
  243. package/dist/plugin-utils/modules.d.cts +1 -1
  244. package/dist/plugin-utils/modules.d.mts +1 -1
  245. package/dist/plugin-utils/paths.d.cts +1 -1
  246. package/dist/plugin-utils/paths.d.mts +1 -1
  247. package/dist/{fs-C2lru696.cjs → schemas/fs.cjs} +8 -38
  248. package/dist/{schemas-Zvqwdrw_.d.mts → schemas/fs.d.cts} +2 -2
  249. package/dist/schemas/fs.d.cts.map +1 -0
  250. package/dist/{schemas-Zvqwdrw_.d.cts → schemas/fs.d.mts} +2 -2
  251. package/dist/schemas/fs.d.mts.map +1 -0
  252. package/dist/{fs-DqLn15uU.mjs → schemas/fs.mjs} +2 -2
  253. package/dist/schemas/fs.mjs.map +1 -0
  254. package/dist/storage/base.d.cts +2 -1
  255. package/dist/storage/base.d.cts.map +1 -1
  256. package/dist/storage/base.d.mts +2 -1
  257. package/dist/storage/base.d.mts.map +1 -1
  258. package/dist/storage/file-system.d.cts +1 -1
  259. package/dist/storage/file-system.d.mts +1 -1
  260. package/dist/storage/virtual.d.cts +1 -1
  261. package/dist/storage/virtual.d.mts +1 -1
  262. package/dist/types/api.d.cts +16 -0
  263. package/dist/types/api.d.cts.map +1 -0
  264. package/dist/types/api.d.mts +16 -0
  265. package/dist/types/api.d.mts.map +1 -0
  266. package/dist/types/config.d.cts +739 -0
  267. package/dist/types/config.d.cts.map +1 -0
  268. package/dist/types/config.d.mts +739 -0
  269. package/dist/types/config.d.mts.map +1 -0
  270. package/dist/types/context.d.cts +682 -0
  271. package/dist/types/context.d.cts.map +1 -0
  272. package/dist/types/context.d.mts +682 -0
  273. package/dist/types/context.d.mts.map +1 -0
  274. package/dist/types/fs.d.cts +538 -0
  275. package/dist/types/fs.d.cts.map +1 -0
  276. package/dist/types/fs.d.mts +538 -0
  277. package/dist/types/fs.d.mts.map +1 -0
  278. package/dist/types/hooks.d.cts +96 -0
  279. package/dist/types/hooks.d.cts.map +1 -0
  280. package/dist/types/hooks.d.mts +96 -0
  281. package/dist/types/hooks.d.mts.map +1 -0
  282. package/dist/types/index.d.cts +9 -0
  283. package/dist/types/index.d.mts +9 -0
  284. package/dist/types/logging.d.cts +145 -0
  285. package/dist/types/logging.d.cts.map +1 -0
  286. package/dist/types/logging.d.mts +145 -0
  287. package/dist/types/logging.d.mts.map +1 -0
  288. package/dist/types/plugin.d.cts +207 -0
  289. package/dist/types/plugin.d.cts.map +1 -0
  290. package/dist/types/plugin.d.mts +207 -0
  291. package/dist/types/plugin.d.mts.map +1 -0
  292. package/dist/types/tsconfig.d.cts +73 -0
  293. package/dist/types/tsconfig.d.cts.map +1 -0
  294. package/dist/types/tsconfig.d.mts +73 -0
  295. package/dist/types/tsconfig.d.mts.map +1 -0
  296. package/dist/types/unplugin.d.cts +22 -0
  297. package/dist/types/unplugin.d.cts.map +1 -0
  298. package/dist/types/unplugin.d.mts +22 -0
  299. package/dist/types/unplugin.d.mts.map +1 -0
  300. package/package.json +7 -7
  301. package/dist/api-DTCbbtSH.d.cts +0 -6
  302. package/dist/api-DTCbbtSH.d.cts.map +0 -1
  303. package/dist/api-DTCbbtSH.d.mts +0 -6
  304. package/dist/api-DTCbbtSH.d.mts.map +0 -1
  305. package/dist/base-context-BmxgDD3S.d.mts +0 -79
  306. package/dist/base-context-BmxgDD3S.d.mts.map +0 -1
  307. package/dist/base-context-mHoSEqHf.d.cts +0 -79
  308. package/dist/base-context-mHoSEqHf.d.cts.map +0 -1
  309. package/dist/commands-DzGd8pnR.d.cts +0 -5
  310. package/dist/commands-DzGd8pnR.d.cts.map +0 -1
  311. package/dist/commands-DzGd8pnR.d.mts +0 -5
  312. package/dist/commands-DzGd8pnR.d.mts.map +0 -1
  313. package/dist/config-BnV_o0Es.d.cts +0 -2461
  314. package/dist/config-BnV_o0Es.d.cts.map +0 -1
  315. package/dist/config-DKeDSykZ.d.cts +0 -138
  316. package/dist/config-DKeDSykZ.d.cts.map +0 -1
  317. package/dist/config-DbOP5nVu.d.mts +0 -138
  318. package/dist/config-DbOP5nVu.d.mts.map +0 -1
  319. package/dist/config-DboKmDhl.d.mts +0 -2461
  320. package/dist/config-DboKmDhl.d.mts.map +0 -1
  321. package/dist/context-C6oL3mPw.d.mts +0 -368
  322. package/dist/context-C6oL3mPw.d.mts.map +0 -1
  323. package/dist/context-DcY6YqBQ.d.cts +0 -368
  324. package/dist/context-DcY6YqBQ.d.cts.map +0 -1
  325. package/dist/context-helpers-BRt-Eq-v.d.mts +0 -15
  326. package/dist/context-helpers-BRt-Eq-v.d.mts.map +0 -1
  327. package/dist/context-helpers-Cnsku6fQ.d.cts +0 -15
  328. package/dist/context-helpers-Cnsku6fQ.d.cts.map +0 -1
  329. package/dist/devtools-h0du-bSj.d.cts +0 -13
  330. package/dist/devtools-h0du-bSj.d.cts.map +0 -1
  331. package/dist/devtools-h0du-bSj.d.mts +0 -13
  332. package/dist/devtools-h0du-bSj.d.mts.map +0 -1
  333. package/dist/entry-BC_V2K2U.d.cts +0 -46
  334. package/dist/entry-BC_V2K2U.d.cts.map +0 -1
  335. package/dist/entry-CHIaWcmk.d.mts +0 -46
  336. package/dist/entry-CHIaWcmk.d.mts.map +0 -1
  337. package/dist/environments-BYv_kHRG.d.cts +0 -10
  338. package/dist/environments-BYv_kHRG.d.cts.map +0 -1
  339. package/dist/environments-BYv_kHRG.d.mts +0 -10
  340. package/dist/environments-BYv_kHRG.d.mts.map +0 -1
  341. package/dist/events-NA1XM2Vz.d.cts +0 -10
  342. package/dist/events-NA1XM2Vz.d.cts.map +0 -1
  343. package/dist/events-NA1XM2Vz.d.mts +0 -10
  344. package/dist/events-NA1XM2Vz.d.mts.map +0 -1
  345. package/dist/extensions-ctxXzgay.d.cts +0 -5
  346. package/dist/extensions-ctxXzgay.d.cts.map +0 -1
  347. package/dist/extensions-ctxXzgay.d.mts +0 -5
  348. package/dist/extensions-ctxXzgay.d.mts.map +0 -1
  349. package/dist/file-header-Co9oo7aI.d.cts +0 -41
  350. package/dist/file-header-Co9oo7aI.d.cts.map +0 -1
  351. package/dist/file-header-rHqeXgRV.d.mts +0 -41
  352. package/dist/file-header-rHqeXgRV.d.mts.map +0 -1
  353. package/dist/format-Cf-cgZ-s.d.cts +0 -24
  354. package/dist/format-Cf-cgZ-s.d.cts.map +0 -1
  355. package/dist/format-IQPqgWIe.d.mts +0 -24
  356. package/dist/format-IQPqgWIe.d.mts.map +0 -1
  357. package/dist/fs-BzXT5ZPj.d.cts +0 -7
  358. package/dist/fs-BzXT5ZPj.d.cts.map +0 -1
  359. package/dist/fs-BzXT5ZPj.d.mts +0 -7
  360. package/dist/fs-BzXT5ZPj.d.mts.map +0 -1
  361. package/dist/fs-DqLn15uU.mjs.map +0 -1
  362. package/dist/generate-types-CDkVosrS.d.cts +0 -65
  363. package/dist/generate-types-CDkVosrS.d.cts.map +0 -1
  364. package/dist/generate-types-Dw6p3cB_.d.mts +0 -65
  365. package/dist/generate-types-Dw6p3cB_.d.mts.map +0 -1
  366. package/dist/helpers-CrRRFQl5.d.mts +0 -22
  367. package/dist/helpers-CrRRFQl5.d.mts.map +0 -1
  368. package/dist/helpers-DBLIQW3U.d.cts +0 -22
  369. package/dist/helpers-DBLIQW3U.d.cts.map +0 -1
  370. package/dist/hooks-Dhc3ahex.d.cts +0 -5
  371. package/dist/hooks-Dhc3ahex.d.cts.map +0 -1
  372. package/dist/hooks-Dhc3ahex.d.mts +0 -5
  373. package/dist/hooks-Dhc3ahex.d.mts.map +0 -1
  374. package/dist/index-BKZ67WMa.d.cts +0 -1
  375. package/dist/index-BKZ67WMa.d.mts +0 -1
  376. package/dist/index-BVVgDSdq.d.cts +0 -1
  377. package/dist/index-BVVgDSdq.d.mts +0 -1
  378. package/dist/index-Den-MsLx.d.cts +0 -1
  379. package/dist/index-Den-MsLx.d.mts +0 -1
  380. package/dist/index-DmtQKWjk.d.cts +0 -1
  381. package/dist/index-DmtQKWjk.d.mts +0 -1
  382. package/dist/index-LtpXjuJR.d.mts +0 -25
  383. package/dist/index-LtpXjuJR.d.mts.map +0 -1
  384. package/dist/index-_6s0AX1B.d.cts +0 -1
  385. package/dist/index-_6s0AX1B.d.mts +0 -1
  386. package/dist/index-xk4vSgtB.d.cts +0 -25
  387. package/dist/index-xk4vSgtB.d.cts.map +0 -1
  388. package/dist/install-dependencies-CCjZfS9Y.d.mts +0 -12
  389. package/dist/install-dependencies-CCjZfS9Y.d.mts.map +0 -1
  390. package/dist/install-dependencies-CyeYsrfz.d.cts +0 -12
  391. package/dist/install-dependencies-CyeYsrfz.d.cts.map +0 -1
  392. package/dist/log-level-BC8g4BBL.d.cts +0 -67
  393. package/dist/log-level-BC8g4BBL.d.cts.map +0 -1
  394. package/dist/log-level-BC8g4BBL.d.mts +0 -67
  395. package/dist/log-level-BC8g4BBL.d.mts.map +0 -1
  396. package/dist/meta-CdDd2ykC.d.cts +0 -33
  397. package/dist/meta-CdDd2ykC.d.cts.map +0 -1
  398. package/dist/meta-CfTCHU_o.d.mts +0 -33
  399. package/dist/meta-CfTCHU_o.d.mts.map +0 -1
  400. package/dist/meta-QA_SN1j3.d.cts +0 -6
  401. package/dist/meta-QA_SN1j3.d.cts.map +0 -1
  402. package/dist/meta-QA_SN1j3.d.mts +0 -6
  403. package/dist/meta-QA_SN1j3.d.mts.map +0 -1
  404. package/dist/module-resolution-CRMNPsdn.d.mts +0 -40
  405. package/dist/module-resolution-CRMNPsdn.d.mts.map +0 -1
  406. package/dist/module-resolution-D-w-EZaK.d.cts +0 -40
  407. package/dist/module-resolution-D-w-EZaK.d.cts.map +0 -1
  408. package/dist/plugin-B_b7XqaN.d.mts +0 -39
  409. package/dist/plugin-B_b7XqaN.d.mts.map +0 -1
  410. package/dist/plugin-CzV-aFwU.d.cts +0 -39
  411. package/dist/plugin-CzV-aFwU.d.cts.map +0 -1
  412. package/dist/plugin-fhBG7SSQ.d.cts +0 -9
  413. package/dist/plugin-fhBG7SSQ.d.cts.map +0 -1
  414. package/dist/plugin-fhBG7SSQ.d.mts +0 -9
  415. package/dist/plugin-fhBG7SSQ.d.mts.map +0 -1
  416. package/dist/plugins-DfL1fBZi.d.cts +0 -37
  417. package/dist/plugins-DfL1fBZi.d.cts.map +0 -1
  418. package/dist/plugins-zG2X2LA8.d.mts +0 -37
  419. package/dist/plugins-zG2X2LA8.d.mts.map +0 -1
  420. package/dist/resolver-CdBAh8dA.d.mts +0 -19
  421. package/dist/resolver-CdBAh8dA.d.mts.map +0 -1
  422. package/dist/resolver-CfCl--Eh.d.cts +0 -19
  423. package/dist/resolver-CfCl--Eh.d.cts.map +0 -1
  424. package/dist/schemas-Zvqwdrw_.d.cts.map +0 -1
  425. package/dist/schemas-Zvqwdrw_.d.mts.map +0 -1
  426. package/dist/source-file-CLw13fKE.d.mts +0 -30
  427. package/dist/source-file-CLw13fKE.d.mts.map +0 -1
  428. package/dist/source-file-CuuHaBL5.d.cts +0 -30
  429. package/dist/source-file-CuuHaBL5.d.cts.map +0 -1
  430. package/dist/source-map-Cy0aqSpe.d.mts +0 -16
  431. package/dist/source-map-Cy0aqSpe.d.mts.map +0 -1
  432. package/dist/source-map-HU4IoICc.d.cts +0 -16
  433. package/dist/source-map-HU4IoICc.d.cts.map +0 -1
  434. package/dist/streaming-channel-CiyFd_6l.d.cts +0 -126
  435. package/dist/streaming-channel-CiyFd_6l.d.cts.map +0 -1
  436. package/dist/streaming-channel-CiyFd_6l.d.mts +0 -126
  437. package/dist/streaming-channel-CiyFd_6l.d.mts.map +0 -1
  438. package/dist/ts-morph-BGgjbOgM.d.cts +0 -38
  439. package/dist/ts-morph-BGgjbOgM.d.cts.map +0 -1
  440. package/dist/ts-morph-zLvdifpA.d.mts +0 -38
  441. package/dist/ts-morph-zLvdifpA.d.mts.map +0 -1
  442. package/dist/tsconfig-DExoZEQ0.d.cts +0 -75
  443. package/dist/tsconfig-DExoZEQ0.d.cts.map +0 -1
  444. package/dist/tsconfig-De09cBeX.d.mts +0 -75
  445. package/dist/tsconfig-De09cBeX.d.mts.map +0 -1
  446. package/dist/vfs-B9Vhnajc.d.cts +0 -320
  447. package/dist/vfs-B9Vhnajc.d.cts.map +0 -1
  448. package/dist/vfs-Dl6nPqdS.d.mts +0 -320
  449. package/dist/vfs-Dl6nPqdS.d.mts.map +0 -1
  450. package/dist/write-file-BVMnXVPo.d.cts +0 -15
  451. package/dist/write-file-BVMnXVPo.d.cts.map +0 -1
  452. package/dist/write-file-CWf9Xxwd.d.mts +0 -15
  453. package/dist/write-file-CWf9Xxwd.d.mts.map +0 -1
package/dist/lib/meta.mjs CHANGED
@@ -3,6 +3,7 @@ import "../constants/index.mjs";
3
3
  import { existsSync } from "@stryke/fs/exists";
4
4
  import { readJsonFile } from "@stryke/fs/json";
5
5
  import { joinPaths } from "@stryke/path/join-paths";
6
+ import { replacePath } from "@stryke/path/replace";
6
7
  import { kebabCase } from "@stryke/string-format/kebab-case";
7
8
  import { removeFile } from "@stryke/fs/remove-file";
8
9
 
@@ -45,7 +46,7 @@ async function getPersistedMeta(context) {
45
46
  */
46
47
  async function writeMetaFile(context) {
47
48
  const metaFilePath = joinPaths(context.dataPath, "meta.json");
48
- context.debug(`Writing runtime metadata to ${metaFilePath}`);
49
+ context.debug(`Writing runtime metadata to ${replacePath(metaFilePath, context.config.cwd)}`);
49
50
  await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
50
51
  }
51
52
 
@@ -1 +1 @@
1
- {"version":3,"file":"meta.mjs","names":[],"sources":["../../src/lib/meta.ts"],"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 { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { removeFile } from \"@stryke/fs/remove-file\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { ROOT_HASH_LENGTH } from \"../constants\";\nimport type { Context, MetaInfo } from \"../types\";\n\nexport interface CreateContextOptions {\n name?: string;\n}\n\n/**\n * Generates a prefixed project root hash object.\n *\n * @remarks\n * This function returns a string where the project root hash is prefixed with the project name plus a hyphen. If the total length of this string combination exceeds 45 characters, it will truncate the hash.\n *\n * @param name - The name of the project.\n * @param rootHash - The hash of the project root.\n * @returns An object containing the name and project root hash.\n */\nexport function getPrefixedRootHash(name: string, rootHash: string): string {\n const combined = `${kebabCase(name)}_${rootHash}`;\n\n return combined.length > ROOT_HASH_LENGTH\n ? combined.slice(0, ROOT_HASH_LENGTH)\n : combined;\n}\n\n/**\n * Retrieves the persisted meta information from the context's data path.\n *\n * @param context - The build context.\n * @returns A promise that resolves to the persisted meta information, or undefined if not found.\n */\nexport async function getPersistedMeta(\n context: Context\n): Promise<MetaInfo | undefined> {\n const metaFilePath = joinPaths(context.dataPath, \"meta.json\");\n if (existsSync(metaFilePath)) {\n try {\n return await readJsonFile<MetaInfo>(metaFilePath);\n } catch {\n context.warn(\n `Failed to read meta file at ${metaFilePath}. It may be corrupted.`\n );\n await removeFile(metaFilePath);\n\n context.persistedMeta = undefined;\n }\n }\n\n return undefined;\n}\n\n/**\n * Writes the meta file for the context.\n *\n * @param context - The context to write the meta file for.\n * @returns A promise that resolves when the meta file has been written.\n */\nexport async function writeMetaFile(context: Context): Promise<void> {\n const metaFilePath = joinPaths(context.dataPath, \"meta.json\");\n\n context.debug(`Writing runtime metadata to ${metaFilePath}`);\n\n await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,oBAAoB,MAAc,UAA0B;CAC1E,MAAM,WAAW,GAAG,UAAU,IAAI,EAAE,GAAG;CAEvC,OAAO,SAAS,cACZ,SAAS,MAAM,KAAmB,IAClC;AACN;;;;;;;AAQA,eAAsB,iBACpB,SAC+B;CAC/B,MAAM,eAAe,UAAU,QAAQ,UAAU,WAAW;CAC5D,IAAI,WAAW,YAAY,GACzB,IAAI;EACF,OAAO,MAAM,aAAuB,YAAY;CAClD,QAAQ;EACN,QAAQ,KACN,+BAA+B,aAAa,uBAC9C;EACA,MAAM,WAAW,YAAY;EAE7B,QAAQ,gBAAgB;CAC1B;AAIJ;;;;;;;AAQA,eAAsB,cAAc,SAAiC;CACnE,MAAM,eAAe,UAAU,QAAQ,UAAU,WAAW;CAE5D,QAAQ,MAAM,+BAA+B,cAAc;CAE3D,MAAM,QAAQ,GAAG,MAAM,cAAc,KAAK,UAAU,QAAQ,MAAM,MAAM,CAAC,CAAC;AAC5E"}
1
+ {"version":3,"file":"meta.mjs","names":[],"sources":["../../src/lib/meta.ts"],"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 { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { removeFile } from \"@stryke/fs/remove-file\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { ROOT_HASH_LENGTH } from \"../constants\";\nimport type { Context, MetaInfo } from \"../types\";\n\nexport interface CreateContextOptions {\n name?: string;\n}\n\n/**\n * Generates a prefixed project root hash object.\n *\n * @remarks\n * This function returns a string where the project root hash is prefixed with the project name plus a hyphen. If the total length of this string combination exceeds 45 characters, it will truncate the hash.\n *\n * @param name - The name of the project.\n * @param rootHash - The hash of the project root.\n * @returns An object containing the name and project root hash.\n */\nexport function getPrefixedRootHash(name: string, rootHash: string): string {\n const combined = `${kebabCase(name)}_${rootHash}`;\n\n return combined.length > ROOT_HASH_LENGTH\n ? combined.slice(0, ROOT_HASH_LENGTH)\n : combined;\n}\n\n/**\n * Retrieves the persisted meta information from the context's data path.\n *\n * @param context - The build context.\n * @returns A promise that resolves to the persisted meta information, or undefined if not found.\n */\nexport async function getPersistedMeta(\n context: Context\n): Promise<MetaInfo | undefined> {\n const metaFilePath = joinPaths(context.dataPath, \"meta.json\");\n if (existsSync(metaFilePath)) {\n try {\n return await readJsonFile<MetaInfo>(metaFilePath);\n } catch {\n context.warn(\n `Failed to read meta file at ${metaFilePath}. It may be corrupted.`\n );\n await removeFile(metaFilePath);\n\n context.persistedMeta = undefined;\n }\n }\n\n return undefined;\n}\n\n/**\n * Writes the meta file for the context.\n *\n * @param context - The context to write the meta file for.\n * @returns A promise that resolves when the meta file has been written.\n */\nexport async function writeMetaFile(context: Context): Promise<void> {\n const metaFilePath = joinPaths(context.dataPath, \"meta.json\");\n\n context.debug(\n `Writing runtime metadata to ${replacePath(\n metaFilePath,\n context.config.cwd\n )}`\n );\n\n await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,oBAAoB,MAAc,UAA0B;CAC1E,MAAM,WAAW,GAAG,UAAU,IAAI,EAAE,GAAG;CAEvC,OAAO,SAAS,cACZ,SAAS,MAAM,KAAmB,IAClC;AACN;;;;;;;AAQA,eAAsB,iBACpB,SAC+B;CAC/B,MAAM,eAAe,UAAU,QAAQ,UAAU,WAAW;CAC5D,IAAI,WAAW,YAAY,GACzB,IAAI;EACF,OAAO,MAAM,aAAuB,YAAY;CAClD,QAAQ;EACN,QAAQ,KACN,+BAA+B,aAAa,uBAC9C;EACA,MAAM,WAAW,YAAY;EAE7B,QAAQ,gBAAgB;CAC1B;AAIJ;;;;;;;AAQA,eAAsB,cAAc,SAAiC;CACnE,MAAM,eAAe,UAAU,QAAQ,UAAU,WAAW;CAE5D,QAAQ,MACN,+BAA+B,YAC7B,cACA,QAAQ,OAAO,GACjB,GACF;CAEA,MAAM,QAAQ,GAAG,MAAM,cAAc,KAAK,UAAU,QAAQ,MAAM,MAAM,CAAC,CAAC;AAC5E"}
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('../chunk-C_NdSu1c.cjs');
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_plugin_utils_helpers = require('../plugin-utils/helpers.cjs');
4
4
  require('../plugin-utils/index.cjs');
5
5
  let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
6
6
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
7
7
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
8
8
  let chalk = require("chalk");
9
- chalk = require_chunk.__toESM(chalk, 1);
9
+ chalk = require_runtime.__toESM(chalk, 1);
10
10
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
11
11
  let _stryke_path_join = require("@stryke/path/join");
12
12
  let _stryke_fs_install = require("@stryke/fs/install");
@@ -134,7 +134,7 @@ async function resolvePlugins(context, config, options = {}) {
134
134
  if (config) {
135
135
  const result = await initPlugin(context, config);
136
136
  if (result) for (const plugin of result) {
137
- if (!skipLogging) context.debug({
137
+ if (!skipLogging) context.trace({
138
138
  meta: { category: "plugins" },
139
139
  message: `Successfully initialized the ${chalk.default.bold.cyanBright(plugin.name)} plugin`
140
140
  });
@@ -1,2 +1,39 @@
1
- import { i as resolvePlugins, n as initPlugin, r as resolvePlugin, t as ResolvePluginsOptions } from "../plugins-DfL1fBZi.cjs";
2
- export { ResolvePluginsOptions, initPlugin, resolvePlugin, resolvePlugins };
1
+ import { Plugin } from "../types/plugin.cjs";
2
+ import { EnvironmentContext, ExecutionContext, PluginContext } from "../types/context.cjs";
3
+ import { PluginConfig, ResolvedConfig } from "../types/config.cjs";
4
+ import { MaybePromise } from "@stryke/types/base";
5
+
6
+ //#region src/lib/plugins.d.ts
7
+ /**
8
+ * Resolve a plugin module based on the provided plugin path. This function checks if the plugin package is installed, attempts to import the plugin module, and handles various error cases such as missing packages or invalid module exports. It supports both direct plugin exports and plugins exported from a "plugin" subdirectory within the package.
9
+ *
10
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
11
+ * @param pluginPath - The path to the plugin module. This can be a package name, a scoped package name, or a path to a local module.
12
+ * @returns A promise that resolves to the plugin module, which can be a plugin instance, a factory function that returns a plugin, or an array of plugins.
13
+ */
14
+ declare function resolvePlugin<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, pluginPath: string): Promise<Plugin<TPluginContext> | Plugin<TPluginContext>[] | ((options?: any) => MaybePromise<Plugin<TPluginContext> | Plugin<TPluginContext>[]>)>;
15
+ /**
16
+ * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, factory functions, string paths to plugins, and arrays of plugins or plugin configurations. It validates the plugin configuration, resolves any plugin paths, and returns an array of initialized plugins.
17
+ *
18
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
19
+ * @param config - The plugin configuration, which can be in various forms such as a direct plugin instance, a string path to a plugin, a factory function that returns a plugin, or an array of plugins or plugin configurations. This configuration will be processed and validated to initialize the appropriate plugins.
20
+ * @returns A promise that resolves to an array of initialized plugins based on the provided configuration. If the configuration is invalid, an error will be thrown with details about the issue.
21
+ */
22
+ declare function initPlugin<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, config: PluginConfig<TPluginContext>, options?: ResolvePluginsOptions): Promise<Plugin<TPluginContext>[] | null>;
23
+ interface ResolvePluginsOptions {
24
+ /**
25
+ * If true, the plugin resolution process will skip logging messages about the plugin initialization. This can be useful in scenarios where you want to suppress plugin-related logs, such as when running in a non-interactive environment or when you want to reduce log verbosity. By default, this option is false, and plugin initialization messages will be logged using the context's logger.
26
+ */
27
+ skipLogging?: boolean;
28
+ }
29
+ /**
30
+ * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, plugin names, factory functions, and arrays of plugins. It validates the configuration, resolves plugin modules if necessary, and returns an array of initialized plugins ready to be added to the execution context.
31
+ *
32
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
33
+ * @param config - The plugin configuration, which can be in various forms such as a plugin instance, a plugin name string, a factory function that returns a plugin or an array of plugins, or an array of plugin configurations. The function will handle the resolution and initialization of the plugin(s) based on the provided configuration.
34
+ * @returns A promise that resolves to an array of initialized plugins that can be added to the execution context, or null if the configuration is invalid or results in no plugins being initialized.
35
+ */
36
+ declare function resolvePlugins<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, config: PluginConfig<TPluginContext>, options?: ResolvePluginsOptions): Promise<Plugin<TPluginContext>[]>;
37
+ //#endregion
38
+ export { ResolvePluginsOptions, initPlugin, resolvePlugin, resolvePlugins };
39
+ //# sourceMappingURL=plugins.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.cts","names":[],"sources":["../../src/lib/plugins.ts"],"mappings":";;;;;;;;;;;AAwDA;;iBAAsB,aAAA,yBACI,cAAA,mCAGpB,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,IAClC,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,0BACf,aAAA,CAAc,eAAA,EAAiB,cAAA,IACpD,aAAA,CAAc,eAAA,EAAiB,cAAA,GAEjC,OAAA,EAAS,QAAA,EACT,UAAA,WACC,OAAA,CACC,MAAA,CAAO,cAAA,IACP,MAAA,CAAO,cAAA,QAEL,OAAA,WACG,YAAA,CAAa,MAAA,CAAO,cAAA,IAAkB,MAAA,CAAO,cAAA;;;;;;;;iBAsGhC,UAAA,yBACI,cAAA,mCAGpB,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,IAClC,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,0BACf,aAAA,CAAc,eAAA,EAAiB,cAAA,IACpD,aAAA,CAAc,eAAA,EAAiB,cAAA,GAEjC,OAAA,EAAS,QAAA,EACT,MAAA,EAAQ,YAAA,CAAa,cAAA,GACrB,OAAA,GAAS,qBAAA,GACR,OAAA,CAAQ,MAAA,CAAO,cAAA;AAAA,UAwJD,qBAAA;EAxRX;;;EA4RJ,WAAW;AAAA;;;;;;;;iBAUS,cAAA,yBACI,cAAA,mCAGpB,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,IAClC,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACpC,gBAAA,CAAiB,eAAA,EAAiB,cAAA,0BACf,aAAA,CAAc,eAAA,EAAiB,cAAA,IACpD,aAAA,CAAc,eAAA,EAAiB,cAAA,GAEjC,OAAA,EAAS,QAAA,EACT,MAAA,EAAQ,YAAA,CAAa,cAAA,GACrB,OAAA,GAAS,qBAAA,GAA0B,OAAA,CAAA,MAAA,CAAA,cAAA"}
@@ -1,2 +1,39 @@
1
- import { i as resolvePlugins, n as initPlugin, r as resolvePlugin, t as ResolvePluginsOptions } from "../plugins-zG2X2LA8.mjs";
2
- export { ResolvePluginsOptions, initPlugin, resolvePlugin, resolvePlugins };
1
+ import { Plugin } from "../types/plugin.mjs";
2
+ import { EnvironmentContext, ExecutionContext, PluginContext } from "../types/context.mjs";
3
+ import { PluginConfig, ResolvedConfig } from "../types/config.mjs";
4
+ import { MaybePromise } from "@stryke/types/base";
5
+
6
+ //#region src/lib/plugins.d.ts
7
+ /**
8
+ * Resolve a plugin module based on the provided plugin path. This function checks if the plugin package is installed, attempts to import the plugin module, and handles various error cases such as missing packages or invalid module exports. It supports both direct plugin exports and plugins exported from a "plugin" subdirectory within the package.
9
+ *
10
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
11
+ * @param pluginPath - The path to the plugin module. This can be a package name, a scoped package name, or a path to a local module.
12
+ * @returns A promise that resolves to the plugin module, which can be a plugin instance, a factory function that returns a plugin, or an array of plugins.
13
+ */
14
+ declare function resolvePlugin<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, pluginPath: string): Promise<Plugin<TPluginContext> | Plugin<TPluginContext>[] | ((options?: any) => MaybePromise<Plugin<TPluginContext> | Plugin<TPluginContext>[]>)>;
15
+ /**
16
+ * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, factory functions, string paths to plugins, and arrays of plugins or plugin configurations. It validates the plugin configuration, resolves any plugin paths, and returns an array of initialized plugins.
17
+ *
18
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
19
+ * @param config - The plugin configuration, which can be in various forms such as a direct plugin instance, a string path to a plugin, a factory function that returns a plugin, or an array of plugins or plugin configurations. This configuration will be processed and validated to initialize the appropriate plugins.
20
+ * @returns A promise that resolves to an array of initialized plugins based on the provided configuration. If the configuration is invalid, an error will be thrown with details about the issue.
21
+ */
22
+ declare function initPlugin<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, config: PluginConfig<TPluginContext>, options?: ResolvePluginsOptions): Promise<Plugin<TPluginContext>[] | null>;
23
+ interface ResolvePluginsOptions {
24
+ /**
25
+ * If true, the plugin resolution process will skip logging messages about the plugin initialization. This can be useful in scenarios where you want to suppress plugin-related logs, such as when running in a non-interactive environment or when you want to reduce log verbosity. By default, this option is false, and plugin initialization messages will be logged using the context's logger.
26
+ */
27
+ skipLogging?: boolean;
28
+ }
29
+ /**
30
+ * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, plugin names, factory functions, and arrays of plugins. It validates the configuration, resolves plugin modules if necessary, and returns an array of initialized plugins ready to be added to the execution context.
31
+ *
32
+ * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.
33
+ * @param config - The plugin configuration, which can be in various forms such as a plugin instance, a plugin name string, a factory function that returns a plugin or an array of plugins, or an array of plugin configurations. The function will handle the resolution and initialization of the plugin(s) based on the provided configuration.
34
+ * @returns A promise that resolves to an array of initialized plugins that can be added to the execution context, or null if the configuration is invalid or results in no plugins being initialized.
35
+ */
36
+ declare function resolvePlugins<TResolvedConfig extends ResolvedConfig, TSystemContext, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext> | ExecutionContext<TResolvedConfig, TSystemContext>, TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> = PluginContext<TResolvedConfig, TSystemContext>>(context: TContext, config: PluginConfig<TPluginContext>, options?: ResolvePluginsOptions): Promise<Plugin<TPluginContext>[]>;
37
+ //#endregion
38
+ export { ResolvePluginsOptions, initPlugin, resolvePlugin, resolvePlugins };
39
+ //# sourceMappingURL=plugins.d.mts.map
@@ -0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AAA,GAEjC,OAAA,EAAS,QAAA,EACT,MAAA,EAAQ,YAAA,CAAa,cAAA,GACrB,OAAA,GAAS,qBAAA,GAA0B,OAAA,CAAA,MAAA,CAAA,cAAA"}
@@ -131,7 +131,7 @@ async function resolvePlugins(context, config, options = {}) {
131
131
  if (config) {
132
132
  const result = await initPlugin(context, config);
133
133
  if (result) for (const plugin of result) {
134
- if (!skipLogging) context.debug({
134
+ if (!skipLogging) context.trace({
135
135
  meta: { category: "plugins" },
136
136
  message: `Successfully initialized the ${chalk.bold.cyanBright(plugin.name)} plugin`
137
137
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/lib/plugins.ts"],"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 { install } from \"@stryke/fs/install\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport {\n findInvalidPluginConfig,\n isDuplicate,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n ExecutionContext,\n Plugin,\n PluginConfig,\n PluginConfigTuple,\n PluginContext,\n PluginFactory,\n ResolvedConfig\n} from \"../types\";\n\n/**\n * Resolve a plugin module based on the provided plugin path. This function checks if the plugin package is installed, attempts to import the plugin module, and handles various error cases such as missing packages or invalid module exports. It supports both direct plugin exports and plugins exported from a \"plugin\" subdirectory within the package.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param pluginPath - The path to the plugin module. This can be a package name, a scoped package name, or a path to a local module.\n * @returns A promise that resolves to the plugin module, which can be a plugin instance, a factory function that returns a plugin, or an array of plugins.\n */\nexport async function resolvePlugin<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n pluginPath: string\n): Promise<\n | Plugin<TPluginContext>\n | Plugin<TPluginContext>[]\n | ((\n options?: any\n ) => MaybePromise<Plugin<TPluginContext> | Plugin<TPluginContext>[]>)\n> {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [context.config.cwd, context.config.root]\n });\n if (!isInstalled && context.config.autoInstall) {\n context.warn(\n `The plugin package \"${\n pluginPath\n }\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: context.config.root\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n\n throw new Error(\n `An error occurred while installing the build plugin package \"${\n pluginPath\n }\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await context.resolver.plugin.import<{\n plugin?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n default?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n }>(context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\")));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await context.resolver.plugin.import<{\n plugin?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n default?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n }>(context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: Please ensure the plugin package's default export is a class that extends \\`Plugin\\` with a constructor that excepts a single arguments of type \\`PluginOptions\\`.`\n );\n }\n }\n }\n}\n\n/**\n * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, factory functions, string paths to plugins, and arrays of plugins or plugin configurations. It validates the plugin configuration, resolves any plugin paths, and returns an array of initialized plugins.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param config - The plugin configuration, which can be in various forms such as a direct plugin instance, a string path to a plugin, a factory function that returns a plugin, or an array of plugins or plugin configurations. This configuration will be processed and validated to initialize the appropriate plugins.\n * @returns A promise that resolves to an array of initialized plugins based on the provided configuration. If the configuration is invalid, an error will be thrown with details about the issue.\n */\nexport async function initPlugin<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n config: PluginConfig<TPluginContext>,\n options: ResolvePluginsOptions = {}\n): Promise<Plugin<TPluginContext>[] | null> {\n const { skipLogging = false } = options;\n\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = (await Promise.resolve(\n config as Promise<any>\n )) as PluginConfig<TPluginContext>;\n }\n\n if (!isPluginConfig<TPluginContext>(awaited)) {\n const invalid = findInvalidPluginConfig(awaited);\n\n throw new Error(\n `Invalid ${\n invalid && invalid.length > 1 ? \"plugins\" : \"plugin\"\n } specified in the configuration - ${\n invalid && invalid.length > 0\n ? JSON.stringify(awaited)\n : invalid?.join(\"\\n\\n\")\n } \\n\\nPlease ensure the value is one of the following: \\n - an instance of \\`Plugin\\` \\n - a plugin name \\n - an object with the \\`plugin\\` and \\`options\\` properties \\n - a tuple array with the plugin and options \\n - a factory function that returns a plugin or array of plugins \\n - an array of plugins or plugin configurations`\n );\n }\n\n let plugins!: Plugin<TPluginContext>[];\n if (isPlugin<TPluginContext>(awaited)) {\n plugins = [awaited];\n } else if (isFunction(awaited)) {\n plugins = toArray(await Promise.resolve(awaited()));\n } else if (isString(awaited)) {\n const resolved = await resolvePlugin<\n TResolvedConfig,\n TSystemContext,\n TContext\n >(context, awaited);\n if (isFunction(resolved)) {\n plugins = toArray(await Promise.resolve(resolved()));\n } else {\n plugins = toArray(resolved);\n }\n } else if (\n Array.isArray(awaited) &&\n (awaited as TPluginContext[]).every(isPlugin<TPluginContext>)\n ) {\n plugins = awaited as Plugin<TPluginContext>[];\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginConfig<TPluginContext>[]).every(\n isPluginConfig<TPluginContext>\n )\n ) {\n plugins = [];\n for (const pluginConfig of awaited as PluginConfig<TPluginContext>[]) {\n const initialized = await initPlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, pluginConfig);\n if (initialized) {\n plugins.push(...initialized);\n }\n }\n } else if (\n isPluginConfigTuple<TPluginContext>(awaited) ||\n isPluginConfigObject<TPluginContext>(awaited)\n ) {\n let pluginConfig!:\n | string\n | PluginFactory<TPluginContext>\n | Plugin<TPluginContext>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple<TPluginContext>(awaited)) {\n pluginConfig = awaited[0] as Plugin<TPluginContext>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = awaited.plugin as Plugin<TPluginContext>;\n pluginOptions = awaited.options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await resolvePlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, pluginConfig);\n if (isFunction(resolved)) {\n plugins = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n plugins = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n plugins = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<TPluginContext>)\n ) {\n plugins = pluginConfig;\n } else if (isPlugin<TPluginContext>(pluginConfig)) {\n plugins = toArray(pluginConfig);\n }\n }\n\n if (!plugins) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (plugins.length > 0 && !plugins.every(isPlugin<TPluginContext>)) {\n throw new Error(\n `The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n const result = [] as Plugin<TPluginContext>[];\n for (const plugin of plugins) {\n if (isDuplicate<TPluginContext>(plugin, context.plugins)) {\n if (!skipLogging) {\n context.trace({\n meta: {\n category: \"plugins\"\n },\n message: `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n });\n }\n } else {\n result.push(plugin);\n\n if (!skipLogging) {\n context.trace({\n meta: {\n category: \"plugins\"\n },\n message: `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n });\n }\n }\n }\n\n return result;\n}\n\nexport interface ResolvePluginsOptions {\n /**\n * If true, the plugin resolution process will skip logging messages about the plugin initialization. This can be useful in scenarios where you want to suppress plugin-related logs, such as when running in a non-interactive environment or when you want to reduce log verbosity. By default, this option is false, and plugin initialization messages will be logged using the context's logger.\n */\n skipLogging?: boolean;\n}\n\n/**\n * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, plugin names, factory functions, and arrays of plugins. It validates the configuration, resolves plugin modules if necessary, and returns an array of initialized plugins ready to be added to the execution context.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param config - The plugin configuration, which can be in various forms such as a plugin instance, a plugin name string, a factory function that returns a plugin or an array of plugins, or an array of plugin configurations. The function will handle the resolution and initialization of the plugin(s) based on the provided configuration.\n * @returns A promise that resolves to an array of initialized plugins that can be added to the execution context, or null if the configuration is invalid or results in no plugins being initialized.\n */\nexport async function resolvePlugins<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n config: PluginConfig<TPluginContext>,\n options: ResolvePluginsOptions = {}\n) {\n const { skipLogging = false } = options;\n\n const plugins = [] as Plugin<TPluginContext>[];\n if (config) {\n const result = await initPlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, config);\n if (result) {\n for (const plugin of result) {\n if (!skipLogging) {\n context.debug({\n meta: {\n category: \"plugins\"\n },\n message: `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n });\n }\n\n plugins.push(plugin);\n }\n }\n }\n\n return plugins;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwDA,eAAsB,cAWpB,SACA,YAOA;CACA,IACE,WAAW,WAAW,GAAG,KACzB,WAAW,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,SAAS,GAC/C;EACA,MAAM,SAAS,WAAW,MAAM,GAAG,EAAE,OAAO,OAAO;EACnD,aAAa,GAAG,OAAO,GAAG,GAAG,OAAO;CACtC;CAEA,MAAM,cAAc,gBAAgB,YAAY,EAC9C,OAAO,CAAC,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,EACjD,CAAC;CACD,IAAI,CAAC,eAAe,QAAQ,OAAO,aAAa;EAC9C,QAAQ,KACN,uBACE,WACD,wDACH;EAEA,MAAM,SAAS,MAAM,QAAQ,YAAY,EACvC,KAAK,QAAQ,OAAO,KACtB,CAAC;EACD,IAAI,SAAS,OAAO,QAAQ,KAAK,OAAO,WAAW,GAAG;GACpD,QAAQ,MAAM,OAAO,MAAM;GAE3B,MAAM,IAAI,MACR,gEACE,WACD,GACH;EACF;CACF;CAEA,IAAI;EAEF,MAAM,SAAS,MAAM,QAAQ,SAAS,OAAO,OAO1C,QAAQ,SAAS,OAAO,WAAW,UAAU,YAAY,QAAQ,CAAC,CAAC;EAEtE,MAAM,SAAS,OAAO,UAAU,OAAO;EACvC,IAAI,CAAC,QACH,MAAM,IAAI,MACR,uBAAuB,WAAW,kCACpC;EAGF,OAAO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AM,KAAK,WAC/B,OAAO,IACT,EAAE;EACJ,CAAC;CACH,OACK;EACL,OAAO,KAAK,MAAM;EAElB,IAAI,CAAC,aACH,QAAQ,MAAM;GACZ,MAAM,EACJ,UAAU,UACZ;GACA,SAAS,oBAAoB,MAAM,KAAK,WAAW,OAAO,IAAI,EAAE;EAClE,CAAC;CAEL;CAGF,OAAO;AACT;;;;;;;;AAgBA,eAAsB,eAWpB,SACA,QACA,UAAiC,CAAC,GAClC;CACA,MAAM,EAAE,cAAc,UAAU;CAEhC,MAAM,UAAU,CAAC;CACjB,IAAI,QAAQ;EACV,MAAM,SAAS,MAAM,WAKnB,SAAS,MAAM;EACjB,IAAI,QACF,KAAK,MAAM,UAAU,QAAQ;GAC3B,IAAI,CAAC,aACH,QAAQ,MAAM;IACZ,MAAM,EACJ,UAAU,UACZ;IACA,SAAS,gCAAgC,MAAM,KAAK,WAClD,OAAO,IACT,EAAE;GACJ,CAAC;GAGH,QAAQ,KAAK,MAAM;EACrB;CAEJ;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"plugins.mjs","names":[],"sources":["../../src/lib/plugins.ts"],"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 { install } from \"@stryke/fs/install\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport {\n findInvalidPluginConfig,\n isDuplicate,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n ExecutionContext,\n Plugin,\n PluginConfig,\n PluginConfigTuple,\n PluginContext,\n PluginFactory,\n ResolvedConfig\n} from \"../types\";\n\n/**\n * Resolve a plugin module based on the provided plugin path. This function checks if the plugin package is installed, attempts to import the plugin module, and handles various error cases such as missing packages or invalid module exports. It supports both direct plugin exports and plugins exported from a \"plugin\" subdirectory within the package.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param pluginPath - The path to the plugin module. This can be a package name, a scoped package name, or a path to a local module.\n * @returns A promise that resolves to the plugin module, which can be a plugin instance, a factory function that returns a plugin, or an array of plugins.\n */\nexport async function resolvePlugin<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n pluginPath: string\n): Promise<\n | Plugin<TPluginContext>\n | Plugin<TPluginContext>[]\n | ((\n options?: any\n ) => MaybePromise<Plugin<TPluginContext> | Plugin<TPluginContext>[]>)\n> {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [context.config.cwd, context.config.root]\n });\n if (!isInstalled && context.config.autoInstall) {\n context.warn(\n `The plugin package \"${\n pluginPath\n }\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: context.config.root\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n\n throw new Error(\n `An error occurred while installing the build plugin package \"${\n pluginPath\n }\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await context.resolver.plugin.import<{\n plugin?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n default?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n }>(context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\")));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await context.resolver.plugin.import<{\n plugin?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n default?:\n | Plugin<TPluginContext>\n | ((options?: any) => MaybePromise<Plugin<TPluginContext>>);\n }>(context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: Please ensure the plugin package's default export is a class that extends \\`Plugin\\` with a constructor that excepts a single arguments of type \\`PluginOptions\\`.`\n );\n }\n }\n }\n}\n\n/**\n * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, factory functions, string paths to plugins, and arrays of plugins or plugin configurations. It validates the plugin configuration, resolves any plugin paths, and returns an array of initialized plugins.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param config - The plugin configuration, which can be in various forms such as a direct plugin instance, a string path to a plugin, a factory function that returns a plugin, or an array of plugins or plugin configurations. This configuration will be processed and validated to initialize the appropriate plugins.\n * @returns A promise that resolves to an array of initialized plugins based on the provided configuration. If the configuration is invalid, an error will be thrown with details about the issue.\n */\nexport async function initPlugin<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n config: PluginConfig<TPluginContext>,\n options: ResolvePluginsOptions = {}\n): Promise<Plugin<TPluginContext>[] | null> {\n const { skipLogging = false } = options;\n\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = (await Promise.resolve(\n config as Promise<any>\n )) as PluginConfig<TPluginContext>;\n }\n\n if (!isPluginConfig<TPluginContext>(awaited)) {\n const invalid = findInvalidPluginConfig(awaited);\n\n throw new Error(\n `Invalid ${\n invalid && invalid.length > 1 ? \"plugins\" : \"plugin\"\n } specified in the configuration - ${\n invalid && invalid.length > 0\n ? JSON.stringify(awaited)\n : invalid?.join(\"\\n\\n\")\n } \\n\\nPlease ensure the value is one of the following: \\n - an instance of \\`Plugin\\` \\n - a plugin name \\n - an object with the \\`plugin\\` and \\`options\\` properties \\n - a tuple array with the plugin and options \\n - a factory function that returns a plugin or array of plugins \\n - an array of plugins or plugin configurations`\n );\n }\n\n let plugins!: Plugin<TPluginContext>[];\n if (isPlugin<TPluginContext>(awaited)) {\n plugins = [awaited];\n } else if (isFunction(awaited)) {\n plugins = toArray(await Promise.resolve(awaited()));\n } else if (isString(awaited)) {\n const resolved = await resolvePlugin<\n TResolvedConfig,\n TSystemContext,\n TContext\n >(context, awaited);\n if (isFunction(resolved)) {\n plugins = toArray(await Promise.resolve(resolved()));\n } else {\n plugins = toArray(resolved);\n }\n } else if (\n Array.isArray(awaited) &&\n (awaited as TPluginContext[]).every(isPlugin<TPluginContext>)\n ) {\n plugins = awaited as Plugin<TPluginContext>[];\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginConfig<TPluginContext>[]).every(\n isPluginConfig<TPluginContext>\n )\n ) {\n plugins = [];\n for (const pluginConfig of awaited as PluginConfig<TPluginContext>[]) {\n const initialized = await initPlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, pluginConfig);\n if (initialized) {\n plugins.push(...initialized);\n }\n }\n } else if (\n isPluginConfigTuple<TPluginContext>(awaited) ||\n isPluginConfigObject<TPluginContext>(awaited)\n ) {\n let pluginConfig!:\n | string\n | PluginFactory<TPluginContext>\n | Plugin<TPluginContext>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple<TPluginContext>(awaited)) {\n pluginConfig = awaited[0] as Plugin<TPluginContext>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = awaited.plugin as Plugin<TPluginContext>;\n pluginOptions = awaited.options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await resolvePlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, pluginConfig);\n if (isFunction(resolved)) {\n plugins = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n plugins = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n plugins = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<TPluginContext>)\n ) {\n plugins = pluginConfig;\n } else if (isPlugin<TPluginContext>(pluginConfig)) {\n plugins = toArray(pluginConfig);\n }\n }\n\n if (!plugins) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (plugins.length > 0 && !plugins.every(isPlugin<TPluginContext>)) {\n throw new Error(\n `The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n const result = [] as Plugin<TPluginContext>[];\n for (const plugin of plugins) {\n if (isDuplicate<TPluginContext>(plugin, context.plugins)) {\n if (!skipLogging) {\n context.trace({\n meta: {\n category: \"plugins\"\n },\n message: `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n });\n }\n } else {\n result.push(plugin);\n\n if (!skipLogging) {\n context.trace({\n meta: {\n category: \"plugins\"\n },\n message: `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n });\n }\n }\n }\n\n return result;\n}\n\nexport interface ResolvePluginsOptions {\n /**\n * If true, the plugin resolution process will skip logging messages about the plugin initialization. This can be useful in scenarios where you want to suppress plugin-related logs, such as when running in a non-interactive environment or when you want to reduce log verbosity. By default, this option is false, and plugin initialization messages will be logged using the context's logger.\n */\n skipLogging?: boolean;\n}\n\n/**\n * Initialize a plugin based on the provided plugin configuration. This function handles various forms of plugin configurations, including direct plugin instances, plugin names, factory functions, and arrays of plugins. It validates the configuration, resolves plugin modules if necessary, and returns an array of initialized plugins ready to be added to the execution context.\n *\n * @param context - The execution context in which the plugin will be initialized. This context provides access to configuration, logging, and other utilities that may be needed during plugin initialization.\n * @param config - The plugin configuration, which can be in various forms such as a plugin instance, a plugin name string, a factory function that returns a plugin or an array of plugins, or an array of plugin configurations. The function will handle the resolution and initialization of the plugin(s) based on the provided configuration.\n * @returns A promise that resolves to an array of initialized plugins that can be added to the execution context, or null if the configuration is invalid or results in no plugins being initialized.\n */\nexport async function resolvePlugins<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TContext extends\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext> =\n | EnvironmentContext<TResolvedConfig, TSystemContext>\n | ExecutionContext<TResolvedConfig, TSystemContext>,\n TPluginContext extends PluginContext<TResolvedConfig, TSystemContext> =\n PluginContext<TResolvedConfig, TSystemContext>\n>(\n context: TContext,\n config: PluginConfig<TPluginContext>,\n options: ResolvePluginsOptions = {}\n) {\n const { skipLogging = false } = options;\n\n const plugins = [] as Plugin<TPluginContext>[];\n if (config) {\n const result = await initPlugin<\n TResolvedConfig,\n TSystemContext,\n TContext,\n TPluginContext\n >(context, config);\n if (result) {\n for (const plugin of result) {\n if (!skipLogging) {\n context.trace({\n meta: {\n category: \"plugins\"\n },\n message: `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n });\n }\n\n plugins.push(plugin);\n }\n }\n }\n\n return plugins;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAwDA,eAAsB,cAWpB,SACA,YAOA;CACA,IACE,WAAW,WAAW,GAAG,KACzB,WAAW,MAAM,GAAG,EAAE,OAAO,OAAO,EAAE,SAAS,GAC/C;EACA,MAAM,SAAS,WAAW,MAAM,GAAG,EAAE,OAAO,OAAO;EACnD,aAAa,GAAG,OAAO,GAAG,GAAG,OAAO;CACtC;CAEA,MAAM,cAAc,gBAAgB,YAAY,EAC9C,OAAO,CAAC,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,EACjD,CAAC;CACD,IAAI,CAAC,eAAe,QAAQ,OAAO,aAAa;EAC9C,QAAQ,KACN,uBACE,WACD,wDACH;EAEA,MAAM,SAAS,MAAM,QAAQ,YAAY,EACvC,KAAK,QAAQ,OAAO,KACtB,CAAC;EACD,IAAI,SAAS,OAAO,QAAQ,KAAK,OAAO,WAAW,GAAG;GACpD,QAAQ,MAAM,OAAO,MAAM;GAE3B,MAAM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,CAAC,QAAQ,MAAM,QAAwB,GAC/D,MAAM,IAAI,MACR,qBAAqB,KAAK,UAAU,OAAO,EAAE,oGAC/C;CAGF,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,UAAU,SACnB,IAAI,YAA4B,QAAQ,QAAQ,OAAO,GACrD;MAAI,CAAC,aACH,QAAQ,MAAM;GACZ,MAAM,EACJ,UAAU,UACZ;GACA,SAAS,aAAa,MAAM,KAAK,WAC/B,OAAO,IACT,EAAE;EACJ,CAAC;CACH,OACK;EACL,OAAO,KAAK,MAAM;EAElB,IAAI,CAAC,aACH,QAAQ,MAAM;GACZ,MAAM,EACJ,UAAU,UACZ;GACA,SAAS,oBAAoB,MAAM,KAAK,WAAW,OAAO,IAAI,EAAE;EAClE,CAAC;CAEL;CAGF,OAAO;AACT;;;;;;;;AAgBA,eAAsB,eAWpB,SACA,QACA,UAAiC,CAAC,GAClC;CACA,MAAM,EAAE,cAAc,UAAU;CAEhC,MAAM,UAAU,CAAC;CACjB,IAAI,QAAQ;EACV,MAAM,SAAS,MAAM,WAKnB,SAAS,MAAM;EACjB,IAAI,QACF,KAAK,MAAM,UAAU,QAAQ;GAC3B,IAAI,CAAC,aACH,QAAQ,MAAM;IACZ,MAAM,EACJ,UAAU,UACZ;IACA,SAAS,gCAAgC,MAAM,KAAK,WAClD,OAAO,IACT,EAAE;GACJ,CAAC;GAGH,QAAQ,KAAK,MAAM;EACrB;CAEJ;CAEA,OAAO;AACT"}
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_chunk = require('../chunk-C_NdSu1c.cjs');
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
4
  let defu = require("defu");
5
- defu = require_chunk.__toESM(defu, 1);
5
+ defu = require_runtime.__toESM(defu, 1);
6
6
  let jiti = require("jiti");
7
7
 
8
8
  //#region src/lib/resolver.ts
@@ -1,2 +1,20 @@
1
- import { n as createResolver, t as CreateResolverOptions } from "../resolver-CfCl--Eh.cjs";
2
- export { CreateResolverOptions, createResolver };
1
+ import { Resolver } from "../types/context.cjs";
2
+ import { ResolvedConfig } from "../types/config.cjs";
3
+ import { JitiOptions } from "jiti";
4
+
5
+ //#region src/lib/resolver.d.ts
6
+ type CreateResolverOptions = Omit<JitiOptions, "fsCache" | "moduleCache" | "interopDefault"> & Partial<Pick<ResolvedConfig, "mode" | "skipCache">> & {
7
+ cwd: string;
8
+ root: string;
9
+ cacheDir: string;
10
+ };
11
+ /**
12
+ * Create a Jiti resolver for the given workspace and project root.
13
+ *
14
+ * @param options - The options for creating the resolver.
15
+ * @returns A Jiti instance configured for the specified workspace and project root.
16
+ */
17
+ declare function createResolver(options: CreateResolverOptions): Resolver;
18
+ //#endregion
19
+ export { CreateResolverOptions, createResolver };
20
+ //# sourceMappingURL=resolver.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.cts","names":[],"sources":["../../src/lib/resolver.ts"],"mappings":";;;;;KAwBY,qBAAA,GAAwB,IAAA,CAClC,WAAA,kDAGA,OAAA,CAAQ,IAAA,CAAK,cAAA;EACX,GAAA;EACA,IAAA;EACA,QAAA;AAAA;;;;;;;iBA0BY,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,QAAQ"}
@@ -1,2 +1,20 @@
1
- import { n as createResolver, t as CreateResolverOptions } from "../resolver-CdBAh8dA.mjs";
2
- export { CreateResolverOptions, createResolver };
1
+ import { Resolver } from "../types/context.mjs";
2
+ import { ResolvedConfig } from "../types/config.mjs";
3
+ import { JitiOptions } from "jiti";
4
+
5
+ //#region src/lib/resolver.d.ts
6
+ type CreateResolverOptions = Omit<JitiOptions, "fsCache" | "moduleCache" | "interopDefault"> & Partial<Pick<ResolvedConfig, "mode" | "skipCache">> & {
7
+ cwd: string;
8
+ root: string;
9
+ cacheDir: string;
10
+ };
11
+ /**
12
+ * Create a Jiti resolver for the given workspace and project root.
13
+ *
14
+ * @param options - The options for creating the resolver.
15
+ * @returns A Jiti instance configured for the specified workspace and project root.
16
+ */
17
+ declare function createResolver(options: CreateResolverOptions): Resolver;
18
+ //#endregion
19
+ export { CreateResolverOptions, createResolver };
20
+ //# sourceMappingURL=resolver.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolver.d.mts","names":[],"sources":["../../src/lib/resolver.ts"],"mappings":";;;;;KAwBY,qBAAA,GAAwB,IAAA,CAClC,WAAA,kDAGA,OAAA,CAAQ,IAAA,CAAK,cAAA;EACX,GAAA;EACA,IAAA;EACA,QAAA;AAAA;;;;;;;iBA0BY,cAAA,CAAe,OAAA,EAAS,qBAAA,GAAwB,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_fs = require('../fs-C2lru696.cjs');
2
+ const require_fs = require('../schemas/fs.cjs');
3
3
 
4
4
  exports.FileId = require_fs.FileId;
5
5
  exports.FileMetadata = require_fs.FileMetadata;
@@ -1,2 +1,2 @@
1
- import { a as FileSystem, i as FileStorage, n as FileMetadata, o as _capnpFileId, r as FileMetadata_KeyValuePair, t as FileId } from "../schemas-Zvqwdrw_.cjs";
1
+ import { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId } from "../schemas/fs.cjs";
2
2
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId };
@@ -1,2 +1,2 @@
1
- import { a as FileSystem, i as FileStorage, n as FileMetadata, o as _capnpFileId, r as FileMetadata_KeyValuePair, t as FileId } from "../schemas-Zvqwdrw_.mjs";
1
+ import { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId } from "../schemas/fs.mjs";
2
2
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId };
@@ -1,3 +1,3 @@
1
- import { a as FileSystem, i as FileStorage, n as FileMetadata, o as _capnpFileId, r as FileMetadata_KeyValuePair, t as FileId } from "../fs-DqLn15uU.mjs";
1
+ import { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId } from "../schemas/fs.mjs";
2
2
 
3
3
  export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, _capnpFileId };
@@ -1,2 +1,126 @@
1
- import { a as StreamReader, c as createStreamReader, i as StreamErrorPayload, l as createStreamSink, n as CreateStreamReaderOptions, o as StreamSink, r as CreateStreamSinkOptions, s as StreamSinkEvents, t as BufferedChunk } from "../streaming-channel-CiyFd_6l.cjs";
2
- export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
1
+ import { EventEmitter } from "devframe/types";
2
+
3
+ //#region src/lib/streaming-channel.d.ts
4
+ /**
5
+ * Serialized error shape sent over the wire when a stream ends with a failure.
6
+ * Stays JSON-safe so the strict-JSON encoder can carry it without coercion.
7
+ */
8
+ interface StreamErrorPayload {
9
+ name: string;
10
+ message: string;
11
+ }
12
+ /**
13
+ * Single buffered chunk in the server-side ring buffer.
14
+ *
15
+ * Sequence numbers start at 1 and increment per write. Subscribers track
16
+ * `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can
17
+ * replay any chunks the client missed during a brief disconnect.
18
+ */
19
+ interface BufferedChunk<T> {
20
+ seq: number;
21
+ chunk: T;
22
+ }
23
+ interface StreamSinkEvents<T> {
24
+ /** Fired for each `write()`. The RPC layer subscribes and broadcasts. */
25
+ chunk: (seq: number, chunk: T) => void;
26
+ /** Terminal — fired exactly once per sink lifetime. */
27
+ end: (error?: StreamErrorPayload) => void;
28
+ }
29
+ interface CreateStreamSinkOptions {
30
+ id?: string;
31
+ /**
32
+ * Size of the per-stream ring buffer kept for replay-on-resubscribe.
33
+ * `0` (default) disables replay.
34
+ */
35
+ replayWindow?: number;
36
+ }
37
+ /**
38
+ * Server-side producer handle. Two equivalent surfaces share one piece of
39
+ * state: the imperative `write/error/close` triple, and a `WritableStream<T>`
40
+ * for `pipeTo`-style consumption.
41
+ */
42
+ interface StreamSink<T> {
43
+ /** Stable id used by clients to subscribe. */
44
+ readonly id: string;
45
+ /**
46
+ * Aborts when the consumer cancels (server-side) or when the transport
47
+ * loses every subscriber. Producers should poll `signal.aborted` and exit
48
+ * cleanly.
49
+ */
50
+ readonly signal: AbortSignal;
51
+ /** `true` after `close()` / `error()`. Further writes throw. */
52
+ readonly closed: boolean;
53
+ /** Last allocated sequence number. `0` until the first write. */
54
+ readonly lastSeq: number;
55
+ write: (chunk: T) => void;
56
+ error: (reason: unknown) => void;
57
+ close: () => void;
58
+ /** External-cancel path. Aborts the signal so handlers can short-circuit. */
59
+ abort: (reason?: unknown) => void;
60
+ /** `WritableStream<T>` adapter — same in-memory state as the imperative API. */
61
+ readonly writable: WritableStream<T>;
62
+ /**
63
+ * Internal — RPC layer subscribes to receive chunk/end notifications.
64
+ * Not part of the public contract; do not call directly.
65
+ *
66
+ * @internal
67
+ */
68
+ readonly events: EventEmitter<StreamSinkEvents<T>>;
69
+ /**
70
+ * Internal — replay buffer. RPC layer reads on (re)subscribe to feed
71
+ * missed chunks before going live.
72
+ *
73
+ * @internal
74
+ */
75
+ readonly buffer: ReadonlyArray<BufferedChunk<T>>;
76
+ }
77
+ interface CreateStreamReaderOptions {
78
+ id?: string;
79
+ /**
80
+ * Maximum number of buffered chunks held client-side while the consumer
81
+ * isn't draining. On overflow, the oldest chunk is dropped.
82
+ */
83
+ highWaterMark?: number;
84
+ /**
85
+ * Called when the chunk queue overflows the high-water mark. The RPC
86
+ * layer wires this to a coded warning; the primitive itself is
87
+ * RPC-agnostic.
88
+ */
89
+ onOverflow?: (dropped: number) => void;
90
+ /** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */
91
+ onCancel?: () => void;
92
+ }
93
+ /**
94
+ * Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)
95
+ * and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they
96
+ * share a single internal queue, so concurrent draining will race.
97
+ */
98
+ interface StreamReader<T> extends AsyncIterable<T> {
99
+ readonly id: string;
100
+ readonly cancelled: boolean;
101
+ readonly done: boolean;
102
+ /** Highest `seq` observed. Used for replay on reconnect. */
103
+ readonly lastSeenSeq: number;
104
+ /** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */
105
+ readonly readable: ReadableStream<T>;
106
+ cancel: () => void;
107
+ /** @internal */
108
+ _push: (seq: number, chunk: T) => void;
109
+ /** @internal */
110
+ _end: (error?: StreamErrorPayload) => void;
111
+ }
112
+ /**
113
+ * Build a server-side stream sink. RPC-agnostic — the RPC host wires
114
+ * `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay
115
+ * for late or reconnecting subscribers.
116
+ */
117
+ declare function createStreamSink<T>(options?: CreateStreamSinkOptions): StreamSink<T>;
118
+ /**
119
+ * Build a client-side stream reader. RPC-agnostic — the RPC host calls
120
+ * `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the
121
+ * terminal frame. Consumers iterate with `for await` or pipe `readable`.
122
+ */
123
+ declare function createStreamReader<T>(options?: CreateStreamReaderOptions): StreamReader<T>;
124
+ //#endregion
125
+ export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
126
+ //# sourceMappingURL=streaming-channel.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-channel.d.cts","names":[],"sources":["../../src/lib/streaming-channel.ts"],"mappings":";;;;;AA0BA;;UAAiB,kBAAA;EACf,IAAA;EACA,OAAO;AAAA;;;;;;;;UAUQ,aAAA;EACf,GAAA;EACA,KAAA,EAAO,CAAC;AAAA;AAAA,UAGO,gBAAA;EAIiB;EAFhC,KAAA,GAAQ,GAAA,UAAa,KAAA,EAAO,CAAA;EAA5B;EAEA,GAAA,GAAM,KAAA,GAAQ,kB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