@vltpkg/cli-js 1.3.6 → 1.3.8
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-SFEGWG3Y.js → access-WLKANIOE.js} +8 -8
- package/{bugs-X2JHO4WZ.js → bugs-5Q3QSTWP.js} +17 -17
- package/{build-BK4ITRPX.js → build-XSFR63AW.js} +9 -9
- package/{cache-JRW72UJE.js → cache-UVPK5J5A.js} +13 -13
- package/chunk-3U6QWN62.js +45 -0
- package/{chunk-2XDF3JBH.js → chunk-43HNQWPQ.js} +6 -6
- package/chunk-4JAZZRKR.js +76 -0
- package/{chunk-F6ZN6TTL.js → chunk-5KOLUYXH.js} +61 -11
- package/{chunk-TY2UJ3SA.js → chunk-6BQKR2FM.js} +1 -1
- package/{chunk-PBBULTAG.js → chunk-6D54UN4T.js} +1 -1
- package/{chunk-FOSDT7YU.js → chunk-6P5CFJR7.js} +4 -4
- package/{chunk-J4NHRZX6.js → chunk-A2TSRXZD.js} +1 -1
- package/{chunk-IXAHSTBN.js → chunk-BGA3WB7H.js} +86 -10
- package/{chunk-GDYDW277.js → chunk-CB65DPZ2.js} +195 -195
- package/{chunk-VI7V6OCC.js → chunk-DL3H4EMY.js} +46 -19
- package/{chunk-O2B5SLP7.js → chunk-EL4GVZK5.js} +2 -2
- package/{chunk-HD6TAM7A.js → chunk-FIUUAQGC.js} +5 -5
- package/{chunk-64VFL4WI.js → chunk-GZ5MYMBT.js} +1 -1
- package/{chunk-X2WYIUFQ.js → chunk-H77JYU7F.js} +1 -1
- package/{chunk-BP3PQ67D.js → chunk-IBGFQR23.js} +16 -0
- package/{chunk-CRGWLUGC.js → chunk-IHXJVKAE.js} +1 -1
- package/{chunk-2XFFMF6G.js → chunk-IUL6MPP6.js} +4 -4
- package/{chunk-BCANUHR3.js → chunk-KMOOTBHM.js} +5 -1
- package/{chunk-WGSYVB4F.js → chunk-NWHKSRO3.js} +268 -21
- package/{chunk-JELA46YR.js → chunk-OAP2ROTL.js} +1 -1
- package/{chunk-AFUXQ3P4.js → chunk-OWMR2EDW.js} +1 -1
- package/{chunk-RAE3LNUK.js → chunk-PJJCFMLW.js} +3 -3
- package/chunk-QNDM4DVO.js +25 -0
- package/{chunk-XU5WNX4S.js → chunk-SE2FSMBR.js} +1 -0
- package/{chunk-JIQBZ2UT.js → chunk-SV4WK3KX.js} +2 -2
- package/{chunk-LHIDMYN2.js → chunk-TLY4VGMH.js} +1 -1
- package/{chunk-WS7BNE5S.js → chunk-WHLYMMI2.js} +3 -3
- package/{chunk-LFCZGP2L.js → chunk-WKA5UYNA.js} +3 -10
- package/{chunk-2XD7RUKI.js → chunk-XCDLOQZZ.js} +3 -3
- package/{chunk-TOKUDCSW.js → chunk-XDSZO74H.js} +6 -6
- package/{ci-6GQ3GMJK.js → ci-EDRETPUF.js} +10 -10
- package/cli-package.json +3 -1
- package/{config-6VRNS5F3.js → config-MVNXGEOQ.js} +8 -8
- package/{config-5VN6JXGK.js → config-OKBXU7TU.js} +10 -10
- package/{create-K7ROUCVJ.js → create-R7BXYJSU.js} +18 -18
- package/{deprecate-WRSZJ2WG.js → deprecate-YSUKBKQM.js} +11 -11
- package/{dist-tag-NSTCFNON.js → dist-tag-MIGYSR4F.js} +8 -8
- package/{docs-E2PATRJS.js → docs-4WVIN75H.js} +17 -17
- package/{exec-SV4RXF2E.js → exec-IXHDQLAM.js} +26 -18
- package/{exec-cache-K4LBRSRD.js → exec-cache-EA7GHIK7.js} +16 -16
- package/{exec-local-RT27P325.js → exec-local-GM4LH56M.js} +15 -15
- package/{help-XXKA42B7.js → help-TCXGBICU.js} +4 -4
- package/{init-IYCFQJPW.js → init-MWZDWQHM.js} +10 -10
- package/{install-RRCUQ34D.js → install-HPI5HU3C.js} +16 -16
- package/{list-WFYB66G7.js → list-2CX6REPJ.js} +21 -19
- package/{login-K6HTWO4J.js → login-RAY23CVG.js} +12 -12
- package/{logout-F6EI7WST.js → logout-ICB5OMGY.js} +8 -8
- package/outdated-FYHPXRMT.js +533 -0
- package/{pack-FX24JZR4.js → pack-E5MNPQXK.js} +11 -11
- package/package.json +1 -1
- package/{ping-6QRL622S.js → ping-REQ2KSAR.js} +8 -8
- package/{pkg-FPWX4VUE.js → pkg-YB4GSRII.js} +11 -11
- package/{profile-WAI5BGPU.js → profile-GKBW6GRI.js} +8 -8
- package/{publish-GI7T7TE2.js → publish-4ZQJYYLF.js} +17 -17
- package/{query-GC2DGBWT.js → query-SKXBF3MJ.js} +21 -19
- package/{registry-PY2L5ZWC.js → registry-MQJJCWJY.js} +5 -5
- package/registry-client-src-revalidate.js +58 -9
- package/{repo-CFXNFSY7.js → repo-ACPTZI2C.js} +17 -17
- package/{reporter-5QKWEQNH.js → reporter-4KK2JNGO.js} +10 -10
- package/{run-VFHTHV5N.js → run-YW3ITX2A.js} +15 -15
- package/{run-exec-OJEIP3WL.js → run-exec-7VQX3OFG.js} +15 -15
- package/security-archive-src-update-expired.js +1 -1
- package/{setup-CCM2QAVA.js → setup-PLEKCMXN.js} +15 -15
- package/{src-3MEJQYBG.js → src-GP7VLT7P.js} +2 -2
- package/{src-LLE3Q5NY.js → src-PXDFMQ6W.js} +6 -4
- package/{src-54SW7RQE.js → src-XQ7KVUVN.js} +14 -14
- package/{token-P5N54F4D.js → token-GB7RPE5J.js} +8 -8
- package/{uninstall-QJA3X4GY.js → uninstall-RLCECX37.js} +12 -12
- package/{unpublish-IAB6LNVC.js → unpublish-3ZXEAVHF.js} +8 -8
- package/{update-VZEF6QRY.js → update-VDZP6EZN.js} +25 -16
- package/{version-A6FPEDV5.js → version-MRELJPOK.js} +10 -10
- package/{view-SA6QU2NW.js → view-LCXMTGCJ.js} +76 -52
- 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-YDNKCWU7.js → whoami-PNRDBS45.js} +8 -8
- package/chunk-MXRSLXAC.js +0 -75
|
@@ -11,17 +11,19 @@ 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-DL3H4EMY.js";
|
|
15
15
|
import {
|
|
16
|
+
RollbackRemove,
|
|
17
|
+
cmdShim,
|
|
16
18
|
findCmdShimIfExists,
|
|
17
19
|
install
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-NWHKSRO3.js";
|
|
19
21
|
import {
|
|
20
22
|
PathScurry
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CB65DPZ2.js";
|
|
22
24
|
import {
|
|
23
25
|
Spec
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-GZ5MYMBT.js";
|
|
25
27
|
import {
|
|
26
28
|
walkUp
|
|
27
29
|
} from "./chunk-HTOTG4TS.js";
|
|
@@ -30,7 +32,7 @@ import {
|
|
|
30
32
|
} from "./chunk-XNLSTHDK.js";
|
|
31
33
|
import {
|
|
32
34
|
parseScope
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-IBGFQR23.js";
|
|
34
36
|
import {
|
|
35
37
|
error
|
|
36
38
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -221,7 +223,7 @@ var vlxInstall = async (spec, options, promptFn) => {
|
|
|
221
223
|
};
|
|
222
224
|
|
|
223
225
|
// ../../src/vlx/src/resolve.ts
|
|
224
|
-
import { resolve as
|
|
226
|
+
import { resolve as resolve7 } from "node:path";
|
|
225
227
|
|
|
226
228
|
// ../../src/vlx/src/add-to-path.ts
|
|
227
229
|
import { delimiter } from "node:path";
|
|
@@ -279,6 +281,72 @@ var findPackage = async (name, projectRoot, packageJson) => {
|
|
|
279
281
|
}
|
|
280
282
|
};
|
|
281
283
|
|
|
284
|
+
// ../../src/vlx/src/local.ts
|
|
285
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
286
|
+
import {
|
|
287
|
+
mkdir as mkdir2,
|
|
288
|
+
mkdtemp,
|
|
289
|
+
readFile,
|
|
290
|
+
realpath,
|
|
291
|
+
rename,
|
|
292
|
+
rm as rm2
|
|
293
|
+
} from "node:fs/promises";
|
|
294
|
+
import { basename as basename2, resolve as resolve6 } from "node:path";
|
|
295
|
+
import { pathToFileURL as pathToFileURL2 } from "node:url";
|
|
296
|
+
var localDir = async (spec) => {
|
|
297
|
+
const { type, file } = spec.final;
|
|
298
|
+
if (type !== "file" || !file) return;
|
|
299
|
+
const dir = resolve6(file);
|
|
300
|
+
return await dirExists(dir) ? dir : void 0;
|
|
301
|
+
};
|
|
302
|
+
var vlxLocal = async (dir, packageJson) => {
|
|
303
|
+
const manifest = packageJson.read(dir);
|
|
304
|
+
const bins = Object.entries(manifest.bin ?? {});
|
|
305
|
+
const heads = await Promise.all(
|
|
306
|
+
bins.map(async ([k, v]) => {
|
|
307
|
+
const target = resolve6(dir, v);
|
|
308
|
+
const data = await readFile(target, "utf8").catch(
|
|
309
|
+
(cause) => {
|
|
310
|
+
throw error(`Bin target not found: ${k} -> ${v}`, {
|
|
311
|
+
path: target,
|
|
312
|
+
cause
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
return `\0${k}\0${v}\0${data.trim().split(/\r*\n/)[0]}`;
|
|
317
|
+
})
|
|
318
|
+
);
|
|
319
|
+
const key = createHash2("sha512").update(dir + heads.join("")).digest("hex").substring(0, 16);
|
|
320
|
+
const cache = new XDG("vlt/vlx-local").cache();
|
|
321
|
+
await mkdir2(cache, { recursive: true });
|
|
322
|
+
const path = resolve6(await realpath(cache), key);
|
|
323
|
+
if (!await dirExists(path)) {
|
|
324
|
+
const tmp = await mkdtemp(`${path}-`);
|
|
325
|
+
const remover = new RollbackRemove();
|
|
326
|
+
await Promise.all(
|
|
327
|
+
bins.map(
|
|
328
|
+
([k, v]) => cmdShim(
|
|
329
|
+
resolve6(dir, v),
|
|
330
|
+
resolve6(tmp, "node_modules/.bin", k),
|
|
331
|
+
remover
|
|
332
|
+
)
|
|
333
|
+
)
|
|
334
|
+
);
|
|
335
|
+
remover.confirm();
|
|
336
|
+
await rename(tmp, path).catch(async (er) => {
|
|
337
|
+
if (!await dirExists(path)) throw er;
|
|
338
|
+
await rm2(tmp, { recursive: true, force: true });
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return {
|
|
342
|
+
path,
|
|
343
|
+
name: manifest.name ?? basename2(dir),
|
|
344
|
+
version: manifest.version,
|
|
345
|
+
resolved: String(pathToFileURL2(dir)),
|
|
346
|
+
arg0: inferDefaultExecutable(manifest)?.[0]
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
|
|
282
350
|
// ../../src/vlx/src/resolve.ts
|
|
283
351
|
var vlxResolve = async (positionals, options, promptFn) => {
|
|
284
352
|
const noArgs = positionals.length === 0;
|
|
@@ -289,22 +357,30 @@ var vlxResolve = async (positionals, options, promptFn) => {
|
|
|
289
357
|
if (!arg0) {
|
|
290
358
|
return void 0;
|
|
291
359
|
}
|
|
292
|
-
const found = await findExecutable(arg0, projectRoot);
|
|
360
|
+
const found = arg0 === "." || arg0 === ".." || /[\\/]/.test(arg0) ? void 0 : await findExecutable(arg0, projectRoot);
|
|
293
361
|
if (found) return found;
|
|
294
362
|
pkgOption = arg0;
|
|
295
363
|
arg0 = void 0;
|
|
296
364
|
}
|
|
297
365
|
let pkgTarget = void 0;
|
|
366
|
+
let dir;
|
|
298
367
|
if (pkgOption) {
|
|
299
|
-
const pkgSpec = Spec.parseArgs(
|
|
368
|
+
const pkgSpec = Spec.parseArgs(
|
|
369
|
+
// bare . / .. are paths, not names
|
|
370
|
+
pkgOption === "." || pkgOption === ".." ? `${pkgOption}/` : pkgOption,
|
|
371
|
+
options
|
|
372
|
+
);
|
|
300
373
|
const { name, bareSpec } = pkgSpec.final;
|
|
301
374
|
if (!bareSpec) {
|
|
302
375
|
pkgTarget = await findPackage(name, projectRoot, packageJson);
|
|
376
|
+
} else {
|
|
377
|
+
dir = await localDir(pkgSpec);
|
|
378
|
+
if (dir) pkgTarget = await vlxLocal(dir, packageJson);
|
|
303
379
|
}
|
|
304
380
|
pkgTarget ??= await vlxInstall(pkgSpec, options, promptFn);
|
|
305
381
|
}
|
|
306
382
|
if (pkgTarget) {
|
|
307
|
-
addToPATH(
|
|
383
|
+
addToPATH(resolve7(pkgTarget.path, "node_modules/.bin"));
|
|
308
384
|
if (noArgs) return void 0;
|
|
309
385
|
}
|
|
310
386
|
if (!arg0) {
|
|
@@ -316,7 +392,7 @@ var vlxResolve = async (positionals, options, promptFn) => {
|
|
|
316
392
|
arg0 = pkgTarget.arg0;
|
|
317
393
|
if (!arg0) {
|
|
318
394
|
const { name, version, bin } = packageJson.read(
|
|
319
|
-
|
|
395
|
+
dir ?? resolve7(pkgTarget.path, "node_modules", pkgTarget.name)
|
|
320
396
|
);
|
|
321
397
|
throw error("Package executable could not be inferred", {
|
|
322
398
|
name,
|
|
@@ -13,10 +13,10 @@ import {
|
|
|
13
13
|
graphRun,
|
|
14
14
|
graphRunSync,
|
|
15
15
|
joinDepIDTuple
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SV4WK3KX.js";
|
|
17
17
|
import {
|
|
18
18
|
Spec
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-GZ5MYMBT.js";
|
|
20
20
|
import {
|
|
21
21
|
load,
|
|
22
22
|
parse as parse2,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
parse,
|
|
44
44
|
parseRange,
|
|
45
45
|
satisfies
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-IBGFQR23.js";
|
|
47
47
|
import {
|
|
48
48
|
error
|
|
49
49
|
} from "./chunk-WZWDS3W4.js";
|
|
@@ -363,198 +363,6 @@ var require_promise_retry = __commonJS({
|
|
|
363
363
|
}
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
-
// ../../src/git/src/spawn.ts
|
|
367
|
-
var import_promise_retry = __toESM(require_promise_retry(), 1);
|
|
368
|
-
|
|
369
|
-
// ../../src/git/src/make-error.ts
|
|
370
|
-
var connectionErrorRe = new RegExp(
|
|
371
|
-
[
|
|
372
|
-
"remote error: Internal Server Error",
|
|
373
|
-
"The remote end hung up unexpectedly",
|
|
374
|
-
"Connection timed out",
|
|
375
|
-
"Operation timed out",
|
|
376
|
-
"Failed to connect to .* Timed out",
|
|
377
|
-
"Connection reset by peer",
|
|
378
|
-
"SSL_ERROR_SYSCALL",
|
|
379
|
-
"The requested URL returned error: 503"
|
|
380
|
-
].join("|")
|
|
381
|
-
);
|
|
382
|
-
var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
|
|
383
|
-
var makeError = (result) => connectionErrorRe.test(result.stderr) ? [
|
|
384
|
-
(n) => n < 3,
|
|
385
|
-
error("A git connection error occurred", result)
|
|
386
|
-
] : missingPathspecRe.test(result.stderr) ? [null, error("The git reference could not be found", result)] : [null, error("An unknown git error occurred", result)];
|
|
387
|
-
|
|
388
|
-
// ../../src/git/src/opts.ts
|
|
389
|
-
var gitEnv = {
|
|
390
|
-
GIT_ASKPASS: "echo",
|
|
391
|
-
GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
|
|
392
|
-
};
|
|
393
|
-
var opts = (opts2 = {}) => ({
|
|
394
|
-
acceptFail: true,
|
|
395
|
-
...opts2,
|
|
396
|
-
env: opts2.env ?? { ...gitEnv, ...process.env },
|
|
397
|
-
stdio: "pipe",
|
|
398
|
-
stdioString: true,
|
|
399
|
-
shell: false
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
// ../../src/git/src/which.ts
|
|
403
|
-
var gitPath = void 0;
|
|
404
|
-
var which = (opts2 = {}) => {
|
|
405
|
-
if (opts2.git) {
|
|
406
|
-
return opts2.git;
|
|
407
|
-
}
|
|
408
|
-
let whichError = void 0;
|
|
409
|
-
if (opts2.git !== false) {
|
|
410
|
-
if (!gitPath) {
|
|
411
|
-
try {
|
|
412
|
-
gitPath = whichSync("git");
|
|
413
|
-
} catch (er) {
|
|
414
|
-
whichError = er;
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
if (!gitPath || opts2.git === false) {
|
|
419
|
-
return error(
|
|
420
|
-
"No git binary found in $PATH",
|
|
421
|
-
{
|
|
422
|
-
code: "ENOGIT",
|
|
423
|
-
cause: whichError
|
|
424
|
-
},
|
|
425
|
-
which
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
return gitPath;
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
// ../../src/git/src/spawn.ts
|
|
432
|
-
var spawn = async (gitArgs, opts2 = {}) => {
|
|
433
|
-
const gitPath2 = which(opts2);
|
|
434
|
-
if (gitPath2 instanceof Error) {
|
|
435
|
-
throw gitPath2;
|
|
436
|
-
}
|
|
437
|
-
const args = opts2.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
|
|
438
|
-
const retryOpts = {
|
|
439
|
-
retries: opts2["fetch-retries"] || 3,
|
|
440
|
-
factor: opts2["fetch-retry-factor"] || 2,
|
|
441
|
-
maxTimeout: opts2["fetch-retry-maxtimeout"] || 6e4,
|
|
442
|
-
minTimeout: opts2["fetch-retry-mintimeout"] || 1e3
|
|
443
|
-
};
|
|
444
|
-
return (0, import_promise_retry.default)(async (retryFn, num) => {
|
|
445
|
-
const result = await promiseSpawn(gitPath2, args, opts(opts2));
|
|
446
|
-
if (result.status || result.signal) {
|
|
447
|
-
const [shouldRetry, gitError] = makeError(result);
|
|
448
|
-
if (!shouldRetry?.(num)) {
|
|
449
|
-
throw gitError;
|
|
450
|
-
}
|
|
451
|
-
retryFn(gitError);
|
|
452
|
-
}
|
|
453
|
-
return result;
|
|
454
|
-
}, retryOpts);
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
// ../../src/git/src/is.ts
|
|
458
|
-
import { stat } from "node:fs/promises";
|
|
459
|
-
var is = ({ cwd = process.cwd() } = {}) => stat(cwd + "/.git").then(
|
|
460
|
-
() => true,
|
|
461
|
-
() => false
|
|
462
|
-
);
|
|
463
|
-
|
|
464
|
-
// ../../src/git/src/is-clean.ts
|
|
465
|
-
var isClean = async (opts2 = {}) => {
|
|
466
|
-
const result = await spawn(
|
|
467
|
-
["status", "--porcelain=v1", "-uno"],
|
|
468
|
-
opts2
|
|
469
|
-
);
|
|
470
|
-
if (result.status || result.signal) {
|
|
471
|
-
throw error("git isClean check failed", result);
|
|
472
|
-
}
|
|
473
|
-
for (const line of result.stdout.split(/\r?\n+/)) {
|
|
474
|
-
if (line.trim()) return false;
|
|
475
|
-
}
|
|
476
|
-
return true;
|
|
477
|
-
};
|
|
478
|
-
|
|
479
|
-
// ../../src/git-scp-url/src/index.ts
|
|
480
|
-
var knownProtocols = /* @__PURE__ */ new Set([
|
|
481
|
-
"http:",
|
|
482
|
-
"https:",
|
|
483
|
-
"git:",
|
|
484
|
-
"git+ssh:",
|
|
485
|
-
"git+https:",
|
|
486
|
-
"ssh:"
|
|
487
|
-
]);
|
|
488
|
-
var memo = /* @__PURE__ */ new Map();
|
|
489
|
-
var correctProtocol = (arg) => {
|
|
490
|
-
const firstColon = arg.indexOf(":");
|
|
491
|
-
const proto = arg.slice(0, firstColon + 1);
|
|
492
|
-
const doubleSlash = arg.indexOf("//");
|
|
493
|
-
if (knownProtocols.has(proto)) {
|
|
494
|
-
if (doubleSlash === firstColon + 1) {
|
|
495
|
-
return arg;
|
|
496
|
-
}
|
|
497
|
-
return proto + "//" + arg.slice(firstColon + 1);
|
|
498
|
-
}
|
|
499
|
-
const firstAt = arg.indexOf("@");
|
|
500
|
-
if (firstAt > -1) {
|
|
501
|
-
if (firstAt > firstColon) {
|
|
502
|
-
return `git+ssh://${arg}`;
|
|
503
|
-
} else {
|
|
504
|
-
return arg;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
return proto + "//" + arg.slice(firstColon + 1);
|
|
508
|
-
};
|
|
509
|
-
var correctUrl = (url) => {
|
|
510
|
-
const firstAt = url.indexOf("@");
|
|
511
|
-
const lastHash = url.lastIndexOf("#");
|
|
512
|
-
let firstColon = url.indexOf(":");
|
|
513
|
-
let lastColon = url.lastIndexOf(
|
|
514
|
-
":",
|
|
515
|
-
lastHash > -1 ? lastHash : Infinity
|
|
516
|
-
);
|
|
517
|
-
let corrected = url;
|
|
518
|
-
if (lastColon > firstAt) {
|
|
519
|
-
corrected = url.slice(0, lastColon) + "/" + url.slice(lastColon + 1);
|
|
520
|
-
firstColon = corrected.indexOf(":");
|
|
521
|
-
lastColon = corrected.lastIndexOf(":");
|
|
522
|
-
}
|
|
523
|
-
if (firstColon === -1 && !url.includes("//")) {
|
|
524
|
-
corrected = `git+ssh://${corrected}`;
|
|
525
|
-
}
|
|
526
|
-
return corrected;
|
|
527
|
-
};
|
|
528
|
-
var gitScpURL = (url) => {
|
|
529
|
-
const memoized = memo.get(url);
|
|
530
|
-
if (memoized) return memoized;
|
|
531
|
-
try {
|
|
532
|
-
const result = new URL(url);
|
|
533
|
-
if (result.hostname) {
|
|
534
|
-
memo.set(url, result);
|
|
535
|
-
return result;
|
|
536
|
-
}
|
|
537
|
-
} catch {
|
|
538
|
-
}
|
|
539
|
-
try {
|
|
540
|
-
const result = new URL(correctUrl(correctProtocol(url)));
|
|
541
|
-
if (result.hostname) {
|
|
542
|
-
memo.set(url, result);
|
|
543
|
-
return result;
|
|
544
|
-
}
|
|
545
|
-
} catch {
|
|
546
|
-
}
|
|
547
|
-
return void 0;
|
|
548
|
-
};
|
|
549
|
-
|
|
550
|
-
// ../../src/git/src/clone.ts
|
|
551
|
-
import { mkdir, stat as stat2 } from "node:fs/promises";
|
|
552
|
-
import { basename, resolve as resolve2 } from "node:path";
|
|
553
|
-
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
554
|
-
|
|
555
|
-
// ../../src/git/src/is-windows.ts
|
|
556
|
-
var isWindows = (opts2) => (opts2.fakePlatform || process.platform) === "win32";
|
|
557
|
-
|
|
558
366
|
// ../../src/pick-manifest/src/index.ts
|
|
559
367
|
import { readFileSync } from "node:fs";
|
|
560
368
|
var parsedNodeVersion = Version.parse(process.version);
|
|
@@ -784,6 +592,198 @@ function pickManifest(packument, wanted, opts2 = {}) {
|
|
|
784
592
|
return found?.mani;
|
|
785
593
|
}
|
|
786
594
|
|
|
595
|
+
// ../../src/git/src/spawn.ts
|
|
596
|
+
var import_promise_retry = __toESM(require_promise_retry(), 1);
|
|
597
|
+
|
|
598
|
+
// ../../src/git/src/make-error.ts
|
|
599
|
+
var connectionErrorRe = new RegExp(
|
|
600
|
+
[
|
|
601
|
+
"remote error: Internal Server Error",
|
|
602
|
+
"The remote end hung up unexpectedly",
|
|
603
|
+
"Connection timed out",
|
|
604
|
+
"Operation timed out",
|
|
605
|
+
"Failed to connect to .* Timed out",
|
|
606
|
+
"Connection reset by peer",
|
|
607
|
+
"SSL_ERROR_SYSCALL",
|
|
608
|
+
"The requested URL returned error: 503"
|
|
609
|
+
].join("|")
|
|
610
|
+
);
|
|
611
|
+
var missingPathspecRe = /pathspec .* did not match any file\(s\) known to git/;
|
|
612
|
+
var makeError = (result) => connectionErrorRe.test(result.stderr) ? [
|
|
613
|
+
(n) => n < 3,
|
|
614
|
+
error("A git connection error occurred", result)
|
|
615
|
+
] : missingPathspecRe.test(result.stderr) ? [null, error("The git reference could not be found", result)] : [null, error("An unknown git error occurred", result)];
|
|
616
|
+
|
|
617
|
+
// ../../src/git/src/opts.ts
|
|
618
|
+
var gitEnv = {
|
|
619
|
+
GIT_ASKPASS: "echo",
|
|
620
|
+
GIT_SSH_COMMAND: "ssh -oStrictHostKeyChecking=accept-new"
|
|
621
|
+
};
|
|
622
|
+
var opts = (opts2 = {}) => ({
|
|
623
|
+
acceptFail: true,
|
|
624
|
+
...opts2,
|
|
625
|
+
env: opts2.env ?? { ...gitEnv, ...process.env },
|
|
626
|
+
stdio: "pipe",
|
|
627
|
+
stdioString: true,
|
|
628
|
+
shell: false
|
|
629
|
+
});
|
|
630
|
+
|
|
631
|
+
// ../../src/git/src/which.ts
|
|
632
|
+
var gitPath = void 0;
|
|
633
|
+
var which = (opts2 = {}) => {
|
|
634
|
+
if (opts2.git) {
|
|
635
|
+
return opts2.git;
|
|
636
|
+
}
|
|
637
|
+
let whichError = void 0;
|
|
638
|
+
if (opts2.git !== false) {
|
|
639
|
+
if (!gitPath) {
|
|
640
|
+
try {
|
|
641
|
+
gitPath = whichSync("git");
|
|
642
|
+
} catch (er) {
|
|
643
|
+
whichError = er;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (!gitPath || opts2.git === false) {
|
|
648
|
+
return error(
|
|
649
|
+
"No git binary found in $PATH",
|
|
650
|
+
{
|
|
651
|
+
code: "ENOGIT",
|
|
652
|
+
cause: whichError
|
|
653
|
+
},
|
|
654
|
+
which
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
return gitPath;
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
// ../../src/git/src/spawn.ts
|
|
661
|
+
var spawn = async (gitArgs, opts2 = {}) => {
|
|
662
|
+
const gitPath2 = which(opts2);
|
|
663
|
+
if (gitPath2 instanceof Error) {
|
|
664
|
+
throw gitPath2;
|
|
665
|
+
}
|
|
666
|
+
const args = opts2.allowReplace || gitArgs[0] === "--no-replace-objects" ? gitArgs : ["--no-replace-objects", ...gitArgs];
|
|
667
|
+
const retryOpts = {
|
|
668
|
+
retries: opts2["fetch-retries"] || 3,
|
|
669
|
+
factor: opts2["fetch-retry-factor"] || 2,
|
|
670
|
+
maxTimeout: opts2["fetch-retry-maxtimeout"] || 6e4,
|
|
671
|
+
minTimeout: opts2["fetch-retry-mintimeout"] || 1e3
|
|
672
|
+
};
|
|
673
|
+
return (0, import_promise_retry.default)(async (retryFn, num) => {
|
|
674
|
+
const result = await promiseSpawn(gitPath2, args, opts(opts2));
|
|
675
|
+
if (result.status || result.signal) {
|
|
676
|
+
const [shouldRetry, gitError] = makeError(result);
|
|
677
|
+
if (!shouldRetry?.(num)) {
|
|
678
|
+
throw gitError;
|
|
679
|
+
}
|
|
680
|
+
retryFn(gitError);
|
|
681
|
+
}
|
|
682
|
+
return result;
|
|
683
|
+
}, retryOpts);
|
|
684
|
+
};
|
|
685
|
+
|
|
686
|
+
// ../../src/git/src/is.ts
|
|
687
|
+
import { stat } from "node:fs/promises";
|
|
688
|
+
var is = ({ cwd = process.cwd() } = {}) => stat(cwd + "/.git").then(
|
|
689
|
+
() => true,
|
|
690
|
+
() => false
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
// ../../src/git/src/is-clean.ts
|
|
694
|
+
var isClean = async (opts2 = {}) => {
|
|
695
|
+
const result = await spawn(
|
|
696
|
+
["status", "--porcelain=v1", "-uno"],
|
|
697
|
+
opts2
|
|
698
|
+
);
|
|
699
|
+
if (result.status || result.signal) {
|
|
700
|
+
throw error("git isClean check failed", result);
|
|
701
|
+
}
|
|
702
|
+
for (const line of result.stdout.split(/\r?\n+/)) {
|
|
703
|
+
if (line.trim()) return false;
|
|
704
|
+
}
|
|
705
|
+
return true;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
// ../../src/git-scp-url/src/index.ts
|
|
709
|
+
var knownProtocols = /* @__PURE__ */ new Set([
|
|
710
|
+
"http:",
|
|
711
|
+
"https:",
|
|
712
|
+
"git:",
|
|
713
|
+
"git+ssh:",
|
|
714
|
+
"git+https:",
|
|
715
|
+
"ssh:"
|
|
716
|
+
]);
|
|
717
|
+
var memo = /* @__PURE__ */ new Map();
|
|
718
|
+
var correctProtocol = (arg) => {
|
|
719
|
+
const firstColon = arg.indexOf(":");
|
|
720
|
+
const proto = arg.slice(0, firstColon + 1);
|
|
721
|
+
const doubleSlash = arg.indexOf("//");
|
|
722
|
+
if (knownProtocols.has(proto)) {
|
|
723
|
+
if (doubleSlash === firstColon + 1) {
|
|
724
|
+
return arg;
|
|
725
|
+
}
|
|
726
|
+
return proto + "//" + arg.slice(firstColon + 1);
|
|
727
|
+
}
|
|
728
|
+
const firstAt = arg.indexOf("@");
|
|
729
|
+
if (firstAt > -1) {
|
|
730
|
+
if (firstAt > firstColon) {
|
|
731
|
+
return `git+ssh://${arg}`;
|
|
732
|
+
} else {
|
|
733
|
+
return arg;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return proto + "//" + arg.slice(firstColon + 1);
|
|
737
|
+
};
|
|
738
|
+
var correctUrl = (url) => {
|
|
739
|
+
const firstAt = url.indexOf("@");
|
|
740
|
+
const lastHash = url.lastIndexOf("#");
|
|
741
|
+
let firstColon = url.indexOf(":");
|
|
742
|
+
let lastColon = url.lastIndexOf(
|
|
743
|
+
":",
|
|
744
|
+
lastHash > -1 ? lastHash : Infinity
|
|
745
|
+
);
|
|
746
|
+
let corrected = url;
|
|
747
|
+
if (lastColon > firstAt) {
|
|
748
|
+
corrected = url.slice(0, lastColon) + "/" + url.slice(lastColon + 1);
|
|
749
|
+
firstColon = corrected.indexOf(":");
|
|
750
|
+
lastColon = corrected.lastIndexOf(":");
|
|
751
|
+
}
|
|
752
|
+
if (firstColon === -1 && !url.includes("//")) {
|
|
753
|
+
corrected = `git+ssh://${corrected}`;
|
|
754
|
+
}
|
|
755
|
+
return corrected;
|
|
756
|
+
};
|
|
757
|
+
var gitScpURL = (url) => {
|
|
758
|
+
const memoized = memo.get(url);
|
|
759
|
+
if (memoized) return memoized;
|
|
760
|
+
try {
|
|
761
|
+
const result = new URL(url);
|
|
762
|
+
if (result.hostname) {
|
|
763
|
+
memo.set(url, result);
|
|
764
|
+
return result;
|
|
765
|
+
}
|
|
766
|
+
} catch {
|
|
767
|
+
}
|
|
768
|
+
try {
|
|
769
|
+
const result = new URL(correctUrl(correctProtocol(url)));
|
|
770
|
+
if (result.hostname) {
|
|
771
|
+
memo.set(url, result);
|
|
772
|
+
return result;
|
|
773
|
+
}
|
|
774
|
+
} catch {
|
|
775
|
+
}
|
|
776
|
+
return void 0;
|
|
777
|
+
};
|
|
778
|
+
|
|
779
|
+
// ../../src/git/src/clone.ts
|
|
780
|
+
import { mkdir, stat as stat2 } from "node:fs/promises";
|
|
781
|
+
import { basename, resolve as resolve2 } from "node:path";
|
|
782
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
783
|
+
|
|
784
|
+
// ../../src/git/src/is-windows.ts
|
|
785
|
+
var isWindows = (opts2) => (opts2.fakePlatform || process.platform) === "win32";
|
|
786
|
+
|
|
787
787
|
// ../../src/git/src/revs.ts
|
|
788
788
|
import { fileURLToPath } from "node:url";
|
|
789
789
|
|