@preventive/deptree 1.5.1 → 1.5.3
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.
- package/bin/compare.js +10 -21
- package/bin/deptree.js +5 -10
- package/cargo.d.ts +139 -195
- package/cargo.js +0 -2
- package/cocoapods.d.ts +211 -381
- package/cocoapods.js +0 -2
- package/npm.d.ts +245 -369
- package/npm.js +4 -6
- package/package.json +2 -2
- package/pnpm.d.ts +258 -667
- package/pnpm.js +2 -4
- package/soldeer.d.ts +144 -215
- package/soldeer.js +0 -2
- package/src/cargo/crate.js +21 -46
- package/src/cargo/inputs.js +5 -8
- package/src/cargo/members.js +6 -12
- package/src/cargo/registry.js +5 -9
- package/src/cargo/tree.js +8 -13
- package/src/cargo/workspace.js +13 -26
- package/src/cocoapods/archive.js +19 -40
- package/src/cocoapods/clean.js +21 -45
- package/src/cocoapods/fnmatch.js +12 -27
- package/src/cocoapods/inputs.js +5 -11
- package/src/cocoapods/install.js +11 -24
- package/src/cocoapods/podspec.js +19 -40
- package/src/cocoapods/podtree.js +10 -19
- package/src/cocoapods/source.js +13 -30
- package/src/cocoapods/tree.js +17 -39
- package/src/cocoapods/unicode.js +3 -9
- package/src/github.js +12 -24
- package/src/glob.js +2 -4
- package/src/lazy.js +2 -4
- package/src/manifest.js +2 -4
- package/src/matcher.js +3 -5
- package/src/mount.js +7 -14
- package/src/npm/bins.js +3 -5
- package/src/npm/compat.js +3 -5
- package/src/npm/package.js +6 -12
- package/src/npm/ratio.js +3 -5
- package/src/npm/settings.js +3 -5
- package/src/npm/tree.js +6 -11
- package/src/npm/versions.js +3 -4
- package/src/npmrc.js +2 -4
- package/src/patch.js +8 -14
- package/src/pnpm/bins.js +16 -42
- package/src/pnpm/filename.js +2 -4
- package/src/pnpm/gitignore.js +2 -4
- package/src/pnpm/glob.js +3 -5
- package/src/pnpm/hoist.js +8 -16
- package/src/pnpm/hoisted.js +15 -44
- package/src/pnpm/hook.js +2 -4
- package/src/pnpm/install.js +5 -10
- package/src/pnpm/lazy.js +8 -23
- package/src/pnpm/local.js +2 -4
- package/src/pnpm/minimatch.js +8 -15
- package/src/pnpm/nm-hoist.js +5 -11
- package/src/pnpm/npm-packlist.js +3 -6
- package/src/pnpm/overrides.js +2 -4
- package/src/pnpm/package.js +10 -16
- package/src/pnpm/packlist.js +3 -7
- package/src/pnpm/patches.js +3 -4
- package/src/pnpm/production.js +9 -28
- package/src/pnpm/projects.js +2 -6
- package/src/pnpm/readers.js +2 -4
- package/src/pnpm/settings.js +2 -5
- package/src/pnpm/tree.js +14 -37
- package/src/pnpm/workspace.js +4 -7
- package/src/pnpm/write.js +1 -1
- package/src/soldeer/config.js +5 -9
- package/src/soldeer/tree.js +2 -4
- package/src/soldeer/zip.js +8 -17
- package/src/tarball.js +12 -29
- package/src/yarn1/compat.js +2 -4
- package/src/yarn1/hoist.js +3 -8
- package/src/yarn1/package.js +12 -23
- package/src/yarn1/resolve.js +6 -11
- package/src/yarn1/settings.js +5 -10
- package/src/yarn1/tree.js +9 -18
- package/yarn1.d.ts +203 -360
- package/yarn1.js +4 -6
package/bin/compare.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
// and
|
|
3
|
-
// install makes to its type, mode, and bytes or link target; and how they
|
|
4
|
-
// differ: files and links as @preventive/compare tells them, the rest here.
|
|
1
|
+
// What is on disk and what deptree builds, each a map from a path under the install's folders to its type,
|
|
2
|
+
// mode, and bytes or target; and how they differ, files and links as @preventive/compare tells them
|
|
5
3
|
|
|
6
4
|
import { Buffer } from 'node:buffer'
|
|
7
5
|
import { lstatSync, readFileSync, readdirSync, readlinkSync, statSync } from 'node:fs'
|
|
@@ -29,17 +27,12 @@ export function projectView(root) {
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
// What deptree never builds:
|
|
33
|
-
//
|
|
34
|
-
// dependency Soldeer clones, and what CocoaPods generates in Pods beside the
|
|
35
|
-
// pods but its record, Manifest.lock: the podspecs of pods by :path, headers,
|
|
36
|
-
// support files and the projects.
|
|
30
|
+
// What deptree never builds: .bin, each manager's record of its install and pnpm 11's unread package map,
|
|
31
|
+
// a Soldeer clone's .git, and what CocoaPods generates in Pods but Manifest.lock
|
|
37
32
|
const NOT_BUILT = /(?:^|\/)node_modules\/(?:\.bin|\.modules\.yaml|\.pnpm-workspace-state(?:-v\d+)?\.json|\.pnpm\/lock\.yaml|\.package-lock\.json|\.package-map\.json|\.yarn-integrity)(?:\/|$)|^dependencies\/[^/]+\/\.git(?:\/|$)|^Pods\/(?:Local Podspecs|Headers|Target Support Files|\.project_cache|[^/]+\.xcodeproj)(?:\/|$)/u
|
|
38
33
|
|
|
39
|
-
// Everything under each of `dirs` as `view` has it,
|
|
40
|
-
//
|
|
41
|
-
// folder not there left out. A directory deptree never builds is one entry,
|
|
42
|
-
// not entered, as only it is ever listed.
|
|
34
|
+
// Everything under each of `dirs` as `view` has it, links not followed and files read whole; a directory
|
|
35
|
+
// deptree never builds is one entry, not entered
|
|
43
36
|
export function readSide(view, dirs) {
|
|
44
37
|
const entries = new Map()
|
|
45
38
|
const stack = dirs.filter((dir) => typeOf(view, dir, false) !== undefined)
|
|
@@ -55,10 +48,8 @@ export function readSide(view, dirs) {
|
|
|
55
48
|
return entries
|
|
56
49
|
}
|
|
57
50
|
|
|
58
|
-
// The paths on disk alone that hold nothing Node resolves: what deptree never
|
|
59
|
-
//
|
|
60
|
-
// .bin of links to what it removed, a scope once its last package goes, or
|
|
61
|
-
// the hoisted linker's .pnpm of its state alone.
|
|
51
|
+
// The paths on disk alone that hold nothing Node resolves: what deptree never builds, and directories of
|
|
52
|
+
// nothing else, as pnpm leaves a .bin of links to what it removed, or an emptied scope
|
|
62
53
|
export function leftOut(changes, disk) {
|
|
63
54
|
const left = new Set(changes.filter(({ mark }) => mark === '-').map(({ path }) => path))
|
|
64
55
|
for (const [path, { type }] of disk) {
|
|
@@ -105,10 +96,8 @@ function changeOf({ status, old: disk, new: tree }) {
|
|
|
105
96
|
return { mark: '~', type: tree.type, what: what.join('; '), content }
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
// How the disk differs from the tree, in walk order, each file or link with
|
|
109
|
-
//
|
|
110
|
-
// a path only one side has, or of another type on each, as only a directory
|
|
111
|
-
// has anything in it; a directory's own mode is the umask's, not compared.
|
|
99
|
+
// How the disk differs from the tree, in walk order, each file or link with compare's `status` of it.
|
|
100
|
+
// Nothing under a path one side lacks or types otherwise is listed; a directory's mode is not compared.
|
|
112
101
|
export function difference(disk, tree) {
|
|
113
102
|
const shown = (path) => disk.get(dirname(path))?.type === tree.get(dirname(path))?.type
|
|
114
103
|
const changes = []
|
package/bin/deptree.js
CHANGED
|
@@ -92,13 +92,11 @@ const OPTIONS = {
|
|
|
92
92
|
help: { type: 'boolean', short: 'h' },
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// Each package manager by its version flag: its lockfile, the folder it
|
|
96
|
-
// installs into in each project it finds, and the version where the flag is
|
|
97
|
-
// left out and nothing pins one, or, `pinned`, what the project pins, or,
|
|
98
|
-
// `unpinned`, that the flag is needed; `development`, that it installs every
|
|
99
|
-
// dependency, there being no other kind.
|
|
100
95
|
const github = () => createClient({ token: process.env.GITHUB_TOKEN || process.env.GH_TOKEN || null })
|
|
101
96
|
|
|
97
|
+
// Each manager by its version flag: its lockfile, the folder it installs into, and the version where the
|
|
98
|
+
// flag is left out: `pinned` takes what the project pins, `unpinned` needs the flag. `development` is a
|
|
99
|
+
// manager that installs every dependency, there being no other kind.
|
|
102
100
|
const MANAGERS = {
|
|
103
101
|
pnpm: { lockfile: 'pnpm-lock.yaml', folder: 'node_modules', projects: findPnpmProjects, build: buildPnpmTree },
|
|
104
102
|
yarn: { lockfile: 'yarn.lock', folder: 'node_modules', projects: findYarn1Workspaces, build: buildYarn1Tree },
|
|
@@ -241,11 +239,8 @@ function size(bytes) {
|
|
|
241
239
|
return unit === 0 ? `${bytes} B` : `${(bytes / 1024 ** unit).toFixed(1)} ${UNITS[unit]}`
|
|
242
240
|
}
|
|
243
241
|
|
|
244
|
-
// A refusal says what and where: deptree's
|
|
245
|
-
//
|
|
246
|
-
// the system's on a call it names, parseArgs's of an option, or a host
|
|
247
|
-
// deptree takes no version of from what is there. Anything else is a bug,
|
|
248
|
-
// and shows its stack, though Node gave it a code.
|
|
242
|
+
// A refusal says what and where: deptree's, its readers', compare's, the system's on a call it names,
|
|
243
|
+
// parseArgs's, or of a host version deptree cannot take. Anything else is a bug, and shows its stack.
|
|
249
244
|
const REFUSALS = [DeptreeError, LockfileError, TomlError, CompareError]
|
|
250
245
|
const refused = (error) => REFUSALS.some((type) => error instanceof type) || typeof error?.syscall === 'string' || String(error?.code).startsWith('ERR_PARSE_ARGS_') || (error instanceof TypeError && error.message.startsWith('host.'))
|
|
251
246
|
function describe(error) {
|
package/cargo.d.ts
CHANGED
|
@@ -1,221 +1,165 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The vendor directory `cargo vendor` makes from a Cargo.lock, built in memory
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { buildCargoTree } from '@preventive/deptree/cargo.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Each .crate is fetched through `@preventive/upstream`: from cargo's own cache ($CARGO_HOME/registry/cache)
|
|
9
|
+
* where one there has the lockfile's checksum, which is never written, else its own (`setCacheDir`). That
|
|
10
|
+
* is the one place a filesystem is touched. Nothing is left to a guess: what cargo would read otherwise,
|
|
11
|
+
* or what this cannot reproduce exactly, is refused.
|
|
12
|
+
*
|
|
13
|
+
* @module @preventive/deptree/cargo.js
|
|
14
|
+
*/
|
|
2
15
|
|
|
3
|
-
|
|
16
|
+
import type { NodeType, Vfs } from '@preventive/vfs';
|
|
4
17
|
|
|
5
|
-
|
|
6
|
-
// them. Each .crate is fetched through it, and that is the one place
|
|
7
|
-
// anything here touches a filesystem. Before the network, it takes one from
|
|
8
|
-
// cargo's own cache -- each registry's under $CARGO_HOME/registry/cache, or
|
|
9
|
-
// ~/.cargo where that is unset -- where one there has the lockfile's
|
|
10
|
-
// checksum, and writes none of it; then from its own cache, where one is
|
|
11
|
-
// set, which is where it writes each .crate it fetches: setCacheDir() sets
|
|
12
|
-
// the default one, and setCacheDir(false) unsets it. Unset, which it is
|
|
13
|
-
// until set, it writes nothing. The project is read only through the view
|
|
14
|
-
// given as `project`, and the tree built in a Vfs.
|
|
15
|
-
export { setCacheDir } from '@preventive/upstream/npm.js'
|
|
18
|
+
export { LockfileError, TomlError } from '@preventive/lockfile/cargo.js';
|
|
16
19
|
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// cargo unpacks and names files otherwise there.
|
|
20
|
+
// Where `@preventive/upstream` caches .crate files: setCacheDir() the default, false none, as until set
|
|
21
|
+
export { setCacheDir } from '@preventive/upstream/npm.js';
|
|
22
|
+
|
|
23
|
+
/** The machine cargo would vendor on */
|
|
22
24
|
export interface CargoHost {
|
|
23
|
-
cargo
|
|
24
|
-
|
|
25
|
+
/** The exact cargo that vendors, 1.94.0 to 1.99.x; from 1.97 each .cargo-checksum.json has a `$comment` */
|
|
26
|
+
cargo: string;
|
|
27
|
+
/** As Node names it, `linux` or `darwin`; Windows is refused, as cargo unpacks and names files otherwise there */
|
|
28
|
+
os: string;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Each is read as UTF-8, and refused where it is not. A link where cargo
|
|
34
|
-
// looks for members, or at or on the way to any file it reads -- Cargo.lock,
|
|
35
|
-
// the config, a Cargo.toml -- is refused, so that nothing is read from
|
|
36
|
-
// outside the view. Each throws an error
|
|
37
|
-
// whose `code` is ENOENT, ENOTDIR or ELOOP for a path that leads nowhere.
|
|
38
|
-
// Nothing is written to it.
|
|
31
|
+
/**
|
|
32
|
+
* The project's root, by paths from `/`: a Vfs, or anything with these methods, such as a view of a
|
|
33
|
+
* directory on disk. Read as UTF-8: Cargo.lock, the Cargo.toml of every path package cargo reads and of
|
|
34
|
+
* each directory between one and the root, the directories workspace.members takes, and .cargo/config or
|
|
35
|
+
* .cargo/config.toml. A link at or on the way to any of them is refused; nothing is written.
|
|
36
|
+
*/
|
|
39
37
|
export interface CargoProject {
|
|
40
|
-
readdir(path: string): string[]
|
|
41
|
-
lstat(path: string): { type: NodeType }
|
|
42
|
-
stat(path: string): { type: NodeType }
|
|
43
|
-
|
|
38
|
+
readdir(path: string): string[];
|
|
39
|
+
lstat(path: string): { type: NodeType };
|
|
40
|
+
stat(path: string): { type: NodeType };
|
|
41
|
+
/** Throws with `code` ENOENT, ENOTDIR or ELOOP for a path that leads nowhere */
|
|
42
|
+
readFile(path: string): Uint8Array;
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// package and the root. What cargo refuses of one is refused too: a glob
|
|
75
|
-
// that takes nothing, a member with no Cargo.toml or with a [workspace] of
|
|
76
|
-
// its own, a root excluded from its own workspace, a default member that is
|
|
77
|
-
// no member, a path dependency or [patch] that leads to no package or to
|
|
78
|
-
// another of the name. Settings from anywhere else -- a config above the
|
|
79
|
-
// project or in cargo's home, the environment, the command line -- are not
|
|
80
|
-
// read, and are taken to be at their defaults. Of the config, [patch] is
|
|
81
|
-
// read, as cargo resolves with it; `paths` and `include` are refused; the
|
|
82
|
-
// rest is passed over, as it bears on where packages are fetched from and
|
|
83
|
-
// not on what is vendored: `cargo vendor` replaces no source unless told
|
|
84
|
-
// to with --respect-source-config.
|
|
85
|
-
//
|
|
86
|
-
// `vfs` is a Vfs to mount the tree into, at its root, which is taken to be
|
|
87
|
-
// the project's -- it may be `project` too; without one, a new Vfs holds
|
|
88
|
-
// the tree alone. A Vfs that holds a `vendor` at its root, or on macOS a
|
|
89
|
-
// name that is one there, is refused before anything is fetched: cargo
|
|
90
|
-
// would remove what is in it. Nothing there is written over: each
|
|
91
|
-
// directory the tree has is one there or is made, and every file is written
|
|
92
|
-
// where nothing is. The tree is built, and held to every check below,
|
|
93
|
-
// before any of it is written, so a refusal leaves the Vfs as it was.
|
|
94
|
-
export type CargoTreeOptions = CargoTreeGiven | CargoTreeRead
|
|
45
|
+
/**
|
|
46
|
+
* The files `cargo vendor` reads at the project's root, taken to be the workspace's, with no workspace
|
|
47
|
+
* above it: given as text (`lockfile`, `manifests` and `config`) or read from `project`
|
|
48
|
+
*
|
|
49
|
+
* The path packages are the members (the root's, each directory workspace.members takes and exclude does
|
|
50
|
+
* not, each path dependency of a member in the root and not excluded), and every other package cargo reads
|
|
51
|
+
* from a path: path dependencies of members, each `[patch]` from a path, and their normal and build path
|
|
52
|
+
* dependencies. Each inherits from the root's `[workspace]` where cargo has it inherit.
|
|
53
|
+
*
|
|
54
|
+
* Refused, as cargo reads it otherwise: a `**` or `[` in a members glob, a path that is absolute, leads
|
|
55
|
+
* out of the project or has a `..` after a name, a package.workspace pointing elsewhere than the root,
|
|
56
|
+
* and a `[workspace]` between a package and the root. Refused, as cargo refuses it: a glob that takes
|
|
57
|
+
* nothing, a member without a Cargo.toml or with a `[workspace]`, a root excluded from its workspace, a
|
|
58
|
+
* default member that is no member, and a path dependency or `[patch]` to no package or another of the
|
|
59
|
+
* name. Of the config, `[patch]` is read and `paths` and `include` refused; settings from anywhere else
|
|
60
|
+
* are taken to be at their defaults.
|
|
61
|
+
*/
|
|
62
|
+
export type CargoTreeOptions = CargoTreeGiven | CargoTreeRead;
|
|
63
|
+
|
|
64
|
+
interface CargoTreeCommon {
|
|
65
|
+
host: CargoHost;
|
|
66
|
+
/**
|
|
67
|
+
* A Vfs to mount the tree into, at the project's root (it may be `project`), or a new one. One that
|
|
68
|
+
* holds a `vendor` (on macOS, a name that is one there) is refused before anything is fetched. Nothing
|
|
69
|
+
* there is written over, and a refusal leaves it as it was.
|
|
70
|
+
*/
|
|
71
|
+
vfs?: Vfs;
|
|
72
|
+
}
|
|
95
73
|
|
|
96
|
-
export interface CargoTreeGiven {
|
|
97
|
-
lockfile: string
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
74
|
+
export interface CargoTreeGiven extends CargoTreeCommon {
|
|
75
|
+
lockfile: string;
|
|
76
|
+
/**
|
|
77
|
+
* Each Cargo.toml cargo reads, and none else, by directory: `.` for the root, and each other's path
|
|
78
|
+
* from it with no `.`, `..` or empty segment
|
|
79
|
+
*/
|
|
80
|
+
manifests: Record<string, string> | Map<string, string>;
|
|
81
|
+
/** .cargo/config.toml */
|
|
82
|
+
config?: string;
|
|
83
|
+
project?: undefined;
|
|
103
84
|
}
|
|
104
85
|
|
|
105
|
-
export interface CargoTreeRead {
|
|
106
|
-
lockfile?: undefined
|
|
107
|
-
manifests?: undefined
|
|
108
|
-
config?: undefined
|
|
109
|
-
project: CargoProject
|
|
110
|
-
host: CargoHost
|
|
111
|
-
vfs?: Vfs
|
|
86
|
+
export interface CargoTreeRead extends CargoTreeCommon {
|
|
87
|
+
lockfile?: undefined;
|
|
88
|
+
manifests?: undefined;
|
|
89
|
+
config?: undefined;
|
|
90
|
+
project: CargoProject;
|
|
112
91
|
}
|
|
113
92
|
|
|
114
|
-
|
|
115
|
-
// lockfile's; `vendored` those copied into vendor/, each a .crate fetched;
|
|
116
|
-
// `files` and `bytes` what is written, each .cargo-checksum.json among it.
|
|
93
|
+
/** What was vendored */
|
|
117
94
|
export interface CargoTreeStats {
|
|
118
|
-
packages
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
95
|
+
/** The lockfile's packages */
|
|
96
|
+
packages: number;
|
|
97
|
+
/** Those copied into vendor/, each a .crate fetched */
|
|
98
|
+
vendored: number;
|
|
99
|
+
/** Files written, each .cargo-checksum.json among them */
|
|
100
|
+
files: number;
|
|
101
|
+
/** Bytes written */
|
|
102
|
+
bytes: number;
|
|
122
103
|
}
|
|
123
104
|
|
|
124
|
-
|
|
125
|
-
// directory, from the project's root, which is `/` of the Vfs --
|
|
126
|
-
// vendor/<name>, or vendor/<name>-<version> for all but the greatest
|
|
127
|
-
// version of a name; `name`, `version` and `source` the lockfile's;
|
|
128
|
-
// `checksum` the hex sha256 its .crate is held to; `commit` the commit its
|
|
129
|
-
// .cargo_vcs_info.json names, as `cargo package` writes one where it packs
|
|
130
|
-
// from a git checkout, where that is a full commit id and the checkout was
|
|
131
|
-
// not dirty, and undefined elsewhere; `repository` and `homepage` those its
|
|
132
|
-
// Cargo.toml's [package] gives, as cargo packed it, each undefined where it
|
|
133
|
-
// gives none. All of it is the publisher's word, held to no repository.
|
|
105
|
+
/** A package as an SBOM would list it; all of it the publisher's word, held to no repository */
|
|
134
106
|
export interface CargoInstalled {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
107
|
+
/** `vendor/<name>`, or `vendor/<name>-<version>` for all but the greatest version of a name */
|
|
108
|
+
path: string;
|
|
109
|
+
name: string;
|
|
110
|
+
version: string;
|
|
111
|
+
source: string;
|
|
112
|
+
/** The hex sha256 its .crate is held to */
|
|
113
|
+
checksum: string;
|
|
114
|
+
/** The full commit its .cargo_vcs_info.json names, where `cargo package` packed a clean checkout */
|
|
115
|
+
commit: string | undefined;
|
|
116
|
+
/** Its packed Cargo.toml's */
|
|
117
|
+
repository: string | undefined;
|
|
118
|
+
/** Its packed Cargo.toml's */
|
|
119
|
+
homepage: string | undefined;
|
|
143
120
|
}
|
|
144
121
|
|
|
145
|
-
// `vfs` is the one given, the tree mounted into it, or a new one.
|
|
146
|
-
// `installed` is each package vendored, in the lockfile's order.
|
|
147
122
|
export interface CargoTree {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
123
|
+
/** The one given, the tree mounted into it, or a new one */
|
|
124
|
+
vfs: Vfs;
|
|
125
|
+
stats: CargoTreeStats;
|
|
126
|
+
/** In the lockfile's order */
|
|
127
|
+
installed: CargoInstalled[];
|
|
151
128
|
}
|
|
152
129
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
// What the archive readers refuse is refused: @preventive/archive's
|
|
183
|
-
// compression.js and tar.js refuse a name with a backslash, a control or
|
|
184
|
-
// formatting character, an empty or `..` segment, or a drive letter, two
|
|
185
|
-
// entries of one name that differ, an entry inside one that is not a
|
|
186
|
-
// directory, a sparse entry -- where cargo would take some of it. What cargo
|
|
187
|
-
// reads otherwise than the readers is refused:
|
|
188
|
-
// a .crate of more than one gzip member, of which cargo reads the first
|
|
189
|
-
// alone; a gzip header CRC or reserved flag; a pax size, which cargo 1.94.0
|
|
190
|
-
// reads otherwise. What cargo refuses or fails on is refused: a .crate that
|
|
191
|
-
// unpacks to more than 512 MiB, or twenty times its size where that is
|
|
192
|
-
// more; an entry not under `<name>-<version>`, an entry not a file or
|
|
193
|
-
// directory, a .crate's own .cargo-checksum.json, which cargo lists and
|
|
194
|
-
// writes over so that it cannot build from it. So is what cargo fails on or
|
|
195
|
-
// reads otherwise as any user but root: a file whose mode lacks the owner's
|
|
196
|
-
// read, which cargo cannot checksum; a directory with anything in it whose
|
|
197
|
-
// mode lacks the owner's read or search, whose files cargo leaves out of
|
|
198
|
-
// .cargo-checksum.json; and one whose mode lacks the owner's write where
|
|
199
|
-
// anything is written into it after its own entry, as .cargo-checksum.json
|
|
200
|
-
// always is into the package's. A directory with nothing in it may have any
|
|
201
|
-
// mode. On macOS, two names in one directory that differ only in case
|
|
202
|
-
// or normalization are refused, as they would be one name there.
|
|
203
|
-
//
|
|
204
|
-
// Packages come from crates.io alone: one from git, which cargo vendor
|
|
205
|
-
// checks out with git, or from another registry, is refused.
|
|
206
|
-
//
|
|
207
|
-
// Nothing is left to a guess: a lockfile or manifest the lockfile reader
|
|
208
|
-
// refuses, a workspace this does not read as cargo reads it, a package from
|
|
209
|
-
// anywhere but crates.io, a check above that fails -- each is refused with a
|
|
210
|
-
// DeptreeError, a LockfileError or a TomlError that says where. A TypeError
|
|
211
|
-
// is thrown for options of the wrong type.
|
|
212
|
-
export function buildCargoTree(options: CargoTreeOptions): Promise<CargoTree>
|
|
130
|
+
/**
|
|
131
|
+
* The vendor directory `cargo vendor` makes, with `host.cargo` and none of its options, in a project
|
|
132
|
+
* with no vendor directory yet: `vendor/<directory>` for each package but path ones, and nothing else
|
|
133
|
+
*
|
|
134
|
+
* A package's directory is its name, or `<name>-<version>` for all but the greatest version of the name
|
|
135
|
+
* by the semver crate's order. The lockfile is held to the manifests, as cargo resolves anew one out of
|
|
136
|
+
* date with them: every package's (a vendored one's from its .crate) laid over it by `linkCargo`, each
|
|
137
|
+
* path dependency to the package its path leads to, every path package of it one cargo reads, and every
|
|
138
|
+
* member in it.
|
|
139
|
+
*
|
|
140
|
+
* Each .crate is fetched from crates.io, held to the lockfile's sha256, and unpacked as cargo unpacks
|
|
141
|
+
* it: `<name>-<version>/` taken off; anything under a `.git`, a .gitattributes, .gitignore or .cargo-ok
|
|
142
|
+
* passed over; directories 0o755 or their own entry's mode, files their mode within 0o777, as a 0o022
|
|
143
|
+
* umask leaves them; then a .cargo-checksum.json, 0o644, as cargo writes it. Refused:
|
|
144
|
+
* - what `@preventive/archive`'s readers refuse, such as a `..` name or two entries of one name that differ
|
|
145
|
+
* - what cargo reads otherwise: more than one gzip member, a gzip header CRC or reserved flag, a pax size
|
|
146
|
+
* - what cargo refuses: past 512 MiB unpacked (or twenty times the .crate), an entry not under
|
|
147
|
+
* `<name>-<version>` or not a file or directory, a .crate's own .cargo-checksum.json
|
|
148
|
+
* - what cargo fails on as any user but root: a file without its owner's read, a directory with anything
|
|
149
|
+
* in it without its owner's read and search, or written into after its entry without its owner's write
|
|
150
|
+
* - on macOS, two names that are one there
|
|
151
|
+
*
|
|
152
|
+
* A package from git, or from a registry but crates.io, is refused.
|
|
153
|
+
*
|
|
154
|
+
* @param options - The files and where to build
|
|
155
|
+
* @returns The tree, what it holds, and its packages
|
|
156
|
+
* @throws DeptreeError, LockfileError or TomlError saying where; TypeError for options of the wrong type
|
|
157
|
+
*/
|
|
158
|
+
export function buildCargoTree(options: CargoTreeOptions): Promise<CargoTree>;
|
|
213
159
|
|
|
214
|
-
|
|
215
|
-
// `packages["serde 1.0.0 (registry+...)"]`, an entry of a .crate -- or
|
|
216
|
-
// undefined for the call as a whole; the message leads with it. `cause` is
|
|
217
|
-
// what a package beneath refused with, where one did.
|
|
160
|
+
/** A refusal */
|
|
218
161
|
export class DeptreeError extends Error {
|
|
219
|
-
constructor(detail: string, where?: string, options?: { cause?: unknown })
|
|
220
|
-
|
|
162
|
+
constructor(detail: string, where?: string, options?: { cause?: unknown });
|
|
163
|
+
/** What it is about, such as `crates/a/Cargo.toml`, which the message leads with; undefined for the call */
|
|
164
|
+
where: string | undefined;
|
|
221
165
|
}
|
package/cargo.js
CHANGED