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