mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 12:38:24 +02:00
Fix bunx (#18)
* Add symlink for bunx * Remove node_modules, use bundled code instead * Add revision support
This commit is contained in:
parent
67e559db2c
commit
c34bee2511
272 changed files with 71159 additions and 37631 deletions
58
node_modules/esbuild/lib/main.js
generated
vendored
58
node_modules/esbuild/lib/main.js
generated
vendored
|
@ -314,7 +314,9 @@ function pushCommonFlags(flags, options, keys) {
|
|||
let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
|
||||
let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
|
||||
let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean);
|
||||
let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger);
|
||||
let drop = getFlag(options, keys, "drop", mustBeArray);
|
||||
let dropLabels = getFlag(options, keys, "dropLabels", mustBeArray);
|
||||
let charset = getFlag(options, keys, "charset", mustBeString);
|
||||
let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean);
|
||||
let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean);
|
||||
|
@ -330,6 +332,7 @@ function pushCommonFlags(flags, options, keys) {
|
|||
let pure = getFlag(options, keys, "pure", mustBeArray);
|
||||
let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
|
||||
let platform = getFlag(options, keys, "platform", mustBeString);
|
||||
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
||||
if (legalComments)
|
||||
flags.push(`--legal-comments=${legalComments}`);
|
||||
if (sourceRoot !== void 0)
|
||||
|
@ -348,6 +351,8 @@ function pushCommonFlags(flags, options, keys) {
|
|||
flags.push(`--global-name=${globalName}`);
|
||||
if (platform)
|
||||
flags.push(`--platform=${platform}`);
|
||||
if (tsconfigRaw)
|
||||
flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
|
||||
if (minify)
|
||||
flags.push("--minify");
|
||||
if (minifySyntax)
|
||||
|
@ -356,6 +361,8 @@ function pushCommonFlags(flags, options, keys) {
|
|||
flags.push("--minify-whitespace");
|
||||
if (minifyIdentifiers)
|
||||
flags.push("--minify-identifiers");
|
||||
if (lineLimit)
|
||||
flags.push(`--line-limit=${lineLimit}`);
|
||||
if (charset)
|
||||
flags.push(`--charset=${charset}`);
|
||||
if (treeShaking !== void 0)
|
||||
|
@ -365,6 +372,8 @@ function pushCommonFlags(flags, options, keys) {
|
|||
if (drop)
|
||||
for (let what of drop)
|
||||
flags.push(`--drop:${validateStringValue(what, "drop")}`);
|
||||
if (dropLabels)
|
||||
flags.push(`--drop-labels=${Array.from(dropLabels).map((what) => validateStringValue(what, "dropLabels")).join(",")}`);
|
||||
if (mangleProps)
|
||||
flags.push(`--mangle-props=${mangleProps.source}`);
|
||||
if (reserveProps)
|
||||
|
@ -622,7 +631,6 @@ function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
|
|||
pushLogFlags(flags, options, keys, isTTY2, logLevelDefault);
|
||||
pushCommonFlags(flags, options, keys);
|
||||
let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean);
|
||||
let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject);
|
||||
let sourcefile = getFlag(options, keys, "sourcefile", mustBeString);
|
||||
let loader = getFlag(options, keys, "loader", mustBeString);
|
||||
let banner = getFlag(options, keys, "banner", mustBeString);
|
||||
|
@ -631,8 +639,6 @@ function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) {
|
|||
checkForInvalidFlags(options, keys, `in ${callName}() call`);
|
||||
if (sourcemap)
|
||||
flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`);
|
||||
if (tsconfigRaw)
|
||||
flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`);
|
||||
if (sourcefile)
|
||||
flags.push(`--sourcefile=${sourcefile}`);
|
||||
if (loader)
|
||||
|
@ -727,7 +733,11 @@ function createChannel(streamIn) {
|
|||
}
|
||||
throw new Error(`Invalid command: ` + request.command);
|
||||
} catch (e) {
|
||||
sendResponse(id, { errors: [extractErrorMessageV8(e, streamIn, null, void 0, "")] });
|
||||
const errors = [extractErrorMessageV8(e, streamIn, null, void 0, "")];
|
||||
try {
|
||||
sendResponse(id, { errors });
|
||||
} catch {
|
||||
}
|
||||
}
|
||||
};
|
||||
let isFirstPacket = true;
|
||||
|
@ -735,8 +745,8 @@ function createChannel(streamIn) {
|
|||
if (isFirstPacket) {
|
||||
isFirstPacket = false;
|
||||
let binaryVersion = String.fromCharCode(...bytes);
|
||||
if (binaryVersion !== "0.17.10") {
|
||||
throw new Error(`Cannot start service: Host version "${"0.17.10"}" does not match binary version ${quote(binaryVersion)}`);
|
||||
if (binaryVersion !== "0.19.2") {
|
||||
throw new Error(`Cannot start service: Host version "${"0.19.2"}" does not match binary version ${quote(binaryVersion)}`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1134,6 +1144,7 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|||
const servedir = getFlag(options2, keys, "servedir", mustBeString);
|
||||
const keyfile = getFlag(options2, keys, "keyfile", mustBeString);
|
||||
const certfile = getFlag(options2, keys, "certfile", mustBeString);
|
||||
const fallback = getFlag(options2, keys, "fallback", mustBeString);
|
||||
const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction);
|
||||
checkForInvalidFlags(options2, keys, `in serve() call`);
|
||||
const request2 = {
|
||||
|
@ -1151,6 +1162,8 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
|
|||
request2.keyfile = keyfile;
|
||||
if (certfile !== void 0)
|
||||
request2.certfile = certfile;
|
||||
if (fallback !== void 0)
|
||||
request2.fallback = fallback;
|
||||
sendRequest(refs, request2, (error2, response2) => {
|
||||
if (error2)
|
||||
return reject(new Error(error2));
|
||||
|
@ -1622,7 +1635,7 @@ function parseStackLinesV8(streamIn, lines, ident) {
|
|||
}
|
||||
function failureErrorWithLog(text, errors, warnings) {
|
||||
let limit = 5;
|
||||
let summary = errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => {
|
||||
text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => {
|
||||
if (i === limit)
|
||||
return "\n...";
|
||||
if (!e.location)
|
||||
|
@ -1633,9 +1646,19 @@ error: ${e.text}`;
|
|||
return `
|
||||
${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`;
|
||||
}).join("");
|
||||
let error = new Error(`${text}${summary}`);
|
||||
error.errors = errors;
|
||||
error.warnings = warnings;
|
||||
let error = new Error(text);
|
||||
for (const [key, value] of [["errors", errors], ["warnings", warnings]]) {
|
||||
Object.defineProperty(error, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: () => value,
|
||||
set: (value2) => Object.defineProperty(error, key, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: value2
|
||||
})
|
||||
});
|
||||
}
|
||||
return error;
|
||||
}
|
||||
function replaceDetailsInMessages(messages, stash) {
|
||||
|
@ -1713,11 +1736,12 @@ function sanitizeStringArray(values, property) {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
function convertOutputFiles({ path: path3, contents }) {
|
||||
function convertOutputFiles({ path: path3, contents, hash }) {
|
||||
let text = null;
|
||||
return {
|
||||
path: path3,
|
||||
contents,
|
||||
hash,
|
||||
get text() {
|
||||
const binary = this.contents;
|
||||
if (text === null || binary !== contents) {
|
||||
|
@ -1905,7 +1929,7 @@ for your current platform.`);
|
|||
"node_modules",
|
||||
".cache",
|
||||
"esbuild",
|
||||
`pnpapi-${pkg.replace("/", "-")}-${"0.17.10"}-${path.basename(subpath)}`
|
||||
`pnpapi-${pkg.replace("/", "-")}-${"0.19.2"}-${path.basename(subpath)}`
|
||||
);
|
||||
if (!fs.existsSync(binTargetPath)) {
|
||||
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
||||
|
@ -1940,7 +1964,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|||
}
|
||||
}
|
||||
var _a;
|
||||
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.17.10";
|
||||
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.2";
|
||||
var esbuildCommandAndArgs = () => {
|
||||
if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
||||
throw new Error(
|
||||
|
@ -2007,7 +2031,7 @@ var fsAsync = {
|
|||
}
|
||||
}
|
||||
};
|
||||
var version = "0.17.10";
|
||||
var version = "0.19.2";
|
||||
var build = (options) => ensureServiceIsRunning().build(options);
|
||||
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
||||
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
||||
|
@ -2117,7 +2141,7 @@ var ensureServiceIsRunning = () => {
|
|||
if (longLivedService)
|
||||
return longLivedService;
|
||||
let [command, args] = esbuildCommandAndArgs();
|
||||
let child = child_process.spawn(command, args.concat(`--service=${"0.17.10"}`, "--ping"), {
|
||||
let child = child_process.spawn(command, args.concat(`--service=${"0.19.2"}`, "--ping"), {
|
||||
windowsHide: true,
|
||||
stdio: ["pipe", "pipe", "inherit"],
|
||||
cwd: defaultWD
|
||||
|
@ -2217,7 +2241,7 @@ var runServiceSync = (callback) => {
|
|||
esbuild: node_exports
|
||||
});
|
||||
callback(service);
|
||||
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.17.10"}`), {
|
||||
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.2"}`), {
|
||||
cwd: defaultWD,
|
||||
windowsHide: true,
|
||||
input: stdin,
|
||||
|
@ -2237,7 +2261,7 @@ var workerThreadService = null;
|
|||
var startWorkerThreadService = (worker_threads2) => {
|
||||
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
||||
let worker = new worker_threads2.Worker(__filename, {
|
||||
workerData: { workerPort, defaultWD, esbuildVersion: "0.17.10" },
|
||||
workerData: { workerPort, defaultWD, esbuildVersion: "0.19.2" },
|
||||
transferList: [workerPort],
|
||||
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
||||
//
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue