@powerlines/core 0.14.5 → 0.15.1

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 (391) hide show
  1. package/dist/constants/api.cjs +6 -5
  2. package/dist/constants/api.d.cts +3 -3
  3. package/dist/constants/api.d.cts.map +1 -1
  4. package/dist/constants/api.d.mts +3 -3
  5. package/dist/constants/api.d.mts.map +1 -1
  6. package/dist/constants/api.mjs +4 -4
  7. package/dist/constants/api.mjs.map +1 -1
  8. package/dist/constants/commands.cjs +3 -2
  9. package/dist/constants/commands.d.cts +1 -1
  10. package/dist/constants/commands.d.mts +1 -1
  11. package/dist/constants/commands.mjs +2 -2
  12. package/dist/constants/commands.mjs.map +1 -1
  13. package/dist/constants/devtools.cjs +23 -0
  14. package/dist/constants/devtools.d.cts +13 -0
  15. package/dist/constants/devtools.d.cts.map +1 -0
  16. package/dist/constants/devtools.d.mts +13 -0
  17. package/dist/constants/devtools.d.mts.map +1 -0
  18. package/dist/constants/devtools.mjs +14 -0
  19. package/dist/constants/devtools.mjs.map +1 -0
  20. package/dist/constants/environments.cjs +1 -0
  21. package/dist/constants/extensions.cjs +21 -0
  22. package/dist/constants/extensions.d.cts +5 -0
  23. package/dist/constants/extensions.d.cts.map +1 -0
  24. package/dist/constants/extensions.d.mts +5 -0
  25. package/dist/constants/extensions.d.mts.map +1 -0
  26. package/dist/constants/extensions.mjs +20 -0
  27. package/dist/constants/extensions.mjs.map +1 -0
  28. package/dist/constants/fs.cjs +1 -0
  29. package/dist/constants/hooks.cjs +1 -0
  30. package/dist/constants/index.cjs +48 -30
  31. package/dist/constants/index.d.cts +5 -3
  32. package/dist/constants/index.d.mts +5 -3
  33. package/dist/constants/index.mjs +5 -3
  34. package/dist/constants/log-level.cjs +90 -0
  35. package/dist/constants/log-level.d.cts +63 -0
  36. package/dist/constants/log-level.d.cts.map +1 -0
  37. package/dist/constants/log-level.d.mts +63 -0
  38. package/dist/constants/log-level.d.mts.map +1 -0
  39. package/dist/constants/log-level.mjs +82 -0
  40. package/dist/constants/log-level.mjs.map +1 -0
  41. package/dist/constants/meta.cjs +1 -0
  42. package/dist/constants/plugin.cjs +3 -2
  43. package/dist/constants/plugin.d.cts +2 -2
  44. package/dist/constants/plugin.d.mts +2 -2
  45. package/dist/context/base-context.cjs +127 -0
  46. package/dist/context/base-context.d.cts +81 -0
  47. package/dist/context/base-context.d.cts.map +1 -0
  48. package/dist/context/base-context.d.mts +81 -0
  49. package/dist/context/base-context.d.mts.map +1 -0
  50. package/dist/context/base-context.mjs +125 -0
  51. package/dist/context/base-context.mjs.map +1 -0
  52. package/dist/context/context.cjs +934 -0
  53. package/dist/context/context.d.cts +369 -0
  54. package/dist/context/context.d.cts.map +1 -0
  55. package/dist/context/context.d.mts +369 -0
  56. package/dist/context/context.d.mts.map +1 -0
  57. package/dist/context/context.mjs +932 -0
  58. package/dist/context/context.mjs.map +1 -0
  59. package/dist/context/environment-context.cjs +219 -0
  60. package/dist/context/environment-context.d.cts +100 -0
  61. package/dist/context/environment-context.d.cts.map +1 -0
  62. package/dist/context/environment-context.d.mts +100 -0
  63. package/dist/context/environment-context.d.mts.map +1 -0
  64. package/dist/context/environment-context.mjs +218 -0
  65. package/dist/context/environment-context.mjs.map +1 -0
  66. package/dist/context/execution-context.cjs +230 -0
  67. package/dist/context/execution-context.d.cts +101 -0
  68. package/dist/context/execution-context.d.cts.map +1 -0
  69. package/dist/context/execution-context.d.mts +101 -0
  70. package/dist/context/execution-context.d.mts.map +1 -0
  71. package/dist/context/execution-context.mjs +228 -0
  72. package/dist/context/execution-context.mjs.map +1 -0
  73. package/dist/context/index.cjs +12 -0
  74. package/dist/context/index.d.cts +6 -0
  75. package/dist/context/index.d.mts +6 -0
  76. package/dist/context/index.mjs +7 -0
  77. package/dist/context/plugin-context.cjs +83 -0
  78. package/dist/context/plugin-context.d.cts +18 -0
  79. package/dist/context/plugin-context.d.cts.map +1 -0
  80. package/dist/context/plugin-context.d.mts +18 -0
  81. package/dist/context/plugin-context.d.mts.map +1 -0
  82. package/dist/context/plugin-context.mjs +82 -0
  83. package/dist/context/plugin-context.mjs.map +1 -0
  84. package/dist/index.cjs +62 -9
  85. package/dist/index.d.cts +20 -9
  86. package/dist/index.d.mts +20 -9
  87. package/dist/index.mjs +17 -5
  88. package/dist/lib/config.cjs +160 -15
  89. package/dist/lib/config.d.cts +92 -6
  90. package/dist/lib/config.d.cts.map +1 -1
  91. package/dist/lib/config.d.mts +92 -6
  92. package/dist/lib/config.d.mts.map +1 -1
  93. package/dist/lib/config.mjs +154 -16
  94. package/dist/lib/config.mjs.map +1 -1
  95. package/dist/lib/context-helpers.cjs +43 -0
  96. package/dist/lib/context-helpers.d.cts +19 -0
  97. package/dist/lib/context-helpers.d.cts.map +1 -0
  98. package/dist/lib/context-helpers.d.mts +19 -0
  99. package/dist/lib/context-helpers.d.mts.map +1 -0
  100. package/dist/lib/context-helpers.mjs +41 -0
  101. package/dist/lib/context-helpers.mjs.map +1 -0
  102. package/dist/lib/entry.cjs +5 -5
  103. package/dist/lib/entry.d.cts.map +1 -1
  104. package/dist/lib/entry.d.mts.map +1 -1
  105. package/dist/lib/entry.mjs +5 -5
  106. package/dist/lib/entry.mjs.map +1 -1
  107. package/dist/lib/environment.cjs +72 -0
  108. package/dist/lib/environment.d.cts +12 -0
  109. package/dist/lib/environment.d.cts.map +1 -0
  110. package/dist/lib/environment.d.mts +12 -0
  111. package/dist/lib/environment.d.mts.map +1 -0
  112. package/dist/lib/environment.mjs +67 -0
  113. package/dist/lib/environment.mjs.map +1 -0
  114. package/dist/lib/events.cjs +43 -0
  115. package/dist/lib/events.d.cts +10 -0
  116. package/dist/lib/events.d.cts.map +1 -0
  117. package/dist/lib/events.d.mts +10 -0
  118. package/dist/lib/events.d.mts.map +1 -0
  119. package/dist/lib/events.mjs +42 -0
  120. package/dist/lib/events.mjs.map +1 -0
  121. package/dist/lib/generate-types.cjs +371 -0
  122. package/dist/lib/generate-types.d.cts +67 -0
  123. package/dist/lib/generate-types.d.cts.map +1 -0
  124. package/dist/lib/generate-types.d.mts +67 -0
  125. package/dist/lib/generate-types.d.mts.map +1 -0
  126. package/dist/lib/generate-types.mjs +368 -0
  127. package/dist/lib/generate-types.mjs.map +1 -0
  128. package/dist/lib/hooks.cjs +152 -0
  129. package/dist/lib/hooks.d.cts +28 -0
  130. package/dist/lib/hooks.d.cts.map +1 -0
  131. package/dist/lib/hooks.d.mts +28 -0
  132. package/dist/lib/hooks.d.mts.map +1 -0
  133. package/dist/lib/hooks.mjs +147 -0
  134. package/dist/lib/hooks.mjs.map +1 -0
  135. package/dist/lib/index.cjs +64 -9
  136. package/dist/lib/index.d.cts +15 -3
  137. package/dist/lib/index.d.mts +15 -3
  138. package/dist/lib/index.mjs +19 -5
  139. package/dist/lib/install-dependencies.cjs +25 -0
  140. package/dist/lib/install-dependencies.d.cts +12 -0
  141. package/dist/lib/install-dependencies.d.cts.map +1 -0
  142. package/dist/lib/install-dependencies.d.mts +12 -0
  143. package/dist/lib/install-dependencies.d.mts.map +1 -0
  144. package/dist/lib/install-dependencies.mjs +24 -0
  145. package/dist/lib/install-dependencies.mjs.map +1 -0
  146. package/dist/lib/meta.cjs +57 -0
  147. package/dist/lib/meta.d.cts +34 -0
  148. package/dist/lib/meta.d.cts.map +1 -0
  149. package/dist/lib/meta.d.mts +34 -0
  150. package/dist/lib/meta.d.mts.map +1 -0
  151. package/dist/lib/meta.mjs +54 -0
  152. package/dist/lib/meta.mjs.map +1 -0
  153. package/dist/lib/plugins.cjs +150 -0
  154. package/dist/lib/plugins.d.cts +40 -0
  155. package/dist/lib/plugins.d.cts.map +1 -0
  156. package/dist/lib/plugins.d.mts +40 -0
  157. package/dist/lib/plugins.d.mts.map +1 -0
  158. package/dist/lib/plugins.mjs +146 -0
  159. package/dist/lib/plugins.mjs.map +1 -0
  160. package/dist/lib/resolver.cjs +35 -0
  161. package/dist/lib/resolver.d.cts +21 -0
  162. package/dist/lib/resolver.d.cts.map +1 -0
  163. package/dist/lib/resolver.d.mts +21 -0
  164. package/dist/lib/resolver.d.mts.map +1 -0
  165. package/dist/lib/resolver.mjs +33 -0
  166. package/dist/lib/resolver.mjs.map +1 -0
  167. package/dist/lib/schemas.cjs +9 -0
  168. package/dist/lib/schemas.d.cts +2 -0
  169. package/dist/lib/schemas.d.mts +2 -0
  170. package/dist/lib/schemas.mjs +3 -0
  171. package/dist/lib/streaming-channel.cjs +260 -0
  172. package/dist/lib/streaming-channel.d.cts +133 -0
  173. package/dist/lib/streaming-channel.d.cts.map +1 -0
  174. package/dist/lib/streaming-channel.d.mts +133 -0
  175. package/dist/lib/streaming-channel.d.mts.map +1 -0
  176. package/dist/lib/streaming-channel.mjs +258 -0
  177. package/dist/lib/streaming-channel.mjs.map +1 -0
  178. package/dist/lib/typescript/index.cjs +16 -0
  179. package/dist/lib/typescript/index.d.cts +3 -0
  180. package/dist/lib/typescript/index.d.mts +3 -0
  181. package/dist/lib/typescript/index.mjs +4 -0
  182. package/dist/lib/typescript/ts-morph.cjs +105 -0
  183. package/dist/lib/typescript/ts-morph.d.cts +38 -0
  184. package/dist/lib/typescript/ts-morph.d.cts.map +1 -0
  185. package/dist/lib/typescript/ts-morph.d.mts +38 -0
  186. package/dist/lib/typescript/ts-morph.d.mts.map +1 -0
  187. package/dist/lib/typescript/ts-morph.mjs +102 -0
  188. package/dist/lib/typescript/ts-morph.mjs.map +1 -0
  189. package/dist/lib/typescript/tsconfig.cjs +253 -0
  190. package/dist/lib/typescript/tsconfig.d.cts +77 -0
  191. package/dist/lib/typescript/tsconfig.d.cts.map +1 -0
  192. package/dist/lib/typescript/tsconfig.d.mts +77 -0
  193. package/dist/lib/typescript/tsconfig.d.mts.map +1 -0
  194. package/dist/lib/typescript/tsconfig.mjs +240 -0
  195. package/dist/lib/typescript/tsconfig.mjs.map +1 -0
  196. package/dist/lib/unplugin/helpers.cjs +2 -2
  197. package/dist/lib/unplugin/module-resolution.cjs +18 -18
  198. package/dist/lib/unplugin/module-resolution.mjs +18 -18
  199. package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
  200. package/dist/lib/unplugin/plugin.cjs +55 -62
  201. package/dist/lib/unplugin/plugin.d.cts +10 -11
  202. package/dist/lib/unplugin/plugin.d.cts.map +1 -1
  203. package/dist/lib/unplugin/plugin.d.mts +10 -11
  204. package/dist/lib/unplugin/plugin.d.mts.map +1 -1
  205. package/dist/lib/unplugin/plugin.mjs +55 -62
  206. package/dist/lib/unplugin/plugin.mjs.map +1 -1
  207. package/dist/lib/utilities/file-header.cjs +2 -2
  208. package/dist/lib/utilities/file-header.mjs +2 -2
  209. package/dist/lib/utilities/file-header.mjs.map +1 -1
  210. package/dist/lib/utilities/format.cjs +1 -1
  211. package/dist/lib/utilities/format.mjs +1 -1
  212. package/dist/lib/utilities/index.cjs +2 -2
  213. package/dist/lib/utilities/index.mjs +2 -2
  214. package/dist/lib/utilities/write-file.cjs +1 -2
  215. package/dist/lib/utilities/write-file.d.cts +1 -1
  216. package/dist/lib/utilities/write-file.d.cts.map +1 -1
  217. package/dist/lib/utilities/write-file.d.mts +1 -1
  218. package/dist/lib/utilities/write-file.d.mts.map +1 -1
  219. package/dist/lib/utilities/write-file.mjs +1 -2
  220. package/dist/lib/utilities/write-file.mjs.map +1 -1
  221. package/dist/lib/vfs.cjs +1104 -0
  222. package/dist/lib/vfs.d.cts +321 -0
  223. package/dist/lib/vfs.d.cts.map +1 -0
  224. package/dist/lib/vfs.d.mts +321 -0
  225. package/dist/lib/vfs.d.mts.map +1 -0
  226. package/dist/lib/vfs.mjs +1102 -0
  227. package/dist/lib/vfs.mjs.map +1 -0
  228. package/dist/plugin-base.cjs +1 -1
  229. package/dist/plugin-base.mjs +1 -1
  230. package/dist/plugin-base.mjs.map +1 -1
  231. package/dist/plugin-utils/build-helpers.cjs +2 -2
  232. package/dist/plugin-utils/build-helpers.mjs +2 -2
  233. package/dist/plugin-utils/build-helpers.mjs.map +1 -1
  234. package/dist/plugin-utils/context-helpers.cjs +22 -12
  235. package/dist/plugin-utils/context-helpers.d.cts +9 -1
  236. package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
  237. package/dist/plugin-utils/context-helpers.d.mts +9 -1
  238. package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
  239. package/dist/plugin-utils/context-helpers.mjs +22 -13
  240. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  241. package/dist/plugin-utils/filter.cjs +13 -5
  242. package/dist/plugin-utils/filter.d.cts +2 -1
  243. package/dist/plugin-utils/filter.d.cts.map +1 -1
  244. package/dist/plugin-utils/filter.d.mts +2 -1
  245. package/dist/plugin-utils/filter.d.mts.map +1 -1
  246. package/dist/plugin-utils/filter.mjs +13 -6
  247. package/dist/plugin-utils/filter.mjs.map +1 -1
  248. package/dist/plugin-utils/format.cjs +44 -0
  249. package/dist/plugin-utils/format.d.cts +11 -0
  250. package/dist/plugin-utils/format.d.cts.map +1 -0
  251. package/dist/plugin-utils/format.d.mts +11 -0
  252. package/dist/plugin-utils/format.d.mts.map +1 -0
  253. package/dist/plugin-utils/format.mjs +43 -0
  254. package/dist/plugin-utils/format.mjs.map +1 -0
  255. package/dist/plugin-utils/helpers.cjs +6 -6
  256. package/dist/plugin-utils/helpers.d.cts +15 -15
  257. package/dist/plugin-utils/helpers.d.cts.map +1 -1
  258. package/dist/plugin-utils/helpers.d.mts +15 -15
  259. package/dist/plugin-utils/helpers.d.mts.map +1 -1
  260. package/dist/plugin-utils/helpers.mjs +1 -1
  261. package/dist/plugin-utils/helpers.mjs.map +1 -1
  262. package/dist/plugin-utils/index.cjs +34 -4
  263. package/dist/plugin-utils/index.d.cts +7 -4
  264. package/dist/plugin-utils/index.d.mts +7 -4
  265. package/dist/plugin-utils/index.mjs +9 -6
  266. package/dist/plugin-utils/install.cjs +47 -0
  267. package/dist/plugin-utils/install.d.cts +23 -0
  268. package/dist/plugin-utils/install.d.cts.map +1 -0
  269. package/dist/plugin-utils/install.d.mts +23 -0
  270. package/dist/plugin-utils/install.d.mts.map +1 -0
  271. package/dist/plugin-utils/install.mjs +45 -0
  272. package/dist/plugin-utils/install.mjs.map +1 -0
  273. package/dist/plugin-utils/logging.cjs +588 -1
  274. package/dist/plugin-utils/logging.d.cts +93 -1
  275. package/dist/plugin-utils/logging.d.cts.map +1 -1
  276. package/dist/plugin-utils/logging.d.mts +93 -1
  277. package/dist/plugin-utils/logging.d.mts.map +1 -1
  278. package/dist/plugin-utils/logging.mjs +572 -1
  279. package/dist/plugin-utils/logging.mjs.map +1 -1
  280. package/dist/plugin-utils/merge.cjs +1 -1
  281. package/dist/plugin-utils/merge.mjs +1 -1
  282. package/dist/plugin-utils/modules.cjs +1 -1
  283. package/dist/plugin-utils/modules.mjs +1 -1
  284. package/dist/plugin-utils/modules.mjs.map +1 -1
  285. package/dist/plugin-utils/paths.cjs +6 -2
  286. package/dist/plugin-utils/paths.mjs +6 -2
  287. package/dist/plugin-utils/paths.mjs.map +1 -1
  288. package/dist/plugin-utils/virtual.cjs +80 -0
  289. package/dist/plugin-utils/virtual.d.cts +69 -0
  290. package/dist/plugin-utils/virtual.d.cts.map +1 -0
  291. package/dist/plugin-utils/virtual.d.mts +69 -0
  292. package/dist/plugin-utils/virtual.d.mts.map +1 -0
  293. package/dist/plugin-utils/virtual.mjs +73 -0
  294. package/dist/plugin-utils/virtual.mjs.map +1 -0
  295. package/dist/schemas/fs.cjs +232 -0
  296. package/dist/schemas/fs.d.cts +127 -0
  297. package/dist/schemas/fs.d.cts.map +1 -0
  298. package/dist/schemas/fs.d.mts +127 -0
  299. package/dist/schemas/fs.d.mts.map +1 -0
  300. package/dist/schemas/fs.mjs +226 -0
  301. package/dist/schemas/fs.mjs.map +1 -0
  302. package/dist/storage/base.cjs +216 -0
  303. package/dist/storage/base.d.cts +201 -0
  304. package/dist/storage/base.d.cts.map +1 -0
  305. package/dist/storage/base.d.mts +201 -0
  306. package/dist/storage/base.d.mts.map +1 -0
  307. package/dist/storage/base.mjs +215 -0
  308. package/dist/storage/base.mjs.map +1 -0
  309. package/dist/storage/file-system.cjs +180 -0
  310. package/dist/storage/file-system.d.cts +129 -0
  311. package/dist/storage/file-system.d.cts.map +1 -0
  312. package/dist/storage/file-system.d.mts +129 -0
  313. package/dist/storage/file-system.d.mts.map +1 -0
  314. package/dist/storage/file-system.mjs +179 -0
  315. package/dist/storage/file-system.mjs.map +1 -0
  316. package/dist/storage/helpers.cjs +37 -0
  317. package/dist/storage/helpers.d.cts +25 -0
  318. package/dist/storage/helpers.d.cts.map +1 -0
  319. package/dist/storage/helpers.d.mts +25 -0
  320. package/dist/storage/helpers.d.mts.map +1 -0
  321. package/dist/storage/helpers.mjs +34 -0
  322. package/dist/storage/helpers.mjs.map +1 -0
  323. package/dist/storage/index.cjs +12 -0
  324. package/dist/storage/index.d.cts +5 -0
  325. package/dist/storage/index.d.mts +5 -0
  326. package/dist/storage/index.mjs +6 -0
  327. package/dist/storage/virtual.cjs +98 -0
  328. package/dist/storage/virtual.d.cts +80 -0
  329. package/dist/storage/virtual.d.cts.map +1 -0
  330. package/dist/storage/virtual.d.mts +80 -0
  331. package/dist/storage/virtual.d.mts.map +1 -0
  332. package/dist/storage/virtual.mjs +97 -0
  333. package/dist/storage/virtual.mjs.map +1 -0
  334. package/dist/types/api.d.cts +18 -152
  335. package/dist/types/api.d.cts.map +1 -1
  336. package/dist/types/api.d.mts +18 -152
  337. package/dist/types/api.d.mts.map +1 -1
  338. package/dist/types/config.d.cts +194 -135
  339. package/dist/types/config.d.cts.map +1 -1
  340. package/dist/types/config.d.mts +195 -136
  341. package/dist/types/config.d.mts.map +1 -1
  342. package/dist/types/context.d.cts +152 -128
  343. package/dist/types/context.d.cts.map +1 -1
  344. package/dist/types/context.d.mts +155 -131
  345. package/dist/types/context.d.mts.map +1 -1
  346. package/dist/types/fs.d.mts +1 -1
  347. package/dist/types/index.d.cts +5 -6
  348. package/dist/types/index.d.mts +5 -6
  349. package/dist/types/logging.d.cts +161 -0
  350. package/dist/types/logging.d.cts.map +1 -0
  351. package/dist/types/logging.d.mts +161 -0
  352. package/dist/types/logging.d.mts.map +1 -0
  353. package/dist/types/plugin.d.cts +6 -9
  354. package/dist/types/plugin.d.cts.map +1 -1
  355. package/dist/types/plugin.d.mts +6 -9
  356. package/dist/types/plugin.d.mts.map +1 -1
  357. package/dist/types/tsconfig.d.mts +1 -1
  358. package/dist/types/unplugin.d.cts +5 -26
  359. package/dist/types/unplugin.d.cts.map +1 -1
  360. package/dist/types/unplugin.d.mts +5 -26
  361. package/dist/types/unplugin.d.mts.map +1 -1
  362. package/package.json +259 -457
  363. package/schemas/fs.capnp +42 -0
  364. package/dist/constants/virtual-modules.cjs +0 -8
  365. package/dist/constants/virtual-modules.d.cts +0 -6
  366. package/dist/constants/virtual-modules.d.cts.map +0 -1
  367. package/dist/constants/virtual-modules.d.mts +0 -6
  368. package/dist/constants/virtual-modules.d.mts.map +0 -1
  369. package/dist/constants/virtual-modules.mjs +0 -7
  370. package/dist/constants/virtual-modules.mjs.map +0 -1
  371. package/dist/lib/logger.cjs +0 -99
  372. package/dist/lib/logger.d.cts +0 -53
  373. package/dist/lib/logger.d.cts.map +0 -1
  374. package/dist/lib/logger.d.mts +0 -53
  375. package/dist/lib/logger.d.mts.map +0 -1
  376. package/dist/lib/logger.mjs +0 -93
  377. package/dist/lib/logger.mjs.map +0 -1
  378. package/dist/types/_internal.cjs +0 -0
  379. package/dist/types/_internal.d.cts +0 -106
  380. package/dist/types/_internal.d.cts.map +0 -1
  381. package/dist/types/_internal.d.mts +0 -106
  382. package/dist/types/_internal.d.mts.map +0 -1
  383. package/dist/types/_internal.mjs +0 -1
  384. package/dist/types/commands.d.cts +0 -16
  385. package/dist/types/commands.d.cts.map +0 -1
  386. package/dist/types/commands.d.mts +0 -16
  387. package/dist/types/commands.d.mts.map +0 -1
  388. package/dist/types/utils.d.cts +0 -9
  389. package/dist/types/utils.d.cts.map +0 -1
  390. package/dist/types/utils.d.mts +0 -9
  391. package/dist/types/utils.d.mts.map +0 -1
