@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,77 @@
1
+ import { ParsedTypeScriptConfig, TSConfig } from "../../types/tsconfig.mjs";
2
+ import { EnvironmentContext } from "../../types/context.mjs";
3
+ import { ResolvedConfig } from "../../types/config.mjs";
4
+ import ts from "typescript";
5
+ import { FilterPattern } from "@stryke/types/file";
6
+
7
+ //#region src/lib/typescript/tsconfig.d.ts
8
+ declare function getTsconfigDtsPath<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TSystemContext = unknown>(context: EnvironmentContext<TResolvedConfig, TSystemContext>): string;
9
+ declare function initializeTsconfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TSystemContext = unknown, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext>>(context: TContext): Promise<void>;
10
+ declare function resolveTsconfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TSystemContext = unknown, TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> = EnvironmentContext<TResolvedConfig, TSystemContext>>(context: TContext): Promise<void>;
11
+ /**
12
+ * Get the path to the tsconfig.json file.
13
+ *
14
+ * @param cwd - The root directory of the workspace.
15
+ * @param root - The root directory of the project.
16
+ * @param tsconfig - The path to the tsconfig.json file.
17
+ * @returns The absolute path to the tsconfig.json file.
18
+ * @throws If the tsconfig.json file does not exist.
19
+ */
20
+ declare function getTsconfigFilePath(cwd: string, root: string, tsconfig?: string): string;
21
+ /**
22
+ * Get the path to the tsconfig.json file.
23
+ *
24
+ * @param cwd - The root directory of the workspace.
25
+ * @param root - The root directory of the project.
26
+ * @param tsconfig - The path to the tsconfig.json file.
27
+ * @returns The absolute path to the tsconfig.json file.
28
+ * @throws If the tsconfig.json file does not exist.
29
+ */
30
+ declare function tryTsconfigFilePath(cwd: string, root: string, tsconfig: string): string | undefined;
31
+ /**
32
+ * Check if the TypeScript configuration type matches any of the provided types.
33
+ *
34
+ * @param tsconfigType - The type from the TypeScript configuration.
35
+ * @param types - An array of type names to check against.
36
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
37
+ */
38
+ declare function findMatch(tsconfigType: string | RegExp | null, types: (string | RegExp | null)[], extensions?: string[]): string | RegExp | null | undefined;
39
+ /**
40
+ * Check if the TypeScript configuration type matches any of the provided types.
41
+ *
42
+ * @param tsconfigType - The type from the TypeScript configuration.
43
+ * @param types - An array of type names to check against.
44
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
45
+ */
46
+ declare function findIncludeMatch(tsconfigType: string | RegExp | null, types: (string | RegExp | null)[]): string | RegExp | null | undefined;
47
+ /**
48
+ * Check if the TypeScript configuration type matches any of the provided types.
49
+ *
50
+ * @param tsconfigType - The type from the TypeScript configuration.
51
+ * @param types - An array of type names to check against.
52
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
53
+ */
54
+ declare function isMatchFound(tsconfigType: string | RegExp | null, types: (string | RegExp | null)[]): boolean;
55
+ /**
56
+ * Check if the TypeScript configuration type matches any of the provided types.
57
+ *
58
+ * @param tsconfigType - The type from the TypeScript configuration.
59
+ * @param types - An array of type names to check against.
60
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
61
+ */
62
+ declare function isIncludeMatchFound(tsconfigType: FilterPattern, types: FilterPattern[]): boolean;
63
+ /**
64
+ * Get the parsed TypeScript configuration.
65
+ *
66
+ * @param workspaceRoot - The root directory of the workspace.
67
+ * @param projectRoot - The root directory of the project.
68
+ * @param tsconfig - The path to the tsconfig.json file.
69
+ * @param tsconfigRaw - The raw tsconfig.json content.
70
+ * @param originalTsconfigJson - The original tsconfig.json content.
71
+ * @param host - The TypeScript parse config host.
72
+ * @returns The resolved TypeScript configuration.
73
+ */
74
+ declare function getParsedTypeScriptConfig(workspaceRoot: string, projectRoot: string, tsconfig?: string, tsconfigRaw?: TSConfig, originalTsconfigJson?: TSConfig, host?: ts.ParseConfigHost): ParsedTypeScriptConfig;
75
+ //#endregion
76
+ export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigDtsPath, getTsconfigFilePath, initializeTsconfig, isIncludeMatchFound, isMatchFound, resolveTsconfig, tryTsconfigFilePath };
77
+ //# sourceMappingURL=tsconfig.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.d.mts","names":[],"sources":["../../../src/lib/typescript/tsconfig.ts"],"mappings":";;;;;;;iBAyCgB,kBAAA,yBACU,cAAA,GAAiB,cAAA,2BAAA,CAEzC,OAAA,EAAS,kBAAA,CAAmB,eAAA,EAAiB,cAAA;AAAA,iBAiJzB,kBAAA,yBACI,cAAA,GAAiB,cAAA,6CAExB,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACnD,kBAAA,CAAmB,eAAA,EAAiB,cAAA,EAAA,CACtC,OAAA,EAAS,QAAA,GAAW,OAAA;AAAA,iBA2CA,eAAA,yBACI,cAAA,GAAiB,cAAA,6CAExB,kBAAA,CAAmB,eAAA,EAAiB,cAAA,IACnD,kBAAA,CAAmB,eAAA,EAAiB,cAAA,EAAA,CACtC,OAAA,EAAS,QAAA,GAAW,OAAA;;;;;;;;;;iBA+GN,mBAAA,CACd,GAAA,UACA,IAAA,UACA,QAAA;;;;;;;;;AAxT4D;iBA2V9C,mBAAA,CACd,GAAA,UACA,IAAA,UACA,QAAA;;;;;;;;iBAuBc,SAAA,CACd,YAAA,WAAuB,MAAA,SACvB,KAAA,YAAiB,MAAA,YACjB,UAAA,uBACU,MAAA;;;;;;;;iBAkCI,gBAAA,CACd,YAAA,WAAuB,MAAA,SACvB,KAAA,YAAiB,MAAA,sBACP,MAAA;;;;;;;;iBAuCI,YAAA,CACd,YAAA,WAAuB,MAAA,SACvB,KAAA,YAAiB,MAAM;;;;;;AAjTI;AA2C7B;iBAkRgB,mBAAA,CACd,YAAA,EAAc,aAAA,EACd,KAAA,EAAO,aAAa;;;;;;;;;;;;iBAqBN,yBAAA,CACd,aAAA,UACA,WAAA,UACA,QAAA,WACA,WAAA,GAAa,QAAA,EACb,oBAAA,GAAuB,QAAA,EACvB,IAAA,GAAM,EAAA,CAAG,eAAA,GACR,sBAAA"}
@@ -0,0 +1,240 @@
1
+ import { existsSync } from "@stryke/fs/exists";
2
+ import { readJsonFile, readJsonFileSync } from "@stryke/fs/json";
3
+ import { appendPath } from "@stryke/path/append";
4
+ import { findFileName, findFilePath, relativePath } from "@stryke/path/file-path-fns";
5
+ import { joinPaths } from "@stryke/path/join-paths";
6
+ import defu from "defu";
7
+ import { titleCase } from "@stryke/string-format/title-case";
8
+ import chalk from "chalk";
9
+ import { isPackageExists } from "@stryke/fs/package-fns";
10
+ import { getObjectDiff } from "@donedeal0/superdiff";
11
+ import { StormJSON } from "@stryke/json/storm-json";
12
+ import ts from "typescript";
13
+
14
+ //#region src/lib/typescript/tsconfig.ts
15
+ function getTsconfigDtsPath(context) {
16
+ return joinPaths(relativePath(joinPaths(context.config.cwd, context.config.root), findFilePath(context.typesPath)), findFileName(context.typesPath));
17
+ }
18
+ async function resolveTsconfigChanges(context) {
19
+ const tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig, context.config.tsconfigRaw);
20
+ const tsconfigJson = await readJsonFile(getTsconfigFilePath(context.config.cwd, context.config.root, context.config.tsconfig));
21
+ tsconfigJson.compilerOptions ??= {};
22
+ if (context.config.output.dts !== false) {
23
+ const dtsRelativePath = getTsconfigDtsPath(context);
24
+ if (!tsconfigJson.include?.some((filePattern) => isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath]))) {
25
+ tsconfigJson.include ??= [];
26
+ tsconfigJson.include.push(dtsRelativePath.startsWith("./") ? dtsRelativePath.slice(2) : dtsRelativePath);
27
+ }
28
+ }
29
+ if (!tsconfig.options.lib?.some((lib) => [
30
+ "lib.esnext.d.ts",
31
+ "lib.es2021.d.ts",
32
+ "lib.es2022.d.ts",
33
+ "lib.es2023.d.ts"
34
+ ].includes(lib.toLowerCase()))) {
35
+ tsconfigJson.compilerOptions.lib ??= [];
36
+ tsconfigJson.compilerOptions.lib.push("esnext");
37
+ }
38
+ if (tsconfig.options.esModuleInterop !== true) tsconfigJson.compilerOptions.esModuleInterop = true;
39
+ if (tsconfig.options.isolatedModules !== true) tsconfigJson.compilerOptions.isolatedModules = true;
40
+ if (context.config.platform === "node") {
41
+ if (!tsconfig.options.types?.some((type) => type.toLowerCase() === "node" || type.toLowerCase() === "@types/node")) {
42
+ tsconfigJson.compilerOptions.types ??= [];
43
+ tsconfigJson.compilerOptions.types.push("node");
44
+ }
45
+ }
46
+ return tsconfigJson;
47
+ }
48
+ async function initializeTsconfig(context) {
49
+ context.debug("Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.");
50
+ if (!isPackageExists("typescript")) throw new Error("The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"");
51
+ const tsconfigFilePath = getTsconfigFilePath(context.config.cwd, context.config.root, context.config.tsconfig);
52
+ context.tsconfig.originalTsconfigJson = await readJsonFile(tsconfigFilePath);
53
+ context.tsconfig.tsconfigJson = await resolveTsconfigChanges(context);
54
+ context.debug("Writing updated TypeScript configuration (tsconfig.json) file to disk.");
55
+ await context.fs.write(tsconfigFilePath, StormJSON.stringify(context.tsconfig.tsconfigJson));
56
+ context.tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig, context.config.tsconfigRaw, context.tsconfig.originalTsconfigJson);
57
+ }
58
+ async function resolveTsconfig(context) {
59
+ const updateTsconfigJson = await readJsonFile(context.tsconfig.tsconfigFilePath);
60
+ if (updateTsconfigJson?.compilerOptions?.types && Array.isArray(updateTsconfigJson.compilerOptions.types) && !updateTsconfigJson.compilerOptions.types.length) delete updateTsconfigJson.compilerOptions.types;
61
+ const result = getObjectDiff(context.tsconfig.originalTsconfigJson, updateTsconfigJson, {
62
+ ignoreArrayOrder: true,
63
+ showOnly: {
64
+ statuses: [
65
+ "added",
66
+ "deleted",
67
+ "updated"
68
+ ],
69
+ granularity: "deep"
70
+ }
71
+ });
72
+ const changes = [];
73
+ const getChanges = (difference, property) => {
74
+ if (difference.status === "added" || difference.status === "deleted" || difference.status === "updated") if (difference.diff) for (const diff of difference.diff) getChanges(diff, property ? `${property}.${difference.property}` : difference.property);
75
+ else changes.push({
76
+ field: property ? `${property}.${difference.property}` : difference.property,
77
+ status: difference.status,
78
+ previous: difference.status === "added" ? "---" : StormJSON.stringify(difference.previousValue),
79
+ current: difference.status === "deleted" ? "---" : StormJSON.stringify(difference.currentValue)
80
+ });
81
+ };
82
+ for (const diff of result.diff) getChanges(diff);
83
+ if (changes.length > 0) context.warn(`Updating the following configuration values in "${context.tsconfig.tsconfigFilePath}" file:
84
+
85
+ ${changes.map((change, i) => `${chalk.bold.whiteBright(`${i + 1}. ${titleCase(change.status)} the ${change.field} field: `)}
86
+ ${chalk.red(` - Previous: ${change.previous} `)}
87
+ ${chalk.green(` - Updated: ${change.current} `)}
88
+ `).join("\n")}
89
+ `);
90
+ await context.fs.write(context.tsconfig.tsconfigFilePath, StormJSON.stringify(updateTsconfigJson));
91
+ context.tsconfig = getParsedTypeScriptConfig(context.config.cwd, context.config.root, context.config.tsconfig);
92
+ if (!context.tsconfig) throw new Error("Failed to parse the TypeScript configuration file.");
93
+ }
94
+ /**
95
+ * Get the path to the tsconfig.json file.
96
+ *
97
+ * @param cwd - The root directory of the workspace.
98
+ * @param root - The root directory of the project.
99
+ * @param tsconfig - The path to the tsconfig.json file.
100
+ * @returns The absolute path to the tsconfig.json file.
101
+ * @throws If the tsconfig.json file does not exist.
102
+ */
103
+ function getTsconfigFilePath(cwd, root, tsconfig) {
104
+ let tsconfigFilePath;
105
+ if (tsconfig) tsconfigFilePath = tryTsconfigFilePath(cwd, root, tsconfig);
106
+ else {
107
+ tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.app.json");
108
+ if (!tsconfigFilePath) {
109
+ tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.lib.json");
110
+ if (!tsconfigFilePath) tsconfigFilePath = tryTsconfigFilePath(cwd, root, "tsconfig.json");
111
+ }
112
+ }
113
+ if (!tsconfigFilePath) throw new Error(`Cannot find the \`tsconfig.json\` configuration file for the project at ${root}.`);
114
+ return tsconfigFilePath;
115
+ }
116
+ /**
117
+ * Get the path to the tsconfig.json file.
118
+ *
119
+ * @param cwd - The root directory of the workspace.
120
+ * @param root - The root directory of the project.
121
+ * @param tsconfig - The path to the tsconfig.json file.
122
+ * @returns The absolute path to the tsconfig.json file.
123
+ * @throws If the tsconfig.json file does not exist.
124
+ */
125
+ function tryTsconfigFilePath(cwd, root, tsconfig) {
126
+ let tsconfigFilePath = tsconfig;
127
+ if (!existsSync(tsconfigFilePath)) {
128
+ tsconfigFilePath = appendPath(tsconfig, root);
129
+ if (!existsSync(tsconfigFilePath)) {
130
+ tsconfigFilePath = appendPath(tsconfig, appendPath(root, cwd));
131
+ if (!existsSync(tsconfigFilePath)) return;
132
+ }
133
+ }
134
+ return tsconfigFilePath;
135
+ }
136
+ /**
137
+ * Check if the TypeScript configuration type matches any of the provided types.
138
+ *
139
+ * @param tsconfigType - The type from the TypeScript configuration.
140
+ * @param types - An array of type names to check against.
141
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
142
+ */
143
+ function findMatch(tsconfigType, types, extensions = [
144
+ ".ts",
145
+ ".tsx",
146
+ ".d.ts"
147
+ ]) {
148
+ return types.find((type) => tsconfigType?.toString().toLowerCase() === type?.toString().toLowerCase() || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}` || `./${tsconfigType?.toString().toLowerCase()}` === type?.toString().toLowerCase() || extensions.some((ext) => `${tsconfigType?.toString().toLowerCase()}${ext}` === type?.toString().toLowerCase() || `${tsconfigType?.toString().toLowerCase()}${ext}` === `./${type?.toString().toLowerCase()}` || `${type?.toString().toLowerCase()}${ext}` === `./${tsconfigType?.toString().toLowerCase()}` || tsconfigType?.toString().toLowerCase() === `${type?.toString().toLowerCase()}${ext}` || tsconfigType?.toString().toLowerCase() === `./${type?.toString().toLowerCase()}${ext}` || type?.toString().toLowerCase() === `./${tsconfigType?.toString().toLowerCase()}${ext}`));
149
+ }
150
+ /**
151
+ * Check if the TypeScript configuration type matches any of the provided types.
152
+ *
153
+ * @param tsconfigType - The type from the TypeScript configuration.
154
+ * @param types - An array of type names to check against.
155
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
156
+ */
157
+ function findIncludeMatch(tsconfigType, types) {
158
+ return findMatch(tsconfigType, types, [
159
+ ".ts",
160
+ ".tsx",
161
+ ".d.ts",
162
+ ".js",
163
+ ".jsx",
164
+ ".mjs",
165
+ ".cjs",
166
+ ".mts",
167
+ ".cts",
168
+ "/*.ts",
169
+ "/*.tsx",
170
+ "/*.d.ts",
171
+ "/*.js",
172
+ "/*.jsx",
173
+ "/*.mjs",
174
+ "/*.cjs",
175
+ "/*.mts",
176
+ "/*.cts",
177
+ "/**/*.ts",
178
+ "/**/*.tsx",
179
+ "/**/*.d.ts",
180
+ "/**/*.js",
181
+ "/**/*.jsx",
182
+ "/**/*.mjs",
183
+ "/**/*.cjs",
184
+ "/**/*.mts",
185
+ "/**/*.cts"
186
+ ]);
187
+ }
188
+ /**
189
+ * Check if the TypeScript configuration type matches any of the provided types.
190
+ *
191
+ * @param tsconfigType - The type from the TypeScript configuration.
192
+ * @param types - An array of type names to check against.
193
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
194
+ */
195
+ function isMatchFound(tsconfigType, types) {
196
+ return findMatch(tsconfigType, types) !== void 0;
197
+ }
198
+ /**
199
+ * Check if the TypeScript configuration type matches any of the provided types.
200
+ *
201
+ * @param tsconfigType - The type from the TypeScript configuration.
202
+ * @param types - An array of type names to check against.
203
+ * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.
204
+ */
205
+ function isIncludeMatchFound(tsconfigType, types) {
206
+ return findIncludeMatch(tsconfigType, types) !== void 0;
207
+ }
208
+ /**
209
+ * Get the parsed TypeScript configuration.
210
+ *
211
+ * @param workspaceRoot - The root directory of the workspace.
212
+ * @param projectRoot - The root directory of the project.
213
+ * @param tsconfig - The path to the tsconfig.json file.
214
+ * @param tsconfigRaw - The raw tsconfig.json content.
215
+ * @param originalTsconfigJson - The original tsconfig.json content.
216
+ * @param host - The TypeScript parse config host.
217
+ * @returns The resolved TypeScript configuration.
218
+ */
219
+ function getParsedTypeScriptConfig(workspaceRoot, projectRoot, tsconfig, tsconfigRaw = {}, originalTsconfigJson, host = ts.sys) {
220
+ const tsconfigFilePath = getTsconfigFilePath(workspaceRoot, projectRoot, tsconfig);
221
+ const tsconfigJson = readJsonFileSync(tsconfigFilePath);
222
+ if (!tsconfigJson) throw new Error(`Cannot find the \`tsconfig.json\` configuration file at ${joinPaths(projectRoot, tsconfig ?? "tsconfig.json")}`);
223
+ const parsedCommandLine = ts.parseJsonConfigFileContent(defu(tsconfigRaw ?? {}, tsconfigJson), host, appendPath(projectRoot, workspaceRoot));
224
+ if (parsedCommandLine.errors.length > 0) {
225
+ const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:
226
+ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && error.code ? `[${error.category}-${error.code}]: ` : "") + error.messageText.toString()}`).join("\n")}
227
+ `;
228
+ throw new Error(errorMessage);
229
+ }
230
+ return {
231
+ ...parsedCommandLine,
232
+ originalTsconfigJson: originalTsconfigJson ?? tsconfigJson,
233
+ tsconfigJson,
234
+ tsconfigFilePath
235
+ };
236
+ }
237
+
238
+ //#endregion
239
+ export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigDtsPath, getTsconfigFilePath, initializeTsconfig, isIncludeMatchFound, isMatchFound, resolveTsconfig, tryTsconfigFilePath };
240
+ //# sourceMappingURL=tsconfig.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.mjs","names":[],"sources":["../../../src/lib/typescript/tsconfig.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile, readJsonFileSync } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { FilterPattern } from \"@stryke/types/file\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport defu from \"defu\";\nimport ts from \"typescript\";\nimport { ResolvedConfig } from \"../../types/config\";\nimport { EnvironmentContext } from \"../../types/context\";\nimport type { ParsedTypeScriptConfig, TSConfig } from \"../../types/tsconfig\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(context: EnvironmentContext<TResolvedConfig, TSystemContext>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(context.config.cwd, context.config.root),\n findFilePath(context.typesPath)\n ),\n findFileName(context.typesPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n context: EnvironmentContext<TResolvedConfig, TSystemContext>\n): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> =\n EnvironmentContext<TResolvedConfig, TSystemContext>\n>(context: TContext): Promise<void> {\n context.debug(\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson = await resolveTsconfigChanges<\n TResolvedConfig,\n TSystemContext\n >(context);\n\n context.debug(\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends EnvironmentContext<TResolvedConfig, TSystemContext> =\n EnvironmentContext<TResolvedConfig, TSystemContext>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.warn(\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.config.cwd,\n context.config.root,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function getTsconfigFilePath(\n cwd: string,\n root: string,\n tsconfig?: string\n): string {\n let tsconfigFilePath: string | undefined;\n if (tsconfig) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, tsconfig);\n } else {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.app.json\");\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.lib.json\");\n if (!tsconfigFilePath) {\n tsconfigFilePath = tryTsconfigFilePath(cwd, root, \"tsconfig.json\");\n }\n }\n }\n\n if (!tsconfigFilePath) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file for the project at ${\n root\n }.`\n );\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Get the path to the tsconfig.json file.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @returns The absolute path to the tsconfig.json file.\n * @throws If the tsconfig.json file does not exist.\n */\nexport function tryTsconfigFilePath(\n cwd: string,\n root: string,\n tsconfig: string\n): string | undefined {\n let tsconfigFilePath = tsconfig;\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(tsconfig, root);\n if (!existsSync(tsconfigFilePath)) {\n tsconfigFilePath = appendPath(tsconfig, appendPath(root, cwd));\n if (!existsSync(tsconfigFilePath)) {\n return undefined;\n }\n }\n }\n\n return tsconfigFilePath;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[],\n extensions: string[] = [\".ts\", \".tsx\", \".d.ts\"]\n): string | RegExp | null | undefined {\n return types.find(\n type =>\n tsconfigType?.toString().toLowerCase() ===\n type?.toString().toLowerCase() ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}` ||\n `./${tsconfigType?.toString().toLowerCase()}` ===\n type?.toString().toLowerCase() ||\n extensions.some(\n ext =>\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n type?.toString().toLowerCase() ||\n `${tsconfigType?.toString().toLowerCase()}${ext}` ===\n `./${type?.toString().toLowerCase()}` ||\n `${type?.toString().toLowerCase()}${ext}` ===\n `./${tsconfigType?.toString().toLowerCase()}` ||\n tsconfigType?.toString().toLowerCase() ===\n `${type?.toString().toLowerCase()}${ext}` ||\n tsconfigType?.toString().toLowerCase() ===\n `./${type?.toString().toLowerCase()}${ext}` ||\n type?.toString().toLowerCase() ===\n `./${tsconfigType?.toString().toLowerCase()}${ext}`\n )\n );\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function findIncludeMatch(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): string | RegExp | null | undefined {\n return findMatch(tsconfigType, types, [\n \".ts\",\n \".tsx\",\n \".d.ts\",\n \".js\",\n \".jsx\",\n \".mjs\",\n \".cjs\",\n \".mts\",\n \".cts\",\n \"/*.ts\",\n \"/*.tsx\",\n \"/*.d.ts\",\n \"/*.js\",\n \"/*.jsx\",\n \"/*.mjs\",\n \"/*.cjs\",\n \"/*.mts\",\n \"/*.cts\",\n \"/**/*.ts\",\n \"/**/*.tsx\",\n \"/**/*.d.ts\",\n \"/**/*.js\",\n \"/**/*.jsx\",\n \"/**/*.mjs\",\n \"/**/*.cjs\",\n \"/**/*.mts\",\n \"/**/*.cts\"\n ]);\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isMatchFound(\n tsconfigType: string | RegExp | null,\n types: (string | RegExp | null)[]\n): boolean {\n return findMatch(tsconfigType, types) !== undefined;\n}\n\n/**\n * Check if the TypeScript configuration type matches any of the provided types.\n *\n * @param tsconfigType - The type from the TypeScript configuration.\n * @param types - An array of type names to check against.\n * @returns True if the TypeScript configuration type matches any of the provided types, false otherwise.\n */\nexport function isIncludeMatchFound(\n tsconfigType: FilterPattern,\n types: FilterPattern[]\n): boolean {\n return (\n findIncludeMatch(\n tsconfigType as string | RegExp | null,\n types as (string | RegExp | null)[]\n ) !== undefined\n );\n}\n\n/**\n * Get the parsed TypeScript configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param projectRoot - The root directory of the project.\n * @param tsconfig - The path to the tsconfig.json file.\n * @param tsconfigRaw - The raw tsconfig.json content.\n * @param originalTsconfigJson - The original tsconfig.json content.\n * @param host - The TypeScript parse config host.\n * @returns The resolved TypeScript configuration.\n */\nexport function getParsedTypeScriptConfig(\n workspaceRoot: string,\n projectRoot: string,\n tsconfig?: string,\n tsconfigRaw: TSConfig = {},\n originalTsconfigJson?: TSConfig,\n host: ts.ParseConfigHost = ts.sys\n): ParsedTypeScriptConfig {\n const tsconfigFilePath = getTsconfigFilePath(\n workspaceRoot,\n projectRoot,\n tsconfig\n );\n const tsconfigJson = readJsonFileSync<TSConfig>(tsconfigFilePath);\n if (!tsconfigJson) {\n throw new Error(\n `Cannot find the \\`tsconfig.json\\` configuration file at ${joinPaths(\n projectRoot,\n tsconfig ?? \"tsconfig.json\"\n )}`\n );\n }\n\n const parsedCommandLine = ts.parseJsonConfigFileContent(\n defu(tsconfigRaw ?? {}, tsconfigJson),\n host,\n appendPath(projectRoot, workspaceRoot)\n );\n if (parsedCommandLine.errors.length > 0) {\n const errorMessage = `Cannot parse the TypeScript compiler options. Please investigate the following issues:\n${parsedCommandLine.errors\n .map(\n error =>\n `- ${\n (error.category !== undefined && error.code\n ? `[${error.category}-${error.code}]: `\n : \"\") + error.messageText.toString()\n }`\n )\n .join(\"\\n\")}\n `;\n\n throw new Error(errorMessage);\n }\n\n return {\n ...parsedCommandLine,\n originalTsconfigJson: (originalTsconfigJson ??\n tsconfigJson) as TsConfigJson,\n tsconfigJson,\n tsconfigFilePath\n };\n}\n"],"mappings":"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"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
2
  const require_constants_plugin = require('../../constants/plugin.cjs');
