esbuild 0.15.7 → 0.15.9
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/bin/esbuild +35 -9
- package/install.js +5 -4
- package/lib/main.d.ts +2 -0
- package/lib/main.js +639 -671
- package/package.json +23 -22
package/bin/esbuild
CHANGED
|
@@ -24,6 +24,8 @@ var fs = require("fs");
|
|
|
24
24
|
var os = require("os");
|
|
25
25
|
var path = require("path");
|
|
26
26
|
var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH;
|
|
27
|
+
var packageDarwin_arm64 = "esbuild-darwin-arm64";
|
|
28
|
+
var packageDarwin_x64 = "esbuild-darwin-64";
|
|
27
29
|
var knownWindowsPackages = {
|
|
28
30
|
"win32 arm64 LE": "esbuild-windows-arm64",
|
|
29
31
|
"win32 ia32 LE": "esbuild-windows-32",
|
|
@@ -49,6 +51,7 @@ var knownUnixlikePackages = {
|
|
|
49
51
|
"sunos x64 LE": "esbuild-sunos-64"
|
|
50
52
|
};
|
|
51
53
|
var knownWebAssemblyFallbackPackages = {
|
|
54
|
+
"android arm LE": "@esbuild/android-arm",
|
|
52
55
|
"android x64 LE": "esbuild-android-64"
|
|
53
56
|
};
|
|
54
57
|
function pkgAndSubpathForCurrentPlatform() {
|
|
@@ -114,11 +117,7 @@ function generateBinPath() {
|
|
|
114
117
|
} catch {
|
|
115
118
|
const otherPkg = pkgForSomeOtherPlatform();
|
|
116
119
|
if (otherPkg) {
|
|
117
|
-
|
|
118
|
-
You installed esbuild on another platform than the one you're currently using.
|
|
119
|
-
This won't work because esbuild is written with native code and needs to
|
|
120
|
-
install a platform-specific binary executable.
|
|
121
|
-
|
|
120
|
+
let suggestions = `
|
|
122
121
|
Specifically the "${otherPkg}" package is present but this platform
|
|
123
122
|
needs the "${pkg}" package instead. People often get into this
|
|
124
123
|
situation by installing esbuild on Windows or macOS and copying "node_modules"
|
|
@@ -128,14 +127,40 @@ Windows and WSL environments.
|
|
|
128
127
|
If you are installing with npm, you can try not copying the "node_modules"
|
|
129
128
|
directory when you copy the files over, and running "npm ci" or "npm install"
|
|
130
129
|
on the destination platform after the copy. Or you could consider using yarn
|
|
131
|
-
instead which has built-in support for installing a package on multiple
|
|
130
|
+
instead of npm which has built-in support for installing a package on multiple
|
|
132
131
|
platforms simultaneously.
|
|
133
132
|
|
|
134
133
|
If you are installing with yarn, you can try listing both this platform and the
|
|
135
134
|
other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
|
|
136
135
|
feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
137
136
|
Keep in mind that this means multiple copies of esbuild will be present.
|
|
137
|
+
`;
|
|
138
|
+
if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) {
|
|
139
|
+
suggestions = `
|
|
140
|
+
Specifically the "${otherPkg}" package is present but this platform
|
|
141
|
+
needs the "${pkg}" package instead. People often get into this
|
|
142
|
+
situation by installing esbuild with npm running inside of Rosetta 2 and then
|
|
143
|
+
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
|
|
144
|
+
2 is Apple's on-the-fly x86_64-to-arm64 translation service).
|
|
138
145
|
|
|
146
|
+
If you are installing with npm, you can try ensuring that both npm and node are
|
|
147
|
+
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
|
|
148
|
+
changing how you installed npm and/or node. For example, installing node with
|
|
149
|
+
the universal installer here should work: https://nodejs.org/en/download/. Or
|
|
150
|
+
you could consider using yarn instead of npm which has built-in support for
|
|
151
|
+
installing a package on multiple platforms simultaneously.
|
|
152
|
+
|
|
153
|
+
If you are installing with yarn, you can try listing both "arm64" and "x64"
|
|
154
|
+
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
|
|
155
|
+
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
|
|
156
|
+
Keep in mind that this means multiple copies of esbuild will be present.
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
throw new Error(`
|
|
160
|
+
You installed esbuild for another platform than the one you're currently using.
|
|
161
|
+
This won't work because esbuild is written with native code and needs to
|
|
162
|
+
install a platform-specific binary executable.
|
|
163
|
+
${suggestions}
|
|
139
164
|
Another alternative is to use the "esbuild-wasm" package instead, which works
|
|
140
165
|
the same way on all platforms. But it comes with a heavy performance cost and
|
|
141
166
|
can sometimes be 10x slower than the "esbuild" package, so you may also not
|
|
@@ -145,8 +170,9 @@ want to do that.
|
|
|
145
170
|
throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
|
|
146
171
|
|
|
147
172
|
If you are installing esbuild with npm, make sure that you don't specify the
|
|
148
|
-
"--no-optional"
|
|
149
|
-
by esbuild to install the correct binary executable
|
|
173
|
+
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
|
|
174
|
+
of "package.json" is used by esbuild to install the correct binary executable
|
|
175
|
+
for your current platform.`);
|
|
150
176
|
}
|
|
151
177
|
throw e;
|
|
152
178
|
}
|
|
@@ -163,7 +189,7 @@ by esbuild to install the correct binary executable for your current platform.`)
|
|
|
163
189
|
"node_modules",
|
|
164
190
|
".cache",
|
|
165
191
|
"esbuild",
|
|
166
|
-
`pnpapi-${pkg}-${"0.15.
|
|
192
|
+
`pnpapi-${pkg}-${"0.15.9"}-${path.basename(subpath)}`
|
|
167
193
|
);
|
|
168
194
|
if (!fs.existsSync(binTargetPath)) {
|
|
169
195
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
package/install.js
CHANGED
|
@@ -48,6 +48,7 @@ var knownUnixlikePackages = {
|
|
|
48
48
|
"sunos x64 LE": "esbuild-sunos-64"
|
|
49
49
|
};
|
|
50
50
|
var knownWebAssemblyFallbackPackages = {
|
|
51
|
+
"android arm LE": "@esbuild/android-arm",
|
|
51
52
|
"android x64 LE": "esbuild-android-64"
|
|
52
53
|
};
|
|
53
54
|
function pkgAndSubpathForCurrentPlatform() {
|
|
@@ -89,8 +90,8 @@ function validateBinaryVersion(...command) {
|
|
|
89
90
|
const stdout = child_process.execFileSync(command.shift(), command, {
|
|
90
91
|
stdio: "pipe"
|
|
91
92
|
}).toString().trim();
|
|
92
|
-
if (stdout !== "0.15.
|
|
93
|
-
throw new Error(`Expected ${JSON.stringify("0.15.
|
|
93
|
+
if (stdout !== "0.15.9") {
|
|
94
|
+
throw new Error(`Expected ${JSON.stringify("0.15.9")} but got ${JSON.stringify(stdout)}`);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
function isYarn() {
|
|
@@ -142,7 +143,7 @@ function installUsingNPM(pkg, subpath, binPath) {
|
|
|
142
143
|
try {
|
|
143
144
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
|
144
145
|
child_process.execSync(
|
|
145
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.15.
|
|
146
|
+
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.15.9"}`,
|
|
146
147
|
{ cwd: installDir, stdio: "pipe", env }
|
|
147
148
|
);
|
|
148
149
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
|
@@ -193,7 +194,7 @@ function maybeOptimizePackage(binPath) {
|
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
|
196
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.15.
|
|
197
|
+
const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.15.9"}.tgz`;
|
|
197
198
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
|
198
199
|
try {
|
|
199
200
|
fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
|
package/lib/main.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ interface CommonOptions {
|
|
|
61
61
|
jsxImportSource?: string;
|
|
62
62
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
|
63
63
|
jsxDev?: boolean;
|
|
64
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
|
65
|
+
jsxSideEffects?: boolean;
|
|
64
66
|
|
|
65
67
|
/** Documentation: https://esbuild.github.io/api/#define */
|
|
66
68
|
define?: { [key: string]: string };
|