#!/usr/bin/env node var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); var __reExport = (target, module2, desc) => { if (module2 && typeof module2 === "object" || typeof module2 === "function") { for (let key of __getOwnPropNames(module2)) if (!__hasOwnProp.call(target, key) && key !== "default") __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); } return target; }; var __toModule = (module2) => { return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); }; // lib/npm/node-platform.ts var fs = require("fs"); var os = require("os"); var path = require("path"); var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; var knownWindowsPackages = { "win32 arm64 LE": "esbuild-windows-arm64", "win32 ia32 LE": "esbuild-windows-32", "win32 x64 LE": "esbuild-windows-64" }; var knownUnixlikePackages = { "android arm64 LE": "esbuild-android-arm64", "darwin arm64 LE": "esbuild-darwin-arm64", "darwin x64 LE": "esbuild-darwin-64", "freebsd arm64 LE": "esbuild-freebsd-arm64", "freebsd x64 LE": "esbuild-freebsd-64", "openbsd x64 LE": "esbuild-openbsd-64", "linux arm LE": "esbuild-linux-arm", "linux arm64 LE": "esbuild-linux-arm64", "linux ia32 LE": "esbuild-linux-32", "linux mips64el LE": "esbuild-linux-mips64le", "linux ppc64 LE": "esbuild-linux-ppc64le", "linux x64 LE": "esbuild-linux-64", "sunos x64 LE": "esbuild-sunos-64" }; function pkgAndSubpathForCurrentPlatform() { let pkg; let subpath; let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; if (platformKey in knownWindowsPackages) { pkg = knownWindowsPackages[platformKey]; subpath = "esbuild.exe"; } else if (platformKey in knownUnixlikePackages) { pkg = knownUnixlikePackages[platformKey]; subpath = "bin/esbuild"; } else { throw new Error(`Unsupported platform: ${platformKey}`); } return { pkg, subpath }; } function downloadedBinPath(pkg, subpath) { const esbuildLibDir = path.dirname(require.resolve("esbuild")); return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); } function generateBinPath() { if (ESBUILD_BINARY_PATH) { return ESBUILD_BINARY_PATH; } const { pkg, subpath } = pkgAndSubpathForCurrentPlatform(); let binPath; try { binPath = require.resolve(`${pkg}/${subpath}`); } catch (e) { binPath = downloadedBinPath(pkg, subpath); if (!fs.existsSync(binPath)) { try { require.resolve(pkg); } catch (e2) { throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. If you are installing esbuild with npm, make sure that you don't specify the "--no-optional" flag. The "optionalDependencies" package.json feature is used by esbuild to install the correct binary executable for your current platform.`); } throw e; } } let isYarnPnP = false; try { require("pnpapi"); isYarnPnP = true; } catch (e) { } if (isYarnPnP) { const esbuildLibDir = path.dirname(require.resolve("esbuild")); const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`); if (!fs.existsSync(binTargetPath)) { fs.copyFileSync(binPath, binTargetPath); fs.chmodSync(binTargetPath, 493); } return binTargetPath; } return binPath; } // lib/npm/node-shim.ts require("child_process").execFileSync(generateBinPath(), process.argv.slice(2), { stdio: "inherit" });