@vltpkg/cli-js 1.0.0-rc.27 → 1.0.0-rc.29
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/access-6HRR4HXE.js +293 -0
- package/{bugs-CS34LDPD.js → bugs-2CAZQ32S.js} +19 -22
- package/{build-XHEFAWMN.js → build-OAWTNBMS.js} +10 -13
- package/{cache-LII2V5IM.js → cache-JTAFST6T.js} +14 -15
- package/cache-unzip-src-unzip.js +606 -575
- package/{chunk-D27QPHKI.js → chunk-2V4AQPBR.js} +67 -20
- package/{chunk-JQHMLTO5.js → chunk-3MWZTKGK.js} +419 -328
- package/{chunk-DJBBJDHI.js → chunk-7RZL7BZI.js} +159 -74
- package/chunk-7WHVJ56C.js +73 -0
- package/{chunk-LAG2R3YJ.js → chunk-BW6C3YUV.js} +6 -6
- package/{chunk-6YTJVEK2.js → chunk-CLDF5XLG.js} +11 -11
- package/{chunk-DYL7AFY7.js → chunk-CPM47YUH.js} +5 -3
- package/{chunk-QWWYZ3TT.js → chunk-D2MVJDUA.js} +1 -1
- package/{chunk-5E5GX4G6.js → chunk-FBTBHRPG.js} +1 -1
- package/{chunk-AZLX27EM.js → chunk-FXDRM4ZO.js} +296 -258
- package/chunk-G2YT2GWF.js +120 -0
- package/{chunk-INXSTZAX.js → chunk-HAGUS4HI.js} +21 -21
- package/{chunk-FI5TUER7.js → chunk-HQ4US6G3.js} +681 -687
- package/chunk-IEISSXS4.js +711 -0
- package/{chunk-TRXTSZFT.js → chunk-IYO5QKUW.js} +1 -1
- package/{chunk-DJBVQKBB.js → chunk-K3RN3BGU.js} +5 -5
- package/{chunk-P2HZ4ISK.js → chunk-LPLXAVG7.js} +54 -6
- package/{chunk-XSUIV5NF.js → chunk-M7HPHM7B.js} +14 -12
- package/{chunk-BIUCOMBH.js → chunk-MAIQR5GM.js} +5 -5
- package/{chunk-TDTJOKF2.js → chunk-NLFBANVO.js} +8 -1
- package/{chunk-XWF3GJKE.js → chunk-Q3DNNTPG.js} +27 -1
- package/{chunk-VCSVHRCS.js → chunk-R44FR7BY.js} +1269 -590
- package/{chunk-QDGZZ5FZ.js → chunk-TYV4N3S3.js} +6 -692
- package/{chunk-LKFTVDWS.js → chunk-VPKJNCKL.js} +26 -13
- package/{chunk-VTZZIXYW.js → chunk-VRIS5HAW.js} +3 -3
- package/{chunk-S5I2UOBT.js → chunk-WX2DCAG2.js} +7 -7
- package/{chunk-YR47M5L7.js → chunk-XYCCQT7N.js} +34 -39
- package/{chunk-D7U7KDEM.js → chunk-YCQTLBWF.js} +1 -1
- package/{chunk-SR66HWMM.js → chunk-ZINDEKAU.js} +144 -93
- package/{ci-EEXNEPKP.js → ci-TOJJVHI4.js} +13 -16
- package/cli-package.json +2 -1
- package/{config-4ZFJD5AY.js → config-DVAPEE5D.js} +12 -14
- package/{config-6MUU2TRJ.js → config-GOV4E2KK.js} +26 -26
- package/{create-DEKJKPYX.js → create-NGJD7K4L.js} +24 -26
- package/deprecate-WROL4AHK.js +176 -0
- package/{devtools-NOLON5YL.js → devtools-TPMVKPB5.js} +80 -77
- package/dist-tag-WZXXWXMB.js +204 -0
- package/{docs-5EKPZANX.js → docs-YCOZFMZG.js} +19 -22
- package/{exec-I4YPE6YW.js → exec-URG5OWLH.js} +24 -26
- package/{exec-cache-XEWPABLK.js → exec-cache-KHDOEH2F.js} +21 -23
- package/{exec-local-OQXG2VPW.js → exec-local-52TVUL5K.js} +19 -21
- package/{help-OG655SE5.js → help-LNSDVBGJ.js} +4 -5
- package/{init-LJH2YTBM.js → init-XNMWYATA.js} +10 -8
- package/{install-KP2FGWOR.js → install-SKUZERZJ.js} +28 -17
- package/{list-ACZ3ZSIZ.js → list-XEDVFUD5.js} +19 -21
- package/{login-VFTRKZE2.js → login-52SA2DSI.js} +6 -9
- package/{logout-Z4AVG64D.js → logout-5YYHNV5W.js} +6 -9
- package/{pack-GPJNX7RP.js → pack-B7QZHMYP.js} +14 -17
- package/package.json +1 -1
- package/{ping-B2YS4SR3.js → ping-PRGDYDRI.js} +6 -9
- package/{pkg-WUYJDFSH.js → pkg-UEIQIVVD.js} +15 -19
- package/profile-46FKVQEL.js +129 -0
- package/{publish-WTMGC4ET.js → publish-HBYHOSKH.js} +17 -20
- package/{query-UCM35VVC.js → query-5A4YLS2C.js} +19 -21
- package/registry-client-package.json +1 -1
- package/registry-client-src-revalidate.js +1157 -1032
- package/{repo-MZCPTQZU.js → repo-I6X66PHD.js} +19 -22
- package/{reporter-XRZ37LFK.js → reporter-NUXJTV4G.js} +2 -3
- package/{run-CAX4Z2SC.js → run-VEZMUMVH.js} +19 -21
- package/{run-exec-SM42FE7W.js → run-exec-6ADY4BKH.js} +19 -21
- package/security-archive-src-update-expired.js +8 -7
- package/{src-SDJWTPCU.js → src-O32QL33R.js} +20 -22
- package/token-YK6L74PA.js +206 -0
- package/{uninstall-YYPPXM2O.js → uninstall-UBUZBV7E.js} +14 -17
- package/unpublish-ZHJEKT7A.js +224 -0
- package/{update-YFUTH33A.js → update-WO4BHJF4.js} +13 -16
- package/{version-SK256WED.js → version-RLESYHML.js} +13 -16
- package/{view-CBYGJ76J.js → view-UA5HXFXG.js} +16 -17
- package/vlr.js +1 -1
- package/vlrx.js +1 -1
- package/vlt.js +1 -1
- package/vlx.js +1 -1
- package/vlxl.js +1 -1
- package/{whoami-ZT4ZEN2C.js → whoami-7H3FPR2O.js} +6 -9
- package/chunk-52LBC3AX.js +0 -75
- package/chunk-BGQCUUCA.js +0 -667
- package/chunk-E74WGW5C.js +0 -49
- package/chunk-JLJKOF75.js +0 -40
- package/chunk-YP4YNE5Y.js +0 -68
- package/token-YCURCCNR.js +0 -103
|
@@ -10,689 +10,15 @@ globalThis.clearInterval = _vlt_clearInterval;
|
|
|
10
10
|
import {createRequire as _vlt_createRequire} from "node:module";
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
Spec,
|
|
14
|
+
Spec2,
|
|
15
|
+
currentDefaultRegistryName,
|
|
16
|
+
defaultRegistryName
|
|
17
|
+
} from "./chunk-IEISSXS4.js";
|
|
15
18
|
import {
|
|
16
|
-
error
|
|
17
|
-
typeError
|
|
19
|
+
error
|
|
18
20
|
} from "./chunk-WZWDS3W4.js";
|
|
19
21
|
|
|
20
|
-
// ../../src/spec/src/browser.ts
|
|
21
|
-
var kCustomInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
22
|
-
var defaultRegistry = "https://registry.npmjs.org/";
|
|
23
|
-
var defaultRegistryName = "npm";
|
|
24
|
-
var defaultRegistries = {
|
|
25
|
-
npm: defaultRegistry,
|
|
26
|
-
gh: "https://npm.pkg.github.com/"
|
|
27
|
-
};
|
|
28
|
-
var defaultJsrRegistries = { jsr: "https://npm.jsr.io/" };
|
|
29
|
-
var defaultGitHosts = {
|
|
30
|
-
github: "git+ssh://git@github.com:$1/$2.git",
|
|
31
|
-
bitbucket: "git+ssh://git@bitbucket.org:$1/$2.git",
|
|
32
|
-
gitlab: "git+ssh://git@gitlab.com:$1/$2.git",
|
|
33
|
-
gist: "git+ssh://git@gist.github.com/$1.git"
|
|
34
|
-
};
|
|
35
|
-
var defaultGitHostArchives = {
|
|
36
|
-
github: "https://api.github.com/repos/$1/$2/tarball/$committish",
|
|
37
|
-
bitbucket: "https://bitbucket.org/$1/$2/get/$committish.tar.gz",
|
|
38
|
-
gist: "https://codeload.github.com/gist/$1/tar.gz/$committish",
|
|
39
|
-
gitlab: "https://gitlab.com/$1/$2/repository/archive.tar.gz?ref=$committish"
|
|
40
|
-
};
|
|
41
|
-
var gitHostWebsites = {
|
|
42
|
-
github: "https://github.com/",
|
|
43
|
-
bitbucket: "https://bitbucket.org/",
|
|
44
|
-
gist: "https://gist.github.com/",
|
|
45
|
-
gitlab: "https://gitlab.com/"
|
|
46
|
-
};
|
|
47
|
-
var defaultScopeRegistries = {
|
|
48
|
-
"@jsr": "https://npm.jsr.io/"
|
|
49
|
-
};
|
|
50
|
-
var getOptions = (options) => ({
|
|
51
|
-
catalog: {},
|
|
52
|
-
catalogs: {},
|
|
53
|
-
...options,
|
|
54
|
-
"jsr-registries": {
|
|
55
|
-
...options?.["jsr-registries"] ?? {},
|
|
56
|
-
...defaultJsrRegistries
|
|
57
|
-
},
|
|
58
|
-
registry: options?.registry ?? defaultRegistry,
|
|
59
|
-
"scope-registries": options?.["scope-registries"] ?? {},
|
|
60
|
-
"git-hosts": options?.["git-hosts"] ? {
|
|
61
|
-
...defaultGitHosts,
|
|
62
|
-
...options["git-hosts"]
|
|
63
|
-
} : defaultGitHosts,
|
|
64
|
-
registries: {
|
|
65
|
-
...options?.registries ?? {},
|
|
66
|
-
...defaultRegistries
|
|
67
|
-
},
|
|
68
|
-
"git-host-archives": options?.["git-host-archives"] ? {
|
|
69
|
-
...defaultGitHostArchives,
|
|
70
|
-
...options["git-host-archives"]
|
|
71
|
-
} : defaultGitHostArchives
|
|
72
|
-
});
|
|
73
|
-
var startsWithSpecIdentifier = (spec, options) => spec.startsWith("/") || spec.startsWith("./") || spec.startsWith("../") || spec.startsWith("file:") || spec.startsWith("http:") || spec.startsWith("https:") || spec.startsWith("workspace:") || spec.startsWith("catalog:") || spec.startsWith("git@") || spec.startsWith("git://") || spec.startsWith("git+ssh://") || spec.startsWith("git+http://") || spec.startsWith("git+https://") || spec.startsWith("git+file://") || spec.startsWith("git@github.com") || spec.startsWith("registry:") || spec.startsWith("npm:") || spec.startsWith("jsr:") || spec.startsWith("gh:") || // anything that starts with a known git host key, or a
|
|
74
|
-
// custom registered registry protocol e.g: `github:`, `custom:`
|
|
75
|
-
[
|
|
76
|
-
...Object.keys(options["git-hosts"]),
|
|
77
|
-
...Object.keys(options.registries),
|
|
78
|
-
...Object.keys(options["jsr-registries"])
|
|
79
|
-
].some((key) => spec.startsWith(`${key}:`));
|
|
80
|
-
var findFirstAt = (spec, hasScope) => spec.indexOf("@", hasScope ? 1 : 0);
|
|
81
|
-
var findGitIdentifier = (spec) => spec.indexOf("#") > 2;
|
|
82
|
-
var findFileIdentifier = (spec) => spec.includes("/");
|
|
83
|
-
var isSpec = (spec) => typeof spec === "object" && spec !== null && "spec" in spec && "bareSpec" in spec && "name" in spec && "type" in spec && "options" in spec && typeof spec.spec === "string" && typeof spec.bareSpec === "string" && typeof spec.name === "string";
|
|
84
|
-
var currentDefaultRegistryName = (registry, options) => {
|
|
85
|
-
for (const [name, url] of Object.entries(
|
|
86
|
-
options.registries ?? {}
|
|
87
|
-
)) {
|
|
88
|
-
const specRegURL = registry.endsWith("/") ? registry : registry + "/";
|
|
89
|
-
const knownRegURL = url.endsWith("/") ? url : url + "/";
|
|
90
|
-
if (specRegURL === knownRegURL) {
|
|
91
|
-
return name;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var Spec = class _Spec {
|
|
96
|
-
static parse(spec, bareOrOptions, options) {
|
|
97
|
-
return typeof spec === "object" ? spec : new this(spec, bareOrOptions, options);
|
|
98
|
-
}
|
|
99
|
-
static parseArgs(specOrBareSpec, opts) {
|
|
100
|
-
const options = getOptions(opts ?? {});
|
|
101
|
-
if (startsWithSpecIdentifier(specOrBareSpec, options)) {
|
|
102
|
-
const parsed = this.parse("(unknown)", specOrBareSpec, options);
|
|
103
|
-
if (parsed.subspec) {
|
|
104
|
-
const { namedJsrRegistry: jsrHost } = parsed;
|
|
105
|
-
if (!jsrHost) {
|
|
106
|
-
parsed.name = parsed.subspec.name;
|
|
107
|
-
}
|
|
108
|
-
parsed.spec = `${parsed.name}@${parsed.bareSpec}`;
|
|
109
|
-
}
|
|
110
|
-
return parsed;
|
|
111
|
-
} else {
|
|
112
|
-
const hasScope = specOrBareSpec.startsWith("@");
|
|
113
|
-
const at = findFirstAt(specOrBareSpec, hasScope);
|
|
114
|
-
if (at > -1) {
|
|
115
|
-
return this.parse(
|
|
116
|
-
specOrBareSpec.substring(0, at),
|
|
117
|
-
specOrBareSpec.substring(at + 1),
|
|
118
|
-
options
|
|
119
|
-
);
|
|
120
|
-
} else if (findGitIdentifier(specOrBareSpec) || !hasScope && findFileIdentifier(specOrBareSpec)) {
|
|
121
|
-
return this.parse("(unknown)", specOrBareSpec, options);
|
|
122
|
-
} else {
|
|
123
|
-
return this.parse(`${specOrBareSpec}@`, options);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
static nodejsDependencies;
|
|
128
|
-
type;
|
|
129
|
-
spec;
|
|
130
|
-
options;
|
|
131
|
-
name;
|
|
132
|
-
scope;
|
|
133
|
-
scopeRegistry;
|
|
134
|
-
bareSpec;
|
|
135
|
-
gitRemote;
|
|
136
|
-
gitSelector;
|
|
137
|
-
gitSelectorParsed;
|
|
138
|
-
gitCommittish;
|
|
139
|
-
namedGitHost;
|
|
140
|
-
namedGitHostPath;
|
|
141
|
-
workspaceSpec;
|
|
142
|
-
workspace;
|
|
143
|
-
namedRegistry;
|
|
144
|
-
namedJsrRegistry;
|
|
145
|
-
registry;
|
|
146
|
-
registrySpec;
|
|
147
|
-
conventionalRegistryTarball;
|
|
148
|
-
semver;
|
|
149
|
-
range;
|
|
150
|
-
distTag;
|
|
151
|
-
remoteURL;
|
|
152
|
-
file;
|
|
153
|
-
catalog;
|
|
154
|
-
subspec;
|
|
155
|
-
overridden = false;
|
|
156
|
-
#final;
|
|
157
|
-
#toString;
|
|
158
|
-
/**
|
|
159
|
-
* Return the final entry in the chain of subspecs
|
|
160
|
-
* When deciding which thing to actually fetch, spec.final is the thing
|
|
161
|
-
* to look at.
|
|
162
|
-
*/
|
|
163
|
-
get final() {
|
|
164
|
-
if (this.#final) return this.#final;
|
|
165
|
-
const final = this.subspec ? this.subspec.final : this;
|
|
166
|
-
if (final.type === "catalog") {
|
|
167
|
-
throw error('invalid Spec.final value, type is "catalog"');
|
|
168
|
-
}
|
|
169
|
-
return this.#final = final;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Normally, the string value of a Spec is just the string passed in to
|
|
173
|
-
* be parsed. However, in the case of a chain of subspecs, like
|
|
174
|
-
* `foo@npm:bar@npm:baz@npm:quux@latest`, this simplifies out the middle
|
|
175
|
-
* parts of the chain, returning just `foo@npm:quux@latest`
|
|
176
|
-
*/
|
|
177
|
-
toString() {
|
|
178
|
-
if (this.#toString !== void 0) return this.#toString;
|
|
179
|
-
let sub = this;
|
|
180
|
-
while (sub.subspec?.subspec) sub = sub.subspec;
|
|
181
|
-
if (sub.subspec && sub.subspec.type !== "registry")
|
|
182
|
-
sub = sub.subspec;
|
|
183
|
-
return this.#toString = this.name + "@" + sub.bareSpec;
|
|
184
|
-
}
|
|
185
|
-
constructor(spec, bareOrOptions, options = {}) {
|
|
186
|
-
if (bareOrOptions && typeof bareOrOptions === "object") {
|
|
187
|
-
options = bareOrOptions;
|
|
188
|
-
bareOrOptions = void 0;
|
|
189
|
-
}
|
|
190
|
-
this.options = getOptions(options);
|
|
191
|
-
if (typeof bareOrOptions === "string") {
|
|
192
|
-
this.name = spec;
|
|
193
|
-
this.#parseScope(spec);
|
|
194
|
-
this.bareSpec = bareOrOptions;
|
|
195
|
-
this.spec = `${this.name}@${bareOrOptions}`;
|
|
196
|
-
} else {
|
|
197
|
-
this.spec = spec;
|
|
198
|
-
if (!spec.startsWith("git@") && startsWithSpecIdentifier(spec, this.options) && spec.includes(":") && [
|
|
199
|
-
...Object.keys(this.options.registries),
|
|
200
|
-
...Object.keys(defaultRegistries)
|
|
201
|
-
].some((key) => spec.startsWith(`${key}:`))) {
|
|
202
|
-
this.name = spec;
|
|
203
|
-
this.bareSpec = spec;
|
|
204
|
-
} else {
|
|
205
|
-
const hasScope = spec.startsWith("@");
|
|
206
|
-
let at = findFirstAt(spec, hasScope);
|
|
207
|
-
if (at === -1) {
|
|
208
|
-
at = spec.length;
|
|
209
|
-
spec += "@";
|
|
210
|
-
}
|
|
211
|
-
this.name = spec.substring(0, at);
|
|
212
|
-
if (hasScope) this.#parseScope(this.name);
|
|
213
|
-
this.bareSpec = spec.substring(at + 1);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (this.bareSpec.startsWith("catalog:")) {
|
|
217
|
-
this.catalog = this.bareSpec.substring("catalog:".length);
|
|
218
|
-
const catalog = this.catalog ? this.options.catalogs?.[this.catalog] : this.options.catalog;
|
|
219
|
-
if (!catalog) {
|
|
220
|
-
throw this.#error("Named catalog not found", {
|
|
221
|
-
name: this.catalog,
|
|
222
|
-
validOptions: this.options.catalogs && Object.keys(this.options.catalogs)
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
const sub = catalog[this.name];
|
|
226
|
-
if (!sub) {
|
|
227
|
-
throw this.#error("Name not found in catalog", {
|
|
228
|
-
name: this.name,
|
|
229
|
-
validOptions: Object.keys(catalog)
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
this.subspec = _Spec.parse(this.name, sub);
|
|
233
|
-
this.type = "catalog";
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
if (this.bareSpec.startsWith("https://")) {
|
|
237
|
-
for (const [name, origin] of Object.entries(gitHostWebsites)) {
|
|
238
|
-
if (this.bareSpec.startsWith(origin)) {
|
|
239
|
-
const parsed = new URL(this.bareSpec);
|
|
240
|
-
const [user, project] = parsed.pathname.replace(/\.git$/, "").replace(/\/+/g, " ").trim().split(" ");
|
|
241
|
-
if (user && project) {
|
|
242
|
-
this.bareSpec = `${name}:${user}/${project}${parsed.hash}`;
|
|
243
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (this.bareSpec.startsWith("workspace:")) {
|
|
250
|
-
this.type = "workspace";
|
|
251
|
-
const ws = this.bareSpec.substring("workspace:".length).trim();
|
|
252
|
-
const w = ws.lastIndexOf("@");
|
|
253
|
-
if (w === -1) {
|
|
254
|
-
this.workspace = this.name;
|
|
255
|
-
} else {
|
|
256
|
-
const wsName = ws.substring(0, w);
|
|
257
|
-
if (!wsName || wsName === "*" || wsName === "~" || wsName === "^" || (wsName.startsWith("@") ? wsName.split("/").length !== 2 || wsName.substring(1).includes("@") : wsName.includes("@"))) {
|
|
258
|
-
throw this.#error(
|
|
259
|
-
"workspace: name must be a path or valid package name",
|
|
260
|
-
{ found: wsName }
|
|
261
|
-
);
|
|
262
|
-
}
|
|
263
|
-
this.workspace = wsName;
|
|
264
|
-
}
|
|
265
|
-
const wss = w === -1 ? ws : ws.substring(w + 1) || "*";
|
|
266
|
-
const range2 = wss === "*" ? void 0 : parseRange(wss);
|
|
267
|
-
if (wss !== "*" && wss !== "~" && wss !== "^" && !range2) {
|
|
268
|
-
throw this.#error(
|
|
269
|
-
"workspace: spec must be one of *, ~, or ^, or a valid semver range",
|
|
270
|
-
{
|
|
271
|
-
found: wss,
|
|
272
|
-
wanted: `'*'|'~'|'^'|SemverRange`
|
|
273
|
-
}
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
this.workspaceSpec = wss;
|
|
277
|
-
if (range2) {
|
|
278
|
-
this.semver = wss;
|
|
279
|
-
this.range = range2;
|
|
280
|
-
}
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
if (this.bareSpec.startsWith("git://") || this.bareSpec.startsWith("git+ssh://") || this.bareSpec.startsWith("git+http://") || this.bareSpec.startsWith("git+https://") || this.bareSpec.startsWith("git+file://") || // legacy affordance
|
|
284
|
-
this.bareSpec.startsWith("git@github.com")) {
|
|
285
|
-
if (this.bareSpec.startsWith("git@")) {
|
|
286
|
-
this.bareSpec = `git+ssh://${this.bareSpec}`;
|
|
287
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
288
|
-
}
|
|
289
|
-
this.type = "git";
|
|
290
|
-
for (const [name, host] of Object.entries(
|
|
291
|
-
this.options["git-hosts"]
|
|
292
|
-
)) {
|
|
293
|
-
const s = host.indexOf("$");
|
|
294
|
-
if (s > 0 && this.bareSpec.startsWith(host.substring(0, s))) {
|
|
295
|
-
const p = this.bareSpec.substring(s).replace(/\.git(#.*)?$/, "$1");
|
|
296
|
-
this.bareSpec = `${name}:${p}`;
|
|
297
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
298
|
-
this.#parseHostedGit(name, host);
|
|
299
|
-
this.type = "git";
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
this.#parseGitSelector(this.bareSpec);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
const regs = Object.entries(this.options.registries);
|
|
307
|
-
if (this.bareSpec.startsWith("registry:")) {
|
|
308
|
-
const reg = this.bareSpec.substring("registry:".length);
|
|
309
|
-
const h = reg.indexOf("#");
|
|
310
|
-
if (h === -1) {
|
|
311
|
-
throw this.#error("registry: must include name/version");
|
|
312
|
-
}
|
|
313
|
-
this.type = "registry";
|
|
314
|
-
let url = reg.substring(0, h);
|
|
315
|
-
if (!url.endsWith("/")) url += "/";
|
|
316
|
-
const regSpec = reg.substring(h + 1);
|
|
317
|
-
for (let [name, u] of regs) {
|
|
318
|
-
if (!u.endsWith("/")) {
|
|
319
|
-
u += "/";
|
|
320
|
-
this.options.registries[name] = u;
|
|
321
|
-
}
|
|
322
|
-
if (u === url) this.namedRegistry = name;
|
|
323
|
-
}
|
|
324
|
-
this.#parseRegistrySpec(regSpec, url);
|
|
325
|
-
this.#guessRegistryTarball();
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
for (const [host, url] of regs) {
|
|
329
|
-
const h = `${host}:`;
|
|
330
|
-
if (this.bareSpec.startsWith(h)) {
|
|
331
|
-
this.type = "registry";
|
|
332
|
-
this.namedRegistry = host;
|
|
333
|
-
this.#parseRegistrySpec(
|
|
334
|
-
this.bareSpec.substring(h.length),
|
|
335
|
-
url
|
|
336
|
-
).namedRegistry ??= host;
|
|
337
|
-
if (this.subspec && this.name === this.bareSpec) {
|
|
338
|
-
this.name = this.subspec.name;
|
|
339
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
340
|
-
}
|
|
341
|
-
this.#guessRegistryTarball();
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
const ghosts = Object.entries(this.options["git-hosts"]);
|
|
346
|
-
for (const [name, template] of ghosts) {
|
|
347
|
-
if (this.#parseHostedGit(name, template)) {
|
|
348
|
-
this.type = "git";
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
const jsrs = Object.entries(this.options["jsr-registries"]);
|
|
353
|
-
for (const [host, url] of jsrs) {
|
|
354
|
-
const h = `${host}:`;
|
|
355
|
-
if (this.bareSpec.startsWith(h)) {
|
|
356
|
-
this.type = "registry";
|
|
357
|
-
this.namedJsrRegistry = host;
|
|
358
|
-
this.#parseJsrRegistrySpec(
|
|
359
|
-
this.bareSpec.substring(h.length),
|
|
360
|
-
url
|
|
361
|
-
).namedJsrRegistry ??= host;
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
if (this.bareSpec.startsWith("https://") || this.bareSpec.startsWith("http://")) {
|
|
366
|
-
this.remoteURL = this.bareSpec;
|
|
367
|
-
this.type = "remote";
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
if (this.bareSpec.startsWith("file:")) {
|
|
371
|
-
this.type = "file";
|
|
372
|
-
const [path, uri] = getNormalizeFile(
|
|
373
|
-
this.constructor.nodejsDependencies
|
|
374
|
-
)(this.bareSpec, this);
|
|
375
|
-
this.file = path;
|
|
376
|
-
this.bareSpec = uri.replace(/\/+$/, "");
|
|
377
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (!this.bareSpec.startsWith("./") && !this.bareSpec.startsWith("../") && this.options["git-hosts"].github) {
|
|
381
|
-
const hash = this.bareSpec.indexOf("#");
|
|
382
|
-
const up = hash === -1 ? this.bareSpec : this.bareSpec.substring(0, hash);
|
|
383
|
-
if (up.split("/").length === 2) {
|
|
384
|
-
this.bareSpec = `github:${this.bareSpec}`;
|
|
385
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
386
|
-
this.#parseHostedGit(
|
|
387
|
-
"github",
|
|
388
|
-
this.options["git-hosts"].github
|
|
389
|
-
);
|
|
390
|
-
this.type = "git";
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (this.bareSpec.includes("/") || this.bareSpec === "." || this.bareSpec === "..") {
|
|
395
|
-
this.type = "file";
|
|
396
|
-
const [file, uri] = getNormalizeFile(
|
|
397
|
-
this.constructor.nodejsDependencies
|
|
398
|
-
)(`file:${this.bareSpec}`, this);
|
|
399
|
-
this.bareSpec = uri;
|
|
400
|
-
this.spec = `${this.name}@${this.bareSpec}`;
|
|
401
|
-
this.file = file;
|
|
402
|
-
return;
|
|
403
|
-
}
|
|
404
|
-
this.type = "registry";
|
|
405
|
-
const range = parseRange(this.bareSpec);
|
|
406
|
-
if (range) {
|
|
407
|
-
this.semver = this.bareSpec.trim();
|
|
408
|
-
this.range = range;
|
|
409
|
-
} else {
|
|
410
|
-
this.distTag = this.bareSpec;
|
|
411
|
-
}
|
|
412
|
-
this.registrySpec = this.bareSpec;
|
|
413
|
-
const { "scope-registries": scopeRegs, registry } = this.options;
|
|
414
|
-
const scopeReg = this.scope && scopeRegs[this.scope];
|
|
415
|
-
this.registry = scopeReg ?? registry;
|
|
416
|
-
for (const r of Object.values(this.options["jsr-registries"])) {
|
|
417
|
-
if (this.registry === r) return;
|
|
418
|
-
}
|
|
419
|
-
this.#guessRegistryTarball();
|
|
420
|
-
}
|
|
421
|
-
#parseScope(name) {
|
|
422
|
-
if (!name.startsWith("@")) return;
|
|
423
|
-
const s = name.indexOf("/");
|
|
424
|
-
if (s > 1 && s < name.length - 1) {
|
|
425
|
-
const scope = name.substring(0, s);
|
|
426
|
-
this.registry = this.scopeRegistry = this.options["scope-registries"][scope];
|
|
427
|
-
this.scope = scope;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
#parseHostedGit(name, template) {
|
|
431
|
-
if (this.bareSpec.startsWith(`${name}:`)) {
|
|
432
|
-
const h = this.bareSpec.indexOf("#");
|
|
433
|
-
const bare = h === -1 ? this.bareSpec : this.bareSpec.substring(0, h);
|
|
434
|
-
const hash = h === -1 ? "" : this.bareSpec.substring(h);
|
|
435
|
-
const hostPath = bare.substring(name.length + 1);
|
|
436
|
-
if (!hostPath) {
|
|
437
|
-
throw this.#error("invalid named git host specifier");
|
|
438
|
-
}
|
|
439
|
-
const split = hostPath.split("/");
|
|
440
|
-
let t = template;
|
|
441
|
-
for (let i = 0; i < split.length; i++) {
|
|
442
|
-
t = t.split(`$${i + 1}`).join(split[i]);
|
|
443
|
-
}
|
|
444
|
-
t += hash;
|
|
445
|
-
this.namedGitHost = name;
|
|
446
|
-
this.namedGitHostPath = hostPath;
|
|
447
|
-
this.#parseGitSelector(t);
|
|
448
|
-
if (this.gitCommittish && !this.gitSelectorParsed?.path) {
|
|
449
|
-
const archiveHost = this.options["git-host-archives"][name];
|
|
450
|
-
if (name === "github" && this.gitCommittish.startsWith("pull/") && this.gitCommittish.match(/\//g)?.length === 1) {
|
|
451
|
-
this.gitCommittish += "/head";
|
|
452
|
-
}
|
|
453
|
-
if (archiveHost) {
|
|
454
|
-
this.type = "remote";
|
|
455
|
-
let t2 = archiveHost;
|
|
456
|
-
t2 = t2.split("$committish").join(this.gitCommittish);
|
|
457
|
-
for (let i = 0; i < split.length; i++) {
|
|
458
|
-
t2 = t2.split(`$${i + 1}`).join(split[i]);
|
|
459
|
-
}
|
|
460
|
-
this.remoteURL = t2;
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return true;
|
|
464
|
-
}
|
|
465
|
-
return false;
|
|
466
|
-
}
|
|
467
|
-
/* c8 ignore start */
|
|
468
|
-
[kCustomInspect]() {
|
|
469
|
-
return `@vltpkg/spec.Spec ${String(this)}`;
|
|
470
|
-
}
|
|
471
|
-
/* c8 ignore stop */
|
|
472
|
-
#guessRegistryTarball() {
|
|
473
|
-
const { name, registry, range } = this.final;
|
|
474
|
-
if (!registry || !range?.isSingle) return;
|
|
475
|
-
const stripScope = /^@[^/]+\//;
|
|
476
|
-
this.conventionalRegistryTarball = String(
|
|
477
|
-
new URL(
|
|
478
|
-
`/${name}/-/${name.replace(stripScope, "")}-${range}.tgz`,
|
|
479
|
-
registry
|
|
480
|
-
)
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
#parseRegistrySpec(s, url) {
|
|
484
|
-
this.registry = url;
|
|
485
|
-
this.subspec = this.constructor.parse(s, {
|
|
486
|
-
...this.options,
|
|
487
|
-
registry: url
|
|
488
|
-
});
|
|
489
|
-
return this.subspec;
|
|
490
|
-
}
|
|
491
|
-
#parseJsrRegistrySpec(s, url) {
|
|
492
|
-
this.registry = url;
|
|
493
|
-
if (!s.startsWith("@")) s = `${this.name}@${s}`;
|
|
494
|
-
const name = s.startsWith("@jsr/") ? s : `@jsr/${s.replace(/^@/, "").replace(/\//, "__")}`;
|
|
495
|
-
this.subspec = this.constructor.parse(name, {
|
|
496
|
-
...this.options,
|
|
497
|
-
"scope-registries": {
|
|
498
|
-
...this.options["scope-registries"],
|
|
499
|
-
"@jsr": url
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
if (this.name === "(unknown)") {
|
|
503
|
-
const nextAt = s.indexOf("@", 1);
|
|
504
|
-
if (nextAt === -1) {
|
|
505
|
-
this.name = s;
|
|
506
|
-
} else {
|
|
507
|
-
this.name = s.substring(0, s.indexOf("@", 1));
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
const reg = `${this.namedJsrRegistry}:`;
|
|
511
|
-
const n = `${reg}${this.name}`;
|
|
512
|
-
if (this.bareSpec.startsWith(n + "@")) {
|
|
513
|
-
this.bareSpec = reg + this.bareSpec.substring(n.length + 1);
|
|
514
|
-
} else if (this.bareSpec === n) {
|
|
515
|
-
this.bareSpec = reg;
|
|
516
|
-
}
|
|
517
|
-
this.spec = this.name + "@" + this.bareSpec;
|
|
518
|
-
return this.subspec;
|
|
519
|
-
}
|
|
520
|
-
#error(message, extra = {}) {
|
|
521
|
-
return error(message, { spec: this.spec, ...extra }, this.#error);
|
|
522
|
-
}
|
|
523
|
-
#parseGitSelector(s) {
|
|
524
|
-
const h = s.indexOf("#");
|
|
525
|
-
if (h === -1) {
|
|
526
|
-
this.gitRemote = s;
|
|
527
|
-
return;
|
|
528
|
-
}
|
|
529
|
-
this.gitRemote = s.substring(0, h);
|
|
530
|
-
this.gitSelector = s.substring(h + 1);
|
|
531
|
-
const [selectorParsed, committish, range] = this.constructor.parseGitSelector(this.gitSelector, this);
|
|
532
|
-
this.range = range;
|
|
533
|
-
this.gitCommittish = committish;
|
|
534
|
-
this.gitSelectorParsed = selectorParsed;
|
|
535
|
-
}
|
|
536
|
-
/**
|
|
537
|
-
* Should only ever be called with the bit that comes AFTER the #
|
|
538
|
-
* in the git remote url.
|
|
539
|
-
*/
|
|
540
|
-
static parseGitSelector(selector, spec) {
|
|
541
|
-
if (!selector) return [{}];
|
|
542
|
-
const split = selector.split("::");
|
|
543
|
-
const first = split[0];
|
|
544
|
-
let committish = void 0;
|
|
545
|
-
let range = void 0;
|
|
546
|
-
const parsed = {};
|
|
547
|
-
if (typeof first !== "string") {
|
|
548
|
-
throw typeError("impossible", {
|
|
549
|
-
found: first,
|
|
550
|
-
wanted: String
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
if (!first.includes(":")) {
|
|
554
|
-
committish = first;
|
|
555
|
-
split.shift();
|
|
556
|
-
}
|
|
557
|
-
for (const kv of split) {
|
|
558
|
-
const c = kv.indexOf(":");
|
|
559
|
-
if (c === -1) continue;
|
|
560
|
-
const k = kv.substring(0, c);
|
|
561
|
-
const v = kv.substring(c + 1);
|
|
562
|
-
if (k === "semver") {
|
|
563
|
-
if (committish) {
|
|
564
|
-
throw error(
|
|
565
|
-
"Cannot specify a semver range and committish value",
|
|
566
|
-
{ spec }
|
|
567
|
-
);
|
|
568
|
-
}
|
|
569
|
-
range = parseRange(v);
|
|
570
|
-
if (!range) {
|
|
571
|
-
throw error(`Invalid git tag semver range: ${v}`, { spec });
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
if (k === "semver" || k === "path") {
|
|
575
|
-
if (k === "path") {
|
|
576
|
-
if (
|
|
577
|
-
/* c8 ignore next */
|
|
578
|
-
this.nodejsDependencies?.isAbsolute(
|
|
579
|
-
v
|
|
580
|
-
) || /(^|\/|\\)\.\.($|\\|\/)/.test(v)
|
|
581
|
-
) {
|
|
582
|
-
throw error("Invalid path in git selector", { spec });
|
|
583
|
-
}
|
|
584
|
-
parsed.path = (this.nodejsDependencies ? this.nodejsDependencies.join("/", v).substring(1) : v).replace(/\\/g, "/");
|
|
585
|
-
} else {
|
|
586
|
-
parsed[k] = v;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
return [parsed, committish, range];
|
|
591
|
-
}
|
|
592
|
-
};
|
|
593
|
-
var getNormalizeFile = (opts) => (bareSpec, spec) => {
|
|
594
|
-
const slashes = bareSpec.substring(
|
|
595
|
-
"file:".length,
|
|
596
|
-
"file://".length
|
|
597
|
-
);
|
|
598
|
-
const pref = `file:${slashes === "//" ? slashes : ""}`;
|
|
599
|
-
const rest = bareSpec.substring(pref.length);
|
|
600
|
-
const [a = "", b = "/", c = "/", d = "/"] = rest.split("", 4);
|
|
601
|
-
if (!a) {
|
|
602
|
-
return [".", "file:."];
|
|
603
|
-
}
|
|
604
|
-
if (a === "/" && b === "~" && c !== "/" || a === "~" && b !== "/") {
|
|
605
|
-
throw error(
|
|
606
|
-
`invalid file: specifier. '~username' not supported`,
|
|
607
|
-
{ spec }
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
if (a === "~") {
|
|
611
|
-
return (
|
|
612
|
-
/* c8 ignore start */
|
|
613
|
-
opts ? [
|
|
614
|
-
opts.resolve(opts.homedir(), rest.substring(2)),
|
|
615
|
-
`file:${rest}`
|
|
616
|
-
] : [rest, `file:${rest}`]
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
if (a === "/" && b === "~") {
|
|
620
|
-
return opts ? [
|
|
621
|
-
opts.resolve(opts.homedir(), rest.substring(3)),
|
|
622
|
-
`file:${rest.substring(1)}`
|
|
623
|
-
] : (
|
|
624
|
-
/* c8 ignore stop */
|
|
625
|
-
[rest.substring(1), `file:${rest.substring(1)}`]
|
|
626
|
-
);
|
|
627
|
-
}
|
|
628
|
-
if (a === "/" && b === "." && (c === "/" || c === "." && d === "/")) {
|
|
629
|
-
return [rest.substring(1), `file:${rest.substring(1)}`];
|
|
630
|
-
}
|
|
631
|
-
if (a === "." && (b === "/" || b === "." && c === "/")) {
|
|
632
|
-
return [rest, `file:${rest}`];
|
|
633
|
-
}
|
|
634
|
-
if (slashes === "//") {
|
|
635
|
-
try {
|
|
636
|
-
const parsed = new URL(bareSpec);
|
|
637
|
-
if (parsed.host) {
|
|
638
|
-
if (parsed.host !== "localhost") {
|
|
639
|
-
throw error(
|
|
640
|
-
`invalid file:// specifier. host must be empty or 'localhost'`,
|
|
641
|
-
{
|
|
642
|
-
spec,
|
|
643
|
-
found: parsed.host,
|
|
644
|
-
validOptions: ["", "localhost"]
|
|
645
|
-
}
|
|
646
|
-
);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return [
|
|
650
|
-
parsed.pathname.replace(/^\/([a-zA-Z]:\/)/, "$1"),
|
|
651
|
-
`file://${parsed.pathname}`
|
|
652
|
-
];
|
|
653
|
-
} catch (er) {
|
|
654
|
-
throw error("invalid file:// specifier", {
|
|
655
|
-
spec,
|
|
656
|
-
cause: er
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
if (opts?.winPath.isAbsolute(rest)) {
|
|
661
|
-
return [rest, `file://${rest}`];
|
|
662
|
-
}
|
|
663
|
-
return [`./${rest}`, `file:./${rest}`];
|
|
664
|
-
};
|
|
665
|
-
|
|
666
|
-
// ../../src/spec/src/index.ts
|
|
667
|
-
import { homedir } from "node:os";
|
|
668
|
-
import {
|
|
669
|
-
isAbsolute,
|
|
670
|
-
join,
|
|
671
|
-
resolve,
|
|
672
|
-
win32 as winPath
|
|
673
|
-
} from "node:path";
|
|
674
|
-
import { inspect } from "node:util";
|
|
675
|
-
var Spec2 = class extends Spec {
|
|
676
|
-
[kCustomInspect](_depth, options) {
|
|
677
|
-
const str = inspect(
|
|
678
|
-
Object.fromEntries(
|
|
679
|
-
Object.entries(this).filter(([k, v]) => {
|
|
680
|
-
return k !== "options" && v !== void 0;
|
|
681
|
-
})
|
|
682
|
-
),
|
|
683
|
-
options
|
|
684
|
-
);
|
|
685
|
-
return `@vltpkg/spec.Spec ${str}`;
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
Spec2.nodejsDependencies = {
|
|
689
|
-
homedir,
|
|
690
|
-
isAbsolute,
|
|
691
|
-
join,
|
|
692
|
-
resolve,
|
|
693
|
-
winPath
|
|
694
|
-
};
|
|
695
|
-
|
|
696
22
|
// ../../src/dep-id/src/browser.ts
|
|
697
23
|
var delimiter = "~";
|
|
698
24
|
var EXTRA_PEER_SET_DELIMITER = "peer.";
|
|
@@ -1533,18 +859,6 @@ var graphRunSync = (options) => {
|
|
|
1533
859
|
};
|
|
1534
860
|
|
|
1535
861
|
export {
|
|
1536
|
-
defaultRegistry,
|
|
1537
|
-
defaultRegistryName,
|
|
1538
|
-
defaultRegistries,
|
|
1539
|
-
defaultJsrRegistries,
|
|
1540
|
-
defaultGitHosts,
|
|
1541
|
-
defaultGitHostArchives,
|
|
1542
|
-
gitHostWebsites,
|
|
1543
|
-
defaultScopeRegistries,
|
|
1544
|
-
getOptions,
|
|
1545
|
-
isSpec,
|
|
1546
|
-
Spec,
|
|
1547
|
-
Spec2,
|
|
1548
862
|
asDepID,
|
|
1549
863
|
joinDepIDTuple,
|
|
1550
864
|
splitDepID,
|