@seasb/metafab 0.0.0-stage → 1.0.0

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 (369) hide show
  1. package/README.md +47 -2
  2. package/dist/cli.d.ts +11 -0
  3. package/dist/cli.js +317 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/build.d.ts +2 -0
  6. package/dist/commands/build.js +70 -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 +41 -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 +74 -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/import.d.ts +2 -0
  21. package/dist/commands/import.js +107 -0
  22. package/dist/commands/import.js.map +1 -0
  23. package/dist/commands/init.d.ts +2 -0
  24. package/dist/commands/init.js +77 -0
  25. package/dist/commands/init.js.map +1 -0
  26. package/dist/commands/map.d.ts +2 -0
  27. package/dist/commands/map.js +43 -0
  28. package/dist/commands/map.js.map +1 -0
  29. package/dist/commands/not-implemented.d.ts +2 -0
  30. package/dist/commands/not-implemented.js +19 -0
  31. package/dist/commands/not-implemented.js.map +1 -0
  32. package/dist/commands/pipeline-add.d.ts +2 -0
  33. package/dist/commands/pipeline-add.js +67 -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 +44 -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 +147 -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 +23 -0
  51. package/dist/core/build/agents.js +60 -0
  52. package/dist/core/build/agents.js.map +1 -0
  53. package/dist/core/build/index.d.ts +4 -0
  54. package/dist/core/build/index.js +5 -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 +48 -0
  60. package/dist/core/build/plan.js +792 -0
  61. package/dist/core/build/plan.js.map +1 -0
  62. package/dist/core/build/skill.d.ts +60 -0
  63. package/dist/core/build/skill.js +275 -0
  64. package/dist/core/build/skill.js.map +1 -0
  65. package/dist/core/check/drift.d.ts +13 -0
  66. package/dist/core/check/drift.js +205 -0
  67. package/dist/core/check/drift.js.map +1 -0
  68. package/dist/core/check/index.d.ts +12 -0
  69. package/dist/core/check/index.js +78 -0
  70. package/dist/core/check/index.js.map +1 -0
  71. package/dist/core/check/markers.d.ts +9 -0
  72. package/dist/core/check/markers.js +220 -0
  73. package/dist/core/check/markers.js.map +1 -0
  74. package/dist/core/config/destinations.d.ts +5 -0
  75. package/dist/core/config/destinations.js +20 -0
  76. package/dist/core/config/destinations.js.map +1 -0
  77. package/dist/core/config/load.d.ts +4 -0
  78. package/dist/core/config/load.js +41 -0
  79. package/dist/core/config/load.js.map +1 -0
  80. package/dist/core/config/parse.d.ts +8 -0
  81. package/dist/core/config/parse.js +198 -0
  82. package/dist/core/config/parse.js.map +1 -0
  83. package/dist/core/config/source.d.ts +14 -0
  84. package/dist/core/config/source.js +44 -0
  85. package/dist/core/config/source.js.map +1 -0
  86. package/dist/core/config/types.d.ts +48 -0
  87. package/dist/core/config/types.js +2 -0
  88. package/dist/core/config/types.js.map +1 -0
  89. package/dist/core/config/validate.d.ts +11 -0
  90. package/dist/core/config/validate.js +351 -0
  91. package/dist/core/config/validate.js.map +1 -0
  92. package/dist/core/config/writers.d.ts +14 -0
  93. package/dist/core/config/writers.js +261 -0
  94. package/dist/core/config/writers.js.map +1 -0
  95. package/dist/core/config.d.ts +7 -0
  96. package/dist/core/config.js +8 -0
  97. package/dist/core/config.js.map +1 -0
  98. package/dist/core/discovery.d.ts +34 -0
  99. package/dist/core/discovery.js +272 -0
  100. package/dist/core/discovery.js.map +1 -0
  101. package/dist/core/edit/create.d.ts +18 -0
  102. package/dist/core/edit/create.js +190 -0
  103. package/dist/core/edit/create.js.map +1 -0
  104. package/dist/core/edit/document.d.ts +4 -0
  105. package/dist/core/edit/document.js +16 -0
  106. package/dist/core/edit/document.js.map +1 -0
  107. package/dist/core/edit/factory-yaml.d.ts +17 -0
  108. package/dist/core/edit/factory-yaml.js +211 -0
  109. package/dist/core/edit/factory-yaml.js.map +1 -0
  110. package/dist/core/edit/files.d.ts +6 -0
  111. package/dist/core/edit/files.js +47 -0
  112. package/dist/core/edit/files.js.map +1 -0
  113. package/dist/core/edit/index.d.ts +9 -0
  114. package/dist/core/edit/index.js +10 -0
  115. package/dist/core/edit/index.js.map +1 -0
  116. package/dist/core/edit/map.d.ts +24 -0
  117. package/dist/core/edit/map.js +82 -0
  118. package/dist/core/edit/map.js.map +1 -0
  119. package/dist/core/edit/names.d.ts +2 -0
  120. package/dist/core/edit/names.js +17 -0
  121. package/dist/core/edit/names.js.map +1 -0
  122. package/dist/core/edit/paths.d.ts +8 -0
  123. package/dist/core/edit/paths.js +76 -0
  124. package/dist/core/edit/paths.js.map +1 -0
  125. package/dist/core/edit/pipeline.d.ts +19 -0
  126. package/dist/core/edit/pipeline.js +146 -0
  127. package/dist/core/edit/pipeline.js.map +1 -0
  128. package/dist/core/edit/skill.d.ts +1 -0
  129. package/dist/core/edit/skill.js +10 -0
  130. package/dist/core/edit/skill.js.map +1 -0
  131. package/dist/core/factory/discovery.d.ts +9 -0
  132. package/dist/core/factory/discovery.js +139 -0
  133. package/dist/core/factory/discovery.js.map +1 -0
  134. package/dist/core/factory/factory-yaml.d.ts +16 -0
  135. package/dist/core/factory/factory-yaml.js +375 -0
  136. package/dist/core/factory/factory-yaml.js.map +1 -0
  137. package/dist/core/factory/index.d.ts +5 -0
  138. package/dist/core/factory/index.js +6 -0
  139. package/dist/core/factory/index.js.map +1 -0
  140. package/dist/core/factory/lines.d.ts +8 -0
  141. package/dist/core/factory/lines.js +11 -0
  142. package/dist/core/factory/lines.js.map +1 -0
  143. package/dist/core/factory/load.d.ts +4 -0
  144. package/dist/core/factory/load.js +81 -0
  145. package/dist/core/factory/load.js.map +1 -0
  146. package/dist/core/factory/requires.d.ts +9 -0
  147. package/dist/core/factory/requires.js +123 -0
  148. package/dist/core/factory/requires.js.map +1 -0
  149. package/dist/core/factory/types.d.ts +45 -0
  150. package/dist/core/factory/types.js +2 -0
  151. package/dist/core/factory/types.js.map +1 -0
  152. package/dist/core/factory/validate.d.ts +41 -0
  153. package/dist/core/factory/validate.js +441 -0
  154. package/dist/core/factory/validate.js.map +1 -0
  155. package/dist/core/hooks/index.d.ts +8 -0
  156. package/dist/core/hooks/index.js +15 -0
  157. package/dist/core/hooks/index.js.map +1 -0
  158. package/dist/core/hooks/script.d.ts +21 -0
  159. package/dist/core/hooks/script.js +34 -0
  160. package/dist/core/hooks/script.js.map +1 -0
  161. package/dist/core/hooks/sync.d.ts +17 -0
  162. package/dist/core/hooks/sync.js +262 -0
  163. package/dist/core/hooks/sync.js.map +1 -0
  164. package/dist/core/import/conflicts.d.ts +82 -0
  165. package/dist/core/import/conflicts.js +256 -0
  166. package/dist/core/import/conflicts.js.map +1 -0
  167. package/dist/core/import/copy.d.ts +10 -0
  168. package/dist/core/import/copy.js +76 -0
  169. package/dist/core/import/copy.js.map +1 -0
  170. package/dist/core/import/file-tree.d.ts +43 -0
  171. package/dist/core/import/file-tree.js +107 -0
  172. package/dist/core/import/file-tree.js.map +1 -0
  173. package/dist/core/import/index.d.ts +5 -0
  174. package/dist/core/import/index.js +6 -0
  175. package/dist/core/import/index.js.map +1 -0
  176. package/dist/core/import/pipeline-changes.d.ts +8 -0
  177. package/dist/core/import/pipeline-changes.js +89 -0
  178. package/dist/core/import/pipeline-changes.js.map +1 -0
  179. package/dist/core/import/run.d.ts +76 -0
  180. package/dist/core/import/run.js +258 -0
  181. package/dist/core/import/run.js.map +1 -0
  182. package/dist/core/init/gitattributes.d.ts +20 -0
  183. package/dist/core/init/gitattributes.js +89 -0
  184. package/dist/core/init/gitattributes.js.map +1 -0
  185. package/dist/core/init/index.d.ts +4 -0
  186. package/dist/core/init/index.js +5 -0
  187. package/dist/core/init/index.js.map +1 -0
  188. package/dist/core/init/name.d.ts +1 -0
  189. package/dist/core/init/name.js +4 -0
  190. package/dist/core/init/name.js.map +1 -0
  191. package/dist/core/init/run.d.ts +51 -0
  192. package/dist/core/init/run.js +261 -0
  193. package/dist/core/init/run.js.map +1 -0
  194. package/dist/core/init/targets.d.ts +17 -0
  195. package/dist/core/init/targets.js +87 -0
  196. package/dist/core/init/targets.js.map +1 -0
  197. package/dist/core/merge.d.ts +88 -0
  198. package/dist/core/merge.js +239 -0
  199. package/dist/core/merge.js.map +1 -0
  200. package/dist/core/publish/exclude.d.ts +9 -0
  201. package/dist/core/publish/exclude.js +32 -0
  202. package/dist/core/publish/exclude.js.map +1 -0
  203. package/dist/core/publish/git-target.d.ts +32 -0
  204. package/dist/core/publish/git-target.js +447 -0
  205. package/dist/core/publish/git-target.js.map +1 -0
  206. package/dist/core/publish/index.d.ts +10 -0
  207. package/dist/core/publish/index.js +11 -0
  208. package/dist/core/publish/index.js.map +1 -0
  209. package/dist/core/publish/npm-target.d.ts +15 -0
  210. package/dist/core/publish/npm-target.js +170 -0
  211. package/dist/core/publish/npm-target.js.map +1 -0
  212. package/dist/core/publish/package-json.d.ts +31 -0
  213. package/dist/core/publish/package-json.js +74 -0
  214. package/dist/core/publish/package-json.js.map +1 -0
  215. package/dist/core/publish/prepare.d.ts +24 -0
  216. package/dist/core/publish/prepare.js +93 -0
  217. package/dist/core/publish/prepare.js.map +1 -0
  218. package/dist/core/publish/provenance.d.ts +1 -0
  219. package/dist/core/publish/provenance.js +20 -0
  220. package/dist/core/publish/provenance.js.map +1 -0
  221. package/dist/core/publish/publish.d.ts +13 -0
  222. package/dist/core/publish/publish.js +130 -0
  223. package/dist/core/publish/publish.js.map +1 -0
  224. package/dist/core/publish/readme.d.ts +22 -0
  225. package/dist/core/publish/readme.js +112 -0
  226. package/dist/core/publish/readme.js.map +1 -0
  227. package/dist/core/publish/stage.d.ts +19 -0
  228. package/dist/core/publish/stage.js +333 -0
  229. package/dist/core/publish/stage.js.map +1 -0
  230. package/dist/core/publish/types.d.ts +71 -0
  231. package/dist/core/publish/types.js +2 -0
  232. package/dist/core/publish/types.js.map +1 -0
  233. package/dist/core/requires/check.d.ts +15 -0
  234. package/dist/core/requires/check.js +83 -0
  235. package/dist/core/requires/check.js.map +1 -0
  236. package/dist/core/requires/index.d.ts +4 -0
  237. package/dist/core/requires/index.js +5 -0
  238. package/dist/core/requires/index.js.map +1 -0
  239. package/dist/core/requires/inspect.d.ts +44 -0
  240. package/dist/core/requires/inspect.js +114 -0
  241. package/dist/core/requires/inspect.js.map +1 -0
  242. package/dist/core/requires/paths.d.ts +29 -0
  243. package/dist/core/requires/paths.js +83 -0
  244. package/dist/core/requires/paths.js.map +1 -0
  245. package/dist/core/requires/setup.d.ts +37 -0
  246. package/dist/core/requires/setup.js +147 -0
  247. package/dist/core/requires/setup.js.map +1 -0
  248. package/dist/core/setup.d.ts +27 -0
  249. package/dist/core/setup.js +84 -0
  250. package/dist/core/setup.js.map +1 -0
  251. package/dist/core/sources/cache.d.ts +38 -0
  252. package/dist/core/sources/cache.js +200 -0
  253. package/dist/core/sources/cache.js.map +1 -0
  254. package/dist/core/sources/containment.d.ts +21 -0
  255. package/dist/core/sources/containment.js +50 -0
  256. package/dist/core/sources/containment.js.map +1 -0
  257. package/dist/core/sources/env.d.ts +12 -0
  258. package/dist/core/sources/env.js +28 -0
  259. package/dist/core/sources/env.js.map +1 -0
  260. package/dist/core/sources/extract.d.ts +25 -0
  261. package/dist/core/sources/extract.js +676 -0
  262. package/dist/core/sources/extract.js.map +1 -0
  263. package/dist/core/sources/git-process.d.ts +26 -0
  264. package/dist/core/sources/git-process.js +51 -0
  265. package/dist/core/sources/git-process.js.map +1 -0
  266. package/dist/core/sources/git.d.ts +41 -0
  267. package/dist/core/sources/git.js +511 -0
  268. package/dist/core/sources/git.js.map +1 -0
  269. package/dist/core/sources/https.d.ts +21 -0
  270. package/dist/core/sources/https.js +208 -0
  271. package/dist/core/sources/https.js.map +1 -0
  272. package/dist/core/sources/index.d.ts +13 -0
  273. package/dist/core/sources/index.js +14 -0
  274. package/dist/core/sources/index.js.map +1 -0
  275. package/dist/core/sources/npm-cli.d.ts +19 -0
  276. package/dist/core/sources/npm-cli.js +43 -0
  277. package/dist/core/sources/npm-cli.js.map +1 -0
  278. package/dist/core/sources/npm.d.ts +29 -0
  279. package/dist/core/sources/npm.js +386 -0
  280. package/dist/core/sources/npm.js.map +1 -0
  281. package/dist/core/sources/parse.d.ts +32 -0
  282. package/dist/core/sources/parse.js +389 -0
  283. package/dist/core/sources/parse.js.map +1 -0
  284. package/dist/core/sources/path.d.ts +10 -0
  285. package/dist/core/sources/path.js +316 -0
  286. package/dist/core/sources/path.js.map +1 -0
  287. package/dist/core/sources/redact.d.ts +2 -0
  288. package/dist/core/sources/redact.js +70 -0
  289. package/dist/core/sources/redact.js.map +1 -0
  290. package/dist/core/sources/resolve.d.ts +9 -0
  291. package/dist/core/sources/resolve.js +29 -0
  292. package/dist/core/sources/resolve.js.map +1 -0
  293. package/dist/core/sources/types.d.ts +86 -0
  294. package/dist/core/sources/types.js +2 -0
  295. package/dist/core/sources/types.js.map +1 -0
  296. package/dist/core/sources/validate.d.ts +9 -0
  297. package/dist/core/sources/validate.js +111 -0
  298. package/dist/core/sources/validate.js.map +1 -0
  299. package/dist/core/summary.d.ts +77 -0
  300. package/dist/core/summary.js +405 -0
  301. package/dist/core/summary.js.map +1 -0
  302. package/dist/core/update/clashes.d.ts +63 -0
  303. package/dist/core/update/clashes.js +192 -0
  304. package/dist/core/update/clashes.js.map +1 -0
  305. package/dist/core/update/detach.d.ts +21 -0
  306. package/dist/core/update/detach.js +38 -0
  307. package/dist/core/update/detach.js.map +1 -0
  308. package/dist/core/update/diff.d.ts +58 -0
  309. package/dist/core/update/diff.js +180 -0
  310. package/dist/core/update/diff.js.map +1 -0
  311. package/dist/core/update/fetch.d.ts +34 -0
  312. package/dist/core/update/fetch.js +73 -0
  313. package/dist/core/update/fetch.js.map +1 -0
  314. package/dist/core/update/index.d.ts +6 -0
  315. package/dist/core/update/index.js +7 -0
  316. package/dist/core/update/index.js.map +1 -0
  317. package/dist/core/update/restore.d.ts +20 -0
  318. package/dist/core/update/restore.js +195 -0
  319. package/dist/core/update/restore.js.map +1 -0
  320. package/dist/core/update/run.d.ts +113 -0
  321. package/dist/core/update/run.js +1132 -0
  322. package/dist/core/update/run.js.map +1 -0
  323. package/dist/core/update/select.d.ts +39 -0
  324. package/dist/core/update/select.js +157 -0
  325. package/dist/core/update/select.js.map +1 -0
  326. package/dist/core/update/spelling.d.ts +51 -0
  327. package/dist/core/update/spelling.js +185 -0
  328. package/dist/core/update/spelling.js.map +1 -0
  329. package/dist/core/update/trees.d.ts +24 -0
  330. package/dist/core/update/trees.js +72 -0
  331. package/dist/core/update/trees.js.map +1 -0
  332. package/dist/errors.d.ts +29 -0
  333. package/dist/errors.js +24 -0
  334. package/dist/errors.js.map +1 -0
  335. package/dist/help.d.ts +46 -0
  336. package/dist/help.js +103 -0
  337. package/dist/help.js.map +1 -0
  338. package/dist/input.d.ts +25 -0
  339. package/dist/input.js +173 -0
  340. package/dist/input.js.map +1 -0
  341. package/dist/output.d.ts +21 -0
  342. package/dist/output.js +37 -0
  343. package/dist/output.js.map +1 -0
  344. package/dist/util/frontmatter.d.ts +12 -0
  345. package/dist/util/frontmatter.js +58 -0
  346. package/dist/util/frontmatter.js.map +1 -0
  347. package/dist/util/fs.d.ts +32 -0
  348. package/dist/util/fs.js +126 -0
  349. package/dist/util/fs.js.map +1 -0
  350. package/dist/util/git-names.d.ts +8 -0
  351. package/dist/util/git-names.js +25 -0
  352. package/dist/util/git-names.js.map +1 -0
  353. package/dist/util/git.d.ts +12 -0
  354. package/dist/util/git.js +33 -0
  355. package/dist/util/git.js.map +1 -0
  356. package/dist/util/suggest.d.ts +6 -0
  357. package/dist/util/suggest.js +48 -0
  358. package/dist/util/suggest.js.map +1 -0
  359. package/dist/util/text.d.ts +8 -0
  360. package/dist/util/text.js +19 -0
  361. package/dist/util/text.js.map +1 -0
  362. package/dist/util/version.d.ts +7 -0
  363. package/dist/util/version.js +13 -0
  364. package/dist/util/version.js.map +1 -0
  365. package/dist/util/yaml.d.ts +30 -0
  366. package/dist/util/yaml.js +201 -0
  367. package/dist/util/yaml.js.map +1 -0
  368. package/package.json +51 -4
  369. package/resources/metafab-skill/SKILL.md +99 -0