@@ -2,7 +2,7 @@ import { UnpluginBuilderVariant, UnpluginOptions as UnpluginOptions$1 } from "..
2
2
  import { Plugin, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, TypesResult } from "../types/plugin.mjs";
3
3
  import { HooksListItem } from "../types/hooks.mjs";
4
4
  import { PluginContext, ResolveResult, UnresolvedContext } from "../types/context.mjs";
5
- import { EnvironmentConfig, EnvironmentResolvedConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, ResolvedConfig } from "../types/config.mjs";
5
+ import { EnvironmentConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, ResolvedEnvironmentConfig } from "../types/config.mjs";
6
6
  import * as _$unplugin from "unplugin";
7
7
  import * as _$_stryke_types_base0 from "@stryke/types/base";
8
8
  import { AnyFunction } from "@stryke/types/base";
@@ -15,28 +15,28 @@ import * as _$rollup from "rollup";
15
15
  * @param value - The object to check
16
16
  * @returns True if the object is a {@link Plugin}, false otherwise
17
17
  */
18
- declare function isPlugin<TContext extends PluginContext = PluginContext<ResolvedConfig>>(value: unknown): value is Plugin<TContext>;
18
+ declare function isPlugin<TContext extends PluginContext = PluginContext>(value: unknown): value is Plugin<TContext>;
19
19
  /**
20
20
  * Type guard to check if an object is a {@link PluginConfigObject}
21
21
  *
22
22
  * @param value - The object to check
23
23
  * @returns True if the object is a {@link PluginConfigObject}, false otherwise
24
24
  */
