Fix bunx (#18)

* Add symlink for bunx

* Remove node_modules, use bundled code instead

* Add revision support
This commit is contained in:
Ashcon Partovi 2023-09-11 12:37:45 -07:00 committed by GitHub
parent 67e559db2c
commit c34bee2511
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
272 changed files with 71159 additions and 37631 deletions

9
node_modules/esbuild/install.js generated vendored
View file

@ -88,6 +88,7 @@ var path2 = require("path");
var zlib = require("zlib");
var https = require("https");
var child_process = require("child_process");
var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version;
var toPath = path2.join(__dirname, "bin", "esbuild");
var isToPathJS = true;
function validateBinaryVersion(...command) {
@ -127,8 +128,8 @@ which means the "esbuild" binary executable can't be run. You can either:
}
throw err;
}
if (stdout !== "0.17.10") {
throw new Error(`Expected ${JSON.stringify("0.17.10")} but got ${JSON.stringify(stdout)}`);
if (stdout !== versionFromPackageJSON) {
throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`);
}
}
function isYarn() {
@ -180,7 +181,7 @@ function installUsingNPM(pkg, subpath, binPath) {
try {
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
child_process.execSync(
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.17.10"}`,
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`,
{ cwd: installDir, stdio: "pipe", env }
);
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
@ -231,7 +232,7 @@ function maybeOptimizePackage(binPath) {
}
}
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.17.10"}.tgz`;
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`;
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
try {
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));