@powerlines/core 0.15.0 → 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
@@ -0,0 +1,934 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_constants_log_level = require('../constants/log-level.cjs');
4
+ const require_plugin_utils_logging = require('../plugin-utils/logging.cjs');
5
+ const require_lib_resolver = require('../lib/resolver.cjs');
6
+ const require_lib_config = require('../lib/config.cjs');
7
+ const require_plugin_utils_helpers = require('../plugin-utils/helpers.cjs');
8
+ const require_plugin_utils_merge = require('../plugin-utils/merge.cjs');
9
+ const require_plugin_utils_context_helpers = require('../plugin-utils/context-helpers.cjs');
10
+ const require_plugin_utils_format = require('../plugin-utils/format.cjs');
11
+ const require_plugin_utils_paths = require('../plugin-utils/paths.cjs');
12
+ const require_lib_hooks = require('../lib/hooks.cjs');
13
+ const require_lib_context_helpers = require('../lib/context-helpers.cjs');
14
+ const require_lib_entry = require('../lib/entry.cjs');
15
+ const require_constants_meta = require('../constants/meta.cjs');
16
+ require('../constants/index.cjs');
17
+ const require_lib_meta = require('../lib/meta.cjs');
18
+ const require_lib_typescript_tsconfig = require('../lib/typescript/tsconfig.cjs');
19
+ const require_lib_vfs = require('../lib/vfs.cjs');
20
+ const require_context_base_context = require('./base-context.cjs');
21
+ let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
22
+ let _stryke_path_append = require("@stryke/path/append");
23
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
24
+ let _stryke_path_replace = require("@stryke/path/replace");
25
+ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
26
+ let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
27
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
28
+ let defu = require("defu");
29
+ defu = require_runtime.__toESM(defu, 1);
30
+ let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
31
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
32
+ let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
33
+ let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
34
+ let _stryke_convert_to_array = require("@stryke/convert/to-array");
35
+ let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
36
+ let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
37
+ let _stryke_path_join = require("@stryke/path/join");
38
+ let _stryke_helpers_omit = require("@stryke/helpers/omit");
39
+ let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
40
+ let node_fs = require("node:fs");
41
+ let _stryke_hash = require("@stryke/hash");
42
+ let bundle_require = require("bundle-require");
43
+ let flat_cache = require("flat-cache");
44
+ let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
45
+ let _stryke_hash_node = require("@stryke/hash/node");
46
+ let _stryke_http_fetch = require("@stryke/http/fetch");
47
+ let _stryke_path_is_equal = require("@stryke/path/is-equal");
48
+ let compatx = require("compatx");
49
+ let oxc_parser = require("oxc-parser");
50
+ let undici = require("undici");
51
+
52
+ //#region src/context/context.ts
53
+ (0, undici.setGlobalDispatcher)(new undici.Agent({ keepAliveTimeout: 1e4 }).compose(undici.interceptors.retry({
54
+ maxRetries: 3,
55
+ minTimeout: 1e3,
56
+ maxTimeout: 1e4,
57
+ timeoutFactor: 2,
58
+ retryAfter: true
59
+ })));
60
+ const UNRESOLVED_CONFIG_NAMES = [
61
+ "userConfig",
62
+ "inlineConfig",
63
+ "pluginConfig",
64
+ "environmentConfig"
65
+ ];
66
+ var PowerlinesContext = class extends require_context_base_context.PowerlinesBaseContext {
67
+ #checksum = null;
68
+ #buildId = (0, _stryke_unique_id_uuid.uuid)();
69
+ #releaseId = (0, _stryke_unique_id_uuid.uuid)();
70
+ #fs;
71
+ #tsconfig;
72
+ #parserCache;
73
+ #requestCache;
74
+ #configProxy;
75
+ resolver;
76
+ /**
77
+ * The parsed `package.json` file for the project
78
+ */
79
+ packageJson;
80
+ /**
81
+ * The parsed `project.json` file for the project
82
+ */
83
+ projectJson = void 0;
84
+ /**
85
+ * The parsed configuration file for the project
86
+ */
87
+ configFile;
88
+ /**
89
+ * An object containing the dependencies that should be installed for the project
90
+ */
91
+ dependencies = {};
92
+ /**
93
+ * An object containing the development dependencies that should be installed for the project
94
+ */
95
+ devDependencies = {};
96
+ /**
97
+ * The persisted meta information about the current build
98
+ */
99
+ persistedMeta = void 0;
100
+ /**
101
+ * The resolved tsconfig file paths for the project
102
+ */
103
+ resolvePatterns = [];
104
+ /**
105
+ * The resolved configuration for this context
106
+ */
107
+ resolvedConfig = {};
108
+ /**
109
+ * The configuration options that were overridden by plugins during the build process, which may include additional properties or modifications made during the configuration loading process.
110
+ */
111
+ overriddenConfig = {};
112
+ /**
113
+ * The configuration options provided inline during execution, such as CLI flags or other parameters that may be relevant to the command being executed. These options can be used to override or supplement the configuration options defined in a configuration file on disk, and are typically provided as part of the execution context when running a Powerlines command.
114
+ */
115
+ inlineConfig = {};
116
+ /**
117
+ * The configuration options read from a configuration file on disk, which may be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.
118
+ */
119
+ userConfig = {};
120
+ /**
121
+ * The configuration options provided by plugins added by the user (and other plugins)
122
+ */
123
+ pluginConfig = {};
124
+ /**
125
+ * The configuration options provided by the environment
126
+ */
127
+ environmentConfig = {};
128
+ /**
129
+ * The resolved entry type definitions for the project
130
+ */
131
+ get entry() {
132
+ const entry = this.resolvedEntry;
133
+ return require_lib_entry.resolveInputsSync(this, entry && entry.length > 0 ? entry : Array.isArray(this.config.input) || (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.input) && !require_lib_entry.isTypeDefinition(this.config.input) ? this.config.input : (0, _stryke_convert_to_array.toArray)(this.config.input).flat());
134
+ }
135
+ /**
136
+ * The TypeScript configuration parsed from the tsconfig file
137
+ */
138
+ get tsconfig() {
139
+ if (!this.#tsconfig) this.tsconfig = { tsconfigFilePath: this.config.tsconfig };
140
+ return this.#tsconfig;
141
+ }
142
+ /**
143
+ * Sets the TypeScript configuration parsed from the tsconfig file
144
+ */
145
+ set tsconfig(value) {
146
+ this.#tsconfig = value;
147
+ this.resolvePatterns = (0, bundle_require.tsconfigPathsToRegExp)(value?.options?.paths ?? {});
148
+ }
149
+ /**
150
+ * The virtual file system interface for the project
151
+ */
152
+ get fs() {
153
+ if (!this.#fs) this.#fs = require_lib_vfs.VirtualFileSystem.createSync(this);
154
+ return this.#fs;
155
+ }
156
+ /**
157
+ * Get the checksum of the project's current state
158
+ */
159
+ get checksum() {
160
+ return this.#checksum;
161
+ }
162
+ /**
163
+ * Invokes the configured plugin hooks
164
+ *
165
+ * @remarks
166
+ * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
167
+ *
168
+ * @param hook - The hook to call
169
+ * @param options - The options to provide to the hook
170
+ * @param args - The arguments to pass to the hook
171
+ * @returns The result of the hook call
172
+ */
173
+ callHook = async (hook, options, ...args) => require_lib_hooks.callHook(this, hook, options, ...args);
174
+ /**
175
+ * The meta information about the current build
176
+ */
177
+ get meta() {
178
+ return {
179
+ executionId: this.#buildId,
180
+ releaseId: this.#releaseId,
181
+ checksum: this.#checksum,
182
+ timestamp: this.timestamp,
183
+ rootHash: (0, _stryke_hash.murmurhash)({
184
+ workspaceRoot: this.config?.cwd,
185
+ root: this.config?.root
186
+ }, { maxLength: 45 }),
187
+ configHash: (0, _stryke_hash.murmurhash)(this.config, { maxLength: 62 })
188
+ };
189
+ }
190
+ /**
191
+ * The resolved configuration options
192
+ */
193
+ get config() {
194
+ if (!this.#configProxy) this.#configProxy = this.createConfigProxy();
195
+ return this.#configProxy;
196
+ }
197
+ /**
198
+ * Get the path to the artifacts directory for the project
199
+ */
200
+ get artifactsPath() {
201
+ return (0, _stryke_path_join.joinPaths)(this.config.cwd, this.config.root, this.config.output?.artifactsPath || `.${this.config.framework?.name || "powerlines"}`);
202
+ }
203
+ /**
204
+ * Get the path to the builtin modules used by the project
205
+ */
206
+ get builtinsPath() {
207
+ return (0, _stryke_path_join.joinPaths)(this.artifactsPath, "builtins");
208
+ }
209
+ /**
210
+ * Get the path to the entry directory for the project
211
+ */
212
+ get entryPath() {
213
+ return (0, _stryke_path_join.joinPaths)(this.artifactsPath, "entry");
214
+ }
215
+ /**
216
+ * Get the path to the infrastructure modules used by the project
217
+ */
218
+ get infrastructurePath() {
219
+ return (0, _stryke_path_join.joinPaths)(this.artifactsPath, "infrastructure");
220
+ }
221
+ /**
222
+ * Get the path to the data directory for the project
223
+ */
224
+ get dataPath() {
225
+ return (0, _stryke_path_join.joinPaths)(this.envPaths.data, "projects", require_lib_meta.getPrefixedRootHash(this.config.name, this.meta.rootHash));
226
+ }
227
+ /**
228
+ * Get the path to the cache directory for the project
229
+ */
230
+ get cachePath() {
231
+ return (0, _stryke_path_join.joinPaths)(this.envPaths.cache, "projects", (0, _stryke_hash.murmurhash)({
232
+ checksum: this.#checksum,
233
+ config: this.meta.configHash
234
+ }, { maxLength: 62 }));
235
+ }
236
+ /**
237
+ * Get the path to the generated declaration file for the project
238
+ */
239
+ get typesPath() {
240
+ return this.config.output.types ? (0, _stryke_path_append.appendPath)(this.config.output.types, this.config.cwd) : (0, _stryke_path_join.joinPaths)(this.config.cwd, this.config.root, "powerlines.d.ts");
241
+ }
242
+ /**
243
+ * Get the project root relative to the workspace root
244
+ */
245
+ get relativeToWorkspaceRoot() {
246
+ return (0, _stryke_fs_get_workspace_root.relativeToWorkspaceRoot)(this.config.root);
247
+ }
248
+ /**
249
+ * The builtin module id that exist in the Powerlines virtual file system
250
+ */
251
+ get builtins() {
252
+ return Object.values(this.fs.metadata).filter((meta) => meta && meta.type === "builtin").map((meta) => meta?.id).filter(Boolean);
253
+ }
254
+ /**
255
+ * Additional arguments provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed.
256
+ */
257
+ get additionalArgs() {
258
+ return Object.entries(this.config.inlineConfig.additionalArgs ?? {}).reduce((ret, [key, value]) => {
259
+ const formattedKey = key.replace(/^--?/, "");
260
+ if (ret[formattedKey]) if (Array.isArray(ret[formattedKey])) if (Array.isArray(value)) ret[formattedKey] = [...(0, _stryke_convert_to_array.toArray)(ret[formattedKey]), ...value];
261
+ else ret[formattedKey] = [...(0, _stryke_convert_to_array.toArray)(ret[formattedKey]), value];
262
+ else ret[formattedKey] = [ret[formattedKey], ...Array.isArray(value) ? value : [value]];
263
+ else ret[formattedKey] = value;
264
+ return ret;
265
+ }, {});
266
+ }
267
+ /**
268
+ * The alias mappings for the project used during module resolution
269
+ *
270
+ * @remarks
271
+ * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.
272
+ */
273
+ get alias() {
274
+ return this.builtins.reduce((ret, id) => {
275
+ const moduleId = `${this.config?.framework?.name || "powerlines"}:${id.replace(/^.*:/, "")}`;
276
+ if (!ret[moduleId]) {
277
+ const path = this.fs.paths[id];
278
+ if (path) ret[moduleId] = path;
279
+ }
280
+ return ret;
281
+ }, this.config.resolve.alias ? Array.isArray(this.config.resolve.alias) ? this.config.resolve.alias.reduce((ret, alias) => {
282
+ if (!ret[alias.find.toString()]) ret[alias.find.toString()] = alias.replacement;
283
+ return ret;
284
+ }, {}) : this.config.resolve.alias : {});
285
+ }
286
+ get logger() {
287
+ return this.createLogger();
288
+ }
289
+ /**
290
+ * The log level for the context, which determines the minimum level of log messages that will be emitted by the logger. This is resolved based on the configuration options provided by the user, and can be set to different levels for development, production, and test environments. The log level can also be overridden by plugins or other parts of the build process to provide more granular control over logging output.
291
+ */
292
+ get logLevel() {
293
+ return require_plugin_utils_logging.resolveLogLevel(this.config.logLevel, this.config.mode);
294
+ }
295
+ /**
296
+ * The environment paths for the project, which provide the locations of various directories and files used by the Powerlines framework. These paths are resolved based on the organization ID, application ID, and workspace root directory, and can be used to access configuration files, cache directories, and other resources in a consistent manner.
297
+ */
298
+ get envPaths() {
299
+ return (0, _stryke_env_get_env_paths.getEnvPaths)({
300
+ orgId: (0, _stryke_string_format_kebab_case.kebabCase)(this.config.framework?.orgId || "storm-software"),
301
+ appId: (0, _stryke_string_format_kebab_case.kebabCase)(this.config.framework?.name || "powerlines"),
302
+ workspaceRoot: this.config.cwd
303
+ });
304
+ }
305
+ /**
306
+ * Gets the parser cache.
307
+ */
308
+ get parserCache() {
309
+ if (!this.#parserCache) this.#parserCache = (0, flat_cache.create)({
310
+ cacheId: "parser",
311
+ cacheDir: this.cachePath,
312
+ ttl: 7200 * 1e3,
313
+ lruSize: 5e3,
314
+ persistInterval: 250
315
+ });
316
+ return this.#parserCache;
317
+ }
318
+ /**
319
+ * Gets the request cache.
320
+ */
321
+ get requestCache() {
322
+ if (!this.#requestCache) this.#requestCache = (0, flat_cache.create)({
323
+ cacheId: "http",
324
+ cacheDir: this.cachePath,
325
+ ttl: 360 * 60 * 1e3,
326
+ lruSize: 5e3,
327
+ persistInterval: 250
328
+ });
329
+ return this.#requestCache;
330
+ }
331
+ /**
332
+ * The entry points that exist in the Powerlines virtual file system
333
+ */
334
+ get resolvedEntry() {
335
+ return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
336
+ const typeDefinition = { file: path };
337
+ if (meta.properties) {
338
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties.file)) typeDefinition.file = meta.properties.file;
339
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties.name)) typeDefinition.name = meta.properties.name;
340
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties["input.file"]) || (0, _stryke_type_checks_is_set_string.isSetString)(meta.properties["input.name"])) {
341
+ typeDefinition.input ??= {};
342
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties["input.file"])) typeDefinition.input.file = meta.properties["input.file"];
343
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties["input.name"])) typeDefinition.input.name = meta.properties["input.name"];
344
+ }
345
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(meta.properties.output)) typeDefinition.output = meta.properties.output;
346
+ }
347
+ return typeDefinition;
348
+ }).filter(Boolean);
349
+ }
350
+ /**
351
+ * Creates a new Context instance.
352
+ *
353
+ * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
354
+ */
355
+ constructor(options) {
356
+ super(options);
357
+ this.options = options;
358
+ }
359
+ createLogger(options = {}) {
360
+ return require_plugin_utils_logging.createLogger(this.config.name || this.options.root, {
361
+ logLevel: this.logLevel,
362
+ ...options
363
+ }, this.options.logFn);
364
+ }
365
+ /**
366
+ * A function to perform HTTP fetch requests
367
+ *
368
+ * @remarks
369
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
370
+ *
371
+ * @example
372
+ * ```ts
373
+ * const response = await context.fetch("https://api.example.com/data");
374
+ * const data = await response.json();
375
+ * ```
376
+ *
377
+ * @see https://github.com/nodejs/undici
378
+ *
379
+ * @param input - The URL to fetch.
380
+ * @param options - The fetch request options.
381
+ * @returns A promise that resolves to a response returned by the fetch.
382
+ */
383
+ async fetch(input, options = {}) {
384
+ const cacheKey = (0, _stryke_hash.murmurhash)({
385
+ input: input.toString(),
386
+ options: JSON.stringify(options)
387
+ });
388
+ if (!this.config.skipCache && !options.skipCache) {
389
+ const cached = this.requestCache.get(cacheKey);
390
+ if (cached) return new undici.Response(cached.body, {
391
+ status: cached.status,
392
+ statusText: cached.statusText,
393
+ headers: cached.headers
394
+ });
395
+ }
396
+ const logger = this.extendLogger({ category: "communication" });
397
+ const startTime = Date.now();
398
+ logger.trace(`Sending fetch request (${options.method?.toUpperCase() || "GET"}): ${input.toString()}`);
399
+ const response = await (0, _stryke_http_fetch.fetchRequest)(input, {
400
+ timeout: 12e3,
401
+ ...options
402
+ });
403
+ const result = {
404
+ body: await response.text(),
405
+ status: response.status,
406
+ statusText: response.statusText,
407
+ headers: Object.fromEntries(response.headers.entries())
408
+ };
409
+ if (!this.config.skipCache && !options.skipCache) try {
410
+ this.requestCache.set(cacheKey, result);
411
+ } catch {}
412
+ logger.trace(`Fetch request (${options.method?.toUpperCase() || "GET"}) completed in ${Date.now() - startTime}ms: ${input.toString()} - ${response.status} / ${response.statusText} \n - Response Headers: ${JSON.stringify(result.headers)}\n - Response Body: ${typeof result.body === "string" ? result.body.length > 1e3 ? `${result.body.slice(0, 1e3)}... (truncated, total length: ${result.body.length})` : result.body : "[Non-string body]"}`);
413
+ return new undici.Response(result.body, {
414
+ status: result.status,
415
+ statusText: result.statusText,
416
+ headers: result.headers
417
+ });
418
+ }
419
+ /**
420
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
421
+ *
422
+ * @remarks
423
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
424
+ *
425
+ * @example
426
+ * ```ts
427
+ * const ast = context.parse("const x: number = 42;");
428
+ * ```
429
+ *
430
+ * @see https://rollupjs.org/plugin-development/#this-parse
431
+ * @see https://github.com/oxc/oxc
432
+ *
433
+ * @param code - The source code to parse.
434
+ * @param options - The options to pass to the parser.
435
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
436
+ */
437
+ async parse(code, options = {}) {
438
+ const cacheKey = (0, _stryke_hash.murmurhash)({
439
+ code,
440
+ options
441
+ });
442
+ let result;
443
+ if (!this.config.skipCache) {
444
+ result = this.parserCache.get(cacheKey);
445
+ if (result) return result;
446
+ }
447
+ result = await (0, oxc_parser.parse)(`source.${options.lang || "ts"}`, code, {
448
+ ...options,
449
+ sourceType: "module",
450
+ showSemanticErrors: this.config.mode === "development"
451
+ });
452
+ if (!this.config.skipCache) this.parserCache.set(cacheKey, result);
453
+ return result;
454
+ }
455
+ /**
456
+ * A helper function to resolve modules in the Virtual File System
457
+ *
458
+ * @remarks
459
+ * This function can be used to resolve modules relative to the project root directory.
460
+ *
461
+ * @example
462
+ * ```ts
463
+ * const resolved = await context.resolve("some-module", "/path/to/importer");
464
+ * ```
465
+ *
466
+ * @param id - The module to resolve.
467
+ * @param importer - An optional path to the importer module.
468
+ * @param options - Additional resolution options.
469
+ * @returns A promise that resolves to the resolved module path.
470
+ */
471
+ async resolve(id, importer, options = {}) {
472
+ let moduleId = id;
473
+ if (this.config.resolve.alias) {
474
+ if (Array.isArray(this.config.resolve.alias)) {
475
+ const alias = this.config.resolve.alias.find((a) => (0, bundle_require.match)(moduleId, [a.find]));
476
+ if (alias) moduleId = alias.replacement;
477
+ } else if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.resolve.alias) && this.config.resolve.alias[id]) moduleId = this.config.resolve.alias[id];
478
+ }
479
+ if (this.fs.isResolvableId(moduleId) || importer && this.fs.isResolvableId(importer)) {
480
+ let resolvedImporter = importer;
481
+ if (importer && this.fs.isResolvableId(importer)) resolvedImporter = await this.fs.resolve(importer, void 0, (0, defu.default)({
482
+ conditions: this.config.resolve.conditions,
483
+ extensions: this.config.resolve.extensions
484
+ }, options));
485
+ const result = await this.fs.resolve(moduleId, resolvedImporter, (0, defu.default)({
486
+ conditions: this.config.resolve.conditions,
487
+ extensions: this.config.resolve.extensions
488
+ }, options));
489
+ if (!result) return;
490
+ const external = Boolean(!(0, bundle_require.match)(moduleId, this.config.resolve.noExternal) && ((0, bundle_require.match)(moduleId, this.config.resolve.external) || moduleId.startsWith("node:") || (!this.fs.isVirtual(moduleId, importer, options) || this.fs.isVirtual(moduleId, importer, options) && this.config.projectType !== "application") && this.config.resolve.skipNodeModulesBundle && !/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId)));
491
+ return {
492
+ id: result,
493
+ external,
494
+ virtual: !external
495
+ };
496
+ }
497
+ if (this.config.resolve.skipNodeModulesBundle) {
498
+ if ((0, bundle_require.match)(moduleId, this.resolvePatterns) || (0, bundle_require.match)(moduleId, this.config.resolve.noExternal)) return;
499
+ if ((0, bundle_require.match)(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) return {
500
+ id: moduleId,
501
+ external: true,
502
+ virtual: false
503
+ };
504
+ if (!/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId)) return {
505
+ id: moduleId,
506
+ external: true,
507
+ virtual: false
508
+ };
509
+ } else {
510
+ if ((0, bundle_require.match)(moduleId, this.config.resolve.noExternal)) return;
511
+ if ((0, bundle_require.match)(moduleId, this.config.resolve.external) || moduleId.startsWith("node:")) return {
512
+ id: moduleId,
513
+ external: true,
514
+ virtual: false
515
+ };
516
+ }
517
+ }
518
+ /**
519
+ * A helper function to load modules from the Virtual File System
520
+ *
521
+ * @remarks
522
+ * This function can be used to load modules relative to the project root directory.
523
+ *
524
+ * @example
525
+ * ```ts
526
+ * const module = await context.load("some-module", "/path/to/importer");
527
+ * ```
528
+ *
529
+ * @param id - The module to load.
530
+ * @returns A promise that resolves to the loaded module.
531
+ */
532
+ async load(id) {
533
+ const resolvedId = await this.fs.resolve(id);
534
+ if (!resolvedId) return;
535
+ const code = await this.fs.read(resolvedId);
536
+ if (!code) return;
537
+ return {
538
+ code,
539
+ map: null
540
+ };
541
+ }
542
+ /**
543
+ * Get the builtin virtual files that exist in the Powerlines virtual file system
544
+ */
545
+ async getBuiltins() {
546
+ return Promise.all(Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "builtin").map(async ([id, meta]) => {
547
+ const code = await this.fs.read(id);
548
+ const path = this.fs.paths[id];
549
+ return {
550
+ ...meta,
551
+ path,
552
+ code
553
+ };
554
+ }));
555
+ }
556
+ /**
557
+ * Resolves a file and writes it to the VFS if it does not already exist
558
+ *
559
+ * @param code - The source code of the file
560
+ * @param path - The path to write the file to
561
+ * @param options - Additional options for writing the file
562
+ */
563
+ async emit(code, path, options = {}) {
564
+ const filePath = options.extension ? (0, _stryke_path_file_path_fns.findFileExtensionSafe)(path) ? options.extension.startsWith(".") ? path.replace((0, _stryke_path_file_path_fns.findFileDotExtensionSafe)(path), options.extension) : path.replace((0, _stryke_path_file_path_fns.findFileExtensionSafe)(path), options.extension) : options.extension.startsWith(".") ? `${path}${options.extension}` : `${path}.${options.extension}` : (0, _stryke_path_file_path_fns.findFileExtensionSafe)(path) ? path : `${path}.ts`;
565
+ if ((0, _stryke_type_checks_is_function.isFunction)(this.emitFile) && options.emitWithBundler) return this.emitFile({
566
+ needsCodeReference: options.needsCodeReference,
567
+ originalFileName: options.originalFileName,
568
+ fileName: filePath,
569
+ source: code,
570
+ type: "asset"
571
+ });
572
+ return this.fs.write(filePath, code, options);
573
+ }
574
+ /**
575
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
576
+ *
577
+ * @param code - The source code of the file
578
+ * @param path - The path to write the file to
579
+ * @param options - Additional options for writing the file
580
+ */
581
+ emitSync(code, path, options = {}) {
582
+ const filePath = options.extension ? (0, _stryke_path_file_path_fns.findFileExtensionSafe)(path) ? options.extension.startsWith(".") ? path.replace((0, _stryke_path_file_path_fns.findFileDotExtensionSafe)(path), options.extension) : path.replace((0, _stryke_path_file_path_fns.findFileExtensionSafe)(path), options.extension) : options.extension.startsWith(".") ? `${path}${options.extension}` : `${path}.${options.extension}` : (0, _stryke_path_file_path_fns.findFileExtensionSafe)(path) ? path : `${path}.ts`;
583
+ if ((0, _stryke_type_checks_is_function.isFunction)(this.emitFile) && options.emitWithBundler) return this.emitFile({
584
+ needsCodeReference: options.needsCodeReference,
585
+ originalFileName: options.originalFileName,
586
+ fileName: filePath,
587
+ source: code,
588
+ type: "asset"
589
+ });
590
+ return this.fs.writeSync(filePath, code, options);
591
+ }
592
+ /**
593
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
594
+ *
595
+ * @param code - The source code of the entry file
596
+ * @param path - A path to write the entry file to
597
+ * @param options - Optional write file options
598
+ */
599
+ async emitEntry(code, path, options = {}) {
600
+ return this.emit(code, (0, _stryke_path_append.appendPath)(path, this.entryPath), (0, defu.default)({ meta: {
601
+ type: "entry",
602
+ properties: {
603
+ file: (0, _stryke_path_append.appendPath)(path, this.entryPath),
604
+ name: options?.name,
605
+ output: options?.output,
606
+ "input.file": options?.input?.file,
607
+ "input.name": options?.input?.name
608
+ }
609
+ } }, (0, _stryke_helpers_omit.omit)(options, ["name"])));
610
+ }
611
+ /**
612
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
613
+ *
614
+ * @param code - The source code of the entry file
615
+ * @param path - A path to write the entry file to
616
+ * @param options - Optional write file options
617
+ */
618
+ emitEntrySync(code, path, options = {}) {
619
+ return this.emitSync(code, (0, _stryke_path_append.appendPath)(path, this.entryPath), (0, defu.default)({ meta: {
620
+ type: "entry",
621
+ properties: {
622
+ file: (0, _stryke_path_append.appendPath)(path, this.entryPath),
623
+ name: options?.name,
624
+ output: options?.output,
625
+ "input.file": options?.input?.file,
626
+ "input.name": options?.input?.name
627
+ }
628
+ } }, (0, _stryke_helpers_omit.omit)(options, ["name"])));
629
+ }
630
+ /**
631
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
632
+ *
633
+ * @param code - The source code of the builtin file
634
+ * @param id - The unique identifier of the builtin file
635
+ * @param options - Optional write file options
636
+ */
637
+ async emitBuiltin(code, id, options = {}) {
638
+ if (!this.builtinsPath) throw new Error(`The builtins path is not set. Cannot emit builtin file with id "${id}".`);
639
+ if (!(0, _stryke_type_checks_is_set_string.isSetString)(id)) throw new Error(`The builtin id must be a non-empty string. Received: ${String(id)}`);
640
+ return this.emit(code, (0, _stryke_path_append.appendPath)(id, this.builtinsPath), (0, defu.default)(options, { meta: {
641
+ type: "builtin",
642
+ id
643
+ } }));
644
+ }
645
+ /**
646
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
647
+ *
648
+ * @param code - The source code of the builtin file
649
+ * @param id - The unique identifier of the builtin file
650
+ * @param options - Optional write file options
651
+ */
652
+ emitBuiltinSync(code, id, options = {}) {
653
+ if (!this.builtinsPath) throw new Error(`The builtins path is not set. Cannot emit builtin file with id "${id}".`);
654
+ if (!(0, _stryke_type_checks_is_set_string.isSetString)(id)) throw new Error(`The builtin id must be a non-empty string. Received: ${String(id)}`);
655
+ return this.emitSync(code, (0, _stryke_path_append.appendPath)(id, this.builtinsPath), (0, defu.default)(options, { meta: {
656
+ type: "builtin",
657
+ id
658
+ } }));
659
+ }
660
+ /**
661
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
662
+ *
663
+ * @param code - The source code of the builtin file
664
+ * @param id - The unique identifier of the builtin file
665
+ * @param options - Optional write file options
666
+ */
667
+ async emitInfrastructure(code, id, options = {}) {
668
+ if (!this.infrastructurePath) throw new Error(`The infrastructure path is not set. Cannot emit infrastructure file with id "${id}".`);
669
+ if (!(0, _stryke_type_checks_is_set_string.isSetString)(id)) throw new Error(`The infrastructure id must be a non-empty string. Received: ${String(id)}`);
670
+ return this.emit(code, (0, _stryke_path_append.appendPath)(id, this.infrastructurePath), (0, defu.default)(options, { meta: {
671
+ type: "infrastructure",
672
+ id
673
+ } }));
674
+ }
675
+ /**
676
+ * Synchronously resolves an infrastructure virtual file and writes it to the VFS if it does not already exist
677
+ *
678
+ * @param code - The source code of the infrastructure file
679
+ * @param id - The unique identifier of the infrastructure file
680
+ * @param options - Optional write file options
681
+ */
682
+ emitInfrastructureSync(code, id, options = {}) {
683
+ if (!this.infrastructurePath) throw new Error(`The infrastructure path is not set. Cannot emit infrastructure file with id "${id}".`);
684
+ if (!(0, _stryke_type_checks_is_set_string.isSetString)(id)) throw new Error(`The infrastructure id must be a non-empty string. Received: ${String(id)}`);
685
+ return this.emitSync(code, (0, _stryke_path_append.appendPath)(id, this.infrastructurePath), (0, defu.default)(options, { meta: {
686
+ type: "infrastructure",
687
+ id
688
+ } }));
689
+ }
690
+ /**
691
+ * Generates a checksum representing the current context state
692
+ *
693
+ * @param path - The root directory of the project to generate the checksum for
694
+ * @returns A promise that resolves to a string representing the checksum
695
+ */
696
+ async generateChecksum(path) {
697
+ return (0, _stryke_hash_node.hashDirectory)(path || (0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd));
698
+ }
699
+ /**
700
+ * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.
701
+ *
702
+ * @param config - The inline configuration values to set.
703
+ * @returns A promise that resolves when the inline configuration values have been set.
704
+ */
705
+ async setInlineConfig(config) {
706
+ this.logger.debug({
707
+ meta: { category: "config" },
708
+ message: `Updating inline configuration object: \n${require_plugin_utils_format.formatConfig(config)}`
709
+ });
710
+ this.inlineConfig = config;
711
+ this.#checksum = await this.generateChecksum();
712
+ this.configFile = await require_lib_config.loadParsedConfig(this.options.cwd, this.options.root, this.options.framework?.name || "powerlines", this.options.framework?.orgId || "storm-software", config);
713
+ const result = this.configFile.config && (0, _stryke_convert_to_array.toArray)(this.configFile.config).length > this.options.configIndex ? (0, _stryke_convert_to_array.toArray)(this.configFile.config)[this.options.configIndex] : this.configFile.config;
714
+ if (!result) this.logger.warn(`No configuration found in ${this.options.configFile} for execution index ${this.options.configIndex}.`);
715
+ else await this.setUserConfig((0, _stryke_type_checks_is_function.isFunction)(result) ? await Promise.resolve(result({
716
+ cwd: this.cwd,
717
+ root: this.options.root,
718
+ mode: this.inlineConfig.mode || await require_lib_config.getDefaultMode(this.cwd, this.options.root),
719
+ command: this.inlineConfig.command
720
+ })) : result);
721
+ await this.resolveConfig();
722
+ }
723
+ /**
724
+ * A setter function to populate the plugin config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the plugin configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any plugin configuration provided during execution.
725
+ *
726
+ * @param config - The plugin configuration values to set.
727
+ * @returns A promise that resolves when the plugin configuration values have been set.
728
+ */
729
+ async setPluginConfig(config) {
730
+ this.logger.debug({
731
+ meta: { category: "config" },
732
+ message: `Updating plugin configuration object: \n${require_plugin_utils_format.formatConfig(config)}`
733
+ });
734
+ this.pluginConfig = config;
735
+ await this.resolveConfig();
736
+ }
737
+ /**
738
+ * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.
739
+ *
740
+ * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.
741
+ */
742
+ mergeConfig() {
743
+ return require_plugin_utils_merge.mergeConfig({
744
+ inlineConfig: this.inlineConfig,
745
+ userConfig: this.userConfig,
746
+ pluginConfig: this.pluginConfig,
747
+ environmentConfig: this.environmentConfig
748
+ }, require_lib_context_helpers.getConfigProps(this.overriddenConfig), this.options, require_lib_context_helpers.getConfigProps(this.inlineConfig), require_lib_context_helpers.getConfigProps(this.userConfig), require_lib_context_helpers.getConfigProps(this.pluginConfig), {
749
+ version: this.packageJson?.version,
750
+ description: this.packageJson?.description,
751
+ environments: {},
752
+ resolve: {}
753
+ });
754
+ }
755
+ /**
756
+ * A setter function to populate the user config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the user configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.
757
+ *
758
+ * @param config - The user configuration values to set.
759
+ * @returns A promise that resolves when the user configuration values have been set.
760
+ */
761
+ async setUserConfig(config) {
762
+ this.logger.debug({
763
+ meta: { category: "config" },
764
+ message: `Updating user configuration object: \n${require_plugin_utils_format.formatConfig(config)}`
765
+ });
766
+ this.userConfig = config;
767
+ await this.resolveConfig();
768
+ }
769
+ /**
770
+ * Initialize the context with the provided configuration options
771
+ */
772
+ async resolveConfig() {
773
+ const mergedConfig = this.mergeConfig();
774
+ this.logger.trace({
775
+ meta: { category: "config" },
776
+ message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${require_plugin_utils_format.formatConfig(mergedConfig)} \n\n --- User Config --- \n${require_plugin_utils_format.formatConfig(this.userConfig)} \n\n --- Inline Config --- \n${require_plugin_utils_format.formatConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n${require_plugin_utils_format.formatConfig(this.pluginConfig)} \n\n --- Environment Config --- \n${require_plugin_utils_format.formatConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n${require_plugin_utils_format.formatConfig(this.overriddenConfig)}`
777
+ });
778
+ mergedConfig.output = (0, defu.default)(mergedConfig.output ?? {}, {
779
+ copy: { assets: [
780
+ { glob: "LICENSE" },
781
+ {
782
+ input: mergedConfig.root,
783
+ glob: "*.md"
784
+ },
785
+ {
786
+ input: mergedConfig.root,
787
+ glob: "package.json"
788
+ }
789
+ ] },
790
+ dts: true
791
+ });
792
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.mode)) mergedConfig.mode = await require_lib_config.getDefaultMode(this.cwd, mergedConfig.root);
793
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.framework) || !(0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.framework.name)) {
794
+ mergedConfig.framework ??= {};
795
+ mergedConfig.framework.name ??= await require_plugin_utils_context_helpers.getWorkspaceName(this) || "powerlines";
796
+ }
797
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.platform)) mergedConfig.platform = "neutral";
798
+ mergedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(mergedConfig.compatibilityDate, "latest");
799
+ if (!this.packageJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
800
+ const result = await require_lib_config.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
801
+ if (result) {
802
+ if (result.packageJson) this.packageJson = result.packageJson;
803
+ if (result.projectJson) this.projectJson = result.projectJson;
804
+ if (this.packageJson) {
805
+ mergedConfig.framework ??= {};
806
+ mergedConfig.framework.name ??= await require_plugin_utils_context_helpers.getWorkspaceName(this) || "powerlines";
807
+ mergedConfig.framework.orgId ??= require_plugin_utils_context_helpers.getPackageJsonOrganization(this.packageJson) || "storm-software";
808
+ }
809
+ }
810
+ }
811
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
812
+ this.resolvedConfig = mergedConfig;
813
+ this.#configProxy = this.createConfigProxy();
814
+ mergedConfig.input = require_lib_entry.getUniqueInputs(mergedConfig.input);
815
+ if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
816
+ mergedConfig.title ??= (0, _stryke_string_format_title_case.titleCase)(mergedConfig.name);
817
+ if (mergedConfig.resolve.external) mergedConfig.resolve.external = (0, _stryke_helpers_get_unique.getUnique)(mergedConfig.resolve.external);
818
+ if (mergedConfig.resolve.noExternal) mergedConfig.resolve.noExternal = (0, _stryke_helpers_get_unique.getUnique)(mergedConfig.resolve.noExternal);
819
+ mergedConfig.plugins = (mergedConfig.plugins ?? []).flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin)).filter(Boolean).reduce((ret, plugin) => {
820
+ if (require_plugin_utils_helpers.isPlugin(plugin) && require_plugin_utils_helpers.isDuplicate(plugin, ret.filter((p) => require_plugin_utils_helpers.isPlugin(p)))) return ret;
821
+ ret.push(plugin);
822
+ return ret;
823
+ }, []);
824
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = require_constants_log_level.DEFAULT_DEVELOPMENT_LOG_LEVEL;
825
+ else if (mergedConfig.mode === "test") mergedConfig.logLevel = require_constants_log_level.DEFAULT_TEST_LOG_LEVEL;
826
+ else mergedConfig.logLevel = require_constants_log_level.DEFAULT_PRODUCTION_LOG_LEVEL;
827
+ mergedConfig.logLevel = require_plugin_utils_logging.resolveLogLevel(mergedConfig.logLevel);
828
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.tsconfig)) mergedConfig.tsconfig = (0, _stryke_path_replace.replacePath)(require_plugin_utils_paths.replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
829
+ else mergedConfig.tsconfig = require_lib_typescript_tsconfig.getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
830
+ mergedConfig.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
831
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.path)) mergedConfig.output.path = (0, _stryke_path_append.appendPath)(require_plugin_utils_paths.replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
832
+ else mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(mergedConfig.root, "dist"), mergedConfig.cwd);
833
+ mergedConfig.output.copy ??= {};
834
+ if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? (0, _stryke_path_append.appendPath)(require_plugin_utils_paths.replacePathTokens(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
835
+ else mergedConfig.output.copy.path = (0, _stryke_path_append.appendPath)(require_plugin_utils_paths.replacePathTokens(this, (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : (0, _stryke_path_join.joinPaths)("dist", mergedConfig.root)), mergedConfig.cwd);
836
+ if (mergedConfig.output.types !== false) mergedConfig.output.types = (0, _stryke_path_append.appendPath)(require_plugin_utils_paths.replacePathTokens(this, mergedConfig.output.types || (0, _stryke_path_join.joinPaths)(mergedConfig.root, `${mergedConfig.framework?.name ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
837
+ if (mergedConfig.output.copy && mergedConfig.output.copy.path && mergedConfig.output.copy.assets && Array.isArray(mergedConfig.output.copy.assets)) mergedConfig.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(mergedConfig.output.copy.assets.map((asset) => {
838
+ return {
839
+ glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
840
+ input: (0, _stryke_type_checks_is_string.isString)(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? mergedConfig.cwd : (0, _stryke_path_is_parent_path.isParentPath)(asset.input, mergedConfig.cwd) || (0, _stryke_path_is_equal.isEqual)(asset.input, mergedConfig.cwd) ? asset.input : (0, _stryke_path_append.appendPath)(asset.input, mergedConfig.cwd),
841
+ output: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.output ? (0, _stryke_path_is_parent_path.isParentPath)(asset.output, mergedConfig.cwd) ? asset.output : (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(mergedConfig.output.copy.path, (0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(asset.output, (0, _stryke_path_replace.replacePath)(mergedConfig.output.copy.path, mergedConfig.cwd)), mergedConfig.output.copy.path)), mergedConfig.cwd) : (0, _stryke_path_append.appendPath)(mergedConfig.output.copy.path, mergedConfig.cwd),
842
+ ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
843
+ };
844
+ }), (a) => `${a.input}-${a.glob}-${a.output}`);
845
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
846
+ else mergedConfig.output.sourceMap = false;
847
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
848
+ else mergedConfig.output.minify = false;
849
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework?.name ?? "powerlines"}`;
850
+ if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
851
+ ...asset,
852
+ glob: require_plugin_utils_paths.replacePathTokens(this, asset.glob),
853
+ ignore: asset.ignore ? asset.ignore.map((ignore) => require_plugin_utils_paths.replacePathTokens(this, ignore)) : void 0,
854
+ input: require_plugin_utils_paths.replacePathTokens(this, asset.input),
855
+ output: require_plugin_utils_paths.replacePathTokens(this, asset.output)
856
+ }));
857
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output?.storage) && mergedConfig.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(mergedConfig.output?.storage) && Object.values(mergedConfig.output.storage).every((adapter) => adapter.preset === "virtual")) mergedConfig.output.overwrite = true;
858
+ this.resolvedConfig = mergedConfig;
859
+ this.#configProxy = this.createConfigProxy();
860
+ this.resolver = require_lib_resolver.createResolver({
861
+ cwd: this.resolvedConfig.cwd,
862
+ root: this.resolvedConfig.root,
863
+ cacheDir: this.envPaths.cache,
864
+ mode: this.resolvedConfig.mode
865
+ });
866
+ this.logger.info({
867
+ meta: { category: "config" },
868
+ message: `Resolved Powerlines configuration object: \n${require_plugin_utils_format.formatConfig(this.resolvedConfig)}`
869
+ });
870
+ this.#fs ??= await require_lib_vfs.VirtualFileSystem.create(this);
871
+ }
872
+ createConfigProxy() {
873
+ return new Proxy(this.resolvedConfig, {
874
+ /**
875
+ * A trap for the `delete` operator.
876
+ * @param target - The original object which is being proxied.
877
+ * @param key - The name or `Symbol` of the property to delete.
878
+ * @returns A `boolean` indicating whether or not the property was deleted.
879
+ */
880
+ deleteProperty: (target, key) => {
881
+ if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) throw new Error(`Cannot delete property ${key.toString()} from config - it is only intended to be used as a reference.`);
882
+ Reflect.deleteProperty(this.overriddenConfig, key);
883
+ return Reflect.deleteProperty(target, key);
884
+ },
885
+ /**
886
+ * A trap for getting a property value.
887
+ * @param target - The original object which is being proxied.
888
+ * @param key - The name or `Symbol` of the property to get.
889
+ * @param receiver - The proxy or an object that inherits from the proxy.
890
+ */
891
+ get: (target, key, receiver) => {
892
+ if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {
893
+ if (key === "cwd") return this.cwd;
894
+ if (key === "userConfig") return this.userConfig;
895
+ if (key === "inlineConfig") return this.inlineConfig;
896
+ if (key === "pluginConfig") return this.pluginConfig;
897
+ if (key === "environmentConfig") return this.environmentConfig;
898
+ }
899
+ return Reflect.get(target, key, receiver);
900
+ },
901
+ /**
902
+ * A trap for the `in` operator.
903
+ * @param target - The original object which is being proxied.
904
+ * @param key - The name or `Symbol` of the property to check for existence.
905
+ */
906
+ has: (target, key) => {
907
+ return Reflect.has(target, key) || UNRESOLVED_CONFIG_NAMES.includes(key.toString());
908
+ },
909
+ /**
910
+ * A trap for `Reflect.ownKeys()`.
911
+ * @param target - The original object which is being proxied.
912
+ */
913
+ ownKeys: (target) => {
914
+ return (0, _stryke_helpers_get_unique.getUnique)([...Reflect.ownKeys(target), ...UNRESOLVED_CONFIG_NAMES]);
915
+ },
916
+ /**
917
+ * A trap for setting a property value.
918
+ * @param target - The original object which is being proxied.
919
+ * @param key - The name or `Symbol` of the property to set.
920
+ * @param newValue - The new value to assign to the property.
921
+ * @param receiver - The object to which the assignment was originally directed.
922
+ * @returns A `boolean` indicating whether or not the property was set.
923
+ */
924
+ set: (target, key, newValue, receiver) => {
925
+ if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) throw new Error(`Cannot change property ${key.toString()} from config - it is only intended to be used as a reference.`);
926
+ Reflect.set(this.overriddenConfig, key, newValue, receiver);
927
+ return Reflect.set(target, key, newValue, receiver);
928
+ }
929
+ });
930
+ }
931
+ };
932
+
933
+ //#endregion
934
+ exports.PowerlinesContext = PowerlinesContext;