25
- declare function isPluginConfigObject<TContext extends PluginContext = PluginContext<ResolvedConfig>>(value: unknown): value is PluginConfigObject<TContext>;
25
+ declare function isPluginConfigObject<TContext extends PluginContext = PluginContext>(value: unknown): value is PluginConfigObject<TContext>;
26
26
  /**
27
27
  * Type guard to check if an object is a {@link PluginConfigTuple}
28
28
  *
29
29
  * @param value - The object to check
30
30
  * @returns True if the object is a {@link PluginConfigTuple}, false otherwise
31
31
  */
32
- declare function isPluginConfigTuple<TContext extends PluginContext = PluginContext<ResolvedConfig>>(value: unknown): value is PluginConfigTuple<TContext>;
32
+ declare function isPluginConfigTuple<TContext extends PluginContext = PluginContext>(value: unknown): value is PluginConfigTuple<TContext>;
33
33
  /**
34
34
  * Type guard to check if an object is a {@link PluginConfig}
35
35
  *
36
36
  * @param value - The object to check
37
37
  * @returns True if the object is a {@link PluginConfig}, false otherwise
38
38
  */
39
- declare function isPluginConfig<TContext extends PluginContext = PluginContext<ResolvedConfig>>(value: unknown): value is PluginConfig<TContext>;
39
+ declare function isPluginConfig<TContext extends PluginContext = PluginContext>(value: unknown): value is PluginConfig<TContext>;
40
40
  /**
41
41
  * Type guard to check if an value is a {@link PluginHook} function
42
42
  *
@@ -75,21 +75,21 @@ declare function getHookHandler<TContext extends PluginContext = PluginContext,
75
75
  * @returns The extracted hook, or undefined if the hook does not exist
76
76
  */
77
77
  declare function extractPluginHook<TContext extends PluginContext = PluginContext, TPlugin extends Plugin<TContext> = Plugin<TContext>>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>): {
78
- normal: OmitThisParameter<((this: TContext, code: string) => _$_stryke_types_base0.MaybePromise<TypesResult | string | undefined | null>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>, "id" | "code">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>)) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>, "id">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>)) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
78
+ normal: OmitThisParameter<((this: TContext, code: string) => _$_stryke_types_base0.MaybePromise<TypesResult | string | undefined | null>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>, "id" | "code">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>)) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>, "id">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>)) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
79
79
  isEntry: boolean;
