@powerlines/core 0.48.26 → 0.48.28

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 (508) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +14 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +26 -0
  3. package/dist/constants/api.test.cjs +42 -0
  4. package/dist/constants/api.test.d.cts +1 -0
  5. package/dist/constants/api.test.d.mts +2 -0
  6. package/dist/constants/api.test.mjs +44 -0
  7. package/dist/constants/api.test.mjs.map +1 -0
  8. package/dist/constants/commands.test.cjs +29 -0
  9. package/dist/constants/commands.test.d.cts +1 -0
  10. package/dist/constants/commands.test.d.mts +2 -0
  11. package/dist/constants/commands.test.mjs +31 -0
  12. package/dist/constants/commands.test.mjs.map +1 -0
  13. package/dist/constants/devtools.test.cjs +46 -0
  14. package/dist/constants/devtools.test.d.cts +1 -0
  15. package/dist/constants/devtools.test.d.mts +2 -0
  16. package/dist/constants/devtools.test.mjs +48 -0
  17. package/dist/constants/devtools.test.mjs.map +1 -0
  18. package/dist/constants/environments.test.cjs +34 -0
  19. package/dist/constants/environments.test.d.cts +1 -0
  20. package/dist/constants/environments.test.d.mts +2 -0
  21. package/dist/constants/environments.test.mjs +36 -0
  22. package/dist/constants/environments.test.mjs.map +1 -0
  23. package/dist/constants/extensions.test.cjs +35 -0
  24. package/dist/constants/extensions.test.d.cts +1 -0
  25. package/dist/constants/extensions.test.d.mts +2 -0
  26. package/dist/constants/extensions.test.mjs +37 -0
  27. package/dist/constants/extensions.test.mjs.map +1 -0
  28. package/dist/constants/fs.test.cjs +34 -0
  29. package/dist/constants/fs.test.d.cts +1 -0
  30. package/dist/constants/fs.test.d.mts +2 -0
  31. package/dist/constants/fs.test.mjs +36 -0
  32. package/dist/constants/fs.test.mjs.map +1 -0
  33. package/dist/constants/hooks.test.cjs +29 -0
  34. package/dist/constants/hooks.test.d.cts +1 -0
  35. package/dist/constants/hooks.test.d.mts +2 -0
  36. package/dist/constants/hooks.test.mjs +31 -0
  37. package/dist/constants/hooks.test.mjs.map +1 -0
  38. package/dist/constants/log-level.test.cjs +76 -0
  39. package/dist/constants/log-level.test.d.cts +1 -0
  40. package/dist/constants/log-level.test.d.mts +2 -0
  41. package/dist/constants/log-level.test.mjs +78 -0
  42. package/dist/constants/log-level.test.mjs.map +1 -0
  43. package/dist/constants/meta.test.cjs +33 -0
  44. package/dist/constants/meta.test.d.cts +1 -0
  45. package/dist/constants/meta.test.d.mts +2 -0
  46. package/dist/constants/meta.test.mjs +35 -0
  47. package/dist/constants/meta.test.mjs.map +1 -0
  48. package/dist/constants/plugin.test.cjs +59 -0
  49. package/dist/constants/plugin.test.d.cts +1 -0
  50. package/dist/constants/plugin.test.d.mts +2 -0
  51. package/dist/constants/plugin.test.mjs +61 -0
  52. package/dist/constants/plugin.test.mjs.map +1 -0
  53. package/dist/context/base-context.cjs +8 -1
  54. package/dist/context/base-context.d.cts.map +1 -1
  55. package/dist/context/base-context.d.mts.map +1 -1
  56. package/dist/context/base-context.mjs +3 -1
  57. package/dist/context/base-context.mjs.map +1 -1
  58. package/dist/context/base-context.test.cjs +23 -0
  59. package/dist/context/base-context.test.d.cts +1 -0
  60. package/dist/context/base-context.test.d.mts +2 -0
  61. package/dist/context/base-context.test.mjs +25 -0
  62. package/dist/context/base-context.test.mjs.map +1 -0
  63. package/dist/context/context.cjs +8 -1
  64. package/dist/context/context.d.cts.map +1 -1
  65. package/dist/context/context.d.mts.map +1 -1
  66. package/dist/context/context.mjs +3 -1
  67. package/dist/context/context.mjs.map +1 -1
  68. package/dist/context/context.test.cjs +23 -0
  69. package/dist/context/context.test.d.cts +1 -0
  70. package/dist/context/context.test.d.mts +2 -0
  71. package/dist/context/context.test.mjs +25 -0
  72. package/dist/context/context.test.mjs.map +1 -0
  73. package/dist/context/environment-context.cjs +9 -1
  74. package/dist/context/environment-context.d.cts.map +1 -1
  75. package/dist/context/environment-context.d.mts.map +1 -1
  76. package/dist/context/environment-context.mjs +3 -1
  77. package/dist/context/environment-context.mjs.map +1 -1
  78. package/dist/context/environment-context.test.cjs +23 -0
  79. package/dist/context/environment-context.test.d.cts +1 -0
  80. package/dist/context/environment-context.test.d.mts +2 -0
  81. package/dist/context/environment-context.test.mjs +25 -0
  82. package/dist/context/environment-context.test.mjs.map +1 -0
  83. package/dist/context/execution-context.cjs +8 -1
  84. package/dist/context/execution-context.d.cts.map +1 -1
  85. package/dist/context/execution-context.d.mts.map +1 -1
  86. package/dist/context/execution-context.mjs +3 -1
  87. package/dist/context/execution-context.mjs.map +1 -1
  88. package/dist/context/execution-context.test.cjs +23 -0
  89. package/dist/context/execution-context.test.d.cts +1 -0
  90. package/dist/context/execution-context.test.d.mts +2 -0
  91. package/dist/context/execution-context.test.mjs +25 -0
  92. package/dist/context/execution-context.test.mjs.map +1 -0
  93. package/dist/context/plugin-context.cjs +9 -1
  94. package/dist/context/plugin-context.d.cts.map +1 -1
  95. package/dist/context/plugin-context.d.mts.map +1 -1
  96. package/dist/context/plugin-context.mjs +3 -1
  97. package/dist/context/plugin-context.mjs.map +1 -1
  98. package/dist/context/plugin-context.test.cjs +23 -0
  99. package/dist/context/plugin-context.test.d.cts +1 -0
  100. package/dist/context/plugin-context.test.d.mts +2 -0
  101. package/dist/context/plugin-context.test.mjs +25 -0
  102. package/dist/context/plugin-context.test.mjs.map +1 -0
  103. package/dist/lib/config.cjs +18 -0
  104. package/dist/lib/config.mjs +14 -1
  105. package/dist/lib/config.mjs.map +1 -1
  106. package/dist/lib/config.test.cjs +23 -0
  107. package/dist/lib/config.test.d.cts +1 -0
  108. package/dist/lib/config.test.d.mts +2 -0
  109. package/dist/lib/config.test.mjs +25 -0
  110. package/dist/lib/config.test.mjs.map +1 -0
  111. package/dist/lib/context-helpers.cjs +11 -0
  112. package/dist/lib/context-helpers.d.cts +4 -4
  113. package/dist/lib/context-helpers.d.cts.map +1 -1
  114. package/dist/lib/context-helpers.d.mts +4 -4
  115. package/dist/lib/context-helpers.d.mts.map +1 -1
  116. package/dist/lib/context-helpers.mjs +6 -1
  117. package/dist/lib/context-helpers.mjs.map +1 -1
  118. package/dist/lib/context-helpers.test.cjs +23 -0
  119. package/dist/lib/context-helpers.test.d.cts +1 -0
  120. package/dist/lib/context-helpers.test.d.mts +2 -0
  121. package/dist/lib/context-helpers.test.mjs +25 -0
  122. package/dist/lib/context-helpers.test.mjs.map +1 -0
  123. package/dist/lib/entry.cjs +16 -0
  124. package/dist/lib/entry.d.cts.map +1 -1
  125. package/dist/lib/entry.d.mts.map +1 -1
  126. package/dist/lib/entry.mjs +11 -1
  127. package/dist/lib/entry.mjs.map +1 -1
  128. package/dist/lib/entry.test.cjs +23 -0
  129. package/dist/lib/entry.test.d.cts +1 -0
  130. package/dist/lib/entry.test.d.mts +2 -0
  131. package/dist/lib/entry.test.mjs +25 -0
  132. package/dist/lib/entry.test.mjs.map +1 -0
  133. package/dist/lib/environment.cjs +12 -0
  134. package/dist/lib/environment.d.cts.map +1 -1
  135. package/dist/lib/environment.d.mts.map +1 -1
  136. package/dist/lib/environment.mjs +8 -1
  137. package/dist/lib/environment.mjs.map +1 -1
  138. package/dist/lib/environment.test.cjs +23 -0
  139. package/dist/lib/environment.test.d.cts +1 -0
  140. package/dist/lib/environment.test.d.mts +2 -0
  141. package/dist/lib/environment.test.mjs +25 -0
  142. package/dist/lib/environment.test.mjs.map +1 -0
  143. package/dist/lib/events.cjs +9 -1
  144. package/dist/lib/events.d.cts.map +1 -1
  145. package/dist/lib/events.d.mts.map +1 -1
  146. package/dist/lib/events.mjs +4 -1
  147. package/dist/lib/events.mjs.map +1 -1
  148. package/dist/lib/events.test.cjs +23 -0
  149. package/dist/lib/events.test.d.cts +1 -0
  150. package/dist/lib/events.test.d.mts +2 -0
  151. package/dist/lib/events.test.mjs +25 -0
  152. package/dist/lib/events.test.mjs.map +1 -0
  153. package/dist/lib/generate-types.cjs +12 -0
  154. package/dist/lib/generate-types.d.cts.map +1 -1
  155. package/dist/lib/generate-types.d.mts.map +1 -1
  156. package/dist/lib/generate-types.mjs +7 -1
  157. package/dist/lib/generate-types.mjs.map +1 -1
  158. package/dist/lib/generate-types.test.cjs +23 -0
  159. package/dist/lib/generate-types.test.d.cts +1 -0
  160. package/dist/lib/generate-types.test.d.mts +2 -0
  161. package/dist/lib/generate-types.test.mjs +25 -0
  162. package/dist/lib/generate-types.test.mjs.map +1 -0
  163. package/dist/lib/hooks.cjs +12 -0
  164. package/dist/lib/hooks.d.cts.map +1 -1
  165. package/dist/lib/hooks.d.mts.map +1 -1
  166. package/dist/lib/hooks.mjs +8 -1
  167. package/dist/lib/hooks.mjs.map +1 -1
  168. package/dist/lib/hooks.test.cjs +23 -0
  169. package/dist/lib/hooks.test.d.cts +1 -0
  170. package/dist/lib/hooks.test.d.mts +2 -0
  171. package/dist/lib/hooks.test.mjs +25 -0
  172. package/dist/lib/hooks.test.mjs.map +1 -0
  173. package/dist/lib/install-dependencies.cjs +9 -1
  174. package/dist/lib/install-dependencies.d.cts.map +1 -1
  175. package/dist/lib/install-dependencies.d.mts.map +1 -1
  176. package/dist/lib/install-dependencies.mjs +3 -1
  177. package/dist/lib/install-dependencies.mjs.map +1 -1
  178. package/dist/lib/install-dependencies.test.cjs +23 -0
  179. package/dist/lib/install-dependencies.test.d.cts +1 -0
  180. package/dist/lib/install-dependencies.test.d.mts +2 -0
  181. package/dist/lib/install-dependencies.test.mjs +25 -0
  182. package/dist/lib/install-dependencies.test.mjs.map +1 -0
  183. package/dist/lib/meta.test.cjs +35 -0
  184. package/dist/lib/meta.test.d.cts +1 -0
  185. package/dist/lib/meta.test.d.mts +2 -0
  186. package/dist/lib/meta.test.mjs +37 -0
  187. package/dist/lib/meta.test.mjs.map +1 -0
  188. package/dist/lib/plugins.cjs +11 -0
  189. package/dist/lib/plugins.d.cts.map +1 -1
  190. package/dist/lib/plugins.d.mts.map +1 -1
  191. package/dist/lib/plugins.mjs +7 -1
  192. package/dist/lib/plugins.mjs.map +1 -1
  193. package/dist/lib/plugins.test.cjs +23 -0
  194. package/dist/lib/plugins.test.d.cts +1 -0
  195. package/dist/lib/plugins.test.d.mts +2 -0
  196. package/dist/lib/plugins.test.mjs +25 -0
  197. package/dist/lib/plugins.test.mjs.map +1 -0
  198. package/dist/lib/resolver.cjs +8 -1
  199. package/dist/lib/resolver.mjs +3 -1
  200. package/dist/lib/resolver.mjs.map +1 -1
  201. package/dist/lib/resolver.test.cjs +23 -0
  202. package/dist/lib/resolver.test.d.cts +1 -0
  203. package/dist/lib/resolver.test.d.mts +2 -0
  204. package/dist/lib/resolver.test.mjs +25 -0
  205. package/dist/lib/resolver.test.mjs.map +1 -0
  206. package/dist/lib/streaming-channel.cjs +12 -1
  207. package/dist/lib/streaming-channel.d.cts.map +1 -1
  208. package/dist/lib/streaming-channel.d.mts.map +1 -1
  209. package/dist/lib/streaming-channel.mjs +6 -1
  210. package/dist/lib/streaming-channel.mjs.map +1 -1
  211. package/dist/lib/streaming-channel.test.cjs +23 -0
  212. package/dist/lib/streaming-channel.test.d.cts +1 -0
  213. package/dist/lib/streaming-channel.test.d.mts +2 -0
  214. package/dist/lib/streaming-channel.test.mjs +25 -0
  215. package/dist/lib/streaming-channel.test.mjs.map +1 -0
  216. package/dist/lib/typescript/ts-morph.cjs +11 -1
  217. package/dist/lib/typescript/ts-morph.d.cts.map +1 -1
  218. package/dist/lib/typescript/ts-morph.d.mts.map +1 -1
  219. package/dist/lib/typescript/ts-morph.mjs +6 -1
  220. package/dist/lib/typescript/ts-morph.mjs.map +1 -1
  221. package/dist/lib/typescript/ts-morph.test.cjs +23 -0
  222. package/dist/lib/typescript/ts-morph.test.d.cts +1 -0
  223. package/dist/lib/typescript/ts-morph.test.d.mts +2 -0
  224. package/dist/lib/typescript/ts-morph.test.mjs +25 -0
  225. package/dist/lib/typescript/ts-morph.test.mjs.map +1 -0
  226. package/dist/lib/typescript/tsconfig.cjs +19 -1
  227. package/dist/lib/typescript/tsconfig.d.cts.map +1 -1
  228. package/dist/lib/typescript/tsconfig.d.mts.map +1 -1
  229. package/dist/lib/typescript/tsconfig.mjs +14 -1
  230. package/dist/lib/typescript/tsconfig.mjs.map +1 -1
  231. package/dist/lib/typescript/tsconfig.test.cjs +23 -0
  232. package/dist/lib/typescript/tsconfig.test.d.cts +1 -0
  233. package/dist/lib/typescript/tsconfig.test.d.mts +2 -0
  234. package/dist/lib/typescript/tsconfig.test.mjs +25 -0
  235. package/dist/lib/typescript/tsconfig.test.mjs.map +1 -0
  236. package/dist/lib/unplugin/helpers.cjs +11 -0
  237. package/dist/lib/unplugin/helpers.d.cts.map +1 -1
  238. package/dist/lib/unplugin/helpers.d.mts.map +1 -1
  239. package/dist/lib/unplugin/helpers.mjs +6 -1
  240. package/dist/lib/unplugin/helpers.mjs.map +1 -1
  241. package/dist/lib/unplugin/helpers.test.cjs +23 -0
  242. package/dist/lib/unplugin/helpers.test.d.cts +1 -0
  243. package/dist/lib/unplugin/helpers.test.d.mts +2 -0
  244. package/dist/lib/unplugin/helpers.test.mjs +25 -0
  245. package/dist/lib/unplugin/helpers.test.mjs.map +1 -0
  246. package/dist/lib/unplugin/module-resolution.cjs +8 -1
  247. package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
  248. package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
  249. package/dist/lib/unplugin/module-resolution.mjs +3 -1
  250. package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
  251. package/dist/lib/unplugin/module-resolution.test.cjs +23 -0
  252. package/dist/lib/unplugin/module-resolution.test.d.cts +1 -0
  253. package/dist/lib/unplugin/module-resolution.test.d.mts +2 -0
  254. package/dist/lib/unplugin/module-resolution.test.mjs +25 -0
  255. package/dist/lib/unplugin/module-resolution.test.mjs.map +1 -0
  256. package/dist/lib/unplugin/plugin.cjs +12 -1
  257. package/dist/lib/unplugin/plugin.d.cts.map +1 -1
  258. package/dist/lib/unplugin/plugin.d.mts.map +1 -1
  259. package/dist/lib/unplugin/plugin.mjs +6 -1
  260. package/dist/lib/unplugin/plugin.mjs.map +1 -1
  261. package/dist/lib/unplugin/plugin.test.cjs +23 -0
  262. package/dist/lib/unplugin/plugin.test.d.cts +1 -0
  263. package/dist/lib/unplugin/plugin.test.d.mts +2 -0
  264. package/dist/lib/unplugin/plugin.test.mjs +25 -0
  265. package/dist/lib/unplugin/plugin.test.mjs.map +1 -0
  266. package/dist/lib/utilities/file-header.cjs +13 -0
  267. package/dist/lib/utilities/file-header.mjs +8 -1
  268. package/dist/lib/utilities/file-header.mjs.map +1 -1
  269. package/dist/lib/utilities/file-header.test.cjs +23 -0
  270. package/dist/lib/utilities/file-header.test.d.cts +1 -0
  271. package/dist/lib/utilities/file-header.test.d.mts +2 -0
  272. package/dist/lib/utilities/file-header.test.mjs +25 -0
  273. package/dist/lib/utilities/file-header.test.mjs.map +1 -0
  274. package/dist/lib/utilities/format.cjs +11 -1
  275. package/dist/lib/utilities/format.mjs +6 -1
  276. package/dist/lib/utilities/format.mjs.map +1 -1
  277. package/dist/lib/utilities/format.test.cjs +23 -0
  278. package/dist/lib/utilities/format.test.d.cts +1 -0
  279. package/dist/lib/utilities/format.test.d.mts +2 -0
  280. package/dist/lib/utilities/format.test.mjs +25 -0
  281. package/dist/lib/utilities/format.test.mjs.map +1 -0
  282. package/dist/lib/utilities/source-file.cjs +12 -1
  283. package/dist/lib/utilities/source-file.mjs +7 -1
  284. package/dist/lib/utilities/source-file.mjs.map +1 -1
  285. package/dist/lib/utilities/source-file.test.cjs +23 -0
  286. package/dist/lib/utilities/source-file.test.d.cts +1 -0
  287. package/dist/lib/utilities/source-file.test.d.mts +2 -0
  288. package/dist/lib/utilities/source-file.test.mjs +25 -0
  289. package/dist/lib/utilities/source-file.test.mjs.map +1 -0
  290. package/dist/lib/utilities/source-map.cjs +8 -1
  291. package/dist/lib/utilities/source-map.mjs +3 -1
  292. package/dist/lib/utilities/source-map.mjs.map +1 -1
  293. package/dist/lib/utilities/source-map.test.cjs +23 -0
  294. package/dist/lib/utilities/source-map.test.d.cts +1 -0
  295. package/dist/lib/utilities/source-map.test.d.mts +2 -0
  296. package/dist/lib/utilities/source-map.test.mjs +25 -0
  297. package/dist/lib/utilities/source-map.test.mjs.map +1 -0
  298. package/dist/lib/utilities/write-file.cjs +9 -1
  299. package/dist/lib/utilities/write-file.mjs +3 -1
  300. package/dist/lib/utilities/write-file.mjs.map +1 -1
  301. package/dist/lib/utilities/write-file.test.cjs +23 -0
  302. package/dist/lib/utilities/write-file.test.d.cts +1 -0
  303. package/dist/lib/utilities/write-file.test.d.mts +2 -0
  304. package/dist/lib/utilities/write-file.test.mjs +25 -0
  305. package/dist/lib/utilities/write-file.test.mjs.map +1 -0
  306. package/dist/lib/vfs.cjs +8 -1
  307. package/dist/lib/vfs.d.cts.map +1 -1
  308. package/dist/lib/vfs.d.mts.map +1 -1
  309. package/dist/lib/vfs.mjs +3 -1
  310. package/dist/lib/vfs.mjs.map +1 -1
  311. package/dist/lib/vfs.test.cjs +23 -0
  312. package/dist/lib/vfs.test.d.cts +1 -0
  313. package/dist/lib/vfs.test.d.mts +2 -0
  314. package/dist/lib/vfs.test.mjs +25 -0
  315. package/dist/lib/vfs.test.mjs.map +1 -0
  316. package/dist/plugin-base.cjs +12 -1
  317. package/dist/plugin-base.mjs +6 -1
  318. package/dist/plugin-base.mjs.map +1 -1
  319. package/dist/plugin-base.test.cjs +23 -0
  320. package/dist/plugin-base.test.d.cts +1 -0
  321. package/dist/plugin-base.test.d.mts +2 -0
  322. package/dist/plugin-base.test.mjs +25 -0
  323. package/dist/plugin-base.test.mjs.map +1 -0
  324. package/dist/plugin-utils/build-helpers.cjs +8 -0
  325. package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
  326. package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
  327. package/dist/plugin-utils/build-helpers.mjs +3 -1
  328. package/dist/plugin-utils/build-helpers.mjs.map +1 -1
  329. package/dist/plugin-utils/build-helpers.test.cjs +23 -0
  330. package/dist/plugin-utils/build-helpers.test.d.cts +1 -0
  331. package/dist/plugin-utils/build-helpers.test.d.mts +2 -0
  332. package/dist/plugin-utils/build-helpers.test.mjs +25 -0
  333. package/dist/plugin-utils/build-helpers.test.mjs.map +1 -0
  334. package/dist/plugin-utils/combine-plugins.cjs +12 -1
  335. package/dist/plugin-utils/combine-plugins.mjs +6 -1
  336. package/dist/plugin-utils/combine-plugins.mjs.map +1 -1
  337. package/dist/plugin-utils/combine-plugins.test.cjs +23 -0
  338. package/dist/plugin-utils/combine-plugins.test.d.cts +1 -0
  339. package/dist/plugin-utils/combine-plugins.test.d.mts +2 -0
  340. package/dist/plugin-utils/combine-plugins.test.mjs +25 -0
  341. package/dist/plugin-utils/combine-plugins.test.mjs.map +1 -0
  342. package/dist/plugin-utils/context-helpers.cjs +13 -0
  343. package/dist/plugin-utils/context-helpers.mjs +8 -1
  344. package/dist/plugin-utils/context-helpers.mjs.map +1 -1
  345. package/dist/plugin-utils/context-helpers.test.cjs +23 -0
  346. package/dist/plugin-utils/context-helpers.test.d.cts +1 -0
  347. package/dist/plugin-utils/context-helpers.test.d.mts +2 -0
  348. package/dist/plugin-utils/context-helpers.test.mjs +25 -0
  349. package/dist/plugin-utils/context-helpers.test.mjs.map +1 -0
  350. package/dist/plugin-utils/docs-helper.cjs +8 -0
  351. package/dist/plugin-utils/docs-helper.mjs +3 -1
  352. package/dist/plugin-utils/docs-helper.mjs.map +1 -1
  353. package/dist/plugin-utils/docs-helper.test.cjs +23 -0
  354. package/dist/plugin-utils/docs-helper.test.d.cts +1 -0
  355. package/dist/plugin-utils/docs-helper.test.d.mts +2 -0
  356. package/dist/plugin-utils/docs-helper.test.mjs +25 -0
  357. package/dist/plugin-utils/docs-helper.test.mjs.map +1 -0
  358. package/dist/plugin-utils/enable-plugin.cjs +9 -1
  359. package/dist/plugin-utils/enable-plugin.d.cts.map +1 -1
  360. package/dist/plugin-utils/enable-plugin.d.mts.map +1 -1
  361. package/dist/plugin-utils/enable-plugin.mjs +3 -1
  362. package/dist/plugin-utils/enable-plugin.mjs.map +1 -1
  363. package/dist/plugin-utils/enable-plugin.test.cjs +23 -0
  364. package/dist/plugin-utils/enable-plugin.test.d.cts +1 -0
  365. package/dist/plugin-utils/enable-plugin.test.d.mts +2 -0
  366. package/dist/plugin-utils/enable-plugin.test.mjs +25 -0
  367. package/dist/plugin-utils/enable-plugin.test.mjs.map +1 -0
  368. package/dist/plugin-utils/extend.cjs +9 -1
  369. package/dist/plugin-utils/extend.d.cts.map +1 -1
  370. package/dist/plugin-utils/extend.d.mts.map +1 -1
  371. package/dist/plugin-utils/extend.mjs +3 -1
  372. package/dist/plugin-utils/extend.mjs.map +1 -1
  373. package/dist/plugin-utils/extend.test.cjs +23 -0
  374. package/dist/plugin-utils/extend.test.d.cts +1 -0
  375. package/dist/plugin-utils/extend.test.d.mts +2 -0
  376. package/dist/plugin-utils/extend.test.mjs +25 -0
  377. package/dist/plugin-utils/extend.test.mjs.map +1 -0
  378. package/dist/plugin-utils/filter.cjs +17 -0
  379. package/dist/plugin-utils/filter.mjs +13 -1
  380. package/dist/plugin-utils/filter.mjs.map +1 -1
  381. package/dist/plugin-utils/filter.test.cjs +23 -0
  382. package/dist/plugin-utils/filter.test.d.cts +1 -0
  383. package/dist/plugin-utils/filter.test.d.mts +2 -0
  384. package/dist/plugin-utils/filter.test.mjs +25 -0
  385. package/dist/plugin-utils/filter.test.mjs.map +1 -0
  386. package/dist/plugin-utils/format-package-json.cjs +9 -1
  387. package/dist/plugin-utils/format-package-json.mjs +3 -1
  388. package/dist/plugin-utils/format-package-json.mjs.map +1 -1
  389. package/dist/plugin-utils/format-package-json.test.cjs +23 -0
  390. package/dist/plugin-utils/format-package-json.test.d.cts +1 -0
  391. package/dist/plugin-utils/format-package-json.test.d.mts +2 -0
  392. package/dist/plugin-utils/format-package-json.test.mjs +25 -0
  393. package/dist/plugin-utils/format-package-json.test.mjs.map +1 -0
  394. package/dist/plugin-utils/format.cjs +9 -1
  395. package/dist/plugin-utils/format.mjs +3 -1
  396. package/dist/plugin-utils/format.mjs.map +1 -1
  397. package/dist/plugin-utils/format.test.cjs +23 -0
  398. package/dist/plugin-utils/format.test.d.cts +1 -0
  399. package/dist/plugin-utils/format.test.d.mts +2 -0
  400. package/dist/plugin-utils/format.test.mjs +25 -0
  401. package/dist/plugin-utils/format.test.mjs.map +1 -0
  402. package/dist/plugin-utils/get-config-path.cjs +9 -1
  403. package/dist/plugin-utils/get-config-path.mjs +3 -1
  404. package/dist/plugin-utils/get-config-path.mjs.map +1 -1
  405. package/dist/plugin-utils/get-config-path.test.cjs +23 -0
  406. package/dist/plugin-utils/get-config-path.test.d.cts +1 -0
  407. package/dist/plugin-utils/get-config-path.test.d.mts +2 -0
  408. package/dist/plugin-utils/get-config-path.test.mjs +25 -0
  409. package/dist/plugin-utils/get-config-path.test.mjs.map +1 -0
  410. package/dist/plugin-utils/helpers.cjs +25 -0
  411. package/dist/plugin-utils/helpers.d.cts.map +1 -1
  412. package/dist/plugin-utils/helpers.d.mts.map +1 -1
  413. package/dist/plugin-utils/helpers.mjs +20 -1
  414. package/dist/plugin-utils/helpers.mjs.map +1 -1
  415. package/dist/plugin-utils/helpers.test.cjs +23 -0
  416. package/dist/plugin-utils/helpers.test.d.cts +1 -0
  417. package/dist/plugin-utils/helpers.test.d.mts +2 -0
  418. package/dist/plugin-utils/helpers.test.mjs +25 -0
  419. package/dist/plugin-utils/helpers.test.mjs.map +1 -0
  420. package/dist/plugin-utils/install.cjs +12 -1
  421. package/dist/plugin-utils/install.mjs +6 -1
  422. package/dist/plugin-utils/install.mjs.map +1 -1
  423. package/dist/plugin-utils/install.test.cjs +23 -0
  424. package/dist/plugin-utils/install.test.d.cts +1 -0
  425. package/dist/plugin-utils/install.test.d.mts +2 -0
  426. package/dist/plugin-utils/install.test.mjs +25 -0
  427. package/dist/plugin-utils/install.test.mjs.map +1 -0
  428. package/dist/plugin-utils/logging.cjs +24 -0
  429. package/dist/plugin-utils/logging.mjs +20 -1
  430. package/dist/plugin-utils/logging.mjs.map +1 -1
  431. package/dist/plugin-utils/logging.test.cjs +23 -0
  432. package/dist/plugin-utils/logging.test.d.cts +1 -0
  433. package/dist/plugin-utils/logging.test.d.mts +2 -0
  434. package/dist/plugin-utils/logging.test.mjs +25 -0
  435. package/dist/plugin-utils/logging.test.mjs.map +1 -0
  436. package/dist/plugin-utils/merge.cjs +11 -1
  437. package/dist/plugin-utils/merge.d.cts.map +1 -1
  438. package/dist/plugin-utils/merge.d.mts.map +1 -1
  439. package/dist/plugin-utils/merge.mjs +6 -1
  440. package/dist/plugin-utils/merge.mjs.map +1 -1
  441. package/dist/plugin-utils/merge.test.cjs +23 -0
  442. package/dist/plugin-utils/merge.test.d.cts +1 -0
  443. package/dist/plugin-utils/merge.test.d.mts +2 -0
  444. package/dist/plugin-utils/merge.test.mjs +25 -0
  445. package/dist/plugin-utils/merge.test.mjs.map +1 -0
  446. package/dist/plugin-utils/modules.cjs +9 -1
  447. package/dist/plugin-utils/modules.mjs +4 -1
  448. package/dist/plugin-utils/modules.mjs.map +1 -1
  449. package/dist/plugin-utils/modules.test.cjs +23 -0
  450. package/dist/plugin-utils/modules.test.d.cts +1 -0
  451. package/dist/plugin-utils/modules.test.d.mts +2 -0
  452. package/dist/plugin-utils/modules.test.mjs +25 -0
  453. package/dist/plugin-utils/modules.test.mjs.map +1 -0
  454. package/dist/plugin-utils/paths.cjs +8 -0
  455. package/dist/plugin-utils/paths.mjs +3 -1
  456. package/dist/plugin-utils/paths.mjs.map +1 -1
  457. package/dist/plugin-utils/paths.test.cjs +23 -0
  458. package/dist/plugin-utils/paths.test.d.cts +1 -0
  459. package/dist/plugin-utils/paths.test.d.mts +2 -0
  460. package/dist/plugin-utils/paths.test.mjs +25 -0
  461. package/dist/plugin-utils/paths.test.mjs.map +1 -0
  462. package/dist/plugin-utils/virtual.cjs +17 -1
  463. package/dist/plugin-utils/virtual.mjs +12 -1
  464. package/dist/plugin-utils/virtual.mjs.map +1 -1
  465. package/dist/plugin-utils/virtual.test.cjs +23 -0
  466. package/dist/plugin-utils/virtual.test.d.cts +1 -0
  467. package/dist/plugin-utils/virtual.test.d.mts +2 -0
  468. package/dist/plugin-utils/virtual.test.mjs +25 -0
  469. package/dist/plugin-utils/virtual.test.mjs.map +1 -0
  470. package/dist/schemas/fs.d.cts.map +1 -1
  471. package/dist/schemas/fs.d.mts.map +1 -1
  472. package/dist/storage/base.cjs +9 -1
  473. package/dist/storage/base.d.cts.map +1 -1
  474. package/dist/storage/base.d.mts.map +1 -1
  475. package/dist/storage/base.mjs +3 -1
  476. package/dist/storage/base.mjs.map +1 -1
  477. package/dist/storage/base.test.cjs +23 -0
  478. package/dist/storage/base.test.d.cts +1 -0
  479. package/dist/storage/base.test.d.mts +2 -0
  480. package/dist/storage/base.test.mjs +25 -0
  481. package/dist/storage/base.test.mjs.map +1 -0
  482. package/dist/storage/file-system.cjs +9 -1
  483. package/dist/storage/file-system.mjs +3 -1
  484. package/dist/storage/file-system.mjs.map +1 -1
  485. package/dist/storage/file-system.test.cjs +23 -0
  486. package/dist/storage/file-system.test.d.cts +1 -0
  487. package/dist/storage/file-system.test.d.mts +2 -0
  488. package/dist/storage/file-system.test.mjs +25 -0
  489. package/dist/storage/file-system.test.mjs.map +1 -0
  490. package/dist/storage/helpers.cjs +12 -0
  491. package/dist/storage/helpers.mjs +7 -1
  492. package/dist/storage/helpers.mjs.map +1 -1
  493. package/dist/storage/helpers.test.cjs +23 -0
  494. package/dist/storage/helpers.test.d.cts +1 -0
  495. package/dist/storage/helpers.test.d.mts +2 -0
  496. package/dist/storage/helpers.test.mjs +25 -0
  497. package/dist/storage/helpers.test.mjs.map +1 -0
  498. package/dist/storage/virtual.cjs +9 -1
  499. package/dist/storage/virtual.d.cts.map +1 -1
  500. package/dist/storage/virtual.d.mts.map +1 -1
  501. package/dist/storage/virtual.mjs +3 -1
  502. package/dist/storage/virtual.mjs.map +1 -1
  503. package/dist/storage/virtual.test.cjs +23 -0
  504. package/dist/storage/virtual.test.d.cts +1 -0
  505. package/dist/storage/virtual.test.d.mts +2 -0
  506. package/dist/storage/virtual.test.mjs +25 -0
  507. package/dist/storage/virtual.test.mjs.map +1 -0
  508. package/package.json +257 -17
