@vltpkg/cli-js 1.0.10 → 1.1.0
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-4RPC3X5N.js → access-GLWBGQLN.js} +41 -10
- package/{bugs-K6QLQLL4.js → bugs-OCQYFWFE.js} +18 -18
- package/{build-VD4L5IED.js → build-CPWGNTCM.js} +7 -8
- package/{cache-Q6FUUEQF.js → cache-SL7DQMY2.js} +20 -14
- package/chunk-2IMBYPYC.js +190 -0
- package/{chunk-5JFRXIK2.js → chunk-2PWSMJD7.js} +20 -1
- package/{chunk-FUCQ7ARR.js → chunk-47M7IZ5P.js} +26 -22
- package/{chunk-WAYVHANF.js → chunk-6LEMBT22.js} +30 -5
- package/chunk-A75UYRJC.js +75 -0
- package/{chunk-HAYXR3MW.js → chunk-APMYKJI2.js} +1 -1
- package/{chunk-B5IILBX7.js → chunk-BUXPKRYB.js} +4 -4
- package/{chunk-5HPGL5WS.js → chunk-CBASIDQH.js} +1 -1
- package/{chunk-MNK55XSE.js → chunk-CEHPRPGQ.js} +21 -0
- package/{chunk-BSPUKIWY.js → chunk-CF5EGH4W.js} +12 -2
- package/{chunk-P5S2TFCF.js → chunk-CTQSUNNE.js} +14 -10
- package/{chunk-NWLS3VOQ.js → chunk-GJGQTRAT.js} +154 -26
- package/{chunk-5HBKYSTX.js → chunk-HYCYL4RX.js} +1 -1
- package/{chunk-NA732FNL.js → chunk-J2XWQVDK.js} +98 -6
- package/{chunk-DAS7TVRN.js → chunk-JSQUYHU7.js} +5 -5
- package/{chunk-XUP35M5Q.js → chunk-S6Y57MUS.js} +4 -4
- package/chunk-SNOBGFNM.js +129 -0
- package/{chunk-VL7RJVNN.js → chunk-TNEMFBP5.js} +20 -11
- package/{chunk-3564IL5W.js → chunk-TUXWDPCQ.js} +1 -1
- package/{chunk-ZNCVQQDT.js → chunk-TXTK2PKN.js} +2 -2
- package/{chunk-LPIBYUMT.js → chunk-U7TEQCBN.js} +27 -1
- package/{chunk-XFI4THXZ.js → chunk-WE2TQN32.js} +1 -1
- package/{chunk-USTJECVS.js → chunk-X2AWQGYG.js} +1 -1
- package/{chunk-TYRKIWGF.js → chunk-YKCGWKUE.js} +3 -3
- package/{chunk-2YJ5MESP.js → chunk-ZDQJWRCU.js} +1 -1
- package/{ci-G4PJWJQE.js → ci-O2RSLTBX.js} +9 -10
- package/cli-package.json +1 -1
- package/{config-WTIWWXRD.js → config-ZBIF32GS.js} +11 -11
- package/{config-66ARNESN.js → config-ZPH7V77F.js} +8 -6
- package/{create-DF6RQTHC.js → create-2JX4RV5U.js} +17 -17
- package/{deprecate-2KTC2HKH.js → deprecate-XJLP2TUW.js} +21 -18
- package/{dist-tag-QKJQIOGN.js → dist-tag-F6ZFWGQU.js} +23 -25
- package/{docs-YSWJTGYX.js → docs-IJCZZ4V6.js} +18 -18
- package/{exec-5XIMPSBI.js → exec-IWSS2LUA.js} +17 -17
- package/{exec-cache-OGX7WR5P.js → exec-cache-AG77OOEE.js} +15 -15
- package/{exec-local-SB7EPYED.js → exec-local-QXPWC4QG.js} +13 -14
- package/{help-GMCQHGVN.js → help-TGNDNWLP.js} +4 -4
- package/{init-KXIIWHBA.js → init-WU7BRPKR.js} +7 -8
- package/{install-ODTEMAMS.js → install-74XKB5N7.js} +37 -14
- package/{list-QS4FLJSU.js → list-TOEC6Q3A.js} +41 -29
- package/{login-6TGYRY43.js → login-WJYMAFSL.js} +11 -11
- package/{logout-GOAB7KHJ.js → logout-MTRQWI3L.js} +7 -7
- package/{pack-PJDH6PKP.js → pack-FFWGLSNC.js} +11 -12
- package/package.json +1 -1
- package/{ping-ANBW2IRW.js → ping-DWUVTCJB.js} +7 -7
- package/{pkg-GZWUXU65.js → pkg-KNZW5FIA.js} +10 -11
- package/{profile-BLY74CMB.js → profile-6W2ABNXL.js} +20 -7
- package/{publish-W2KOTNMB.js → publish-HGNUONU3.js} +33 -75
- package/{query-3PUMU5ON.js → query-FSCYPETX.js} +35 -23
- package/{registry-ONSDWNPV.js → registry-YTJZ3AQD.js} +3 -3
- package/registry-client-package.json +6 -1
- package/registry-client-src-revalidate.js +230 -39
- package/{repo-LZ6STH4C.js → repo-OVIKYYWA.js} +18 -18
- package/{reporter-SDMDYYMJ.js → reporter-ZW7OMRZT.js} +23 -1
- package/{run-JMIBADHE.js → run-UPV3RPQJ.js} +13 -14
- package/{run-exec-JEKM2O53.js → run-exec-YJSMWMMP.js} +13 -14
- package/{setup-BTBU3NAI.js → setup-7DPMAPUY.js} +20 -19
- package/{src-23VBKASP.js → src-BNCFK4FH.js} +15 -15
- package/{src-J4BAYOBO.js → src-XJT4IJSV.js} +11 -4
- package/{token-PUJ7QN6D.js → token-GA73ER5V.js} +8 -8
- package/{uninstall-OTISP2T7.js → uninstall-E3VKSC3B.js} +11 -11
- package/{unpublish-X75EEQAN.js → unpublish-Q6MQHBPQ.js} +43 -40
- package/{update-CKXX5POE.js → update-4CC44TR5.js} +34 -12
- package/{version-24B2X7M7.js → version-CRZBXNDG.js} +9 -10
- package/{view-Q7MAQ6R3.js → view-ILUULGSO.js} +9 -9
- 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-S6CQZFE3.js → whoami-Z4TSLYTR.js} +28 -12
- package/chunk-UBLFPJHV.js +0 -40
- package/chunk-Y3QEV76Q.js +0 -75
|
@@ -13,14 +13,39 @@ import {
|
|
|
13
13
|
actual,
|
|
14
14
|
callLimit,
|
|
15
15
|
createVirtualRoot
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-47M7IZ5P.js";
|
|
17
17
|
import {
|
|
18
18
|
SecurityArchive
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZDQJWRCU.js";
|
|
20
20
|
import {
|
|
21
21
|
error
|
|
22
22
|
} from "./chunk-WZWDS3W4.js";
|
|
23
23
|
|
|
24
|
+
// ../../src/cli-sdk/src/is-vlt-installed.ts
|
|
25
|
+
import { lstatSync } from "node:fs";
|
|
26
|
+
import { resolve } from "node:path";
|
|
27
|
+
var lstat = (path) => {
|
|
28
|
+
try {
|
|
29
|
+
return lstatSync(path, { throwIfNoEntry: false });
|
|
30
|
+
} catch {
|
|
31
|
+
return void 0;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var isDir = (path) => !!lstat(path)?.isDirectory();
|
|
35
|
+
var isFile = (path) => !!lstat(path)?.isFile();
|
|
36
|
+
var isVltInstalled = (projectRoot) => isDir(resolve(projectRoot, "node_modules/.vlt")) || isFile(resolve(projectRoot, "node_modules/.vlt-lock.json"));
|
|
37
|
+
var assertVltInstalled = (projectRoot, command) => {
|
|
38
|
+
if (isVltInstalled(projectRoot)) return;
|
|
39
|
+
const nodeModules = resolve(projectRoot, "node_modules");
|
|
40
|
+
const hint = isDir(nodeModules) ? `run \`vlt install\` to rebuild it before running \`vlt ${command}\`` : `run \`vlt install\` before running \`vlt ${command}\``;
|
|
41
|
+
throw error(`No vlt install found in ${nodeModules}
|
|
42
|
+
|
|
43
|
+
${hint}`, {
|
|
44
|
+
code: "EQUERY",
|
|
45
|
+
path: nodeModules
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
24
49
|
// ../../src/cli-sdk/src/query-host-contexts.ts
|
|
25
50
|
import { homedir as homedir2 } from "node:os";
|
|
26
51
|
import { parse, posix } from "node:path";
|
|
@@ -115,7 +140,7 @@ var reloadConfig = async (folder) => {
|
|
|
115
140
|
unload("project");
|
|
116
141
|
} catch {
|
|
117
142
|
}
|
|
118
|
-
const { Config } = await import("./config-
|
|
143
|
+
const { Config } = await import("./config-ZPH7V77F.js");
|
|
119
144
|
return Config.load(folder, process.argv, true);
|
|
120
145
|
};
|
|
121
146
|
|
|
@@ -126,7 +151,6 @@ try {
|
|
|
126
151
|
} catch {
|
|
127
152
|
}
|
|
128
153
|
var home2 = foundHome ?? posix.dirname(posix.format(parse(process.cwd())));
|
|
129
|
-
var isVltInstalled = (folder) => !!folder.resolve("node_modules/.vlt").lstatSync()?.isDirectory() || !!folder.resolve("node_modules/.vlt-lock.json").lstatSync()?.isFile();
|
|
130
154
|
var getPossibleProjectKeys = (folder, scurry) => {
|
|
131
155
|
const relativePath = posix.relative(
|
|
132
156
|
scurry.cwd.fullpathPosix(),
|
|
@@ -196,7 +220,7 @@ var createHostContextsMap = async (conf) => {
|
|
|
196
220
|
for (const folder of projectFolders) {
|
|
197
221
|
try {
|
|
198
222
|
const config = await reloadConfig(folder.fullpath());
|
|
199
|
-
if (!isVltInstalled(folder)) {
|
|
223
|
+
if (!isVltInstalled(folder.fullpath())) {
|
|
200
224
|
continue;
|
|
201
225
|
}
|
|
202
226
|
const graph = actual.load({
|
|
@@ -234,5 +258,6 @@ var createHostContextsMap = async (conf) => {
|
|
|
234
258
|
};
|
|
235
259
|
|
|
236
260
|
export {
|
|
261
|
+
assertVltInstalled,
|
|
237
262
|
createHostContextsMap
|
|
238
263
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var global = globalThis;
|
|
2
|
+
import {Buffer} from "node:buffer";
|
|
3
|
+
import {setTimeout as _vlt_setTimeout,clearTimeout as _vlt_clearTimeout,setImmediate as _vlt_setImmediate,clearImmediate as _vlt_clearImmediate,setInterval as _vlt_setInterval,clearInterval as _vlt_clearInterval} from "node:timers";
|
|
4
|
+
globalThis.setTimeout = _vlt_setTimeout;
|
|
5
|
+
globalThis.clearTimeout = _vlt_clearTimeout;
|
|
6
|
+
globalThis.setImmediate = _vlt_setImmediate;
|
|
7
|
+
globalThis.clearImmediate = _vlt_clearImmediate;
|
|
8
|
+
globalThis.setInterval = _vlt_setInterval;
|
|
9
|
+
globalThis.clearInterval = _vlt_clearInterval;
|
|
10
|
+
import {createRequire as _vlt_createRequire} from "node:module";
|
|
11
|
+
var require = _vlt_createRequire(import.meta.filename);
|
|
12
|
+
import {
|
|
13
|
+
error
|
|
14
|
+
} from "./chunk-WZWDS3W4.js";
|
|
15
|
+
import {
|
|
16
|
+
__glob
|
|
17
|
+
} from "./chunk-PZLD7RTK.js";
|
|
18
|
+
|
|
19
|
+
// import("./commands/**/*.ts") in ../../src/cli-sdk/src/load-command.ts
|
|
20
|
+
var globImport_commands_ts = __glob({
|
|
21
|
+
"./commands/access.ts": () => import("./access-GLWBGQLN.js"),
|
|
22
|
+
"./commands/bugs.ts": () => import("./bugs-OCQYFWFE.js"),
|
|
23
|
+
"./commands/build.ts": () => import("./build-CPWGNTCM.js"),
|
|
24
|
+
"./commands/cache.ts": () => import("./cache-SL7DQMY2.js"),
|
|
25
|
+
"./commands/ci.ts": () => import("./ci-O2RSLTBX.js"),
|
|
26
|
+
"./commands/config.ts": () => import("./config-ZBIF32GS.js"),
|
|
27
|
+
"./commands/create.ts": () => import("./create-2JX4RV5U.js"),
|
|
28
|
+
"./commands/deprecate.ts": () => import("./deprecate-XJLP2TUW.js"),
|
|
29
|
+
"./commands/dist-tag.ts": () => import("./dist-tag-F6ZFWGQU.js"),
|
|
30
|
+
"./commands/docs.ts": () => import("./docs-IJCZZ4V6.js"),
|
|
31
|
+
"./commands/exec-cache.ts": () => import("./exec-cache-AG77OOEE.js"),
|
|
32
|
+
"./commands/exec-local.ts": () => import("./exec-local-QXPWC4QG.js"),
|
|
33
|
+
"./commands/exec.ts": () => import("./exec-IWSS2LUA.js"),
|
|
34
|
+
"./commands/help.ts": () => import("./help-TGNDNWLP.js"),
|
|
35
|
+
"./commands/init.ts": () => import("./init-WU7BRPKR.js"),
|
|
36
|
+
"./commands/install.ts": () => import("./install-74XKB5N7.js"),
|
|
37
|
+
"./commands/install/reporter.ts": () => import("./reporter-ZW7OMRZT.js"),
|
|
38
|
+
"./commands/list.ts": () => import("./list-TOEC6Q3A.js"),
|
|
39
|
+
"./commands/login.ts": () => import("./login-WJYMAFSL.js"),
|
|
40
|
+
"./commands/logout.ts": () => import("./logout-MTRQWI3L.js"),
|
|
41
|
+
"./commands/pack.ts": () => import("./pack-FFWGLSNC.js"),
|
|
42
|
+
"./commands/ping.ts": () => import("./ping-DWUVTCJB.js"),
|
|
43
|
+
"./commands/pkg.ts": () => import("./pkg-KNZW5FIA.js"),
|
|
44
|
+
"./commands/profile.ts": () => import("./profile-6W2ABNXL.js"),
|
|
45
|
+
"./commands/publish.ts": () => import("./publish-HGNUONU3.js"),
|
|
46
|
+
"./commands/query.ts": () => import("./query-FSCYPETX.js"),
|
|
47
|
+
"./commands/registry.ts": () => import("./registry-YTJZ3AQD.js"),
|
|
48
|
+
"./commands/repo.ts": () => import("./repo-OVIKYYWA.js"),
|
|
49
|
+
"./commands/run-exec.ts": () => import("./run-exec-YJSMWMMP.js"),
|
|
50
|
+
"./commands/run.ts": () => import("./run-UPV3RPQJ.js"),
|
|
51
|
+
"./commands/setup.ts": () => import("./setup-7DPMAPUY.js"),
|
|
52
|
+
"./commands/token.ts": () => import("./token-GA73ER5V.js"),
|
|
53
|
+
"./commands/uninstall.ts": () => import("./uninstall-E3VKSC3B.js"),
|
|
54
|
+
"./commands/unpublish.ts": () => import("./unpublish-Q6MQHBPQ.js"),
|
|
55
|
+
"./commands/update.ts": () => import("./update-4CC44TR5.js"),
|
|
56
|
+
"./commands/version.ts": () => import("./version-CRZBXNDG.js"),
|
|
57
|
+
"./commands/view.ts": () => import("./view-ILUULGSO.js"),
|
|
58
|
+
"./commands/whoami.ts": () => import("./whoami-Z4TSLYTR.js")
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ../../src/cli-sdk/src/load-command.ts
|
|
62
|
+
var loadCommand = async (command) => {
|
|
63
|
+
try {
|
|
64
|
+
return await globImport_commands_ts(`./commands/${command}.ts`);
|
|
65
|
+
} catch (e) {
|
|
66
|
+
throw error("Could not load command", {
|
|
67
|
+
found: command,
|
|
68
|
+
cause: e
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
loadCommand
|
|
75
|
+
};
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
} from "./chunk-RIYFGX27.js";
|
|
15
15
|
import {
|
|
16
16
|
createHostContextsMap
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6LEMBT22.js";
|
|
18
18
|
import {
|
|
19
19
|
stderr,
|
|
20
20
|
stdout,
|
|
21
21
|
styleTextStdout
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-TNEMFBP5.js";
|
|
23
23
|
import {
|
|
24
24
|
require_emoji_regex
|
|
25
25
|
} from "./chunk-VTEFO2FT.js";
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
Query,
|
|
28
28
|
actual,
|
|
29
29
|
isRunResult
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-47M7IZ5P.js";
|
|
31
31
|
import {
|
|
32
32
|
Monorepo
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-X2AWQGYG.js";
|
|
34
34
|
import {
|
|
35
35
|
isErrorWithCause
|
|
36
36
|
} from "./chunk-VFBCWAOC.js";
|
|
@@ -1203,6 +1203,10 @@ var definition = j2.heading("Configuration").description(
|
|
|
1203
1203
|
|
|
1204
1204
|
Command-specific fields may be set in a nested \`command\` object that
|
|
1205
1205
|
overrides any options defined at the top level.
|
|
1206
|
+
|
|
1207
|
+
Object type values given in the environment or on the command line
|
|
1208
|
+
are merged key by key over the config files (command line wins over
|
|
1209
|
+
environment); other values replace them.
|
|
1206
1210
|
`
|
|
1207
1211
|
).flag({
|
|
1208
1212
|
color: {
|
|
@@ -1266,6 +1270,12 @@ var definition = j2.heading("Configuration").description(
|
|
|
1266
1270
|
alias must be configured (e.g. via \`vlt setup\`) before it
|
|
1267
1271
|
can be used. The \`gh\` and \`jsr\` aliases have built-in
|
|
1268
1272
|
defaults that can be overridden here.
|
|
1273
|
+
|
|
1274
|
+
Aliases given on the command line or in
|
|
1275
|
+
\`VLT_REGISTRIES\` (newline-delimited) merge with the
|
|
1276
|
+
configured ones, later sources winning per key. Pass
|
|
1277
|
+
\`--save-config\` to \`install\`, \`add\` or
|
|
1278
|
+
\`update\` to save them to \`vlt.json\`.
|
|
1269
1279
|
`
|
|
1270
1280
|
},
|
|
1271
1281
|
"scoped-registries": {
|
|
@@ -1689,6 +1699,17 @@ var definition = j2.heading("Configuration").description(
|
|
|
1689
1699
|
This is useful if a package already exists in
|
|
1690
1700
|
devDependencies or optionalDependencies, but you want to
|
|
1691
1701
|
move it to be a non-optional production dependency.`
|
|
1702
|
+
},
|
|
1703
|
+
"save-config": {
|
|
1704
|
+
description: `Save the registry and git host options given on the
|
|
1705
|
+
command line or via \`VLT_*\` env (\`--registry\`,
|
|
1706
|
+
\`--registries\`, \`--default-registry-alias\`,
|
|
1707
|
+
\`--scoped-registries\`, \`--jsr-registries\`,
|
|
1708
|
+
\`--git-hosts\`, \`--git-host-archives\`) to the
|
|
1709
|
+
project \`vlt.json\` (or the user one with
|
|
1710
|
+
\`--config=user\`) after a successful \`install\`,
|
|
1711
|
+
\`add\` or \`update\`. Values a config file already
|
|
1712
|
+
has are left alone.`
|
|
1692
1713
|
}
|
|
1693
1714
|
}).opt({
|
|
1694
1715
|
"save-prefix": {
|
|
@@ -9,10 +9,13 @@ globalThis.setInterval = _vlt_setInterval;
|
|
|
9
9
|
globalThis.clearInterval = _vlt_clearInterval;
|
|
10
10
|
import {createRequire as _vlt_createRequire} from "node:module";
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
|
+
import {
|
|
13
|
+
asUnknownSpecPrefix
|
|
14
|
+
} from "./chunk-2PWSMJD7.js";
|
|
12
15
|
import {
|
|
13
16
|
addKey,
|
|
14
17
|
asDependency
|
|
15
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-47M7IZ5P.js";
|
|
16
19
|
import {
|
|
17
20
|
joinDepIDTuple,
|
|
18
21
|
splitDepID
|
|
@@ -65,6 +68,13 @@ var rebaseFileSpec = (spec, importerPath, scurryCwd, specOptions, monorepo) => {
|
|
|
65
68
|
if (rebasedPath === spec.file) return spec;
|
|
66
69
|
return Spec.parseArgs(rebasedPath, specOptions);
|
|
67
70
|
};
|
|
71
|
+
var parseArg = (item, options) => {
|
|
72
|
+
try {
|
|
73
|
+
return Spec.parseArgs(item, options);
|
|
74
|
+
} catch (er) {
|
|
75
|
+
throw asUnknownSpecPrefix(er);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
68
78
|
var parseAddArgs = (config, scurry, monorepo) => {
|
|
69
79
|
const add = new AddImportersDependenciesMapImpl();
|
|
70
80
|
const items = config.positionals;
|
|
@@ -74,7 +84,7 @@ var parseAddArgs = (config, scurry, monorepo) => {
|
|
|
74
84
|
const parsedItems = [];
|
|
75
85
|
let hasFileSpecs = false;
|
|
76
86
|
for (const item of items) {
|
|
77
|
-
const spec =
|
|
87
|
+
const spec = parseArg(item, specOptions);
|
|
78
88
|
parsedItems.push({ spec, type });
|
|
79
89
|
if (spec.type === "file") hasFileSpecs = true;
|
|
80
90
|
add.modifiedDependencies = true;
|
|
@@ -20,13 +20,16 @@ import {
|
|
|
20
20
|
pickManifest,
|
|
21
21
|
resolve,
|
|
22
22
|
revs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-X2AWQGYG.js";
|
|
24
24
|
import {
|
|
25
25
|
Spec
|
|
26
26
|
} from "./chunk-XKVU23NC.js";
|
|
27
|
+
import {
|
|
28
|
+
registryErrorMessage
|
|
29
|
+
} from "./chunk-SNOBGFNM.js";
|
|
27
30
|
import {
|
|
28
31
|
logRequest
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-U7TEQCBN.js";
|
|
30
33
|
import {
|
|
31
34
|
asPackument
|
|
32
35
|
} from "./chunk-VFBCWAOC.js";
|
|
@@ -83,6 +86,7 @@ var rename = platform !== "win32" ? fsRename : (async function(oldPath, newPath)
|
|
|
83
86
|
var debug = debuglog("vlt");
|
|
84
87
|
var xdg = new XDG("vlt");
|
|
85
88
|
var delimiter = "~";
|
|
89
|
+
var PACKUMENT_ACCEPT = "application/vnd.vlt.packument-v1+json; q=1.0, application/json; q=0.8, */*; q=0.1";
|
|
86
90
|
var manifestCacheMaxAge = 5 * 60 * 1e3;
|
|
87
91
|
var noRegistryError = (spec) => error(
|
|
88
92
|
'No registry configured to resolve this spec. Set "registry" in vlt.json, pass --registry, or run `vlt login --registry=<url>`. See https://docs.vlt.sh/cli',
|
|
@@ -119,7 +123,7 @@ var PackageInfoClient = class {
|
|
|
119
123
|
#tarPoolPromise;
|
|
120
124
|
async getRegistryClient() {
|
|
121
125
|
if (this.#registryClient) return this.#registryClient;
|
|
122
|
-
this.#registryClientPromise ??= import("./src-
|
|
126
|
+
this.#registryClientPromise ??= import("./src-XJT4IJSV.js").then(({ RegistryClient }) => {
|
|
123
127
|
this.#registryClient = new RegistryClient(this.options);
|
|
124
128
|
return this.#registryClient;
|
|
125
129
|
});
|
|
@@ -228,7 +232,7 @@ var PackageInfoClient = class {
|
|
|
228
232
|
throw this.#resolveError(
|
|
229
233
|
spec,
|
|
230
234
|
options,
|
|
231
|
-
|
|
235
|
+
`${registryErrorMessage(response)} when fetching the tarball for ${spec}. The resolved version may have been unpublished, or the registry may be misconfigured or unreachable.`,
|
|
232
236
|
{
|
|
233
237
|
url: r.resolved,
|
|
234
238
|
response
|
|
@@ -286,7 +290,7 @@ var PackageInfoClient = class {
|
|
|
286
290
|
throw this.#resolveError(
|
|
287
291
|
spec,
|
|
288
292
|
options,
|
|
289
|
-
|
|
293
|
+
`failed to fetch remote tarball: ${registryErrorMessage(response)}`,
|
|
290
294
|
{
|
|
291
295
|
url: r.resolved,
|
|
292
296
|
response
|
|
@@ -462,7 +466,7 @@ var PackageInfoClient = class {
|
|
|
462
466
|
throw this.#resolveError(
|
|
463
467
|
spec,
|
|
464
468
|
options,
|
|
465
|
-
|
|
469
|
+
`${registryErrorMessage(response)} when fetching the tarball for ${spec} at ${tarball}. The version may have been unpublished, or the registry may be misconfigured or unreachable.`,
|
|
466
470
|
{ response, url: tarball }
|
|
467
471
|
);
|
|
468
472
|
}
|
|
@@ -542,7 +546,7 @@ var PackageInfoClient = class {
|
|
|
542
546
|
throw this.#resolveError(
|
|
543
547
|
spec,
|
|
544
548
|
options,
|
|
545
|
-
|
|
549
|
+
`failed to fetch URL: ${registryErrorMessage(response)}`,
|
|
546
550
|
{ response, url: remoteURL }
|
|
547
551
|
);
|
|
548
552
|
}
|
|
@@ -645,7 +649,7 @@ var PackageInfoClient = class {
|
|
|
645
649
|
throw this.#resolveError(
|
|
646
650
|
s,
|
|
647
651
|
options,
|
|
648
|
-
|
|
652
|
+
`failed to fetch URL: ${registryErrorMessage(response)}`,
|
|
649
653
|
{ response, url: remoteURL }
|
|
650
654
|
);
|
|
651
655
|
}
|
|
@@ -755,7 +759,7 @@ var PackageInfoClient = class {
|
|
|
755
759
|
}
|
|
756
760
|
async #fetchPackument(spec, options, pakuURL, useCache) {
|
|
757
761
|
const response = await (await this.getRegistryClient()).request(pakuURL, {
|
|
758
|
-
headers: { accept:
|
|
762
|
+
headers: { accept: PACKUMENT_ACCEPT },
|
|
759
763
|
...useCache === false ? { useCache } : {},
|
|
760
764
|
// costs a conditional GET per moving selector on an otherwise warm
|
|
761
765
|
// cache, install included. 304s are cheap but not free; the
|
|
@@ -766,7 +770,7 @@ var PackageInfoClient = class {
|
|
|
766
770
|
throw this.#resolveError(
|
|
767
771
|
spec,
|
|
768
772
|
options,
|
|
769
|
-
|
|
773
|
+
`failed to fetch packument: ${registryErrorMessage(response)}`,
|
|
770
774
|
{
|
|
771
775
|
url: pakuURL,
|
|
772
776
|
response
|
|
@@ -11,16 +11,18 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
urlOpen
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-APMYKJI2.js";
|
|
15
|
+
import {
|
|
16
|
+
assertOk,
|
|
17
|
+
registryErrorMessage
|
|
18
|
+
} from "./chunk-SNOBGFNM.js";
|
|
15
19
|
import {
|
|
16
20
|
loadPackageJson
|
|
17
21
|
} from "./chunk-E74WGW5C.js";
|
|
18
22
|
import {
|
|
19
|
-
I
|
|
20
|
-
} from "./chunk-LPIBYUMT.js";
|
|
21
|
-
import {
|
|
23
|
+
I,
|
|
22
24
|
logRequest
|
|
23
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-U7TEQCBN.js";
|
|
24
26
|
import {
|
|
25
27
|
asError
|
|
26
28
|
} from "./chunk-VFBCWAOC.js";
|
|
@@ -1074,7 +1076,7 @@ var require_util = __commonJS({
|
|
|
1074
1076
|
return new BodyAsyncIterable(body);
|
|
1075
1077
|
} else if (body && isFormDataLike(body)) {
|
|
1076
1078
|
return body;
|
|
1077
|
-
} else if (body && typeof body !== "string" && !ArrayBuffer.isView(body) &&
|
|
1079
|
+
} else if (body && typeof body !== "string" && !ArrayBuffer.isView(body) && isIterable3(body)) {
|
|
1078
1080
|
return new BodyAsyncIterable(body);
|
|
1079
1081
|
} else {
|
|
1080
1082
|
return body;
|
|
@@ -1195,7 +1197,7 @@ var require_util = __commonJS({
|
|
|
1195
1197
|
function isAsyncIterable(obj) {
|
|
1196
1198
|
return !!(obj != null && typeof obj[Symbol.asyncIterator] === "function");
|
|
1197
1199
|
}
|
|
1198
|
-
function
|
|
1200
|
+
function isIterable3(obj) {
|
|
1199
1201
|
return !!(obj != null && (typeof obj[Symbol.iterator] === "function" || typeof obj[Symbol.asyncIterator] === "function"));
|
|
1200
1202
|
}
|
|
1201
1203
|
function hasSafeIterator(obj) {
|
|
@@ -1806,7 +1808,7 @@ var require_util = __commonJS({
|
|
|
1806
1808
|
parseURL,
|
|
1807
1809
|
getServerName,
|
|
1808
1810
|
isStream,
|
|
1809
|
-
isIterable:
|
|
1811
|
+
isIterable: isIterable3,
|
|
1810
1812
|
hasSafeIterator,
|
|
1811
1813
|
isAsyncIterable,
|
|
1812
1814
|
isDestroyed,
|
|
@@ -2115,7 +2117,7 @@ var require_request = __commonJS({
|
|
|
2115
2117
|
destroy,
|
|
2116
2118
|
isBuffer,
|
|
2117
2119
|
isFormDataLike,
|
|
2118
|
-
isIterable:
|
|
2120
|
+
isIterable: isIterable3,
|
|
2119
2121
|
hasSafeIterator,
|
|
2120
2122
|
isBlobLike,
|
|
2121
2123
|
serializePathWithQuery,
|
|
@@ -2230,7 +2232,7 @@ var require_request = __commonJS({
|
|
|
2230
2232
|
this.body = body.byteLength ? Buffer.from(body) : null;
|
|
2231
2233
|
} else if (typeof body === "string") {
|
|
2232
2234
|
this.body = body.length ? Buffer.from(body) : null;
|
|
2233
|
-
} else if (isFormDataLike(body) ||
|
|
2235
|
+
} else if (isFormDataLike(body) || isIterable3(body) || isBlobLike(body)) {
|
|
2234
2236
|
this.body = body;
|
|
2235
2237
|
} else {
|
|
2236
2238
|
throw new InvalidArgumentError("body must be a string, a Buffer, a Readable stream, an iterable, or an async iterable");
|
|
@@ -26601,6 +26603,19 @@ var CacheEntry = class _CacheEntry {
|
|
|
26601
26603
|
get statusCode() {
|
|
26602
26604
|
return this.#statusCode;
|
|
26603
26605
|
}
|
|
26606
|
+
/**
|
|
26607
|
+
* True when the registry answered with a 2xx.
|
|
26608
|
+
*
|
|
26609
|
+
* `RegistryClient.request()` resolves for every status, so this is how
|
|
26610
|
+
* code holding a real CacheEntry asks "did it work?".
|
|
26611
|
+
*
|
|
26612
|
+
* Note this is the strict form. Use it only where a genuine CacheEntry
|
|
26613
|
+
* is guaranteed; `assertOk` uses the loose range check because it is
|
|
26614
|
+
* also handed duck-typed responses.
|
|
26615
|
+
*/
|
|
26616
|
+
get ok() {
|
|
26617
|
+
return this.#statusCode >= 200 && this.#statusCode < 300;
|
|
26618
|
+
}
|
|
26604
26619
|
get headers() {
|
|
26605
26620
|
return this.#headers;
|
|
26606
26621
|
}
|
|
@@ -26953,9 +26968,9 @@ var __CODE_SPLIT_SCRIPT_NAME2 = resolve3(import.meta.dirname, "registry-client-s
|
|
|
26953
26968
|
var isDeno2 = globalThis.Deno != void 0;
|
|
26954
26969
|
var didProcessBeforeExitHook2 = false;
|
|
26955
26970
|
var registered2 = /* @__PURE__ */ new Map();
|
|
26956
|
-
var register2 = (path, method, url) => {
|
|
26971
|
+
var register2 = (path, method, url, accept) => {
|
|
26957
26972
|
const r = registered2.get(path) ?? /* @__PURE__ */ new Set();
|
|
26958
|
-
const key = `${method} ${url}`;
|
|
26973
|
+
const key = `${method} ${url}${accept ? ` ${String(accept)}` : ""}`;
|
|
26959
26974
|
r.add(key);
|
|
26960
26975
|
registered2.set(path, r);
|
|
26961
26976
|
if (!didProcessBeforeExitHook2) {
|
|
@@ -27005,6 +27020,33 @@ var bun = isBun ? proc.versions.bun : void 0;
|
|
|
27005
27020
|
var deno = isDeno3 ? proc.versions.deno : void 0;
|
|
27006
27021
|
var node = isNode ? proc.versions.node : void 0;
|
|
27007
27022
|
|
|
27023
|
+
// ../../src/registry-client/src/get-header.ts
|
|
27024
|
+
var isIterable2 = (o) => !!o && typeof o === "object" && Symbol.iterator in o;
|
|
27025
|
+
var getHeader = (headers, key) => {
|
|
27026
|
+
if (!headers) return void 0;
|
|
27027
|
+
key = key.toLowerCase();
|
|
27028
|
+
if (Array.isArray(headers)) {
|
|
27029
|
+
if (!headers.length) return void 0;
|
|
27030
|
+
if (Array.isArray(headers[0])) {
|
|
27031
|
+
for (const [k, v] of headers) {
|
|
27032
|
+
if (k.toLowerCase() === key) return v;
|
|
27033
|
+
}
|
|
27034
|
+
} else if (headers.length % 2 === 0) {
|
|
27035
|
+
for (let i = 0; i < headers.length; i += 2) {
|
|
27036
|
+
if (headers[i]?.toLowerCase() === key) return headers[i + 1];
|
|
27037
|
+
}
|
|
27038
|
+
}
|
|
27039
|
+
} else if (isIterable2(headers)) {
|
|
27040
|
+
for (const [k, v] of headers) {
|
|
27041
|
+
if (k.toLowerCase() === key) return v;
|
|
27042
|
+
}
|
|
27043
|
+
} else {
|
|
27044
|
+
for (const [k, v] of Object.entries(headers)) {
|
|
27045
|
+
if (k.toLowerCase() === key) return v;
|
|
27046
|
+
}
|
|
27047
|
+
}
|
|
27048
|
+
};
|
|
27049
|
+
|
|
27008
27050
|
// ../../src/registry-client/src/handle-304-response.ts
|
|
27009
27051
|
var handleCacheHitResponse = (resp, entry) => {
|
|
27010
27052
|
if (resp.statusCode !== 304 && resp.statusCode !== 412 || !entry)
|
|
@@ -27053,6 +27095,9 @@ var otplease = async (client, options, response) => {
|
|
|
27053
27095
|
);
|
|
27054
27096
|
if (wwwAuth.has("ipaddress")) {
|
|
27055
27097
|
throw error("Authorization is not allowed from your ip address", {
|
|
27098
|
+
code: "ENEEDAUTH",
|
|
27099
|
+
status: response.statusCode,
|
|
27100
|
+
method: options.method,
|
|
27056
27101
|
response
|
|
27057
27102
|
});
|
|
27058
27103
|
}
|
|
@@ -27085,17 +27130,30 @@ var otplease = async (client, options, response) => {
|
|
|
27085
27130
|
}
|
|
27086
27131
|
}
|
|
27087
27132
|
throw error("Unrecognized OTP authentication challenge", {
|
|
27133
|
+
code: "ENEEDAUTH",
|
|
27134
|
+
status: response.statusCode,
|
|
27135
|
+
method: options.method,
|
|
27088
27136
|
response
|
|
27089
27137
|
});
|
|
27090
27138
|
}
|
|
27091
27139
|
if (wwwAuth.has("bearer")) {
|
|
27092
27140
|
throw error(
|
|
27093
27141
|
"Missing or invalid authentication token. Run `vlt login` or `vlt token add` to authenticate.",
|
|
27094
|
-
{
|
|
27142
|
+
{
|
|
27143
|
+
code: "ENEEDAUTH",
|
|
27144
|
+
status: response.statusCode,
|
|
27145
|
+
method: options.method,
|
|
27146
|
+
response
|
|
27147
|
+
}
|
|
27095
27148
|
);
|
|
27096
27149
|
}
|
|
27097
27150
|
if (wwwAuth.size) {
|
|
27098
|
-
throw error("Unknown authentication challenge", {
|
|
27151
|
+
throw error("Unknown authentication challenge", {
|
|
27152
|
+
code: "ENEEDAUTH",
|
|
27153
|
+
status: response.statusCode,
|
|
27154
|
+
method: options.method,
|
|
27155
|
+
response
|
|
27156
|
+
});
|
|
27099
27157
|
}
|
|
27100
27158
|
const text = await responseBodyText(response).catch(() => "");
|
|
27101
27159
|
if (text.toLowerCase().includes("one-time pass")) {
|
|
@@ -27446,7 +27504,40 @@ var RegistryClient = class {
|
|
|
27446
27504
|
*/
|
|
27447
27505
|
async scroll(url, options = {}, seek) {
|
|
27448
27506
|
const resp = await this.request(url, options);
|
|
27449
|
-
const {
|
|
27507
|
+
const { statusCode } = resp;
|
|
27508
|
+
if (statusCode < 200 || statusCode >= 300) {
|
|
27509
|
+
let detail;
|
|
27510
|
+
try {
|
|
27511
|
+
const body2 = resp.json();
|
|
27512
|
+
if (body2 && typeof body2 === "object" && "error" in body2) {
|
|
27513
|
+
detail = body2.error;
|
|
27514
|
+
}
|
|
27515
|
+
} catch {
|
|
27516
|
+
}
|
|
27517
|
+
const status = STATUS_CODES[statusCode];
|
|
27518
|
+
throw error(
|
|
27519
|
+
`Failed to fetch paginated results: ${statusCode}${status ? ` ${status}` : ""}${typeof detail === "string" && detail ? `: ${detail}` : ""}`,
|
|
27520
|
+
{ code: "EREQUEST", status: statusCode, url: String(url) }
|
|
27521
|
+
);
|
|
27522
|
+
}
|
|
27523
|
+
let body;
|
|
27524
|
+
try {
|
|
27525
|
+
body = resp.json();
|
|
27526
|
+
} catch (cause) {
|
|
27527
|
+
throw error("Invalid JSON in paginated registry response", {
|
|
27528
|
+
code: "EREQUEST",
|
|
27529
|
+
url: String(url),
|
|
27530
|
+
cause
|
|
27531
|
+
});
|
|
27532
|
+
}
|
|
27533
|
+
if (!body || typeof body !== "object" || !("objects" in body) || !Array.isArray(body.objects) || !("urls" in body) || !body.urls || typeof body.urls !== "object" || Array.isArray(body.urls) || "next" in body.urls && body.urls.next !== null && body.urls.next !== void 0 && typeof body.urls.next !== "string") {
|
|
27534
|
+
throw error("Invalid pagination in registry response", {
|
|
27535
|
+
code: "EREQUEST",
|
|
27536
|
+
url: String(url)
|
|
27537
|
+
});
|
|
27538
|
+
}
|
|
27539
|
+
const objects = body.objects;
|
|
27540
|
+
const urls = body.urls;
|
|
27450
27541
|
return urls.next && !(seek && objects.some(seek)) ? objects.concat(await this.scroll(urls.next, options, seek)) : objects;
|
|
27451
27542
|
}
|
|
27452
27543
|
/**
|
|
@@ -27465,17 +27556,41 @@ var RegistryClient = class {
|
|
|
27465
27556
|
const s = tok.replace(/^(Bearer|Basic) /i, "");
|
|
27466
27557
|
const base = registryBase(registry);
|
|
27467
27558
|
const tokensUrl = new URL("-/npm/v1/tokens", base);
|
|
27468
|
-
const
|
|
27469
|
-
|
|
27470
|
-
|
|
27471
|
-
|
|
27472
|
-
|
|
27473
|
-
|
|
27474
|
-
|
|
27475
|
-
|
|
27476
|
-
|
|
27559
|
+
const stillLive = `Removing the local credential anyway; revoke the token in the registry UI if it is still live.`;
|
|
27560
|
+
try {
|
|
27561
|
+
let record;
|
|
27562
|
+
try {
|
|
27563
|
+
record = await this.seek(tokensUrl, ({ token }) => s.startsWith(token), {
|
|
27564
|
+
useCache: false
|
|
27565
|
+
});
|
|
27566
|
+
} catch (er) {
|
|
27567
|
+
log3(
|
|
27568
|
+
`Could not list tokens at ${tokensUrl}: ${asError(er).message}
|
|
27569
|
+
` + stillLive
|
|
27570
|
+
);
|
|
27571
|
+
}
|
|
27572
|
+
if (record) {
|
|
27573
|
+
const deleteUrl = new URL(
|
|
27574
|
+
`-/npm/v1/tokens/token/${record.key}`,
|
|
27575
|
+
base
|
|
27576
|
+
);
|
|
27577
|
+
const failed = (detail) => log3(
|
|
27578
|
+
`Failed to revoke the token on the registry: ${detail}
|
|
27579
|
+
` + stillLive
|
|
27580
|
+
);
|
|
27581
|
+
try {
|
|
27582
|
+
const response = await this.request(deleteUrl, {
|
|
27583
|
+
useCache: false,
|
|
27584
|
+
method: "DELETE"
|
|
27585
|
+
});
|
|
27586
|
+
if (!response.ok) failed(registryErrorMessage(response));
|
|
27587
|
+
} catch (er) {
|
|
27588
|
+
failed(asError(er).message);
|
|
27589
|
+
}
|
|
27590
|
+
}
|
|
27591
|
+
} finally {
|
|
27592
|
+
await deleteToken(registry, this.identity);
|
|
27477
27593
|
}
|
|
27478
|
-
await deleteToken(registry, this.identity);
|
|
27479
27594
|
}
|
|
27480
27595
|
/**
|
|
27481
27596
|
* Log into the registry specified.
|
|
@@ -27579,11 +27694,19 @@ var RegistryClient = class {
|
|
|
27579
27694
|
}
|
|
27580
27695
|
return await this.#checkLogin(url, options);
|
|
27581
27696
|
}
|
|
27697
|
+
assertOk(response, {
|
|
27698
|
+
message: "Web login failed",
|
|
27699
|
+
url,
|
|
27700
|
+
advice: (statusCode) => statusCode === 404 ? "This registry does not implement the web login endpoint." : void 0
|
|
27701
|
+
});
|
|
27582
27702
|
if (response.statusCode === 200) {
|
|
27583
27703
|
const token = getTokenResponse(response.json());
|
|
27584
27704
|
if (token) return token;
|
|
27585
27705
|
}
|
|
27586
27706
|
throw error("Invalid response from web login endpoint", {
|
|
27707
|
+
code: "EREQUEST",
|
|
27708
|
+
url,
|
|
27709
|
+
status: response.statusCode,
|
|
27587
27710
|
response
|
|
27588
27711
|
});
|
|
27589
27712
|
}
|
|
@@ -27657,7 +27780,12 @@ var RegistryClient = class {
|
|
|
27657
27780
|
}
|
|
27658
27781
|
const forcedFallback = forceRevalidate && entry?.staleWhileRevalidate ? entry : void 0;
|
|
27659
27782
|
if (!forceRevalidate && staleWhileRevalidate && entry?.staleWhileRevalidate && m) {
|
|
27660
|
-
register2(
|
|
27783
|
+
register2(
|
|
27784
|
+
dirname3(this.cache.path()),
|
|
27785
|
+
m,
|
|
27786
|
+
url,
|
|
27787
|
+
getHeader(options.headers, "accept")
|
|
27788
|
+
);
|
|
27661
27789
|
logRequest(url, "stale", { method });
|
|
27662
27790
|
return entry;
|
|
27663
27791
|
}
|