80
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
80
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) | (((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
81
81
  isEntry: boolean;
82
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
82
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) & PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
83
83
  isEntry: boolean;
84
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>, "id">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
84
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>, "id">) | (PluginHookObject<(this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
85
85
  isEntry: boolean;
86
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
86
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>, never> & ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
87
87
  isEntry: boolean;
88
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>)) | (((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & ((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | (((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & PluginHookObject<(this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>, never>) | (((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & (TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>) | (PluginHookObject<(this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>, never> & ((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext, name: string, environment: EnvironmentConfig) => _$_stryke_types_base0.MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>)>;
88
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>)) | (((this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & ((this: UnresolvedContext<TContext["config"], TContext["system"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | (((this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & PluginHookObject<(this: UnresolvedContext<TContext["config"], TContext["system"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>, never>) | (((this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & (TContext["config"] extends infer T ? { [K in keyof T]?: (T[K] extends infer T_1 ? { [K_2 in keyof T_1]?: (T_1[K_2] extends infer T_2 ? { [K_3 in keyof T_2]?: (T_2[K_3] extends infer T_3 ? { [K_4 in keyof T_3]?: (T_3[K_4] extends infer T_4 ? { [K_5 in keyof T_4]?: (T_4[K_5] extends infer T_5 ? { [K_6 in keyof T_5]?: (T_5[K_6] extends infer T_6 ? { [K_7 in keyof T_6]?: (T_6[K_7] extends infer T_7 ? { [K_8 in keyof T_7]?: (T_7[K_8] extends infer T_8 ? { [K_9 in keyof T_8]?: (T_8[K_9] extends infer T_9 ? { [K_10 in keyof T_9]?: (T_9[K_10] extends infer T_10 ? { [K_11 in keyof T_10]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>) | (PluginHookObject<(this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>, never> & ((this: UnresolvedContext<TContext["config"], TContext["system"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext, name: string, environment: EnvironmentConfig) => _$_stryke_types_base0.MaybePromise<Partial<ResolvedEnvironmentConfig> | undefined | null>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>)>;
89
89
  } | {
90
- [x: string]: OmitThisParameter<((this: TContext, code: string) => _$_stryke_types_base0.MaybePromise<TypesResult | string | undefined | null>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
90
+ [x: string]: OmitThisParameter<((this: TContext, code: string) => _$_stryke_types_base0.MaybePromise<TypesResult | string | undefined | null>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, code: string, id: string) => _$_stryke_types_base0.MaybePromise<_$unplugin.TransformResult>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string) => _$_stryke_types_base0.MaybePromise<_$rollup.LoadResult>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext, id: string, importer: string | undefined, options: {
91
91
  isEntry: boolean;
92
- }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) | ((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) | (((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & ((this: UnresolvedContext<TContext["config"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext, name: string, environment: EnvironmentConfig) => _$_stryke_types_base0.MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"]> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>)>;
92
+ }) => _$_stryke_types_base0.MaybePromise<string | ResolveResult | null | undefined>) | ((this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) | (((this: UnresolvedContext<TContext["config"], unknown>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>) & ((this: UnresolvedContext<TContext["config"], TContext["system"]>) => _$_stryke_types_base0.MaybePromise<(TContext["config"] extends infer T_1 ? { [K in keyof T_1]?: (T_1[K] extends infer T_2 ? { [K_2 in keyof T_2]?: (T_2[K_2] extends infer T_3 ? { [K_3 in keyof T_3]?: (T_3[K_3] extends infer T_4 ? { [K_4 in keyof T_4]?: (T_4[K_4] extends infer T_5 ? { [K_5 in keyof T_5]?: (T_5[K_5] extends infer T_6 ? { [K_6 in keyof T_6]?: (T_6[K_6] extends infer T_7 ? { [K_7 in keyof T_7]?: (T_7[K_7] extends infer T_8 ? { [K_8 in keyof T_8]?: (T_8[K_8] extends infer T_9 ? { [K_9 in keyof T_9]?: (T_9[K_9] extends infer T_10 ? { [K_10 in keyof T_10]?: (T_10[K_10] extends infer T_11 ? { [K_11 in keyof T_11]?: /*elided*/any | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) | undefined } : never) & Record<string, any>>)) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext, name: string, environment: EnvironmentConfig) => _$_stryke_types_base0.MaybePromise<Partial<ResolvedEnvironmentConfig> | undefined | null>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: _$unplugin.UnpluginBuildContext & PluginContext<TContext["config"], unknown> & TContext) => _$_stryke_types_base0.MaybePromise<void>) | ((this: TContext) => _$_stryke_types_base0.MaybePromise<void>)>;
93
93
  normal?: undefined;
94
94
  } | undefined;
95
95
  /**
@@ -120,7 +120,7 @@ declare function isUnpluginHookField<TUnpluginBuilderVariant extends UnpluginBui
120
120
  * @param plugins - The list of plugins to check against
121
121
  * @returns True if the plugin should be deduplicated, false otherwise
122
122
  */
123
- declare function isDuplicate<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TContext extends PluginContext<TResolvedConfig> = PluginContext<TResolvedConfig>>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]): boolean;
123
+ declare function isDuplicate<TContext extends PluginContext = PluginContext>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]): boolean;
124
124
  /**
125
125
  * Remove duplicate hooks from a list of hooks, keeping the first occurrence of each plugin.
126
126
  *
@@ -143,7 +143,7 @@ declare function addPluginHook<TContext extends PluginContext = PluginContext, T
143
143
  * @param config - The plugin configuration to check
144
144
  * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations
145
145
  */
146
- declare function findInvalidPluginConfig<TContext extends PluginContext = PluginContext<ResolvedConfig>>(config: PluginConfig<TContext>): string[] | null;
146
+ declare function findInvalidPluginConfig<TContext extends PluginContext = PluginContext>(config: PluginConfig<TContext>): string[] | null;
147
147
  declare type __ΩGetHookHandlerReturnType = any[];
148
148
  //#endregion
149
149
  export { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey };
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/plugin-utils/helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAuDgB,QAAA,kBACG,aAAA,GAAgB,aAAA,CAAc,cAAA,EAAA,CAC/C,KAAA,YAAiB,KAAA,IAAS,MAAA,CAAO,QAAA;;;;;;;iBA6BnB,oBAAA,kBACG,aAAA,GAAgB,aAAA,CAAc,cAAA,EAAA,CAC/C,KAAA,YAAiB,KAAA,IAAS,kBAAA,CAAmB,QAAA;;;;;;;iBAiB/B,mBAAA,kBACG,aAAA,GAAgB,aAAA,CAAc,cAAA,EAAA,CAC/C,KAAA,YAAiB,KAAA,IAAS,iBAAA,CAAkB,QAAA;;;;;;AArB9C;iBAsCgB,cAAA,kBACG,aAAA,GAAgB,aAAA,CAAc,cAAA,EAAA,CAC/C,KAAA,YAAiB,KAAA,IAAS,YAAA,CAAa,QAAA;;;;;;;iBAiBzB,kBAAA,CACd,KAAA,YACC,KAAA,IAAS,gBAAA,CAAiB,WAAA;;;;;;;iBAUb,oBAAA,CAAqB,KAAA,YAAiB,KAAA,IAAS,WAAA;;;;;AAlD/D;;iBA4DgB,YAAA,CAAa,KAAA,YAAiB,KAAA,IAAS,UAAA,CAAW,WAAA;AAAA,KAItD,wBAAA,kBACO,aAAA,GAAgB,aAAA,oCAE/B,aAAA,CAAc,QAAA,EAAU,MAAA;;;;;;;iBAQZ,cAAA,kBACG,aAAA,GAAgB,aAAA,+BAAA,CAGjC,UAAA,EAAY,UAAA,CAAW,WAAA,IACtB,wBAAA,CAAyB,QAAA,EAAU,IAAA;;;;;;;;;iBActB,iBAAA,kBACG,aAAA,GAAgB,aAAA,kBACjB,MAAA,CAAO,QAAA,IAAY,MAAA,CAAO,QAAA,EAAA,CAC1C,OAAA,EAAS,QAAA,EAAU,MAAA,EAAQ,OAAA,EAAS,IAAA,QAAY,WAAA,CAAY,QAAA;;;;;;;;;;;4vBA7E5D,s8BAAA,w8BAAA,s9BAAA,+8BAAA,i3BAAA,+9BAAA,s9BAAA;;;;mwBACA,g9BAAA,+8BAAA;;;;;;AAiBF;;;iBAiFgB,iBAAA,iCACkB,sBAAA,GAC9B,sBAAA,CAAA,CAEF,IAAA,WACC,IAAA,OAAW,uBAAA,UAAiC,iBAAA,CAAgB,uBAAA;;;;;;;iBAY/C,iBAAA,kBAAmC,aAAA,CAAA,CACjD,IAAA;;;;;;;iBAWc,mBAAA,iCACkB,sBAAA,GAC9B,sBAAA,CAAA,CACF,KAAA,WAAgB,KAAA,IAAS,uBAAA;;AA3F3B;;;;;;iBAyGgB,WAAA,yBACU,cAAA,GAAiB,cAAA,mBACxB,aAAA,CAAc,eAAA,IAC7B,aAAA,CAAc,eAAA,EAAA,CAChB,MAAA,EAAQ,MAAA,CAAO,QAAA,GAAW,OAAA,EAAS,MAAA,CAAO,QAAA;;;;AAzG5C;;;iBA2HgB,cAAA,kBACG,aAAA,GAAgB,aAAA,iBAClB,gBAAA,CAAiB,QAAA,IAAY,gBAAA,CAAiB,QAAA,iBAC/C,aAAA,CAAc,QAAA,EAAU,MAAA,IAAU,aAAA,CAC9C,QAAA,EACA,MAAA,EAAA,CAEF,SAAA,EAAW,KAAA,KAAU,KAAA;;;;;;;;;iBAsBP,aAAA,kBACG,aAAA,GAAgB,aAAA,iBAClB,gBAAA,CAAiB,QAAA,IAAY,gBAAA,CAAiB,QAAA,iBAC/C,aAAA,CAAc,QAAA,EAAU,MAAA,IAAU,aAAA,CAC9C,QAAA,EACA,MAAA,EAAA,CAGF,OAAA,EAAS,QAAA,EACT,MAAA,EAAQ,MAAA,CAAO,QAAA,GACf,UAAA,EAAY,UAAA,CAAW,WAAA,GACvB,SAAA,EAAW,KAAA,KACV,KAAA;;;;;;;iBA6Ba,uBAAA,kBACG,aAAA,GAAgB,aAAA,CAAc,cAAA,EAAA,CAC/C,MAAA,EAAQ,YAAA,CAAa,QAAA;AAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/plugin-utils/helpers.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAsDgB,QAAA,kBAA0B,aAAA,GAAgB,aAAA,CAAA,CACxD,KAAA,YACC,KAAA,IAAS,MAAA,CAAO,QAAA;;;;;;;iBA6BH,oBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CACjC,KAAA,YAAiB,KAAA,IAAS,kBAAA,CAAmB,QAAA;;;;;;;iBAiB/B,mBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CACjC,KAAA,YAAiB,KAAA,IAAS,iBAAA,CAAkB,QAAA;;;;AArB9C;;;iBAsCgB,cAAA,kBAAgC,aAAA,GAAgB,aAAA,CAAA,CAC9D,KAAA,YACC,KAAA,IAAS,YAAA,CAAa,QAAA;;;;;;;iBAiBT,kBAAA,CACd,KAAA,YACC,KAAA,IAAS,gBAAA,CAAiB,WAAA;;;;;;;iBAUb,oBAAA,CAAqB,KAAA,YAAiB,KAAA,IAAS,WAAA;AAlD/D;;;;;;AAAA,iBA4DgB,YAAA,CAAa,KAAA,YAAiB,KAAA,IAAS,UAAA,CAAW,WAAA;AAAA,KAItD,wBAAA,kBACO,aAAA,GAAgB,aAAA,oCAE/B,aAAA,CAAc,QAAA,EAAU,MAAA;;;;;;;iBAQZ,cAAA,kBACG,aAAA,GAAgB,aAAA,+BAAA,CAGjC,UAAA,EAAY,UAAA,CAAW,WAAA,IACtB,wBAAA,CAAyB,QAAA,EAAU,IAAA;;;;AA7DtC;;;;;iBA2EgB,iBAAA,kBACG,aAAA,GAAgB,aAAA,kBACjB,MAAA,CAAO,QAAA,IAAY,MAAA,CAAO,QAAA,EAAA,CAC1C,OAAA,EAAS,QAAA,EAAU,MAAA,EAAQ,OAAA,EAAS,IAAA,QAAY,WAAA,CAAY,QAAA;;;;;;;;;;;qwBA5E7B,09BAAA,i9BAAA,0+BAAA,w9BAAA,i3BAAA,w+BAAA,0+BAAA;;;;4wBAmBL,y9BAAA,m+BAAA;;;;;;;;AAU5B;iBAqEgB,iBAAA,iCACkB,sBAAA,GAC9B,sBAAA,CAAA,CAEF,IAAA,WACC,IAAA,OAAW,uBAAA,UAAiC,iBAAA,CAAgB,uBAAA;;;;;;;iBAY/C,iBAAA,kBAAmC,aAAA,CAAA,CACjD,IAAA;AA7EF;;;;;;AAAA,iBAwFgB,mBAAA,iCACkB,sBAAA,GAC9B,sBAAA,CAAA,CACF,KAAA,WAAgB,KAAA,IAAS,uBAAA;;;;AAvF3B;;;;iBAqGgB,WAAA,kBAA6B,aAAA,GAAgB,aAAA,CAAA,CAC3D,MAAA,EAAQ,MAAA,CAAO,QAAA,GACf,OAAA,EAAS,MAAA,CAAO,QAAA;;;;;;;iBAmBF,cAAA,kBACG,aAAA,GAAgB,aAAA,iBAClB,gBAAA,CAAiB,QAAA,IAAY,gBAAA,CAAiB,QAAA,iBAC/C,aAAA,CAAc,QAAA,EAAU,MAAA,IAAU,aAAA,CAC9C,QAAA,EACA,MAAA,EAAA,CAEF,SAAA,EAAW,KAAA,KAAU,KAAA;;;;;;;;AAtHvB;iBA4IgB,aAAA,kBACG,aAAA,GAAgB,aAAA,iBAClB,gBAAA,CAAiB,QAAA,IAAY,gBAAA,CAAiB,QAAA,iBAC/C,aAAA,CAAc,QAAA,EAAU,MAAA,IAAU,aAAA,CAC9C,QAAA,EACA,MAAA,EAAA,CAGF,OAAA,EAAS,QAAA,EACT,MAAA,EAAQ,MAAA,CAAO,QAAA,GACf,UAAA,EAAY,UAAA,CAAW,WAAA,GACvB,SAAA,EAAW,KAAA,KACV,KAAA;;;;;;;iBA6Ba,uBAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CACjC,MAAA,EAAQ,YAAA,CAAa,QAAA;AAAA"}
@@ -1,8 +1,8 @@
1
1
  import { PLUGIN_HOOKS_FIELDS, PLUGIN_NON_HOOK_FIELDS, UNPLUGIN_BUILDER_VARIANTS } from "../constants/plugin.mjs";
2
+ import { kebabCase } from "@stryke/string-format/kebab-case";
2
3
  import { isFunction } from "@stryke/type-checks/is-function";
3
4
  import { isSetObject } from "@stryke/type-checks/is-set-object";
4
5
  import { isSetString } from "@stryke/type-checks/is-set-string";
5
- import { kebabCase } from "@stryke/string-format/kebab-case";
6
6
  import { isUndefined } from "@stryke/type-checks/is-undefined";
7
7
 
8
8
  //#region src/plugin-utils/helpers.ts
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/plugin-utils/helpers.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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n PLUGIN_NON_HOOK_FIELDS,\n UNPLUGIN_BUILDER_VARIANTS\n} from \"../constants/plugin\";\nimport type {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n ResolvedConfig\n} from \"../types/config\";\nimport type { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport type { HooksListItem } from \"../types/hooks\";\nimport type {\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport type {\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Plugin<TContext>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Plugin<TContext>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(value: unknown): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin<TContext>(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends string = string\n> = HooksListItem<TContext, TField>[\"handler\"];\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TKey extends string = string\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TKey> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TKey>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n) {\n return !PLUGIN_NON_HOOK_FIELDS.includes(keys as PluginHookFields<TContext>);\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function isDuplicate<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends PluginContext<TResolvedConfig> =\n PluginContext<TResolvedConfig>\n>(plugin: Plugin<TContext>, plugins: Plugin<TContext>[]) {\n return (\n plugin.dedupe !== false &&\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) ||\n kebabCase(p.name) === kebabCase(plugin.name))\n )\n );\n}\n\n/**\n * Remove duplicate hooks from a list of hooks, keeping the first occurrence of each plugin.\n *\n * @param hooksList - The list of hooks to deduplicate.\n * @returns A new list of hooks with duplicates removed.\n */\nexport function dedupeHooklist<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends HooksListItem<TContext, TField> = HooksListItem<\n TContext,\n TField\n >\n>(hooksList: TList[]): TList[] {\n return hooksList.reduce((ret, hook) => {\n if (\n !isDuplicate(\n hook.plugin,\n ret.map(h => h.plugin)\n )\n ) {\n ret.push(hook);\n }\n return ret;\n }, [] as TList[]);\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends HooksListItem<TContext, TField> = HooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n): TList[] {\n if (\n !isDuplicate(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as GetHookHandlerReturnType<TContext, TField>;\n if (!handler) {\n return hooksList;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n\n return hooksList;\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext<ResolvedConfig>\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"helpers.mjs","names":[],"sources":["../../src/plugin-utils/helpers.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 { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport {\n PLUGIN_HOOKS_FIELDS,\n PLUGIN_NON_HOOK_FIELDS,\n UNPLUGIN_BUILDER_VARIANTS\n} from \"../constants/plugin\";\nimport type {\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple\n} from \"../types/config\";\nimport type { PluginContext, WithUnpluginBuildContext } from \"../types/context\";\nimport type { HooksListItem } from \"../types/hooks\";\nimport type {\n Plugin,\n PluginHook,\n PluginHookFields,\n PluginHookObject,\n PluginHooks\n} from \"../types/plugin\";\nimport type {\n UnpluginBuilderVariant,\n UnpluginOptions\n} from \"../types/unplugin\";\n\n/**\n * Type guard to check if an object is a {@link Plugin}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link Plugin}, false otherwise\n */\nexport function isPlugin<TContext extends PluginContext = PluginContext>(\n value: unknown\n): value is Plugin<TContext> {\n return (\n isSetObject(value) &&\n \"name\" in value &&\n isSetString(value.name) &&\n (isUndefined((value as Plugin<TContext>).api) ||\n (\"api\" in value && isSetObject(value.api))) &&\n (isUndefined((value as Plugin<TContext>).applyToEnvironment) ||\n (\"applyToEnvironment\" in value &&\n isFunction(value.applyToEnvironment))) &&\n (isUndefined((value as Plugin<TContext>).dedupe) ||\n (\"dedupe\" in value && isFunction(value.dedupe))) &&\n PLUGIN_HOOKS_FIELDS.every(\n hook =>\n isUndefined((value as Record<string, unknown>)[hook]) ||\n (hook in value &&\n (isPluginHookFunction((value as Record<string, unknown>)[hook]) ||\n (hook === \"config\" &&\n isSetObject((value as Plugin<TContext>)[hook]))))\n )\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigObject}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigObject}, false otherwise\n */\nexport function isPluginConfigObject<\n TContext extends PluginContext = PluginContext\n>(value: unknown): value is PluginConfigObject<TContext> {\n return (\n isSetObject(value) &&\n \"plugin\" in value &&\n (((isSetString(value.plugin) || isFunction(value.plugin)) &&\n \"options\" in value &&\n isSetObject(value.options)) ||\n isPlugin(value.plugin))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfigTuple}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfigTuple}, false otherwise\n */\nexport function isPluginConfigTuple<\n TContext extends PluginContext = PluginContext\n>(value: unknown): value is PluginConfigTuple<TContext> {\n return (\n Array.isArray(value) &&\n (value.length === 1 || value.length === 2) &&\n (((isSetString(value[0]) || isFunction(value[0])) &&\n value.length > 1 &&\n isSetObject(value[1])) ||\n isPlugin(value[0]))\n );\n}\n\n/**\n * Type guard to check if an object is a {@link PluginConfig}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginConfig}, false otherwise\n */\nexport function isPluginConfig<TContext extends PluginContext = PluginContext>(\n value: unknown\n): value is PluginConfig<TContext> {\n return (\n isSetString(value) ||\n isFunction(value) ||\n isPlugin(value) ||\n isPluginConfigObject(value) ||\n isPluginConfigTuple(value) ||\n (Array.isArray(value) && value.every(item => isPluginConfig(item)))\n );\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookObject(\n value: unknown\n): value is PluginHookObject<AnyFunction> {\n return isSetObject(value) && \"handler\" in value && isFunction(value.handler);\n}\n\n/**\n * Type guard to check if an value is a {@link PluginHook} function\n *\n * @param value - The value to check\n * @returns True if the value is a {@link PluginHook} function, false otherwise\n */\nexport function isPluginHookFunction(value: unknown): value is AnyFunction {\n return isFunction(value) || isPluginHookObject(value);\n}\n\n/**\n * Type guard to check if an object is a {@link PluginHook}\n *\n * @param value - The object to check\n * @returns True if the object is a {@link PluginHook}, false otherwise\n */\nexport function isPluginHook(value: unknown): value is PluginHook<AnyFunction> {\n return isPluginHookFunction(value) || isPluginHookObject(value);\n}\n\nexport type GetHookHandlerReturnType<\n TContext extends PluginContext = PluginContext,\n TField extends string = string\n> = HooksListItem<TContext, TField>[\"handler\"];\n\n/**\n * Extract the hook handler function from a plugin hook\n *\n * @param pluginHook - The plugin hook to extract the handler function from\n * @returns The hook handler function\n */\nexport function getHookHandler<\n TContext extends PluginContext = PluginContext,\n TKey extends string = string\n>(\n pluginHook: PluginHook<AnyFunction>\n): GetHookHandlerReturnType<TContext, TKey> {\n return (\n isFunction(pluginHook) ? pluginHook : pluginHook.handler\n ) as GetHookHandlerReturnType<TContext, TKey>;\n}\n\n/**\n * Extract a plugin hook from a plugin\n *\n * @param context - The build context\n * @param plugin - The plugin to extract the hook from\n * @param hook - The name of the hook to extract\n * @returns The extracted hook, or undefined if the hook does not exist\n */\nexport function extractPluginHook<\n TContext extends PluginContext = PluginContext,\n TPlugin extends Plugin<TContext> = Plugin<TContext>\n>(context: TContext, plugin: TPlugin, hook: keyof PluginHooks<TContext>) {\n const pluginHook = plugin[hook];\n if (!isPluginHook(pluginHook)) {\n return undefined;\n }\n\n return isFunction(pluginHook)\n ? {\n normal: pluginHook.bind(context)\n }\n : {\n [pluginHook.order ? pluginHook.order : \"normal\"]:\n pluginHook.handler.bind(context)\n };\n}\n\n/**\n * Check if a hook is external.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookKey<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(\n keys: string\n): keys is `${TUnpluginBuilderVariant}:${keyof UnpluginOptions[TUnpluginBuilderVariant] & string}` {\n return UNPLUGIN_BUILDER_VARIANTS.some(variant =>\n keys.startsWith(`${variant}:`)\n );\n}\n\n/**\n * Check if a hook is internal.\n *\n * @param keys - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isPluginHookField<TContext extends PluginContext>(\n keys: string\n) {\n return !PLUGIN_NON_HOOK_FIELDS.includes(keys as PluginHookFields<TContext>);\n}\n\n/**\n * Check if a hook is external.\n *\n * @param field - The name of the hook to check.\n * @returns True if the hook is external, false otherwise.\n */\nexport function isUnpluginHookField<\n TUnpluginBuilderVariant extends UnpluginBuilderVariant =\n UnpluginBuilderVariant\n>(field: string): field is TUnpluginBuilderVariant {\n return (\n !isPluginHookField(field) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(field as UnpluginBuilderVariant)\n );\n}\n\n/**\n * Check if a plugin should be deduplicated.\n *\n * @param plugin - The plugin to check\n * @param plugins - The list of plugins to check against\n * @returns True if the plugin should be deduplicated, false otherwise\n */\nexport function isDuplicate<TContext extends PluginContext = PluginContext>(\n plugin: Plugin<TContext>,\n plugins: Plugin<TContext>[]\n) {\n return (\n plugin.dedupe !== false &&\n plugins.some(\n p =>\n p.dedupe !== false &&\n ((isFunction(p.dedupe) && p.dedupe(plugin)) ||\n kebabCase(p.name) === kebabCase(plugin.name))\n )\n );\n}\n\n/**\n * Remove duplicate hooks from a list of hooks, keeping the first occurrence of each plugin.\n *\n * @param hooksList - The list of hooks to deduplicate.\n * @returns A new list of hooks with duplicates removed.\n */\nexport function dedupeHooklist<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends HooksListItem<TContext, TField> = HooksListItem<\n TContext,\n TField\n >\n>(hooksList: TList[]): TList[] {\n return hooksList.reduce((ret, hook) => {\n if (\n !isDuplicate(\n hook.plugin,\n ret.map(h => h.plugin)\n )\n ) {\n ret.push(hook);\n }\n return ret;\n }, [] as TList[]);\n}\n\n/**\n * Add a plugin hook to the hooks list.\n *\n * @param context - The plugin context\n * @param plugin - The plugin to add the hook from\n * @param pluginHook - The plugin hook to add\n * @param hooksList - The list of hooks to add to\n */\nexport function addPluginHook<\n TContext extends PluginContext = PluginContext,\n TField extends PluginHookFields<TContext> = PluginHookFields<TContext>,\n TList extends HooksListItem<TContext, TField> = HooksListItem<\n TContext,\n TField\n >\n>(\n context: TContext,\n plugin: Plugin<TContext>,\n pluginHook: PluginHook<AnyFunction>,\n hooksList: TList[]\n): TList[] {\n if (\n !isDuplicate(plugin, hooksList.map(hook => hook.plugin).filter(Boolean))\n ) {\n const handler = ((...args: unknown[]) =>\n (\n getHookHandler<WithUnpluginBuildContext<TContext>, TField>(\n pluginHook\n ) as unknown as (...args: unknown[]) => unknown\n ).apply(context, args)) as GetHookHandlerReturnType<TContext, TField>;\n if (!handler) {\n return hooksList;\n }\n\n hooksList.push({\n plugin,\n handler\n } as any);\n }\n\n return hooksList;\n}\n\n/**\n * Check the provided {@link PluginConfig}, and return a stringified version of the invalid configuration. If an array is provided, check each item in the array.\n *\n * @param config - The plugin configuration to check\n * @returns Null if the configuration is valid, otherwise an array of stringified invalid configurations\n */\nexport function findInvalidPluginConfig<\n TContext extends PluginContext = PluginContext\n>(config: PluginConfig<TContext>): string[] | null {\n if (isPluginConfig<TContext>(config)) {\n return null;\n }\n\n if (Array.isArray(config as PluginConfig<TContext>[])) {\n const invalidItems: string[] = [];\n (config as PluginConfig<TContext>[]).forEach(item => {\n const invalid = findInvalidPluginConfig<TContext>(item);\n if (invalid) {\n invalidItems.push(...invalid.map(i => JSON.stringify(i, null, 2)));\n }\n });\n\n return invalidItems.length > 0 ? invalidItems : null;\n }\n\n return [JSON.stringify(config, null, 2)];\n}\n"],"mappings":"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"}
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_plugin_utils_paths = require('./paths.cjs');
3
- const require_plugin_utils_format_package_json = require('./format-package-json.cjs');
2
+ const require_plugin_utils_logging = require('./logging.cjs');
4
3
  const require_plugin_utils_build_helpers = require('./build-helpers.cjs');
5
4
  const require_plugin_utils_helpers = require('./helpers.cjs');
6
5
  const require_plugin_utils_merge = require('./merge.cjs');
@@ -8,30 +7,51 @@ const require_plugin_utils_combine_plugins = require('./combine-plugins.cjs');
8
7
  const require_plugin_utils_context_helpers = require('./context-helpers.cjs');
9
8
  const require_plugin_utils_docs_helper = require('./docs-helper.cjs');
10
9
  const require_plugin_utils_extend = require('./extend.cjs');
10
+ const require_plugin_utils_virtual = require('./virtual.cjs');
11
11
  const require_plugin_utils_filter = require('./filter.cjs');
12
+ const require_plugin_utils_format = require('./format.cjs');
13
+ const require_plugin_utils_format_package_json = require('./format-package-json.cjs');
12
14
  const require_plugin_utils_get_config_path = require('./get-config-path.cjs');
13
- const require_plugin_utils_logging = require('./logging.cjs');
15
+ const require_plugin_utils_install = require('./install.cjs');
14
16
  const require_plugin_utils_modules = require('./modules.cjs');
17
+ const require_plugin_utils_paths = require('./paths.cjs');
15
18
 
19
+ exports.VIRTUAL_MODULE_PREFIX = require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX;
20
+ exports.VIRTUAL_MODULE_PREFIX_REGEX = require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX_REGEX;
16
21
  exports.addPluginHook = require_plugin_utils_helpers.addPluginHook;
22
+ exports.addVirtualPrefix = require_plugin_utils_virtual.addVirtualPrefix;
23
+ exports.colorBackground = require_plugin_utils_logging.colorBackground;
24
+ exports.colorText = require_plugin_utils_logging.colorText;
17
25
  exports.combinePluginOptions = require_plugin_utils_combine_plugins.combinePluginOptions;
18
26
  exports.combinePlugins = require_plugin_utils_combine_plugins.combinePlugins;
27
+ exports.consoleLog = require_plugin_utils_logging.consoleLog;
28
+ exports.consoleLogger = require_plugin_utils_logging.consoleLogger;
19
29
  exports.createCodeFilter = require_plugin_utils_filter.createCodeFilter;
20
30
  exports.createFilter = require_plugin_utils_filter.createFilter;
21
31
  exports.createFilterForId = require_plugin_utils_filter.createFilterForId;
22
32
  exports.createFilterForTransform = require_plugin_utils_filter.createFilterForTransform;
23
33
  exports.createIdFilter = require_plugin_utils_filter.createIdFilter;
34
+ exports.createLogFn = require_plugin_utils_logging.createLogFn;
35
+ exports.createLogger = require_plugin_utils_logging.createLogger;
36
+ exports.createVirtualPrefixRegex = require_plugin_utils_virtual.createVirtualPrefixRegex;
24
37
  exports.dedupeHooklist = require_plugin_utils_helpers.dedupeHooklist;
25
38
  exports.extend = require_plugin_utils_extend.extend;
39
+ exports.extendLogFn = require_plugin_utils_logging.extendLogFn;
40
+ exports.extendLogger = require_plugin_utils_logging.extendLogger;
26
41
  exports.extractPluginHook = require_plugin_utils_helpers.extractPluginHook;
27
42
  exports.findInvalidPluginConfig = require_plugin_utils_helpers.findInvalidPluginConfig;
43
+ exports.formatConfig = require_plugin_utils_format.formatConfig;
28
44
  exports.formatPackageJson = require_plugin_utils_format_package_json.formatPackageJson;
29
45
  exports.getConfigPath = require_plugin_utils_get_config_path.getConfigPath;
30
46
  exports.getDependencyConfig = require_plugin_utils_build_helpers.getDependencyConfig;
31
47
  exports.getDocsOutputPath = require_plugin_utils_docs_helper.getDocsOutputPath;
32
48
  exports.getHookHandler = require_plugin_utils_helpers.getHookHandler;
33
49
  exports.getOrganizationName = require_plugin_utils_context_helpers.getOrganizationName;
50
+ exports.getPackageJsonOrganization = require_plugin_utils_context_helpers.getPackageJsonOrganization;
51
+ exports.getTextColor = require_plugin_utils_logging.getTextColor;
34
52
  exports.getWorkspaceName = require_plugin_utils_context_helpers.getWorkspaceName;
53
+ exports.installPackage = require_plugin_utils_install.installPackage;
54
+ exports.installPackages = require_plugin_utils_install.installPackages;
35
55
  exports.isBuiltinModule = require_plugin_utils_modules.isBuiltinModule;
36
56
  exports.isDuplicate = require_plugin_utils_helpers.isDuplicate;
37
57
  exports.isPlugin = require_plugin_utils_helpers.isPlugin;
@@ -44,10 +64,20 @@ exports.isPluginHookFunction = require_plugin_utils_helpers.isPluginHookFunction
44
64
  exports.isPluginHookObject = require_plugin_utils_helpers.isPluginHookObject;
45
65
  exports.isUnpluginHookField = require_plugin_utils_helpers.isUnpluginHookField;
46
66
  exports.isUnpluginHookKey = require_plugin_utils_helpers.isUnpluginHookKey;
67
+ exports.isValidLogLevel = require_plugin_utils_logging.isValidLogLevel;
68
+ exports.isValidLogLevelConfig = require_plugin_utils_logging.isValidLogLevelConfig;
47
69
  exports.isVerbose = require_plugin_utils_logging.isVerbose;
70
+ exports.isVirtualModule = require_plugin_utils_virtual.isVirtualModule;
48
71
  exports.merge = require_plugin_utils_merge.merge;
49
72
  exports.mergeConfig = require_plugin_utils_merge.mergeConfig;
50
73
  exports.normalizeFilter = require_plugin_utils_filter.normalizeFilter;
74
+ exports.normalizeSingleFilter = require_plugin_utils_filter.normalizeSingleFilter;
51
75
  exports.patternToCodeFilter = require_plugin_utils_filter.patternToCodeFilter;
52
76
  exports.patternToIdFilter = require_plugin_utils_filter.patternToIdFilter;
53
- exports.replacePathTokens = require_plugin_utils_paths.replacePathTokens;
77
+ exports.prefixRegex = require_plugin_utils_virtual.prefixRegex;
78
+ exports.removeVirtualPrefix = require_plugin_utils_virtual.removeVirtualPrefix;
79
+ exports.replacePathTokens = require_plugin_utils_paths.replacePathTokens;
80
+ exports.resolveLogLevel = require_plugin_utils_logging.resolveLogLevel;
81
+ exports.withCustomLogger = require_plugin_utils_logging.withCustomLogger;
82
+ exports.withLogFn = require_plugin_utils_logging.withLogFn;
83
+ exports.withLogger = require_plugin_utils_logging.withLogger;
@@ -1,14 +1,17 @@
1
1
  import { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig } from "./build-helpers.cjs";
2
2
  import { CombinePluginsOptions, __ΩCombinePluginsOptions, combinePluginOptions, combinePlugins } from "./combine-plugins.cjs";
3
- import { getOrganizationName, getWorkspaceName } from "./context-helpers.cjs";
3
+ import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.cjs";
4
4
  import { getDocsOutputPath } from "./docs-helper.cjs";
5
5
  import { extend } from "./extend.cjs";
6
- import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.cjs";
6
+ import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter } from "./filter.cjs";
7
7
  import { formatPackageJson } from "./format-package-json.cjs";
8
+ import { formatConfig } from "./format.cjs";
8
9
  import { getConfigPath } from "./get-config-path.cjs";
9
10
  import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.cjs";
10
- import { isVerbose } from "./logging.cjs";
11
+ import { installPackage, installPackages } from "./install.cjs";
12
+ import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.cjs";
11
13
  import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.cjs";
12
14
  import { isBuiltinModule } from "./modules.cjs";
13
15
  import { replacePathTokens } from "./paths.cjs";
14
- export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, combinePluginOptions, combinePlugins, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, dedupeHooklist, extend, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens };
16
+ import { PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩPrefixRegexOptions, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, prefixRegex, removeVirtualPrefix } from "./virtual.cjs";
17
+ export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, __ΩPrefixRegexOptions, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, installPackage, installPackages, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter, prefixRegex, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
@@ -1,14 +1,17 @@
1
1
  import { GetDependencyConfigResult, __ΩGetDependencyConfigResult, getDependencyConfig } from "./build-helpers.mjs";
2
2
  import { CombinePluginsOptions, __ΩCombinePluginsOptions, combinePluginOptions, combinePlugins } from "./combine-plugins.mjs";
3
- import { getOrganizationName, getWorkspaceName } from "./context-helpers.mjs";
3
+ import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.mjs";
4
4
  import { getDocsOutputPath } from "./docs-helper.mjs";
5
5
  import { extend } from "./extend.mjs";
6
- import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
6
+ import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
7
7
  import { formatPackageJson } from "./format-package-json.mjs";
8
+ import { formatConfig } from "./format.mjs";
8
9
  import { getConfigPath } from "./get-config-path.mjs";
9
10
  import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
10
- import { isVerbose } from "./logging.mjs";
11
+ import { installPackage, installPackages } from "./install.mjs";
12
+ import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
11
13
  import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.mjs";
12
14
  import { isBuiltinModule } from "./modules.mjs";
13
15
  import { replacePathTokens } from "./paths.mjs";
14
- export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, combinePluginOptions, combinePlugins, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, dedupeHooklist, extend, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens };
16
+ import { PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩPrefixRegexOptions, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, prefixRegex, removeVirtualPrefix } from "./virtual.mjs";
17
+ export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, PrefixRegexOptions, VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, __ΩPrefixRegexOptions, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, installPackage, installPackages, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter, prefixRegex, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
@@ -1,15 +1,18 @@
1
- import { replacePathTokens } from "./paths.mjs";
2
- import { formatPackageJson } from "./format-package-json.mjs";
1
+ import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
3
2
  import { getDependencyConfig } from "./build-helpers.mjs";
4
3
  import { addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
5
4
  import { merge, mergeConfig } from "./merge.mjs";
6
5
  import { combinePluginOptions, combinePlugins } from "./combine-plugins.mjs";
7
- import { getOrganizationName, getWorkspaceName } from "./context-helpers.mjs";
6
+ import { getOrganizationName, getPackageJsonOrganization, getWorkspaceName } from "./context-helpers.mjs";
8
7
  import { getDocsOutputPath } from "./docs-helper.mjs";
9
8
  import { extend } from "./extend.mjs";
10
- import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
9
+ import { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addVirtualPrefix, createVirtualPrefixRegex, isVirtualModule, prefixRegex, removeVirtualPrefix } from "./virtual.mjs";
10
+ import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
11
+ import { formatConfig } from "./format.mjs";
12
+ import { formatPackageJson } from "./format-package-json.mjs";
11
13
  import { getConfigPath } from "./get-config-path.mjs";
12
- import { isVerbose } from "./logging.mjs";
14
+ import { installPackage, installPackages } from "./install.mjs";
13
15
  import { isBuiltinModule } from "./modules.mjs";
16
+ import { replacePathTokens } from "./paths.mjs";
14
17
 
15
- export { addPluginHook, combinePluginOptions, combinePlugins, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, dedupeHooklist, extend, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens };
18
+ export { VIRTUAL_MODULE_PREFIX, VIRTUAL_MODULE_PREFIX_REGEX, addPluginHook, addVirtualPrefix, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, createVirtualPrefixRegex, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getPackageJsonOrganization, getTextColor, getWorkspaceName, installPackage, installPackages, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, isVirtualModule, merge, mergeConfig, normalizeFilter, normalizeSingleFilter, patternToCodeFilter, patternToIdFilter, prefixRegex, removeVirtualPrefix, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
@@ -0,0 +1,47 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ let _stryke_fs_install = require("@stryke/fs/install");
4
+ let _stryke_fs_package_fns = require("@stryke/fs/package-fns");
5
+ let _stryke_string_format_package = require("@stryke/string-format/package");
6
+ let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
7
+
8
+ //#region src/plugin-utils/install.ts
9
+ /**
10
+ * Installs a package if it is not already installed.
11
+ *
12
+ * @param context - The resolved options
13
+ * @param packageName - The name of the package to install
14
+ * @param dev - Whether to install the package as a dev dependency
15
+ */
16
+ async function installPackage(context, packageName, dev = false) {
17
+ if (!await (0, _stryke_fs_package_fns.isPackageListed)((0, _stryke_string_format_package.getPackageName)(packageName), { cwd: context.config.root })) if (context.config.autoInstall) {
18
+ context.warn(`The package "${packageName}" is not installed. It will be installed automatically.`);
19
+ const result = await (0, _stryke_fs_install.install)(packageName, {
20
+ cwd: context.config.root,
21
+ dev
22
+ });
23
+ if ((0, _stryke_type_checks_is_number.isNumber)(result.exitCode) && result.exitCode > 0) {
24
+ context.error(result.stderr);
25
+ throw new Error(`An error occurred while installing the package "${packageName}"`);
26
+ }
27
+ } else context.warn(`The package "${packageName}" is not installed. Since the "autoInstall" option is set to false, it will not be installed automatically.`);
28
+ else if ((0, _stryke_string_format_package.hasPackageVersion)(packageName) && !process.env.POWERLINES_SKIP_VERSION_CHECK) {
29
+ if (!await (0, _stryke_fs_package_fns.doesPackageMatch)((0, _stryke_string_format_package.getPackageName)(packageName), (0, _stryke_string_format_package.getPackageVersion)(packageName), context.config.root)) {
30
+ const packageListing = await (0, _stryke_fs_package_fns.getPackageListing)((0, _stryke_string_format_package.getPackageName)(packageName), { cwd: context.config.root });
31
+ if (!packageListing?.version.startsWith("catalog:") && !packageListing?.version.startsWith("workspace:")) context.warn(`The package "${(0, _stryke_string_format_package.getPackageName)(packageName)}" is installed but does not match the expected version ${(0, _stryke_string_format_package.getPackageVersion)(packageName)} (installed version: ${packageListing?.version || "<Unknown>"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`);
32
+ }
33
+ }
34
+ }
35
+ /**
36
+ * Installs a package if it is not already installed.
37
+ *
38
+ * @param context - The resolved options
39
+ * @param packages - The list of packages to install
40
+ */
41
+ async function installPackages(context, packages) {
42
+ return Promise.all(packages.map(async (pkg) => installPackage(context, pkg.name, pkg.dev)));
43
+ }
44
+
45
+ //#endregion
46
+ exports.installPackage = installPackage;
47
+ exports.installPackages = installPackages;
@@ -0,0 +1,23 @@
1
+ import { Context } from "../types/context.cjs";
2
+ //#region src/plugin-utils/install.d.ts
3
+ /**
4
+ * Installs a package if it is not already installed.
5
+ *
6
+ * @param context - The resolved options
7
+ * @param packageName - The name of the package to install
8
+ * @param dev - Whether to install the package as a dev dependency
9
+ */
10
+ declare function installPackage(context: Context, packageName: string, dev?: boolean): Promise<void>;
11
+ /**
12
+ * Installs a package if it is not already installed.
13
+ *
14
+ * @param context - The resolved options
15
+ * @param packages - The list of packages to install
16
+ */
17
+ declare function installPackages(context: Context, packages: Array<{
18
+ name: string;
19
+ dev?: boolean;
20
+ }>): Promise<void[]>;
21
+ //#endregion
22
+ export { installPackage, installPackages };
23
+ //# sourceMappingURL=install.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.cts","names":[],"sources":["../../src/plugin-utils/install.ts"],"mappings":";;;;;AAuCA;;;;iBAAsB,cAAA,CACpB,OAAA,EAAS,OAAA,EACT,WAAA,UACA,GAAA,aAAW,OAAA;;;;;;;iBA+DS,eAAA,CACpB,OAAA,EAAS,OAAA,EACT,QAAA,EAAU,KAAA;EAAQ,IAAA;EAAc,GAAA;AAAA,KAAgB,OAAA"}
@@ -0,0 +1,23 @@
1
+ import { Context } from "../types/context.mjs";
2
+ //#region src/plugin-utils/install.d.ts
3
+ /**
4
+ * Installs a package if it is not already installed.
5
+ *
6
+ * @param context - The resolved options
7
+ * @param packageName - The name of the package to install
8
+ * @param dev - Whether to install the package as a dev dependency
9
+ */
10
+ declare function installPackage(context: Context, packageName: string, dev?: boolean): Promise<void>;
11
+ /**
12
+ * Installs a package if it is not already installed.
13
+ *
14
+ * @param context - The resolved options
15
+ * @param packages - The list of packages to install
16
+ */
17
+ declare function installPackages(context: Context, packages: Array<{
18
+ name: string;
19
+ dev?: boolean;
20
+ }>): Promise<void[]>;
21
+ //#endregion
22
+ export { installPackage, installPackages };
23
+ //# sourceMappingURL=install.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.mts","names":[],"sources":["../../src/plugin-utils/install.ts"],"mappings":";;;;;AAuCA;;;;iBAAsB,cAAA,CACpB,OAAA,EAAS,OAAA,EACT,WAAA,UACA,GAAA,aAAW,OAAA;;;;;;;iBA+DS,eAAA,CACpB,OAAA,EAAS,OAAA,EACT,QAAA,EAAU,KAAA;EAAQ,IAAA;EAAc,GAAA;AAAA,KAAgB,OAAA"}
@@ -0,0 +1,45 @@
1
+ import { install } from "@stryke/fs/install";
2
+ import { doesPackageMatch, getPackageListing, isPackageListed } from "@stryke/fs/package-fns";
3
+ import { getPackageName, getPackageVersion, hasPackageVersion } from "@stryke/string-format/package";
4
+ import { isNumber } from "@stryke/type-checks/is-number";
5
+
6
+ //#region src/plugin-utils/install.ts
7
+ /**
8
+ * Installs a package if it is not already installed.
9
+ *
10
+ * @param context - The resolved options
11
+ * @param packageName - The name of the package to install
12
+ * @param dev - Whether to install the package as a dev dependency
13
+ */
14
+ async function installPackage(context, packageName, dev = false) {
15
+ if (!await isPackageListed(getPackageName(packageName), { cwd: context.config.root })) if (context.config.autoInstall) {
16
+ context.warn(`The package "${packageName}" is not installed. It will be installed automatically.`);
17
+ const result = await install(packageName, {
18
+ cwd: context.config.root,
19
+ dev
20
+ });
21
+ if (isNumber(result.exitCode) && result.exitCode > 0) {
22
+ context.error(result.stderr);
23
+ throw new Error(`An error occurred while installing the package "${packageName}"`);
24
+ }
25
+ } else context.warn(`The package "${packageName}" is not installed. Since the "autoInstall" option is set to false, it will not be installed automatically.`);
26
+ else if (hasPackageVersion(packageName) && !process.env.POWERLINES_SKIP_VERSION_CHECK) {
27
+ if (!await doesPackageMatch(getPackageName(packageName), getPackageVersion(packageName), context.config.root)) {
28
+ const packageListing = await getPackageListing(getPackageName(packageName), { cwd: context.config.root });
29
+ if (!packageListing?.version.startsWith("catalog:") && !packageListing?.version.startsWith("workspace:")) context.warn(`The package "${getPackageName(packageName)}" is installed but does not match the expected version ${getPackageVersion(packageName)} (installed version: ${packageListing?.version || "<Unknown>"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the "STORM_STACK_SKIP_VERSION_CHECK" environment variable.`);
30
+ }
31
+ }
32
+ }
33
+ /**
34
+ * Installs a package if it is not already installed.
35
+ *
36
+ * @param context - The resolved options
37
+ * @param packages - The list of packages to install
38
+ */
39
+ async function installPackages(context, packages) {
40
+ return Promise.all(packages.map(async (pkg) => installPackage(context, pkg.name, pkg.dev)));
41
+ }
42
+
43
+ //#endregion
44
+ export { installPackage, installPackages };
45
+ //# sourceMappingURL=install.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.mjs","names":[],"sources":["../../src/plugin-utils/install.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 type { Context } from \"@powerlines/core\";\nimport { install } from \"@stryke/fs/install\";\nimport {\n doesPackageMatch,\n getPackageListing,\n isPackageListed\n} from \"@stryke/fs/package-fns\";\nimport {\n getPackageName,\n getPackageVersion,\n hasPackageVersion\n} from \"@stryke/string-format/package\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packageName - The name of the package to install\n * @param dev - Whether to install the package as a dev dependency\n */\nexport async function installPackage(\n context: Context,\n packageName: string,\n dev = false\n) {\n if (\n !(await isPackageListed(getPackageName(packageName), {\n cwd: context.config.root\n }))\n ) {\n if (context.config.autoInstall) {\n context.warn(\n `The package \"${packageName}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(packageName, {\n cwd: context.config.root,\n dev\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n throw new Error(\n `An error occurred while installing the package \"${packageName}\"`\n );\n }\n } else {\n context.warn(\n `The package \"${packageName}\" is not installed. Since the \"autoInstall\" option is set to false, it will not be installed automatically.`\n );\n }\n } else if (\n hasPackageVersion(packageName) &&\n !process.env.POWERLINES_SKIP_VERSION_CHECK\n ) {\n const isMatching = await doesPackageMatch(\n getPackageName(packageName),\n getPackageVersion(packageName)!,\n context.config.root\n );\n if (!isMatching) {\n const packageListing = await getPackageListing(\n getPackageName(packageName),\n {\n cwd: context.config.root\n }\n );\n if (\n !packageListing?.version.startsWith(\"catalog:\") &&\n !packageListing?.version.startsWith(\"workspace:\")\n ) {\n context.warn(\n `The package \"${getPackageName(packageName)}\" is installed but does not match the expected version ${getPackageVersion(\n packageName\n )} (installed version: ${packageListing?.version || \"<Unknown>\"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the \"STORM_STACK_SKIP_VERSION_CHECK\" environment variable.`\n );\n }\n }\n }\n}\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packages - The list of packages to install\n */\nexport async function installPackages(\n context: Context,\n packages: Array<{ name: string; dev?: boolean }>\n) {\n return Promise.all(\n packages.map(async pkg => installPackage(context, pkg.name, pkg.dev))\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAuCA,eAAsB,eACpB,SACA,aACA,MAAM,OACN;AACA,KACE,CAAE,MAAM,gBAAgB,eAAe,YAAY,EAAE,EACnD,KAAK,QAAQ,OAAO,MACrB,CAAC,CAEF,KAAI,QAAQ,OAAO,aAAa;AAC9B,UAAQ,KACN,gBAAgB,YAAY,yDAC7B;EAED,MAAM,SAAS,MAAM,QAAQ,aAAa;GACxC,KAAK,QAAQ,OAAO;GACpB;GACD,CAAC;AACF,MAAI,SAAS,OAAO,SAAS,IAAI,OAAO,WAAW,GAAG;AACpD,WAAQ,MAAM,OAAO,OAAO;AAC5B,SAAM,IAAI,MACR,mDAAmD,YAAY,GAChE;;OAGH,SAAQ,KACN,gBAAgB,YAAY,6GAC7B;UAGH,kBAAkB,YAAY,IAC9B,CAAC,QAAQ,IAAI,+BAOb;MAAI,CAAC,MALoB,iBACvB,eAAe,YAAY,EAC3B,kBAAkB,YAAY,EAC9B,QAAQ,OAAO,KAChB,EACgB;GACf,MAAM,iBAAiB,MAAM,kBAC3B,eAAe,YAAY,EAC3B,EACE,KAAK,QAAQ,OAAO,MACrB,CACF;AACD,OACE,CAAC,gBAAgB,QAAQ,WAAW,WAAW,IAC/C,CAAC,gBAAgB,QAAQ,WAAW,aAAa,CAEjD,SAAQ,KACN,gBAAgB,eAAe,YAAY,CAAC,yDAAyD,kBACnG,YACD,CAAC,uBAAuB,gBAAgB,WAAW,YAAY,4JACjE;;;;;;;;;;AAYT,eAAsB,gBACpB,SACA,UACA;AACA,QAAO,QAAQ,IACb,SAAS,IAAI,OAAM,QAAO,eAAe,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC,CACtE"}