@preventive/deptree 1.5.2 → 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 +1 -1
- 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/src/tarball.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// A registry tarball
|
|
2
|
-
//
|
|
3
|
-
// and its version's document from the registry, where asked for, for what
|
|
4
|
-
// it says of where the package comes from, or alone, for its size.
|
|
1
|
+
// A registry tarball through @preventive/upstream, its integrity checked again here as the lockfile's,
|
|
2
|
+
// and where asked for its version's document, for where the package comes from or for its size
|
|
5
3
|
|
|
6
4
|
import { decompress } from '@preventive/archive/compression.js'
|
|
7
5
|
import { unpack } from '@preventive/archive/tar.js'
|
|
@@ -20,10 +18,8 @@ export const REGISTRY = 'https://registry.npmjs.org/'
|
|
|
20
18
|
// The registry's own URL for a version's tarball, as npm and pnpm spell it.
|
|
21
19
|
export const tarballUrl = (name, version) => `${REGISTRY}${name}/-/${name.split('/').at(-1)}-${version}.tgz`
|
|
22
20
|
|
|
23
|
-
// A name and
|
|
24
|
-
//
|
|
25
|
-
// path. The lockfile reader holds both to more; the URL fetched is held to
|
|
26
|
-
// this whatever reached here.
|
|
21
|
+
// A name and version the URL holds as they are: unescaped ASCII, no part `.` or `..`, nothing that ends
|
|
22
|
+
// the path. The lockfile reader holds both to more; the URL fetched is held to this whatever got here.
|
|
27
23
|
const NAME = /^(?:@[\w~-][\w.~-]*\/)?[\w~-][\w.~-]*$/u
|
|
28
24
|
const VERSION = /^[\dA-Za-z][\dA-Za-z.+-]*$/u
|
|
29
25
|
|
|
@@ -87,14 +83,9 @@ export function withDirs(files, where, dirs = new Set()) {
|
|
|
87
83
|
const aboutOf = ({ gitHead, repository, homepage, bugs }) => ({ commit: gitHead, repository, homepage, bugs })
|
|
88
84
|
export const NO_ABOUT = Object.freeze(aboutOf({}))
|
|
89
85
|
|
|
90
|
-
// What a tree
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
// `sizeEstimateOnly`, false unless given true, for each version's document
|
|
94
|
-
// alone (fetchSize); and `lazy`, false unless given true, for nothing until a
|
|
95
|
-
// package is unpacked, and then its tarball, as without it. The two are
|
|
96
|
-
// refused together: a tree is laid out with sizes alone, or to be unpacked.
|
|
97
|
-
// Each is refused with `into`, a Vfs given to mount the tree's files into.
|
|
86
|
+
// What a tree fetches from the registry: `sizeEstimateOnly` the documents alone (fetchSize), `lazy` a
|
|
87
|
+
// tarball as its package is unpacked. The two are refused together, and each with `into`, a Vfs to mount
|
|
88
|
+
// the files into.
|
|
98
89
|
export function fetchingOf({ metadata = true, cache, sizeEstimateOnly = false, lazy = false }, into) {
|
|
99
90
|
if (typeof metadata !== 'boolean') throw new TypeError('metadata must be a boolean, or left out')
|
|
100
91
|
if (cache !== undefined && cache !== false && (typeof cache?.read !== 'function' || typeof cache?.write !== 'function')) {
|
|
@@ -110,13 +101,9 @@ export function fetchingOf({ metadata = true, cache, sizeEstimateOnly = false, l
|
|
|
110
101
|
|
|
111
102
|
const SHA512 = /^sha512-[\d+/A-Za-z]{86}==$/u
|
|
112
103
|
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
// getMeta
|
|
116
|
-
// says, whatever `metadata` is. Else, with `metadata`, the document is asked
|
|
117
|
-
// for beside the tarball, given the dist the tarball is fetched by, which
|
|
118
|
-
// getMeta holds the document's to as text, the registry's being the one a
|
|
119
|
-
// lockfile copies, so nothing is hashed again. Else NO_ABOUT.
|
|
104
|
+
// Without a `given` integrity, as ownTarball lets one through unpinned, the version document's is taken,
|
|
105
|
+
// and `about` is what it says. Else with `metadata` the document is asked for beside the tarball, held by
|
|
106
|
+
// getMeta to the dist the tarball is fetched by, so nothing is hashed again.
|
|
120
107
|
export async function fetchTarball(name, version, given, where, { metadata, cache }) {
|
|
121
108
|
checkId(name, version, where)
|
|
122
109
|
const meta = given === undefined ? await getMeta(name, version, { cache }) : undefined
|
|
@@ -131,12 +118,8 @@ export async function fetchTarball(name, version, given, where, { metadata, cach
|
|
|
131
118
|
return { bytes, tar, entries: unpack(tar), inflated: tar.length, integrity, about: said }
|
|
132
119
|
}
|
|
133
120
|
|
|
134
|
-
// The version's document alone, asked for as fetchTarball asks for it
|
|
135
|
-
//
|
|
136
|
-
// registry's to; no tarball is fetched. `size` is the document's
|
|
137
|
-
// unpackedSize, the bytes of the tarball's files as the registry counted
|
|
138
|
-
// them, or undefined where it has none; `about` what it says of where the
|
|
139
|
-
// package comes from.
|
|
121
|
+
// The version's document alone, asked for as fetchTarball asks for it: `size` its unpackedSize, the
|
|
122
|
+
// bytes of the files as the registry counted them, or undefined
|
|
140
123
|
export async function fetchSize(name, version, integrity, where, { cache }) {
|
|
141
124
|
checkId(name, version, where)
|
|
142
125
|
if (!SHA512.test(integrity)) throw new DeptreeError('a tarball with no sha512 integrity is not supported', where)
|
package/src/yarn1/compat.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// yarn 1's package-compatibility.js
|
|
2
|
-
//
|
|
3
|
-
// Node unknown (host.node left out) takes every range of its own, and of
|
|
4
|
-
// what it reports in process.versions.
|
|
1
|
+
// yarn 1's package-compatibility.js against host.node and host.yarn: an engine yarn knows no version of
|
|
2
|
+
// is passed over, as yarn does, and a Node unknown takes every range of its own and its process.versions
|
|
5
3
|
|
|
6
4
|
import { compareVersions, major, satisfies, valid } from '@preventive/upstream/semver.js'
|
|
7
5
|
import { DeptreeError, quote } from '../error.js'
|
package/src/yarn1/hoist.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
// yarn 1's PackageHoister (package-hoister.js), quirks and all: a
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// which a check meant to put them after their peers always puts last.
|
|
5
|
-
// Departs from yarn only in leaving out nohoist, --focus and --flat, refused
|
|
6
|
-
// before it runs, and yarn's record of each step; in comparing `loc` where
|
|
7
|
-
// yarn compares cache paths, and references where it compares manifests;
|
|
8
|
-
// and in reachedBut, its own.
|
|
1
|
+
// yarn 1's PackageHoister (package-hoister.js), quirks and all: a level's requests go by pattern, then
|
|
2
|
+
// those with peers, which a check meant to put them after their peers puts last. It departs from yarn in
|
|
3
|
+
// comparing `loc` for cache paths and references for manifests, and in reachedBut, its own.
|
|
9
4
|
|
|
10
5
|
import { DeptreeError, quote } from '../error.js'
|
|
11
6
|
|
package/src/yarn1/package.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
// A registry package as yarn 1 installs it, each mode given 0o644 and masked
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// none in its own node_modules (npm packs those only for bundled
|
|
5
|
-
// dependencies), and a package.json of the lockfile's name and version.
|
|
6
|
-
// And a directory by `file:`, as yarn's copy fetcher installs it.
|
|
1
|
+
// A registry package as yarn 1 installs it, each mode given 0o644 and masked by a 0o022 umask as tar-fs
|
|
2
|
+
// does for yarn's fetcher, and held to what npm packs; and a directory by `file:`, as yarn's copy fetcher
|
|
3
|
+
// installs it
|
|
7
4
|
|
|
8
5
|
import { fromBase64 } from '@exodus/bytes/base64.js'
|
|
9
6
|
import { toHex } from '@exodus/bytes/hex.js'
|
|
@@ -47,12 +44,9 @@ function entriesOf(entries, where) {
|
|
|
47
44
|
|
|
48
45
|
const decoder = new TextDecoder('utf-8', { fatal: true })
|
|
49
46
|
|
|
50
|
-
// yarn writes the registry
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
// 3.10.8, is the first it signed over one it made, and superstatic@6.0.0, at
|
|
54
|
-
// 2018-08-03T20:22:28.120Z, the last over none. It has since made one for
|
|
55
|
-
// every version published before too.
|
|
47
|
+
// yarn writes a sha1 alone where the registry has no sha512, which it has made for every version as it
|
|
48
|
+
// was published since then: firebase-tools@4.0.3, by npm 3.10.8, is the first it signed over one it made,
|
|
49
|
+
// and superstatic@6.0.0 the last over none
|
|
56
50
|
const SHA512_SINCE = '2018-08-05T14:58:16.253Z'
|
|
57
51
|
|
|
58
52
|
// The hex of an integrity that is a sha1 alone.
|
|
@@ -61,11 +55,9 @@ function sha1Of(integrity) {
|
|
|
61
55
|
return toHex(fromBase64(integrity.slice(5)))
|
|
62
56
|
}
|
|
63
57
|
|
|
64
|
-
// `name` is the one fetched, as an `npm:` alias asks for it.
|
|
65
|
-
// integrity
|
|
66
|
-
//
|
|
67
|
-
// with a sha1 integrity alone is held to it, and to the registry's sha512,
|
|
68
|
-
// where it was published before SHA512_SINCE.
|
|
58
|
+
// `name` is the one fetched, as an `npm:` alias asks for it. A pattern naming the tarball's URL has no
|
|
59
|
+
// integrity but the sha1 after its `#`, and one with a sha1 integrity alone has to be published before
|
|
60
|
+
// SHA512_SINCE: each is held to its sha1 and to the registry's sha512.
|
|
69
61
|
export function registryTarball(entry, name, where) {
|
|
70
62
|
const { resolution } = entry
|
|
71
63
|
if (resolution === undefined) throw new DeptreeError('a directory, by file: or link:, is not supported', where)
|
|
@@ -117,12 +109,9 @@ export async function fetchYarnPackage({ name, version, integrity, sha1: pinned
|
|
|
117
109
|
return { ...withBins({ files, dirs }, manifest, where), sha1, integrity: fetched.integrity, about: fetched.about }
|
|
118
110
|
}
|
|
119
111
|
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
// yarn holds it to: no link, device or node_modules of its own in it, and a
|
|
124
|
-
// package.json of the name, version and lists its lockfile entry has, which
|
|
125
|
-
// yarn reads anew, installing whatever they are.
|
|
112
|
+
// All in the directory, modes as they are, read from the project as yarn reads it at every install. No
|
|
113
|
+
// link, device or node_modules of its own in it, and a package.json of the name, version and lists its
|
|
114
|
+
// lockfile entry has, which yarn would install whatever they are.
|
|
126
115
|
export function readYarnDirectory(project, { name, version, entry, dir }, where) {
|
|
127
116
|
if (typeOf(project, `/${dir}`, false) !== 'directory') throw new DeptreeError(`${quote(dir)} is not a directory of the project`, where)
|
|
128
117
|
const files = new Map()
|
package/src/yarn1/resolve.js
CHANGED
|
@@ -6,12 +6,9 @@ import { satisfies, validRange } from '@preventive/upstream/semver.js'
|
|
|
6
6
|
import { DeptreeError, quote } from '../error.js'
|
|
7
7
|
import { matchesGlob } from '../glob.js'
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// alone, where nothing runs beside it; beneath, only one read already is
|
|
13
|
-
// asked for again, which yarn reads once all else has run, and takes the
|
|
14
|
-
// first's package for.
|
|
9
|
+
// The microtask turns each request beneath a top-level one takes, all at once, before it checks for a
|
|
10
|
+
// package of its version, a tarball URL as many as the registry. A directory is read at the top level
|
|
11
|
+
// alone; beneath, only one read already, which yarn reads once all else has run, taking the first's.
|
|
15
12
|
const TURNS = { registry: 5, workspace: 3, directory: 1 }
|
|
16
13
|
|
|
17
14
|
// yarn's normalizePattern.
|
|
@@ -22,11 +19,9 @@ export function splitPattern(pattern) {
|
|
|
22
19
|
return { name: scoped ? `@${name}` : name, range: parts.length === 0 ? 'latest' : version || '*', hasVersion: version !== '' }
|
|
23
20
|
}
|
|
24
21
|
|
|
25
|
-
// yarn's normalizeRange:
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// own tarball by its URL, on npm's registry or yarn's mirror; and a
|
|
29
|
-
// directory, by `file:` or a path.
|
|
22
|
+
// yarn's normalizeRange: a range neither semver nor with a `:`, as an `npm:` alias has, is a tag. Of
|
|
23
|
+
// getExoticResolver's sources, in its order: a tarball where a path ends in .tgz, the registry's own
|
|
24
|
+
// alone, then a directory by `file:` or a path.
|
|
30
25
|
const TAG = /^[\w~-][\w.~-]*$/u
|
|
31
26
|
const TARBALL = /^https?:\/\/|^[^@]*\.(?:tgz|tar\.gz)$/u
|
|
32
27
|
const REGISTRY_TARBALL = /^https:\/\/registry\.(?:npmjs\.org|yarnpkg\.com)\/[^#?]+\.tgz$/u
|
package/src/yarn1/settings.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
// The project's .yarnrc and .npmrc
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// Options that change the tree are refused; the rest are for where and how
|
|
5
|
-
// yarn fetches, and the tree is held to the lockfile's integrities. A `--`
|
|
6
|
-
// line of .yarnrc is a flag yarn adds to its command line.
|
|
1
|
+
// The project's .yarnrc and .npmrc as yarn 1 reads them for an install, the .yarnrc's over the .npmrc's,
|
|
2
|
+
// and a `--` line of the .yarnrc as a flag. What changes the tree is refused; the rest is where and how
|
|
3
|
+
// yarn fetches, and the tree is held to the lockfile's integrities.
|
|
7
4
|
|
|
8
5
|
import { DeptreeError, quote } from '../error.js'
|
|
9
6
|
import { parseNpmrc } from '../npmrc.js'
|
|
@@ -16,10 +13,8 @@ const PASSED = new Set([
|
|
|
16
13
|
'check-files', 'pure-lockfile', 'frozen-lockfile', 'audit', 'disable-pnp',
|
|
17
14
|
])
|
|
18
15
|
|
|
19
|
-
// Of the options
|
|
20
|
-
//
|
|
21
|
-
// project's directory, where yarn reads no package.json with validate(),
|
|
22
|
-
// which drops a name listed twice from all but one of its lists.
|
|
16
|
+
// Of the options config.getOption reads, those that change the tree, and yarn-path, which runs another
|
|
17
|
+
// yarn; global-folder as the project's directory has yarn drop a name listed twice from all but one list
|
|
23
18
|
const REFUSED = new Set([
|
|
24
19
|
'ignore-optional', 'production', 'bin-links', 'workspaces-experimental', 'workspaces-nohoist-experimental', 'plugnplay-override',
|
|
25
20
|
'yarn-link-file-dependencies', 'enable-meta-folder', 'experimental-pack-script-packages-in-mirror', 'global-folder', 'yarn-path',
|
package/src/yarn1/tree.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
// --production does too. Not written: node_modules/.bin, yarn's
|
|
4
|
-
// .yarn-integrity, and anything a script builds.
|
|
1
|
+
// The tree `yarn install --frozen-lockfile --ignore-scripts` makes in a directory with no node_modules,
|
|
2
|
+
// with `production` --production too: no .bin, .yarn-integrity or anything a script builds
|
|
5
3
|
|
|
6
4
|
import { parseYarn1Lockfile } from '@preventive/lockfile/yarn1.js'
|
|
7
5
|
import { Vfs } from '@preventive/vfs'
|
|
@@ -68,10 +66,8 @@ function locationOf(names, workspaces) {
|
|
|
68
66
|
return `node_modules/${names.join('/node_modules/')}`
|
|
69
67
|
}
|
|
70
68
|
|
|
71
|
-
// With --production yarn asks for the root's devDependencies
|
|
72
|
-
//
|
|
73
|
-
// (install.js's markIgnored): it is installed only where something else
|
|
74
|
-
// needs it.
|
|
69
|
+
// With --production yarn still asks for, fetches, checks and hoists the root's devDependencies, but marks
|
|
70
|
+
// each ignored (install.js's markIgnored), installed only where something else needs it
|
|
75
71
|
function resolveProject(inputs, host, production) {
|
|
76
72
|
const lockfile = parseYarn1Lockfile(inputs.lockfile, { manifests: Object.fromEntries(inputs.manifests), semver: { clean, satisfies, valid, validRange } })
|
|
77
73
|
const manifests = new Map([...inputs.manifests].map(([dir, manifest]) => [dir, fixLists(manifest)]))
|
|
@@ -89,11 +85,9 @@ function resolveProject(inputs, host, production) {
|
|
|
89
85
|
return { workspaces, asked, resolved }
|
|
90
86
|
}
|
|
91
87
|
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
// no peers, bins, platforms or engines, and the first's files, and their
|
|
96
|
-
// hashes are held to the first's tarball.
|
|
88
|
+
// Every package fetched before any is checked, in yarn's resolver's order. Of two its cache keeps in one
|
|
89
|
+
// place only the first is fetched; the rest have their lockfile entry for package.json, with no peers,
|
|
90
|
+
// bins, platforms or engines, and are held to the first's tarball.
|
|
97
91
|
async function fetchChecked(resolved, host, settings, project, fetching) {
|
|
98
92
|
const order = [...new Set(resolved.patterns.values())]
|
|
99
93
|
const registry = order.filter((ref) => ref.kind === 'registry')
|
|
@@ -175,11 +169,8 @@ function writeTree(placed, fetched) {
|
|
|
175
169
|
}
|
|
176
170
|
const pkg = fetched.get(ref)
|
|
177
171
|
const earlier = copies.get(dest)
|
|
178
|
-
if (earlier?.[0].ref === ref)
|
|
179
|
-
|
|
180
|
-
} else {
|
|
181
|
-
copies.set(dest, [info])
|
|
182
|
-
}
|
|
172
|
+
if (earlier?.[0].ref === ref) earlier.push(info)
|
|
173
|
+
else copies.set(dest, [info])
|
|
183
174
|
writeFiles(vfs, dest, pkg, counted, skipped)
|
|
184
175
|
left.set(pkg, left.get(pkg) - 1)
|
|
185
176
|
if (left.get(pkg) === 0) letGo(pkg)
|