socket 1.1.117 → 1.1.119
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 +10 -0
- package/README.md +1 -0
- package/dist/constants.js +4 -4
- package/dist/constants.js.map +1 -1
- package/dist/tsconfig.dts.tsbuildinfo +1 -1
- package/dist/types/utils/dlx.d.mts +4 -3
- package/dist/types/utils/dlx.d.mts.map +1 -1
- package/dist/utils.js +59 -22
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
|
@@ -29,9 +29,10 @@ export type CoanaDlxOptions = DlxOptions & {
|
|
|
29
29
|
*
|
|
30
30
|
* If the dlx path fails (e.g. broken `npx` on the host), falls back to
|
|
31
31
|
* `npm install`-ing @coana-tech/cli into a temp directory and invoking it
|
|
32
|
-
* directly via `node`. The
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* directly via `node`. The launcher strategy can be overridden with
|
|
33
|
+
* SOCKET_CLI_COANA_LAUNCHER: 'auto' (the default) tries dlx with the
|
|
34
|
+
* npm-install fallback, 'npm-install' skips dlx entirely, and 'npx' never
|
|
35
|
+
* falls back.
|
|
35
36
|
*/
|
|
36
37
|
export declare function spawnCoanaDlx(args: string[] | readonly string[], orgSlug?: string, options?: CoanaDlxOptions | undefined, spawnExtra?: SpawnExtra | undefined): Promise<CResult<string>>;
|
|
37
38
|
/**
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"dlx.d.mts","sourceRoot":"","sources":["../../../src/utils/dlx.mts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,gBAAgB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,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
|
@@ -5324,7 +5324,7 @@ async function spawnCoanaScriptViaNode(scriptPath, args, finalEnv, options, spaw
|
|
|
5324
5324
|
const spawnResult = await spawn.spawn(isBinary ? scriptPath : 'node', spawnArgs, {
|
|
5325
5325
|
cwd: options.cwd,
|
|
5326
5326
|
env: sanitizeEnvForCoanaSubprocess(finalEnv),
|
|
5327
|
-
stdio: spawnExtra?.['stdio']
|
|
5327
|
+
stdio: options.stdio ?? spawnExtra?.['stdio'] ?? 'inherit'
|
|
5328
5328
|
});
|
|
5329
5329
|
return {
|
|
5330
5330
|
ok: true,
|
|
@@ -5400,6 +5400,38 @@ async function spawnCoanaViaNpmInstall(args, version, finalEnv, options, spawnEx
|
|
|
5400
5400
|
return buildDlxErrorResult(e);
|
|
5401
5401
|
}
|
|
5402
5402
|
}
|
|
5403
|
+
/**
|
|
5404
|
+
* Resolve how the Coana engine should be launched.
|
|
5405
|
+
*
|
|
5406
|
+
* SOCKET_CLI_COANA_LAUNCHER wins when set:
|
|
5407
|
+
* - 'auto' (default): try dlx first, fall back to `npm install` + `node` on
|
|
5408
|
+
* launcher-level failures.
|
|
5409
|
+
* - 'npm-install': skip dlx entirely; always `npm install` + `node`.
|
|
5410
|
+
* - 'npx': dlx only; never fall back.
|
|
5411
|
+
* Unrecognized values warn and behave as 'auto'.
|
|
5412
|
+
*
|
|
5413
|
+
* The legacy boolean variables SOCKET_CLI_COANA_FORCE_NPM_INSTALL
|
|
5414
|
+
* ('npm-install') and SOCKET_CLI_COANA_DISABLE_NPM_FALLBACK ('npx') are still
|
|
5415
|
+
* honored when the new variable is unset, but are intentionally undocumented.
|
|
5416
|
+
*/
|
|
5417
|
+
function getCoanaLauncherMode() {
|
|
5418
|
+
const rawMode = process.env['SOCKET_CLI_COANA_LAUNCHER'];
|
|
5419
|
+
const mode = rawMode?.trim().toLowerCase();
|
|
5420
|
+
if (mode) {
|
|
5421
|
+
if (mode === 'auto' || mode === 'npm-install' || mode === 'npx') {
|
|
5422
|
+
return mode;
|
|
5423
|
+
}
|
|
5424
|
+
logger.logger.warn(`Ignoring unrecognized SOCKET_CLI_COANA_LAUNCHER value "${rawMode}"; expected "auto", "npm-install", or "npx".`);
|
|
5425
|
+
return 'auto';
|
|
5426
|
+
}
|
|
5427
|
+
if (process.env['SOCKET_CLI_COANA_FORCE_NPM_INSTALL']) {
|
|
5428
|
+
return 'npm-install';
|
|
5429
|
+
}
|
|
5430
|
+
if (process.env['SOCKET_CLI_COANA_DISABLE_NPM_FALLBACK']) {
|
|
5431
|
+
return 'npx';
|
|
5432
|
+
}
|
|
5433
|
+
return 'auto';
|
|
5434
|
+
}
|
|
5403
5435
|
|
|
5404
5436
|
/**
|
|
5405
5437
|
* Helper to spawn coana with dlx.
|
|
@@ -5411,9 +5443,10 @@ async function spawnCoanaViaNpmInstall(args, version, finalEnv, options, spawnEx
|
|
|
5411
5443
|
*
|
|
5412
5444
|
* If the dlx path fails (e.g. broken `npx` on the host), falls back to
|
|
5413
5445
|
* `npm install`-ing @coana-tech/cli into a temp directory and invoking it
|
|
5414
|
-
* directly via `node`. The
|
|
5415
|
-
*
|
|
5416
|
-
*
|
|
5446
|
+
* directly via `node`. The launcher strategy can be overridden with
|
|
5447
|
+
* SOCKET_CLI_COANA_LAUNCHER: 'auto' (the default) tries dlx with the
|
|
5448
|
+
* npm-install fallback, 'npm-install' skips dlx entirely, and 'npx' never
|
|
5449
|
+
* falls back.
|
|
5417
5450
|
*/
|
|
5418
5451
|
async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
5419
5452
|
const {
|
|
@@ -5455,37 +5488,40 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5455
5488
|
...spawnEnv
|
|
5456
5489
|
};
|
|
5457
5490
|
const resolvedVersion = coanaVersion || constants.default.ENV.INLINED_SOCKET_CLI_COANA_TECH_CLI_VERSION;
|
|
5491
|
+
|
|
5492
|
+
// `shadowNpmBase` (the dlx launcher) configures the child's stdio from its
|
|
5493
|
+
// `options` arg, NOT from the registry-spawn `extra` arg — the latter only
|
|
5494
|
+
// attaches metadata to the result. Callers that requested streaming via
|
|
5495
|
+
// `spawnExtra` (the 4th arg), e.g. `{ stdio: 'inherit' }` from
|
|
5496
|
+
// `socket manifest gradle`, were therefore silently ignored on this path:
|
|
5497
|
+
// Coana ran piped and its output — including the real failure reason — never
|
|
5498
|
+
// reached the user, leaving only an unhelpful "command failed". Resolve the
|
|
5499
|
+
// requested stdio from either argument and honor it on every launch path:
|
|
5500
|
+
// dlx, local-path, and npm-install (e.g. `socket fix --silence` requests
|
|
5501
|
+
// `stdio: 'pipe'` via options).
|
|
5502
|
+
const requestedStdio = spawnExtra?.['stdio'] ?? require$$11.getOwn(dlxOptions, 'stdio');
|
|
5458
5503
|
const localCoanaPath = process.env['SOCKET_CLI_COANA_LOCAL_PATH'];
|
|
5459
5504
|
// Use local Coana CLI if path is provided.
|
|
5460
5505
|
if (localCoanaPath) {
|
|
5461
5506
|
try {
|
|
5462
5507
|
return await spawnCoanaScriptViaNode(localCoanaPath, args, finalEnv, {
|
|
5463
|
-
cwd: dlxOptions.cwd
|
|
5508
|
+
cwd: dlxOptions.cwd,
|
|
5509
|
+
stdio: requestedStdio
|
|
5464
5510
|
}, spawnExtra);
|
|
5465
5511
|
} catch (e) {
|
|
5466
5512
|
return buildDlxErrorResult(e);
|
|
5467
5513
|
}
|
|
5468
5514
|
}
|
|
5515
|
+
const launcherMode = getCoanaLauncherMode();
|
|
5469
5516
|
|
|
5470
5517
|
// Allow forcing the npm-install path for debugging or for environments
|
|
5471
5518
|
// where dlx is known-broken.
|
|
5472
|
-
if (
|
|
5519
|
+
if (launcherMode === 'npm-install') {
|
|
5473
5520
|
return await spawnCoanaViaNpmInstall(args, resolvedVersion, finalEnv, {
|
|
5474
|
-
cwd: dlxOptions.cwd
|
|
5521
|
+
cwd: dlxOptions.cwd,
|
|
5522
|
+
stdio: requestedStdio
|
|
5475
5523
|
}, spawnExtra);
|
|
5476
5524
|
}
|
|
5477
|
-
|
|
5478
|
-
// `shadowNpmBase` (the dlx launcher) configures the child's stdio from its
|
|
5479
|
-
// `options` arg, NOT from the registry-spawn `extra` arg — the latter only
|
|
5480
|
-
// attaches metadata to the result. Callers that requested streaming via
|
|
5481
|
-
// `spawnExtra` (the 4th arg), e.g. `{ stdio: 'inherit' }` from
|
|
5482
|
-
// `socket manifest gradle`, were therefore silently ignored on this path:
|
|
5483
|
-
// Coana ran piped and its output — including the real failure reason — never
|
|
5484
|
-
// reached the user, leaving only an unhelpful "command failed". Promote the
|
|
5485
|
-
// requested stdio into the dlx options so it is honored here too.
|
|
5486
|
-
// `spawnCoanaScriptViaNode` already reads `spawnExtra.stdio` for the
|
|
5487
|
-
// local-path and npm-install branches, so this aligns all three paths.
|
|
5488
|
-
const requestedStdio = spawnExtra?.['stdio'] ?? require$$11.getOwn(dlxOptions, 'stdio');
|
|
5489
5525
|
try {
|
|
5490
5526
|
// Use npm/dlx version.
|
|
5491
5527
|
const result = await spawnDlx({
|
|
@@ -5518,7 +5554,7 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5518
5554
|
};
|
|
5519
5555
|
} catch (e) {
|
|
5520
5556
|
const dlxError = buildDlxErrorResult(e);
|
|
5521
|
-
if (
|
|
5557
|
+
if (launcherMode === 'npx') {
|
|
5522
5558
|
return dlxError;
|
|
5523
5559
|
}
|
|
5524
5560
|
|
|
@@ -5530,7 +5566,8 @@ async function spawnCoanaDlx(args, orgSlug, options, spawnExtra) {
|
|
|
5530
5566
|
}
|
|
5531
5567
|
logger.logger.warn('Coana dlx invocation failed; retrying via `npm install` + `node`.');
|
|
5532
5568
|
const fallbackResult = await spawnCoanaViaNpmInstall(args, resolvedVersion, finalEnv, {
|
|
5533
|
-
cwd: dlxOptions.cwd
|
|
5569
|
+
cwd: dlxOptions.cwd,
|
|
5570
|
+
stdio: requestedStdio
|
|
5534
5571
|
}, spawnExtra);
|
|
5535
5572
|
if (fallbackResult.ok) {
|
|
5536
5573
|
return fallbackResult;
|
|
@@ -8355,5 +8392,5 @@ exports.updateConfigValue = updateConfigValue;
|
|
|
8355
8392
|
exports.walkNestedMap = walkNestedMap;
|
|
8356
8393
|
exports.webLink = webLink;
|
|
8357
8394
|
exports.writeSocketJson = writeSocketJson;
|
|
8358
|
-
//# debugId=
|
|
8395
|
+
//# debugId=63132cfd-da77-4711-b6d2-61b2536128a6
|
|
8359
8396
|
//# sourceMappingURL=utils.js.map
|