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