socket 1.1.114 → 1.1.115
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/CHANGELOG.md +5 -0
- package/dist/constants.js +3 -3
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/utils.js +80 -10
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlx.d.mts","sourceRoot":"","sources":["../../../src/utils/dlx.mts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAA;AAMpE,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG;IAC1C,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IAC3C,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAQD;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,WAAW,EAAE,cAAc,EAC3B,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,EAChC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,GAClC,OAAO,CAAC,eAAe,CAAC,CAwG1B;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG;IACzC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,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;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,EACrC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,GAClC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAyJ1B;AAsHD;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,EAChC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,GAClC,OAAO,CAAC,eAAe,CAAC,CAU1B;AAED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE,EAClC,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,EAChC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,GAClC,OAAO,CAAC,eAAe,CAAC,CAU1B"}
|
package/dist/utils.js
CHANGED
|
@@ -5469,6 +5469,18 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5469
5469
|
cwd: dlxOptions.cwd
|
|
5470
5470
|
}, spawnExtra);
|
|
5471
5471
|
}
|
|
5472
|
+
|
|
5473
|
+
// `shadowNpmBase` (the dlx launcher) configures the child's stdio from its
|
|
5474
|
+
// `options` arg, NOT from the registry-spawn `extra` arg — the latter only
|
|
5475
|
+
// attaches metadata to the result. Callers that requested streaming via
|
|
5476
|
+
// `spawnExtra` (the 4th arg), e.g. `{ stdio: 'inherit' }` from
|
|
5477
|
+
// `socket manifest gradle`, were therefore silently ignored on this path:
|
|
5478
|
+
// Coana ran piped and its output — including the real failure reason — never
|
|
5479
|
+
// reached the user, leaving only an unhelpful "command failed". Promote the
|
|
5480
|
+
// requested stdio into the dlx options so it is honored here too.
|
|
5481
|
+
// `spawnCoanaScriptViaNode` already reads `spawnExtra.stdio` for the
|
|
5482
|
+
// local-path and npm-install branches, so this aligns all three paths.
|
|
5483
|
+
const requestedStdio = spawnExtra?.['stdio'] ?? require$$11.getOwn(dlxOptions, 'stdio');
|
|
5472
5484
|
try {
|
|
5473
5485
|
// Use npm/dlx version.
|
|
5474
5486
|
const result = await spawnDlx({
|
|
@@ -5476,8 +5488,16 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5476
5488
|
version: resolvedVersion
|
|
5477
5489
|
}, args, {
|
|
5478
5490
|
force: true,
|
|
5479
|
-
silent
|
|
5491
|
+
// Do NOT silence the launcher. `--silent` (npm loglevel silent) hides
|
|
5492
|
+
// npm's own download/registry/launch errors, so when npx/pnpm-dlx fails
|
|
5493
|
+
// to fetch @coana-tech/cli the user is left with a bare exit code and no
|
|
5494
|
+
// cause. shadowNpmBase defaults to `--loglevel error`, which keeps real
|
|
5495
|
+
// launcher errors visible while staying quiet on success.
|
|
5496
|
+
silent: false,
|
|
5480
5497
|
...dlxOptions,
|
|
5498
|
+
...(requestedStdio === undefined ? {} : {
|
|
5499
|
+
stdio: requestedStdio
|
|
5500
|
+
}),
|
|
5481
5501
|
env: finalEnv,
|
|
5482
5502
|
ipc: {
|
|
5483
5503
|
[constants.default.SOCKET_CLI_SHADOW_ACCEPT_RISKS]: true,
|
|
@@ -5503,7 +5523,7 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5503
5523
|
if (!shouldFallbackOnDlxError(e)) {
|
|
5504
5524
|
return dlxError;
|
|
5505
5525
|
}
|
|
5506
|
-
logger.logger.warn('Coana dlx invocation failed
|
|
5526
|
+
logger.logger.warn('Coana dlx invocation failed; retrying via `npm install` + `node`.');
|
|
5507
5527
|
const fallbackResult = await spawnCoanaViaNpmInstall(args, resolvedVersion, finalEnv, {
|
|
5508
5528
|
cwd: dlxOptions.cwd
|
|
5509
5529
|
}, spawnExtra);
|
|
@@ -5539,10 +5559,29 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5539
5559
|
* rather than blindly re-running Coana.
|
|
5540
5560
|
*/
|
|
5541
5561
|
function shouldFallbackOnDlxError(e) {
|
|
5542
|
-
|
|
5543
|
-
|
|
5562
|
+
// Coana clearly ran (its banner is in the captured stderr) → any later
|
|
5563
|
+
// non-zero exit is a real Coana failure and retrying would hit it again.
|
|
5564
|
+
if (coanaBannerSeen(e)) {
|
|
5544
5565
|
return false;
|
|
5545
5566
|
}
|
|
5567
|
+
return dlxLauncherFailedBeforeCoana(e);
|
|
5568
|
+
}
|
|
5569
|
+
|
|
5570
|
+
/**
|
|
5571
|
+
* Heuristic: did the dlx launcher (npx / pnpm dlx / yarn dlx) fail BEFORE the
|
|
5572
|
+
* Coana process itself started? True for spawn-level errors (a string `code`
|
|
5573
|
+
* like ENOENT), signal kills, and exit codes >= 128 (conventionally
|
|
5574
|
+
* signal-derived) — all cases where the launcher, not Coana, is the culprit
|
|
5575
|
+
* (e.g. npx missing from PATH, or @coana-tech/cli failing to download). A small
|
|
5576
|
+
* integer exit code is deliberately NOT treated as a launch failure: Coana's
|
|
5577
|
+
* own exit codes are small integers too, so it is genuinely ambiguous.
|
|
5578
|
+
*
|
|
5579
|
+
* Caveat: a launcher that fails to download the package can also exit with a
|
|
5580
|
+
* small integer (npm/npx often exit 1), which lands in the ambiguous bucket.
|
|
5581
|
+
* We cannot disambiguate those from a real Coana exit without inspecting the
|
|
5582
|
+
* launcher's output, so the npm-install fallback does not fire for them.
|
|
5583
|
+
*/
|
|
5584
|
+
function dlxLauncherFailedBeforeCoana(e) {
|
|
5546
5585
|
const code = e?.code;
|
|
5547
5586
|
// Spawn-level failure (e.g. ENOENT when npx is missing from PATH).
|
|
5548
5587
|
if (typeof code === 'string') {
|
|
@@ -5554,10 +5593,18 @@ function shouldFallbackOnDlxError(e) {
|
|
|
5554
5593
|
}
|
|
5555
5594
|
// Exit codes >= 128 are conventionally signal-derived, and the observed
|
|
5556
5595
|
// npx-launcher failures in the wild fall into this range (e.g. 249, 254).
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5596
|
+
return typeof code === 'number' && code >= 128;
|
|
5597
|
+
}
|
|
5598
|
+
|
|
5599
|
+
/**
|
|
5600
|
+
* Definitive proof Coana actually booted: its startup banner appears in the
|
|
5601
|
+
* captured stderr. Only available when the launcher's output was piped
|
|
5602
|
+
* (captured); with inherited stdio there is nothing to inspect, so this
|
|
5603
|
+
* returns false (the failure is then classified by exit code / signal alone).
|
|
5604
|
+
*/
|
|
5605
|
+
function coanaBannerSeen(e) {
|
|
5606
|
+
const capturedStderr = String(e?.stderr ?? '');
|
|
5607
|
+
return !!capturedStderr && /Coana CLI version/i.test(capturedStderr);
|
|
5561
5608
|
}
|
|
5562
5609
|
|
|
5563
5610
|
/**
|
|
@@ -5566,6 +5613,7 @@ function shouldFallbackOnDlxError(e) {
|
|
|
5566
5613
|
*/
|
|
5567
5614
|
function buildDlxErrorResult(e) {
|
|
5568
5615
|
const stderr = e?.stderr;
|
|
5616
|
+
const stdout = e?.stdout;
|
|
5569
5617
|
const exitCode = e?.code;
|
|
5570
5618
|
const signal = e?.signal;
|
|
5571
5619
|
const cause = getErrorCause(e);
|
|
@@ -5577,7 +5625,29 @@ function buildDlxErrorResult(e) {
|
|
|
5577
5625
|
details.push(`signal ${signal}`);
|
|
5578
5626
|
}
|
|
5579
5627
|
const detailSuffix = details.length ? ` (${details.join(', ')})` : '';
|
|
5580
|
-
|
|
5628
|
+
// Prefer captured stderr, then stdout, then the generic spawn error. Coana
|
|
5629
|
+
// logs some failures (e.g. unresolved Gradle dependencies) to stdout, so
|
|
5630
|
+
// without the stdout fallback a piped failure collapsed to an unhelpful
|
|
5631
|
+
// "command failed" even when the real reason was captured.
|
|
5632
|
+
const detail = stderr || stdout || cause;
|
|
5633
|
+
// Be honest about WHERE the failure happened. On the dlx path the spawned
|
|
5634
|
+
// process is the package-manager launcher (npx / pnpm dlx / yarn dlx), which
|
|
5635
|
+
// downloads @coana-tech/cli and only then runs it — so a failure may be the
|
|
5636
|
+
// launcher dying before Coana ever started, not Coana itself. We can only be
|
|
5637
|
+
// CERTAIN of that for a spawn-level error (a string `code` like ENOENT: the
|
|
5638
|
+
// launcher binary could not start, so Coana provably never ran). A non-zero
|
|
5639
|
+
// exit or signal is genuinely ambiguous — Coana may have started, streamed
|
|
5640
|
+
// output, and then died (e.g. OOM), or the launcher may have failed to fetch
|
|
5641
|
+
// the package — and with inherited stdio there is no captured output to tell
|
|
5642
|
+
// them apart, so we must not assert either way.
|
|
5643
|
+
let message;
|
|
5644
|
+
if (coanaBannerSeen(e)) {
|
|
5645
|
+
message = `Coana command failed${detailSuffix}: ${detail}`;
|
|
5646
|
+
} else if (typeof e?.code === 'string') {
|
|
5647
|
+
message = `Failed to launch Coana via the package manager${detailSuffix} — the npx/pnpm-dlx/yarn-dlx launcher could not start (e.g. it is missing from PATH): ${detail}`;
|
|
5648
|
+
} else {
|
|
5649
|
+
message = `Coana failed to run via the package manager${detailSuffix}: ${detail}`;
|
|
5650
|
+
}
|
|
5581
5651
|
return {
|
|
5582
5652
|
ok: false,
|
|
5583
5653
|
data: e,
|
|
@@ -8280,5 +8350,5 @@ exports.updateConfigValue = updateConfigValue;
|
|
|
8280
8350
|
exports.walkNestedMap = walkNestedMap;
|
|
8281
8351
|
exports.webLink = webLink;
|
|
8282
8352
|
exports.writeSocketJson = writeSocketJson;
|
|
8283
|
-
//# debugId=
|
|
8353
|
+
//# debugId=da564a1a-94b4-43b0-953f-ee64e00633c5
|
|
8284
8354
|
//# sourceMappingURL=utils.js.map
|