@@ -0,0 +1,389 @@
1
+ import { homedir } from "node:os";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import validateNpmPackageName from "validate-npm-package-name";
5
+ import { ExitCode, MetafabError } from "../../errors.js";
6
+ import { redact, stripSourceCredentials } from "./redact.js";
7
+ const GITHUB_PATTERN = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
8
+ const DRIVE_PATH = /^[A-Za-z]:[\\/]/;
9
+ const UNC_PATH = /^\\\\/;
10
+ // Git's own test for the scp-like form: the first colon must come before any
11
+ // slash (so `host:path` is scp but `host/path:x` is not), and a Windows drive
12
+ // path is a path, never a host. The user is required so a drive-relative path
13
+ // such as `C:fab` is never mistaken for a repository.
14
+ const SCP_GIT = /^([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+):(.+)$/;
15
+ const SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):\/\//;
16
+ const ANY_SCHEME = /^([A-Za-z][A-Za-z0-9+.-]*):/;
17
+ const SUPPORTED_SOURCES = "an npm name, github:owner/repo, git+https://, git+ssh://, ssh://, git@host:path, git+file:///<path>, an https:// tarball, or a local path";
18
+ const GIT_SOURCE_FIX = "Use git+https://, git+ssh://, git+file://, ssh://, user@host:path or github:owner/repo for a Git repository, an https:// URL for a tarball, an npm name, or a local path";
19
+ const WINDOWS_PATH_FIX = "Write the path as C:\\fabs\\acme or C:/fabs/acme";
20
+ function isScpGit(value) {
21
+ if (DRIVE_PATH.test(value))
22
+ return false;
23
+ const colon = value.indexOf(":");
24
+ if (colon <= 0)
25
+ return false;
26
+ const slash = value.indexOf("/");
27
+ if (slash !== -1 && slash < colon)
28
+ return false;
29
+ return SCP_GIT.test(value);
30
+ }
31
+ function invalidSource(input, reason) {
32
+ return new MetafabError(`Invalid source "${redact(input)}": ${reason}`, {
33
+ exitCode: ExitCode.Failed,
34
+ code: "invalid-source",
35
+ });
36
+ }
37
+ function isPathLike(value) {
38
+ return (value.startsWith(".") ||
39
+ value.startsWith("/") ||
40
+ value.startsWith("\\") ||
41
+ value.startsWith("~") ||
42
+ DRIVE_PATH.test(value) ||
43
+ UNC_PATH.test(value));
44
+ }
45
+ function expandHome(value) {
46
+ if (value === "~")
47
+ return homedir();
48
+ if (value.startsWith("~/") || value.startsWith("~\\")) {
49
+ return path.join(homedir(), value.slice(2));
50
+ }
51
+ return value;
52
+ }
53
+ function resolvePath(value, cwd) {
54
+ if (DRIVE_PATH.test(value) || UNC_PATH.test(value)) {
55
+ return path.win32.resolve(value);
56
+ }
57
+ if (/^file:\/\/[^/]/i.test(value)) {
58
+ throw invalidSource(value, "a file URL must use three slashes");
59
+ }
60
+ if (/^file:\/\//i.test(value)) {
61
+ try {
62
+ return fileURLToPath(new URL(value));
63
+ }
64
+ catch {
65
+ throw invalidSource(value, "the file URL is not valid");
66
+ }
67
+ }
68
+ return path.resolve(cwd, expandHome(value));
69
+ }
70
+ function parseGitRef(raw, input) {
71
+ if (raw === undefined)
72
+ return undefined;
73
+ if (raw === "")
74
+ throw invalidSource(input, "the Git ref is empty");
75
+ if (raw.startsWith("semver:")) {
76
+ const range = raw.slice("semver:".length);
77
+ if (range === "")
78
+ throw invalidSource(input, "the semver range is empty");
79
+ return { type: "range", range };
80
+ }
81
+ return { type: "name", name: raw };
82
+ }
83
+ function splitRef(value) {
84
+ const index = value.lastIndexOf("#");
85
+ if (index === -1)
86
+ return { base: value };
87
+ return { base: value.slice(0, index), ref: value.slice(index + 1) };
88
+ }
89
+ function parseGithub(input) {
90
+ const { base, ref } = splitRef(input);
91
+ const repository = base.slice("github:".length);
92
+ if (!GITHUB_PATTERN.test(repository)) {
93
+ throw invalidSource(input, "expected github:owner/repo");
94
+ }
95
+ const withoutGit = repository.endsWith(".git") ? repository.slice(0, -".git".length) : repository;
96
+ return {
97
+ kind: "git",
98
+ url: `https://github.com/${withoutGit}.git`,
99
+ source: `github:${repository}`,
100
+ ...(ref === undefined ? {} : { ref: parseGitRef(ref, input) }),
101
+ };
102
+ }
103
+ // A Windows drive path after the `file://` authority, with either slash:
104
+ // `C:\fabs\fab.git` or `/C:/fabs/fab.git`.
105
+ const DRIVE_AFTER_AUTHORITY = /^\/?([A-Za-z]:[\\/].*)$/;
106
+ /**
107
+ * The `file://` URL Git reads for the text after the authority. Git's parser
108
+ * needs a `/` after the authority: a backslash path gives it no path at all
109
+ * (`file://C:\fabs\fab.git` fails with "no path specified"). Both accepted
110
+ * Windows spellings therefore become the three-slash forward-slash form.
111
+ */
112
+ function drivePathFileUrl(after) {
113
+ const match = DRIVE_AFTER_AUTHORITY.exec(after);
114
+ if (match === null)
115
+ return undefined;
116
+ return `file:///${match[1].replace(/\\/g, "/")}`;
117
+ }
118
+ /**
119
+ * A `git+file://` source is a Git repository on this machine or a mounted
120
+ * share, such as the bare fab repository `publish.git: file:///…` writes. The
121
+ * path must be absolute, so `update` can re-parse the recorded source from
122
+ * another working directory: three slashes, `localhost`, or a Windows drive.
123
+ * The URL Git is given is `file:` plus the text after `git+file:`, except that
124
+ * a Windows drive path becomes the three-slash form Git reads; re-serialising
125
+ * the rest through `new URL()` would change the recorded source and the mirror
126
+ * key.
127
+ */
128
+ function parseGitFileUrl(input) {
129
+ const { base, ref } = splitRef(input);
130
+ const rest = base.slice("git+file:".length);
131
+ if (!rest.startsWith("//")) {
132
+ throw invalidSource(input, "a Git file URL must be absolute, such as git+file:///srv/fabs/fab.git");
133
+ }
134
+ const after = rest.slice(2);
135
+ if (after === "" || after === "/") {
136
+ throw invalidSource(input, "the Git file URL has no path");
137
+ }
138
+ // Git accepts an empty host (the third slash), `localhost`, and a Windows
139
+ // drive right after `//` or `///`. Any other authority names a host.
140
+ if (!after.startsWith("/") && !/^localhost\//i.test(after) && !DRIVE_PATH.test(after)) {
141
+ throw invalidSource(input, "a Git file URL cannot name a host; use git+file:///<absolute path>");
142
+ }
143
+ return {
144
+ kind: "git",
145
+ url: drivePathFileUrl(after) ?? `file:${rest}`,
146
+ source: base,
147
+ ...(ref === undefined ? {} : { ref: parseGitRef(ref, input) }),
148
+ };
149
+ }
150
+ function schemeHint(scheme) {
151
+ // A one-letter scheme is a Windows drive with no slash after it: `C:fab` is
152
+ // drive-relative, so it cannot name a repository.
153
+ if (/^[a-z]$/.test(scheme)) {
154
+ return "A Windows path needs a slash after the drive, such as C:\\fabs\\acme";
155
+ }
156
+ if (scheme === "http")
157
+ return "Use https:// for a tarball or git+https:// for a Git repository";
158
+ if (scheme === "git" || scheme === "git+http")
159
+ return "Use git+https:// or git+ssh://";
160
+ return undefined;
161
+ }
162
+ /**
163
+ * Every value that looks like a URL scheme but is not a supported source is
164
+ * refused with the list of forms `import` reads, instead of falling through to
165
+ * the npm package-name parser and its unhelpful error. Unlike `invalidSource`,
166
+ * this carries a problem with a fix line, so the CLI prints what to write
167
+ * instead.
168
+ */
169
+ function unsupportedScheme(input, rawScheme) {
170
+ const shown = redact(input);
171
+ const scheme = rawScheme.toLowerCase();
172
+ const hint = schemeHint(scheme);
173
+ const message = `Invalid source "${shown}": unsupported URL scheme "${scheme}:". ` +
174
+ `Supported sources: ${SUPPORTED_SOURCES}${hint === undefined ? "" : `. ${hint}`}`;
175
+ const fix = /^[a-z]$/.test(scheme) ? WINDOWS_PATH_FIX : GIT_SOURCE_FIX;
176
+ return new MetafabError(message, {
177
+ exitCode: ExitCode.Failed,
178
+ code: "invalid-source",
179
+ problems: [{ level: "error", file: shown, message, fix }],
180
+ });
181
+ }
182
+ function parseGitUrl(input, prefix) {
183
+ const { base, ref } = splitRef(input);
184
+ const rawUrl = base.slice(prefix.length);
185
+ let parsed;
186
+ try {
187
+ parsed = new URL(rawUrl);
188
+ }
189
+ catch {
190
+ throw invalidSource(input, "the Git URL is not valid");
191
+ }
192
+ if (parsed.hostname === "")
193
+ throw invalidSource(input, "the Git URL has no host");
194
+ // Git compares the scheme of the URL it is handed case-sensitively, so a
195
+ // source typed as `git+HTTPS://…` would reach it as an unknown protocol.
196
+ // Lower-case only the scheme; keep the rest of the text byte for byte, and
197
+ // record `source` exactly as the user wrote it.
198
+ const schemeEnd = rawUrl.indexOf("://");
199
+ const url = `${rawUrl.slice(0, schemeEnd).toLowerCase()}${rawUrl.slice(schemeEnd)}`;
200
+ return {
201
+ kind: "git",
202
+ url,
203
+ source: base,
204
+ ...(ref === undefined ? {} : { ref: parseGitRef(ref, input) }),
205
+ };
206
+ }
207
+ function parseScpGit(input) {
208
+ const { base, ref } = splitRef(input);
209
+ if (!isScpGit(base)) {
210
+ throw invalidSource(input, "the Git URL is not valid");
211
+ }
212
+ // Keep the scp string as the URL: Git accepts it as written, and rewriting
213
+ // it to `ssh://host/path` would turn the scp form's home-relative path into
214
+ // an absolute one.
215
+ return {
216
+ kind: "git",
217
+ url: base,
218
+ source: base,
219
+ ...(ref === undefined ? {} : { ref: parseGitRef(ref, input) }),
220
+ };
221
+ }
222
+ function parseHttps(input) {
223
+ let parsed;
224
+ try {
225
+ parsed = new URL(input);
226
+ }
227
+ catch {
228
+ throw invalidSource(input, "the HTTPS URL is not valid");
229
+ }
230
+ if (parsed.protocol !== "https:" || parsed.hostname === "") {
231
+ throw invalidSource(input, "expected an https URL");
232
+ }
233
+ return { kind: "https", url: input };
234
+ }
235
+ function splitNpm(value, input) {
236
+ let name = value;
237
+ let requested;
238
+ if (value.startsWith("@")) {
239
+ const slash = value.indexOf("/");
240
+ if (slash === -1)
241
+ throw invalidSource(input, "expected an npm package name or @scope/name");
242
+ const at = value.indexOf("@", slash);
243
+ if (at !== -1) {
244
+ name = value.slice(0, at);
245
+ requested = value.slice(at + 1);
246
+ }
247
+ }
248
+ else {
249
+ const at = value.indexOf("@");
250
+ if (at > 0) {
251
+ name = value.slice(0, at);
252
+ requested = value.slice(at + 1);
253
+ }
254
+ }
255
+ if (name === "")
256
+ throw invalidSource(input, "the npm package name is empty");
257
+ const result = validateNpmPackageName(name);
258
+ if (!result.validForOldPackages) {
259
+ const reason = result.errors?.[0] ?? "the npm package name is not valid";
260
+ throw invalidSource(input, reason);
261
+ }
262
+ if (requested !== undefined) {
263
+ if (requested === "")
264
+ throw invalidSource(input, "the npm range is empty");
265
+ if (/[/\\:#]/.test(requested)) {
266
+ throw invalidSource(input, "the npm range is not valid");
267
+ }
268
+ }
269
+ return requested === undefined ? { name } : { name, requested };
270
+ }
271
+ export function parseSource(input, options) {
272
+ const value = input.trim();
273
+ if (value === "")
274
+ throw invalidSource(input, "the source is empty");
275
+ if (/^git\+file:/i.test(value))
276
+ return parseGitFileUrl(value);
277
+ if (/^file:/i.test(value)) {
278
+ const withoutProtocol = value.slice("file:".length);
279
+ if (withoutProtocol === "")
280
+ throw invalidSource(input, "the file source is empty");
281
+ return {
282
+ kind: "path",
283
+ path: resolvePath(/^file:\/\//i.test(value) ? value : withoutProtocol, options.cwd),
284
+ source: value,
285
+ };
286
+ }
287
+ if (isPathLike(value)) {
288
+ return { kind: "path", path: resolvePath(value, options.cwd), source: value };
289
+ }
290
+ if (/^github:/i.test(value))
291
+ return parseGithub(value);
292
+ if (isScpGit(value))
293
+ return parseScpGit(value);
294
+ if (/^ssh:\/\//i.test(value))
295
+ return parseGitUrl(value, "");
296
+ if (/^git\+ssh:\/\//i.test(value))
297
+ return parseGitUrl(value, "git+");
298
+ if (/^git\+https:\/\//i.test(value))
299
+ return parseGitUrl(value, "git+");
300
+ if (/^https:\/\//i.test(value))
301
+ return parseHttps(value);
302
+ // An npm name never contains `:`, and the scp and path forms above have
303
+ // already claimed `git@host:path` and `C:\…` or `C:/…`.
304
+ const scheme = ANY_SCHEME.exec(value);
305
+ if (scheme !== null)
306
+ throw unsupportedScheme(input, scheme[1]);
307
+ const npm = splitNpm(value, input);
308
+ return npm.requested === undefined
309
+ ? { kind: "npm", name: npm.name }
310
+ : { kind: "npm", name: npm.name, requested: npm.requested };
311
+ }
312
+ /**
313
+ * The URL to hand to Git: `git+https://`, `git+ssh://` and `git+file://` lose
314
+ * `git+`. The scheme is lower-cased because Git compares it case-sensitively,
315
+ * and the rest of the text is kept byte for byte. An scp form has no scheme
316
+ * with `//`, so it is returned unchanged. A `file://` Windows drive path is
317
+ * turned into the three-slash form Git reads, as `parseGitFileUrl` does.
318
+ */
319
+ export function gitTransportUrl(url) {
320
+ const match = SCHEME.exec(url);
321
+ if (match === null)
322
+ return url;
323
+ const scheme = match[1].replace(/^git\+/i, "").toLowerCase();
324
+ const after = url.slice(match[0].length);
325
+ const fileUrl = scheme === "file" ? drivePathFileUrl(after) : undefined;
326
+ return fileUrl ?? `${scheme}://${after}`;
327
+ }
328
+ // A `file:` URL whose text after `//` is a Windows drive path. Only here is the
329
+ // "authority" really the start of a path, so only here is a `@` not userinfo.
330
+ const FILE_DRIVE_AUTHORITY = /^(?:git\+)?file:\/\/[A-Za-z]:[\\/]/i;
331
+ const FILE_URL = /^(?:git\+)?file:\/\//i;
332
+ /**
333
+ * A `file:` URL that names an authority (`file://localhost/…`, and the form
334
+ * `file://user:pw@localhost/…` that carries credentials) loses the whole
335
+ * userinfo, not only the password: `parseGitFileUrl` accepts no host but an
336
+ * empty one, `localhost` or a drive, so a username left in place would make
337
+ * the recorded source, and the `import` line in a published README, fail to
338
+ * parse. The `@` kept for ssh is not useful here, and the username is not
339
+ * something to write down either.
340
+ */
341
+ function stripFileUserinfo(source) {
342
+ const file = FILE_URL.exec(source);
343
+ if (file === null)
344
+ return source;
345
+ const start = file[0].length;
346
+ const slash = source.indexOf("/", start);
347
+ const end = slash === -1 ? source.length : slash;
348
+ const at = source.lastIndexOf("@", end - 1);
349
+ if (at < start)
350
+ return source;
351
+ return source.slice(0, start) + source.slice(at + 1);
352
+ }
353
+ /**
354
+ * The source to record or key on: the value without credentials, except for a
355
+ * `file:` URL written with a Windows drive right after `//`
356
+ * (`file://C:\Users\bob@corp\fab.git`). There the authority is really the
357
+ * start of a path, so stripping would cut the `@` in the path as if it were
358
+ * userinfo and the recorded source would no longer parse. A `file:` URL that
359
+ * does name an authority (`file://user:pw@localhost/…`) loses all of its
360
+ * userinfo, so the recorded source stays a `file:` URL `import` accepts. Every
361
+ * other form keeps `stripSourceCredentials`.
362
+ */
363
+ export function sourceWithoutCredentials(source) {
364
+ if (FILE_DRIVE_AUTHORITY.test(source))
365
+ return source;
366
+ if (FILE_URL.test(source))
367
+ return stripFileUserinfo(source);
368
+ return stripSourceCredentials(source);
369
+ }
370
+ /**
371
+ * The source `import` accepts for a URL Git accepts: `https://` and `file://`
372
+ * gain `git+`. A `#` in a `file:` path becomes `%23`, because Git reads it
373
+ * literally in a path while a source splits it off as the ref: the repository
374
+ * `/srv/my#fab.git` would otherwise be imported as `/srv/my` at ref `fab.git`.
375
+ * Every other form is returned unchanged, and only the scheme text changes.
376
+ */
377
+ export function importSourceForGitUrl(url) {
378
+ const match = SCHEME.exec(url);
379
+ if (match === null)
380
+ return url;
381
+ const scheme = match[1].toLowerCase();
382
+ const bare = scheme.replace(/^git\+/, "");
383
+ if (scheme !== "https" && bare !== "file")
384
+ return url;
385
+ const rest = url.slice(match[0].length);
386
+ const path = bare === "file" ? rest.replace(/#/g, "%23") : rest;
387
+ return scheme.startsWith("git+") ? `${scheme}://${path}` : `git+${scheme}://${path}`;
388
+ }
389
+ //# sourceMappingURL=parse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../src/core/sources/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,sBAAsB,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAO7D,MAAM,cAAc,GAAG,oCAAoC,CAAC;AAC5D,MAAM,UAAU,GAAG,iBAAiB,CAAC;AACrC,MAAM,QAAQ,GAAG,OAAO,CAAC;AACzB,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,sDAAsD;AACtD,MAAM,OAAO,GAAG,0CAA0C,CAAC;AAC3D,MAAM,MAAM,GAAG,iCAAiC,CAAC;AACjD,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAEjD,MAAM,iBAAiB,GACrB,2IAA2I,CAAC;AAC9I,MAAM,cAAc,GAClB,0KAA0K,CAAC;AAC7K,MAAM,gBAAgB,GAAG,kDAAkD,CAAC;AAE5E,SAAS,QAAQ,CAAC,KAAa;IAC7B,IAAI,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,I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GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,GAAG,CAAC;IAC/B,MAAM,MAAM,GAAI,KAAK,CAAC,CAAC,CAAY,CAAC,WAAW,EAAE,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC1C,IAAI,MAAM,KAAK,OAAO,IAAI,IAAI,KAAK,MAAM;QAAE,OAAO,GAAG,CAAC;IACtD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,MAAM,MAAM,IAAI,EAAE,CAAC;AACvF,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { FetchedFab, Resolved } from "./types.js";
2
+ export type ResolvedPath = Extract<Resolved, {
3
+ kind: "path";
4
+ }>;
5
+ export interface PathOptions {
6
+ maxEntries?: number;
7
+ maxTotalSize?: number;
8
+ }
9
+ export declare function locateFactoryDir(specPath: string): Promise<string>;
10
+ export declare function fetchPath(source: ResolvedPath, options?: PathOptions): Promise<FetchedFab>;