@seasb/metafab 0.0.1 → 2.0.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/README.md +46 -1
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.js +419 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/build.d.ts +31 -0
  6. package/dist/commands/build.js +156 -0
  7. package/dist/commands/build.js.map +1 -0
  8. package/dist/commands/check.d.ts +2 -0
  9. package/dist/commands/check.js +52 -0
  10. package/dist/commands/check.js.map +1 -0
  11. package/dist/commands/create.d.ts +2 -0
  12. package/dist/commands/create.js +75 -0
  13. package/dist/commands/create.js.map +1 -0
  14. package/dist/commands/detach.d.ts +2 -0
  15. package/dist/commands/detach.js +24 -0
  16. package/dist/commands/detach.js.map +1 -0
  17. package/dist/commands/diff.d.ts +2 -0
  18. package/dist/commands/diff.js +35 -0
  19. package/dist/commands/diff.js.map +1 -0
  20. package/dist/commands/env.d.ts +4 -0
  21. package/dist/commands/env.js +362 -0
  22. package/dist/commands/env.js.map +1 -0
  23. package/dist/commands/import.d.ts +2 -0
  24. package/dist/commands/import.js +107 -0
  25. package/dist/commands/import.js.map +1 -0
  26. package/dist/commands/init.d.ts +2 -0
  27. package/dist/commands/init.js +77 -0
  28. package/dist/commands/init.js.map +1 -0
  29. package/dist/commands/map.d.ts +2 -0
  30. package/dist/commands/map.js +42 -0
  31. package/dist/commands/map.js.map +1 -0
  32. package/dist/commands/pipeline-add.d.ts +2 -0
  33. package/dist/commands/pipeline-add.js +68 -0
  34. package/dist/commands/pipeline-add.js.map +1 -0
  35. package/dist/commands/pipeline-remove.d.ts +2 -0
  36. package/dist/commands/pipeline-remove.js +45 -0
  37. package/dist/commands/pipeline-remove.js.map +1 -0
  38. package/dist/commands/publish.d.ts +2 -0
  39. package/dist/commands/publish.js +153 -0
  40. package/dist/commands/publish.js.map +1 -0
  41. package/dist/commands/types.d.ts +45 -0
  42. package/dist/commands/types.js +2 -0
  43. package/dist/commands/types.js.map +1 -0
  44. package/dist/commands/update.d.ts +2 -0
  45. package/dist/commands/update.js +97 -0
  46. package/dist/commands/update.js.map +1 -0
  47. package/dist/core/adopt.d.ts +53 -0
  48. package/dist/core/adopt.js +676 -0
  49. package/dist/core/adopt.js.map +1 -0
  50. package/dist/core/build/agents.d.ts +26 -0
  51. package/dist/core/build/agents.js +67 -0
  52. package/dist/core/build/agents.js.map +1 -0
  53. package/dist/core/build/index.d.ts +5 -0
  54. package/dist/core/build/index.js +6 -0
  55. package/dist/core/build/index.js.map +1 -0
  56. package/dist/core/build/markers.d.ts +34 -0
  57. package/dist/core/build/markers.js +97 -0
  58. package/dist/core/build/markers.js.map +1 -0
  59. package/dist/core/build/plan.d.ts +82 -0
  60. package/dist/core/build/plan.js +912 -0
  61. package/dist/core/build/plan.js.map +1 -0
  62. package/dist/core/build/preview.d.ts +39 -0
  63. package/dist/core/build/preview.js +344 -0
  64. package/dist/core/build/preview.js.map +1 -0
  65. package/dist/core/build/skill.d.ts +99 -0
  66. package/dist/core/build/skill.js +354 -0
  67. package/dist/core/build/skill.js.map +1 -0
  68. package/dist/core/check/drift.d.ts +13 -0
  69. package/dist/core/check/drift.js +205 -0
  70. package/dist/core/check/drift.js.map +1 -0
  71. package/dist/core/check/index.d.ts +16 -0
  72. package/dist/core/check/index.js +84 -0
  73. package/dist/core/check/index.js.map +1 -0
  74. package/dist/core/check/markers.d.ts +9 -0
  75. package/dist/core/check/markers.js +220 -0
  76. package/dist/core/check/markers.js.map +1 -0
  77. package/dist/core/config/destinations.d.ts +5 -0
  78. package/dist/core/config/destinations.js +20 -0
  79. package/dist/core/config/destinations.js.map +1 -0
  80. package/dist/core/config/load.d.ts +4 -0
  81. package/dist/core/config/load.js +41 -0
  82. package/dist/core/config/load.js.map +1 -0
  83. package/dist/core/config/parse.d.ts +8 -0
  84. package/dist/core/config/parse.js +201 -0
  85. package/dist/core/config/parse.js.map +1 -0
  86. package/dist/core/config/source.d.ts +25 -0
  87. package/dist/core/config/source.js +67 -0
  88. package/dist/core/config/source.js.map +1 -0
  89. package/dist/core/config/types.d.ts +48 -0
  90. package/dist/core/config/types.js +2 -0
  91. package/dist/core/config/types.js.map +1 -0
  92. package/dist/core/config/validate.d.ts +11 -0
  93. package/dist/core/config/validate.js +389 -0
  94. package/dist/core/config/validate.js.map +1 -0
  95. package/dist/core/config/writers.d.ts +14 -0
  96. package/dist/core/config/writers.js +269 -0
  97. package/dist/core/config/writers.js.map +1 -0
  98. package/dist/core/config.d.ts +7 -0
  99. package/dist/core/config.js +8 -0
  100. package/dist/core/config.js.map +1 -0
  101. package/dist/core/discovery.d.ts +34 -0
  102. package/dist/core/discovery.js +272 -0
  103. package/dist/core/discovery.js.map +1 -0
  104. package/dist/core/edit/create.d.ts +18 -0
  105. package/dist/core/edit/create.js +190 -0
  106. package/dist/core/edit/create.js.map +1 -0
  107. package/dist/core/edit/document.d.ts +4 -0
  108. package/dist/core/edit/document.js +16 -0
  109. package/dist/core/edit/document.js.map +1 -0
  110. package/dist/core/edit/factory-yaml.d.ts +17 -0
  111. package/dist/core/edit/factory-yaml.js +213 -0
  112. package/dist/core/edit/factory-yaml.js.map +1 -0
  113. package/dist/core/edit/files.d.ts +6 -0
  114. package/dist/core/edit/files.js +47 -0
  115. package/dist/core/edit/files.js.map +1 -0
  116. package/dist/core/edit/index.d.ts +9 -0
  117. package/dist/core/edit/index.js +10 -0
  118. package/dist/core/edit/index.js.map +1 -0
  119. package/dist/core/edit/map.d.ts +24 -0
  120. package/dist/core/edit/map.js +82 -0
  121. package/dist/core/edit/map.js.map +1 -0
  122. package/dist/core/edit/names.d.ts +2 -0
  123. package/dist/core/edit/names.js +17 -0
  124. package/dist/core/edit/names.js.map +1 -0
  125. package/dist/core/edit/paths.d.ts +8 -0
  126. package/dist/core/edit/paths.js +81 -0
  127. package/dist/core/edit/paths.js.map +1 -0
  128. package/dist/core/edit/pipeline.d.ts +19 -0
  129. package/dist/core/edit/pipeline.js +152 -0
  130. package/dist/core/edit/pipeline.js.map +1 -0
  131. package/dist/core/edit/skill.d.ts +1 -0
  132. package/dist/core/edit/skill.js +10 -0
  133. package/dist/core/edit/skill.js.map +1 -0
  134. package/dist/core/env/condition.d.ts +40 -0
  135. package/dist/core/env/condition.js +283 -0
  136. package/dist/core/env/condition.js.map +1 -0
  137. package/dist/core/env/declarations.d.ts +16 -0
  138. package/dist/core/env/declarations.js +328 -0
  139. package/dist/core/env/declarations.js.map +1 -0
  140. package/dist/core/env/directives.d.ts +75 -0
  141. package/dist/core/env/directives.js +429 -0
  142. package/dist/core/env/directives.js.map +1 -0
  143. package/dist/core/env/git-config.d.ts +15 -0
  144. package/dist/core/env/git-config.js +110 -0
  145. package/dist/core/env/git-config.js.map +1 -0
  146. package/dist/core/env/imports.d.ts +60 -0
  147. package/dist/core/env/imports.js +217 -0
  148. package/dist/core/env/imports.js.map +1 -0
  149. package/dist/core/env/index.d.ts +6 -0
  150. package/dist/core/env/index.js +7 -0
  151. package/dist/core/env/index.js.map +1 -0
  152. package/dist/core/env/markdown.d.ts +22 -0
  153. package/dist/core/env/markdown.js +33 -0
  154. package/dist/core/env/markdown.js.map +1 -0
  155. package/dist/core/env/render.d.ts +13 -0
  156. package/dist/core/env/render.js +65 -0
  157. package/dist/core/env/render.js.map +1 -0
  158. package/dist/core/env/report.d.ts +29 -0
  159. package/dist/core/env/report.js +39 -0
  160. package/dist/core/env/report.js.map +1 -0
  161. package/dist/core/env/scenarios.d.ts +40 -0
  162. package/dist/core/env/scenarios.js +124 -0
  163. package/dist/core/env/scenarios.js.map +1 -0
  164. package/dist/core/env/select.d.ts +30 -0
  165. package/dist/core/env/select.js +191 -0
  166. package/dist/core/env/select.js.map +1 -0
  167. package/dist/core/env/types.d.ts +38 -0
  168. package/dist/core/env/types.js +2 -0
  169. package/dist/core/env/types.js.map +1 -0
  170. package/dist/core/env/validate.d.ts +25 -0
  171. package/dist/core/env/validate.js +212 -0
  172. package/dist/core/env/validate.js.map +1 -0
  173. package/dist/core/factory/discovery.d.ts +9 -0
  174. package/dist/core/factory/discovery.js +139 -0
  175. package/dist/core/factory/discovery.js.map +1 -0
  176. package/dist/core/factory/factory-yaml.d.ts +29 -0
  177. package/dist/core/factory/factory-yaml.js +538 -0
  178. package/dist/core/factory/factory-yaml.js.map +1 -0
  179. package/dist/core/factory/index.d.ts +5 -0
  180. package/dist/core/factory/index.js +6 -0
  181. package/dist/core/factory/index.js.map +1 -0
  182. package/dist/core/factory/lines.d.ts +8 -0
  183. package/dist/core/factory/lines.js +11 -0
  184. package/dist/core/factory/lines.js.map +1 -0
  185. package/dist/core/factory/load.d.ts +4 -0
  186. package/dist/core/factory/load.js +83 -0
  187. package/dist/core/factory/load.js.map +1 -0
  188. package/dist/core/factory/requires.d.ts +9 -0
  189. package/dist/core/factory/requires.js +123 -0
  190. package/dist/core/factory/requires.js.map +1 -0
  191. package/dist/core/factory/types.d.ts +58 -0
  192. package/dist/core/factory/types.js +2 -0
  193. package/dist/core/factory/types.js.map +1 -0
  194. package/dist/core/factory/validate.d.ts +44 -0
  195. package/dist/core/factory/validate.js +460 -0
  196. package/dist/core/factory/validate.js.map +1 -0
  197. package/dist/core/hooks/index.d.ts +8 -0
  198. package/dist/core/hooks/index.js +15 -0
  199. package/dist/core/hooks/index.js.map +1 -0
  200. package/dist/core/hooks/script.d.ts +21 -0
  201. package/dist/core/hooks/script.js +34 -0
  202. package/dist/core/hooks/script.js.map +1 -0
  203. package/dist/core/hooks/sync.d.ts +17 -0
  204. package/dist/core/hooks/sync.js +262 -0
  205. package/dist/core/hooks/sync.js.map +1 -0
  206. package/dist/core/import/conflicts.d.ts +82 -0
  207. package/dist/core/import/conflicts.js +256 -0
  208. package/dist/core/import/conflicts.js.map +1 -0
  209. package/dist/core/import/copy.d.ts +10 -0
  210. package/dist/core/import/copy.js +76 -0
  211. package/dist/core/import/copy.js.map +1 -0
  212. package/dist/core/import/file-tree.d.ts +43 -0
  213. package/dist/core/import/file-tree.js +107 -0
  214. package/dist/core/import/file-tree.js.map +1 -0
  215. package/dist/core/import/index.d.ts +5 -0
  216. package/dist/core/import/index.js +6 -0
  217. package/dist/core/import/index.js.map +1 -0
  218. package/dist/core/import/pipeline-changes.d.ts +8 -0
  219. package/dist/core/import/pipeline-changes.js +89 -0
  220. package/dist/core/import/pipeline-changes.js.map +1 -0
  221. package/dist/core/import/run.d.ts +76 -0
  222. package/dist/core/import/run.js +275 -0
  223. package/dist/core/import/run.js.map +1 -0
  224. package/dist/core/init/gitattributes.d.ts +20 -0
  225. package/dist/core/init/gitattributes.js +89 -0
  226. package/dist/core/init/gitattributes.js.map +1 -0
  227. package/dist/core/init/index.d.ts +4 -0
  228. package/dist/core/init/index.js +5 -0
  229. package/dist/core/init/index.js.map +1 -0
  230. package/dist/core/init/name.d.ts +1 -0
  231. package/dist/core/init/name.js +4 -0
  232. package/dist/core/init/name.js.map +1 -0
  233. package/dist/core/init/run.d.ts +51 -0
  234. package/dist/core/init/run.js +261 -0
  235. package/dist/core/init/run.js.map +1 -0
  236. package/dist/core/init/targets.d.ts +17 -0
  237. package/dist/core/init/targets.js +87 -0
  238. package/dist/core/init/targets.js.map +1 -0
  239. package/dist/core/merge.d.ts +88 -0
  240. package/dist/core/merge.js +239 -0
  241. package/dist/core/merge.js.map +1 -0
  242. package/dist/core/publish/exclude.d.ts +9 -0
  243. package/dist/core/publish/exclude.js +32 -0
  244. package/dist/core/publish/exclude.js.map +1 -0
  245. package/dist/core/publish/git-target.d.ts +32 -0
  246. package/dist/core/publish/git-target.js +460 -0
  247. package/dist/core/publish/git-target.js.map +1 -0
  248. package/dist/core/publish/index.d.ts +10 -0
  249. package/dist/core/publish/index.js +11 -0
  250. package/dist/core/publish/index.js.map +1 -0
  251. package/dist/core/publish/npm-target.d.ts +15 -0
  252. package/dist/core/publish/npm-target.js +177 -0
  253. package/dist/core/publish/npm-target.js.map +1 -0
  254. package/dist/core/publish/package-json.d.ts +31 -0
  255. package/dist/core/publish/package-json.js +74 -0
  256. package/dist/core/publish/package-json.js.map +1 -0
  257. package/dist/core/publish/prepare.d.ts +35 -0
  258. package/dist/core/publish/prepare.js +102 -0
  259. package/dist/core/publish/prepare.js.map +1 -0
  260. package/dist/core/publish/provenance.d.ts +1 -0
  261. package/dist/core/publish/provenance.js +20 -0
  262. package/dist/core/publish/provenance.js.map +1 -0
  263. package/dist/core/publish/publish.d.ts +13 -0
  264. package/dist/core/publish/publish.js +143 -0
  265. package/dist/core/publish/publish.js.map +1 -0
  266. package/dist/core/publish/readme.d.ts +22 -0
  267. package/dist/core/publish/readme.js +109 -0
  268. package/dist/core/publish/readme.js.map +1 -0
  269. package/dist/core/publish/stage.d.ts +19 -0
  270. package/dist/core/publish/stage.js +333 -0
  271. package/dist/core/publish/stage.js.map +1 -0
  272. package/dist/core/publish/types.d.ts +71 -0
  273. package/dist/core/publish/types.js +2 -0
  274. package/dist/core/publish/types.js.map +1 -0
  275. package/dist/core/requires/check.d.ts +15 -0
  276. package/dist/core/requires/check.js +83 -0
  277. package/dist/core/requires/check.js.map +1 -0
  278. package/dist/core/requires/index.d.ts +4 -0
  279. package/dist/core/requires/index.js +5 -0
  280. package/dist/core/requires/index.js.map +1 -0
  281. package/dist/core/requires/inspect.d.ts +44 -0
  282. package/dist/core/requires/inspect.js +114 -0
  283. package/dist/core/requires/inspect.js.map +1 -0
  284. package/dist/core/requires/paths.d.ts +29 -0
  285. package/dist/core/requires/paths.js +83 -0
  286. package/dist/core/requires/paths.js.map +1 -0
  287. package/dist/core/requires/setup.d.ts +37 -0
  288. package/dist/core/requires/setup.js +147 -0
  289. package/dist/core/requires/setup.js.map +1 -0
  290. package/dist/core/setup.d.ts +27 -0
  291. package/dist/core/setup.js +84 -0
  292. package/dist/core/setup.js.map +1 -0
  293. package/dist/core/sources/cache.d.ts +38 -0
  294. package/dist/core/sources/cache.js +264 -0
  295. package/dist/core/sources/cache.js.map +1 -0
  296. package/dist/core/sources/containment.d.ts +21 -0
  297. package/dist/core/sources/containment.js +50 -0
  298. package/dist/core/sources/containment.js.map +1 -0
  299. package/dist/core/sources/env.d.ts +12 -0
  300. package/dist/core/sources/env.js +28 -0
  301. package/dist/core/sources/env.js.map +1 -0
  302. package/dist/core/sources/extract.d.ts +25 -0
  303. package/dist/core/sources/extract.js +639 -0
  304. package/dist/core/sources/extract.js.map +1 -0
  305. package/dist/core/sources/git-process.d.ts +26 -0
  306. package/dist/core/sources/git-process.js +51 -0
  307. package/dist/core/sources/git-process.js.map +1 -0
  308. package/dist/core/sources/git.d.ts +41 -0
  309. package/dist/core/sources/git.js +525 -0
  310. package/dist/core/sources/git.js.map +1 -0
  311. package/dist/core/sources/https.d.ts +21 -0
  312. package/dist/core/sources/https.js +218 -0
  313. package/dist/core/sources/https.js.map +1 -0
  314. package/dist/core/sources/index.d.ts +13 -0
  315. package/dist/core/sources/index.js +14 -0
  316. package/dist/core/sources/index.js.map +1 -0
  317. package/dist/core/sources/npm-cli.d.ts +19 -0
  318. package/dist/core/sources/npm-cli.js +51 -0
  319. package/dist/core/sources/npm-cli.js.map +1 -0
  320. package/dist/core/sources/npm.d.ts +29 -0
  321. package/dist/core/sources/npm.js +411 -0
  322. package/dist/core/sources/npm.js.map +1 -0
  323. package/dist/core/sources/parse.d.ts +46 -0
  324. package/dist/core/sources/parse.js +446 -0
  325. package/dist/core/sources/parse.js.map +1 -0
  326. package/dist/core/sources/path.d.ts +10 -0
  327. package/dist/core/sources/path.js +331 -0
  328. package/dist/core/sources/path.js.map +1 -0
  329. package/dist/core/sources/problems.d.ts +29 -0
  330. package/dist/core/sources/problems.js +36 -0
  331. package/dist/core/sources/problems.js.map +1 -0
  332. package/dist/core/sources/redact.d.ts +2 -0
  333. package/dist/core/sources/redact.js +70 -0
  334. package/dist/core/sources/redact.js.map +1 -0
  335. package/dist/core/sources/resolve.d.ts +9 -0
  336. package/dist/core/sources/resolve.js +29 -0
  337. package/dist/core/sources/resolve.js.map +1 -0
  338. package/dist/core/sources/types.d.ts +86 -0
  339. package/dist/core/sources/types.js +2 -0
  340. package/dist/core/sources/types.js.map +1 -0
  341. package/dist/core/sources/validate.d.ts +9 -0
  342. package/dist/core/sources/validate.js +116 -0
  343. package/dist/core/sources/validate.js.map +1 -0
  344. package/dist/core/summary.d.ts +79 -0
  345. package/dist/core/summary.js +411 -0
  346. package/dist/core/summary.js.map +1 -0
  347. package/dist/core/update/clashes.d.ts +63 -0
  348. package/dist/core/update/clashes.js +192 -0
  349. package/dist/core/update/clashes.js.map +1 -0
  350. package/dist/core/update/detach.d.ts +21 -0
  351. package/dist/core/update/detach.js +38 -0
  352. package/dist/core/update/detach.js.map +1 -0
  353. package/dist/core/update/diff.d.ts +58 -0
  354. package/dist/core/update/diff.js +180 -0
  355. package/dist/core/update/diff.js.map +1 -0
  356. package/dist/core/update/fetch.d.ts +34 -0
  357. package/dist/core/update/fetch.js +73 -0
  358. package/dist/core/update/fetch.js.map +1 -0
  359. package/dist/core/update/index.d.ts +6 -0
  360. package/dist/core/update/index.js +7 -0
  361. package/dist/core/update/index.js.map +1 -0
  362. package/dist/core/update/restore.d.ts +20 -0
  363. package/dist/core/update/restore.js +195 -0
  364. package/dist/core/update/restore.js.map +1 -0
  365. package/dist/core/update/run.d.ts +113 -0
  366. package/dist/core/update/run.js +1135 -0
  367. package/dist/core/update/run.js.map +1 -0
  368. package/dist/core/update/select.d.ts +39 -0
  369. package/dist/core/update/select.js +157 -0
  370. package/dist/core/update/select.js.map +1 -0
  371. package/dist/core/update/spelling.d.ts +51 -0
  372. package/dist/core/update/spelling.js +185 -0
  373. package/dist/core/update/spelling.js.map +1 -0
  374. package/dist/core/update/trees.d.ts +24 -0
  375. package/dist/core/update/trees.js +72 -0
  376. package/dist/core/update/trees.js.map +1 -0
  377. package/dist/errors.d.ts +39 -0
  378. package/dist/errors.js +24 -0
  379. package/dist/errors.js.map +1 -0
  380. package/dist/help.d.ts +51 -0
  381. package/dist/help.js +117 -0
  382. package/dist/help.js.map +1 -0
  383. package/dist/input.d.ts +25 -0
  384. package/dist/input.js +174 -0
  385. package/dist/input.js.map +1 -0
  386. package/dist/output.d.ts +21 -0
  387. package/dist/output.js +37 -0
  388. package/dist/output.js.map +1 -0
  389. package/dist/util/frontmatter.d.ts +12 -0
  390. package/dist/util/frontmatter.js +58 -0
  391. package/dist/util/frontmatter.js.map +1 -0
  392. package/dist/util/fs.d.ts +38 -0
  393. package/dist/util/fs.js +135 -0
  394. package/dist/util/fs.js.map +1 -0
  395. package/dist/util/git-names.d.ts +8 -0
  396. package/dist/util/git-names.js +25 -0
  397. package/dist/util/git-names.js.map +1 -0
  398. package/dist/util/git.d.ts +12 -0
  399. package/dist/util/git.js +33 -0
  400. package/dist/util/git.js.map +1 -0
  401. package/dist/util/suggest.d.ts +6 -0
  402. package/dist/util/suggest.js +48 -0
  403. package/dist/util/suggest.js.map +1 -0
  404. package/dist/util/text.d.ts +8 -0
  405. package/dist/util/text.js +19 -0
  406. package/dist/util/text.js.map +1 -0
  407. package/dist/util/version.d.ts +7 -0
  408. package/dist/util/version.js +13 -0
  409. package/dist/util/version.js.map +1 -0
  410. package/dist/util/yaml.d.ts +30 -0
  411. package/dist/util/yaml.js +201 -0
  412. package/dist/util/yaml.js.map +1 -0
  413. package/package.json +51 -3
  414. package/resources/metafab-skill/SKILL.md +173 -0
