@get-bb/plugin-sdk 0.6.80 → 0.6.90
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/README.md +26 -23
- package/bundled-types/bb-plugin-sdk-app.d.ts +1035 -897
- package/bundled-types/bb-plugin-sdk-internal-file-navigation-validation.d.ts +7 -0
- package/bundled-types/bb-plugin-sdk-internal-rpc-query-host.d.ts +7 -0
- package/bundled-types/bb-plugin-sdk-process.d.ts +61 -0
- package/bundled-types/bb-plugin-sdk-testing-app.d.ts +45 -21
- package/bundled-types/bb-plugin-sdk-testing.d.ts +11 -0
- package/bundled-types/bb-plugin-sdk.d.ts +1029 -895
- package/dist/app.js +16 -0
- package/dist/host.js +557 -13
- package/dist/index.js +1 -1
- package/dist/internal/file-navigation-validation.js +14 -3
- package/dist/internal/host-policy.js +1 -1
- package/dist/internal/plugin-app-collector.js +11 -3
- package/dist/internal/rpc-query-host.js +307 -445
- package/dist/process.js +694 -0
- package/dist/provider-bridge-acp-next.js +739 -320
- package/dist/provider-bridge-acp.js +739 -320
- package/dist/provider-bridge-testing.js +677 -43
- package/dist/provider-bridge-worker-entry.mjs +534 -66
- package/dist/provider-bridge.js +604 -212
- package/dist/testing/app.js +543 -573
- package/dist/testing/index.js +126 -108
- package/package.json +7 -1
package/dist/provider-bridge.js
CHANGED
|
@@ -509,7 +509,7 @@ var require_parse = __commonJS({
|
|
|
509
509
|
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module) {
|
|
510
510
|
"use strict";
|
|
511
511
|
var SemVer = require_semver();
|
|
512
|
-
var
|
|
512
|
+
var parse2 = (version, options, throwErrors = false) => {
|
|
513
513
|
if (version instanceof SemVer) {
|
|
514
514
|
return version;
|
|
515
515
|
}
|
|
@@ -522,7 +522,7 @@ var require_parse = __commonJS({
|
|
|
522
522
|
throw er;
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
module.exports =
|
|
525
|
+
module.exports = parse2;
|
|
526
526
|
}
|
|
527
527
|
});
|
|
528
528
|
|
|
@@ -530,9 +530,9 @@ var require_parse = __commonJS({
|
|
|
530
530
|
var require_valid = __commonJS({
|
|
531
531
|
"../../node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module) {
|
|
532
532
|
"use strict";
|
|
533
|
-
var
|
|
533
|
+
var parse2 = require_parse();
|
|
534
534
|
var valid = (version, options) => {
|
|
535
|
-
const v =
|
|
535
|
+
const v = parse2(version, options);
|
|
536
536
|
return v ? v.version : null;
|
|
537
537
|
};
|
|
538
538
|
module.exports = valid;
|
|
@@ -3923,10 +3923,536 @@ function experimental_defineProviderBridge(definition) {
|
|
|
3923
3923
|
return { experimental_apiVersion: 1, ...definition };
|
|
3924
3924
|
}
|
|
3925
3925
|
|
|
3926
|
-
// ../process-utils/src/
|
|
3926
|
+
// ../process-utils/src/host-process.ts
|
|
3927
|
+
import parse from "cross-spawn/lib/parse.js";
|
|
3928
|
+
import {
|
|
3929
|
+
spawn as nodeSpawn,
|
|
3930
|
+
fork as nodeFork,
|
|
3931
|
+
execFile as nodeExecFile
|
|
3932
|
+
} from "node:child_process";
|
|
3927
3933
|
import crossSpawn from "cross-spawn";
|
|
3934
|
+
|
|
3935
|
+
// ../process-utils/src/host-toolchain.ts
|
|
3936
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
3937
|
+
import {
|
|
3938
|
+
accessSync,
|
|
3939
|
+
constants,
|
|
3940
|
+
existsSync,
|
|
3941
|
+
readdirSync,
|
|
3942
|
+
realpathSync,
|
|
3943
|
+
statSync
|
|
3944
|
+
} from "node:fs";
|
|
3945
|
+
import { createRequire } from "node:module";
|
|
3946
|
+
import { homedir } from "node:os";
|
|
3947
|
+
import {
|
|
3948
|
+
basename,
|
|
3949
|
+
delimiter,
|
|
3950
|
+
dirname,
|
|
3951
|
+
extname as extname2,
|
|
3952
|
+
isAbsolute,
|
|
3953
|
+
join as join2
|
|
3954
|
+
} from "node:path";
|
|
3955
|
+
import { fileURLToPath } from "node:url";
|
|
3956
|
+
|
|
3957
|
+
// ../../node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js
|
|
3958
|
+
import fs from "node:fs";
|
|
3959
|
+
import path from "node:path";
|
|
3960
|
+
import process2 from "node:process";
|
|
3961
|
+
var isWindows = process2.platform === "win32";
|
|
3962
|
+
var separatorPattern = isWindows ? new RegExp("[\\/\\\\]", "v") : new RegExp("\\/", "v");
|
|
3963
|
+
var defaultPathExt = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";
|
|
3964
|
+
function resolveOptions(command, options) {
|
|
3965
|
+
if (typeof command !== "string" || command.length === 0) {
|
|
3966
|
+
throw new TypeError("Expected a non-empty string.");
|
|
3967
|
+
}
|
|
3968
|
+
const {
|
|
3969
|
+
cwd = process2.cwd(),
|
|
3970
|
+
// On Windows, `process.env.PATH` can be undefined in some contexts (for example, worker threads), where it's only exposed as `Path`.
|
|
3971
|
+
path: searchPath = process2.env.PATH ?? (isWindows ? process2.env.Path : void 0) ?? "",
|
|
3972
|
+
// `||` (not `??`) so an empty `PATHEXT` falls back to the default instead of disabling all lookup on Windows.
|
|
3973
|
+
pathExt = process2.env.PATHEXT || defaultPathExt
|
|
3974
|
+
} = options;
|
|
3975
|
+
return { cwd, searchPath, pathExt };
|
|
3976
|
+
}
|
|
3977
|
+
function windowsExtensions(command, pathExt) {
|
|
3978
|
+
const extensions = pathExt.split(path.delimiter).filter(Boolean);
|
|
3979
|
+
const commandExtension = path.extname(command).toLowerCase();
|
|
3980
|
+
if (commandExtension !== "" && extensions.some((extension) => extension.toLowerCase() === commandExtension)) {
|
|
3981
|
+
return ["", ...extensions];
|
|
3982
|
+
}
|
|
3983
|
+
return extensions;
|
|
3984
|
+
}
|
|
3985
|
+
function* candidatePaths(command, { cwd, searchPath, pathExt }) {
|
|
3986
|
+
const extensions = isWindows ? windowsExtensions(command, pathExt) : [""];
|
|
3987
|
+
if (separatorPattern.test(command)) {
|
|
3988
|
+
const base = path.resolve(cwd, command);
|
|
3989
|
+
for (const extension of extensions) {
|
|
3990
|
+
yield base + extension;
|
|
3991
|
+
}
|
|
3992
|
+
return;
|
|
3993
|
+
}
|
|
3994
|
+
const directories = [
|
|
3995
|
+
// Windows searches the current directory before `PATH`.
|
|
3996
|
+
...isWindows ? [cwd] : [],
|
|
3997
|
+
...searchPath.split(path.delimiter)
|
|
3998
|
+
];
|
|
3999
|
+
for (const directory of directories) {
|
|
4000
|
+
const unquoted = isWindows && directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
|
|
4001
|
+
if (unquoted === "") {
|
|
4002
|
+
continue;
|
|
4003
|
+
}
|
|
4004
|
+
const base = path.resolve(cwd, unquoted, command);
|
|
4005
|
+
for (const extension of extensions) {
|
|
4006
|
+
yield base + extension;
|
|
4007
|
+
}
|
|
4008
|
+
}
|
|
4009
|
+
}
|
|
4010
|
+
function isExecutableSync(filePath) {
|
|
4011
|
+
let stats;
|
|
4012
|
+
try {
|
|
4013
|
+
stats = fs.statSync(filePath);
|
|
4014
|
+
} catch (error) {
|
|
4015
|
+
return isWindows && error.code === "EACCES";
|
|
4016
|
+
}
|
|
4017
|
+
if (!stats.isFile()) {
|
|
4018
|
+
return false;
|
|
4019
|
+
}
|
|
4020
|
+
if (isWindows) {
|
|
4021
|
+
return true;
|
|
4022
|
+
}
|
|
4023
|
+
try {
|
|
4024
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
4025
|
+
return true;
|
|
4026
|
+
} catch {
|
|
4027
|
+
return false;
|
|
4028
|
+
}
|
|
4029
|
+
}
|
|
4030
|
+
function whichCommandSync(command, options = {}) {
|
|
4031
|
+
const resolved = resolveOptions(command, options);
|
|
4032
|
+
for (const candidate of candidatePaths(command, resolved)) {
|
|
4033
|
+
if (isExecutableSync(candidate)) {
|
|
4034
|
+
return candidate;
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
return void 0;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
// ../process-utils/src/host-toolchain.ts
|
|
4041
|
+
var NETWORK_KEYS = [
|
|
4042
|
+
"HTTP_PROXY",
|
|
4043
|
+
"HTTPS_PROXY",
|
|
4044
|
+
"NO_PROXY",
|
|
4045
|
+
"http_proxy",
|
|
4046
|
+
"https_proxy",
|
|
4047
|
+
"no_proxy",
|
|
4048
|
+
"NODE_EXTRA_CA_CERTS",
|
|
4049
|
+
"SSL_CERT_FILE",
|
|
4050
|
+
"SSL_CERT_DIR"
|
|
4051
|
+
];
|
|
4052
|
+
var SHELL_START = "__BB_SHELL_ENV_START__";
|
|
4053
|
+
var SHELL_END = "__BB_SHELL_ENV_END__";
|
|
4054
|
+
var PROBE_TIMEOUT_MS = 3e3;
|
|
4055
|
+
var PROBE_OUTPUT_MAX_CHARS = 1024 * 1024;
|
|
4056
|
+
function executable(file) {
|
|
4057
|
+
try {
|
|
4058
|
+
accessSync(
|
|
4059
|
+
file,
|
|
4060
|
+
process.platform === "win32" ? constants.F_OK : constants.X_OK
|
|
4061
|
+
);
|
|
4062
|
+
return statSync(file).isFile();
|
|
4063
|
+
} catch {
|
|
4064
|
+
return false;
|
|
4065
|
+
}
|
|
4066
|
+
}
|
|
4067
|
+
function envValue(env, key) {
|
|
4068
|
+
if (process.platform !== "win32") return env[key];
|
|
4069
|
+
return env[Object.keys(env).find(
|
|
4070
|
+
(entry) => entry.toUpperCase() === key.toUpperCase()
|
|
4071
|
+
) ?? key];
|
|
4072
|
+
}
|
|
4073
|
+
function mergePath(...paths) {
|
|
4074
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4075
|
+
return paths.flatMap((value) => (value ?? "").split(delimiter)).filter((entry) => {
|
|
4076
|
+
if (!entry) return false;
|
|
4077
|
+
const key = process.platform === "win32" ? entry.replace(/[\\/]+$/u, "").toLowerCase() : entry;
|
|
4078
|
+
if (seen.has(key)) return false;
|
|
4079
|
+
seen.add(key);
|
|
4080
|
+
return true;
|
|
4081
|
+
}).join(delimiter);
|
|
4082
|
+
}
|
|
4083
|
+
function onDiskName(file) {
|
|
4084
|
+
if (process.platform !== "win32") return file;
|
|
4085
|
+
try {
|
|
4086
|
+
const name = basename(file).toLowerCase();
|
|
4087
|
+
const entry = readdirSync(dirname(file)).find(
|
|
4088
|
+
(candidate) => candidate.toLowerCase() === name
|
|
4089
|
+
);
|
|
4090
|
+
return entry === void 0 ? file : join2(dirname(file), entry);
|
|
4091
|
+
} catch {
|
|
4092
|
+
return file;
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
function runProbe(command, args, env) {
|
|
4096
|
+
return new Promise((resolve2) => {
|
|
4097
|
+
let stdout = "";
|
|
4098
|
+
let settled = false;
|
|
4099
|
+
let timer;
|
|
4100
|
+
const finish = (status) => {
|
|
4101
|
+
if (settled) return;
|
|
4102
|
+
settled = true;
|
|
4103
|
+
clearTimeout(timer);
|
|
4104
|
+
resolve2({ status, stdout });
|
|
4105
|
+
};
|
|
4106
|
+
let child;
|
|
4107
|
+
try {
|
|
4108
|
+
child = spawn(command, args, {
|
|
4109
|
+
cwd: homedir(),
|
|
4110
|
+
env,
|
|
4111
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
4112
|
+
windowsHide: true
|
|
4113
|
+
});
|
|
4114
|
+
} catch {
|
|
4115
|
+
finish(null);
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
timer = setTimeout(() => {
|
|
4119
|
+
child.kill("SIGKILL");
|
|
4120
|
+
finish(null);
|
|
4121
|
+
}, PROBE_TIMEOUT_MS);
|
|
4122
|
+
child.stdout?.setEncoding("utf8");
|
|
4123
|
+
child.stdout?.on("data", (chunk) => {
|
|
4124
|
+
if (stdout.length < PROBE_OUTPUT_MAX_CHARS) stdout += chunk;
|
|
4125
|
+
});
|
|
4126
|
+
child.once("error", () => finish(null));
|
|
4127
|
+
child.once("close", (code) => finish(code));
|
|
4128
|
+
});
|
|
4129
|
+
}
|
|
4130
|
+
async function readShellEnvironment(env, retainPrevious) {
|
|
4131
|
+
if (process.platform === "win32") {
|
|
4132
|
+
const registry2 = join2(
|
|
4133
|
+
envValue(env, "SystemRoot") ?? "C:\\Windows",
|
|
4134
|
+
"System32",
|
|
4135
|
+
"reg.exe"
|
|
4136
|
+
);
|
|
4137
|
+
const values = { ...env };
|
|
4138
|
+
const paths = [];
|
|
4139
|
+
for (const key of [
|
|
4140
|
+
"HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment",
|
|
4141
|
+
"HKCU\\Environment"
|
|
4142
|
+
]) {
|
|
4143
|
+
const result = await runProbe(registry2, ["query", key], env);
|
|
4144
|
+
if (result.status !== 0) continue;
|
|
4145
|
+
for (const match of result.stdout.matchAll(
|
|
4146
|
+
/^ {4}(.+?) {4}REG_[A-Z_]+ {4}(.*)$/gmu
|
|
4147
|
+
)) {
|
|
4148
|
+
const name = match[1]?.trim();
|
|
4149
|
+
if (!name) continue;
|
|
4150
|
+
const value = (match[2] ?? "").trim();
|
|
4151
|
+
if (name.toUpperCase() === "PATH") paths.push(value);
|
|
4152
|
+
else {
|
|
4153
|
+
const existing = Object.keys(values).find(
|
|
4154
|
+
(key2) => key2.toUpperCase() === name.toUpperCase()
|
|
4155
|
+
);
|
|
4156
|
+
values[existing ?? name] = value;
|
|
4157
|
+
}
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4160
|
+
const expand = (value) => {
|
|
4161
|
+
for (let depth = 0; depth < 10; depth += 1) {
|
|
4162
|
+
const expanded = value.replace(
|
|
4163
|
+
/%([^%;\\/]+)%/gu,
|
|
4164
|
+
(reference, variable) => envValue(values, variable) ?? reference
|
|
4165
|
+
);
|
|
4166
|
+
if (expanded === value) break;
|
|
4167
|
+
value = expanded;
|
|
4168
|
+
}
|
|
4169
|
+
return value;
|
|
4170
|
+
};
|
|
4171
|
+
return paths.length === 0 ? null : { PATH: mergePath(...paths.map(expand), envValue(env, "PATH")) };
|
|
4172
|
+
}
|
|
4173
|
+
const shell = env.SHELL?.trim() || (process.platform === "darwin" ? "/bin/zsh" : "/bin/sh");
|
|
4174
|
+
const command = `printf '%s\\n' ${SHELL_START}; /usr/bin/env; printf '%s\\n' ${SHELL_END}`;
|
|
4175
|
+
const shellArgs = ["sh", "dash"].includes(basename(shell)) ? ["-lc"] : ["-ilc", "-lc"];
|
|
4176
|
+
for (const arg of shellArgs) {
|
|
4177
|
+
const result = await runProbe(shell, [arg, command], env);
|
|
4178
|
+
if (result.status !== 0) {
|
|
4179
|
+
if (retainPrevious) return null;
|
|
4180
|
+
continue;
|
|
4181
|
+
}
|
|
4182
|
+
const start = result.stdout.indexOf(`${SHELL_START}
|
|
4183
|
+
`);
|
|
4184
|
+
const end = result.stdout.indexOf(`
|
|
4185
|
+
${SHELL_END}`, start);
|
|
4186
|
+
if (start < 0 || end < 0) {
|
|
4187
|
+
if (retainPrevious) return null;
|
|
4188
|
+
continue;
|
|
4189
|
+
}
|
|
4190
|
+
const values = {};
|
|
4191
|
+
for (const line of result.stdout.slice(start + SHELL_START.length + 1, end).split("\n")) {
|
|
4192
|
+
const separator = line.indexOf("=");
|
|
4193
|
+
const key = line.slice(0, separator);
|
|
4194
|
+
if (key === "PATH" || NETWORK_KEYS.includes(key))
|
|
4195
|
+
values[key] = line.slice(separator + 1);
|
|
4196
|
+
}
|
|
4197
|
+
if (values.PATH) return values;
|
|
4198
|
+
}
|
|
4199
|
+
return null;
|
|
4200
|
+
}
|
|
4201
|
+
var HostToolchain = class {
|
|
4202
|
+
constructor(baseEnv = process.env, runtimePath = process.execPath) {
|
|
4203
|
+
this.baseEnv = baseEnv;
|
|
4204
|
+
this.runtimePath = runtimePath;
|
|
4205
|
+
this.inheritedPath = envValue(baseEnv, "PATH");
|
|
4206
|
+
this.nodePath = runtimePath;
|
|
4207
|
+
}
|
|
4208
|
+
baseEnv;
|
|
4209
|
+
runtimePath;
|
|
4210
|
+
shellEnv = {};
|
|
4211
|
+
inheritedPath;
|
|
4212
|
+
misses = /* @__PURE__ */ new Set();
|
|
4213
|
+
nodePath;
|
|
4214
|
+
refreshing = null;
|
|
4215
|
+
refreshedAt = 0;
|
|
4216
|
+
refresh() {
|
|
4217
|
+
if (this.refreshing !== null) return this.refreshing;
|
|
4218
|
+
this.misses.clear();
|
|
4219
|
+
this.refreshedAt = Date.now();
|
|
4220
|
+
const retainPrevious = this.shellEnv.PATH !== void 0;
|
|
4221
|
+
this.refreshing = readShellEnvironment(this.baseEnv, retainPrevious).then((env) => {
|
|
4222
|
+
if (env !== null) this.shellEnv = env;
|
|
4223
|
+
}).finally(() => {
|
|
4224
|
+
this.refreshing = null;
|
|
4225
|
+
});
|
|
4226
|
+
return this.refreshing;
|
|
4227
|
+
}
|
|
4228
|
+
invalidateFailure(errorOrCode) {
|
|
4229
|
+
const code = typeof errorOrCode === "object" && errorOrCode !== null && "code" in errorOrCode ? errorOrCode.code : errorOrCode;
|
|
4230
|
+
if (code === "ENOENT" || code === 127) void this.refresh();
|
|
4231
|
+
}
|
|
4232
|
+
searchPath(env) {
|
|
4233
|
+
const inherited = envValue(env, "PATH");
|
|
4234
|
+
const home = envValue(env, process.platform === "win32" ? "USERPROFILE" : "HOME") ?? homedir();
|
|
4235
|
+
const fallbacks = [
|
|
4236
|
+
join2(home, ".local", "bin"),
|
|
4237
|
+
join2(home, ".local", "share", "mise", "shims"),
|
|
4238
|
+
join2(home, ".asdf", "shims"),
|
|
4239
|
+
join2(home, ".asdf", "bin"),
|
|
4240
|
+
join2(home, ".volta", "bin")
|
|
4241
|
+
];
|
|
4242
|
+
if (process.platform === "darwin") fallbacks.push("/opt/homebrew/bin");
|
|
4243
|
+
if (process.platform !== "win32")
|
|
4244
|
+
fallbacks.push("/usr/local/bin", "/usr/bin", "/bin");
|
|
4245
|
+
const [first, second] = inherited === void 0 || inherited === this.inheritedPath ? [this.shellEnv.PATH, inherited] : [inherited, this.shellEnv.PATH];
|
|
4246
|
+
return mergePath(
|
|
4247
|
+
first,
|
|
4248
|
+
second,
|
|
4249
|
+
executable(this.nodePath) && /^node(?:\.exe)?$/iu.test(basename(this.nodePath)) ? dirname(this.nodePath) : void 0,
|
|
4250
|
+
...fallbacks
|
|
4251
|
+
);
|
|
4252
|
+
}
|
|
4253
|
+
environment(env = this.baseEnv) {
|
|
4254
|
+
const path10 = this.searchPath(env);
|
|
4255
|
+
const result = { ...env };
|
|
4256
|
+
if (process.platform === "win32") {
|
|
4257
|
+
for (const key of Object.keys(result))
|
|
4258
|
+
if (key !== "PATH" && key.toUpperCase() === "PATH") delete result[key];
|
|
4259
|
+
}
|
|
4260
|
+
if (path10 !== "") result.PATH = path10;
|
|
4261
|
+
const callerKeys = new Set(
|
|
4262
|
+
Object.keys(env).filter((key) => env[key] !== void 0).map((key) => key.toUpperCase())
|
|
4263
|
+
);
|
|
4264
|
+
for (const key of NETWORK_KEYS)
|
|
4265
|
+
if (!callerKeys.has(key.toUpperCase()) && this.shellEnv[key] !== void 0)
|
|
4266
|
+
result[key] = this.shellEnv[key];
|
|
4267
|
+
return result;
|
|
4268
|
+
}
|
|
4269
|
+
lookup(command, options) {
|
|
4270
|
+
const env = this.environment(options.env);
|
|
4271
|
+
const cwd = options.cwd instanceof URL ? fileURLToPath(options.cwd) : options.cwd ?? process.cwd();
|
|
4272
|
+
if (command === "bb") {
|
|
4273
|
+
for (const candidate of [
|
|
4274
|
+
env.BB_CLI_LAUNCHER,
|
|
4275
|
+
env.BB_CLI,
|
|
4276
|
+
env.BB_CLI_DIR ? join2(env.BB_CLI_DIR, "bb") : void 0
|
|
4277
|
+
]) {
|
|
4278
|
+
if (candidate?.trim() && isAbsolute(candidate.trim()) && executable(candidate.trim()))
|
|
4279
|
+
return candidate.trim();
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
const extension = extname2(command);
|
|
4283
|
+
const pathExt = envValue(env, "PATHEXT");
|
|
4284
|
+
const path10 = envValue(env, "PATH") ?? "";
|
|
4285
|
+
const lookupOptions = {
|
|
4286
|
+
cwd,
|
|
4287
|
+
path: path10,
|
|
4288
|
+
pathExt: extension ? `${extension};${pathExt ?? ".EXE;.COM;.CMD;.BAT"}` : pathExt
|
|
4289
|
+
};
|
|
4290
|
+
const found = command === "bb" ? path10.split(delimiter).filter(isAbsolute).map(
|
|
4291
|
+
(directory) => whichCommandSync(join2(directory, command), lookupOptions)
|
|
4292
|
+
).find(Boolean) : whichCommandSync(command, lookupOptions);
|
|
4293
|
+
return found ? onDiskName(found) : null;
|
|
4294
|
+
}
|
|
4295
|
+
resolve(command, options = {}) {
|
|
4296
|
+
const found = this.lookup(command, options);
|
|
4297
|
+
if (found !== null) return found;
|
|
4298
|
+
const key = `${command}\0${String(options.cwd ?? "")}\0${envValue(options.env ?? this.baseEnv, "PATH") ?? ""}`;
|
|
4299
|
+
const sinceRefresh = Date.now() - this.refreshedAt;
|
|
4300
|
+
if (!(this.misses.has(key) && sinceRefresh < 3e4) && (this.misses.size === 0 || sinceRefresh >= 1e3))
|
|
4301
|
+
void this.refresh();
|
|
4302
|
+
this.misses.add(key);
|
|
4303
|
+
return null;
|
|
4304
|
+
}
|
|
4305
|
+
node(options = {}) {
|
|
4306
|
+
if (executable(this.nodePath)) return this.nodePath;
|
|
4307
|
+
const stableHomebrew = this.runtimePath.replace(
|
|
4308
|
+
/\/Cellar\/([^/]+)\/[^/]+\//u,
|
|
4309
|
+
"/opt/$1/"
|
|
4310
|
+
);
|
|
4311
|
+
const candidates = [
|
|
4312
|
+
stableHomebrew,
|
|
4313
|
+
process.argv0,
|
|
4314
|
+
this.lookup(process.platform === "win32" ? "node.exe" : "node", options)
|
|
4315
|
+
];
|
|
4316
|
+
for (const candidate of candidates) {
|
|
4317
|
+
if (!candidate || !isAbsolute(candidate) || !executable(candidate))
|
|
4318
|
+
continue;
|
|
4319
|
+
const probe = spawnSync(
|
|
4320
|
+
candidate,
|
|
4321
|
+
[
|
|
4322
|
+
"-p",
|
|
4323
|
+
"JSON.stringify({path:process.execPath,abi:process.versions.modules,electron:!!process.versions.electron})"
|
|
4324
|
+
],
|
|
4325
|
+
{
|
|
4326
|
+
env: this.environment(options.env),
|
|
4327
|
+
cwd: options.cwd,
|
|
4328
|
+
encoding: "utf8",
|
|
4329
|
+
timeout: PROBE_TIMEOUT_MS,
|
|
4330
|
+
killSignal: "SIGKILL",
|
|
4331
|
+
windowsHide: true
|
|
4332
|
+
}
|
|
4333
|
+
);
|
|
4334
|
+
if (probe.status !== 0) continue;
|
|
4335
|
+
try {
|
|
4336
|
+
const runtime = JSON.parse(probe.stdout.trim());
|
|
4337
|
+
if (typeof runtime !== "object" || runtime === null || !("path" in runtime) || typeof runtime.path !== "string" || !("abi" in runtime) || runtime.abi !== process.versions.modules || !("electron" in runtime) || runtime.electron !== Boolean(process.versions.electron))
|
|
4338
|
+
continue;
|
|
4339
|
+
if (isAbsolute(runtime.path) && executable(runtime.path)) {
|
|
4340
|
+
this.nodePath = runtime.path;
|
|
4341
|
+
return runtime.path;
|
|
4342
|
+
}
|
|
4343
|
+
} catch {
|
|
4344
|
+
}
|
|
4345
|
+
}
|
|
4346
|
+
throw Object.assign(
|
|
4347
|
+
new Error(
|
|
4348
|
+
"The Node runtime was removed and no replacement was found. Reinstall Node or restart bb with an available runtime."
|
|
4349
|
+
),
|
|
4350
|
+
{ code: "ENOENT" }
|
|
4351
|
+
);
|
|
4352
|
+
}
|
|
4353
|
+
bundledNpmCli(command = "npm") {
|
|
4354
|
+
const require2 = createRequire(import.meta.url);
|
|
4355
|
+
return join2(
|
|
4356
|
+
dirname(require2.resolve("npm/package.json")),
|
|
4357
|
+
"bin",
|
|
4358
|
+
`${command}-cli.js`
|
|
4359
|
+
);
|
|
4360
|
+
}
|
|
4361
|
+
npmCli(command = "npm", options = {}) {
|
|
4362
|
+
const bin = `${command}-cli.js`;
|
|
4363
|
+
const runtime = process.versions.electron ? null : this.node(options);
|
|
4364
|
+
const candidates = [];
|
|
4365
|
+
if (runtime !== null)
|
|
4366
|
+
for (const cli of [
|
|
4367
|
+
join2(dirname(runtime), "..", "lib", "node_modules", "npm", "bin", bin),
|
|
4368
|
+
join2(dirname(runtime), "node_modules", "npm", "bin", bin)
|
|
4369
|
+
])
|
|
4370
|
+
candidates.push({ node: runtime, cli });
|
|
4371
|
+
const installed = this.resolve(command, options);
|
|
4372
|
+
if (installed) {
|
|
4373
|
+
try {
|
|
4374
|
+
const cli = realpathSync(installed);
|
|
4375
|
+
const npmRoot = dirname(dirname(cli));
|
|
4376
|
+
const node = [
|
|
4377
|
+
join2(npmRoot, "..", "..", "..", "bin", "node"),
|
|
4378
|
+
join2(npmRoot, "..", "..", "node.exe"),
|
|
4379
|
+
join2(dirname(installed), "node")
|
|
4380
|
+
].find(executable);
|
|
4381
|
+
if (basename(cli) === bin && node !== void 0)
|
|
4382
|
+
candidates.push({ node: realpathSync(node), cli });
|
|
4383
|
+
} catch {
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
if (runtime !== null) {
|
|
4387
|
+
try {
|
|
4388
|
+
candidates.push({ node: runtime, cli: this.bundledNpmCli(command) });
|
|
4389
|
+
} catch {
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
return candidates.find((candidate) => existsSync(candidate.cli)) ?? null;
|
|
4393
|
+
}
|
|
4394
|
+
command(command, args = [], options = {}) {
|
|
4395
|
+
const file = command === this.runtimePath ? this.node(options) : this.resolve(command, options) ?? command;
|
|
4396
|
+
const env = this.environment(options.env);
|
|
4397
|
+
if (/(?:^|[\\/])(?:npm|npx)-cli\.js$/u.test(args[0] ?? "")) {
|
|
4398
|
+
env.PATH = mergePath(dirname(file), env.PATH);
|
|
4399
|
+
}
|
|
4400
|
+
return { command: file, args: [...args], env };
|
|
4401
|
+
}
|
|
4402
|
+
};
|
|
4403
|
+
var toolchainKey = /* @__PURE__ */ Symbol.for("@bb/process-utils/host-toolchain");
|
|
4404
|
+
var shared = globalThis;
|
|
4405
|
+
var hostToolchain = shared[toolchainKey] ??= new HostToolchain();
|
|
4406
|
+
|
|
4407
|
+
// ../process-utils/src/host-process.ts
|
|
4408
|
+
function observe(child) {
|
|
4409
|
+
child.once("error", (error) => hostToolchain.invalidateFailure(error));
|
|
4410
|
+
child.once("exit", (code) => hostToolchain.invalidateFailure(code));
|
|
4411
|
+
return child;
|
|
4412
|
+
}
|
|
4413
|
+
function spawnHostProcess(command, args = [], options = {}) {
|
|
4414
|
+
const launch = options.shell ? { command, args: [...args], env: hostToolchain.environment(options.env) } : hostToolchain.command(command, args, options);
|
|
4415
|
+
const spawn3 = options.shell ? nodeSpawn : crossSpawn;
|
|
4416
|
+
return observe(
|
|
4417
|
+
spawn3(launch.command, launch.args, {
|
|
4418
|
+
...options,
|
|
4419
|
+
env: launch.env,
|
|
4420
|
+
windowsHide: options.windowsHide ?? true
|
|
4421
|
+
})
|
|
4422
|
+
);
|
|
4423
|
+
}
|
|
4424
|
+
function prepareExecFile(command, args, options) {
|
|
4425
|
+
const launch = hostToolchain.command(command, args, options);
|
|
4426
|
+
const parsed = process.platform === "win32" && hostToolchain.resolve(launch.command, {
|
|
4427
|
+
env: launch.env,
|
|
4428
|
+
cwd: options.cwd
|
|
4429
|
+
}) === null ? { command: launch.command, args: launch.args, options } : parse(launch.command, launch.args, { ...options, env: launch.env });
|
|
4430
|
+
return {
|
|
4431
|
+
command: parsed.command,
|
|
4432
|
+
args: parsed.args,
|
|
4433
|
+
options: {
|
|
4434
|
+
...options,
|
|
4435
|
+
...parsed.options,
|
|
4436
|
+
env: launch.env,
|
|
4437
|
+
windowsHide: options.windowsHide ?? true
|
|
4438
|
+
}
|
|
4439
|
+
};
|
|
4440
|
+
}
|
|
4441
|
+
function execHostFileCallback(command, args, options, callback) {
|
|
4442
|
+
const launch = prepareExecFile(command, args, options);
|
|
4443
|
+
return observe(
|
|
4444
|
+
nodeExecFile(
|
|
4445
|
+
launch.command,
|
|
4446
|
+
launch.args,
|
|
4447
|
+
{ ...launch.options, encoding: options.encoding ?? "utf8" },
|
|
4448
|
+
callback
|
|
4449
|
+
)
|
|
4450
|
+
);
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4453
|
+
// ../process-utils/src/spawn.ts
|
|
3928
4454
|
function spawnPortableProcess(request) {
|
|
3929
|
-
return
|
|
4455
|
+
return spawnHostProcess(request.command, request.args, {
|
|
3930
4456
|
cwd: request.cwd,
|
|
3931
4457
|
detached: request.detached,
|
|
3932
4458
|
env: request.env,
|
|
@@ -3936,8 +4462,7 @@ function spawnPortableProcess(request) {
|
|
|
3936
4462
|
}
|
|
3937
4463
|
|
|
3938
4464
|
// ../process-utils/src/windows-process-tree.ts
|
|
3939
|
-
import
|
|
3940
|
-
import path from "node:path";
|
|
4465
|
+
import path2 from "node:path";
|
|
3941
4466
|
function hasExited(child) {
|
|
3942
4467
|
return child.exitCode !== null || child.signalCode !== null;
|
|
3943
4468
|
}
|
|
@@ -3954,8 +4479,8 @@ function terminateWindowsProcessTrees(pids) {
|
|
|
3954
4479
|
resolve2(terminated);
|
|
3955
4480
|
};
|
|
3956
4481
|
try {
|
|
3957
|
-
killer =
|
|
3958
|
-
|
|
4482
|
+
killer = execHostFileCallback(
|
|
4483
|
+
path2.join(
|
|
3959
4484
|
process.env.SystemRoot ?? "C:\\Windows",
|
|
3960
4485
|
"System32",
|
|
3961
4486
|
"taskkill.exe"
|
|
@@ -4129,7 +4654,7 @@ function isPlainObject(value) {
|
|
|
4129
4654
|
}
|
|
4130
4655
|
|
|
4131
4656
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/file-url.js
|
|
4132
|
-
import { fileURLToPath } from "node:url";
|
|
4657
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
4133
4658
|
var safeNormalizeFileUrl = (file, name) => {
|
|
4134
4659
|
const fileString = normalizeFileUrl(normalizeDenoExecPath(file));
|
|
4135
4660
|
if (typeof fileString !== "string") {
|
|
@@ -4139,7 +4664,7 @@ var safeNormalizeFileUrl = (file, name) => {
|
|
|
4139
4664
|
};
|
|
4140
4665
|
var normalizeDenoExecPath = (file) => isDenoExecPath(file) ? file.toString() : file;
|
|
4141
4666
|
var isDenoExecPath = (file) => typeof file !== "string" && file && Object.getPrototypeOf(file) === String.prototype;
|
|
4142
|
-
var normalizeFileUrl = (file) => file instanceof URL ?
|
|
4667
|
+
var normalizeFileUrl = (file) => file instanceof URL ? fileURLToPath2(file) : file;
|
|
4143
4668
|
|
|
4144
4669
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/parameters.js
|
|
4145
4670
|
var normalizeParameters = (rawFile, rawArguments = [], rawOptions = {}) => {
|
|
@@ -4313,15 +4838,15 @@ var getSubprocessResult = ({ stdout }) => {
|
|
|
4313
4838
|
};
|
|
4314
4839
|
|
|
4315
4840
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/main-sync.js
|
|
4316
|
-
import { spawnSync } from "node:child_process";
|
|
4841
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
4317
4842
|
|
|
4318
4843
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/specific.js
|
|
4319
4844
|
import { debuglog } from "node:util";
|
|
4320
4845
|
|
|
4321
4846
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
|
|
4322
|
-
import
|
|
4847
|
+
import process3 from "node:process";
|
|
4323
4848
|
var isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
|
|
4324
|
-
var STANDARD_STREAMS = [
|
|
4849
|
+
var STANDARD_STREAMS = [process3.stdin, process3.stdout, process3.stderr];
|
|
4325
4850
|
var STANDARD_STREAMS_ALIASES = ["stdin", "stdout", "stderr"];
|
|
4326
4851
|
var getStreamName = (fdNumber) => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;
|
|
4327
4852
|
|
|
@@ -4456,11 +4981,11 @@ var quoteString = (escapedArgument) => {
|
|
|
4456
4981
|
var NO_ESCAPE_REGEXP = /^[\w./-]+$/;
|
|
4457
4982
|
|
|
4458
4983
|
// ../../node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
|
|
4459
|
-
import
|
|
4984
|
+
import process4 from "node:process";
|
|
4460
4985
|
function isUnicodeSupported() {
|
|
4461
|
-
const { env } =
|
|
4986
|
+
const { env } = process4;
|
|
4462
4987
|
const { TERM, TERM_PROGRAM } = env;
|
|
4463
|
-
if (
|
|
4988
|
+
if (process4.platform !== "win32") {
|
|
4464
4989
|
return TERM !== "linux";
|
|
4465
4990
|
}
|
|
4466
4991
|
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
@@ -4983,13 +5508,13 @@ var handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
|
4983
5508
|
};
|
|
4984
5509
|
|
|
4985
5510
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/options.js
|
|
4986
|
-
import
|
|
4987
|
-
import
|
|
5511
|
+
import path7 from "node:path";
|
|
5512
|
+
import process7 from "node:process";
|
|
4988
5513
|
import crossSpawn2 from "cross-spawn";
|
|
4989
5514
|
|
|
4990
5515
|
// ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
4991
|
-
import
|
|
4992
|
-
import
|
|
5516
|
+
import process5 from "node:process";
|
|
5517
|
+
import path4 from "node:path";
|
|
4993
5518
|
|
|
4994
5519
|
// ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
|
|
4995
5520
|
function pathKey(options = {}) {
|
|
@@ -5006,21 +5531,21 @@ function pathKey(options = {}) {
|
|
|
5006
5531
|
// ../../node_modules/.pnpm/unicorn-magic@0.3.0/node_modules/unicorn-magic/node.js
|
|
5007
5532
|
import { promisify } from "node:util";
|
|
5008
5533
|
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "node:child_process";
|
|
5009
|
-
import
|
|
5010
|
-
import { fileURLToPath as
|
|
5534
|
+
import path3 from "node:path";
|
|
5535
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
5011
5536
|
var execFileOriginal = promisify(execFileCallback);
|
|
5012
5537
|
function toPath(urlOrPath) {
|
|
5013
|
-
return urlOrPath instanceof URL ?
|
|
5538
|
+
return urlOrPath instanceof URL ? fileURLToPath3(urlOrPath) : urlOrPath;
|
|
5014
5539
|
}
|
|
5015
5540
|
function traversePathUp(startPath) {
|
|
5016
5541
|
return {
|
|
5017
5542
|
*[Symbol.iterator]() {
|
|
5018
|
-
let currentPath =
|
|
5543
|
+
let currentPath = path3.resolve(toPath(startPath));
|
|
5019
5544
|
let previousPath;
|
|
5020
5545
|
while (previousPath !== currentPath) {
|
|
5021
5546
|
yield currentPath;
|
|
5022
5547
|
previousPath = currentPath;
|
|
5023
|
-
currentPath =
|
|
5548
|
+
currentPath = path3.resolve(currentPath, "..");
|
|
5024
5549
|
}
|
|
5025
5550
|
}
|
|
5026
5551
|
};
|
|
@@ -5029,38 +5554,38 @@ var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
|
5029
5554
|
|
|
5030
5555
|
// ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
5031
5556
|
var npmRunPath = ({
|
|
5032
|
-
cwd =
|
|
5033
|
-
path: pathOption =
|
|
5557
|
+
cwd = process5.cwd(),
|
|
5558
|
+
path: pathOption = process5.env[pathKey()],
|
|
5034
5559
|
preferLocal = true,
|
|
5035
|
-
execPath: execPath2 =
|
|
5560
|
+
execPath: execPath2 = process5.execPath,
|
|
5036
5561
|
addExecPath = true
|
|
5037
5562
|
} = {}) => {
|
|
5038
|
-
const cwdPath =
|
|
5563
|
+
const cwdPath = path4.resolve(toPath(cwd));
|
|
5039
5564
|
const result = [];
|
|
5040
|
-
const pathParts = pathOption.split(
|
|
5565
|
+
const pathParts = pathOption.split(path4.delimiter);
|
|
5041
5566
|
if (preferLocal) {
|
|
5042
5567
|
applyPreferLocal(result, pathParts, cwdPath);
|
|
5043
5568
|
}
|
|
5044
5569
|
if (addExecPath) {
|
|
5045
5570
|
applyExecPath(result, pathParts, execPath2, cwdPath);
|
|
5046
5571
|
}
|
|
5047
|
-
return pathOption === "" || pathOption ===
|
|
5572
|
+
return pathOption === "" || pathOption === path4.delimiter ? `${result.join(path4.delimiter)}${pathOption}` : [...result, pathOption].join(path4.delimiter);
|
|
5048
5573
|
};
|
|
5049
5574
|
var applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
5050
5575
|
for (const directory of traversePathUp(cwdPath)) {
|
|
5051
|
-
const pathPart =
|
|
5576
|
+
const pathPart = path4.join(directory, "node_modules/.bin");
|
|
5052
5577
|
if (!pathParts.includes(pathPart)) {
|
|
5053
5578
|
result.push(pathPart);
|
|
5054
5579
|
}
|
|
5055
5580
|
}
|
|
5056
5581
|
};
|
|
5057
5582
|
var applyExecPath = (result, pathParts, execPath2, cwdPath) => {
|
|
5058
|
-
const pathPart =
|
|
5583
|
+
const pathPart = path4.resolve(cwdPath, toPath(execPath2), "..");
|
|
5059
5584
|
if (!pathParts.includes(pathPart)) {
|
|
5060
5585
|
result.push(pathPart);
|
|
5061
5586
|
}
|
|
5062
5587
|
};
|
|
5063
|
-
var npmRunPathEnv = ({ env =
|
|
5588
|
+
var npmRunPathEnv = ({ env = process5.env, ...options } = {}) => {
|
|
5064
5589
|
env = { ...env };
|
|
5065
5590
|
const pathName = pathKey({ env });
|
|
5066
5591
|
options.path = env[pathName];
|
|
@@ -5104,10 +5629,10 @@ var ExecaSyncError = class extends Error {
|
|
|
5104
5629
|
setErrorName(ExecaSyncError, ExecaSyncError.name);
|
|
5105
5630
|
|
|
5106
5631
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/signal.js
|
|
5107
|
-
import { constants as
|
|
5632
|
+
import { constants as constants4 } from "node:os";
|
|
5108
5633
|
|
|
5109
5634
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js
|
|
5110
|
-
import { constants as
|
|
5635
|
+
import { constants as constants3 } from "node:os";
|
|
5111
5636
|
|
|
5112
5637
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/realtime.js
|
|
5113
5638
|
var getRealtimeSignals = () => {
|
|
@@ -5125,7 +5650,7 @@ var SIGRTMIN = 34;
|
|
|
5125
5650
|
var SIGRTMAX = 64;
|
|
5126
5651
|
|
|
5127
5652
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js
|
|
5128
|
-
import { constants } from "node:os";
|
|
5653
|
+
import { constants as constants2 } from "node:os";
|
|
5129
5654
|
|
|
5130
5655
|
// ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/core.js
|
|
5131
5656
|
var SIGNALS = [
|
|
@@ -5416,7 +5941,7 @@ var normalizeSignal = ({
|
|
|
5416
5941
|
}) => {
|
|
5417
5942
|
const {
|
|
5418
5943
|
signals: { [name]: constantSignal }
|
|
5419
|
-
} =
|
|
5944
|
+
} = constants2;
|
|
5420
5945
|
const supported = constantSignal !== void 0;
|
|
5421
5946
|
const number = supported ? constantSignal : defaultNumber;
|
|
5422
5947
|
return { name, number, description, supported, action, forced, standard };
|
|
@@ -5465,7 +5990,7 @@ var getSignalByNumber = (number, signals2) => {
|
|
|
5465
5990
|
};
|
|
5466
5991
|
};
|
|
5467
5992
|
var findSignalByNumber = (number, signals2) => {
|
|
5468
|
-
const signal = signals2.find(({ name }) =>
|
|
5993
|
+
const signal = signals2.find(({ name }) => constants3.signals[name] === number);
|
|
5469
5994
|
if (signal !== void 0) {
|
|
5470
5995
|
return signal;
|
|
5471
5996
|
}
|
|
@@ -5499,13 +6024,13 @@ var normalizeSignalInteger = (signalInteger, optionName) => {
|
|
|
5499
6024
|
throw new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.
|
|
5500
6025
|
${getAvailableSignals()}`);
|
|
5501
6026
|
};
|
|
5502
|
-
var getSignalsIntegerToName = () => new Map(Object.entries(
|
|
6027
|
+
var getSignalsIntegerToName = () => new Map(Object.entries(constants4.signals).reverse().map(([signalName, signalInteger]) => [signalInteger, signalName]));
|
|
5503
6028
|
var signalsIntegerToName = getSignalsIntegerToName();
|
|
5504
6029
|
var normalizeSignalName = (signalName, optionName) => {
|
|
5505
|
-
if (signalName in
|
|
6030
|
+
if (signalName in constants4.signals) {
|
|
5506
6031
|
return signalName;
|
|
5507
6032
|
}
|
|
5508
|
-
if (signalName.toUpperCase() in
|
|
6033
|
+
if (signalName.toUpperCase() in constants4.signals) {
|
|
5509
6034
|
throw new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);
|
|
5510
6035
|
}
|
|
5511
6036
|
throw new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.
|
|
@@ -5513,8 +6038,8 @@ ${getAvailableSignals()}`);
|
|
|
5513
6038
|
};
|
|
5514
6039
|
var getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.
|
|
5515
6040
|
Available signal numbers: ${getAvailableSignalIntegers()}.`;
|
|
5516
|
-
var getAvailableSignalNames = () => Object.keys(
|
|
5517
|
-
var getAvailableSignalIntegers = () => [...new Set(Object.values(
|
|
6041
|
+
var getAvailableSignalNames = () => Object.keys(constants4.signals).sort().map((signalName) => `'${signalName}'`).join(", ");
|
|
6042
|
+
var getAvailableSignalIntegers = () => [...new Set(Object.values(constants4.signals).sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))].join(", ");
|
|
5518
6043
|
var getSignalDescription = (signal) => signalsByName[signal].description;
|
|
5519
6044
|
|
|
5520
6045
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/kill.js
|
|
@@ -6210,7 +6735,7 @@ var killAfterTimeout = async (subprocess, timeout, context, { signal }) => {
|
|
|
6210
6735
|
|
|
6211
6736
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/node.js
|
|
6212
6737
|
import { execPath, execArgv } from "node:process";
|
|
6213
|
-
import
|
|
6738
|
+
import path5 from "node:path";
|
|
6214
6739
|
var mapNode = ({ options }) => {
|
|
6215
6740
|
if (options.node === false) {
|
|
6216
6741
|
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
|
|
@@ -6229,7 +6754,7 @@ var handleNodeOption = (file, commandArguments, {
|
|
|
6229
6754
|
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
|
|
6230
6755
|
}
|
|
6231
6756
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
|
|
6232
|
-
const resolvedNodePath =
|
|
6757
|
+
const resolvedNodePath = path5.resolve(cwd, normalizedNodePath);
|
|
6233
6758
|
const newOptions = {
|
|
6234
6759
|
...options,
|
|
6235
6760
|
nodePath: resolvedNodePath,
|
|
@@ -6239,7 +6764,7 @@ var handleNodeOption = (file, commandArguments, {
|
|
|
6239
6764
|
if (!shouldHandleNode) {
|
|
6240
6765
|
return [file, commandArguments, newOptions];
|
|
6241
6766
|
}
|
|
6242
|
-
if (
|
|
6767
|
+
if (path5.basename(file, ".exe") === "node") {
|
|
6243
6768
|
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
|
|
6244
6769
|
}
|
|
6245
6770
|
return [
|
|
@@ -6328,16 +6853,16 @@ var ENCODING_ALIASES = {
|
|
|
6328
6853
|
var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encoding}"` : String(encoding);
|
|
6329
6854
|
|
|
6330
6855
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/cwd.js
|
|
6331
|
-
import { statSync } from "node:fs";
|
|
6332
|
-
import
|
|
6333
|
-
import
|
|
6856
|
+
import { statSync as statSync2 } from "node:fs";
|
|
6857
|
+
import path6 from "node:path";
|
|
6858
|
+
import process6 from "node:process";
|
|
6334
6859
|
var normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
6335
6860
|
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
|
|
6336
|
-
return
|
|
6861
|
+
return path6.resolve(cwdString);
|
|
6337
6862
|
};
|
|
6338
6863
|
var getDefaultCwd = () => {
|
|
6339
6864
|
try {
|
|
6340
|
-
return
|
|
6865
|
+
return process6.cwd();
|
|
6341
6866
|
} catch (error) {
|
|
6342
6867
|
error.message = `The current directory does not exist.
|
|
6343
6868
|
${error.message}`;
|
|
@@ -6350,7 +6875,7 @@ var fixCwdError = (originalMessage, cwd) => {
|
|
|
6350
6875
|
}
|
|
6351
6876
|
let cwdStat;
|
|
6352
6877
|
try {
|
|
6353
|
-
cwdStat =
|
|
6878
|
+
cwdStat = statSync2(cwd);
|
|
6354
6879
|
} catch (error) {
|
|
6355
6880
|
return `The "cwd" option is invalid: ${cwd}.
|
|
6356
6881
|
${error.message}
|
|
@@ -6380,7 +6905,7 @@ var normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
6380
6905
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
6381
6906
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
6382
6907
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
6383
|
-
if (
|
|
6908
|
+
if (process7.platform === "win32" && path7.basename(file, ".exe") === "cmd") {
|
|
6384
6909
|
commandArguments.unshift("/q");
|
|
6385
6910
|
}
|
|
6386
6911
|
return { file, commandArguments, options };
|
|
@@ -6421,7 +6946,7 @@ var addDefaultOptions = ({
|
|
|
6421
6946
|
serialization
|
|
6422
6947
|
});
|
|
6423
6948
|
var getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
|
|
6424
|
-
const env = extendEnv ? { ...
|
|
6949
|
+
const env = extendEnv ? { ...process7.env, ...envOption } : envOption;
|
|
6425
6950
|
if (preferLocal || node) {
|
|
6426
6951
|
return npmRunPathEnv({
|
|
6427
6952
|
env,
|
|
@@ -7599,7 +8124,7 @@ var normalizeGenerator = ({ stdioItem, stdioItem: { value }, index, newTransform
|
|
|
7599
8124
|
var sortTransforms = (newTransforms, direction) => direction === "input" ? newTransforms.reverse() : newTransforms;
|
|
7600
8125
|
|
|
7601
8126
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/direction.js
|
|
7602
|
-
import
|
|
8127
|
+
import process8 from "node:process";
|
|
7603
8128
|
var getStreamDirection = (stdioItems, fdNumber, optionName) => {
|
|
7604
8129
|
const directions = stdioItems.map((stdioItem) => getStdioItemDirection(stdioItem, fdNumber));
|
|
7605
8130
|
if (directions.includes("input") && directions.includes("output")) {
|
|
@@ -7639,10 +8164,10 @@ var guessStreamDirection = {
|
|
|
7639
8164
|
}
|
|
7640
8165
|
};
|
|
7641
8166
|
var getStandardStreamDirection = (value) => {
|
|
7642
|
-
if ([0,
|
|
8167
|
+
if ([0, process8.stdin].includes(value)) {
|
|
7643
8168
|
return "input";
|
|
7644
8169
|
}
|
|
7645
|
-
if ([1, 2,
|
|
8170
|
+
if ([1, 2, process8.stdout, process8.stderr].includes(value)) {
|
|
7646
8171
|
return "output";
|
|
7647
8172
|
}
|
|
7648
8173
|
};
|
|
@@ -8700,7 +9225,7 @@ var runSubprocessSync = ({ file, commandArguments, options, command, escapedComm
|
|
|
8700
9225
|
try {
|
|
8701
9226
|
addInputOptionsSync(fileDescriptors, options);
|
|
8702
9227
|
const normalizedOptions = normalizeSpawnSyncOptions(options);
|
|
8703
|
-
return
|
|
9228
|
+
return spawnSync2(...concatenateShell(file, commandArguments, normalizedOptions));
|
|
8704
9229
|
} catch (error) {
|
|
8705
9230
|
return makeEarlyError({
|
|
8706
9231
|
error,
|
|
@@ -8743,10 +9268,10 @@ var getSyncResult = ({ error, exitCode, signal, timedOut, isMaxBuffer, stdio, al
|
|
|
8743
9268
|
|
|
8744
9269
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/main-async.js
|
|
8745
9270
|
import { setMaxListeners } from "node:events";
|
|
8746
|
-
import { spawn } from "node:child_process";
|
|
9271
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
8747
9272
|
|
|
8748
9273
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/ipc/methods.js
|
|
8749
|
-
import
|
|
9274
|
+
import process9 from "node:process";
|
|
8750
9275
|
|
|
8751
9276
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/ipc/get-one.js
|
|
8752
9277
|
import { once as once5, on as on2 } from "node:events";
|
|
@@ -8887,9 +9412,9 @@ var addIpcMethods = (subprocess, { ipc }) => {
|
|
|
8887
9412
|
Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
|
|
8888
9413
|
};
|
|
8889
9414
|
var getIpcExport = () => {
|
|
8890
|
-
const anyProcess =
|
|
9415
|
+
const anyProcess = process9;
|
|
8891
9416
|
const isSubprocess = true;
|
|
8892
|
-
const ipc =
|
|
9417
|
+
const ipc = process9.channel !== void 0;
|
|
8893
9418
|
return {
|
|
8894
9419
|
...getIpcMethods(anyProcess, isSubprocess, ipc),
|
|
8895
9420
|
getCancelSignal: getCancelSignal.bind(void 0, {
|
|
@@ -9440,7 +9965,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
9440
9965
|
// "SIGHUP" throws an `ENOSYS` error on Windows,
|
|
9441
9966
|
// so use a supported signal instead
|
|
9442
9967
|
/* c8 ignore start */
|
|
9443
|
-
#hupSig =
|
|
9968
|
+
#hupSig = process10.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
9444
9969
|
/* c8 ignore stop */
|
|
9445
9970
|
#emitter = new Emitter();
|
|
9446
9971
|
#process;
|
|
@@ -9551,7 +10076,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
9551
10076
|
}
|
|
9552
10077
|
}
|
|
9553
10078
|
};
|
|
9554
|
-
var
|
|
10079
|
+
var process10 = globalThis.process;
|
|
9555
10080
|
var {
|
|
9556
10081
|
/**
|
|
9557
10082
|
* Called when the process is exiting, whether via signal, explicit
|
|
@@ -9579,7 +10104,7 @@ var {
|
|
|
9579
10104
|
* @internal
|
|
9580
10105
|
*/
|
|
9581
10106
|
unload
|
|
9582
|
-
} = signalExitWrap(processOk(
|
|
10107
|
+
} = signalExitWrap(processOk(process10) ? new SignalExit(process10) : new SignalExitFallback());
|
|
9583
10108
|
|
|
9584
10109
|
// ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
|
|
9585
10110
|
var cleanupOnExit = (subprocess, { cleanup, detached }, { signal }) => {
|
|
@@ -10693,7 +11218,7 @@ var handleAsyncOptions = ({ timeout, signal, ...options }) => {
|
|
|
10693
11218
|
var spawnSubprocessAsync = ({ file, commandArguments, options, startTime, verboseInfo, command, escapedCommand, fileDescriptors }) => {
|
|
10694
11219
|
let subprocess;
|
|
10695
11220
|
try {
|
|
10696
|
-
subprocess =
|
|
11221
|
+
subprocess = spawn2(...concatenateShell(file, commandArguments, options));
|
|
10697
11222
|
} catch (error) {
|
|
10698
11223
|
return handleEarlyError({
|
|
10699
11224
|
error,
|
|
@@ -11070,109 +11595,15 @@ async function runVcsProcess(command, args, operation, options = {}) {
|
|
|
11070
11595
|
}
|
|
11071
11596
|
|
|
11072
11597
|
// ../process-utils/src/exec-portable-file.ts
|
|
11073
|
-
import { basename
|
|
11074
|
-
|
|
11075
|
-
// ../../node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js
|
|
11076
|
-
import fs from "node:fs";
|
|
11077
|
-
import path7 from "node:path";
|
|
11078
|
-
import process10 from "node:process";
|
|
11079
|
-
var isWindows = process10.platform === "win32";
|
|
11080
|
-
var separatorPattern = isWindows ? new RegExp("[\\/\\\\]", "v") : new RegExp("\\/", "v");
|
|
11081
|
-
var defaultPathExt = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";
|
|
11082
|
-
function resolveOptions(command, options) {
|
|
11083
|
-
if (typeof command !== "string" || command.length === 0) {
|
|
11084
|
-
throw new TypeError("Expected a non-empty string.");
|
|
11085
|
-
}
|
|
11086
|
-
const {
|
|
11087
|
-
cwd = process10.cwd(),
|
|
11088
|
-
// On Windows, `process.env.PATH` can be undefined in some contexts (for example, worker threads), where it's only exposed as `Path`.
|
|
11089
|
-
path: searchPath = process10.env.PATH ?? (isWindows ? process10.env.Path : void 0) ?? "",
|
|
11090
|
-
// `||` (not `??`) so an empty `PATHEXT` falls back to the default instead of disabling all lookup on Windows.
|
|
11091
|
-
pathExt = process10.env.PATHEXT || defaultPathExt
|
|
11092
|
-
} = options;
|
|
11093
|
-
return { cwd, searchPath, pathExt };
|
|
11094
|
-
}
|
|
11095
|
-
function windowsExtensions(command, pathExt) {
|
|
11096
|
-
const extensions = pathExt.split(path7.delimiter).filter(Boolean);
|
|
11097
|
-
const commandExtension = path7.extname(command).toLowerCase();
|
|
11098
|
-
if (commandExtension !== "" && extensions.some((extension) => extension.toLowerCase() === commandExtension)) {
|
|
11099
|
-
return ["", ...extensions];
|
|
11100
|
-
}
|
|
11101
|
-
return extensions;
|
|
11102
|
-
}
|
|
11103
|
-
function* candidatePaths(command, { cwd, searchPath, pathExt }) {
|
|
11104
|
-
const extensions = isWindows ? windowsExtensions(command, pathExt) : [""];
|
|
11105
|
-
if (separatorPattern.test(command)) {
|
|
11106
|
-
const base = path7.resolve(cwd, command);
|
|
11107
|
-
for (const extension of extensions) {
|
|
11108
|
-
yield base + extension;
|
|
11109
|
-
}
|
|
11110
|
-
return;
|
|
11111
|
-
}
|
|
11112
|
-
const directories = [
|
|
11113
|
-
// Windows searches the current directory before `PATH`.
|
|
11114
|
-
...isWindows ? [cwd] : [],
|
|
11115
|
-
...searchPath.split(path7.delimiter)
|
|
11116
|
-
];
|
|
11117
|
-
for (const directory of directories) {
|
|
11118
|
-
const unquoted = isWindows && directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
|
|
11119
|
-
if (unquoted === "") {
|
|
11120
|
-
continue;
|
|
11121
|
-
}
|
|
11122
|
-
const base = path7.resolve(cwd, unquoted, command);
|
|
11123
|
-
for (const extension of extensions) {
|
|
11124
|
-
yield base + extension;
|
|
11125
|
-
}
|
|
11126
|
-
}
|
|
11127
|
-
}
|
|
11128
|
-
function isExecutableSync(filePath) {
|
|
11129
|
-
let stats;
|
|
11130
|
-
try {
|
|
11131
|
-
stats = fs.statSync(filePath);
|
|
11132
|
-
} catch (error) {
|
|
11133
|
-
return isWindows && error.code === "EACCES";
|
|
11134
|
-
}
|
|
11135
|
-
if (!stats.isFile()) {
|
|
11136
|
-
return false;
|
|
11137
|
-
}
|
|
11138
|
-
if (isWindows) {
|
|
11139
|
-
return true;
|
|
11140
|
-
}
|
|
11141
|
-
try {
|
|
11142
|
-
fs.accessSync(filePath, fs.constants.X_OK);
|
|
11143
|
-
return true;
|
|
11144
|
-
} catch {
|
|
11145
|
-
return false;
|
|
11146
|
-
}
|
|
11147
|
-
}
|
|
11148
|
-
function whichCommandSync(command, options = {}) {
|
|
11149
|
-
const resolved = resolveOptions(command, options);
|
|
11150
|
-
for (const candidate of candidatePaths(command, resolved)) {
|
|
11151
|
-
if (isExecutableSync(candidate)) {
|
|
11152
|
-
return candidate;
|
|
11153
|
-
}
|
|
11154
|
-
}
|
|
11155
|
-
return void 0;
|
|
11156
|
-
}
|
|
11157
|
-
|
|
11158
|
-
// ../process-utils/src/exec-portable-file.ts
|
|
11598
|
+
import { basename as basename2 } from "node:path";
|
|
11159
11599
|
function resolvePortableCommand(command, options) {
|
|
11160
|
-
|
|
11161
|
-
const pathKey2 = envKeys.find((key) => key.toUpperCase() === "PATH");
|
|
11162
|
-
const pathExtKey = envKeys.find((key) => key.toUpperCase() === "PATHEXT");
|
|
11163
|
-
const commandExtension = extname2(command);
|
|
11164
|
-
const pathExt = options.env[pathExtKey ?? "PATHEXT"];
|
|
11165
|
-
return whichCommandSync(command, {
|
|
11166
|
-
cwd: options.cwd,
|
|
11167
|
-
path: options.env[pathKey2 ?? "PATH"],
|
|
11168
|
-
pathExt: commandExtension ? `${commandExtension};${pathExt ?? ".EXE;.COM;.CMD;.BAT"}` : pathExt
|
|
11169
|
-
});
|
|
11600
|
+
return hostToolchain.resolve(command, options) ?? void 0;
|
|
11170
11601
|
}
|
|
11171
11602
|
async function execPortableFile(command, args, options) {
|
|
11172
|
-
const
|
|
11173
|
-
if (
|
|
11603
|
+
const executable2 = basename2(command).toLowerCase().replace(/\.(exe|cmd|bat)$/u, "");
|
|
11604
|
+
if (executable2 === "git" || executable2 === "gh") {
|
|
11174
11605
|
return runVcsProcess(
|
|
11175
|
-
|
|
11606
|
+
executable2,
|
|
11176
11607
|
args,
|
|
11177
11608
|
() => execPortableFileUnbounded(command, args, options),
|
|
11178
11609
|
{
|
|
@@ -11195,9 +11626,10 @@ async function execPortableFileUnbounded(command, args, options) {
|
|
|
11195
11626
|
killed: false
|
|
11196
11627
|
});
|
|
11197
11628
|
}
|
|
11198
|
-
const
|
|
11629
|
+
const launch = hostToolchain.command(command, args, options);
|
|
11630
|
+
const subprocess = execa(launch.command, launch.args, {
|
|
11199
11631
|
cwd: options.cwd,
|
|
11200
|
-
env:
|
|
11632
|
+
env: launch.env,
|
|
11201
11633
|
extendEnv: false,
|
|
11202
11634
|
encoding: "buffer",
|
|
11203
11635
|
stripFinalNewline: false,
|
|
@@ -11253,6 +11685,7 @@ async function execPortableFileUnbounded(command, args, options) {
|
|
|
11253
11685
|
stderr: Buffer.from(result.stderr).toString("utf8")
|
|
11254
11686
|
};
|
|
11255
11687
|
if (!result.failed && !canceled && !timedOut) return output;
|
|
11688
|
+
hostToolchain.invalidateFailure(result.code ?? result.exitCode);
|
|
11256
11689
|
const stopped = canceled || result.isMaxBuffer || timedOut;
|
|
11257
11690
|
const syscall = result.cause instanceof Error && "syscall" in result.cause && typeof result.cause.syscall === "string" ? result.cause.syscall : void 0;
|
|
11258
11691
|
const overflowStream = result.shortMessage?.startsWith(
|
|
@@ -11293,56 +11726,15 @@ function sanitizeInheritedChildProcessEnv(args) {
|
|
|
11293
11726
|
return sanitizedEnv;
|
|
11294
11727
|
}
|
|
11295
11728
|
|
|
11296
|
-
// ../process-utils/src/process-info.ts
|
|
11297
|
-
import { execFile as execFile2 } from "node:child_process";
|
|
11298
|
-
import { promisify as promisify3 } from "node:util";
|
|
11299
|
-
var execFileAsync = promisify3(execFile2);
|
|
11300
|
-
|
|
11301
11729
|
// ../provider-bridge-protocol/src/bridge-kit/provider-maintenance-kit.ts
|
|
11302
11730
|
var import_compare = __toESM(require_compare(), 1);
|
|
11303
11731
|
var import_valid = __toESM(require_valid(), 1);
|
|
11304
|
-
import { execFile as execFile3 } from "node:child_process";
|
|
11305
|
-
import { constants as fsConstants } from "node:fs";
|
|
11306
|
-
import { access } from "node:fs/promises";
|
|
11307
11732
|
import path8 from "node:path";
|
|
11308
|
-
import { promisify as promisify4 } from "node:util";
|
|
11309
11733
|
import { z as z26 } from "zod";
|
|
11310
|
-
var execFileAsync2 = promisify4(execFile3);
|
|
11311
11734
|
var CLI_PROBE_TIMEOUT_MS = 5e3;
|
|
11312
11735
|
var INSTALLATION_CHECK_TIMEOUT_MS = 15e3;
|
|
11313
|
-
var DEFAULT_WINDOWS_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
11314
|
-
function selectResolvedExecutable(args) {
|
|
11315
|
-
const candidates = args.candidates.map((candidate) => candidate.trim()).filter((candidate) => candidate.length > 0);
|
|
11316
|
-
if (args.platform !== "win32") {
|
|
11317
|
-
return candidates[0] ?? null;
|
|
11318
|
-
}
|
|
11319
|
-
const extensions = (args.pathExt ?? DEFAULT_WINDOWS_PATHEXT).split(";").map((extension) => extension.trim().toLowerCase()).filter((extension) => extension.length > 0);
|
|
11320
|
-
return candidates.find(
|
|
11321
|
-
(candidate) => extensions.includes(path8.win32.extname(candidate).toLowerCase())
|
|
11322
|
-
) ?? null;
|
|
11323
|
-
}
|
|
11324
11736
|
async function resolveExecutablePath(command) {
|
|
11325
|
-
|
|
11326
|
-
try {
|
|
11327
|
-
await access(command, fsConstants.X_OK);
|
|
11328
|
-
return command;
|
|
11329
|
-
} catch {
|
|
11330
|
-
return null;
|
|
11331
|
-
}
|
|
11332
|
-
}
|
|
11333
|
-
try {
|
|
11334
|
-
const lookup = process.platform === "win32" ? "where" : "which";
|
|
11335
|
-
const { stdout } = await execFileAsync2(lookup, [command], {
|
|
11336
|
-
timeout: CLI_PROBE_TIMEOUT_MS
|
|
11337
|
-
});
|
|
11338
|
-
return selectResolvedExecutable({
|
|
11339
|
-
candidates: stdout.split(/\r?\n/u),
|
|
11340
|
-
platform: process.platform,
|
|
11341
|
-
pathExt: process.env.PATHEXT
|
|
11342
|
-
});
|
|
11343
|
-
} catch {
|
|
11344
|
-
return null;
|
|
11345
|
-
}
|
|
11737
|
+
return hostToolchain.resolve(command);
|
|
11346
11738
|
}
|
|
11347
11739
|
async function commandOutput(command, args) {
|
|
11348
11740
|
try {
|