@exodus/stasis 1.0.0-beta.14 → 1.0.0-beta.16

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 (67) hide show
  1. package/README.md +2 -1
  2. package/bin/stasis.js +99 -16
  3. package/package.json +22 -9
  4. package/src/audit-corrections.js +11 -42
  5. package/src/audit.js +241 -190
  6. package/src/babel.js +39 -122
  7. package/src/bundle-from-lockfile.js +9 -21
  8. package/src/bundle-reader.js +5 -9
  9. package/src/bundle.js +0 -3
  10. package/src/cmd/build.js +82 -174
  11. package/src/cmd/bundle-options.js +113 -167
  12. package/src/cmd/bundle.js +942 -1294
  13. package/src/cmd/diff.js +1 -4
  14. package/src/cmd/github-bundle.js +21 -26
  15. package/src/cmd/output.js +15 -12
  16. package/src/cmd/sbom.js +3 -8
  17. package/src/cmd/tokens.js +16 -23
  18. package/src/define.js +36 -94
  19. package/src/diff.js +72 -128
  20. package/src/esbuild.js +0 -4
  21. package/src/flow.js +18 -13
  22. package/src/installed.js +265 -0
  23. package/src/json-stream.js +4 -9
  24. package/src/loader-mock.js +3 -8
  25. package/src/loader.js +1 -5
  26. package/src/loaders/bash.js +41 -93
  27. package/src/loaders/cargo.js +298 -805
  28. package/src/loaders/foundry.js +109 -285
  29. package/src/loaders/paths.js +13 -13
  30. package/src/loaders/php.js +210 -489
  31. package/src/loaders/rust.js +507 -1430
  32. package/src/loaders/solidity-ownership.js +48 -128
  33. package/src/loaders/solidity.js +39 -122
  34. package/src/loaders/toml.js +7 -17
  35. package/src/lockfile.js +0 -3
  36. package/src/metro-assets.js +10 -384
  37. package/src/metro-resolver.js +58 -134
  38. package/src/metro-transformer.js +0 -5
  39. package/src/metro.js +0 -4
  40. package/src/mock.js +32 -80
  41. package/src/parse.js +4 -4
  42. package/src/prune.js +0 -3
  43. package/src/resolve-fields.js +137 -532
  44. package/src/resolve-node.js +27 -45
  45. package/src/resolve-typescript.js +166 -298
  46. package/src/rollup.js +0 -4
  47. package/src/run-installed.js +10 -0
  48. package/src/sbom.js +52 -128
  49. package/src/scan.js +142 -284
  50. package/src/sixel.js +310 -0
  51. package/src/table.js +63 -31
  52. package/src/validate-notes.d.ts +19 -0
  53. package/src/validate-notes.js +72 -0
  54. package/src/validate.d.ts +159 -0
  55. package/src/validate.js +596 -522
  56. package/src/vfs-bundle/entries.js +40 -57
  57. package/src/vfs-bundle/github.js +80 -122
  58. package/src/vfs-bundle/glob.js +4 -45
  59. package/src/vfs-bundle/lazy.js +27 -56
  60. package/src/vfs-bundle/prisma.js +235 -105
  61. package/src/vfs-bundle/soldeer.js +28 -49
  62. package/src/vfs-bundle/tree.js +295 -318
  63. package/src/vfs-bundle/yarnclean.js +10 -31
  64. package/src/vfs-bundle.js +23 -64
  65. package/src/webpack.js +0 -4
  66. package/src/why.js +78 -232
  67. package/src/installed-commits.js +0 -184
@@ -1,7 +1,5 @@
1
- // Who owns each file of a Solidity project -- the project or one of its dependencies -- decided by
2
- // where the file really is, for the import resolution (solidity.js), forge's config discovery
3
- // (foundry.js) and the bundler's --manifests. Dependencies are untrusted input: a link one plants
4
- // out of itself is never followed.
1
+ // Who owns each file of a Solidity project, by where it really is. Dependencies are untrusted input: a link
2
+ // one plants out of itself is never followed.
5
3
 
6
4
  import { realpathSync } from 'node:fs'
7
5
  import { isAbsolute, join, parse, posix, relative, resolve, sep } from 'node:path'
@@ -10,20 +8,15 @@ import { utf8toString } from '@exodus/bytes/utf8.js'
10
8
  import { LockfileError, parseGitmodules } from '@preventive/lockfile/foundry.js'
