@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/cocoapods/install.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
// A downloaded pod's directory as `pod install` leaves it in Pods/: cleaned
|
|
2
|
-
//
|
|
3
|
-
// platform each takes; copied into Pods/; cleaned again there, for the
|
|
4
|
-
// specs installed; and its source files made read-only.
|
|
1
|
+
// A downloaded pod's directory as `pod install` leaves it in Pods/: cleaned in the download cache for every
|
|
2
|
+
// spec on every platform, copied into Pods/, cleaned there for the specs installed, its sources made read-only
|
|
5
3
|
|
|
6
4
|
import { DeptreeError, quote } from '../error.js'
|
|
7
5
|
import { clean, lock } from './clean.js'
|
|
8
6
|
import { PodTree } from './podtree.js'
|
|
9
7
|
import { allSpecs, consumerOf, licenseFileOf, platformsOf } from './podspec.js'
|
|
10
8
|
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// them a pod was installed for, so a spec installed is held to name the
|
|
14
|
-
// same files on each.
|
|
9
|
+
// A spec's file patterns on each platform it takes, of `platforms` where given, which have to name the
|
|
10
|
+
// same files, as the lockfile does not say which a pod was installed for
|
|
15
11
|
function uniformConsumer(spec, platforms, where) {
|
|
16
12
|
const taken = platformsOf(spec, where).filter((platform) => platforms?.includes(platform) ?? true)
|
|
17
13
|
if (taken.length === 0) throw new DeptreeError(`${quote(spec.name)} is for none of the platforms given`, where)
|
|
@@ -25,13 +21,9 @@ function uniformConsumer(spec, platforms, where) {
|
|
|
25
21
|
return first[1]
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
// What a
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
// the clean in the download cache, and of the specs installed, for the
|
|
32
|
-
// clean in Pods/. `installed` are the specs of `podspec` the lockfile has,
|
|
33
|
-
// and `platforms` those the Podfile's targets are for, or undefined for
|
|
34
|
-
// any.
|
|
24
|
+
// What a podspec says of the files CocoaPods keeps, checked whole before anything is downloaded: the
|
|
25
|
+
// license file, and the consumerOf values of every spec on every platform, for the clean in the cache, and
|
|
26
|
+
// of the `installed` specs, for the clean in Pods/
|
|
35
27
|
export function planPod(podspec, installed, platforms, where) {
|
|
36
28
|
return {
|
|
37
29
|
license: licenseFileOf(podspec, where),
|
|
@@ -40,18 +32,13 @@ export function planPod(podspec, installed, platforms, where) {
|
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
// The download
|
|
44
|
-
//
|
|
45
|
-
// download is a clone, whose .git CocoaPods copies into its cache with the
|
|
46
|
-
// rest, as 1.13 to 1.15 do, which is refused where the clean there keeps
|
|
47
|
-
// it, as what is in it is not known; an archive has none.
|
|
35
|
+
// The download as `plan` leaves it. `keepsGit` where 1.13 to 1.15 copy a clone's .git into the cache,
|
|
36
|
+
// which is refused where the clean there keeps it, as what is in it is not known.
|
|
48
37
|
export function installPod(contents, plan, { folded, keepsGit, where }) {
|
|
49
38
|
const tree = new PodTree(keepsGit ? { ...contents, dirs: [...contents.dirs, '.git'] } : contents, folded, where)
|
|
50
39
|
const budget = { matches: 0 }
|
|
51
|
-
// Downloader::Cache#copy_and_clean
|
|
52
|
-
//
|
|
53
|
-
// a download has, a checkout's 0o644 and 0o755 or an archive's under that
|
|
54
|
-
// umask as tar extracts it.
|
|
40
|
+
// Downloader::Cache#copy_and_clean; its copy into Pods/, FileUtils.cp_r under a 0o022 umask, keeps the
|
|
41
|
+
// download's modes
|
|
55
42
|
clean(tree, plan.every, plan.license, budget)
|
|
56
43
|
if (tree.nodes.has('.git')) throw new DeptreeError('its file patterns keep the .git of the clone, which CocoaPods before 1.16 copies into its cache, and which is not built', where)
|
|
57
44
|
// PodSourceInstaller#clean!, then Installer#lock_pod_sources.
|
package/src/cocoapods/podspec.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
// A podspec as
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// over it, and for an inherited attribute the parent's under both. What
|
|
5
|
-
// CocoaPods would fail on, and what one release reads otherwise than
|
|
6
|
-
// another, is refused.
|
|
1
|
+
// A podspec as Specification.from_hash reads trunk's JSON, and what its Consumer makes of the attributes
|
|
2
|
+
// naming a pod's files on a platform: the spec's, the platform's over it, and an inherited one's parent's
|
|
3
|
+
// under both. What CocoaPods fails on, or one release reads otherwise than another, is refused.
|
|
7
4
|
|
|
8
5
|
import { DeptreeError, quote } from '../error.js'
|
|
9
6
|
import { UNSAFE } from '../mount.js'
|
|
10
7
|
import { CASE_UNSTABLE } from './unicode.js'
|
|
11
8
|
|
|
12
|
-
// The platforms
|
|
13
|
-
//
|
|
14
|
-
// another case of a name, or `xros`, from 1.16 alone.
|
|
9
|
+
// The platforms by a podspec's names, and all in CocoaPods' order for a spec naming none; another case of a
|
|
10
|
+
// name, or `xros`, Platform takes from 1.16 alone
|
|
15
11
|
const PLATFORM_NAMES = { __proto__: null, osx: 'osx', macos: 'osx', ios: 'ios', tvos: 'tvos', visionos: 'visionos', watchos: 'watchos' }
|
|
16
12
|
const PLATFORMS = ['osx', 'ios', 'tvos', 'visionos', 'watchos']
|
|
17
13
|
// What Version.create takes of a deployment target, as trunk has them.
|
|
@@ -28,9 +24,7 @@ const PATHS = ['prefix_header_file', 'module_map']
|
|
|
28
24
|
export const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
29
25
|
// Given at all: a podspec leaves a value out as undefined, null or false.
|
|
30
26
|
export const given = (value) => value !== undefined && value !== null && value !== false
|
|
31
|
-
//
|
|
32
|
-
// written, nor what CocoaPods compares by a case Ruby maps otherwise in one
|
|
33
|
-
// release than another.
|
|
27
|
+
// Not what reads otherwise than written, nor what CocoaPods compares by a case releases map otherwise
|
|
34
28
|
const isText = (value) => typeof value === 'string' && value.isWellFormed() && !UNSAFE.test(value) && !CASE_UNSTABLE.test(value)
|
|
35
29
|
|
|
36
30
|
function readJson(bytes, where) {
|
|
@@ -44,8 +38,7 @@ function readJson(bytes, where) {
|
|
|
44
38
|
return json
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
// A spec and those inside it, each
|
|
48
|
-
// its parent. `at` is where it is in the podspec, for a refusal.
|
|
41
|
+
// A spec and those inside it, each named in full, `Root/Sub`; `at` is where it is, for a refusal
|
|
49
42
|
function specOf(hash, parent, at, where) {
|
|
50
43
|
const name = hash.name
|
|
51
44
|
if (!isText(name) || name === '' || name.includes('/')) throw new DeptreeError(`${at}name is not a spec's name`, where)
|
|
@@ -62,8 +55,7 @@ function specOf(hash, parent, at, where) {
|
|
|
62
55
|
return spec
|
|
63
56
|
}
|
|
64
57
|
|
|
65
|
-
// The root spec
|
|
66
|
-
// `version`, as Pod::Version writes it back.
|
|
58
|
+
// The root spec, held to be the lockfile's `name` at `version`, as Pod::Version writes it back
|
|
67
59
|
export function readPodspec(bytes, name, version, where) {
|
|
68
60
|
const root = specOf(readJson(bytes, where), undefined, '', where)
|
|
69
61
|
if (root.name !== name) throw new DeptreeError(`its podspec is of ${quote(root.name)}`, where)
|
|
@@ -71,8 +63,7 @@ export function readPodspec(bytes, name, version, where) {
|
|
|
71
63
|
return root
|
|
72
64
|
}
|
|
73
65
|
|
|
74
|
-
// Every spec,
|
|
75
|
-
// as recursive_subspecs lists them.
|
|
66
|
+
// Every spec, depth first, as recursive_subspecs lists them
|
|
76
67
|
export function allSpecs(root) {
|
|
77
68
|
return [root, ...root.children.flatMap((child) => allSpecs(child))]
|
|
78
69
|
}
|
|
@@ -81,8 +72,7 @@ export function specNamed(root, name) {
|
|
|
81
72
|
return allSpecs(root).find((spec) => spec.name === name)
|
|
82
73
|
}
|
|
83
74
|
|
|
84
|
-
// Specification#platform_hash: a name,
|
|
85
|
-
// deployment targets; anything else, none.
|
|
75
|
+
// Specification#platform_hash: a name, names, or names to deployment targets; anything else, none
|
|
86
76
|
function platformNames(spec, where) {
|
|
87
77
|
const value = spec.attributes.platforms
|
|
88
78
|
const named = typeof value === 'string' ? [[value, null]] : Array.isArray(value) ? value.map((name) => [name, null]) : isObject(value) ? Object.entries(value) : []
|
|
@@ -102,9 +92,7 @@ export function platformsOf(spec, where) {
|
|
|
102
92
|
return PLATFORMS
|
|
103
93
|
}
|
|
104
94
|
|
|
105
|
-
//
|
|
106
|
-
// reads it; anything else but null or false CocoaPods fails on, or reads as
|
|
107
|
-
// a string.
|
|
95
|
+
// A platform's values, as the Consumer reads them; anything but a hash, null or false CocoaPods fails on
|
|
108
96
|
function platformHash(spec, platform, where) {
|
|
109
97
|
const value = spec.attributes[platform]
|
|
110
98
|
if (!given(value)) return undefined
|
|
@@ -112,8 +100,7 @@ function platformHash(spec, platform, where) {
|
|
|
112
100
|
return value
|
|
113
101
|
}
|
|
114
102
|
|
|
115
|
-
// prepare_value
|
|
116
|
-
// each has to be a pattern, as File.fnmatch takes nothing else.
|
|
103
|
+
// prepare_value: a value as a list of itself, nulls dropped, each a pattern, as File.fnmatch takes no other
|
|
117
104
|
function patternsOf(value, what, where) {
|
|
118
105
|
if (value === undefined || value === null) return []
|
|
119
106
|
const list = Array.isArray(value) ? value.filter((item) => item !== null) : [value]
|
|
@@ -131,8 +118,7 @@ function listOf(spec, key, platform, where) {
|
|
|
131
118
|
return [...patternsOf(own, `${spec.at}${key}`, where), ...patternsOf(onPlatform, `${spec.at}${platform}.${key}`, where)]
|
|
132
119
|
}
|
|
133
120
|
|
|
134
|
-
// A path
|
|
135
|
-
// it: one this keeps as it is, within the directory.
|
|
121
|
+
// A path Pathname#+ joins to the pod's directory as it is, within it
|
|
136
122
|
function checkPath(path, what, where) {
|
|
137
123
|
if (!isText(path) || path === '' || path.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {
|
|
138
124
|
throw new DeptreeError(`${what} is not a path within the pod, as CocoaPods joins it to the pod's directory`, where)
|
|
@@ -140,8 +126,7 @@ function checkPath(path, what, where) {
|
|
|
140
126
|
return path
|
|
141
127
|
}
|
|
142
128
|
|
|
143
|
-
// prefix_header_file and module_map:
|
|
144
|
-
// the platform's over the spec's, the spec's over its parent's.
|
|
129
|
+
// prefix_header_file and module_map: the platform's over the spec's over its parent's; false or null none
|
|
145
130
|
function pathOf(spec, key, platform, where) {
|
|
146
131
|
const [own, onPlatform] = rawValues(spec, key, platform, where)
|
|
147
132
|
const value = onPlatform ?? own ?? (spec.parent === undefined ? undefined : pathOf(spec.parent, key, platform, where))
|
|
@@ -150,8 +135,7 @@ function pathOf(spec, key, platform, where) {
|
|
|
150
135
|
return checkPath(value, `${spec.at}${key}`, where)
|
|
151
136
|
}
|
|
152
137
|
|
|
153
|
-
// _prepare_on_demand_resources: patterns, or a hash of
|
|
154
|
-
// `category`, which has to be a name.
|
|
138
|
+
// _prepare_on_demand_resources: patterns, or a hash of `paths` and a `category` name
|
|
155
139
|
function onDemandPatterns(patterns, what, where) {
|
|
156
140
|
if (typeof patterns === 'string' || Array.isArray(patterns)) return patternsOf(patterns, what, where)
|
|
157
141
|
if (!isObject(patterns)) throw new DeptreeError(`${what} is not file patterns, or a hash of them, which CocoaPods fails on`, where)
|
|
@@ -159,10 +143,8 @@ function onDemandPatterns(patterns, what, where) {
|
|
|
159
143
|
return patternsOf(patterns.paths, `${what}.paths`, where)
|
|
160
144
|
}
|
|
161
145
|
|
|
162
|
-
// resource_bundles and on_demand_resources:
|
|
163
|
-
//
|
|
164
|
-
// a name in both, the bundle has the patterns of both; of an on-demand
|
|
165
|
-
// resource, CocoaPods fails, as it adds the two hashes as if strings.
|
|
146
|
+
// resource_bundles and on_demand_resources: the platform's hash merged into the spec's, by name. A bundle
|
|
147
|
+
// in both has both's patterns; CocoaPods fails on an on-demand resource in both, adding them as strings.
|
|
166
148
|
function hashOf(spec, key, platform, where, prepare) {
|
|
167
149
|
const result = new Map()
|
|
168
150
|
const whats = [`${spec.at}${key}`, `${spec.at}${platform}.${key}`]
|
|
@@ -178,9 +160,7 @@ function hashOf(spec, key, platform, where, prepare) {
|
|
|
178
160
|
return [...result.values()].flat()
|
|
179
161
|
}
|
|
180
162
|
|
|
181
|
-
// What a spec's Consumer on `platform`
|
|
182
|
-
// files: the lists of patterns, those of its resource bundles and its
|
|
183
|
-
// on-demand resources, and the prefix header's and module map's paths.
|
|
163
|
+
// What a spec's Consumer gives on `platform` of each attribute that names files
|
|
184
164
|
export function consumerOf(spec, platform, where) {
|
|
185
165
|
const values = {}
|
|
186
166
|
for (const key of LISTS) values[key] = listOf(spec, key, platform, where)
|
|
@@ -190,8 +170,7 @@ export function consumerOf(spec, platform, where) {
|
|
|
190
170
|
return values
|
|
191
171
|
}
|
|
192
172
|
|
|
193
|
-
// The
|
|
194
|
-
// a hash alone, where its `text`, which CocoaPods strips, is text.
|
|
173
|
+
// The license file, as RootAttributesAccessors#license reads it: of a hash alone, its `text` text
|
|
195
174
|
export function licenseFileOf(root, where) {
|
|
196
175
|
const license = root.attributes.license
|
|
197
176
|
if (!isObject(license)) return undefined
|
package/src/cocoapods/podtree.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
// A pod's directory
|
|
2
|
-
//
|
|
3
|
-
// FileUtils.rm_rf leaves of it.
|
|
1
|
+
// A pod's directory as CocoaPods finds it on disk: what is there, what a path comes to through links, and
|
|
2
|
+
// what FileUtils.rm_rf leaves
|
|
4
3
|
|
|
5
4
|
import { utf8fromStringLoose } from '@exodus/bytes/utf8.js'
|
|
6
5
|
import { DeptreeError, quote } from '../error.js'
|
|
7
6
|
import { fold } from '../mount.js'
|
|
8
7
|
import { CASE_UNSTABLE } from './unicode.js'
|
|
9
8
|
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// name in it, that a call takes, which a path in the pod is shorter than
|
|
13
|
-
// with the pod's directory in front of it.
|
|
9
|
+
// Links followed before ELOOP, and the longest path and name in bytes a call takes, which a path in the pod
|
|
10
|
+
// is shorter than with the pod's directory in front
|
|
14
11
|
const LIMITS = {
|
|
15
12
|
linux: { links: 40, path: 4096, name: 255 },
|
|
16
13
|
darwin: { links: 32, path: 1024, name: 255 },
|
|
@@ -19,11 +16,8 @@ const LIMITS = {
|
|
|
19
16
|
const parentOf = (path) => (path.includes('/') ? path.slice(0, path.lastIndexOf('/')) : '')
|
|
20
17
|
const join = (dir, name) => (dir === '' ? name : `${dir}/${name}`)
|
|
21
18
|
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
// on the way to one is one of them. `folded` where it is on macOS, which
|
|
25
|
-
// finds a name whatever its case and normalization: two that are one name
|
|
26
|
-
// there are refused, as git's checkout would write one of them alone.
|
|
19
|
+
// Every directory on the way to a path is one too. `folded` on macOS, which finds a name whatever its case
|
|
20
|
+
// and normalization: two that are one name there are refused, as git's checkout would write one alone.
|
|
27
21
|
export class PodTree {
|
|
28
22
|
constructor({ dirs, files, links }, folded, where) {
|
|
29
23
|
this.where = where
|
|
@@ -47,8 +41,7 @@ export class PodTree {
|
|
|
47
41
|
}
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
//
|
|
51
|
-
// what it reads by case otherwise in one release than another.
|
|
44
|
+
// A path or name too long, which CocoaPods fails on, or with a letter one release cases otherwise
|
|
52
45
|
check(path, target) {
|
|
53
46
|
const bytes = utf8fromStringLoose(path).length
|
|
54
47
|
if (bytes >= this.limits.path || path.split('/').some((name) => utf8fromStringLoose(name).length > this.limits.name)) {
|
|
@@ -63,9 +56,8 @@ export class PodTree {
|
|
|
63
56
|
return [...this.nodes.keys()]
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
// The node `path` comes to, links followed, or undefined
|
|
67
|
-
//
|
|
68
|
-
// whatever is there on the machine, which is refused.
|
|
59
|
+
// The node `path` comes to, links followed, or undefined for none; a link out of the pod's directory reads
|
|
60
|
+
// whatever the machine has there, and is refused
|
|
69
61
|
resolve(path) {
|
|
70
62
|
// The names still to follow, the next one last.
|
|
71
63
|
const pending = path.split('/').toReversed()
|
|
@@ -104,8 +96,7 @@ export class PodTree {
|
|
|
104
96
|
return this.resolve(path) !== undefined
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
// FileUtils.rm_rf of each of `removed
|
|
108
|
-
// a directory, as nothing is under a link.
|
|
99
|
+
// FileUtils.rm_rf of each of `removed`, with all under it
|
|
109
100
|
removeAll(removed) {
|
|
110
101
|
for (const path of this.paths) {
|
|
111
102
|
let at = path
|
package/src/cocoapods/source.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// Where a pod is downloaded from: its podspec's `source`, as
|
|
2
|
-
// cocoapods-downloader takes it, held to what is fetched here alike.
|
|
1
|
+
// Where a pod is downloaded from: its podspec's `source`, as cocoapods-downloader takes it
|
|
3
2
|
|
|
4
3
|
import { isPodArchiveUrl } from '@preventive/upstream/cocoapods.js'
|
|
5
4
|
import { DeptreeError, quote } from '../error.js'
|
|
@@ -11,35 +10,24 @@ const STRATEGIES = ['git', 'hg', 'http', 'scp', 'svn']
|
|
|
11
10
|
// What its Git takes beside the URL; anything else it refuses.
|
|
12
11
|
const GIT_OPTIONS = new Set(['git', 'tag', 'commit', 'branch', 'submodules'])
|
|
13
12
|
const COMMIT = /^[\da-f]{40}$/u
|
|
14
|
-
// What its Http, a RemoteFile, takes beside the URL; anything else it
|
|
15
|
-
// refuses.
|
|
13
|
+
// What its Http, a RemoteFile, takes beside the URL; anything else it refuses
|
|
16
14
|
const HTTP_OPTIONS = new Set(['http', 'type', 'flatten', 'sha1', 'sha256', 'headers'])
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// sha256 alone is taken, as two archives can be made to share a sha1.
|
|
15
|
+
// RemoteFile compares :sha256 before :sha1, as text, to the lowercase hex Ruby's hexdigest writes; a sha256
|
|
16
|
+
// alone is taken, as two archives can be made to share a sha1
|
|
20
17
|
const SHA256 = /^[\da-f]{64}$/u
|
|
21
|
-
// RemoteFile's types, by :type or the end of the URL's path: tars
|
|
22
|
-
//
|
|
23
|
-
// it does not flatten, and a dmg it mounts, not read here.
|
|
18
|
+
// RemoteFile's types, by :type or the end of the URL's path: tars `tar xf` extracts and are flattened by
|
|
19
|
+
// default, a zip `unzip` extracts, and a dmg it mounts, not read here
|
|
24
20
|
const TARS = new Set(['tgz', 'tar', 'tbz', 'txz'])
|
|
25
21
|
const TYPES = new Set([...TARS, 'zip', 'dmg'])
|
|
26
22
|
const URL_TYPES = [[/\.zip$/u, 'zip'], [/\.(?:tgz|tar\.gz)$/u, 'tgz'], [/\.tar$/u, 'tar'], [/\.(?:tbz|tar\.bz2)$/u, 'tbz'], [/\.(?:txz|tar\.xz)$/u, 'txz'], [/\.dmg$/u, 'dmg']]
|
|
27
|
-
// Meta's namespace on Maven Central, a .tar.gz or a .zip
|
|
28
|
-
// upstream's isPodArchiveUrl takes.
|
|
23
|
+
// Meta's namespace on Maven Central, under which isPodArchiveUrl takes a .tar.gz or a .zip
|
|
29
24
|
const MAVEN_FACEBOOK = 'https://repo1.maven.org/maven2/com/facebook/'
|
|
30
25
|
|
|
31
|
-
// A refusal of where a pod is downloaded from, which
|
|
32
|
-
// `partial` leaves the pod to CocoaPods for; a DeptreeError otherwise.
|
|
26
|
+
// A refusal of where a pod is downloaded from, for which `partial` leaves the pod to CocoaPods
|
|
33
27
|
export class SourceRefusal extends DeptreeError {}
|
|
34
28
|
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// `tar xf` or `unzip` extracts, or a .tar.gz or a .zip under Maven
|
|
38
|
-
// Central's com/facebook/, and the hash the podspec holds it to. A
|
|
39
|
-
// tag is refused, as the lockfile holds no commit for one and GitHub can
|
|
40
|
-
// move it. A prepare_command, a script CocoaPods runs in the download, is
|
|
41
|
-
// refused unless `prepares`, where the caller runs it, as is any other
|
|
42
|
-
// source, each with a SourceRefusal.
|
|
29
|
+
// Git from a GitHub repository by a full commit, or :http (httpSourceOf), else a SourceRefusal: a tag, as
|
|
30
|
+
// GitHub can move one; a prepare_command unless `prepares`, where the caller runs it; any other source
|
|
43
31
|
export function sourceOf(podspec, where, prepares = false) {
|
|
44
32
|
if (given(podspec.attributes.prepare_command) && !prepares) throw new SourceRefusal('a prepare_command, a script CocoaPods runs in the download, is not supported', where)
|
|
45
33
|
const source = podspec.attributes.source
|
|
@@ -61,14 +49,9 @@ export function sourceOf(podspec, where, prepares = false) {
|
|
|
61
49
|
return { type: 'git', url, repo, commit }
|
|
62
50
|
}
|
|
63
51
|
|
|
64
|
-
// An
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// name it downloads it under, `file.<type>`, in the directory it extracts
|
|
68
|
-
// it into; whether it flattens it, by :flatten where that is given, as Ruby
|
|
69
|
-
// reads a value, and else by its type, a tar and not a zip; and the sha256
|
|
70
|
-
// it checks it against. A download held to no hash, or to a sha1 alone, is
|
|
71
|
-
// refused, as is one with :headers, which curl would send.
|
|
52
|
+
// An archive getPodArchive fetches, of the type RemoteFile takes it to be and so downloads as
|
|
53
|
+
// `file.<type>`, flattened by :flatten as Ruby reads it or else as a tar is, held to its sha256. No hash, a
|
|
54
|
+
// sha1 alone, or :headers, which curl would send, is refused.
|
|
72
55
|
function httpSourceOf(source, where) {
|
|
73
56
|
const other = Object.keys(source).find((key) => !HTTP_OPTIONS.has(key))
|
|
74
57
|
if (other !== undefined) throw new SourceRefusal(`its source has :${other}, which cocoapods-downloader refuses of :http`, where)
|
package/src/cocoapods/tree.js
CHANGED
|
@@ -18,14 +18,10 @@ import { SourceRefusal, sourceOf } from './source.js'
|
|
|
18
18
|
const GITHUB = 'github must be a GitHub client from createClient, which each pod is fetched through'
|
|
19
19
|
const GITHUB_METHODS = ['getRepo', 'compareCommits', 'getCommitTree', 'getRepoTreeTarball']
|
|
20
20
|
|
|
21
|
-
// Trunk, as SPEC REPOS names it from
|
|
22
|
-
// trunk's podspecs are kept in, as it named it before; trunk's CDN serves
|
|
23
|
-
// the same files.
|
|
21
|
+
// Trunk, as SPEC REPOS names it from 1.8, or by the git repository of its podspecs, as before
|
|
24
22
|
const isTrunk = (repo) => repo === 'trunk' || /^https:\/\/github\.com\/cocoapods\/specs(?:\.git)?$/iu.test(repo)
|
|
25
23
|
|
|
26
|
-
// What CocoaPods writes in Pods/ beside the pods,
|
|
27
|
-
// would be one with: Pods.xcodeproj among the projects of
|
|
28
|
-
// generate_multiple_pod_projects, each `<name>.xcodeproj`.
|
|
24
|
+
// What CocoaPods writes in Pods/ beside the pods, Pods.xcodeproj among generate_multiple_pod_projects'
|
|
29
25
|
const GENERATED = ['Headers', 'Local Podspecs', 'Manifest.lock', 'Target Support Files']
|
|
30
26
|
const isGenerated = (name, key) => GENERATED.some((other) => key(other) === key(name)) || key(name).endsWith(key('.xcodeproj'))
|
|
31
27
|
|
|
@@ -33,11 +29,8 @@ const checkNoPods = checkNoDir('Pods', 'a Pods directory')
|
|
|
33
29
|
|
|
34
30
|
const about = (name) => `pods[${quote(name)}]`
|
|
35
31
|
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
// it resolved that to a commit, CHECKOUT OPTIONS', which it downloads by
|
|
39
|
-
// those. One by :path, which it reads where it is, false; any other,
|
|
40
|
-
// refused.
|
|
32
|
+
// True for a root CocoaPods downloads into Pods/, from trunk or by :podspec (unless by CHECKOUT OPTIONS,
|
|
33
|
+
// refused); false for one by :path, read where it is; any other refused
|
|
41
34
|
function isDownloaded(root, folded) {
|
|
42
35
|
const where = about(root.name)
|
|
43
36
|
if (root.external?.type === 'path') return false
|
|
@@ -45,8 +38,7 @@ function isDownloaded(root, folded) {
|
|
|
45
38
|
if (root.external !== undefined && root.external.type !== 'podspec') throw new SourceRefusal(`a pod from an external source by :${root.external.type} is not supported: only those from trunk, by :podspec and by :path are`, where)
|
|
46
39
|
if (root.external === undefined && !isTrunk(root.repo)) throw new SourceRefusal(`a pod from the spec repo ${quote(root.repo)} is not supported: only those from trunk are`, where)
|
|
47
40
|
if (isGenerated(root.name, folded ? fold : (name) => name)) throw new DeptreeError('a pod named as what CocoaPods writes beside the pods in Pods/ is not supported', where)
|
|
48
|
-
// PodDirCleaner globs the pod's directory by its path as it is
|
|
49
|
-
// then matches what it should not, or nothing.
|
|
41
|
+
// PodDirCleaner globs the pod's directory by its path as it is
|
|
50
42
|
if (/[*?[\]{}]/u.test(root.name)) throw new DeptreeError('a name with a glob\'s `*`, `?`, `[`, `]`, `{` or `}` in it, which CocoaPods cleans the pod by, is not supported', where)
|
|
51
43
|
// ASCII, as the lockfile reader holds a pod's name to.
|
|
52
44
|
if (root.name.length > 255) throw new DeptreeError('a name too long for a directory, which CocoaPods fails to make', where)
|
|
@@ -57,9 +49,7 @@ function refuse(detail, where) {
|
|
|
57
49
|
throw new DeptreeError(detail, where)
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
// What `attempt` gives
|
|
61
|
-
// where it refuses where the pod is downloaded from, undefined, its refusal
|
|
62
|
-
// kept in `skipped` by the pod's name; any other refusal stands.
|
|
52
|
+
// What `attempt` gives or comes to; with `partial` (`skipped`), undefined for a SourceRefusal, kept there
|
|
63
53
|
function unlessSkipped(attempt, root, skipped) {
|
|
64
54
|
const skip = (error) => {
|
|
65
55
|
if (skipped === undefined || !(error instanceof SourceRefusal)) throw error
|
|
@@ -74,8 +64,7 @@ function unlessSkipped(attempt, root, skipped) {
|
|
|
74
64
|
}
|
|
75
65
|
}
|
|
76
66
|
|
|
77
|
-
// The podspec of a pod by :podspec,
|
|
78
|
-
// Podspecs, held to the lockfile's checksum, which is its sha1.
|
|
67
|
+
// The podspec of a pod by :podspec, held to the lockfile's checksum, its sha1
|
|
79
68
|
async function localPodspec(root, podspecs, where) {
|
|
80
69
|
const bytes = podspecs(root.name)
|
|
81
70
|
if (bytes === undefined) throw new SourceRefusal(`its podspec, the JSON CocoaPods writes as Pods/Local Podspecs/${root.name}.podspec.json, is not given`, where)
|
|
@@ -84,10 +73,8 @@ async function localPodspec(root, podspecs, where) {
|
|
|
84
73
|
return bytes
|
|
85
74
|
}
|
|
86
75
|
|
|
87
|
-
// Each root's podspec,
|
|
88
|
-
//
|
|
89
|
-
// before any tarball or archive is fetched. A pod skipped for its source
|
|
90
|
-
// has no plan, its podspec held to the lockfile all the same.
|
|
76
|
+
// Each root's podspec, source and plan, before any download, so a pod refused costs none; a pod skipped
|
|
77
|
+
// for its source has no plan, its podspec held to the lockfile all the same
|
|
91
78
|
async function planAll(roots, { github, podspecs, platforms, prepare }, skipped) {
|
|
92
79
|
const plans = new Map()
|
|
93
80
|
await eachConcurrently(roots, async (root) => {
|
|
@@ -107,9 +94,8 @@ async function planAll(roots, { github, podspecs, platforms, prepare }, skipped)
|
|
|
107
94
|
return plans
|
|
108
95
|
}
|
|
109
96
|
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
// RemoteFile makes of it.
|
|
97
|
+
// A download, fetched once for every pod of it: a checkout by its repository and commit, an archive by its
|
|
98
|
+
// hash and what RemoteFile makes of it
|
|
113
99
|
const downloadOf = ({ source }) => (source.type === 'git' ? `git ${source.repo}@${source.commit}` : `http ${source.sha256} ${source.file} ${source.flatten}`)
|
|
114
100
|
async function contentsOf({ root, source }, github) {
|
|
115
101
|
const where = about(root.name)
|
|
@@ -119,8 +105,7 @@ async function contentsOf({ root, source }, github) {
|
|
|
119
105
|
|
|
120
106
|
const PREPARED = 'prepare must give the download back as it is after the command: its dirs, a Map of its files, each with data and a mode, and a Map of its links'
|
|
121
107
|
|
|
122
|
-
// A
|
|
123
|
-
// copy of it, by the caller, which gives back what is there afterwards.
|
|
108
|
+
// A copy of the download, with the pod's prepare_command run in it by the caller
|
|
124
109
|
async function prepared(prepare, { root, command }, contents) {
|
|
125
110
|
const copy = { dirs: new Set(contents.dirs), files: new Map(contents.files), links: new Map(contents.links) }
|
|
126
111
|
const after = await prepare({ name: root.name, version: root.version, command, contents: copy })
|
|
@@ -131,10 +116,8 @@ async function prepared(prepare, { root, command }, contents) {
|
|
|
131
116
|
return { dirs: new Set(after.dirs), files: after.files, links: after.links }
|
|
132
117
|
}
|
|
133
118
|
|
|
134
|
-
// What CocoaPods keeps of each pod's download, held only while
|
|
135
|
-
//
|
|
136
|
-
// its download: CocoaPods runs it in its copy of the download, before it
|
|
137
|
-
// cleans that.
|
|
119
|
+
// What CocoaPods keeps of each pod's download, held only while its pods are installed; a prepare_command
|
|
120
|
+
// runs in the copy before it is cleaned
|
|
138
121
|
async function installAll(plans, github, { prepare, ...options }) {
|
|
139
122
|
const byDownload = Map.groupBy(plans.values(), downloadOf)
|
|
140
123
|
const installed = new Map()
|
|
@@ -150,18 +133,14 @@ async function installAll(plans, github, { prepare, ...options }) {
|
|
|
150
133
|
return installed
|
|
151
134
|
}
|
|
152
135
|
|
|
153
|
-
// A pod written, as CocoaPodsInstalled has it: from git, by the commit
|
|
154
|
-
// checked out; by :http, by the URL and the sha256 it is held to.
|
|
155
136
|
function installedOf({ name, version, checksum, pods }, { source }) {
|
|
156
137
|
const pod = { path: `Pods/${name}`, name, version, checksum, pods: [...pods] }
|
|
157
138
|
if (source.type === 'git') return { ...pod, git: source.url, commit: source.commit }
|
|
158
139
|
return { ...pod, http: source.url, sha256: source.sha256 }
|
|
159
140
|
}
|
|
160
141
|
|
|
161
|
-
// Pods/Manifest.lock,
|
|
162
|
-
// the lockfile
|
|
163
|
-
// it is the lockfile's bytes: its text as UTF-8, of no lone surrogate, as
|
|
164
|
-
// the reader refuses one.
|
|
142
|
+
// Pods/Manifest.lock, as CocoaPods writes Podfile.lock: the reader holds the lockfile to be that, so it is
|
|
143
|
+
// the lockfile's UTF-8
|
|
165
144
|
function writeManifest(vfs, lockfile, stats) {
|
|
166
145
|
const data = utf8fromString(lockfile)
|
|
167
146
|
makeDirs(vfs, 'Pods')
|
|
@@ -181,8 +160,7 @@ export async function buildCocoaPodsTree(options) {
|
|
|
181
160
|
const only = onlyOf(all.only)
|
|
182
161
|
const host = checkHost(all.host)
|
|
183
162
|
const folded = host.os === 'darwin'
|
|
184
|
-
// 1.13 to 1.15 copy a download into
|
|
185
|
-
// which copies the clone's .git; 1.16 on, with rsync, which leaves it out.
|
|
163
|
+
// 1.13 to 1.15 copy a download into the cache with FileUtils.cp_r, which copies .git; 1.16 on, rsync
|
|
186
164
|
const keepsGit = Number(host.cocoapods.split('.')[1]) < 16
|
|
187
165
|
// Refused before anything is fetched; mount checks again.
|
|
188
166
|
if (into !== undefined) checkNoPods(into, folded)
|
package/src/cocoapods/unicode.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// 2.6 reads, and older ones that map to them. Each is refused where
|
|
5
|
-
// CocoaPods compares a name by its case, as which release reads it is not
|
|
6
|
-
// known. Made from Unicode 17's DerivedAge.txt, the code points Node maps
|
|
7
|
-
// to another case whose age, or that of what they map to, is past 12.1;
|
|
8
|
-
// they take in every code point Ruby 3.3 maps otherwise than Node, but
|
|
9
|
-
// for the final sigma, which clean.js reads as Ruby does.
|
|
1
|
+
// Letters whose case Ruby maps otherwise in one release than another, or than Node: those Node maps to a
|
|
2
|
+
// case where either is past Unicode 12.1, Ruby 2.6's, by Unicode 17's DerivedAge.txt. They take in all
|
|
3
|
+
// Ruby 3.3 maps otherwise than Node but the final sigma, which clean.js reads as Ruby does.
|
|
10
4
|
export const CASE_UNSTABLE = new RegExp(`[${[
|
|
11
5
|
String.raw`\u{19B}\u{264}\u{1C89}-\u{1C8A}\u{2C2F}\u{2C5F}\u{A7C0}-\u{A7C1}`,
|
|
12
6
|
String.raw`\u{A7C7}-\u{A7DC}\u{A7F5}-\u{A7F6}\u{10570}-\u{1057A}`,
|
package/src/github.js
CHANGED
|
@@ -8,16 +8,12 @@ import { HttpError } from '@preventive/upstream/github.js'
|
|
|
8
8
|
import { DeptreeError, quote } from './error.js'
|
|
9
9
|
import { MAX_BYTES } from './tarball.js'
|
|
10
10
|
|
|
11
|
-
// A name git's checkout refuses,
|
|
12
|
-
//
|
|
13
|
-
// name `git~1`, in any case, dots and spaces after it, and then nothing, or
|
|
14
|
-
// a `:` and anything.
|
|
11
|
+
// A name git's checkout refuses under core.protectNTFS, on by default: `.git` or `git~1` in any case,
|
|
12
|
+
// dots and spaces after it, then nothing or a `:` and anything
|
|
15
13
|
const isDotGit = (name) => /^(?:\.git|git~1)[. ]*(?::|$)/iu.test(name)
|
|
16
14
|
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// ssh://git@github.com/<repo> and git@github.com:<repo>. The owner and name
|
|
20
|
-
// are as GitHub takes them.
|
|
15
|
+
// https://github.com/<repo>, ssh://git@github.com/<repo> and git@github.com:<repo>, `.git` after it or
|
|
16
|
+
// not, scheme and host in any case, the owner and name as GitHub takes them
|
|
21
17
|
const REPO = String.raw`(?<repo>(?=[\dA-Za-z-]{1,39}\/)[\dA-Za-z](?:-?[\dA-Za-z])*\/[\w.-]{1,100}?)(?:\.git)?`
|
|
22
18
|
const URL_FORM = new RegExp(String.raw`^(?:(?i:https):\/\/|(?i:ssh):\/\/git@)(?i:github\.com)\/${REPO}\/?$`, 'u')
|
|
23
19
|
const SCP_FORM = new RegExp(String.raw`^git@(?i:github\.com):${REPO}$`, 'u')
|
|
@@ -29,10 +25,8 @@ export function githubRepoOf(url) {
|
|
|
29
25
|
|
|
30
26
|
const isRedirect = (error) => error instanceof HttpError && error.status >= 300 && error.status < 400
|
|
31
27
|
|
|
32
|
-
// A repository renamed or
|
|
33
|
-
//
|
|
34
|
-
// name GitHub gives it now, as upstream's getRepo follows the redirect;
|
|
35
|
-
// any other redirect is refused there.
|
|
28
|
+
// A repository renamed or moved since, which git's clone follows, is asked for by its name now, as
|
|
29
|
+
// upstream's getRepo follows the redirect; any other redirect is refused there
|
|
36
30
|
async function followingMoves(github, repo, ask) {
|
|
37
31
|
try {
|
|
38
32
|
return await ask(repo)
|
|
@@ -43,11 +37,9 @@ async function followingMoves(github, repo, ask) {
|
|
|
43
37
|
}
|
|
44
38
|
}
|
|
45
39
|
|
|
46
|
-
// That `commit
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// what a clone fetches, the default branch's history alone is asked of, so
|
|
50
|
-
// that a commit on another branch alone is refused too.
|
|
40
|
+
// That a clone has `commit`, which GitHub's API does not tell, answering for any fork's commit and for
|
|
41
|
+
// one nothing reaches. The default branch's history alone is asked of, so one on another branch alone
|
|
42
|
+
// is refused too.
|
|
51
43
|
export async function checkCloned(github, repo, commit, where) {
|
|
52
44
|
const { status } = await followingMoves(github, repo, async (name) => {
|
|
53
45
|
const { default_branch: branch } = await github.getRepo({ repo: name })
|
|
@@ -58,13 +50,9 @@ export async function checkCloned(github, repo, commit, where) {
|
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
// GitHub's tarball of the
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
// and the tarball held to that tree, files, symlinks and the submodules it
|
|
65
|
-
// shows as empty directories alike. Unpacked as a checkout with umask
|
|
66
|
-
// 0o022 writes it: directories 0o755, files 0o644 or 0o755 by the bit git
|
|
67
|
-
// keeps, symlinks as symlinks.
|
|
53
|
+
// GitHub's tarball of the tree read off the commit's own object, both held to it by upstream whatever
|
|
54
|
+
// GitHub's API says, unpacked as a checkout under umask 0o022 writes it: directories 0o755, files 0o644
|
|
55
|
+
// or 0o755 by the bit git keeps, submodules empty directories
|
|
68
56
|
export async function checkoutOf(github, repo, rev, where) {
|
|
69
57
|
const bytes = await followingMoves(github, repo, async (name) => github.getRepoTreeTarball({ repo: name, tree: await github.getCommitTree({ repo: name, sha: rev }) }))
|
|
70
58
|
let entries
|
package/src/glob.js
CHANGED
|
@@ -27,10 +27,8 @@ export const matchesGlob = (glob, path) => placesOf(glob, path).at(-1)
|
|
|
27
27
|
// Whether `glob` may take a path below `dir`: some of it left to take.
|
|
28
28
|
const reachesBelow = (glob, dir) => placesOf(glob, dir).slice(0, -1).some(Boolean)
|
|
29
29
|
|
|
30
|
-
// The directories the globs take that have a package.json, as yarn and npm
|
|
31
|
-
//
|
|
32
|
-
// globs reach is refused. `enter` refuses a directory, or says whether it
|
|
33
|
-
// is kept and walked into.
|
|
30
|
+
// The directories the globs take that have a package.json, as yarn and npm walk for them; a link they
|
|
31
|
+
// reach is refused, as glob follows one or not by where it is. `enter` says whether one is walked into.
|
|
34
32
|
export function walkWorkspaces(project, globs, { manager, fold = (path) => path, skip = () => false, enter = () => true }) {
|
|
35
33
|
const folded = globs.map(fold)
|
|
36
34
|
const found = []
|
package/src/lazy.js
CHANGED
|
@@ -5,10 +5,8 @@ import { settled } from './concurrent.js'
|
|
|
5
5
|
import { quote } from './error.js'
|
|
6
6
|
import { mount } from './mount.js'
|
|
7
7
|
|
|
8
|
-
// `
|
|
9
|
-
//
|
|
10
|
-
// asked for again, or while it is unpacked, is unpacked once; one refused is
|
|
11
|
-
// refused again, as nothing of it was written.
|
|
8
|
+
// `unpackOne` writes the package at a path, as `installed` lists it. One asked for again, or while it is
|
|
9
|
+
// unpacked, is unpacked once; one refused is refused again, as nothing of it was written.
|
|
12
10
|
export function unpacker(byPath, unpackOne) {
|
|
13
11
|
const unpacking = new Map()
|
|
14
12
|
return async function unpack(paths) {
|