Remove node_modules, use bundled code instead

This commit is contained in:
Ashcon Partovi 2023-09-11 09:20:47 -07:00
parent b5e3caf47a
commit 5254461333
269 changed files with 71107 additions and 37583 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));