4
3
  let defu = require("defu");
5
4
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":";;;;;;;AAgCA;;;;;iBAAgB,eAAA,mBACI,iBAAA,GAAoB,oBAAA,oBACpB,iBAAA,GAAoB,oBAAA,CAAA,CACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;;;;;iBAUzC,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAA"}
1
+ {"version":3,"file":"helpers.d.cts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":";;;;;;;AAgCA;;;;;iBAAgB,eAAA,mBACI,iBAAA,GAAoB,oBAAA,oBACpB,iBAAA,GAAoB,oBAAA,CAAA,CACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;;;;;iBAUzC,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":";;;;;;;AAgCA;;;;;iBAAgB,eAAA,mBACI,iBAAA,GAAoB,oBAAA,oBACpB,iBAAA,GAAoB,oBAAA,CAAA,CACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;;;;;iBAUzC,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../../src/lib/unplugin/helpers.ts"],"mappings":";;;;;;;AAgCA;;;;;iBAAgB,eAAA,mBACI,iBAAA,GAAoB,oBAAA,oBACpB,iBAAA,GAAoB,oBAAA,CAAA,CACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;;;;;iBAUzC,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.mjs","names":["defu"],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { UnpluginBuildContext } from \"unplugin\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"../../constants/plugin\";\nimport type { UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginBuilderVariant } from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,gBAGd,UAAqB,UAA4C;AACjE,QAAOA,OAAK,UAAU,SAAS;;;;;;;;AASjC,SAAgB,yBACd,KAC+B;AAC/B,QACE,YAAY,IAAI,IAChB,0BAA0B,SAAS,IAA8B"}
1
+ {"version":3,"file":"helpers.mjs","names":["defu"],"sources":["../../../src/lib/unplugin/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { UnpluginBuildContext } from \"unplugin\";\nimport { UNPLUGIN_BUILDER_VARIANTS } from \"../../constants/plugin\";\nimport type { UnresolvedContext } from \"../../types/context\";\nimport type { UnpluginBuilderVariant } from \"../../types/unplugin\";\n\n/**\n * Merges a base plugin context with an unplugin context, combining their properties.\n *\n * @param contextA - The base plugin context to merge into.\n * @param contextB - The unplugin context to merge from.\n * @returns The merged context.\n */\nexport function combineContexts<\n TContextA extends UnresolvedContext | UnpluginBuildContext,\n TContextB extends UnresolvedContext | UnpluginBuildContext\n>(contextA: TContextA, contextB: TContextB): TContextA & TContextB {\n return defu(contextA, contextB) as TContextA & TContextB;\n}\n\n/**\n * Checks if a value is a valid UnpluginBuilderVariant.\n *\n * @param str - The value to check.\n * @returns True if the value is a UnpluginBuilderVariant, false otherwise.\n */\nexport function isUnpluginBuilderVariant(\n str: unknown\n): str is UnpluginBuilderVariant {\n return (\n isSetString(str) &&\n UNPLUGIN_BUILDER_VARIANTS.includes(str as UnpluginBuilderVariant)\n );\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,SAAgB,gBAGd,UAAqB,UAA4C;CACjE,OAAOA,OAAK,UAAU,QAAQ;AAChC;;;;;;;AAQA,SAAgB,yBACd,KAC+B;CAC/B,OACE,YAAY,GAAG,KACf,0BAA0B,SAAS,GAA6B;AAEpE"}
@@ -1,4 +1,4 @@
1
1
  import { combineContexts, isUnpluginBuilderVariant } from "./helpers.cjs";
2
- import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.cjs";
3
- import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.cjs";
4
- export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
2
+ import { CreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.cjs";
3
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.cjs";
4
+ export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
@@ -1,4 +1,4 @@
1
1
  import { combineContexts, isUnpluginBuilderVariant } from "./helpers.mjs";
2
- import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
- import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.mjs";
4
- export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
2
+ import { CreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.mjs";
4
+ export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
@@ -22,12 +22,11 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
22
22
  * @returns The module resolution hooks (`resolveId` and `load`).
23
23
  */
24
24
  function createUnpluginModuleResolutionFunctions(context, options = {}) {
25
- const ctx = context;
26
25
  return {
27
26
  async resolveId(id, importer, opts = { isEntry: false }) {
28
27
  const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
29
28
  const normalizedImporter = importer ? require_plugin_utils_virtual.removeVirtualPrefix(importer) : void 0;
30
- let result = await ctx.api.callHook("resolveId", {
29
+ let result = await context.callHook("resolveId", {
31
30
  sequential: true,
32
31
  result: "first",
33
32
  order: "pre"
@@ -37,7 +36,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
37
36
  ...result,
38
37
  id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
39
38
  };
40
- result = await ctx.api.callHook("resolveId", {
39
+ result = await context.callHook("resolveId", {
41
40
  sequential: true,
42
41
  result: "first",
43
42
  order: "normal"
@@ -47,7 +46,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
47
46
  ...result,
48
47
  id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
49
48
  };
50
- result = await ctx.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
49
+ result = await context.resolve(normalizedId, normalizedImporter, (0, defu.default)(options.overrides ?? {}, {
51
50
  isFile: true,
52
51
  ...opts
53
52
  }));
@@ -55,7 +54,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
55
54
  ...result,
56
55
  id: result.virtual && options.prefix !== false ? require_plugin_utils_virtual.addVirtualPrefix(result.id) : result.id
57
56
  };
58
- result = await ctx.api.callHook("resolveId", {
57
+ result = await context.callHook("resolveId", {
59
58
  sequential: true,
60
59
  result: "first",
61
60
  order: "post"
@@ -71,21 +70,21 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
71
70
  filter: options.prefix !== false ? { id: require_plugin_utils_virtual.VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
72
71
  async handler(id) {
73
72
  const normalizedId = require_plugin_utils_virtual.removeVirtualPrefix(id);
74
- let result = await ctx.api.callHook("load", {
73
+ let result = await context.callHook("load", {
75
74
  sequential: true,
76
75
  result: "first",
77
76
  order: "pre"
78
77
  }, normalizedId);
79
78
  if (result) return result;
80
- result = await ctx.api.callHook("load", {
79
+ result = await context.callHook("load", {
81
80
  sequential: true,
82
81
  result: "first",
83
82
  order: "normal"
84
83
  }, normalizedId);
85
84
  if (result) return result;
86
- result = await ctx.load(normalizedId);
85
+ result = await context.load(normalizedId);
87
86
  if (result) return result;
88
- return ctx.api.callHook("load", {
87
+ return context.callHook("load", {
89
88
  sequential: true,
90
89
  result: "first",
91
90
  order: "post"
@@ -1,5 +1,5 @@
1
1
  import { ResolveOptions } from "../../types/fs.cjs";
2
- import { PluginContext } from "../../types/context.cjs";
2
+ import { UnresolvedContext } from "../../types/context.cjs";
3
3
  import { UnpluginOptions } from "unplugin";
4
4
 
5
5
  //#region src/lib/unplugin/module-resolution.d.ts
@@ -35,8 +35,7 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
35
35
  * @param options - Options for creating the module resolution functions.
36
36
  * @returns The module resolution hooks (`resolveId` and `load`).
37
37
  */
38
- declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
39
- declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
38
+ declare function createUnpluginModuleResolutionFunctions<TContext extends UnresolvedContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
40
39
  //#endregion
41
- export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
40
+ export { CreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
42
41
  //# sourceMappingURL=module-resolution.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAoCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
1
+ {"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAO,CAAC,cAAA;AAAA;;;;;;;;;;;;;AAqBC;iBALP,uCAAA,kBACG,iBAAA,CAAA,CAEjB,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ResolveOptions } from "../../types/fs.mjs";
2
- import { PluginContext } from "../../types/context.mjs";
2
+ import { UnresolvedContext } from "../../types/context.mjs";
3
3
  import { UnpluginOptions } from "unplugin";
4
4
 
5
5
  //#region src/lib/unplugin/module-resolution.d.ts
@@ -35,8 +35,7 @@ interface CreateUnpluginModuleResolutionFunctionsOptions {
35
35
  * @param options - Options for creating the module resolution functions.
36
36
  * @returns The module resolution hooks (`resolveId` and `load`).
37
37
  */
38
- declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
39
- declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
38
+ declare function createUnpluginModuleResolutionFunctions<TContext extends UnresolvedContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<UnpluginOptions, "resolveId" | "load">;
40
39
  //#endregion
41
- export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
40
+ export { CreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
42
41
  //# sourceMappingURL=module-resolution.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAoCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;;;;;;iBAgBN,uCAAA,kBACG,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA;AAAA"}
1
+ {"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"mappings":";;;;;UAmCiB,8CAAA;;AAAjB;;;;;;;;EAUE,MAAA;EAQkC;AAgBpC;;;;;EAhBE,SAAA,GAAY,OAAO,CAAC,cAAA;AAAA;;;;;;;;;;;;;AAqBC;iBALP,uCAAA,kBACG,iBAAA,CAAA,CAEjB,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,8CAAA,GACR,IAAA,CAAK,eAAA"}
@@ -19,12 +19,11 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
19
19
  * @returns The module resolution hooks (`resolveId` and `load`).
20
20
  */
21
21
  function createUnpluginModuleResolutionFunctions(context, options = {}) {
22
- const ctx = context;
23
22
  return {
24
23
  async resolveId(id, importer, opts = { isEntry: false }) {
25
24
  const normalizedId = removeVirtualPrefix(id);
26
25
  const normalizedImporter = importer ? removeVirtualPrefix(importer) : void 0;
27
- let result = await ctx.api.callHook("resolveId", {
26
+ let result = await context.callHook("resolveId", {
28
27
  sequential: true,
29
28
  result: "first",
30
29
  order: "pre"
@@ -34,7 +33,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
34
33
  ...result,
35
34
  id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
36
35
  };
37
- result = await ctx.api.callHook("resolveId", {
36
+ result = await context.callHook("resolveId", {
38
37
  sequential: true,
39
38
  result: "first",
40
39
  order: "normal"
@@ -44,7 +43,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
44
43
  ...result,
45
44
  id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
46
45
  };
47
- result = await ctx.resolve(normalizedId, normalizedImporter, defu(options.overrides ?? {}, {
46
+ result = await context.resolve(normalizedId, normalizedImporter, defu(options.overrides ?? {}, {
48
47
  isFile: true,
49
48
  ...opts
50
49
  }));
@@ -52,7 +51,7 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
52
51
  ...result,
53
52
  id: result.virtual && options.prefix !== false ? addVirtualPrefix(result.id) : result.id
54
53
  };
55
- result = await ctx.api.callHook("resolveId", {
54
+ result = await context.callHook("resolveId", {
56
55
  sequential: true,
57
56
  result: "first",
58
57
  order: "post"
@@ -68,21 +67,21 @@ function createUnpluginModuleResolutionFunctions(context, options = {}) {
68
67
  filter: options.prefix !== false ? { id: VIRTUAL_MODULE_PREFIX_REGEX } : void 0,
69
68
  async handler(id) {
70
69
  const normalizedId = removeVirtualPrefix(id);
71
- let result = await ctx.api.callHook("load", {
70
+ let result = await context.callHook("load", {
72
71
  sequential: true,
73
72
  result: "first",
74
73
  order: "pre"
75
74
  }, normalizedId);
76
75
  if (result) return result;
77
- result = await ctx.api.callHook("load", {
76
+ result = await context.callHook("load", {
78
77
  sequential: true,
79
78
  result: "first",
80
79
  order: "normal"
81
80
  }, normalizedId);
82
81
  if (result) return result;
83
- result = await ctx.load(normalizedId);
82
+ result = await context.load(normalizedId);
84
83
  if (result) return result;
85
- return ctx.api.callHook("load", {
84
+ return context.callHook("load", {
86
85
  sequential: true,
87
86
  result: "first",
88
87
  order: "post"