esbuild 0.27.7 → 0.28.0
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 +1 -1
- package/install.js +21 -10
- package/lib/main.js +8 -8
- package/package.json +53 -28
package/bin/esbuild
CHANGED
|
@@ -201,7 +201,7 @@ for your current platform.`);
|
|
|
201
201
|
"node_modules",
|
|
202
202
|
".cache",
|
|
203
203
|
"esbuild",
|
|
204
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.
|
|
204
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.28.0"}-${path.basename(subpath)}`
|
|
205
205
|
);
|
|
206
206
|
if (!fs.existsSync(binTargetPath)) {
|
|
207
207
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
package/install.js
CHANGED
|
@@ -91,8 +91,9 @@ var os2 = require("os");
|
|
|
91
91
|
var path2 = require("path");
|
|
92
92
|
var zlib = require("zlib");
|
|
93
93
|
var https = require("https");
|
|
94
|
+
var crypto = require("crypto");
|
|
94
95
|
var child_process = require("child_process");
|
|
95
|
-
var
|
|
96
|
+
var packageJSON = require(path2.join(__dirname, "package.json"));
|
|
96
97
|
var toPath = path2.join(__dirname, "bin", "esbuild");
|
|
97
98
|
var isToPathJS = true;
|
|
98
99
|
function validateBinaryVersion(...command) {
|
|
@@ -132,8 +133,8 @@ which means the "esbuild" binary executable can't be run. You can either:
|
|
|
132
133
|
}
|
|
133
134
|
throw err;
|
|
134
135
|
}
|
|
135
|
-
if (stdout !==
|
|
136
|
-
throw new Error(`Expected ${JSON.stringify(
|
|
136
|
+
if (stdout !== packageJSON.version) {
|
|
137
|
+
throw new Error(`Expected ${JSON.stringify(packageJSON.version)} but got ${JSON.stringify(stdout)}`);
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
function isYarn() {
|
|
@@ -184,10 +185,11 @@ function installUsingNPM(pkg, subpath, binPath) {
|
|
|
184
185
|
try {
|
|
185
186
|
fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
|
|
186
187
|
child_process.execSync(
|
|
187
|
-
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${
|
|
188
|
+
`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${packageJSON.version}`,
|
|
188
189
|
{ cwd: installDir, stdio: "pipe", env }
|
|
189
190
|
);
|
|
190
191
|
const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
|
|
192
|
+
binaryIntegrityCheck(pkg, subpath, fs2.readFileSync(installedBinPath));
|
|
191
193
|
fs2.renameSync(installedBinPath, binPath);
|
|
192
194
|
} finally {
|
|
193
195
|
try {
|
|
@@ -220,8 +222,7 @@ require('child_process').execFileSync(${pathString}, process.argv.slice(2), { st
|
|
|
220
222
|
fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString};
|
|
221
223
|
${code}`);
|
|
222
224
|
}
|
|
223
|
-
function maybeOptimizePackage(binPath) {
|
|
224
|
-
const { isWASM } = pkgAndSubpathForCurrentPlatform();
|
|
225
|
+
function maybeOptimizePackage(binPath, isWASM) {
|
|
225
226
|
if (os2.platform() !== "win32" && !isYarn() && !isWASM) {
|
|
226
227
|
const tempPath = path2.join(__dirname, "bin-esbuild");
|
|
227
228
|
try {
|
|
@@ -233,11 +234,20 @@ function maybeOptimizePackage(binPath) {
|
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
}
|
|
237
|
+
function binaryIntegrityCheck(pkg, subpath, bytes) {
|
|
238
|
+
const hash = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
239
|
+
const key = `${pkg}/${subpath}`;
|
|
240
|
+
const expected = packageJSON["esbuild.binaryHashes"][key];
|
|
241
|
+
if (!expected) throw new Error(`Missing hash for "${key}"`);
|
|
242
|
+
if (hash !== expected) throw new Error(`"${hash.slice(0, 8)}..." doesn't match "${expected.slice(0, 8)}..."`);
|
|
243
|
+
}
|
|
236
244
|
async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
|
|
237
|
-
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${
|
|
245
|
+
const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${packageJSON.version}.tgz`;
|
|
238
246
|
console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
|
|
239
247
|
try {
|
|
240
|
-
|
|
248
|
+
const bytes = extractFileFromTarGzip(await fetch(url), subpath);
|
|
249
|
+
binaryIntegrityCheck(pkg, subpath, bytes);
|
|
250
|
+
fs2.writeFileSync(binPath, bytes);
|
|
241
251
|
fs2.chmodSync(binPath, 493);
|
|
242
252
|
} catch (e) {
|
|
243
253
|
console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`);
|
|
@@ -253,7 +263,7 @@ async function checkAndPreparePackage() {
|
|
|
253
263
|
return;
|
|
254
264
|
}
|
|
255
265
|
}
|
|
256
|
-
const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
|
|
266
|
+
const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
|
|
257
267
|
let binPath;
|
|
258
268
|
try {
|
|
259
269
|
binPath = require.resolve(`${pkg}/${subpath}`);
|
|
@@ -265,6 +275,7 @@ package.json feature is used by esbuild to install the correct binary executable
|
|
|
265
275
|
for your current platform. This install script will now attempt to work around
|
|
266
276
|
this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
|
267
277
|
`);
|
|
278
|
+
if (isWASM) throw new Error(`Failed to install package "${pkg}"`);
|
|
268
279
|
binPath = downloadedBinPath(pkg, subpath);
|
|
269
280
|
try {
|
|
270
281
|
console.error(`[esbuild] Trying to install package "${pkg}" using npm`);
|
|
@@ -278,7 +289,7 @@ this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
|
|
|
278
289
|
}
|
|
279
290
|
}
|
|
280
291
|
}
|
|
281
|
-
maybeOptimizePackage(binPath);
|
|
292
|
+
maybeOptimizePackage(binPath, isWASM);
|
|
282
293
|
}
|
|
283
294
|
checkAndPreparePackage().then(() => {
|
|
284
295
|
if (isToPathJS) {
|
package/lib/main.js
CHANGED
|
@@ -924,8 +924,8 @@ function createChannel(streamIn) {
|
|
|
924
924
|
if (isFirstPacket) {
|
|
925
925
|
isFirstPacket = false;
|
|
926
926
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
927
|
-
if (binaryVersion !== "0.
|
|
928
|
-
throw new Error(`Cannot start service: Host version "${"0.
|
|
927
|
+
if (binaryVersion !== "0.28.0") {
|
|
928
|
+
throw new Error(`Cannot start service: Host version "${"0.28.0"}" does not match binary version ${quote(binaryVersion)}`);
|
|
929
929
|
}
|
|
930
930
|
return;
|
|
931
931
|
}
|
|
@@ -2060,7 +2060,7 @@ for your current platform.`);
|
|
|
2060
2060
|
"node_modules",
|
|
2061
2061
|
".cache",
|
|
2062
2062
|
"esbuild",
|
|
2063
|
-
`pnpapi-${pkg.replace("/", "-")}-${"0.
|
|
2063
|
+
`pnpapi-${pkg.replace("/", "-")}-${"0.28.0"}-${path.basename(subpath)}`
|
|
2064
2064
|
);
|
|
2065
2065
|
if (!fs.existsSync(binTargetPath)) {
|
|
2066
2066
|
fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
|
|
@@ -2095,7 +2095,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
|
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
2097
|
var _a;
|
|
2098
|
-
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.
|
|
2098
|
+
var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.28.0";
|
|
2099
2099
|
var esbuildCommandAndArgs = () => {
|
|
2100
2100
|
if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
|
|
2101
2101
|
throw new Error(
|
|
@@ -2162,7 +2162,7 @@ var fsAsync = {
|
|
|
2162
2162
|
}
|
|
2163
2163
|
}
|
|
2164
2164
|
};
|
|
2165
|
-
var version = "0.
|
|
2165
|
+
var version = "0.28.0";
|
|
2166
2166
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
2167
2167
|
var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
|
|
2168
2168
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -2265,7 +2265,7 @@ var stopService;
|
|
|
2265
2265
|
var ensureServiceIsRunning = () => {
|
|
2266
2266
|
if (longLivedService) return longLivedService;
|
|
2267
2267
|
let [command, args] = esbuildCommandAndArgs();
|
|
2268
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.
|
|
2268
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.28.0"}`, "--ping"), {
|
|
2269
2269
|
windowsHide: true,
|
|
2270
2270
|
stdio: ["pipe", "pipe", "inherit"],
|
|
2271
2271
|
cwd: defaultWD
|
|
@@ -2369,7 +2369,7 @@ var runServiceSync = (callback) => {
|
|
|
2369
2369
|
esbuild: node_exports
|
|
2370
2370
|
});
|
|
2371
2371
|
callback(service);
|
|
2372
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.
|
|
2372
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.28.0"}`), {
|
|
2373
2373
|
cwd: defaultWD,
|
|
2374
2374
|
windowsHide: true,
|
|
2375
2375
|
input: stdin,
|
|
@@ -2389,7 +2389,7 @@ var workerThreadService = null;
|
|
|
2389
2389
|
var startWorkerThreadService = (worker_threads2) => {
|
|
2390
2390
|
let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
|
|
2391
2391
|
let worker = new worker_threads2.Worker(__filename, {
|
|
2392
|
-
workerData: { workerPort, defaultWD, esbuildVersion: "0.
|
|
2392
|
+
workerData: { workerPort, defaultWD, esbuildVersion: "0.28.0" },
|
|
2393
2393
|
transferList: [workerPort],
|
|
2394
2394
|
// From node's documentation: https://nodejs.org/api/worker_threads.html
|
|
2395
2395
|
//
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "esbuild",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "An extremely fast JavaScript and CSS bundler and minifier.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,32 +18,57 @@
|
|
|
18
18
|
"esbuild": "bin/esbuild"
|
|
19
19
|
},
|
|
20
20
|
"optionalDependencies": {
|
|
21
|
-
"@esbuild/aix-ppc64": "0.
|
|
22
|
-
"@esbuild/android-arm": "0.
|
|
23
|
-
"@esbuild/android-arm64": "0.
|
|
24
|
-
"@esbuild/android-x64": "0.
|
|
25
|
-
"@esbuild/darwin-arm64": "0.
|
|
26
|
-
"@esbuild/darwin-x64": "0.
|
|
27
|
-
"@esbuild/freebsd-arm64": "0.
|
|
28
|
-
"@esbuild/freebsd-x64": "0.
|
|
29
|
-
"@esbuild/linux-arm": "0.
|
|
30
|
-
"@esbuild/linux-arm64": "0.
|
|
31
|
-
"@esbuild/linux-ia32": "0.
|
|
32
|
-
"@esbuild/linux-loong64": "0.
|
|
33
|
-
"@esbuild/linux-mips64el": "0.
|
|
34
|
-
"@esbuild/linux-ppc64": "0.
|
|
35
|
-
"@esbuild/linux-riscv64": "0.
|
|
36
|
-
"@esbuild/linux-s390x": "0.
|
|
37
|
-
"@esbuild/linux-x64": "0.
|
|
38
|
-
"@esbuild/netbsd-arm64": "0.
|
|
39
|
-
"@esbuild/netbsd-x64": "0.
|
|
40
|
-
"@esbuild/openbsd-arm64": "0.
|
|
41
|
-
"@esbuild/openbsd-x64": "0.
|
|
42
|
-
"@esbuild/openharmony-arm64": "0.
|
|
43
|
-
"@esbuild/sunos-x64": "0.
|
|
44
|
-
"@esbuild/win32-arm64": "0.
|
|
45
|
-
"@esbuild/win32-ia32": "0.
|
|
46
|
-
"@esbuild/win32-x64": "0.
|
|
21
|
+
"@esbuild/aix-ppc64": "0.28.0",
|
|
22
|
+
"@esbuild/android-arm": "0.28.0",
|
|
23
|
+
"@esbuild/android-arm64": "0.28.0",
|
|
24
|
+
"@esbuild/android-x64": "0.28.0",
|
|
25
|
+
"@esbuild/darwin-arm64": "0.28.0",
|
|
26
|
+
"@esbuild/darwin-x64": "0.28.0",
|
|
27
|
+
"@esbuild/freebsd-arm64": "0.28.0",
|
|
28
|
+
"@esbuild/freebsd-x64": "0.28.0",
|
|
29
|
+
"@esbuild/linux-arm": "0.28.0",
|
|
30
|
+
"@esbuild/linux-arm64": "0.28.0",
|
|
31
|
+
"@esbuild/linux-ia32": "0.28.0",
|
|
32
|
+
"@esbuild/linux-loong64": "0.28.0",
|
|
33
|
+
"@esbuild/linux-mips64el": "0.28.0",
|
|
34
|
+
"@esbuild/linux-ppc64": "0.28.0",
|
|
35
|
+
"@esbuild/linux-riscv64": "0.28.0",
|
|
36
|
+
"@esbuild/linux-s390x": "0.28.0",
|
|
37
|
+
"@esbuild/linux-x64": "0.28.0",
|
|
38
|
+
"@esbuild/netbsd-arm64": "0.28.0",
|
|
39
|
+
"@esbuild/netbsd-x64": "0.28.0",
|
|
40
|
+
"@esbuild/openbsd-arm64": "0.28.0",
|
|
41
|
+
"@esbuild/openbsd-x64": "0.28.0",
|
|
42
|
+
"@esbuild/openharmony-arm64": "0.28.0",
|
|
43
|
+
"@esbuild/sunos-x64": "0.28.0",
|
|
44
|
+
"@esbuild/win32-arm64": "0.28.0",
|
|
45
|
+
"@esbuild/win32-ia32": "0.28.0",
|
|
46
|
+
"@esbuild/win32-x64": "0.28.0"
|
|
47
47
|
},
|
|
48
|
-
"license": "MIT"
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"esbuild.binaryHashes": {
|
|
50
|
+
"@esbuild/aix-ppc64/bin/esbuild": "2037fe2a315e737da7d8fbfff5a582243e0a2ee32462f08c69d4833b4e3f9e06",
|
|
51
|
+
"@esbuild/android-arm64/bin/esbuild": "6acacac48d2104e6e58bd92104e86acfb3c8f344e965a910a749ea024ec044e5",
|
|
52
|
+
"@esbuild/darwin-arm64/bin/esbuild": "6f0e1237f63fa3bc03963e58f0b0be1b9bfacd8f2dc9a3f28483e8f97e4ef2d6",
|
|
53
|
+
"@esbuild/darwin-x64/bin/esbuild": "23dadf855f4ef8cf7c159ed5e4018b8f95d66f7e230a3a04f0add7fb809640ad",
|
|
54
|
+
"@esbuild/freebsd-arm64/bin/esbuild": "94f2b3af237a7fb2c5061f311e35b7fca15553304f77222b4da7996a35049b88",
|
|
55
|
+
"@esbuild/freebsd-x64/bin/esbuild": "c9f571484b1661b93c90cca5781fccd8fc08116eccd4c77079452e51aa2a8240",
|
|
56
|
+
"@esbuild/linux-arm/bin/esbuild": "cd2cf1814f32e671c3765e9a26da6a28fc659be2f95426e8f4a116a1f4eb6949",
|
|
57
|
+
"@esbuild/linux-arm64/bin/esbuild": "f76afb23c4c27f7837a4fc5fc7123e2e2c75c7f8c6a54e09bddfc06d39e288dd",
|
|
58
|
+
"@esbuild/linux-ia32/bin/esbuild": "37ce681c3d0193063cbbf95267d191583f2ffbb818fc81716915f99613af42e9",
|
|
59
|
+
"@esbuild/linux-loong64/bin/esbuild": "0565b36f66537e657447aacf6a79f0d4fb91bca78803d20e46c9077e75af8230",
|
|
60
|
+
"@esbuild/linux-mips64el/bin/esbuild": "33e1bdf0e9423efddb2515b0a29fa409826a18eadd6340fff0e3927574b58475",
|
|
61
|
+
"@esbuild/linux-ppc64/bin/esbuild": "38a3dbbce29bb4ffb5fa2121478f46eb0d6d4979687718c20111372ccfdba169",
|
|
62
|
+
"@esbuild/linux-riscv64/bin/esbuild": "2a7317332a2d2bc27dc0ad33123571fa1a9f3aa448c07f6eb7b7c11354e49da8",
|
|
63
|
+
"@esbuild/linux-s390x/bin/esbuild": "d4eb9dcf9f112fee07d3f2256b397cc1ff49ac097d579d07dc5ceacec1276c12",
|
|
64
|
+
"@esbuild/linux-x64/bin/esbuild": "aafacdf135322bf47c882a4ea4db33d0375583f5b9c3fd2d4e12258e470568be",
|
|
65
|
+
"@esbuild/netbsd-arm64/bin/esbuild": "b4d529ea102b3d8e1d77f136be1d8b8496d641c216db8e4ce314f01b9ba02cd1",
|
|
66
|
+
"@esbuild/netbsd-x64/bin/esbuild": "ef999b6e59c2f7ed319f0bc804bffd9c5fec4dd7fd60c77f52300a7ffde2f12d",
|
|
67
|
+
"@esbuild/openbsd-arm64/bin/esbuild": "5de4790175cb306939af247b0a33036067a2677162d1a79635c77161c13cebee",
|
|
68
|
+
"@esbuild/openbsd-x64/bin/esbuild": "1b0dffef766fd0443f76b3031535a79ebf91050e0438399569539f9eae940d24",
|
|
69
|
+
"@esbuild/sunos-x64/bin/esbuild": "81ded843321d3d7a51986859ce859ea8d497e6fa4e3400c9d5ba3df0671a12df",
|
|
70
|
+
"@esbuild/win32-arm64/esbuild.exe": "ab1477cf488a7f961c3cd7da0689e4a78f8cac3c30eb1021ca0dba46aab25493",
|
|
71
|
+
"@esbuild/win32-ia32/esbuild.exe": "6b687d79c8d59bee797ac9872f3e25f229451059e12e60951f476a32d0e8ee71",
|
|
72
|
+
"@esbuild/win32-x64/esbuild.exe": "2ccfd6d5292493a810d21c0b40f9de3ff5252a0a24eb5dea3df07f33dcea0c0e"
|
|
73
|
+
}
|
|
49
74
|
}
|