@@ -0,0 +1,135 @@
1
+ import { chmod, copyFile, lstat, mkdir, readFile, readdir, stat } from "node:fs/promises";
2
+ import path from "node:path";
3
+ /**
4
+ * Lists `directory` with `readdir(directory, { withFileTypes: true })`. An
5
+ * entry the filesystem reported with no type (every Dirent predicate false,
6
+ * DT_UNKNOWN) is typed from `lstat` instead. An entry that vanished before the
7
+ * `lstat` (ENOENT) is dropped. Any other `lstat` error (EACCES, EIO, ...) is
8
+ * thrown unchanged, exactly like an error from `readdir` itself, so the
9
+ * caller's existing handling for an unreadable directory applies: it never
10
+ * silently skips an entry it could not classify.
11
+ */
12
+ export async function readdirTyped(directory) {
13
+ const entries = await readdir(directory, { withFileTypes: true });
14
+ const typed = [];
15
+ for (const entry of entries) {
16
+ if (entry.isFile() || entry.isDirectory() || entry.isSymbolicLink()) {
17
+ typed.push(entry);
18
+ continue;
19
+ }
20
+ let info;
21
+ try {
22
+ info = await lstat(path.join(directory, entry.name));
23
+ }
24
+ catch (error) {
25
+ if (error.code === "ENOENT")
26
+ continue;
27
+ throw error;
28
+ }
29
+ typed.push({
30
+ name: entry.name,
31
+ isFile: () => info.isFile(),
32
+ isDirectory: () => info.isDirectory(),
33
+ isSymbolicLink: () => info.isSymbolicLink(),
34
+ });
35
+ }
36
+ return typed;
37
+ }
38
+ export function toPosixPath(value) {
39
+ return value.split(path.sep).join("/");
40
+ }
41
+ export function normalizeProblemPath(file, root = process.cwd()) {
42
+ const relative = path.isAbsolute(file) ? path.relative(root, file) : file;
43
+ return relative.split("\\").join("/").replace(/^\.\//, "");
44
+ }
45
+ function fromPosixPath(value) {
46
+ return value.split("/").join(path.sep);
47
+ }
48
+ /**
49
+ * True when the error says the path is not there at all: `ENOENT`, or
50
+ * `ENOTDIR` when a parent of it is a file. Every other error is a real
51
+ * failure, and must not be read as absence.
52
+ */
53
+ export function isAbsentError(error) {
54
+ const code = error?.code;
55
+ return code === "ENOENT" || code === "ENOTDIR";
56
+ }
57
+ export async function pathExists(target) {
58
+ try {
59
+ await stat(target);
60
+ return true;
61
+ }
62
+ catch {
63
+ return false;
64
+ }
65
+ }
66
+ export async function isDirectory(target) {
67
+ try {
68
+ return (await stat(target)).isDirectory();
69
+ }
70
+ catch {
71
+ return false;
72
+ }
73
+ }
74
+ export async function listFiles(root, options = {}) {
75
+ const files = [];
76
+ async function walk(directory, prefix) {
77
+ const entries = await readdirTyped(directory);
78
+ for (const entry of entries) {
79
+ const relativePath = prefix === "" ? entry.name : `${prefix}/${entry.name}`;
80
+ if (options.ignore?.(relativePath, entry.isDirectory()) === true)
81
+ continue;
82
+ if (entry.isDirectory()) {
83
+ await walk(path.join(directory, entry.name), relativePath);
84
+ }
85
+ else if (entry.isFile()) {
86
+ files.push(relativePath);
87
+ }
88
+ }
89
+ }
90
+ await walk(root, "");
91
+ files.sort();
92
+ return files;
93
+ }
94
+ export async function copyFileWithMode(source, destination) {
95
+ const sourceStat = await stat(source);
96
+ await mkdir(path.dirname(destination), { recursive: true });
97
+ await copyFile(source, destination);
98
+ await chmod(destination, sourceStat.mode & 0o777);
99
+ }
100
+ export async function copyTree(source, destination, options = {}) {
101
+ const files = await listFiles(source, options);
102
+ for (const relativePath of files) {
103
+ await copyFileWithMode(path.join(source, fromPosixPath(relativePath)), path.join(destination, fromPosixPath(relativePath)));
104
+ }
105
+ }
106
+ export async function compareTrees(expected, actual, options = {}) {
107
+ const expectedFiles = await listFiles(expected, options);
108
+ const actualFiles = await listFiles(actual, options);
109
+ const expectedSet = new Set(expectedFiles);
110
+ const actualSet = new Set(actualFiles);
111
+ const paths = [...new Set([...expectedFiles, ...actualFiles])].sort();
112
+ const differences = [];
113
+ for (const relativePath of paths) {
114
+ if (!actualSet.has(relativePath)) {
115
+ differences.push({ path: relativePath, kind: "missing" });
116
+ continue;
117
+ }
118
+ if (!expectedSet.has(relativePath)) {
119
+ differences.push({ path: relativePath, kind: "extra" });
120
+ continue;
121
+ }
122
+ const expectedPath = path.join(expected, fromPosixPath(relativePath));
123
+ const actualPath = path.join(actual, fromPosixPath(relativePath));
124
+ const [expectedStat, actualStat] = await Promise.all([stat(expectedPath), stat(actualPath)]);
125
+ const [expectedData, actualData] = await Promise.all([readFile(expectedPath), readFile(actualPath)]);
126
+ if (!expectedData.equals(actualData)) {
127
+ differences.push({ path: relativePath, kind: "content" });
128
+ }
129
+ else if ((expectedStat.mode & 0o777) !== (actualStat.mode & 0o777)) {
130
+ differences.push({ path: relativePath, kind: "mode" });
131
+ }
132
+ }
133
+ return differences;
134
+ }
135
+ //# sourceMappingURL=fs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/util/fs.ts"],"names":[],"mapp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+ * case-insensitively, after the trailing spaces and periods NTFS and HFS
4
+ * ignore, after the code points HFS+ ignores entirely, with the `:` stream
5
+ * suffix NTFS drops, and including the 8.3 short name a Windows filesystem
6
+ * reports for `.git`.
7
+ */
8
+ export declare function isDotGitName(name: string): boolean;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The code points HFS+ ignores inside a name, exactly as Git's `next_hfs_char`
3
+ * skips them: a name that reads as `.git` only after they are dropped is still
4
+ * `.git` to a Mac.
5
+ */
6
+ const HFS_IGNORABLE = /[\u200c\u200d\u200e\u200f\u202a-\u202e\u206a-\u206f\ufeff]/g;
7
+ /**
8
+ * Names Git reads as `.git`, matched the way Git's own `verify_path` matches:
9
+ * case-insensitively, after the trailing spaces and periods NTFS and HFS
10
+ * ignore, after the code points HFS+ ignores entirely, with the `:` stream
11
+ * suffix NTFS drops, and including the 8.3 short name a Windows filesystem
12
+ * reports for `.git`.
13
+ */
14
+ export function isDotGitName(name) {
15
+ // `is_hfs_dotgit`: the ignorable code points are not part of the name.
16
+ if (name.replace(HFS_IGNORABLE, "").toLowerCase() === ".git")
17
+ return true;
18
+ // `is_ntfs_dotgit`: a stream suffix ends the name, then spaces and periods.
19
+ const stream = name.indexOf(":");
20
+ const semantic = (stream === -1 ? name : name.slice(0, stream))
21
+ .replace(/[ .]+$/, "")
22
+ .toLowerCase();
23
+ return semantic === ".git" || semantic === "git~1";
24
+ }
25
+ //# sourceMappingURL=git-names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-names.js","sourceRoot":"","sources":["../../src/util/git-names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,aAAa,GAAG,6DAA6D,CAAC;AAEpF;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,uEAAuE;IACvE,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAE1E,4EAA4E;IAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;SAC5D,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;SACrB,WAAW,EAAE,CAAC;IACjB,OAAO,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,CAAC;AACrD,CAAC"}
@@ -0,0 +1,12 @@
1
+ export interface GitResult {
2
+ exitCode: number;
3
+ stdout: string;
4
+ stderr: string;
5
+ }
6
+ export interface GitOptions {
7
+ cwd?: string;
8
+ env?: NodeJS.ProcessEnv;
9
+ maxBuffer?: number;
10
+ }
11
+ export declare function gitEnv(env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
12
+ export declare function runGit(args: string[], options?: GitOptions): Promise<GitResult>;
@@ -0,0 +1,33 @@
1
+ import { execFile } from "node:child_process";
2
+ import { promisify } from "node:util";
3
+ const execFileAsync = promisify(execFile);
4
+ export function gitEnv(env = process.env) {
5
+ const merged = { ...env };
6
+ if (process.stdin.isTTY !== true)
7
+ merged.GIT_TERMINAL_PROMPT = "0";
8
+ return merged;
9
+ }
10
+ export async function runGit(args, options = {}) {
11
+ try {
12
+ const { stdout, stderr } = await execFileAsync("git", args, {
13
+ cwd: options.cwd,
14
+ env: options.env === undefined ? gitEnv() : gitEnv(options.env),
15
+ encoding: "utf8",
16
+ maxBuffer: options.maxBuffer ?? 16 * 1024 * 1024,
17
+ windowsHide: true,
18
+ });
19
+ return { exitCode: 0, stdout, stderr };
20
+ }
21
+ catch (error) {
22
+ const failure = error;
23
+ if (typeof failure.code === "number") {
24
+ return {
25
+ exitCode: failure.code,
26
+ stdout: failure.stdout ?? "",
27
+ stderr: failure.stderr ?? failure.message ?? "",
28
+ };
29
+ }
30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AE,CAAC;YACrC,OAAO;gBACL,QAAQ,EAAE,OAAO,CAAC,IAAI;gBACtB,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,EAAE;gBAC5B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE;aAChD,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export declare function levenshtein(left: string, right: string): number;
2
+ export interface SuggestOptions {
3
+ maxDistance?: number;
4
+ }
5
+ export declare function suggest(input: string, candidates: readonly string[], options?: SuggestOptions): string | undefined;
6
+ export declare function didYouMean(input: string, candidates: readonly string[], options?: SuggestOptions): string | undefined;
@@ -0,0 +1,48 @@
1
+ export function levenshtein(left, right) {
2
+ const source = Array.from(left);
3
+ const target = Array.from(right);
4
+ if (source.length === 0)
5
+ return target.length;
6
+ if (target.length === 0)
7
+ return source.length;
8
+ let previous = Array.from({ length: target.length + 1 }, (_, index) => index);
9
+ let current = new Array(target.length + 1);
10
+ for (let row = 1; row <= source.length; row += 1) {
11
+ current[0] = row;
12
+ for (let column = 1; column <= target.length; column += 1) {
13
+ const substitution = previous[column - 1] + (source[row - 1] === target[column - 1] ? 0 : 1);
14
+ const deletion = previous[column] + 1;
15
+ const insertion = current[column - 1] + 1;
16
+ current[column] = Math.min(substitution, deletion, insertion);
17
+ }
18
+ [previous, current] = [current, previous];
19
+ }
20
+ return previous[target.length];
21
+ }
22
+ function defaultMaxDistance(input, candidate) {
23
+ const longest = Math.max(input.length, candidate.length);
24
+ return longest <= 3 ? 1 : Math.min(3, Math.floor(longest / 3));
25
+ }
26
+ export function suggest(input, candidates, options = {}) {
27
+ const needle = input.trim();
28
+ if (needle === "")
29
+ return undefined;
30
+ let best;
31
+ for (const candidate of candidates) {
32
+ const distance = levenshtein(needle.toLowerCase(), candidate.toLowerCase());
33
+ if (best === undefined ||
34
+ distance < best.distance ||
35
+ (distance === best.distance && candidate < best.candidate)) {
36
+ best = { candidate, distance };
37
+ }
38
+ }
39
+ if (best === undefined)
40
+ return undefined;
41
+ const maxDistance = options.maxDistance ?? defaultMaxDistance(needle, best.candidate);
42
+ return best.distance <= maxDistance ? best.candidate : undefined;
43
+ }
44
+ export function didYouMean(input, candidates, options = {}) {
45
+ const candidate = suggest(input, candidates, options);
46
+ return candidate === undefined ? undefined : `Did you mean "${candidate}"?`;
47
+ }
48
+ //# sourceMappingURL=suggest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggest.js","sourceRoot":"","sources":["../../src/util/suggest.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,KAAa;IACrD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAEjC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IAC9C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9E,IAAI,OAAO,GAAG,IAAI,KAAK,CAAS,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEnD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACjB,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,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AAC;QACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;QAC5E,IACE,IAAI,KAAK,SAAS;YAClB,QAAQ,GAAG,IAAI,CAAC,QAAQ;YACxB,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,IAAI,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAC1D,CAAC;YACD,IAAI,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;QACjC,CAAC;IACH,CAAC;IAED,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACtF,OAAO,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,UAA6B,EAAE,OAAO,GAAmB,EAAE;IACnG,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,SAAS,IAAI,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare function toLF(text: string): string;
2
+ export declare function equalIgnoringEOL(left: string, right: string): boolean;
3
+ export declare function isSingleLine(text: string): boolean;
4
+ /**
5
+ * True when the text has at least one line break and every `\n` is preceded by
6
+ * `\r`: the file uses CRLF throughout, with no LF-only line.
7
+ */
8
+ export declare function usesCRLF(text: string): boolean;
@@ -0,0 +1,19 @@
1
+ export function toLF(text) {
2
+ return text.replace(/\r\n?/g, "\n");
3
+ }
4
+ export function equalIgnoringEOL(left, right) {
5
+ return toLF(left) === toLF(right);
6
+ }
7
+ export function isSingleLine(text) {
8
+ return !text.includes("\n") && !text.includes("\r");
9
+ }
10
+ /**
11
+ * True when the text has at least one line break and every `\n` is preceded by
12
+ * `\r`: the file uses CRLF throughout, with no LF-only line.
13
+ */
14
+ export function usesCRLF(text) {
15
+ if (!text.includes("\n"))
16
+ return false;
17
+ return !text.replace(/\r\n/g, "").includes("\n");
18
+ }
19
+ //# sourceMappingURL=text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/util/text.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,IAAI,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,KAAa;IAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The version of the CLI that is running.
3
+ *
4
+ * `../../package.json` is the package root from both `src/util/` and
5
+ * `dist/util/`, so the reported version is always the published one.
6
+ */
7
+ export declare function cliVersion(): string;
@@ -0,0 +1,13 @@
1
+ import { createRequire } from "node:module";
2
+ const require = createRequire(import.meta.url);
3
+ /**
4
+ * The version of the CLI that is running.
5
+ *
6
+ * `../../package.json` is the package root from both `src/util/` and
7
+ * `dist/util/`, so the reported version is always the published one.
8
+ */
9
+ export function cliVersion() {
10
+ const pkg = require("../../package.json");
11
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0";
12
+ }
13
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/util/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAA0B,CAAC;IACnE,OAAO,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;AACjE,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { Document } from "yaml";
2
+ export interface YamlProblem {
3
+ message: string;
4
+ line: number;
5
+ fix: string;
6
+ }
7
+ export interface YamlParseOptions {
8
+ lineOffset?: number;
9
+ }
10
+ export interface YamlDocument {
11
+ document: Document.Parsed;
12
+ value: Record<string, unknown>;
13
+ lineAt(offset: number): number;
14
+ lineOf(node?: unknown): number;
15
+ }
16
+ export type YamlParseResult = ({
17
+ ok: true;
18
+ } & YamlDocument) | {
19
+ ok: false;
20
+ problems: YamlProblem[];
21
+ };
22
+ /**
23
+ * Problems for alias nodes: an alias such as `*missing` that names no anchor
24
+ * before it, an alias that refers to an anchor it sits inside, and a document
25
+ * whose aliases expand it past the limit `yaml` applies when it converts one.
26
+ * The counts follow `yaml`'s own, so the problem names the alias that crosses
27
+ * the limit, and callers report it as a grammar problem instead of converting.
28
+ */
29
+ export declare function aliasProblems(document: Document, lineAt: (offset: number) => number): YamlProblem[];
30
+ export declare function parseYaml(text: string, options?: YamlParseOptions): YamlParseResult;
@@ -0,0 +1,201 @@
1
+ import { isAlias, isCollection, isMap, isNode, isPair, isScalar, LineCounter, parseDocument } from "yaml";
2
+ const YAML_OPTIONS = {
3
+ version: "1.2",
4
+ uniqueKeys: true,
5
+ prettyErrors: true,
6
+ };
7
+ /** The expansion limit `yaml` applies when it converts a document to JavaScript. */
8
+ const MAX_ALIAS_COUNT = 100;
9
+ function cleanMessage(message) {
10
+ return message.replace(/\s+at line \d+, column \d+:[\s\S]*$/, "").trim();
11
+ }
12
+ function hasCollectionKey(document) {
13
+ const contents = document.contents;
14
+ if (!isMap(contents))
15
+ return false;
16
+ return contents.items.some((pair) => !isScalar(pair.key));
17
+ }
18
+ function valueFromScalarKeys(document) {
19
+ const contents = document.contents;
20
+ if (!isMap(contents))
21
+ return {};
22
+ const value = {};
23
+ for (const pair of contents.items) {
24
+ if (!isScalar(pair.key) || typeof pair.key.value !== "string")
25
+ continue;
26
+ value[pair.key.value] = isNode(pair.value) ? pair.value.toJS(document) : null;
27
+ }
28
+ return value;
29
+ }
30
+ /**
31
+ * How many values `yaml` counts one value of `node` as while it converts a
32
+ * document to JavaScript: one for a scalar, the largest count in a collection,
33
+ * and an alias's anchor multiplied by that anchor's use count. An anchor that
34
+ * no alias has reached yet counts as zero, as `yaml` counts it. Aliases are not
35
+ * followed into a second walk, so shared subtrees are not expanded here and a
36
+ * nested alias finishes in linear time.
37
+ */
38
+ function expansionCount(node, anchors, uses) {
39
+ if (isAlias(node)) {
40
+ const target = anchors.get(node.source);
41
+ const use = target === undefined ? undefined : uses.get(target);
42
+ return use === undefined ? 0 : use.count * use.aliasCount;
43
+ }
44
+ if (isPair(node)) {
45
+ return Math.max(expansionCount(node.key, anchors, uses), expansionCount(node.value, anchors, uses));
46
+ }
47
+ if (isCollection(node)) {
48
+ let count = 0;
49
+ for (const item of node.items) {
50
+ count = Math.max(count, expansionCount(item, anchors, uses));
51
+ }
52
+ return count;
53
+ }
54
+ return 1;
55
+ }
56
+ /**
57
+ * Problems for alias nodes: an alias such as `*missing` that names no anchor
58
+ * before it, an alias that refers to an anchor it sits inside, and a document
59
+ * whose aliases expand it past the limit `yaml` applies when it converts one.
60
+ * The counts follow `yaml`'s own, so the problem names the alias that crosses
61
+ * the limit, and callers report it as a grammar problem instead of converting.
62
+ */
63
+ export function aliasProblems(document, lineAt) {
64
+ const problems = [];
65
+ const anchors = new Map();
66
+ const uses = new Map();
67
+ const path = new Set();
68
+ let reported = false;
69
+ const walk = (node) => {
70
+ if (isNode(node) && typeof node.anchor === "string")
71
+ anchors.set(node.anchor, node);
72
+ if (isAlias(node)) {
73
+ if (reported)
74
+ return;
75
+ const line = lineAt(node.range?.[0] ?? 0);
76
+ const target = anchors.get(node.source);
77
+ if (target === undefined) {
78
+ problems.push({
79
+ message: `Alias *${node.source} has no anchor`,
80
+ line,
81
+ fix: "Remove the alias or define its anchor before it",
82
+ });
83
+ return;
84
+ }
85
+ if (path.has(target)) {
86
+ problems.push({
87
+ message: `Alias *${node.source} refers to itself`,
88
+ line,
89
+ fix: "Remove the alias or write the values out",
90
+ });
91
+ reported = true;
92
+ return;
93
+ }
94
+ let use = uses.get(target);
95
+ if (use === undefined) {
96
+ // `yaml` counts the anchored node itself as one use before its aliases.
97
+ use = { count: 1, aliasCount: 0 };
98
+ uses.set(target, use);
99
+ }
100
+ use.count += 1;
101
+ if (use.aliasCount === 0)
102
+ use.aliasCount = expansionCount(target, anchors, uses);
103
+ if (use.count * use.aliasCount > MAX_ALIAS_COUNT) {
104
+ problems.push({
105
+ message: `Alias *${node.source} is aliased too many times`,
106
+ line,
107
+ fix: "Use the anchor fewer times or write the values out",
108
+ });
109
+ reported = true;
110
+ }
111
+ return;
112
+ }
113
+ if (!isPair(node) && !isCollection(node))
114
+ return;
115
+ path.add(node);
116
+ if (isPair(node)) {
117
+ walk(node.key);
118
+ walk(node.value);
119
+ }
120
+ else {
121
+ for (const item of node.items)
122
+ walk(item);
123
+ }
124
+ path.delete(node);
125
+ };
126
+ if (document.contents !== null)
127
+ walk(document.contents);
128
+ return problems;
129
+ }
130
+ /** The `yaml` library's errors for an alias it cannot resolve or will not expand. */
131
+ function isAliasError(error) {
132
+ return (error instanceof ReferenceError &&
133
+ /^(?:Excessive alias count|Unresolved alias|This should not happen: Alias anchor was not resolved)/.test(error.message));
134
+ }
135
+ function expansionProblem(lineAt) {
136
+ return {
137
+ message: "The aliases in this document expand it too far",
138
+ line: lineAt(0),
139
+ fix: "Use the anchor fewer times or write the values out",
140
+ };
141
+ }
142
+ export function parseYaml(text, options = {}) {
143
+ const lineOffset = options.lineOffset ?? 0;
144
+ const lineCounter = new LineCounter();
145
+ const document = parseDocument(text, { ...YAML_OPTIONS, lineCounter });
146
+ const lineAt = (offset) => lineCounter.linePos(offset).line + lineOffset;
147
+ if (document.errors.length > 0) {
148
+ return {
149
+ ok: false,
150
+ problems: document.errors.map((error) => ({
151
+ message: cleanMessage(error.message),
152
+ line: lineAt(error.pos[0]),
153
+ fix: "Fix the YAML syntax on this line",
154
+ })),
155
+ };
156
+ }
157
+ const contents = document.contents;
158
+ if (contents !== null && !isMap(contents)) {
159
+ return {
160
+ ok: false,
161
+ problems: [
162
+ {
163
+ message: "Top-level value must be a mapping",
164
+ line: lineAt(contents.range?.[0] ?? 0),
165
+ fix: "Start the document with key: value pairs",
166
+ },
167
+ ],
168
+ };
169
+ }
170
+ const aliases = aliasProblems(document, lineAt);
171
+ if (aliases.length > 0) {
172
+ return { ok: false, problems: aliases };
173
+ }
174
+ let value;
175
+ try {
176
+ value =
177
+ contents === null
178
+ ? {}
179
+ : hasCollectionKey(document)
180
+ ? valueFromScalarKeys(document)
181
+ : document.toJS();
182
+ }
183
+ catch (error) {
184
+ if (!isAliasError(error))
185
+ throw error;
186
+ // `yaml` counts aliases per converted node, so re-check to name the alias
187
+ // that crosses the limit rather than guessing at its position.
188
+ const found = aliasProblems(document, lineAt);
189
+ return { ok: false, problems: found.length > 0 ? found : [expansionProblem(lineAt)] };
190
+ }
191
+ return {
192
+ ok: true,
193
+ document,
194
+ value,
195
+ lineAt,
196
+ lineOf(node) {
197
+ return isNode(node) && node.range != null ? lineAt(node.range[0]) : lineAt(0);
198
+ },
199
+ };
200
+ }
201
+ //# sourceMappingURL=yaml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yaml.js","sourceRoot":"","sources":["../../src/util/yaml.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAsB1G,MAAM,YAAY,GAAG;IACnB,OAAO,EAAE,KAAc;IACvB,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACnB,CAAC;AAEF,oFAAoF;AACpF,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,SAAS,YAAY,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,OAAO,CAAC,qCAAqC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3E,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAyB;IACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAE,IAA+B,CAAC,GAAG,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAyB;IACpD,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IACnC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,CAAC;IAEhC,MAAM,KAAK,GAA4B,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,QAAQ,CA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