@@ -1 +1 @@
1
- {"version":3,"file":"streaming-channel.mjs","names":[],"sources":["../../src/lib/streaming-channel.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 { nanoid } from \"@stryke/unique-id/nanoid-client\";\nimport type { EventEmitter } from \"devframe/types\";\nimport { createEventEmitter } from \"./events\";\n\n/**\n * Serialized error shape sent over the wire when a stream ends with a failure.\n * Stays JSON-safe so the strict-JSON encoder can carry it without coercion.\n */\nexport interface StreamErrorPayload {\n name: string;\n message: string;\n}\n\n/**\n * Single buffered chunk in the server-side ring buffer.\n *\n * Sequence numbers start at 1 and increment per write. Subscribers track\n * `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can\n * replay any chunks the client missed during a brief disconnect.\n */\nexport interface BufferedChunk<T> {\n seq: number;\n chunk: T;\n}\n\nexport interface StreamSinkEvents<T> {\n /** Fired for each `write()`. The RPC layer subscribes and broadcasts. */\n chunk: (seq: number, chunk: T) => void;\n /** Terminal — fired exactly once per sink lifetime. */\n end: (error?: StreamErrorPayload) => void;\n}\n\nexport interface CreateStreamSinkOptions {\n id?: string;\n /**\n * Size of the per-stream ring buffer kept for replay-on-resubscribe.\n * `0` (default) disables replay.\n */\n replayWindow?: number;\n}\n\n/**\n * Server-side producer handle. Two equivalent surfaces share one piece of\n * state: the imperative `write/error/close` triple, and a `WritableStream<T>`\n * for `pipeTo`-style consumption.\n */\nexport interface StreamSink<T> {\n /** Stable id used by clients to subscribe. */\n readonly id: string;\n /**\n * Aborts when the consumer cancels (server-side) or when the transport\n * loses every subscriber. Producers should poll `signal.aborted` and exit\n * cleanly.\n */\n readonly signal: AbortSignal;\n /** `true` after `close()` / `error()`. Further writes throw. */\n readonly closed: boolean;\n /** Last allocated sequence number. `0` until the first write. */\n readonly lastSeq: number;\n\n write: (chunk: T) => void;\n error: (reason: unknown) => void;\n close: () => void;\n /** External-cancel path. Aborts the signal so handlers can short-circuit. */\n abort: (reason?: unknown) => void;\n\n /** `WritableStream<T>` adapter — same in-memory state as the imperative API. */\n readonly writable: WritableStream<T>;\n\n /**\n * Internal — RPC layer subscribes to receive chunk/end notifications.\n * Not part of the public contract; do not call directly.\n *\n * @internal\n */\n readonly events: EventEmitter<StreamSinkEvents<T>>;\n\n /**\n * Internal — replay buffer. RPC layer reads on (re)subscribe to feed\n * missed chunks before going live.\n *\n * @internal\n */\n readonly buffer: ReadonlyArray<BufferedChunk<T>>;\n}\n\nexport interface CreateStreamReaderOptions {\n id?: string;\n /**\n * Maximum number of buffered chunks held client-side while the consumer\n * isn't draining. On overflow, the oldest chunk is dropped.\n */\n highWaterMark?: number;\n /**\n * Called when the chunk queue overflows the high-water mark. The RPC\n * layer wires this to a coded warning; the primitive itself is\n * RPC-agnostic.\n */\n onOverflow?: (dropped: number) => void;\n /** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */\n onCancel?: () => void;\n}\n\n/**\n * Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)\n * and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they\n * share a single internal queue, so concurrent draining will race.\n */\nexport interface StreamReader<T> extends AsyncIterable<T> {\n readonly id: string;\n readonly cancelled: boolean;\n readonly done: boolean;\n /** Highest `seq` observed. Used for replay on reconnect. */\n readonly lastSeenSeq: number;\n /** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */\n readonly readable: ReadableStream<T>;\n\n cancel: () => void;\n\n /** @internal */\n _push: (seq: number, chunk: T) => void;\n /** @internal */\n _end: (error?: StreamErrorPayload) => void;\n}\n\nconst DEFAULT_HIGH_WATER_MARK = 256;\n\nclass StreamClosedError extends Error {\n override name = \"StreamClosedError\";\n}\n\n/**\n * Build a server-side stream sink. RPC-agnostic — the RPC host wires\n * `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay\n * for late or reconnecting subscribers.\n */\nexport function createStreamSink<T>(\n options: CreateStreamSinkOptions = {}\n): StreamSink<T> {\n const id = options.id ?? nanoid();\n const replayWindow = Math.max(0, options.replayWindow ?? 0);\n const events = createEventEmitter<StreamSinkEvents<T>>();\n const controller = new AbortController();\n const buffer: BufferedChunk<T>[] = [];\n\n let closed = false;\n let lastSeq = 0;\n\n function write(chunk: T): void {\n if (closed) {\n throw new StreamClosedError(`Cannot write to a closed stream \"${id}\"`);\n }\n lastSeq += 1;\n if (replayWindow > 0) {\n buffer.push({ seq: lastSeq, chunk });\n if (buffer.length > replayWindow)\n buffer.splice(0, buffer.length - replayWindow);\n }\n events.emit(\"chunk\", lastSeq, chunk);\n }\n\n function error(reason: unknown): void {\n if (closed) return;\n closed = true;\n const payload = toErrorPayload(reason);\n controller.abort(reason);\n events.emit(\"end\", payload);\n }\n\n function close(): void {\n if (closed) return;\n closed = true;\n if (!controller.signal.aborted) controller.abort(\"stream closed\");\n events.emit(\"end\", undefined);\n }\n\n function abort(reason?: unknown): void {\n if (closed) return;\n if (!controller.signal.aborted) controller.abort(reason ?? \"aborted\");\n }\n\n const writable = new WritableStream<T>({\n write(chunk) {\n write(chunk);\n },\n close() {\n close();\n },\n abort(reason) {\n error(reason);\n }\n });\n\n return {\n id,\n signal: controller.signal,\n get closed() {\n return closed;\n },\n get lastSeq() {\n return lastSeq;\n },\n write,\n error,\n close,\n abort,\n writable,\n events,\n buffer\n };\n}\n\n/**\n * Build a client-side stream reader. RPC-agnostic — the RPC host calls\n * `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the\n * terminal frame. Consumers iterate with `for await` or pipe `readable`.\n */\nexport function createStreamReader<T>(\n options: CreateStreamReaderOptions = {}\n): StreamReader<T> {\n const id = options.id ?? nanoid();\n const highWaterMark = Math.max(\n 1,\n options.highWaterMark ?? DEFAULT_HIGH_WATER_MARK\n );\n\n const queue: T[] = [];\n let lastSeenSeq = 0;\n let done = false;\n let cancelled = false;\n let endError: StreamErrorPayload | undefined;\n let pending:\n | {\n resolve: (r: IteratorResult<T>) => void;\n reject: (err: unknown) => void;\n }\n | undefined;\n // Lazily created — accessing `reader.readable` claims the queue for\n // `pipeTo` consumption. While inactive, `_push` only feeds the\n // AsyncIterator path. Mixing the two surfaces is undefined behavior.\n let pullController: ReadableStreamDefaultController<T> | undefined;\n let readableInstance: ReadableStream<T> | undefined;\n\n function drainNext(): void {\n if (!pending) return;\n if (queue.length > 0) {\n const value = queue.shift()!;\n const r = pending;\n pending = undefined;\n r.resolve({ value, done: false });\n return;\n }\n if (done) {\n const r = pending;\n pending = undefined;\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n r.reject(err);\n } else {\n r.resolve({ value: undefined, done: true });\n }\n }\n }\n\n function feedReadable(): void {\n if (!pullController) return;\n while (queue.length > 0) {\n const v = queue.shift()!;\n try {\n pullController.enqueue(v);\n } catch {\n // controller closed/errored under us — drop silently; the\n // ReadableStream consumer is gone and we can't push further.\n break;\n }\n }\n if (done && pullController) {\n try {\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n pullController.error(err);\n } else {\n pullController.close();\n }\n } catch {\n // already closed\n }\n pullController = undefined;\n }\n }\n\n function push(seq: number, chunk: T): void {\n if (done || cancelled) return;\n if (seq <= lastSeenSeq) return; // dedupe replays we've already seen\n lastSeenSeq = seq;\n queue.push(chunk);\n if (queue.length > highWaterMark) {\n const overflow = queue.length - highWaterMark;\n queue.splice(0, overflow);\n options.onOverflow?.(overflow);\n }\n drainNext();\n if (readableInstance) feedReadable();\n }\n\n function end(error?: StreamErrorPayload): void {\n if (done) return;\n done = true;\n endError = error;\n drainNext();\n if (readableInstance) feedReadable();\n }\n\n function cancel(): void {\n if (cancelled || done) return;\n cancelled = true;\n options.onCancel?.();\n end(undefined);\n }\n\n function getReadable(): ReadableStream<T> {\n if (readableInstance) return readableInstance;\n readableInstance = new ReadableStream<T>({\n start(controller) {\n pullController = controller;\n feedReadable();\n },\n cancel() {\n cancel();\n }\n });\n return readableInstance;\n }\n\n const reader: StreamReader<T> = {\n id,\n get cancelled() {\n return cancelled;\n },\n get done() {\n return done;\n },\n get lastSeenSeq() {\n return lastSeenSeq;\n },\n get readable() {\n return getReadable();\n },\n cancel,\n _push: push,\n _end: end,\n [Symbol.asyncIterator](): AsyncIterator<T> {\n return {\n async next(): Promise<IteratorResult<T>> {\n if (queue.length > 0) {\n return Promise.resolve({ value: queue.shift()!, done: false });\n }\n if (done) {\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n return Promise.reject(err);\n }\n return Promise.resolve({\n value: undefined as unknown as T,\n done: true\n });\n }\n return new Promise<IteratorResult<T>>((resolve, reject) => {\n pending = { resolve, reject };\n });\n },\n async return(): Promise<IteratorResult<T>> {\n cancel();\n return Promise.resolve({\n value: undefined as unknown as T,\n done: true\n });\n }\n };\n }\n };\n\n return reader;\n}\n\nfunction toErrorPayload(reason: unknown): StreamErrorPayload {\n if (reason instanceof Error) {\n return { name: reason.name || \"Error\", message: reason.message };\n }\n if (typeof reason === \"string\") {\n return { name: \"Error\", message: reason };\n }\n try {\n return { name: \"Error\", message: JSON.stringify(reason) };\n } catch {\n return { name: \"Error\", message: String(reason) };\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+IA,MAAM,0BAA0B;AAEhC,IAAM,oBAAN,cAAgC,MAAM;CACpC,AAAS,OAAO;AAClB;;;;;;AAOA,SAAgB,iBACd,UAAmC,CAAC,GACrB;CACf,MAAM,KAAK,QAAQ,MAAM,OAAO;CAChC,MAAM,eAAe,KAAK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S,SAAS,OAAO;CAAQ;CAEjE,IAAI,OAAO,WAAW,UACpB,OAAO;EAAE,MAAM;EAAS,SAAS;CAAO;CAE1C,IAAI;EACF,OAAO;GAAE,MAAM;GAAS,SAAS,KAAK,UAAU,MAAM;EAAE;CAC1D,QAAQ;EACN,OAAO;GAAE,MAAM;GAAS,SAAS,OAAO,MAAM;EAAE;CAClD;AACF"}
1
+ {"version":3,"file":"streaming-channel.mjs","names":[],"sources":["../../src/lib/streaming-channel.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 { nanoid } from \"@stryke/unique-id/nanoid-client\";\nimport type { EventEmitter } from \"devframe/types\";\nimport { createEventEmitter } from \"./events\";\n\n/**\n * Serialized error shape sent over the wire when a stream ends with a failure.\n * Stays JSON-safe so the strict-JSON encoder can carry it without coercion.\n */\nexport interface StreamErrorPayload {\n name: string;\n message: string;\n}\n\n/**\n * Single buffered chunk in the server-side ring buffer.\n *\n * Sequence numbers start at 1 and increment per write. Subscribers track\n * `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can\n * replay any chunks the client missed during a brief disconnect.\n */\nexport interface BufferedChunk<T> {\n seq: number;\n chunk: T;\n}\n\nexport interface StreamSinkEvents<T> {\n /** Fired for each `write()`. The RPC layer subscribes and broadcasts. */\n chunk: (seq: number, chunk: T) => void;\n /** Terminal — fired exactly once per sink lifetime. */\n end: (error?: StreamErrorPayload) => void;\n}\n\nexport interface CreateStreamSinkOptions {\n id?: string;\n /**\n * Size of the per-stream ring buffer kept for replay-on-resubscribe.\n * `0` (default) disables replay.\n */\n replayWindow?: number;\n}\n\n/**\n * Server-side producer handle. Two equivalent surfaces share one piece of\n * state: the imperative `write/error/close` triple, and a `WritableStream<T>`\n * for `pipeTo`-style consumption.\n */\nexport interface StreamSink<T> {\n /** Stable id used by clients to subscribe. */\n readonly id: string;\n /**\n * Aborts when the consumer cancels (server-side) or when the transport\n * loses every subscriber. Producers should poll `signal.aborted` and exit\n * cleanly.\n */\n readonly signal: AbortSignal;\n /** `true` after `close()` / `error()`. Further writes throw. */\n readonly closed: boolean;\n /** Last allocated sequence number. `0` until the first write. */\n readonly lastSeq: number;\n\n write: (chunk: T) => void;\n error: (reason: unknown) => void;\n close: () => void;\n /** External-cancel path. Aborts the signal so handlers can short-circuit. */\n abort: (reason?: unknown) => void;\n\n /** `WritableStream<T>` adapter — same in-memory state as the imperative API. */\n readonly writable: WritableStream<T>;\n\n /**\n * Internal — RPC layer subscribes to receive chunk/end notifications.\n * Not part of the public contract; do not call directly.\n *\n * @internal\n */\n readonly events: EventEmitter<StreamSinkEvents<T>>;\n\n /**\n * Internal — replay buffer. RPC layer reads on (re)subscribe to feed\n * missed chunks before going live.\n *\n * @internal\n */\n readonly buffer: ReadonlyArray<BufferedChunk<T>>;\n}\n\nexport interface CreateStreamReaderOptions {\n id?: string;\n /**\n * Maximum number of buffered chunks held client-side while the consumer\n * isn't draining. On overflow, the oldest chunk is dropped.\n */\n highWaterMark?: number;\n /**\n * Called when the chunk queue overflows the high-water mark. The RPC\n * layer wires this to a coded warning; the primitive itself is\n * RPC-agnostic.\n */\n onOverflow?: (dropped: number) => void;\n /** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */\n onCancel?: () => void;\n}\n\n/**\n * Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)\n * and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they\n * share a single internal queue, so concurrent draining will race.\n */\nexport interface StreamReader<T> extends AsyncIterable<T> {\n readonly id: string;\n readonly cancelled: boolean;\n readonly done: boolean;\n /** Highest `seq` observed. Used for replay on reconnect. */\n readonly lastSeenSeq: number;\n /** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */\n readonly readable: ReadableStream<T>;\n\n cancel: () => void;\n\n /** @internal */\n _push: (seq: number, chunk: T) => void;\n /** @internal */\n _end: (error?: StreamErrorPayload) => void;\n}\n\nconst DEFAULT_HIGH_WATER_MARK = 256;\n\nclass StreamClosedError extends Error {\n override name = \"StreamClosedError\";\n}\n\n/**\n * Build a server-side stream sink. RPC-agnostic — the RPC host wires\n * `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay\n * for late or reconnecting subscribers.\n */\nexport function createStreamSink<T>(\n options: CreateStreamSinkOptions = {}\n): StreamSink<T> {\n const id = options.id ?? nanoid();\n const replayWindow = Math.max(0, options.replayWindow ?? 0);\n const events = createEventEmitter<StreamSinkEvents<T>>();\n const controller = new AbortController();\n const buffer: BufferedChunk<T>[] = [];\n\n let closed = false;\n let lastSeq = 0;\n\n function write(chunk: T): void {\n if (closed) {\n throw new StreamClosedError(`Cannot write to a closed stream \"${id}\"`);\n }\n lastSeq += 1;\n if (replayWindow > 0) {\n buffer.push({ seq: lastSeq, chunk });\n if (buffer.length > replayWindow)\n buffer.splice(0, buffer.length - replayWindow);\n }\n events.emit(\"chunk\", lastSeq, chunk);\n }\n\n function error(reason: unknown): void {\n if (closed) return;\n closed = true;\n const payload = toErrorPayload(reason);\n controller.abort(reason);\n events.emit(\"end\", payload);\n }\n\n function close(): void {\n if (closed) return;\n closed = true;\n if (!controller.signal.aborted) controller.abort(\"stream closed\");\n events.emit(\"end\", undefined);\n }\n\n function abort(reason?: unknown): void {\n if (closed) return;\n if (!controller.signal.aborted) controller.abort(reason ?? \"aborted\");\n }\n\n const writable = new WritableStream<T>({\n write(chunk) {\n write(chunk);\n },\n close() {\n close();\n },\n abort(reason) {\n error(reason);\n }\n });\n\n return {\n id,\n signal: controller.signal,\n get closed() {\n return closed;\n },\n get lastSeq() {\n return lastSeq;\n },\n write,\n error,\n close,\n abort,\n writable,\n events,\n buffer\n };\n}\n\n/**\n * Build a client-side stream reader. RPC-agnostic — the RPC host calls\n * `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the\n * terminal frame. Consumers iterate with `for await` or pipe `readable`.\n */\nexport function createStreamReader<T>(\n options: CreateStreamReaderOptions = {}\n): StreamReader<T> {\n const id = options.id ?? nanoid();\n const highWaterMark = Math.max(\n 1,\n options.highWaterMark ?? DEFAULT_HIGH_WATER_MARK\n );\n\n const queue: T[] = [];\n let lastSeenSeq = 0;\n let done = false;\n let cancelled = false;\n let endError: StreamErrorPayload | undefined;\n let pending:\n | {\n resolve: (r: IteratorResult<T>) => void;\n reject: (err: unknown) => void;\n }\n | undefined;\n // Lazily created — accessing `reader.readable` claims the queue for\n // `pipeTo` consumption. While inactive, `_push` only feeds the\n // AsyncIterator path. Mixing the two surfaces is undefined behavior.\n let pullController: ReadableStreamDefaultController<T> | undefined;\n let readableInstance: ReadableStream<T> | undefined;\n\n function drainNext(): void {\n if (!pending) return;\n if (queue.length > 0) {\n const value = queue.shift()!;\n const r = pending;\n pending = undefined;\n r.resolve({ value, done: false });\n return;\n }\n if (done) {\n const r = pending;\n pending = undefined;\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n r.reject(err);\n } else {\n r.resolve({ value: undefined, done: true });\n }\n }\n }\n\n function feedReadable(): void {\n if (!pullController) return;\n while (queue.length > 0) {\n const v = queue.shift()!;\n try {\n pullController.enqueue(v);\n } catch {\n // controller closed/errored under us — drop silently; the\n // ReadableStream consumer is gone and we can't push further.\n break;\n }\n }\n if (done && pullController) {\n try {\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n pullController.error(err);\n } else {\n pullController.close();\n }\n } catch {\n // already closed\n }\n pullController = undefined;\n }\n }\n\n function push(seq: number, chunk: T): void {\n if (done || cancelled) return;\n if (seq <= lastSeenSeq) return; // dedupe replays we've already seen\n lastSeenSeq = seq;\n queue.push(chunk);\n if (queue.length > highWaterMark) {\n const overflow = queue.length - highWaterMark;\n queue.splice(0, overflow);\n options.onOverflow?.(overflow);\n }\n drainNext();\n if (readableInstance) feedReadable();\n }\n\n function end(error?: StreamErrorPayload): void {\n if (done) return;\n done = true;\n endError = error;\n drainNext();\n if (readableInstance) feedReadable();\n }\n\n function cancel(): void {\n if (cancelled || done) return;\n cancelled = true;\n options.onCancel?.();\n end(undefined);\n }\n\n function getReadable(): ReadableStream<T> {\n if (readableInstance) return readableInstance;\n readableInstance = new ReadableStream<T>({\n start(controller) {\n pullController = controller;\n feedReadable();\n },\n cancel() {\n cancel();\n }\n });\n return readableInstance;\n }\n\n const reader: StreamReader<T> = {\n id,\n get cancelled() {\n return cancelled;\n },\n get done() {\n return done;\n },\n get lastSeenSeq() {\n return lastSeenSeq;\n },\n get readable() {\n return getReadable();\n },\n cancel,\n _push: push,\n _end: end,\n [Symbol.asyncIterator](): AsyncIterator<T> {\n return {\n async next(): Promise<IteratorResult<T>> {\n if (queue.length > 0) {\n return Promise.resolve({ value: queue.shift()!, done: false });\n }\n if (done) {\n if (endError) {\n const err = new Error(endError.message);\n err.name = endError.name;\n return Promise.reject(err);\n }\n return Promise.resolve({\n value: undefined as unknown as T,\n done: true\n });\n }\n return new Promise<IteratorResult<T>>((resolve, reject) => {\n pending = { resolve, reject };\n });\n },\n async return(): Promise<IteratorResult<T>> {\n cancel();\n return Promise.resolve({\n value: undefined as unknown as T,\n done: true\n });\n }\n };\n }\n };\n\n return reader;\n}\n\nfunction toErrorPayload(reason: unknown): StreamErrorPayload {\n if (reason instanceof Error) {\n return { name: reason.name || \"Error\", message: reason.message };\n }\n if (typeof reason === \"string\") {\n return { name: \"Error\", message: reason };\n }\n try {\n return { name: \"Error\", message: JSON.stringify(reason) };\n } catch {\n return { name: \"Error\", message: String(reason) };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA+IA,MAAM,0BAA0B;AAEhC,IAAM,oBAAN,cAAgC,MAAM;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AM;KACR,CAAC;IACH;GACF;EACF;CAGU;AACd;AAEA,SAAS,eAAe,QAAqC;CAC3D,IAAI,kBAAkB,OACpB,OAAO;EAAE,MAAM,OAAO,QAAQ;EAAS,SAAS,OAAO;CAAQ;CAEjE,IAAI,OAAO,WAAW,UACpB,OAAO;EAAE,MAAM;EAAS,SAAS;CAAO;CAE1C,IAAI;EACF,OAAO;GAAE,MAAM;GAAS,SAAS,KAAK,UAAU,MAAM;EAAE;CAC1D,QAAQ;EACN,OAAO;GAAE,MAAM;GAAS,SAAS,OAAO,MAAM;EAAE;CAClD;AACF"}
@@ -0,0 +1,23 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ const require_lib_streaming_channel = require('./streaming-channel.cjs');
10
+ let vitest = require("vitest");
11
+
12
+ //#region src/lib/streaming-channel.test.ts
13
+ (0, vitest.describe)("base/core/src/lib/streaming-channel.ts", () => {
14
+ (0, vitest.it)("loads module exports", () => {
15
+ (0, vitest.expect)(require_lib_streaming_channel.streaming_channel_exports).toBeDefined();
16
+ (0, vitest.expect)(typeof require_lib_streaming_channel.streaming_channel_exports).toBe("object");
17
+ });
18
+ (0, vitest.it)("has at least one runtime export", () => {
19
+ (0, vitest.expect)(Object.keys(require_lib_streaming_channel.streaming_channel_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
@@ -0,0 +1,25 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ import { streaming_channel_exports } from "./streaming-channel.mjs";
10
+ import { describe, expect, it } from "vitest";
11
+
12
+ //#region src/lib/streaming-channel.test.ts
13
+ describe("base/core/src/lib/streaming-channel.ts", () => {
14
+ it("loads module exports", () => {
15
+ expect(streaming_channel_exports).toBeDefined();
16
+ expect(typeof streaming_channel_exports).toBe("object");
17
+ });
18
+ it("has at least one runtime export", () => {
19
+ expect(Object.keys(streaming_channel_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
24
+ export { };
25
+ //# sourceMappingURL=streaming-channel.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streaming-channel.test.mjs","names":["moduleExports"],"sources":["../../src/lib/streaming-channel.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./streaming-channel\";\n\ndescribe(\"base/core/src/lib/streaming-channel.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,gDAAgD;CACvD,GAAG,8BAA8B;EAC/B,OAAOA,yBAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,yBAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,yBAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
@@ -13,6 +13,10 @@ defu = require_runtime.__toESM(defu, 1);
13
13
  let ts_morph = require("ts-morph");
14
14
 
15
15
  //#region src/lib/typescript/ts-morph.ts
16
+ var ts_morph_exports = /* @__PURE__ */ require_runtime.__exportAll({
17
+ VirtualFileSystemHost: () => VirtualFileSystemHost,
18
+ createProgram: () => createProgram
19
+ });
16
20
  var VirtualFileSystemHost = class extends ts_morph.InMemoryFileSystemHost {
17
21
  #context;
18
22
  constructor(context) {
@@ -110,4 +114,10 @@ function createProgram(context, override) {
110
114
 
111
115
  //#endregion
112
116
  exports.VirtualFileSystemHost = VirtualFileSystemHost;
113
- exports.createProgram = createProgram;
117
+ exports.createProgram = createProgram;
118
+ Object.defineProperty(exports, 'ts_morph_exports', {
119
+ enumerable: true,
120
+ get: function () {
121
+ return ts_morph_exports;
122
+ }
123
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"ts-morph.d.cts","names":[],"sources":["../../../src/lib/typescript/ts-morph.ts"],"mappings":";;;;cA6Ba,qBAAA,SACH,sBAAA,YACG,cAAA;EAAA;cAIQ,OAAA,EAAS,OAAA;EAMZ,UAAA,CAAW,IAAA;EAIX,WAAA,CAAY,OAAA,WAAkB,eAAA;EAoBxB,QAAA,CAAS,QAAA,WAAgB,OAAA;EAQ/B,YAAA,CAAa,QAAA;EAQP,SAAA,CAAU,QAAA,UAAkB,QAAA,WAAgB,OAAA;EAIlD,aAAA,CAAc,QAAA,UAAkB,QAAA;EAI1B,KAAA,CAAM,OAAA,WAAe,OAAA;EAI3B,SAAA,CAAU,OAAA;EAIJ,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,UAAA,CAAW,QAAA,WAAgB,OAAA;EAIjC,cAAA,CAAe,QAAA;EAIT,eAAA,CAAgB,OAAA,WAAe,OAAA;EAIrC,mBAAA,CAAoB,OAAA;EAIpB,YAAA,CAAa,IAAA;EAIb,mBAAA,CAAA;EAIM,IAAA,CACpB,QAAA,EAAU,aAAA,WACT,OAAA;EAIa,QAAA,CAAS,QAAA,EAAU,aAAA;AAAA;;;;;;;iBAWrB,aAAA,CACd,OAAA,EAAS,OAAA,EACT,QAAA,EAAU,OAAA,CAAQ,cAAA,IACjB,OAAA"}
1
+ {"version":3,"file":"ts-morph.d.cts","names":[],"sources":["../../../src/lib/typescript/ts-morph.ts"],"mappings":";;;;cA6Ba,qBAAA,SACH,sBAAA,YACG,cAAA;EAAA;cAIQ,OAAA,EAAS,OAAA;EAMZ,UAAA,CAAW,IAAA;EAIX,WAAA,CAAY,OAAA,WAAkB,eAAA;EAoBxB,QAAA,CAAS,QAAA,WAAgB,OAAA;EAQ/B,YAAA,CAAa,QAAA;EAQP,SAAA,CAAU,QAAA,UAAkB,QAAA,WAAgB,OAAA;EAIlD,aAAA,CAAc,QAAA,UAAkB,QAAA;EAI1B,KAAA,CAAM,OAAA,WAAe,OAAA;EAI3B,SAAA,CAAU,OAAA;EAIJ,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,UAAA,CAAW,QAAA,WAAgB,OAAA;EAIjC,cAAA,CAAe,QAAA;EAIT,eAAA,CAAgB,OAAA,WAAe,OAAA;EAIrC,mBAAA,CAAoB,OAAA;EAIpB,YAAA,CAAa,IAAA;EAIb,mBAAA;EAIM,IAAA,CACpB,QAAA,EAAU,aAAA,WACT,OAAA;EAIa,QAAA,CAAS,QAAA,EAAU,aAAA;AAAA;;;;;;;iBAWrB,aAAA,CACd,OAAA,EAAS,OAAA,EACT,QAAA,EAAU,OAAA,CAAQ,cAAA,IACjB,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ts-morph.d.mts","names":[],"sources":["../../../src/lib/typescript/ts-morph.ts"],"mappings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,aAAA,CAAc,QAAA,UAAkB,QAAA;EAI1B,KAAA,CAAM,OAAA,WAAe,OAAA;EAI3B,SAAA,CAAU,OAAA;EAIJ,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,IAAA,CAAK,OAAA,UAAiB,QAAA,WAAgB,OAAA;EAI5C,QAAA,CAAS,OAAA,UAAiB,QAAA;EAIpB,UAAA,CAAW,QAAA,WAAgB,OAAA;EAIjC,cAAA,CAAe,QAAA;EAIT,eAAA,CAAgB,OAAA,WAAe,OAAA;EAIrC,mBAAA,CAAoB,OAAA;EAIpB,YAAA,CAAa,IAAA;EAIb,mBAAA;EAIM,IAAA,CACpB,QAAA,EAAU,aAAA,WACT,OAAA;EAIa,QAAA,CAAS,QAAA,EAAU,aAAA;AAAA;;;;;;;iBAWrB,aAAA,CACd,OAAA,EAAS,OAAA,EACT,QAAA,EAAU,OAAA,CAAQ,cAAA,IACjB,OAAA"}
@@ -6,10 +6,15 @@ import __tsdown_shims_url from 'node:url'
6
6
  const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
7
  const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
8
 
9
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
9
10
  import defu from "defu";
10
11
  import { InMemoryFileSystemHost, Project } from "ts-morph";
11
12
 
12
13
  //#region src/lib/typescript/ts-morph.ts
14
+ var ts_morph_exports = /* @__PURE__ */ __exportAll({
15
+ VirtualFileSystemHost: () => VirtualFileSystemHost,
16
+ createProgram: () => createProgram
17
+ });
13
18
  var VirtualFileSystemHost = class extends InMemoryFileSystemHost {
14
19
  #context;
15
20
  constructor(context) {
@@ -106,5 +111,5 @@ function createProgram(context, override) {
106
111
  }
107
112
 
108
113
  //#endregion
109
- export { VirtualFileSystemHost, createProgram };
114
+ export { VirtualFileSystemHost, createProgram, ts_morph_exports };
110
115
  //# sourceMappingURL=ts-morph.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ts-morph.mjs","names":["#context"],"sources":["../../../src/lib/typescript/ts-morph.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 defu from \"defu\";\nimport {\n CompilerOptions,\n FileSystemHost,\n InMemoryFileSystemHost,\n Project,\n ProjectOptions,\n RuntimeDirEntry\n} from \"ts-morph\";\nimport type { Context } from \"../../types/context\";\n\nexport class VirtualFileSystemHost\n extends InMemoryFileSystemHost\n implements FileSystemHost\n{\n #context: Context;\n\n public constructor(context: Context) {\n super();\n\n this.#context = context;\n }\n\n public override deleteSync(path: string) {\n this.#context.fs.removeSync(path);\n }\n\n public override readDirSync(dirPath: string): RuntimeDirEntry[] {\n if (!this.#context.fs.isDirectorySync(dirPath)) {\n return [];\n }\n\n return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {\n const fullPath = this.#context.fs.resolveSync(entry);\n if (fullPath) {\n ret.push({\n name: entry,\n isDirectory: this.#context.fs.isDirectorySync(fullPath),\n isFile: this.#context.fs.isFileSync(fullPath),\n isSymlink: false\n });\n }\n\n return ret;\n }, [] as RuntimeDirEntry[]);\n }\n\n public override async readFile(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return (await this.#context.fs.read(filePath))!;\n }\n\n public override readFileSync(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return this.#context.fs.readSync(filePath)!;\n }\n\n public override async writeFile(filePath: string, fileText: string) {\n return this.#context.fs.write(filePath, fileText);\n }\n\n public override writeFileSync(filePath: string, fileText: string) {\n this.#context.fs.writeSync(filePath, fileText);\n }\n\n public override async mkdir(dirPath: string) {\n await this.#context.fs.mkdir(dirPath);\n }\n\n public override mkdirSync(dirPath: string) {\n this.#context.fs.mkdirSync(dirPath);\n }\n\n public override async move(srcPath: string, destPath: string) {\n await this.#context.fs.move(srcPath, destPath);\n }\n\n public override moveSync(srcPath: string, destPath: string) {\n this.#context.fs.moveSync(srcPath, destPath);\n }\n\n public override async copy(srcPath: string, destPath: string) {\n await this.#context.fs.copy(srcPath, destPath);\n }\n\n public override copySync(srcPath: string, destPath: string) {\n this.#context.fs.copySync(srcPath, destPath);\n }\n\n public override async fileExists(filePath: string) {\n return this.#context.fs.isFile(filePath);\n }\n\n public override fileExistsSync(filePath: string) {\n return this.#context.fs.isFileSync(filePath);\n }\n\n public override async directoryExists(dirPath: string) {\n return this.#context.fs.isDirectory(dirPath);\n }\n\n public override directoryExistsSync(dirPath: string): boolean {\n return this.#context.fs.isDirectorySync(dirPath);\n }\n\n public override realpathSync(path: string) {\n return this.#context.fs.resolveSync(path) || path;\n }\n\n public override getCurrentDirectory() {\n return this.#context.config.cwd;\n }\n\n public override async glob(\n patterns: ReadonlyArray<string>\n ): Promise<string[]> {\n return this.#context.fs.glob(patterns as string[]);\n }\n\n public override globSync(patterns: ReadonlyArray<string>): string[] {\n return this.#context.fs.globSync(patterns as string[]);\n }\n}\n\n/**\n * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing\n *\n * @param context - The Powerlines context\n * @returns A ts-morph {@link Project} instance\n */\nexport function createProgram(\n context: Context,\n override: Partial<ProjectOptions>\n): Project {\n context.debug(\n `Creating ts-morph Project instance with configuration from: ${\n context.tsconfig.tsconfigFilePath\n }.`\n );\n\n const project = new Project(\n defu(override ?? {}, {\n skipAddingFilesFromTsConfig: false,\n tsConfigFilePath: context.tsconfig.tsconfigFilePath,\n fileSystem: new VirtualFileSystemHost(context),\n compilerOptions: defu(context.tsconfig.options ?? {}, {\n lib: [\"lib.esnext.full.d.ts\"]\n }) as CompilerOptions\n })\n );\n\n return project;\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAa,wBAAb,cACU,uBAEV;CACE;CAEA,AAAO,YAAY,SAAkB;EACnC,MAAM;EAEN,KAAKA,WAAW;CAClB;CAEA,AAAgB,WAAW,MAAc;EACvC,KAAKA,SAAS,GAAG,WAAW,IAAI;CAClC;CAEA,AAAgB,YAAY,SAAoC;EAC9D,IAAI,CAAC,KAAKA,SAAS,GAAG,gBAAgB,OAAO,GAC3C,OAAO,CAAC;EAGV,OAAO,KAAKA,SAAS,GAAG,SAAS,OAAO,EAAE,QAAQ,KAAK,UAAU;GAC/D,MAAM,WAAW,KAAKA,SAAS,GAAG,YAAY,KAAK;GACnD,IAAI,UACF,IAAI,KAAK;IACP,MAAM;IACN,aAAa,KAAKA,SAAS,GAAG,gBAAgB,QAAQ;IACtD,QAAQ,KAAKA,SAAS,GAAG,WAAW,QAAQ;IAC5C,WAAW;GACb,CAAC;GAGH,OAAO;EACT,GAAG,CAAC,CAAsB;CAC5B;CAEA,MAAsB,SAAS,UAAkB;EAC/C,IAAI,CAAC,KAAKA,SAAS,GAAG,WAAW,QAAQ,GACvC,OAAO;EAGT,OAAQ,MAAM,KAAKA,SAAS,GAAG,KAAK,QAAQ;CAC9C;CAEA,AAAgB,aAAa,UAAkB;EAC7C,IAAI,CAAC,KAAKA,SAAS,GAAG,WAAW,QAAQ,GACvC,OAAO;EAGT,OAAO,KAAKA,SAAS,GAAG,SAAS,QAAQ;CAC3C;CAEA,MAAsB,UAAU,UAAkB,UAAkB;EAClE,OAAO,KAAKA,SAAS,GAAG,MAAM,UAAU,QAAQ;CAClD;CAEA,AAAgB,cAAc,UAAkB,UAAkB;EAChE,KAAKA,SAAS,GAAG,UAAU,UAAU,QAA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a,QAClB,KAAK,YAAY,CAAC,GAAG;EACnB,6BAA6B;EAC7B,kBAAkB,QAAQ,SAAS;EACnC,YAAY,IAAI,sBAAsB,OAAO;EAC7C,iBAAiB,KAAK,QAAQ,SAAS,WAAW,CAAC,GAAG,EACpD,KAAK,CAAC,sBAAsB,EAC9B,CAAC;CACH,CAAC,CAGU;AACf"}
1
+ {"version":3,"file":"ts-morph.mjs","names":["#context"],"sources":["../../../src/lib/typescript/ts-morph.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 defu from \"defu\";\nimport {\n CompilerOptions,\n FileSystemHost,\n InMemoryFileSystemHost,\n Project,\n ProjectOptions,\n RuntimeDirEntry\n} from \"ts-morph\";\nimport type { Context } from \"../../types/context\";\n\nexport class VirtualFileSystemHost\n extends InMemoryFileSystemHost\n implements FileSystemHost\n{\n #context: Context;\n\n public constructor(context: Context) {\n super();\n\n this.#context = context;\n }\n\n public override deleteSync(path: string) {\n this.#context.fs.removeSync(path);\n }\n\n public override readDirSync(dirPath: string): RuntimeDirEntry[] {\n if (!this.#context.fs.isDirectorySync(dirPath)) {\n return [];\n }\n\n return this.#context.fs.listSync(dirPath).reduce((ret, entry) => {\n const fullPath = this.#context.fs.resolveSync(entry);\n if (fullPath) {\n ret.push({\n name: entry,\n isDirectory: this.#context.fs.isDirectorySync(fullPath),\n isFile: this.#context.fs.isFileSync(fullPath),\n isSymlink: false\n });\n }\n\n return ret;\n }, [] as RuntimeDirEntry[]);\n }\n\n public override async readFile(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return (await this.#context.fs.read(filePath))!;\n }\n\n public override readFileSync(filePath: string) {\n if (!this.#context.fs.isFileSync(filePath)) {\n return \"\";\n }\n\n return this.#context.fs.readSync(filePath)!;\n }\n\n public override async writeFile(filePath: string, fileText: string) {\n return this.#context.fs.write(filePath, fileText);\n }\n\n public override writeFileSync(filePath: string, fileText: string) {\n this.#context.fs.writeSync(filePath, fileText);\n }\n\n public override async mkdir(dirPath: string) {\n await this.#context.fs.mkdir(dirPath);\n }\n\n public override mkdirSync(dirPath: string) {\n this.#context.fs.mkdirSync(dirPath);\n }\n\n public override async move(srcPath: string, destPath: string) {\n await this.#context.fs.move(srcPath, destPath);\n }\n\n public override moveSync(srcPath: string, destPath: string) {\n this.#context.fs.moveSync(srcPath, destPath);\n }\n\n public override async copy(srcPath: string, destPath: string) {\n await this.#context.fs.copy(srcPath, destPath);\n }\n\n public override copySync(srcPath: string, destPath: string) {\n this.#context.fs.copySync(srcPath, destPath);\n }\n\n public override async fileExists(filePath: string) {\n return this.#context.fs.isFile(filePath);\n }\n\n public override fileExistsSync(filePath: string) {\n return this.#context.fs.isFileSync(filePath);\n }\n\n public override async directoryExists(dirPath: string) {\n return this.#context.fs.isDirectory(dirPath);\n }\n\n public override directoryExistsSync(dirPath: string): boolean {\n return this.#context.fs.isDirectorySync(dirPath);\n }\n\n public override realpathSync(path: string) {\n return this.#context.fs.resolveSync(path) || path;\n }\n\n public override getCurrentDirectory() {\n return this.#context.config.cwd;\n }\n\n public override async glob(\n patterns: ReadonlyArray<string>\n ): Promise<string[]> {\n return this.#context.fs.glob(patterns as string[]);\n }\n\n public override globSync(patterns: ReadonlyArray<string>): string[] {\n return this.#context.fs.globSync(patterns as string[]);\n }\n}\n\n/**\n * Create a ts-morph {@link Project} instance used for type reflection and module manipulation during processing\n *\n * @param context - The Powerlines context\n * @returns A ts-morph {@link Project} instance\n */\nexport function createProgram(\n context: Context,\n override: Partial<ProjectOptions>\n): Project {\n context.debug(\n `Creating ts-morph Project instance with configuration from: ${\n context.tsconfig.tsconfigFilePath\n }.`\n );\n\n const project = new Project(\n defu(override ?? {}, {\n skipAddingFilesFromTsConfig: false,\n tsConfigFilePath: context.tsconfig.tsconfigFilePath,\n fileSystem: new VirtualFileSystemHost(context),\n compilerOptions: defu(context.tsconfig.options ?? {}, {\n lib: [\"lib.esnext.full.d.ts\"]\n }) as CompilerOptions\n })\n );\n\n return project;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,IAAa,wBAAb,cACU,uBAEV;CACE;CAEA,AAAO,YAAY,SAAkB;EACnC,MAAM;EAEN,KAAKA,WAAW;CAClB;CAEA,AAAgB,WAAW,MAAc;EACvC,KAAKA,SAAS,GAAG,WAAW,IAAI;CAClC;CAEA,AAAgB,YAAY,SAAoC;EAC9D,IAAI,CAAC,KAAKA,SAAS,GAAG,gBAAgB,OAAO,GAC3C,OAAO,CAAC;EAGV,OAAO,KAAKA,SAAS,GAAG,SAAS,OAAO,EAAE,QAAQ,KAAK,UAAU;GAC/D,MAAM,WAAW,KAAKA,SAAS,GAAG,YAAY,KAAK;GACnD,IAAI,UACF,IAAI,KAAK;IACP,MAAM;IACN,aAAa,KAAKA,SAAS,GAAG,gBAAgB,QAAQ;IACtD,QAAQ,KAAKA,SAAS,GAAG,WAAW,QAAQ;IAC5C,WAAW;GACb,CAAC;GAGH,OAAO;EACT,GAAG,CAAC,CAAsB;CAC5B;CAEA,MAAsB,SAAS,UAAkB;EAC/C,IAAI,CAAC,KAAKA,SAAS,GAAG,WAAW,QAAQ,GACvC,OAAO;EAGT,OAAQ,MAAM,KAAKA,SAAS,GAAG,KAAK,QAAQ;CAC9C;CAEA,AAAgB,aAAa,UAAkB;EAC7C,IAAI,CAAC,KAAKA,SAAS,GAAG,WAAW,QAAQ,GACvC,OAAO;EAGT,OAAO,KAAKA,SAAS,GAAG,SAAS,QAAQ;CAC3C;CAEA,MAAsB,UAAU,UAAkB,UAAk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AAS,GAAG,SAAS,QAAoB;CACvD;AACF;;;;;;;AAQA,SAAgB,cACd,SACA,UACS;CACT,QAAQ,MACN,+DACE,QAAQ,SAAS,iBAClB,EACH;CAaA,OAAO,IAXa,QAClB,KAAK,YAAY,CAAC,GAAG;EACnB,6BAA6B;EAC7B,kBAAkB,QAAQ,SAAS;EACnC,YAAY,IAAI,sBAAsB,OAAO;EAC7C,iBAAiB,KAAK,QAAQ,SAAS,WAAW,CAAC,GAAG,EACpD,KAAK,CAAC,sBAAsB,EAC9B,CAAC;CACH,CAAC,CAGU;AACf"}
@@ -0,0 +1,23 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ const require_lib_typescript_ts_morph = require('./ts-morph.cjs');
10
+ let vitest = require("vitest");
11
+
12
+ //#region src/lib/typescript/ts-morph.test.ts
13
+ (0, vitest.describe)("base/core/src/lib/typescript/ts-morph.ts", () => {
14
+ (0, vitest.it)("loads module exports", () => {
15
+ (0, vitest.expect)(require_lib_typescript_ts_morph.ts_morph_exports).toBeDefined();
16
+ (0, vitest.expect)(typeof require_lib_typescript_ts_morph.ts_morph_exports).toBe("object");
17
+ });
18
+ (0, vitest.it)("has at least one runtime export", () => {
19
+ (0, vitest.expect)(Object.keys(require_lib_typescript_ts_morph.ts_morph_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
@@ -0,0 +1,25 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ import { ts_morph_exports } from "./ts-morph.mjs";
10
+ import { describe, expect, it } from "vitest";
11
+
12
+ //#region src/lib/typescript/ts-morph.test.ts
13
+ describe("base/core/src/lib/typescript/ts-morph.ts", () => {
14
+ it("loads module exports", () => {
15
+ expect(ts_morph_exports).toBeDefined();
16
+ expect(typeof ts_morph_exports).toBe("object");
17
+ });
18
+ it("has at least one runtime export", () => {
19
+ expect(Object.keys(ts_morph_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
24
+ export { };
25
+ //# sourceMappingURL=ts-morph.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-morph.test.mjs","names":["moduleExports"],"sources":["../../../src/lib/typescript/ts-morph.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./ts-morph\";\n\ndescribe(\"base/core/src/lib/typescript/ts-morph.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,kDAAkD;CACzD,GAAG,8BAA8B;EAC/B,OAAOA,gBAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,gBAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,gBAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
@@ -25,6 +25,18 @@ let typescript = require("typescript");
25
25
  typescript = require_runtime.__toESM(typescript, 1);
26
26
 
27
27
  //#region src/lib/typescript/tsconfig.ts
28
+ var tsconfig_exports = /* @__PURE__ */ require_runtime.__exportAll({
29
+ findIncludeMatch: () => findIncludeMatch,
30
+ findMatch: () => findMatch,
31
+ getParsedTypeScriptConfig: () => getParsedTypeScriptConfig,
32
+ getTsconfigDtsPath: () => getTsconfigDtsPath,
33
+ getTsconfigFilePath: () => getTsconfigFilePath,
34
+ initializeTsconfig: () => initializeTsconfig,
35
+ isIncludeMatchFound: () => isIncludeMatchFound,
36
+ isMatchFound: () => isMatchFound,
37
+ resolveTsconfig: () => resolveTsconfig,
38
+ tryTsconfigFilePath: () => tryTsconfigFilePath
39
+ });
28
40
  function getTsconfigDtsPath(context) {
29
41
  return (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_join_paths.joinPaths)(context.config.cwd, context.config.root), (0, _stryke_path_file_path_fns.findFilePath)(context.typesPath)), (0, _stryke_path_file_path_fns.findFileName)(context.typesPath));
30
42
  }
@@ -258,4 +270,10 @@ exports.initializeTsconfig = initializeTsconfig;
258
270
  exports.isIncludeMatchFound = isIncludeMatchFound;
259
271
  exports.isMatchFound = isMatchFound;
260
272
  exports.resolveTsconfig = resolveTsconfig;
261
- exports.tryTsconfigFilePath = tryTsconfigFilePath;
273
+ exports.tryTsconfigFilePath = tryTsconfigFilePath;
274
+ Object.defineProperty(exports, 'tsconfig_exports', {
275
+ enumerable: true,
276
+ get: function () {
277
+ return tsconfig_exports;
278
+ }
279
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"tsconfig.d.cts","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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,mBAAA,CACd,GAAA,UACA,IAAA,UACA,QAAA;;;;;;;;;;iBAmCc,mBAAA,CACd,GAAA,UACA,IAAA,UACA,QAAA;;;;;;;AA9V4D;iBAqX9C,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;;;;;;;;iBAYT,mBAAA,CACd,YAAA,EAAc,aAAA,EACd,KAAA,EAAO,aAAa;;;;;;AA/TO;AA2C7B;;;;;iBAySgB,yBAAA,CACd,aAAA,UACA,WAAA,UACA,QAAA,WACA,WAAA,GAAa,QAAA,EACb,oBAAA,GAAuB,QAAA,EACvB,IAAA,GAAM,EAAA,CAAG,eAAA,GACR,sBAAA"}
@@ -6,6 +6,7 @@ import __tsdown_shims_url from 'node:url'
6
6
  const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
7
  const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
8
 
9
+ import { __exportAll } from "../../_virtual/_rolldown/runtime.mjs";
9
10
  import { existsSync } from "@stryke/fs/exists";
10
11
  import { readJsonFile, readJsonFileSync } from "@stryke/fs/json";
11
12
  import { appendPath } from "@stryke/path/append";
@@ -20,6 +21,18 @@ import { StormJSON } from "@stryke/json/storm-json";
20
21
  import ts from "typescript";
21
22
 
22
23
  //#region src/lib/typescript/tsconfig.ts
24
+ var tsconfig_exports = /* @__PURE__ */ __exportAll({
25
+ findIncludeMatch: () => findIncludeMatch,
26
+ findMatch: () => findMatch,
27
+ getParsedTypeScriptConfig: () => getParsedTypeScriptConfig,
28
+ getTsconfigDtsPath: () => getTsconfigDtsPath,
29
+ getTsconfigFilePath: () => getTsconfigFilePath,
30
+ initializeTsconfig: () => initializeTsconfig,
31
+ isIncludeMatchFound: () => isIncludeMatchFound,
32
+ isMatchFound: () => isMatchFound,
33
+ resolveTsconfig: () => resolveTsconfig,
34
+ tryTsconfigFilePath: () => tryTsconfigFilePath
35
+ });
23
36
  function getTsconfigDtsPath(context) {
24
37
  return joinPaths(relativePath(joinPaths(context.config.cwd, context.config.root), findFilePath(context.typesPath)), findFileName(context.typesPath));
25
38
  }
@@ -244,5 +257,5 @@ ${parsedCommandLine.errors.map((error) => `- ${(error.category !== void 0 && err
244
257
  }
245
258
 
246
259
  //#endregion
247
- export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigDtsPath, getTsconfigFilePath, initializeTsconfig, isIncludeMatchFound, isMatchFound, resolveTsconfig, tryTsconfigFilePath };
260
+ export { findIncludeMatch, findMatch, getParsedTypeScriptConfig, getTsconfigDtsPath, getTsconfigFilePath, initializeTsconfig, isIncludeMatchFound, isMatchFound, resolveTsconfig, tryTsconfigFilePath, tsconfig_exports };
248
261
  //# sourceMappingURL=tsconfig.mjs.map
@@ -1 +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":";;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,mBAGd,SAAsE;CAStE,OARwB,UACtB,aACE,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,GACjD,aAAa,QAAQ,SAAS,CAChC,GACA,aAAa,QAAQ,SAAS,CAGX;AACvB;AAEA,eAAe,uBAIb,SACuB;CACvB,MAAM,WAAW,0BACf,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,QAAQ,OAAO,UACf,QAAQ,OAAO,WACjB;CAQA,MAAM,eAAe,MAAM,aANF,oBACvB,QAAQ,OAAO,KACf,QAAQ,OAAO,MACf,QAAQ,OAAO,QAGoD,CAAC;CACtE,aAAa,oBAAoB,CAAC;CAElC,IAAI,QAAQ,OAAO,OAAO,QAAQ,OAAO;EACvC,MAAM,kBAAkB,mBAAmB,OAAO;EAElD,IACE,CAAC,aAAa,SAAS,MAAK,gBAC1B,oBAAoB,aAAa,CAAC,QAAQ,WAAW,eAAe,CAAC,CACvE,GACA;GACA,aAAa,YAAY,CAAC;GAC1B,aAAa,QAAQ,KACnB,gBAAgB,WAAW,IAAI,IAC3B,gBAAgB,MAAM,CAAC,IACvB,eACN;EACF;CACF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ACrB;EACF;EACA;CACF;AACF"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,mBAGd,SAAsE;CAStE,OARwB,UACtB,aACE,UAAU,QAAQ,OAAO,KAAK,QAAQ,OAAO,IAAI,GACjD,aAAa,QAAQ,SAAS,CAChC,GACA,aAAa,QAAQ,SAAS,CAG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AG,KACN;CACxB,MAAM,mBAAmB,oBACvB,eACA,aACA,QACF;CACA,MAAM,eAAe,iBAA2B,gBAAgB;CAChE,IAAI,CAAC,cACH,MAAM,IAAI,MACR,2DAA2D,UACzD,aACA,YAAY,eACd,GACF;CAGF,MAAM,oBAAoB,GAAG,2BAC3B,KAAK,eAAe,CAAC,GAAG,YAAY,GACpC,MACA,WAAW,aAAa,aAAa,CACvC;CACA,IAAI,kBAAkB,OAAO,SAAS,GAAG;EACvC,MAAM,eAAe;EACvB,kBAAkB,OACjB,KACC,UACE,MACG,MAAM,aAAa,UAAa,MAAM,OACnC,IAAI,MAAM,SAAS,GAAG,MAAM,KAAK,OACjC,MAAM,MAAM,YAAY,SAAS,GAE3C,EACC,KAAK,IAAI,EAAE;;EAGV,MAAM,IAAI,MAAM,YAAY;CAC9B;CAEA,OAAO;EACL,GAAG;EACH,sBAAuB,wBACrB;EACF;EACA;CACF;AACF"}
@@ -0,0 +1,23 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ const require_lib_typescript_tsconfig = require('./tsconfig.cjs');
10
+ let vitest = require("vitest");
11
+
12
+ //#region src/lib/typescript/tsconfig.test.ts
13
+ (0, vitest.describe)("base/core/src/lib/typescript/tsconfig.ts", () => {
14
+ (0, vitest.it)("loads module exports", () => {
15
+ (0, vitest.expect)(require_lib_typescript_tsconfig.tsconfig_exports).toBeDefined();
16
+ (0, vitest.expect)(typeof require_lib_typescript_tsconfig.tsconfig_exports).toBe("object");
17
+ });
18
+ (0, vitest.it)("has at least one runtime export", () => {
19
+ (0, vitest.expect)(Object.keys(require_lib_typescript_tsconfig.tsconfig_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import __tsdown_shims_path from 'node:path';
2
+ import __tsdown_shims_url from 'node:url';
@@ -0,0 +1,25 @@
1
+
2
+
3
+ import __tsdown_shims_path from 'node:path'
4
+ import __tsdown_shims_url from 'node:url'
5
+
6
+ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
7
+ const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
+
9
+ import { tsconfig_exports } from "./tsconfig.mjs";
10
+ import { describe, expect, it } from "vitest";
11
+
12
+ //#region src/lib/typescript/tsconfig.test.ts
13
+ describe("base/core/src/lib/typescript/tsconfig.ts", () => {
14
+ it("loads module exports", () => {
15
+ expect(tsconfig_exports).toBeDefined();
16
+ expect(typeof tsconfig_exports).toBe("object");
17
+ });
18
+ it("has at least one runtime export", () => {
19
+ expect(Object.keys(tsconfig_exports).length).toBeGreaterThan(0);
20
+ });
21
+ });
22
+
23
+ //#endregion
24
+ export { };
25
+ //# sourceMappingURL=tsconfig.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tsconfig.test.mjs","names":["moduleExports"],"sources":["../../../src/lib/typescript/tsconfig.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./tsconfig\";\n\ndescribe(\"base/core/src/lib/typescript/tsconfig.ts\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n\n it(\"has at least one runtime export\", () => {\n expect(Object.keys(moduleExports).length).toBeGreaterThan(0);\n });\n});\n"],"mappings":";;;;;;;;;;;;AAGA,SAAS,kDAAkD;CACzD,GAAG,8BAA8B;EAC/B,OAAOA,gBAAa,EAAE,YAAY;EAClC,OAAO,OAAOA,gBAAa,EAAE,KAAK,QAAQ;CAC5C,CAAC;CAED,GAAG,yCAAyC;EAC1C,OAAO,OAAO,KAAKA,gBAAa,EAAE,MAAM,EAAE,gBAAgB,CAAC;CAC7D,CAAC;AACH,CAAC"}
@@ -7,11 +7,16 @@ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPat
7
7
  const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
8
8
 
9
9
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
10
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
10
11
  const require_constants_plugin = require('../../constants/plugin.cjs');
11
12
  let defu = require("defu");
12
13
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
13
14
 
14
15
  //#region src/lib/unplugin/helpers.ts
16
+ var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
17
+ combineContexts: () => combineContexts,
18
+ isUnpluginBuilderVariant: () => isUnpluginBuilderVariant
19
+ });
15
20
  /**
16
21
  * Merges a base plugin context with an unplugin context, combining their properties.
17
22
  *
@@ -34,4 +39,10 @@ function isUnpluginBuilderVariant(str) {
34
39
 
35
40
  //#endregion
36
41
  exports.combineContexts = combineContexts;
42
+ Object.defineProperty(exports, 'helpers_exports', {
43
+ enumerable: true,
44
+ get: function () {
45
+ return helpers_exports;
46
+ }
47
+ });
37
48
  exports.isUnpluginBuilderVariant = isUnpluginBuilderVariant;
@@ -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,sBAAsB"}
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,EACtC,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,SAAA,GAAY,SAAA,GAAY,SAAA;;;;;;;iBAUzC,wBAAA,CACd,GAAA,YACC,GAAA,IAAO,sBAAsB"}