@preventive/upstream 1.12.0 → 1.13.1
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/advisories.d.ts +125 -89
- package/cargo.d.ts +59 -35
- package/cocoapods.d.ts +44 -57
- package/electron.d.ts +35 -25
- package/git.d.ts +25 -16
- package/github/write.d.ts +60 -29
- package/github.d.ts +207 -193
- package/npm.d.ts +151 -87
- package/package.d.ts +30 -16
- package/package.json +1 -1
- package/rubygems.d.ts +22 -9
- package/semver.d.ts +40 -19
- package/soldeer.d.ts +21 -12
- package/src/advisories/actions.js +13 -38
- package/src/advisories/common.js +29 -1
- package/src/advisories/github.js +5 -19
- package/src/advisories/index.js +3 -10
- package/src/advisories/npm.js +4 -19
- package/src/advisories/osv.js +19 -41
- package/src/advisories/packagist.js +1 -4
- package/src/advisories/patched.js +6 -18
- package/src/advisories/repos.js +8 -13
- package/src/advisories/rubysec.js +2 -7
- package/src/args.js +5 -10
- package/src/attributes.js +3 -4
- package/src/cache.js +9 -22
- package/src/cargo/crate.js +4 -7
- package/src/cargo/repos.js +1 -7
- package/src/cocoapods.js +3 -19
- package/src/download.js +4 -12
- package/src/electron.js +6 -8
- package/src/github/commit.js +1 -13
- package/src/github/read.js +19 -68
- package/src/github/write.js +0 -1
- package/src/http.js +2 -7
- package/src/lockfiles.js +3 -11
- package/src/npm/cacache.js +3 -8
- package/src/npm/registry.js +12 -4
- package/src/npm/repos.js +3 -15
- package/src/npm/tarball.js +5 -20
- package/src/npm/versions.js +7 -21
- package/src/package.js +1 -7
- package/src/pool.js +0 -1
- package/src/pypi/version.js +1 -5
- package/src/remote.js +4 -6
- package/src/rubygems/gem.js +2 -2
- package/src/rubygems/version.js +2 -10
- package/src/semver.js +3 -9
- package/src/soldeer.js +0 -4
- package/src/tree.js +14 -44
- package/src/weak-edges.js +0 -2
- package/weak-edges.d.ts +36 -24
package/advisories.d.ts
CHANGED
|
@@ -1,101 +1,137 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Advisories on packages' versions, from npm's registry, OSV, Packagist, ruby-advisory-db and packages' repositories
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { advisories } from '@preventive/upstream/advisories.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* @module @preventive/upstream/advisories.js
|
|
9
|
+
*/
|
|
3
10
|
|
|
4
|
-
|
|
5
|
-
|
|
11
|
+
import type { Client, RepoName } from './github.js';
|
|
12
|
+
import type { CacheStore } from './npm.js';
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
export type
|
|
14
|
+
export { HttpError } from './npm.js';
|
|
15
|
+
export type { CacheStore } from './npm.js';
|
|
9
16
|
|
|
17
|
+
/** purl's package types, and `ruby` for Ruby interpreters */
|
|
18
|
+
export type Ecosystem =
|
|
19
|
+
| 'npm'
|
|
20
|
+
| 'cargo'
|
|
21
|
+
| 'composer'
|
|
22
|
+
| 'gem'
|
|
23
|
+
| 'ruby'
|
|
24
|
+
| 'pypi'
|
|
25
|
+
| 'swift'
|
|
26
|
+
| 'cocoapods'
|
|
27
|
+
| 'soldeer'
|
|
28
|
+
| 'github';
|
|
29
|
+
|
|
30
|
+
/** A package, and the versions of it to look up */
|
|
10
31
|
export interface Package {
|
|
11
|
-
ecosystem: Ecosystem
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
github
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
internal?: boolean
|
|
32
|
+
ecosystem: Ecosystem;
|
|
33
|
+
/**
|
|
34
|
+
* As its lockfile names it: a pod by its root (`Firebase`), a Swift package by its repository in any case
|
|
35
|
+
* (`github.com/vapor/vapor`), a `github` package by `owner/name`, a Ruby by its engine (`ruby`, `jruby`)
|
|
36
|
+
*/
|
|
37
|
+
name: string;
|
|
38
|
+
/** Its repository, where known, so it need not be looked up; not for a `github` package */
|
|
39
|
+
github?: RepoName;
|
|
40
|
+
/**
|
|
41
|
+
* As its lockfile writes them, matched by the ecosystem's own rules: a Ruby's as Bundler writes it (`3.3.6p108`);
|
|
42
|
+
* a `github` package's a tag (`v4` its whole line), a branch or a commit
|
|
43
|
+
*/
|
|
44
|
+
versions: string[];
|
|
45
|
+
/**
|
|
46
|
+
* A `github` package only: ask its repository alone, its name sent to no other source (OSV)
|
|
47
|
+
*
|
|
48
|
+
* Without it, OSV is asked only of a repository github.com serves without credentials, which is cached a month;
|
|
49
|
+
* any other answer than yes or no from github.com throws.
|
|
50
|
+
*/
|
|
51
|
+
internal?: boolean;
|
|
31
52
|
}
|
|
32
53
|
|
|
54
|
+
/** What else `advisories()` asks, and where it caches */
|
|
33
55
|
export interface AdvisoryOptions {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
cache
|
|
42
|
-
|
|
43
|
-
details
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
/**
|
|
57
|
+
* Required for `ruby`, `cocoapods`, `soldeer` and `github` packages and for `repoAdvisories`; with it, gems are
|
|
58
|
+
* also checked against ruby-advisory-db
|
|
59
|
+
*/
|
|
60
|
+
github?: Client;
|
|
61
|
+
/** Also read advisories each package's repository has published that GitHub hasn't reviewed yet; needs `github` */
|
|
62
|
+
repoAdvisories?: boolean;
|
|
63
|
+
/** Default: `setCacheDir()`'s cache. A store takes its place; `false` still reads it, but writes nothing. */
|
|
64
|
+
cache?: CacheStore | false;
|
|
65
|
+
/** Also return each advisory's full text, as `details` */
|
|
66
|
+
details?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Also ask OSV about npm packages: malware and taken-down releases, which npm's registry has no advisories of
|
|
69
|
+
*
|
|
70
|
+
* Only a package npm serves without a token is asked of OSV; any other answer counts as private.
|
|
71
|
+
*/
|
|
72
|
+
osv?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Read GitHub's own record of each GHSA OSV reports, to tell apart the advisories OSV joins as aliases (default:
|
|
75
|
+
* true)
|
|
76
|
+
*
|
|
77
|
+
* With `false`, raw.githubusercontent.com is asked nothing, no row has `related`, and GHSAs OSV joins are one row.
|
|
78
|
+
*/
|
|
79
|
+
githubAliases?: boolean;
|
|
52
80
|
}
|
|
53
81
|
|
|
54
|
-
|
|
82
|
+
/** One advisory on one package: one row per id, however many sources have it */
|
|
55
83
|
export interface Advisory {
|
|
56
|
-
ecosystem: Ecosystem
|
|
57
|
-
name: string
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
84
|
+
ecosystem: Ecosystem;
|
|
85
|
+
name: string;
|
|
86
|
+
/**
|
|
87
|
+
* npm's registry, OSV, Packagist, ruby-advisory-db or the package's repository (the only source for `cocoapods`
|
|
88
|
+
* and `soldeer`)
|
|
89
|
+
*/
|
|
90
|
+
source: 'registry' | 'osv' | 'packagist' | 'rubysec' | 'repository';
|
|
91
|
+
/**
|
|
92
|
+
* By preference RustSec's for a crate, then the GHSA, else its source's (`PYSEC-...`, `MAL-...`, `CVE-...`), or
|
|
93
|
+
* `npm:<id>`
|
|
94
|
+
*/
|
|
95
|
+
id: string;
|
|
96
|
+
ghsa?: string;
|
|
97
|
+
url?: string;
|
|
98
|
+
/** Its other ids */
|
|
99
|
+
aliases: string[];
|
|
100
|
+
/**
|
|
101
|
+
* Ids of other advisories OSV joins with this GHSA that GitHub's record tells apart, each an advisory of its own,
|
|
102
|
+
* which these versions may not be of; none with `githubAliases: false`
|
|
103
|
+
*/
|
|
104
|
+
related?: string[];
|
|
105
|
+
title?: string;
|
|
106
|
+
/** With `details`: its full text, in Markdown */
|
|
107
|
+
details?: string;
|
|
108
|
+
/** `critical`, `high`, `moderate`, `low` or `info` */
|
|
109
|
+
severity?: string;
|
|
110
|
+
cvss?: number;
|
|
111
|
+
cvssVector?: string;
|
|
112
|
+
cwe: string[];
|
|
113
|
+
/**
|
|
114
|
+
* The affected range as its source writes it, where it has one; OSV's as GitHub writes one (`>= 1.0.0, < 1.2.6`)
|
|
115
|
+
*
|
|
116
|
+
* A repository's range with no end of its own ends below each version it names as patched, a range per release
|
|
117
|
+
* line: `>=9.5.0` patched in `15.5.13, 16.1.7` is `>=9.5.0, < 15.5.13` and `>= 16.0.0-0, < 16.1.7`.
|
|
118
|
+
*/
|
|
119
|
+
range?: string;
|
|
120
|
+
/**
|
|
121
|
+
* RustSec's `unmaintained`, `unsound` or `notice`: not a vulnerability as such
|
|
122
|
+
*
|
|
123
|
+
* A yanked crate is no advisory: see `yankedVersions()` (cargo.js).
|
|
124
|
+
*/
|
|
125
|
+
informational?: string;
|
|
126
|
+
/** Malware, not a vulnerability */
|
|
127
|
+
malware?: true;
|
|
128
|
+
/** The asked versions it affects, never none */
|
|
129
|
+
versions: string[];
|
|
96
130
|
}
|
|
97
131
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
132
|
+
/**
|
|
133
|
+
* The advisories on the asked versions, sorted by ecosystem and name
|
|
134
|
+
*
|
|
135
|
+
* Input is checked before any request; a failed or malformed answer throws rather than leaving anything out.
|
|
136
|
+
*/
|
|
137
|
+
export function advisories(packages: Iterable<Package>, options?: AdvisoryOptions): Promise<Advisory[]>;
|
package/cargo.d.ts
CHANGED
|
@@ -1,41 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* crates.io: .crate files held to their checksums, yanked versions, and crates' GitHub repos
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { getCrate, resolveCrateRepos, verifyChecksum, yankedVersions } from '@preventive/upstream/cargo.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Names, versions (exact semver) and checksums are checked before any request or cache path. The cache is
|
|
9
|
+
* `setCacheDir()`'s (npm.js).
|
|
10
|
+
*
|
|
11
|
+
* @module @preventive/upstream/cargo.js
|
|
12
|
+
*/
|
|
4
13
|
|
|
5
|
-
import type { CacheOptions } from './npm.js'
|
|
14
|
+
import type { CacheOptions } from './npm.js';
|
|
6
15
|
|
|
7
|
-
export { HttpError } from './npm.js'
|
|
16
|
+
export { HttpError } from './npm.js';
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
/** A crate's GitHub repo */
|
|
19
|
+
export interface CrateRepo {
|
|
20
|
+
/** `owner/name`, as the crate's `repository` on crates.io names it */
|
|
21
|
+
github: string;
|
|
22
|
+
}
|
|
13
23
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
// `~/.cargo`. A file there that does not match is passed over. One in
|
|
23
|
-
// setCacheDir's cache that does not match throws.
|
|
24
|
-
export function getCrate(name: string, version: string, checksum?: string): Promise<Uint8Array>
|
|
24
|
+
/**
|
|
25
|
+
* Throw unless crates.io's index has `checksum` for that version
|
|
26
|
+
*
|
|
27
|
+
* The index is read on every call; nothing is cached.
|
|
28
|
+
*
|
|
29
|
+
* @param checksum - A sha256 in lowercase hex, as Cargo.lock records it
|
|
30
|
+
*/
|
|
31
|
+
export function verifyChecksum(name: string, version: string, checksum: string): Promise<void>;
|
|
25
32
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
/**
|
|
34
|
+
* A published version's .crate, held to its sha256
|
|
35
|
+
*
|
|
36
|
+
* Cargo's own cache (each registry's under $CARGO_HOME/registry/cache, else `~/.cargo`'s) is read first and never
|
|
37
|
+
* written: a file there that does not match is passed over. One in `setCacheDir()`'s cache that does not match
|
|
38
|
+
* throws.
|
|
39
|
+
*
|
|
40
|
+
* @param checksum - As Cargo.lock records it; without one, crates.io's index is read for it on every call
|
|
41
|
+
*/
|
|
42
|
+
export function getCrate(name: string, version: string, checksum?: string): Promise<Uint8Array>;
|
|
30
43
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Of each crate's asked versions, those crates.io has yanked, as `cargo audit` warns of, and those it has never
|
|
46
|
+
* published
|
|
47
|
+
*
|
|
48
|
+
* Not advisories, so not in `advisories()`. Cached 90 minutes.
|
|
49
|
+
*/
|
|
50
|
+
export function yankedVersions(
|
|
51
|
+
crates: Iterable<{ name: string; versions: string[] }>,
|
|
52
|
+
options?: CacheOptions
|
|
53
|
+
): Promise<Map<string, { yanked: string[]; unknown: string[] }>>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Each crate's GitHub repo, cached a month
|
|
57
|
+
*
|
|
58
|
+
* A crate crates.io does not have, one naming no GitHub repo, and those of a request that fails are left out.
|
|
59
|
+
* crates.io is asked a hundred names a request, a second apart, as it asks. `cachedOnly` answers from the cache
|
|
60
|
+
* alone and never fetches.
|
|
61
|
+
*/
|
|
62
|
+
export function resolveCrateRepos(
|
|
63
|
+
crateNames: Iterable<string>,
|
|
64
|
+
options?: { cachedOnly?: boolean }
|
|
65
|
+
): Promise<Map<string, CrateRepo>>;
|
package/cocoapods.d.ts
CHANGED
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* CocoaPods trunk's podspecs, and the archives podspecs name, held to their checksums
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { getPodArchive, getPodspec, isPodArchiveUrl } from '@preventive/upstream/cocoapods.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* Arguments are checked before any request or cache path. The cache is `setCacheDir()`'s (npm.js). A pod built
|
|
9
|
+
* from a commit of a GitHub repo, as a podspec's `source` or CHECKOUT OPTIONS may name, is `getRepoTarball()`'s
|
|
10
|
+
* (github.js).
|
|
11
|
+
*
|
|
12
|
+
* @module @preventive/upstream/cocoapods.js
|
|
13
|
+
*/
|
|
6
14
|
|
|
7
|
-
export { HttpError } from './npm.js'
|
|
15
|
+
export { HttpError } from './npm.js';
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// as its version, and a lockfile written before such a change has a
|
|
22
|
-
// checksum no download matches any longer, which throws.
|
|
23
|
-
//
|
|
24
|
-
// CocoaPods' own spec repos are read first, and never written: that path
|
|
25
|
-
// in each directory under $CP_REPOS_DIR, else $CP_HOME_DIR/repos, else
|
|
26
|
-
// `~/.cocoapods/repos`. A file there that does not match is passed over.
|
|
27
|
-
// One in setCacheDir's cache that does not match throws. A cached podspec
|
|
28
|
-
// that matches is answered with no request at all.
|
|
29
|
-
//
|
|
30
|
-
// What the pod is built from is not trunk's, and is not fetched here: a
|
|
31
|
-
// commit of a GitHub repo, as a podspec's `source` or CHECKOUT OPTIONS
|
|
32
|
-
// may name, is github.js's getRepoTarball's; an archive by :http is
|
|
33
|
-
// getPodArchive's.
|
|
34
|
-
export function getPodspec(name: string, version: string, checksum: string): Promise<Uint8Array>
|
|
17
|
+
/**
|
|
18
|
+
* A version's podspec from trunk's CDN, the JSON CocoaPods reads, held to `checksum`
|
|
19
|
+
*
|
|
20
|
+
* CocoaPods' own spec repos (each under $CP_REPOS_DIR, else $CP_HOME_DIR/repos, else `~/.cocoapods/repos`) are read
|
|
21
|
+
* first and never written: a file there that does not match is passed over. One in `setCacheDir()`'s cache that
|
|
22
|
+
* does not match throws. A podspec is not fixed: `pod trunk deprecate` rewrites the latest version's, after which a
|
|
23
|
+
* checksum recorded before matches no download, which throws.
|
|
24
|
+
*
|
|
25
|
+
* @param name - A root's, as Podfile.lock writes it
|
|
26
|
+
* @param checksum - Its sha1 in lowercase hex, as Podfile.lock records it in SPEC CHECKSUMS
|
|
27
|
+
*/
|
|
28
|
+
export function getPodspec(name: string, version: string, checksum: string): Promise<Uint8Array>;
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// the URL parser writes it back out, `new URL(url).toString() === url`, so
|
|
45
|
-
// that no `..`, `%2e%2e` or case takes it out from under the prefix it is
|
|
46
|
-
// written with; with no query, fragment (an empty `?` or `#` among them),
|
|
47
|
-
// credentials or port; and each segment of the path letters, digits, `_`,
|
|
48
|
-
// `.`, `~`, `@`, `-` or a %-escape in capitals.
|
|
49
|
-
export function isPodArchiveUrl(url: unknown): boolean
|
|
30
|
+
/**
|
|
31
|
+
* Whether `getPodArchive()` takes `url`: a path under `https://github.com/<owner>/<repo>/`, or a `.tar.gz` or
|
|
32
|
+
* `.zip` under `https://repo1.maven.org/maven2/com/facebook/`
|
|
33
|
+
*
|
|
34
|
+
* Spelled exactly as URL parsing writes it back, with no query, fragment, credentials or port, and each segment of
|
|
35
|
+
* the path letters, digits, `_`, `.`, `~`, `@`, `-` or %-escapes in capitals.
|
|
36
|
+
*/
|
|
37
|
+
export function isPodArchiveUrl(url: unknown): boolean;
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export function getPodArchive(url: string, sha256: string): Promise<Uint8Array>
|
|
39
|
+
/**
|
|
40
|
+
* An archive a podspec's `source` names by `:http`, held to its `:sha256`
|
|
41
|
+
*
|
|
42
|
+
* Redirects are followed, as the bytes are held to the hash whoever answers. Cached by the hash alone; a cached
|
|
43
|
+
* copy that does not match throws.
|
|
44
|
+
*
|
|
45
|
+
* @param url - One `isPodArchiveUrl()` takes
|
|
46
|
+
* @param sha256 - In lowercase hex; a `:sha1`, which two archives made to collide share, is not taken
|
|
47
|
+
*/
|
|
48
|
+
export function getPodArchive(url: string, sha256: string): Promise<Uint8Array>;
|
package/electron.d.ts
CHANGED
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Electron's release zips, held to their checksums
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { getElectronZip } from '@preventive/upstream/electron.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* @module @preventive/upstream/electron.js
|
|
9
|
+
*/
|
|
5
10
|
|
|
6
|
-
import type { CacheOptions } from './npm.js'
|
|
11
|
+
import type { CacheOptions } from './npm.js';
|
|
7
12
|
|
|
8
|
-
export { HttpError } from './npm.js'
|
|
13
|
+
export { HttpError } from './npm.js';
|
|
9
14
|
|
|
10
|
-
|
|
11
|
-
export type
|
|
15
|
+
/** A platform Electron builds for */
|
|
16
|
+
export type ElectronPlatform = 'darwin' | 'linux' | 'mas' | 'win32';
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
/** An architecture Electron builds for */
|
|
19
|
+
export type ElectronArch = 'arm64' | 'armv7l' | 'ia32' | 'x64';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* `electron-v<version>-<platform>-<arch>.zip` from the GitHub release `v<version>` of electron/electron
|
|
23
|
+
* (electron/nightlies for a nightly), held to `checksum`
|
|
24
|
+
*
|
|
25
|
+
* `@electron/get`'s cache ($electron_config_cache, else the platform's cache directory for electron) and this
|
|
26
|
+
* package's and stasis's default caches are read first and never written: a zip there that does not match is passed
|
|
27
|
+
* over. One in `setCacheDir()`'s cache, or `cache`, that does not match throws; one that matches is answered with no
|
|
28
|
+
* request at all.
|
|
29
|
+
*
|
|
30
|
+
* @param version - An Electron version: `45.5.0`, `45.0.0-alpha.16`, `36.0.0-nightly.20250101`
|
|
31
|
+
* @param checksum - Its sha256 in lowercase hex, as the `electron` package's checksums.json gives it
|
|
32
|
+
*/
|
|
33
|
+
export function getElectronZip(
|
|
34
|
+
version: string,
|
|
35
|
+
platform: ElectronPlatform,
|
|
36
|
+
arch: ElectronArch,
|
|
37
|
+
checksum: string,
|
|
38
|
+
options?: CacheOptions
|
|
39
|
+
): Promise<Uint8Array>;
|
package/git.d.ts
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The git checkout a directory is in, read without running git
|
|
3
|
+
*
|
|
4
|
+
* ```js
|
|
5
|
+
* import { findGitCheckout } from '@preventive/upstream/git.js'
|
|
6
|
+
* ```
|
|
7
|
+
*
|
|
8
|
+
* @module @preventive/upstream/git.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** A checkout in the shape `getRepo()` (package.js) answers in, and HEAD's commit; a field is absent where unread */
|
|
3
12
|
export interface GitCheckout {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// HEAD's commit sha.
|
|
13
|
-
commit?: string
|
|
13
|
+
/** `owner/name`, where the origin remote is on GitHub; never the remote's URL, which can carry a token */
|
|
14
|
+
github?: string;
|
|
15
|
+
/** Where the directory sits in its checkout, `/`-separated; `''` at the root */
|
|
16
|
+
directory?: string;
|
|
17
|
+
/** `https://github.com/<github>`, whenever there is a `github` */
|
|
18
|
+
url?: string;
|
|
19
|
+
/** HEAD's commit sha */
|
|
20
|
+
commit?: string;
|
|
14
21
|
}
|
|
15
22
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The checkout at or above `dir`, found by its closest `.git` (a directory, or a `gitdir:` file)
|
|
25
|
+
*
|
|
26
|
+
* Empty where there is none.
|
|
27
|
+
*/
|
|
28
|
+
export function findGitCheckout(dir: string): Promise<GitCheckout>;
|