@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/yarn1.d.ts
CHANGED
|
@@ -1,390 +1,233 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A node_modules tree built in memory from a yarn.lock, as yarn 1.22 installs it with its node_modules
|
|
3
|
+
* linker
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* import { buildYarn1Tree, findYarn1Workspaces } from '@preventive/deptree/yarn1.js'
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Nothing is left to a guess: a lockfile the reader refuses, a setting not followed, a package from
|
|
10
|
+
* anywhere but npm's registry or a directory of the project, bundled dependencies, another package
|
|
11
|
+
* manager, or a check that fails is refused with a DeptreeError or a LockfileError saying where. Options of
|
|
12
|
+
* the wrong type throw a TypeError.
|
|
13
|
+
*
|
|
14
|
+
* @module @preventive/deptree/yarn1.js
|
|
15
|
+
*/
|
|
3
16
|
|
|
4
|
-
|
|
17
|
+
import type { CacheOptions, PackageBugs, PackageRepository } from '@preventive/upstream/npm.js';
|
|
18
|
+
import type { NodeType, Vfs } from '@preventive/vfs';
|
|
5
19
|
|
|
6
|
-
|
|
7
|
-
// Tarballs are fetched through it, and that is the one place anything here
|
|
8
|
-
// touches a filesystem. Before the network, it takes a tarball from npm's
|
|
9
|
-
// cache -- under $npm_config_cache, or ~/.npm -- from ~/.audit/cache/tgz, or
|
|
10
|
-
// from its own default cache directory or stasis's, where one there has the
|
|
11
|
-
// lockfile's integrity, and writes none of them; then from its own cache,
|
|
12
|
-
// where one is set, which is where it writes each tarball it fetches:
|
|
13
|
-
// setCacheDir() sets the default one, and setCacheDir(false) unsets it.
|
|
14
|
-
// Unset, which it is until set, it writes nothing. yarn's own cache is
|
|
15
|
-
// never read. The project is read only through the view given as
|
|
16
|
-
// `project`, and the tree built in a Vfs.
|
|
17
|
-
export { setCacheDir } from '@preventive/upstream/npm.js'
|
|
20
|
+
export { LockfileError } from '@preventive/lockfile/yarn1.js';
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// would check against the Node it runs on, is refused, but for a Node
|
|
40
|
-
// unknown.
|
|
22
|
+
/**
|
|
23
|
+
* Sets where @preventive/upstream caches what it fetches, which is unset until set
|
|
24
|
+
*
|
|
25
|
+
* Tarballs are fetched through it, the one place anything here touches a filesystem: before the network
|
|
26
|
+
* it reads npm's cache, ~/.audit/cache/tgz and its own or stasis's default directory for one of the
|
|
27
|
+
* lockfile's integrity, writing none of them, then this one, which it writes each tarball it fetches to.
|
|
28
|
+
* `setCacheDir()` sets the default directory and `setCacheDir(false)` unsets it. yarn's cache is never read.
|
|
29
|
+
*/
|
|
30
|
+
export { setCacheDir } from '@preventive/upstream/npm.js';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The machine yarn would install on; Windows is refused, as yarn links bins there with shims
|
|
34
|
+
*
|
|
35
|
+
* A package whose os, cpu or engines the host does not take is left out where optional and refused where
|
|
36
|
+
* not, as yarn fails on it; so is the root. Engines `node` (and `iojs`) and `yarn` are checked as yarn
|
|
37
|
+
* checks them and one yarn has no version for is passed over; one Node reports in process.versions, such
|
|
38
|
+
* as `v8`, is refused but for a Node unknown. ignore-engines and ignore-platform, set, skip the checks.
|
|
39
|
+
* Of two references yarn's cache keeps as one, as a tag asked for twice makes, the second has its lockfile
|
|
40
|
+
* entry for package.json, so it is never left out and links no bins.
|
|
41
|
+
*/
|
|
41
42
|
export interface Yarn1Host {
|
|
42
|
-
yarn
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/** The yarn that installs, a 1.22.x (default: what the root's packageManager pins, which it has to be) */
|
|
44
|
+
yarn?: string;
|
|
45
|
+
/** The Node yarn runs on, exact, or left out for one unknown, which takes every range */
|
|
46
|
+
node?: string;
|
|
47
|
+
/** As Node names it, such as `linux` */
|
|
48
|
+
os: string;
|
|
49
|
+
/** As Node names it, such as `x64` */
|
|
50
|
+
cpu: string;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// Each throws an error whose `code` is ENOENT, ENOTDIR or ELOOP for a path
|
|
54
|
-
// that leads nowhere. Nothing is written to it.
|
|
53
|
+
/**
|
|
54
|
+
* A view of the lockfile's directory by paths from `/`, such as a Vfs; nothing is written to it
|
|
55
|
+
*
|
|
56
|
+
* Each method throws an error whose `code` is ENOENT, ENOTDIR or ELOOP for a path that leads nowhere.
|
|
57
|
+
*/
|
|
55
58
|
export interface Yarn1Project {
|
|
56
|
-
readdir(path: string): string[]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
readdir(path: string): string[];
|
|
60
|
+
/** What a path is, and its mode */
|
|
61
|
+
lstat(path: string): { type: NodeType; mode: number };
|
|
62
|
+
/** What a path leads to */
|
|
63
|
+
stat(path: string): { type: NodeType };
|
|
64
|
+
readFile(path: string): Uint8Array;
|
|
60
65
|
}
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// --modules-folder, --ignore-optional, --no-bin-links, --no-lockfile,
|
|
110
|
-
// which has yarn read no yarn.lock, --global-folder, --cwd and the rest. A .yarnrc line indented under another, which yarn reads into it,
|
|
111
|
-
// is refused too, and so is a value of those two followed that is not true
|
|
112
|
-
// or false, or for the .yarnrc's option a quoted string.
|
|
113
|
-
//
|
|
114
|
-
// A workspace project is the root, marked private, and every directory its
|
|
115
|
-
// `workspaces` globs take -- `*`, `?` and `**`, as the lockfile reader takes
|
|
116
|
-
// them -- with a package.json that has a name and a version. `nohoist`,
|
|
117
|
-
// Plug'n'Play, and a root package.json's `flat` are refused.
|
|
118
|
-
//
|
|
119
|
-
// `vfs` is a Vfs to mount the tree into, at its root, which is taken to
|
|
120
|
-
// be the lockfile's directory, beside whatever it holds, such as the
|
|
121
|
-
// projects themselves -- it may be `project` too; without one, a new Vfs
|
|
122
|
-
// holds the tree alone. Nothing the tree is built from is read from it. A
|
|
123
|
-
// Vfs that holds a node_modules anywhere, or on macOS a name that is one
|
|
124
|
-
// there, is refused before anything is fetched: kept beside the tree, Node
|
|
125
|
-
// would read it as the tree's, and removed, it would be the caller's lost.
|
|
126
|
-
// Nothing there is written over: each directory the tree has is one there
|
|
127
|
-
// or is made, and every file and link is written where nothing is. The
|
|
128
|
-
// tree is built, and held to every check below, before any of it is
|
|
129
|
-
// written, so a refusal leaves the Vfs as it was.
|
|
130
|
-
//
|
|
131
|
-
// `metadata`, true unless given false, has each registry package's version
|
|
132
|
-
// document asked for beside its tarball, through getMeta of
|
|
133
|
-
// @preventive/upstream given the lockfile's dist: the one `cache` keeps,
|
|
134
|
-
// where its dist is that one, else the registry's, a request for each name
|
|
135
|
-
// and version. Its dist has to be the lockfile's, the tarball
|
|
136
|
-
// the registry's own URL and the integrity the lockfile's sha512, compared
|
|
137
|
-
// as text, with nothing hashed again, as the lockfile copies the
|
|
138
|
-
// registry's; and its gitHead, repository, homepage and bugs are the
|
|
139
|
-
// package's. False fetches none, and gives none of them, but for a package
|
|
140
|
-
// whose sha512 the lockfile does not record, whose document is fetched for
|
|
141
|
-
// the registry's either way, and gives them.
|
|
142
|
-
//
|
|
143
|
-
// `cache` is where each registry package's tarball and version document
|
|
144
|
-
// are kept, as @preventive/upstream's CacheOptions take it: in setCacheDir's
|
|
145
|
-
// cache where it is left out; in a store of the caller's, with `read` and
|
|
146
|
-
// `write`, in place of it; or with false, nowhere, though setCacheDir's
|
|
147
|
-
// cache is read all the same. Other tools' caches are read for tarballs
|
|
148
|
-
// whatever it is. A TypeError is thrown for anything else.
|
|
149
|
-
//
|
|
150
|
-
// `sizeEstimateOnly` and `lazy`, which buildPnpmTree and buildNpmTree take
|
|
151
|
-
// for a tree's directories and links alone, are not taken, as yarn hoists
|
|
152
|
-
// and leaves out packages by what their package.json says, which only their
|
|
153
|
-
// tarballs hold: a TypeError is thrown for either given true.
|
|
154
|
-
//
|
|
155
|
-
// `production`, false unless given true, builds the tree `yarn install
|
|
156
|
-
// --production` makes, as below.
|
|
157
|
-
//
|
|
158
|
-
// The two ways the files come, one or the other: given, with `lockfile`
|
|
159
|
-
// and `manifests`; or read, with `project` and none of them. `project`
|
|
160
|
-
// given with `lockfile` is read only to tell whether a tag a top-level
|
|
161
|
-
// dependency asks for is a directory, which yarn would install instead.
|
|
162
|
-
export type Yarn1TreeOptions = Yarn1TreeGiven | Yarn1TreeRead
|
|
67
|
+
/**
|
|
68
|
+
* The files an install reads, either given as text or read from `project`
|
|
69
|
+
*
|
|
70
|
+
* Read, they are yarn.lock and the root's package.json, which have to be there; the package.json of each
|
|
71
|
+
* directory the root's `workspaces` globs take, outside node_modules; the .yarnrc and the .npmrc. Each is
|
|
72
|
+
* UTF-8, a byte order mark dropped, and a refusal names it as it would given: `manifests["packages/x"]`.
|
|
73
|
+
* Refused there: a link the globs reach, a node_modules they would take, a yarn.json, a .yarnrc.yml.
|
|
74
|
+
* Settings from anywhere else are taken at their defaults.
|
|
75
|
+
*
|
|
76
|
+
* Of the .yarnrc and .npmrc, as yarn reads them, an option of the .yarnrc over the .npmrc's and a `--`
|
|
77
|
+
* line of the .yarnrc as a flag: ignore-engines is followed, by its flag or by the option where truthy as
|
|
78
|
+
* yarn reads it, and ignore-platform by its flag alone. One that may change what yarn installs is refused,
|
|
79
|
+
* such as production, ignore-optional, bin-links, yarn-path, global-folder, --flat or --modules-folder, and
|
|
80
|
+
* so is an indented .yarnrc line; one for where and how yarn fetches, or no install, is passed over.
|
|
81
|
+
*
|
|
82
|
+
* A workspace project is the root, marked private, and each directory its `workspaces` take (`*`, `?`,
|
|
83
|
+
* `**`) with a package.json naming a name and a version; nohoist, Plug'n'Play and `flat` are refused.
|
|
84
|
+
*/
|
|
85
|
+
export type Yarn1TreeOptions = Yarn1TreeGiven | Yarn1TreeRead;
|
|
86
|
+
|
|
87
|
+
interface Yarn1TreeShared {
|
|
88
|
+
host: Yarn1Host;
|
|
89
|
+
/**
|
|
90
|
+
* A Vfs to mount the tree into, at the lockfile's directory, beside what it holds (default: a new one)
|
|
91
|
+
*
|
|
92
|
+
* One holding a node_modules, or on macOS a name that is one there, is refused before anything is
|
|
93
|
+
* fetched. Nothing there is written over, and the tree is built and checked first, so a refusal leaves
|
|
94
|
+
* it as it was.
|
|
95
|
+
*/
|
|
96
|
+
vfs?: Vfs;
|
|
97
|
+
/**
|
|
98
|
+
* Fetch each registry package's version document by @preventive/upstream's getMeta, its dist held to the
|
|
99
|
+
* lockfile's, for `commit`, `repository`, `homepage` and `bugs` (default: true)
|
|
100
|
+
*
|
|
101
|
+
* One whose sha512 the lockfile does not record has its document fetched either way.
|
|
102
|
+
*/
|
|
103
|
+
metadata?: boolean;
|
|
104
|
+
/** Where tarballs and version documents are kept, as @preventive/upstream's CacheOptions take it */
|
|
105
|
+
cache?: CacheOptions['cache'];
|
|
106
|
+
/**
|
|
107
|
+
* The tree `--production` makes (default: false)
|
|
108
|
+
*
|
|
109
|
+
* No workspace's devDependencies are asked for. The root's are resolved, fetched, checked and hoisted all
|
|
110
|
+
* the same, taking the places they hoist to, but each copy is installed only where something else needs it.
|
|
111
|
+
*/
|
|
112
|
+
production?: boolean;
|
|
113
|
+
}
|
|
163
114
|
|
|
164
|
-
export interface Yarn1TreeGiven {
|
|
165
|
-
lockfile: string
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
115
|
+
export interface Yarn1TreeGiven extends Yarn1TreeShared {
|
|
116
|
+
lockfile: string;
|
|
117
|
+
/**
|
|
118
|
+
* Each project's package.json by its directory from the lockfile's, `.` for the root, as
|
|
119
|
+
* findYarn1Workspaces lists them; every workspace yarn would find has to be among them
|
|
120
|
+
*/
|
|
121
|
+
manifests: Record<string, string> | Map<string, string>;
|
|
122
|
+
yarnrc?: string;
|
|
123
|
+
npmrc?: string;
|
|
124
|
+
/** Read only to tell whether a tag a top-level dependency asks for is a directory, which yarn would install */
|
|
125
|
+
project?: Yarn1Project;
|
|
175
126
|
}
|
|
176
127
|
|
|
177
|
-
export interface Yarn1TreeRead {
|
|
178
|
-
lockfile?: undefined
|
|
179
|
-
manifests?: undefined
|
|
180
|
-
yarnrc?: undefined
|
|
181
|
-
npmrc?: undefined
|
|
182
|
-
project: Yarn1Project
|
|
183
|
-
host: Yarn1Host
|
|
184
|
-
vfs?: Vfs
|
|
185
|
-
metadata?: boolean
|
|
186
|
-
cache?: CacheOptions['cache']
|
|
187
|
-
production?: boolean
|
|
128
|
+
export interface Yarn1TreeRead extends Yarn1TreeShared {
|
|
129
|
+
lockfile?: undefined;
|
|
130
|
+
manifests?: undefined;
|
|
131
|
+
yarnrc?: undefined;
|
|
132
|
+
npmrc?: undefined;
|
|
133
|
+
project: Yarn1Project;
|
|
188
134
|
}
|
|
189
135
|
|
|
190
|
-
|
|
191
|
-
// packages yarn resolves, each fetched from the registry or read from a
|
|
192
|
-
// directory of the project; `skipped` the optional
|
|
193
|
-
// ones left out, as the host cannot run them; `installed` the copies of
|
|
194
|
-
// them in the tree; `files` and `bytes` what is written; `links` the
|
|
195
|
-
// workspaces linked.
|
|
136
|
+
/** What buildYarn1Tree counts */
|
|
196
137
|
export interface Yarn1TreeStats {
|
|
197
|
-
packages
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
138
|
+
/** The packages yarn resolves, each fetched from the registry or read from a directory of the project */
|
|
139
|
+
packages: number;
|
|
140
|
+
/** The optional ones left out, as the host cannot run them */
|
|
141
|
+
skipped: number;
|
|
142
|
+
/** Their copies in the tree */
|
|
143
|
+
installed: number;
|
|
144
|
+
/** Written */
|
|
145
|
+
files: number;
|
|
146
|
+
/** Written */
|
|
147
|
+
bytes: number;
|
|
148
|
+
/** The workspaces linked */
|
|
149
|
+
links: number;
|
|
203
150
|
}
|
|
204
151
|
|
|
205
|
-
|
|
206
|
-
// where its files really are, from the lockfile's directory, which is `/`
|
|
207
|
-
// of the Vfs -- node_modules/<alias>, or beneath a workspace, in that
|
|
208
|
-
// workspace's own node_modules. `name` and `version` are the package's
|
|
209
|
-
// own, which its package.json is held to, whatever alias it is installed
|
|
210
|
-
// as; `integrity` the sha512 its tarball is held to, for a registry
|
|
211
|
-
// package, and `directory` the directory of the project it is copied
|
|
212
|
-
// from, for one by `file:`, in place of an integrity. For a registry
|
|
213
|
-
// package alone, where its version document is fetched: `commit` is its
|
|
214
|
-
// gitHead, where that is a full commit id, the commit npm read off the
|
|
215
|
-
// checkout it published from; `repository`, `homepage` and `bugs` the
|
|
216
|
-
// document's, as getMeta of @preventive/upstream reads them; each left out
|
|
217
|
-
// where there is none, and all of it the publisher's word, held to no
|
|
218
|
-
// repository. `dev` is
|
|
219
|
-
// whether dev dependencies alone reach this copy, the root's and the
|
|
220
|
-
// workspaces' devDependencies: nothing else does, each dependency, and
|
|
221
|
-
// each peer yarn finds, looked for from where what asks for it is, as Node
|
|
222
|
-
// finds it and yarn marks what an install requires, past what the host
|
|
223
|
-
// cannot run. Two copies of one package may differ: one beneath a
|
|
224
|
-
// devDependency that only it needs is dev. With `production`, none is.
|
|
225
|
-
// `optional` is whether optional dependencies alone reach this copy, so.
|
|
152
|
+
/** A copy of a package in the tree, as an SBOM would list it */
|
|
226
153
|
export interface Yarn1Installed {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
154
|
+
/** Where its files are, from the lockfile's directory: node_modules/<alias>, or in a workspace's own */
|
|
155
|
+
path: string;
|
|
156
|
+
/** The package's own, whatever alias it is installed as */
|
|
157
|
+
name: string;
|
|
158
|
+
version: string;
|
|
159
|
+
/** The sha512 a registry package's tarball is held to */
|
|
160
|
+
integrity?: string;
|
|
161
|
+
/** The directory of the project a `file:` package is copied from */
|
|
162
|
+
directory?: string;
|
|
163
|
+
/** Its version document's gitHead, where fetched and a full commit id: the publisher's word */
|
|
164
|
+
commit?: string;
|
|
165
|
+
/** Its version document's, as getMeta reads it, where fetched; held to no repository */
|
|
166
|
+
repository?: string | PackageRepository;
|
|
167
|
+
homepage?: string;
|
|
168
|
+
bugs?: string | PackageBugs;
|
|
169
|
+
/** Whether only dev dependencies reach this copy, past what the host cannot run; none with `production` */
|
|
170
|
+
dev: boolean;
|
|
171
|
+
/** Whether only optional dependencies reach this copy */
|
|
172
|
+
optional: boolean;
|
|
238
173
|
}
|
|
239
174
|
|
|
240
|
-
// `vfs` is the one given, the tree mounted into it, or a new one.
|
|
241
|
-
// `installed` is each copy in the tree, once for each path, by path in
|
|
242
|
-
// the order of its code points, whatever the locale; a workspace, whose
|
|
243
|
-
// files the tree does not hold, is not among them.
|
|
244
175
|
export interface Yarn1Tree {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
176
|
+
/** The Vfs given, the tree mounted into it, or a new one */
|
|
177
|
+
vfs: Vfs;
|
|
178
|
+
stats: Yarn1TreeStats;
|
|
179
|
+
/** Each copy once per path, by path in code point order; no workspace, whose files the tree does not hold */
|
|
180
|
+
installed: Yarn1Installed[];
|
|
248
181
|
}
|
|
249
182
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
// whatever the settings say. No .bin is written, nor yarn's own
|
|
283
|
-
// .yarn-integrity; but each bin's target is made executable, chmod 755, in
|
|
284
|
-
// every copy of its package, as yarn's fetcher makes it in its cache,
|
|
285
|
-
// whether yarn links the bin or not. Linking makes no file of the tree
|
|
286
|
-
// executable that the fetcher has not: a bin in its package's own
|
|
287
|
-
// node_modules, where yarn installs its dependencies, is refused, as
|
|
288
|
-
// linking it would make the file there executable, and so is a package
|
|
289
|
-
// with bins and a .bin file, where yarn fails to make a directory for
|
|
290
|
-
// them; a workspace's bins are its own files, which the tree does not
|
|
291
|
-
// hold. Each file's mode is the tarball's, with
|
|
292
|
-
// read for all added and a umask of 0o022 taken off, as yarn unpacks it;
|
|
293
|
-
// .bin, .yarn-metadata.json and .yarn-tarball.tgz in a package are left
|
|
294
|
-
// out, as yarn's copy leaves them out.
|
|
295
|
-
//
|
|
296
|
-
// The lockfile is held to what the lockfile reader holds it to, with the
|
|
297
|
-
// manifests, and to what a frozen install holds it to: every pattern
|
|
298
|
-
// asked for has its entry, and each entry a version in the range of its
|
|
299
|
-
// pattern, as yarn would otherwise resolve the pattern anew, frozen or not.
|
|
300
|
-
// The root package.json's packageManager, where it has one, has to be
|
|
301
|
-
// `yarn@` host.yarn exactly, as corepack would run the one it names.
|
|
302
|
-
//
|
|
303
|
-
// And to more than yarn holds it to, where a lockfile yarn writes, or a
|
|
304
|
-
// package the registry serves, always holds: each tarball gzipped, every
|
|
305
|
-
// file under one directory, none in the package's own node_modules, where
|
|
306
|
-
// yarn installs its dependencies, no link or device in it, and a
|
|
307
|
-
// package.json for exactly its name and version; each with the sha512
|
|
308
|
-
// integrity the lockfile records, and the sha1 each of its entries does,
|
|
309
|
-
// fetched or not. yarn writes a sha1 integrity alone where the registry had
|
|
310
|
-
// no sha512 for the version: taken only for one the registry says was
|
|
311
|
-
// published before 2018-08-05T14:58:16.253Z, since when it has made one for
|
|
312
|
-
// every version as it was published, and held to that sha1 and to the
|
|
313
|
-
// registry's own sha512. On macOS, two names in one
|
|
314
|
-
// directory that differ only in case or normalization are refused, as
|
|
315
|
-
// they would be one name there.
|
|
316
|
-
//
|
|
317
|
-
// Packages come from npm's registry, or from a directory of the project.
|
|
318
|
-
// A registry entry's `resolved` has to be the registry's own URL of its
|
|
319
|
-
// tarball, exactly as npm spells it,
|
|
320
|
-
// https://registry.npmjs.org/<name>/-/<base>-<version>.tgz (a `#` and the
|
|
321
|
-
// sha1 after it aside), or that same URL on yarn's mirror,
|
|
322
|
-
// https://registry.yarnpkg.com/, which is taken for npm's; it is fetched
|
|
323
|
-
// from npm's through @preventive/upstream. Each is asked for by a semver
|
|
324
|
-
// range, an `npm:` alias, or a tag -- the last only where the project is
|
|
325
|
-
// given, and a directory of the project of that name is not there, which
|
|
326
|
-
// yarn would install instead. A request of a tag waits on the filesystem,
|
|
327
|
-
// which answers in no set order, and each it answers resolves all beneath
|
|
328
|
-
// it before the next: where two or more wait at once, only where that
|
|
329
|
-
// order changes nothing, as no two would add a package or a pattern under
|
|
330
|
-
// one name, and no resolution applies or directory is read beneath them.
|
|
331
|
-
//
|
|
332
|
-
// Or by the registry's own tarball URL, either of those above (no `#`
|
|
333
|
-
// after it): the entry yarn writes for one has no integrity, so its
|
|
334
|
-
// tarball is held to the sha1 after the `#` of its `resolved` and to the
|
|
335
|
-
// registry's own sha512. Or, by the root or as what a resolution resolves
|
|
336
|
-
// to, by a directory of the project, `file:<path>` or a path starting
|
|
337
|
-
// `./`, within the project and not its root; beneath another package,
|
|
338
|
-
// where yarn reads it in an order not modelled here, only one read
|
|
339
|
-
// already, as the workspaces' aggregator asks for the root's again, which
|
|
340
|
-
// yarn takes the first's package for, but not where a tag waits on the
|
|
341
|
-
// filesystem beside it. yarn copies a
|
|
342
|
-
// directory whole, whatever package.json's `files` and an ignore file
|
|
343
|
-
// say, each file's mode as it is, each bin's target made executable, and
|
|
344
|
-
// the tree copies it so, read from `project`, which has to be given for
|
|
345
|
-
// it: all but each `.bin`, .yarn-metadata.json and .yarn-tarball.tgz in
|
|
346
|
-
// it, as yarn's copy passes them over, empty directories kept. yarn reads
|
|
347
|
-
// a directory's package.json anew at every install, frozen or not, and
|
|
348
|
-
// installs whatever its version and dependencies say; so it has to be of
|
|
349
|
-
// the name and version its lockfile entry has, with the dependencies and
|
|
350
|
-
// optionalDependencies the entry lists. Refused: a link, device or a
|
|
351
|
-
// node_modules of its own in it, a mode beyond 0o777, a directory two
|
|
352
|
-
// patterns ask for, which yarn copies as two packages, and a tarball on
|
|
353
|
-
// the project's disk, which yarn takes for any path ending in .tgz.
|
|
354
|
-
//
|
|
355
|
-
// Ranges and versions are read with npm's own semver, borrowed from the
|
|
356
|
-
// npm beside node as @preventive/upstream borrows it, or with its semver
|
|
357
|
-
// peer where there is no npm, without either of which this throws. yarn
|
|
358
|
-
// 1.22 reads them with the semver 5.5.0 it bundles, which reads alike all
|
|
359
|
-
// but the edges of what a range may spell.
|
|
360
|
-
//
|
|
361
|
-
// Nothing is left to a guess: a lockfile the lockfile reader refuses, a
|
|
362
|
-
// setting this does not know or does not build for, a package from
|
|
363
|
-
// anywhere but those above -- git, another tarball URL, a tarball on disk,
|
|
364
|
-
// a directory by `link:` -- a range that is none of those above, a package
|
|
365
|
-
// with bundled dependencies, another package manager, a check above that
|
|
366
|
-
// fails -- each is refused with a DeptreeError or a LockfileError that says
|
|
367
|
-
// where. A TypeError is thrown for options of the wrong type.
|
|
368
|
-
export function buildYarn1Tree(options: Yarn1TreeOptions): Promise<Yarn1Tree>
|
|
183
|
+
/**
|
|
184
|
+
* The node_modules tree `yarn install --frozen-lockfile --ignore-scripts` makes with host.yarn into a
|
|
185
|
+
* project with no node_modules yet
|
|
186
|
+
*
|
|
187
|
+
* Each package's files are copied where yarn hoists it, and each workspace linked where yarn hoists it by
|
|
188
|
+
* a relative link, with what is hoisted beneath it in its own node_modules; nothing else of the projects is
|
|
189
|
+
* in the tree. The lockfile is resolved in yarn's order (the resolutions, the root's lists, then the
|
|
190
|
+
* workspaces, each request with all beneath it), peers looked for along the shortest chain of names that
|
|
191
|
+
* asked, and the tree laid out as yarn's hoister lays it out, quirks and all.
|
|
192
|
+
*
|
|
193
|
+
* Scripts never run, and no .bin or .yarn-integrity is written, but each bin's target is made 0o755 in every
|
|
194
|
+
* copy, as yarn's fetcher makes it. Each file's mode is the tarball's with read for all and a 0o022 umask
|
|
195
|
+
* taken off; .bin, .yarn-metadata.json and .yarn-tarball.tgz are left out, as yarn's copy leaves them.
|
|
196
|
+
*
|
|
197
|
+
* Held to the lockfile reader's checks and a frozen install's: every pattern has its entry, in its range,
|
|
198
|
+
* and the root's packageManager, where set, is `yarn@` host.yarn. And to what yarn's lockfiles and the
|
|
199
|
+
* registry always hold: each tarball gzipped, under one directory, with nothing in its own node_modules, no
|
|
200
|
+
* link or device, a package.json of its name and version, the lockfile's sha512 and sha1. A sha1 alone is
|
|
201
|
+
* taken only for a version published before 2018-08-05T14:58:16.253Z, and held to the registry's sha512
|
|
202
|
+
* too. On macOS, two names in a directory differing only in case or normalization are refused.
|
|
203
|
+
*
|
|
204
|
+
* Packages come from npm's registry, by its own tarball URL or that on yarn's mirror, asked for by a semver
|
|
205
|
+
* range, an `npm:` alias, the tarball URL, or a tag where the project is given and has no directory of
|
|
206
|
+
* that name; or from a directory of the project by `file:` or `./`, read from `project`, copied whole as
|
|
207
|
+
* yarn copies it, and held to its lockfile entry's name, version and lists. Tags that wait on the
|
|
208
|
+
* filesystem at once, which answers in no set order, are refused where that order could change anything.
|
|
209
|
+
* Ranges are read with the semver of the npm beside node, as @preventive/upstream borrows it.
|
|
210
|
+
*
|
|
211
|
+
* @param options - The files, the host and where the tree goes; `sizeEstimateOnly` or `lazy` is a TypeError
|
|
212
|
+
* @returns The tree
|
|
213
|
+
*/
|
|
214
|
+
export function buildYarn1Tree(options: Yarn1TreeOptions): Promise<Yarn1Tree>;
|
|
369
215
|
|
|
370
|
-
// The directories of the projects yarn finds in `project`, by which
|
|
371
|
-
// buildYarn1Tree takes their package.json given: `.`, the root, first,
|
|
372
|
-
// then each directory with a package.json that a glob of the root's
|
|
373
|
-
// `workspaces` takes, outside node_modules, as yarn finds them, and as
|
|
374
|
-
// buildYarn1Tree reads them from a project. Refused as buildYarn1Tree
|
|
375
|
-
// refuses it: a link where the globs reach, a node_modules they would
|
|
376
|
-
// take, a yarn.json; and a root with no package.json.
|
|
377
216
|
export interface Yarn1WorkspacesOptions {
|
|
378
|
-
project: Yarn1Project
|
|
217
|
+
project: Yarn1Project;
|
|
379
218
|
}
|
|
380
219
|
|
|
381
|
-
|
|
220
|
+
/**
|
|
221
|
+
* The directories of the projects yarn finds in `project`, by which buildYarn1Tree takes their
|
|
222
|
+
* package.json given; refused as buildYarn1Tree refuses them, as is a root with no package.json
|
|
223
|
+
*
|
|
224
|
+
* @returns `.` first, then each directory with a package.json a glob of the root's `workspaces` takes
|
|
225
|
+
*/
|
|
226
|
+
export function findYarn1Workspaces(options: Yarn1WorkspacesOptions): string[];
|
|
382
227
|
|
|
383
|
-
|
|
384
|
-
// package's pattern -- or undefined for the call as a whole; the message
|
|
385
|
-
// leads with it. `cause` is what a package beneath refused with, where one
|
|
386
|
-
// did.
|
|
228
|
+
/** A refusal; `cause` is what a package beneath refused with, where one did */
|
|
387
229
|
export class DeptreeError extends Error {
|
|
388
|
-
constructor(detail: string, where?: string, options?: { cause?: unknown })
|
|
389
|
-
|
|
230
|
+
constructor(detail: string, where?: string, options?: { cause?: unknown });
|
|
231
|
+
/** What it is about, which the message leads with (`.yarnrc:3`, `manifests["."]`, a pattern), or undefined */
|
|
232
|
+
where: string | undefined;
|
|
390
233
|
}
|