11
9
  import { NO_ENTRY, lexists, readRegularFileOrNull } from '@exodus/stasis-core/bundle-util'
12
10
  import { diskHost } from '@exodus/stasis-core/host'
13
- import { hasNodeModulesSegment, nestedMap, relativeEscapes } from '@exodus/stasis-core/util'
11
+ import { hasNodeModulesSegment, memoized, nestedMap, relativeEscapes, upsert } from '@exodus/stasis-core/util'
14
12
  import { isDir } from '../resolve-typescript.js'
15
13
 
16
- // `/`-separated, as the loader's paths are: only Windows' separator is converted (on POSIX a `\\` is
17
- // part of a name, and must not read as a directory boundary).
14
+ // Only Windows' separator: on POSIX a `\\` is part of a name, and must not read as a directory boundary.
18
15
  const toSlashes = (p) => (sep === '\\' ? p.replaceAll('\\', '/') : p)
19
16
 
20
- // --- Reading --------------------------------------------------------------------------------
21
-
22
- // `p`'s real path as `host` resolves it, which throws when it can't: on disk, as the OS does
23
- // (realpath(3): the filesystem's own spelling, which Node's realpathSync doesn't give).
17
+ // On disk as the OS resolves it (realpath(3): the filesystem's own spelling, which Node's realpathSync doesn't give).
24
18
  const realpathIn = (host, p) => (host === diskHost ? realpathSync.native(p) : host.realpath(p))
25
19
 
