@vltpkg/cli-js 1.5.0 → 1.6.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/{access-QPX4QXV4.js → access-YSLEWR2C.js} +8 -8
- package/{bugs-TLOECXEM.js → bugs-S6CRUEA2.js} +23 -19
- package/{build-IQOS3LKO.js → build-SG3KPX3W.js} +49 -14
- package/{cache-O5IBYYSB.js → cache-HA77ROM7.js} +16 -13
- package/cache-unzip-src-unzip.js +23 -4
- package/{chunk-3S3W7QEM.js → chunk-3E3ISOYM.js} +10 -5
- package/{chunk-43EJ4Q42.js → chunk-3JIN46K5.js} +1 -1
- package/{chunk-5KW6AOTT.js → chunk-4GMNWW4C.js} +1 -1
- package/{chunk-6W5XMVIZ.js → chunk-4UAIPIAV.js} +7 -7
- package/{chunk-7UWRR6EE.js → chunk-5Q2HSLVV.js} +1 -1
- package/{chunk-LUVDMEW4.js → chunk-6D3QAFNZ.js} +1 -1
- package/{chunk-LH7J5BDU.js → chunk-6XVW7CWJ.js} +3 -3
- package/{chunk-UZ6ICZE3.js → chunk-7M2VTFLP.js} +12 -1
- package/{chunk-XCQCYB6G.js → chunk-AEVT3CHK.js} +142 -16
- package/{chunk-SMXXFQPI.js → chunk-AHLBPSGQ.js} +3 -3
- package/{chunk-6LZM3I4Q.js → chunk-BF5DRGRZ.js} +25 -4
- package/chunk-BH5CVXNY.js +115 -0
- package/{chunk-CS6AYPY5.js → chunk-BQMHDAYL.js} +6 -13
- package/{chunk-2U4PVHP4.js → chunk-C4RJ4NNS.js} +137 -47
- package/{chunk-F7NPYSI2.js → chunk-CAV7FKWQ.js} +2 -2
- package/chunk-DXED4ARV.js +436 -0
- package/chunk-E74WGW5C.js +49 -0
- package/{chunk-CMLDLZZ3.js → chunk-EFHOWRKU.js} +56 -0
- package/{chunk-IFEZ6BFV.js → chunk-EMTGRCSE.js} +2 -2
- package/{chunk-4TSHLSRK.js → chunk-EYGOEAJM.js} +1 -1
- package/{chunk-DBANBIL2.js → chunk-FZCPQWCJ.js} +1 -0
- package/chunk-GCTREKA4.js +115 -0
- package/{chunk-CW56EJIL.js → chunk-HT6FS4VB.js} +1 -1
- package/{chunk-VR7NRWAD.js → chunk-IHERL3TA.js} +17 -16
- package/chunk-JV5XR5JQ.js +349 -0
- package/{chunk-T5EP7QEF.js → chunk-JZXNHIQE.js} +28 -28
- package/{chunk-IJUVVD7E.js → chunk-KD5ZK72K.js} +1 -1
- package/{chunk-C6ZVVEFV.js → chunk-KURQHX54.js} +5 -3
- package/{chunk-GUP55DM6.js → chunk-L3ZF7OYM.js} +2 -2
- package/{chunk-X6JKMIOU.js → chunk-LGQVZTYR.js} +4 -36
- package/{chunk-G3FZ2ZJK.js → chunk-M242QVJS.js} +1 -1
- package/chunk-MCDLJZXT.js +82 -0
- package/{chunk-WHWPAYZY.js → chunk-MSWOR3FV.js} +35 -7
- package/chunk-N3V6EK5I.js +77 -0
- package/{chunk-ISAMD2FE.js → chunk-N6HV7JWC.js} +1 -1
- package/{chunk-MYX4JCIJ.js → chunk-NO53Y3QO.js} +1 -1
- package/chunk-O6MQ7NN6.js +1155 -0
- package/{chunk-XCSNI6AO.js → chunk-OWL5G4K4.js} +4 -4
- package/{chunk-35EG6T3J.js → chunk-Q2UEILN6.js} +21 -9
- package/{chunk-Z5D5KODU.js → chunk-VGPLFOJO.js} +4 -2
- package/{chunk-ARE7FKDG.js → chunk-W24SBFY5.js} +5 -5
- package/{chunk-XD5KUDXX.js → chunk-WMMKUVAT.js} +10 -8
- package/{chunk-4UH3KMTD.js → chunk-ZJE3OTP3.js} +258 -451
- package/{ci-ESVUMOZO.js → ci-GVLL72SS.js} +21 -17
- package/cli-package.json +3 -1
- package/{config-ZVVLFKR7.js → config-KH6AEMHI.js} +13 -12
- package/{config-TMB2X6DW.js → config-TIPKOPYS.js} +10 -9
- package/{create-BLTNKSBQ.js → create-SKNEZEZY.js} +28 -24
- package/{deprecate-VA6PGHYL.js → deprecate-RFRLJZVL.js} +12 -12
- package/{dist-tag-OYJREFO2.js → dist-tag-LVYOTJHJ.js} +8 -8
- package/{docs-6OC3OQNM.js → docs-INXRFEGY.js} +23 -19
- package/{exec-AZPGFVRY.js → exec-5MA5XRPZ.js} +28 -24
- package/{exec-cache-D75UY2WI.js → exec-cache-7GS4KLWJ.js} +24 -20
- package/{exec-local-E2JKB4X4.js → exec-local-RE4KVTMN.js} +22 -18
- package/{help-UPW77X5N.js → help-JHLP565L.js} +5 -4
- package/{init-SNO6QL7C.js → init-4UFHO67B.js} +13 -12
- package/{install-TEJM2YVX.js → install-Z33YVCDK.js} +108 -52
- package/{list-NHCC2RNB.js → list-XAMKR6TL.js} +29 -22
- package/{login-XNZXCGFD.js → login-6NXUO5FF.js} +14 -13
- package/{logout-YCM7O36Q.js → logout-6P7LWTAY.js} +8 -8
- package/{outdated-4LA7N63W.js → outdated-YNUSWZJD.js} +18 -17
- package/{pack-RC4CZSWF.js → pack-LMQYH75V.js} +15 -14
- package/package.json +1 -1
- package/{ping-RLVAZGDL.js → ping-VLFZ3WCY.js} +8 -8
- package/{pkg-FED5C6TP.js → pkg-JMPBHKSW.js} +16 -15
- package/{profile-DJZNLQPG.js → profile-PJJAA2YM.js} +8 -8
- package/{publish-54AMVMTQ.js → publish-33RFJ2HJ.js} +24 -20
- package/{query-ZQLMSJ7O.js → query-LUUOK57K.js} +29 -22
- package/{registry-6HKQYSZX.js → registry-ZGGWVLBM.js} +5 -5
- package/registry-client-src-revalidate.js +41 -11
- package/{repo-ITA4BLZ4.js → repo-VLHLQP2S.js} +23 -19
- package/{reporter-UYVR2WMB.js → reporter-SNSM2TDC.js} +61 -15
- package/{run-TP2HTJRN.js → run-USWK7R3N.js} +22 -18
- package/{run-exec-UGCC53DV.js → run-exec-PHE44AWW.js} +22 -18
- package/security-archive-src-update-expired.js +24 -5
- package/{setup-XPAM5U3Z.js → setup-JMY47ERY.js} +206 -27
- package/{skills-YD2TB2VD.js → skills-7PYMTDER.js} +41 -56
- package/{skills-LR6GXW3X.js → skills-YMMV6TMN.js} +24 -21
- package/{src-34D4DOOH.js → src-2ZS4VHJP.js} +25 -19
- package/{src-H6DFCAPH.js → src-A5ZJNOHN.js} +6 -4
- package/{src-LHDC4NJO.js → src-W2VQULRG.js} +2 -2
- package/{token-OF63PFTQ.js → token-YKHELNVQ.js} +10 -9
- package/{uninstall-B54FQ5KQ.js → uninstall-Q46HWR5S.js} +53 -17
- package/{unpublish-CSHIGMDQ.js → unpublish-LBANPSJ5.js} +8 -8
- package/{update-HS4VJ5ZG.js → update-B2EGLZHI.js} +19 -17
- package/{version-L7S3DHUS.js → version-IEOBL3NN.js} +14 -13
- package/{view-NWKKWFVA.js → view-JCA5VT6F.js} +13 -13
- 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-65K35VGW.js → whoami-OWJUPO3X.js} +8 -8
- package/chunk-T2VBCUF5.js +0 -77
|
@@ -11,12 +11,17 @@ import {createRequire as _vlt_createRequire} from "node:module";
|
|
|
11
11
|
var require = _vlt_createRequire(import.meta.filename);
|
|
12
12
|
import {
|
|
13
13
|
PackageInfoClient
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IHERL3TA.js";
|
|
15
15
|
import {
|
|
16
16
|
Monorepo,
|
|
17
17
|
PackageJson,
|
|
18
|
-
PathScurry
|
|
19
|
-
|
|
18
|
+
PathScurry,
|
|
19
|
+
workspaceCache
|
|
20
|
+
} from "./chunk-KURQHX54.js";
|
|
21
|
+
import {
|
|
22
|
+
ensureGlobalProject,
|
|
23
|
+
globalCommands
|
|
24
|
+
} from "./chunk-MCDLJZXT.js";
|
|
20
25
|
import {
|
|
21
26
|
commands,
|
|
22
27
|
defaultValues,
|
|
@@ -25,19 +30,20 @@ import {
|
|
|
25
30
|
isRecordField,
|
|
26
31
|
recordFields,
|
|
27
32
|
storeLinkers
|
|
28
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-EFHOWRKU.js";
|
|
29
34
|
import {
|
|
30
35
|
resetCaches
|
|
31
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-CAV7FKWQ.js";
|
|
32
37
|
import {
|
|
33
38
|
find,
|
|
34
39
|
load,
|
|
35
40
|
reload,
|
|
36
|
-
save
|
|
41
|
+
save,
|
|
42
|
+
unload
|
|
37
43
|
} from "./chunk-HTOTG4TS.js";
|
|
38
44
|
import {
|
|
39
45
|
storeRoot
|
|
40
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-4GMNWW4C.js";
|
|
41
47
|
import {
|
|
42
48
|
cloneAvailable
|
|
43
49
|
} from "./chunk-6IF3RJND.js";
|
|
@@ -51,14 +57,15 @@ import {
|
|
|
51
57
|
getOptions,
|
|
52
58
|
isObject,
|
|
53
59
|
isRecordStringString
|
|
54
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-BF5DRGRZ.js";
|
|
55
61
|
import {
|
|
56
62
|
error
|
|
57
63
|
} from "./chunk-WZWDS3W4.js";
|
|
58
64
|
|
|
59
65
|
// ../../src/cli-sdk/src/config/index.ts
|
|
60
66
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
61
|
-
import {
|
|
67
|
+
import { homedir } from "node:os";
|
|
68
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
62
69
|
|
|
63
70
|
// ../../src/cli-sdk/src/config/merge.ts
|
|
64
71
|
var merge = (base, add) => Object.fromEntries(
|
|
@@ -252,6 +259,7 @@ var recordsToPairs = (obj) => {
|
|
|
252
259
|
};
|
|
253
260
|
var kRecord = /* @__PURE__ */ Symbol("parsed key=value record");
|
|
254
261
|
var envKey = (k) => `VLT_${k.replace(/[^a-zA-Z0-9]+/g, "_").toUpperCase()}`;
|
|
262
|
+
var expandHome = (p) => p.replace(/^~(?=$|[\\/])/, homedir());
|
|
255
263
|
var kParentEnv = "__VLT_INTERNAL_EXPLICIT";
|
|
256
264
|
var parentEnv = () => {
|
|
257
265
|
try {
|
|
@@ -292,7 +300,9 @@ var Config = class _Config {
|
|
|
292
300
|
if (this.#options) return this.#options;
|
|
293
301
|
const scurry = new PathScurry(this.projectRoot);
|
|
294
302
|
const packageJson = new PackageJson();
|
|
295
|
-
const asRecords = pairsToRecords(
|
|
303
|
+
const { path: _, ...asRecords } = pairsToRecords(
|
|
304
|
+
this.parse().values
|
|
305
|
+
);
|
|
296
306
|
const extras = {
|
|
297
307
|
projectRoot: this.projectRoot,
|
|
298
308
|
signal: this.#abort.signal,
|
|
@@ -350,6 +360,7 @@ var Config = class _Config {
|
|
|
350
360
|
this.projectRoot = projectRoot;
|
|
351
361
|
this.#options = void 0;
|
|
352
362
|
resetCaches();
|
|
363
|
+
workspaceCache.clear();
|
|
353
364
|
}
|
|
354
365
|
// memoized options() getter value
|
|
355
366
|
#options;
|
|
@@ -376,6 +387,28 @@ var Config = class _Config {
|
|
|
376
387
|
* `~/projects/xyz`, then the highest dir it will check is `~/projects`
|
|
377
388
|
*/
|
|
378
389
|
projectRoot;
|
|
390
|
+
/**
|
|
391
|
+
* Global project root, set when `--global` switched to it.
|
|
392
|
+
*/
|
|
393
|
+
globalRoot;
|
|
394
|
+
/**
|
|
395
|
+
* `--global-bin-dir` from cli, env or user config, set with
|
|
396
|
+
* `globalRoot`.
|
|
397
|
+
*/
|
|
398
|
+
globalBinDir;
|
|
399
|
+
// the global project of the `setup` wizard, not switched to
|
|
400
|
+
#setupGlobal;
|
|
401
|
+
/**
|
|
402
|
+
* The global project (`--global-dir`, `--global-bin-dir`: cli > env >
|
|
403
|
+
* user config, never a project `vlt.json`): the one switched to by
|
|
404
|
+
* `--global`, or the one `vlt setup` offers PATH setup for.
|
|
405
|
+
*/
|
|
406
|
+
globalProject() {
|
|
407
|
+
if (this.globalRoot) {
|
|
408
|
+
return { root: this.globalRoot, binDir: this.globalBinDir };
|
|
409
|
+
}
|
|
410
|
+
return this.#setupGlobal;
|
|
411
|
+
}
|
|
379
412
|
/**
|
|
380
413
|
* `Record<alias, canonical name>` to dereference command aliases.
|
|
381
414
|
*/
|
|
@@ -399,6 +432,10 @@ var Config = class _Config {
|
|
|
399
432
|
const badLinker = process.env.VLT_STORE_LINKER;
|
|
400
433
|
const fixLinker = badLinker !== void 0 && !storeLinkers.includes(badLinker);
|
|
401
434
|
if (fixLinker) process.env.VLT_STORE_LINKER = "unpack";
|
|
435
|
+
const noModifyPath = process.env.VLT_NO_MODIFY_PATH;
|
|
436
|
+
if (noModifyPath !== void 0) {
|
|
437
|
+
process.env.VLT_NO_MODIFY_PATH = noModifyPath === "" || noModifyPath === "0" ? "0" : "1";
|
|
438
|
+
}
|
|
402
439
|
const envKeys = Object.keys(defaultValues).filter(
|
|
403
440
|
(k) => process.env[envKey(k)] !== void 0
|
|
404
441
|
);
|
|
@@ -447,7 +484,20 @@ var Config = class _Config {
|
|
|
447
484
|
if (cmdOrFallback !== "config") {
|
|
448
485
|
assertSpecAliases(pairsToRecords(p.values));
|
|
449
486
|
}
|
|
487
|
+
const binDirKey = envKey("global-bin-dir");
|
|
488
|
+
const keepBinDir = !this.globalRoot && !cliKeys.includes("global-bin-dir");
|
|
489
|
+
const binDirEnv = process.env[binDirKey];
|
|
450
490
|
this.jack.writeEnv(p);
|
|
491
|
+
delete process.env[envKey("global")];
|
|
492
|
+
if (this.globalRoot) {
|
|
493
|
+
process.env[envKey("global-dir")] = this.globalRoot;
|
|
494
|
+
if (this.globalBinDir)
|
|
495
|
+
process.env[binDirKey] = this.globalBinDir;
|
|
496
|
+
else delete process.env[binDirKey];
|
|
497
|
+
} else if (keepBinDir) {
|
|
498
|
+
if (binDirEnv === void 0) delete process.env[binDirKey];
|
|
499
|
+
else process.env[binDirKey] = binDirEnv;
|
|
500
|
+
}
|
|
451
501
|
process.env[kParentEnv] = JSON.stringify({
|
|
452
502
|
explicit,
|
|
453
503
|
env: Object.fromEntries(
|
|
@@ -724,13 +774,89 @@ var Config = class _Config {
|
|
|
724
774
|
/**
|
|
725
775
|
* Find the local config file and load both it and the user-level config in
|
|
726
776
|
* the XDG config home.
|
|
777
|
+
*
|
|
778
|
+
* When `args` select a `--global` command, the global project is used
|
|
779
|
+
* instead of the current one.
|
|
727
780
|
*/
|
|
728
|
-
async loadConfigFile() {
|
|
781
|
+
async loadConfigFile(args) {
|
|
729
782
|
await this.#maybeLoadConfigFile("user");
|
|
783
|
+
const g = args && this.#globalProject(args);
|
|
784
|
+
if (g?.switch) {
|
|
785
|
+
const { root } = g;
|
|
786
|
+
try {
|
|
787
|
+
ensureGlobalProject(root);
|
|
788
|
+
} catch (cause) {
|
|
789
|
+
throw error("Could not create the global project", {
|
|
790
|
+
code: "ECONFIG",
|
|
791
|
+
found: root,
|
|
792
|
+
cause
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
this.globalBinDir = g.binDir;
|
|
796
|
+
unload("project");
|
|
797
|
+
this.globalRoot = this.projectRoot = root;
|
|
798
|
+
} else if (g) {
|
|
799
|
+
this.#setupGlobal = { root: g.root, binDir: g.binDir };
|
|
800
|
+
}
|
|
730
801
|
this.projectRoot = dirname(find("project", this.projectRoot));
|
|
731
802
|
await this.#maybeLoadConfigFile("project");
|
|
732
803
|
return this;
|
|
733
804
|
}
|
|
805
|
+
// global project if `args` run a global command with --global, or
|
|
806
|
+
// `setup`. cli > env > user config, project config is not loaded yet.
|
|
807
|
+
// `switch`: use it as the project (not for the setup wizard)
|
|
808
|
+
#globalProject(args) {
|
|
809
|
+
const { values, positionals } = this.jack.parseRaw(args);
|
|
810
|
+
const cmd = getCommand(positionals[0]);
|
|
811
|
+
if (values.help || !cmd) return;
|
|
812
|
+
const setup = cmd === "setup";
|
|
813
|
+
if (!setup && !globalCommands.has(cmd)) return;
|
|
814
|
+
if (!setup) {
|
|
815
|
+
const env = process.env[envKey("global")];
|
|
816
|
+
const global = values.global ?? (env !== void 0 ? env === "1" : this.#defaults().global === true);
|
|
817
|
+
if (!global) return;
|
|
818
|
+
}
|
|
819
|
+
return {
|
|
820
|
+
root: this.#globalDir(values["global-dir"]),
|
|
821
|
+
binDir: this.#globalBinDir(args),
|
|
822
|
+
switch: !setup || values.path === true
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
#globalDir(cli) {
|
|
826
|
+
const dir = cli || process.env[envKey("global-dir")];
|
|
827
|
+
if (dir) return resolve(expandHome(dir));
|
|
828
|
+
const user = expandHome(
|
|
829
|
+
String(
|
|
830
|
+
this.#defaults()["global-dir"] || defaultValues["global-dir"]
|
|
831
|
+
)
|
|
832
|
+
);
|
|
833
|
+
if (!isAbsolute(user)) {
|
|
834
|
+
throw error("global-dir in the user config must be absolute", {
|
|
835
|
+
code: "ECONFIG",
|
|
836
|
+
found: user
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
return resolve(user);
|
|
840
|
+
}
|
|
841
|
+
// cli > env > user config, like `#globalProject`
|
|
842
|
+
#globalBinDir(args) {
|
|
843
|
+
const { values } = this.jack.parseRaw(args);
|
|
844
|
+
const dir = values["global-bin-dir"] || process.env[envKey("global-bin-dir")];
|
|
845
|
+
if (dir) return resolve(expandHome(dir));
|
|
846
|
+
const user = this.#defaults()["global-bin-dir"];
|
|
847
|
+
if (typeof user !== "string" || !user) return;
|
|
848
|
+
const p = expandHome(user);
|
|
849
|
+
if (!isAbsolute(p)) {
|
|
850
|
+
throw error(
|
|
851
|
+
"global-bin-dir in the user config must be absolute",
|
|
852
|
+
{
|
|
853
|
+
code: "ECONFIG",
|
|
854
|
+
found: p
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
return resolve(p);
|
|
859
|
+
}
|
|
734
860
|
/**
|
|
735
861
|
* Clear cached config values to force re-reading from updated files.
|
|
736
862
|
* @internal
|
|
@@ -748,9 +874,9 @@ var Config = class _Config {
|
|
|
748
874
|
this.values = void 0;
|
|
749
875
|
this.positionals = void 0;
|
|
750
876
|
this.command = void 0;
|
|
751
|
-
const { unload } = await import("./src-JC3ZUYWO.js");
|
|
752
|
-
|
|
753
|
-
|
|
877
|
+
const { unload: unload2 } = await import("./src-JC3ZUYWO.js");
|
|
878
|
+
unload2("user");
|
|
879
|
+
unload2("project");
|
|
754
880
|
await this.#maybeLoadConfigFile("user");
|
|
755
881
|
await this.#maybeLoadConfigFile("project");
|
|
756
882
|
this.parse(this.#originalArgs);
|
|
@@ -763,10 +889,10 @@ var Config = class _Config {
|
|
|
763
889
|
* Load the configuration and return a Promise to a
|
|
764
890
|
* {@link Config} object
|
|
765
891
|
*/
|
|
766
|
-
static async load(projectRoot = process.cwd(), argv = process.argv, reload2 = false) {
|
|
892
|
+
static async load(projectRoot = process.cwd(), argv = process.argv, reload2 = false, allowGlobal = true) {
|
|
767
893
|
if (this.#loaded && !reload2) return this.#loaded;
|
|
768
894
|
const a = new _Config(definition, projectRoot);
|
|
769
|
-
const b = await a.loadConfigFile();
|
|
895
|
+
const b = await a.loadConfigFile(allowGlobal ? argv : void 0);
|
|
770
896
|
this.#loaded = b.parse(argv);
|
|
771
897
|
return this.#loaded;
|
|
772
898
|
}
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
asDepID,
|
|
14
14
|
baseDepID,
|
|
15
15
|
splitDepID
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CAV7FKWQ.js";
|
|
17
17
|
import {
|
|
18
18
|
userAgent
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-M242QVJS.js";
|
|
20
20
|
import {
|
|
21
21
|
I
|
|
22
22
|
} from "./chunk-B6RIGNEO.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
} from "./chunk-XNLSTHDK.js";
|
|
26
26
|
import {
|
|
27
27
|
defaultRegistryName
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-BF5DRGRZ.js";
|
|
29
29
|
import {
|
|
30
30
|
error
|
|
31
31
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -802,12 +802,31 @@ var Comparator = class {
|
|
|
802
802
|
);
|
|
803
803
|
}
|
|
804
804
|
#parseCaret(comp) {
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
807
|
-
this.tuples.push(
|
|
805
|
+
const parsed = this.#parseX(comp);
|
|
806
|
+
if (isXMajor(parsed)) {
|
|
807
|
+
this.tuples.push(this.#getComparatorAny());
|
|
808
808
|
return;
|
|
809
809
|
}
|
|
810
|
-
const
|
|
810
|
+
const z = this.includePrerelease ? "0" : void 0;
|
|
811
|
+
if (isXMinor(parsed)) {
|
|
812
|
+
const [M2] = parsed;
|
|
813
|
+
this.tuples.push(
|
|
814
|
+
[">=", new Version(comp, M2, 0, 0, z, void 0)],
|
|
815
|
+
["<", new Version(comp, M2 + 1, 0, 0, "0", void 0)]
|
|
816
|
+
);
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
if (isXPatch(parsed)) {
|
|
820
|
+
const [M2, m2] = parsed;
|
|
821
|
+
this.tuples.push(
|
|
822
|
+
[">=", new Version(comp, M2, m2, 0, z, void 0)],
|
|
823
|
+
M2 !== 0 ? ["<", new Version(comp, M2 + 1, 0, 0, "0", void 0)] : ["<", new Version(comp, 0, m2 + 1, 0, "0", void 0)]
|
|
824
|
+
);
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
const [M, m, p, pr = z, build] = parsed;
|
|
828
|
+
const minv = new Version(comp, M, m, p, pr, build);
|
|
829
|
+
const min = [">=", minv];
|
|
811
830
|
if (minv.major !== 0) {
|
|
812
831
|
this.tuples.push(min, [
|
|
813
832
|
"<",
|
|
@@ -2323,6 +2342,7 @@ var parseRange = (range, includePrerelease = false) => {
|
|
|
2323
2342
|
rangeCache.set(key, parsed);
|
|
2324
2343
|
return parsed;
|
|
2325
2344
|
};
|
|
2345
|
+
var valid = (version) => !!parse(version);
|
|
2326
2346
|
var satisfies = (version, range, includePrerelease = false) => {
|
|
2327
2347
|
if (typeof version === "string") {
|
|
2328
2348
|
const parsed = parse(version);
|
|
@@ -2569,6 +2589,7 @@ export {
|
|
|
2569
2589
|
Range,
|
|
2570
2590
|
parse,
|
|
2571
2591
|
parseRange,
|
|
2592
|
+
valid,
|
|
2572
2593
|
satisfies,
|
|
2573
2594
|
inc,
|
|
2574
2595
|
rsort,
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
|
|
13
|
+
// ../../src/cli-sdk/src/shell.ts
|
|
14
|
+
import { existsSync } from "node:fs";
|
|
15
|
+
import { homedir } from "node:os";
|
|
16
|
+
var shells = /* @__PURE__ */ new Map([
|
|
17
|
+
["bash", "bash"],
|
|
18
|
+
["zsh", "zsh"],
|
|
19
|
+
["fish", "fish"],
|
|
20
|
+
["nu", "nu"],
|
|
21
|
+
["pwsh", "pwsh"],
|
|
22
|
+
["powershell", "pwsh"],
|
|
23
|
+
["sh", "sh"],
|
|
24
|
+
["dash", "sh"],
|
|
25
|
+
["ksh", "sh"],
|
|
26
|
+
["mksh", "sh"],
|
|
27
|
+
["ash", "sh"]
|
|
28
|
+
]);
|
|
29
|
+
var isSep = (c, win32) => c === "/" || win32 && c === "\\";
|
|
30
|
+
var homeRest = (path, home, win32) => !home ? void 0 : path === home ? "" : path.startsWith(home) && isSep(path[home.length], win32) ? path.slice(home.length) : void 0;
|
|
31
|
+
var prettyPath = (path, home = homedir(), win32 = process.platform === "win32") => {
|
|
32
|
+
const rest = homeRest(path, home, win32);
|
|
33
|
+
return rest === void 0 ? path : `~${rest}`;
|
|
34
|
+
};
|
|
35
|
+
var detectShell = (env = process.env, platform = process.platform) => {
|
|
36
|
+
const { SHELL } = env;
|
|
37
|
+
if (SHELL) {
|
|
38
|
+
const name = SHELL.replace(/^.*[\\/]/, "").replace(/\.exe$/i, "").toLowerCase();
|
|
39
|
+
return shells.get(name) ?? "unknown";
|
|
40
|
+
}
|
|
41
|
+
if (platform !== "win32") return "unknown";
|
|
42
|
+
const mods = (env.PSModulePath ?? "").split(";").filter(Boolean);
|
|
43
|
+
return mods.length >= 3 ? "pwsh" : "cmd";
|
|
44
|
+
};
|
|
45
|
+
var opts = ({
|
|
46
|
+
env = process.env,
|
|
47
|
+
platform = process.platform,
|
|
48
|
+
home = homedir()
|
|
49
|
+
}) => ({
|
|
50
|
+
env,
|
|
51
|
+
platform,
|
|
52
|
+
home,
|
|
53
|
+
win32: platform === "win32"
|
|
54
|
+
});
|
|
55
|
+
var escape = (s, chars, esc = "\\") => s.replace(chars, (c) => esc + c);
|
|
56
|
+
var posixInner = (dir, o, chars) => {
|
|
57
|
+
const { home, win32 } = opts(o);
|
|
58
|
+
const slash = (p2) => win32 ? p2.replace(/\\/g, "/") : p2;
|
|
59
|
+
const rest = homeRest(dir, home, win32);
|
|
60
|
+
if (rest !== void 0) return "$HOME" + escape(slash(rest), chars);
|
|
61
|
+
const p = win32 ? slash(dir).replace(
|
|
62
|
+
/^([a-z]):/i,
|
|
63
|
+
(_, d) => `/${d.toLowerCase()}`
|
|
64
|
+
) : dir;
|
|
65
|
+
return escape(p, chars);
|
|
66
|
+
};
|
|
67
|
+
var shChars = /[\\"$`]/g;
|
|
68
|
+
var posixPath = (dir, o = {}) => `"${posixInner(dir, o, shChars)}"`;
|
|
69
|
+
var fishPath = (dir, o = {}) => `"${posixInner(dir, o, /[\\"$]/g)}"`;
|
|
70
|
+
var shellPathCommand = (shell, dir, o = {}) => {
|
|
71
|
+
const { home, win32 } = opts(o);
|
|
72
|
+
const rest = homeRest(dir, home, win32);
|
|
73
|
+
switch (shell) {
|
|
74
|
+
case "fish":
|
|
75
|
+
return `fish_add_path ${fishPath(dir, o)}`;
|
|
76
|
+
case "nu":
|
|
77
|
+
return `$env.PATH = ($env.PATH | prepend "${escape(dir, /[\\"]/g)}")`;
|
|
78
|
+
case "pwsh": {
|
|
79
|
+
const p = rest === void 0 ? escape(dir, /[`"$]/g, "`") : "$HOME" + escape(rest, /[`"$]/g, "`");
|
|
80
|
+
return `$env:PATH += "${win32 ? ";" : ":"}${p}"`;
|
|
81
|
+
}
|
|
82
|
+
case "cmd":
|
|
83
|
+
return `set "PATH=%PATH%;${rest === void 0 ? dir : "%USERPROFILE%" + rest}"`;
|
|
84
|
+
default:
|
|
85
|
+
return `export PATH="${posixInner(dir, o, shChars)}:$PATH"`;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var shellRcFile = (shell, o = {}) => {
|
|
89
|
+
const { env, platform, home, win32 } = opts(o);
|
|
90
|
+
switch (shell) {
|
|
91
|
+
case "zsh":
|
|
92
|
+
return prettyPath(`${env.ZDOTDIR || home}/.zshrc`, home, win32);
|
|
93
|
+
case "bash": {
|
|
94
|
+
const has = (f2) => existsSync(`${home}/${f2}`);
|
|
95
|
+
if (platform !== "darwin" && has(".bashrc")) return "~/.bashrc";
|
|
96
|
+
const f = [".bash_profile", ".bash_login"].find(has);
|
|
97
|
+
return `~/${f ?? ".profile"}`;
|
|
98
|
+
}
|
|
99
|
+
case "sh":
|
|
100
|
+
return env.ENV ? prettyPath(env.ENV, home, win32) : "~/.profile";
|
|
101
|
+
case "pwsh":
|
|
102
|
+
return "$PROFILE";
|
|
103
|
+
default:
|
|
104
|
+
return void 0;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
prettyPath,
|
|
110
|
+
detectShell,
|
|
111
|
+
posixPath,
|
|
112
|
+
fishPath,
|
|
113
|
+
shellPathCommand,
|
|
114
|
+
shellRcFile
|
|
115
|
+
};
|
|
@@ -12,17 +12,17 @@ var require = _vlt_createRequire(import.meta.filename);
|
|
|
12
12
|
import {
|
|
13
13
|
addKey,
|
|
14
14
|
asDependency
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-C4RJ4NNS.js";
|
|
16
16
|
import {
|
|
17
|
-
|
|
18
|
-
} from "./chunk-
|
|
17
|
+
parseSpecArg
|
|
18
|
+
} from "./chunk-7M2VTFLP.js";
|
|
19
19
|
import {
|
|
20
20
|
joinDepIDTuple,
|
|
21
21
|
splitDepID
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CAV7FKWQ.js";
|
|
23
23
|
import {
|
|
24
24
|
Spec
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-6D3QAFNZ.js";
|
|
26
26
|
|
|
27
27
|
// ../../src/cli-sdk/src/parse-add-remove-args.ts
|
|
28
28
|
import { isAbsolute, relative, resolve } from "node:path";
|
|
@@ -68,13 +68,6 @@ var rebaseFileSpec = (spec, importerPath, scurryCwd, specOptions, monorepo) => {
|
|
|
68
68
|
if (rebasedPath === spec.file) return spec;
|
|
69
69
|
return Spec.parseArgs(rebasedPath, specOptions);
|
|
70
70
|
};
|
|
71
|
-
var parseArg = (item, options) => {
|
|
72
|
-
try {
|
|
73
|
-
return Spec.parseArgs(item, options);
|
|
74
|
-
} catch (er) {
|
|
75
|
-
throw asUnknownSpecPrefix(er);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
71
|
var parseAddArgs = (config, scurry, monorepo) => {
|
|
79
72
|
const add = new AddImportersDependenciesMapImpl();
|
|
80
73
|
const items = config.positionals;
|
|
@@ -84,7 +77,7 @@ var parseAddArgs = (config, scurry, monorepo) => {
|
|
|
84
77
|
const parsedItems = [];
|
|
85
78
|
let hasFileSpecs = false;
|
|
86
79
|
for (const item of items) {
|
|
87
|
-
const spec =
|
|
80
|
+
const spec = parseSpecArg(item, specOptions);
|
|
88
81
|
parsedItems.push({ spec, type });
|
|
89
82
|
if (spec.type === "file") hasFileSpecs = true;
|
|
90
83
|
add.modifiedDependencies = true;
|