26
- // `p`'s real path (realpathIn), or null.
27
20
  export function realpathOrNull(p, host = diskHost) {
28
21
  try {
29
22
  return realpathIn(host, p)
@@ -32,16 +25,10 @@ export function realpathOrNull(p, host = diskHost) {
32
25
  }
33
26
  }
34
27
 
35
- // A path relative to a dir (slashes) that stays inside it.
36
28
  const inRoot = (rel) => !relativeEscapes(rel)
37
29
 
38
- // `abs`, a file the resolution read, relative to the project `root` (slashes): as spelled when that
39
- // lies inside it with no `..` to resolve (a linked lib's files keep the lib's path), else by real
40
- // paths -- where the read went (an absolute or `/proc/self/cwd` lib; a `..` after a symlink) --
41
- // `../` when outside the project. One whose real path the OS can't give (past PATH_MAX) is never
42
- // normalized, which could name another file: it keeps the path it was read by, `..` and all, from
43
- // the root however that's spelled (as given or by its real path), for solidityOwnership to refuse,
44
- // or else stays absolute, a name --manifests refuses as unresolvable. Real paths are `host`'s.
30
+ // As spelled inside `root` with no `..` to resolve, else by real paths. One with no real path is never normalized,
31
+ // which could name another file: it keeps its `..`s, for solidityOwnership to refuse.
45
32
  export function projectRelative(root, abs, host = diskHost) {
46
33
  const rel = toSlashes(relative(root, abs))
47
34
  if (inRoot(rel) && !toSlashes(abs).split('/').includes('..')) return rel
@@ -51,8 +38,6 @@ export function projectRelative(root, abs, host = diskHost) {
51
38
  return below(resolve(root), abs) ?? (realRoot === null ? null : below(realRoot, abs)) ?? toSlashes(abs)
52
39
  }
53
40
 
54
- // `abs` from `dir`, component by component as spelled (empty and `.` ones dropped, `..` kept), or
55
- // null when it doesn't start with `dir`'s components.
56
41
  function below(dir, abs) {
57
42
  const parts = (p) => toSlashes(p).split('/').filter((c) => c !== '' && c !== '.')
58
43
  const d = parts(dir)
@@ -60,10 +45,8 @@ function below(dir, abs) {
60
45
  return d.length < a.length && d.every((c, i) => a[i] === c) ? a.slice(d.length).join('/') : null
61
46
  }
62
47
 
63
- // realpathIn `host` of `p`: `{ real }`, or `{ real: null, missing }`, `missing` only when nothing
64
- // is there at all. The OS may fail to resolve what is there -- a real path past PATH_MAX, a loop, a
65
- // link whose end it can't name (`/proc/self/fd/0` on a pipe), a dir it may not search -- and a
66
- // read may still get through.
48
+ // `missing` only when nothing is there at all: the OS may fail to resolve what is there (past PATH_MAX, a loop,
49
+ // `/proc/self/fd/0` on a pipe, a dir it may not search), and a read may still get through.
67
50
  function osRealpath(p, host) {
68
51
  try {
69
52
  return { real: realpathIn(host, p), missing: false }
@@ -72,9 +55,8 @@ function osRealpath(p, host) {
72
55
  }
73
56
  }
74
57
 
75
- // `bytes` as UTF-8 text, a byte-order mark kept. Bytes that aren't UTF-8 throw, naming them
76
- // `label`, rather than read with U+FFFD in their place: forge, solc and git refuse such a file, and
77
- // the text bundled or read must be the file's own.
58
+ // A BOM kept. Bytes that aren't UTF-8 throw rather than read with U+FFFD in their place: forge, solc and git
59
+ // refuse such a file, and the text bundled or read must be the file's own.
78
60
  export function decodeUtf8(bytes, label) {
79
61
  try {
80
62
  return utf8toString(bytes)
@@ -83,22 +65,12 @@ export function decodeUtf8(bytes, label) {
83
65
  }
84
66
  }
85
67
 
86
- // A config file's text (decodeUtf8), or null when there's no file (readRegularFileOrNull: a regular
87
- // file only, read through `host`). Errors name it `label`.
88
68
  export function readUtf8OrNull(file, label, host = diskHost) {
89
69
  const buf = readRegularFileOrNull(file, label, host)
90
70
  return buf === null ? null : decodeUtf8(buf, label)
91
71
  }
92
72
 
93
- // --- .gitmodules ------------------------------------------------------------------------------
94
-
95
- // The submodules of the project at `baseDir`, `{ path, url, branch }` (`url` and `branch` when set),
96
- // from its `.gitmodules` as @preventive/lockfile reads it (as git does). A url is taken as written
97
- // (`checkUrls: false`): relative to the superproject's remote, a path or none, as it only names a
98
- // GitHub submodule's bucket. A file the library refuses -- something git reads two ways, or that it
99
- // doesn't check (`update = none`, `active`, a `[core]` section) -- never fails the bundle: it's
100
- // warned about and read submodule by submodule (gitmodulesLeniently). One git itself refuses is an
101
- // error: read past what git can't, a submodule's section would be lost, and its directory with it.
73
+ // One the library refuses is warned about and read submodule by submodule; one git itself refuses is an error.
102
74
  export function readGitmodules(baseDir, host = diskHost) {
103
75
  const text = readUtf8OrNull(join(baseDir, '.gitmodules'), '.gitmodules', host)
104
76
  if (text === null) return []
@@ -113,20 +85,12 @@ export function readGitmodules(baseDir, host = diskHost) {
113
85
  }
114
86
  }
115
87
 
116
- // The keys a submodule is read for; past `path`, they're dropped in this order to read the rest.
88
+ // Past `path`, they're dropped in this order to read the rest.
117
89
  const SUBMODULE_KEYS = new Set(['path', 'url', 'branch'])
118
90
  const DROPPABLE = ['branch', 'url']
119
91
 
120
- // `.gitmodules` text the library refused as a whole, read as git reads it (readGitConfig) a
121
- // submodule at a time: a key of `submodule.<name>.<key>`, from `[submodule "name"]` or
122
- // `[submodule.name]`, its last `path`, `url` and `branch` (the sections of one name merged), as git
123
- // reads the checkout's .gitmodules -- a value replaces an earlier one, but for a path or url git
124
- // ignores, one starting with `-` -- each submodule then read by the library alone. One that still
125
- // doesn't read loses its branch, then its url; one whose path doesn't read fails closed: its
126
- // directory, when the path names one inside the repository (`./lib/x`, `lib/x/`), is still a
127
- // dependency, just unnamed, and else the submodule is skipped. Every other path given it is a
128
- // dependency too: git reads the first of two where it reads .gitmodules from a commit, so no path a
129
- // submodule is given may name the project's own code. `notes` say what was dropped.
92
+ // Each submodule's last `path`, `url` and `branch` read by the library alone, dropping its branch, then url,
93
+ // until it reads; failing closed: every path given it a dependency, if unnamed.
130
94
  function gitmodulesLeniently(text) {
131
95
  const sections = new Map() // a submodule's name -> Map<key, its entry>
132
96
  const paths = new Map() // a submodule's name -> every `path` given it
@@ -137,7 +101,7 @@ function gitmodulesLeniently(text) {
137
101
  const name = variable.slice('submodule.'.length)
138
102
  if (section !== 'submodule') notes.push(`${header}, a section git reads as [submodule "${name}"]; reading it as that`)
139
103
  const kept = nestedMap(sections, name)
140
- const given = paths.get(name) ?? paths.set(name, []).get(name)
104
+ const given = upsert(paths, name, () => [])
141
105
  for (const entry of keys) {
142
106
  if (!SUBMODULE_KEYS.has(entry.key)) continue
143
107
  if (entry.key === 'path') given.push(entry.value)
@@ -187,27 +151,20 @@ function gitmodulesLeniently(text) {
187
151
  return { submodules, notes }
188
152
  }
189
153
 
190
- // A `path`'s value -> the directory it names, normalized, when that lies inside the repository (else
191
- // null): `./lib/x` and `lib/x/` are lib/x.
192
154
  function normalSubmodulePath(value) {
193
155
  if (typeof value !== 'string') return null
194
156
  const path = posix.normalize(value).replace(/\/+$/u, '')
195
157
  return path !== '' && path !== '.' && inRoot(path) ? path : null
196
158
  }
197
159
 
198
- // git's ctype, ASCII alone: only these are space, and a key is letters, digits and `-`, starting with
199
- // a letter.
160
+ // git's ctype, ASCII alone.
200
161
  const GIT_SPACE = new Set([' ', '\t', '\n', '\r'])
201
162
  const isGitAlpha = (char) => /^[A-Za-z]$/u.test(char)
202
163
  const isGitKeyChar = (char) => /^[\dA-Za-z-]$/u.test(char)
203
164
  const GIT_ESCAPES = { __proto__: null, t: '\t', b: '\b', n: '\n', '\\': '\\', '"': '"' }
204
165
 
205
- // `.gitmodules` text as git's config.c reads a config file, to the character, refusing what git
206
- // refuses ("bad config line") and nothing more: its sections in order, each `{ section, subsection,
207
- // header, keys }` -- the name lowercased, the subsection with a backslash's character for it, the
208
- // header as written -- and each key `{ key, value, text }`: its name lowercased, its value (null for
209
- // a key alone) and its text, from the key to the end of its value. Keys before any header are in a
210
- // first section with no name.
166
+ // As git's config.c reads it, refusing what git refuses and nothing more; keys before any header in a first,
167
+ // unnamed section, a key's `text` from the key to its value's end.
211
168
  function readGitConfig(text) {
212
169
  const src = text.startsWith('\uFEFF') ? text.slice(1) : text // a byte-order mark git skips
213
170
  let pos = 0
@@ -231,7 +188,7 @@ function readGitConfig(text) {
231
188
  }
232
189
  const refuse = (what) => new Error(`.gitmodules: ${what} at line ${at}; git refuses such a file`)
233
190
 
234
- // git's get_base_var and get_extended_base_var: `[name]` or `[name "subsection"]`.
191
+ // git's get_base_var and get_extended_base_var.
235
192
  const readHeader = () => {
236
193
  let section = ''
237
194
  for (;;) {
@@ -261,8 +218,7 @@ function readGitConfig(text) {
261
218
  if (next() !== ']') throw refuse('a subsection with no "]" right after it')
262
219
  return subsection
263
220
  }
264
- // git's parse_value: quotes, escapes, a `\` that runs the value on, a comment outside quotes, and
265
- // space outside quotes trimmed at both ends.
221
+ // git's parse_value.
266
222
  const readValue = () => {
267
223
  let value = ''
268
224
  let quoted = false
@@ -299,7 +255,7 @@ function readGitConfig(text) {
299
255
  }
300
256
  }
301
257
  }
302
- // git's get_value: a key, and `=` and its value or nothing.
258
+ // git's get_value.
303
259
  const readKey = (first, start) => {
304
260
  let key = first.toLowerCase()
305
261
  let char = next()
@@ -336,8 +292,6 @@ function readGitConfig(text) {
336
292
  }
337
293
  }
338
294
 
339
- // --- Ownership --------------------------------------------------------------------------------
340
-
341
295
  const readdirOrEmpty = (dir, host) => {
342
296
  try {
343
297
  return host.readdir(dir)
@@ -350,27 +304,8 @@ const NOTHING = { abs: null, escape: null }
350
304
  // A link target's separators, as the OS reads them (a `\\` is part of a name on POSIX).
351
305
  const TARGET_SEPARATORS = sep === '\\' ? /[\\/]/u : /\//u
352
306
 
353
- // Who owns each project-relative path, decided from how it resolves on disk. The dependencies are
354
- // every `node_modules/<pkg>` (`@scope/<pkg>`), each entry of the `dirs` (forge's libs, Soldeer's
355
- // `dependencies/`; a linked entry is the dependency where it points, as a symlinked
356
- // `lib/forge-std`), and the `packages` (git submodules). `assert(path)` throws for a path `of`
357
- // refuses; `of(path)` gives `{ real, outside, dependency, escape }`:
358
- // - `real`: the real path, spelled as the filesystem spells it (project-relative; null when
359
- // nothing is there), `outside` when it's out of the root;
360
- // - `dependency`: the real path lies in a dependency, however the path got there (a project's
361
- // `src/vendor -> ../lib/dep/src` holds the dependency's code);
362
- // - `escape`: `{ link, root, why }` (and `reason`, saying so) when the path may not be read: it
363
- // crosses a symlink that no one trusted placed -- one planted inside the dependency `root` that
364
- // leads out of it to anything but another dependency (`lib/evil/src/Evil.sol -> ../../../.env`),
365
- // or one outside the project (`root` null) that leads back into it (a dependency linked from
366
- // elsewhere: `lib/evil -> ../../shared/evil` holding `Evil.sol -> ../../proj/.env`) -- or
367
- // (`why: 'unresolved'`) the walk below can't vouch for it: it resolves the path link by link, and
368
- // where that doesn't land where the OS's realpath does (a link target it can't read as the OS
369
- // does, one that isn't UTF-8), or the OS can't resolve it at all (a real path past PATH_MAX), the
370
- // path is refused rather than trusted. `real` null with no `escape` means nothing is there. A
371
- // link the project placed (a workspace package in node_modules, a linked `lib/` entry) may lead
372
- // anywhere in the root, and so may one on the path the project was named by (a symlinked
373
- // checkout, macOS's `/tmp`). The project is read through `host`.
307
+ // The dependencies are every `node_modules/<pkg>`, each entry of `dirs` and the `packages`. An `escape` is a link
308
+ // a dependency planted out of itself, one from outside back in, or one the walk can't vouch for.
374
309
  export function solidityOwnership(baseDir, { dirs = [], packages = [], host = diskHost } = {}) {
375
310
  const realBase = realpathIn(host, baseDir)
376
311
  const realOf = (p) => realpathOrNull(p, host)
@@ -381,14 +316,13 @@ export function solidityOwnership(baseDir, { dirs = [], packages = [], host = di
381
316
  const under = (rel, dir) => rel === dir || rel.startsWith(`${dir}/`)
382
317
  const clean = (d) => posix.normalize(toSlashes(d)).replace(/\/+$/u, '')
383
318
 
384
- // Dirs whose entries are dependencies, and dependency dirs themselves; each by its real path too.
319
+ // Dirs whose entries are dependencies, and dependency dirs themselves, each by its real path too.
385
320
  const holders = new Set()
386
321
  const roots = new Set()
387
322
  const addReal = (set, rel) => {
388
323
  const real = realOf(join(baseDir, rel))
389
324
  if (real !== null && inside(toRel(real))) set.add(toRel(real))
390
325
  }
391
- // A dir as the project names it: relative to the root, or (an absolute lib) by its real path.
392
326
  const projectDir = (d) => {
393
327
  if (!isAbsolute(d)) return clean(d)
394
328
  const real = realOf(d)
@@ -406,7 +340,6 @@ export function solidityOwnership(baseDir, { dirs = [], packages = [], host = di
406
340
  }
407
341
  const dependencyDirs = [...holders, ...roots]
408
342
  const inDependency = (rel) => inside(rel) && (hasNodeModulesSegment(rel) || dependencyDirs.some((d) => under(rel, d)))
409
- // The innermost dependency holding `rel`, a real path.
410
343
  const rootOf = (rel) => {
411
344
  if (!inside(rel)) return null
412
345
  const parts = rel.split('/')
@@ -423,10 +356,8 @@ export function solidityOwnership(baseDir, { dirs = [], packages = [], host = di
423
356
  return best
424
357
  }
425
358
 
426
- // Resolve `parts` from the real dir `start` as realpath does, checking each symlink crossed
427
- // (and those its target crosses): `{ abs, escape }`, `abs` null when nothing is there, and
428
- // spelled as given past the last link. A link's dir and target take the filesystem's spelling (a
429
- // case-insensitive one finds `lib` for `LIB`) before their owners are judged.
359
+ // As realpath resolves `parts`, checking each symlink crossed. A link's dir and target take the filesystem's
360
+ // spelling (a case-insensitive one finds `lib` for `LIB`) before their owners are judged.
430
361
  const walk = (start, parts, depth) => {
431
362
  let cur = start
432
363
  for (const part of parts) {
@@ -467,35 +398,27 @@ export function solidityOwnership(baseDir, { dirs = [], packages = [], host = di
467
398
  return { abs: cur, escape: null }
468
399
  }
469
400
 
470
- const owners = new Map()
471
- const of = (rel) => {
472
- let owner = owners.get(rel)
473
- if (owner === undefined) {
474
- // As given, not normalized: the OS resolves a `..` after a link from where the link leads.
475
- const path = rel === '' ? realBase : `${realBase}${sep}${rel}`
476
- let { abs, escape } = walk(realBase, rel.split('/'), 0)
477
- if (escape === null) {
478
- // The OS's answer is the one a read gets: the walk must agree with it, or the path is
479
- // refused, as it is when the OS can't resolve it at all, though a read may still get through.
480
- // (Past its last link the walk's path is spelled as given; with none, it's `path` itself.)
481
- const { real: os, missing } = osRealpath(path, host)
482
- const walked = abs === null ? null : abs === path ? os : realOf(abs)
483
- if (walked !== os || (os === null && !missing)) escape = { link: rel, root: null, why: 'unresolved' }
484
- abs = os
485
- }
486
- const real = abs === null ? null : toRel(abs)
487
- owner = {
488
- real,
489
- outside: real !== null && !inRoot(real),
490
- dependency: real !== null && inDependency(real),
491
- escape,
492
- reason: escape && escapeReason(rel, escape),
493
- }
494
- owners.set(rel, owner)
401
+ const of = memoized((rel) => {
402
+ // As given, not normalized: the OS resolves a `..` after a link from where the link leads.
403
+ const path = rel === '' ? realBase : `${realBase}${sep}${rel}`
404
+ let { abs, escape } = walk(realBase, rel.split('/'), 0)
405
+ if (escape === null) {
406
+ // The OS's answer is the one a read gets: the walk must agree with it, or the path is refused, as it is
407
+ // when the OS can't resolve it at all.
408
+ const { real: os, missing } = osRealpath(path, host)
409
+ const walked = abs === null ? null : abs === path ? os : realOf(abs)
410
+ if (walked !== os || (os === null && !missing)) escape = { link: rel, root: null, why: 'unresolved' }
411
+ abs = os
495
412
  }
496
- return owner
497
- }
498
- // Throws, saying why, for a path `of` refuses; `what` names it (`'entry '`).
413
+ const real = abs === null ? null : toRel(abs)
414
+ return {
415
+ real,
416
+ outside: real !== null && !inRoot(real),
417
+ dependency: real !== null && inDependency(real),
418
+ escape,
419
+ reason: escape && escapeReason(rel, escape),
420
+ }
421
+ })
499
422
  const assert = (rel, what = '') => {
500
423
  const { reason } = of(rel)
501
424
  if (reason) throw new Error(`Refusing ${what}${rel}: ${reason}`)
@@ -503,16 +426,13 @@ export function solidityOwnership(baseDir, { dirs = [], packages = [], host = di
503
426
  return { of, assert }
504
427
  }
505
428
 
506
- // The ownership of the project at `baseDir` given its lib dirs (`soldeer`: forge's `dependencies/`
507
- // holds dependencies too), with its git submodules, which it keeps as `submodules` (readGitmodules),
508
- // read through `host`.
429
+ // `soldeer`: forge's `dependencies/` holds dependencies too.
509
430
  export function projectOwnership(baseDir, libs, { soldeer = false, host = diskHost } = {}) {
510
431
  const submodules = readGitmodules(baseDir, host)
511
432
  const dirs = [...libs, ...(soldeer ? ['dependencies'] : [])]
512
433
  return { ...solidityOwnership(baseDir, { dirs, packages: submodules.map((s) => s.path), host }), submodules }
513
434
  }
514
435
 
515
- // Why a path is refused (see solidityOwnership).
516
436
  function escapeReason(path, { link, root, why }) {
517
437
  if (why === 'unresolved') return `${path} crosses a link stasis can't follow the way the filesystem does`
518
438
  const what = root === null ? 'a link from outside the project root back into it' : `a link out of the dependency ${root}`