esbuild 0.11.19 → 0.11.20
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/install.js +7 -4
- package/lib/main.js +31 -20
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
6
|
-
var
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
7
9
|
for (var prop in b || (b = {}))
|
|
8
10
|
if (__hasOwnProp.call(b, prop))
|
|
9
11
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -14,13 +16,14 @@ var __objSpread = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
const fs = require("fs");
|
|
18
21
|
const os = require("os");
|
|
19
22
|
const path = require("path");
|
|
20
23
|
const zlib = require("zlib");
|
|
21
24
|
const https = require("https");
|
|
22
25
|
const child_process = require("child_process");
|
|
23
|
-
const version = "0.11.
|
|
26
|
+
const version = "0.11.20";
|
|
24
27
|
const binPath = path.join(__dirname, "bin", "esbuild");
|
|
25
28
|
async function installBinaryFromPackage(name, fromPath, toPath) {
|
|
26
29
|
const cachePath = getCachePath(name);
|
|
@@ -150,7 +153,7 @@ function installUsingNPM(name, file) {
|
|
|
150
153
|
const installDir = path.join(os.tmpdir(), "esbuild-" + Math.random().toString(36).slice(2));
|
|
151
154
|
fs.mkdirSync(installDir, {recursive: true});
|
|
152
155
|
fs.writeFileSync(path.join(installDir, "package.json"), "{}");
|
|
153
|
-
const env =
|
|
156
|
+
const env = __spreadProps(__spreadValues({}, process.env), {npm_config_global: void 0});
|
|
154
157
|
child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${name}@${version}`, {cwd: installDir, stdio: "pipe", env});
|
|
155
158
|
const buffer = fs.readFileSync(path.join(installDir, "node_modules", name, file));
|
|
156
159
|
try {
|
package/lib/main.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
3
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value}) : obj[key] = value;
|
|
6
|
-
var
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
7
9
|
for (var prop in b || (b = {}))
|
|
8
10
|
if (__hasOwnProp.call(b, prop))
|
|
9
11
|
__defNormalProp(a, prop, b[prop]);
|
|
@@ -14,6 +16,7 @@ var __objSpread = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
|
|
18
21
|
var __export = (target, all) => {
|
|
19
22
|
for (var name in all)
|
|
@@ -251,7 +254,7 @@ function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) {
|
|
|
251
254
|
let color = getFlag(options, keys, "color", mustBeBoolean);
|
|
252
255
|
let logLevel = getFlag(options, keys, "logLevel", mustBeString);
|
|
253
256
|
let logLimit = getFlag(options, keys, "logLimit", mustBeInteger);
|
|
254
|
-
if (color)
|
|
257
|
+
if (color !== void 0)
|
|
255
258
|
flags.push(`--color=${color}`);
|
|
256
259
|
else if (isTTY2)
|
|
257
260
|
flags.push(`--color=true`);
|
|
@@ -683,8 +686,8 @@ function createChannel(streamIn) {
|
|
|
683
686
|
if (isFirstPacket) {
|
|
684
687
|
isFirstPacket = false;
|
|
685
688
|
let binaryVersion = String.fromCharCode(...bytes);
|
|
686
|
-
if (binaryVersion !== "0.11.
|
|
687
|
-
throw new Error(`Cannot start service: Host version "${"0.11.
|
|
689
|
+
if (binaryVersion !== "0.11.20") {
|
|
690
|
+
throw new Error(`Cannot start service: Host version "${"0.11.20"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
|
|
688
691
|
}
|
|
689
692
|
return;
|
|
690
693
|
}
|
|
@@ -909,15 +912,15 @@ function createChannel(streamIn) {
|
|
|
909
912
|
throw new Error(`Invalid command: ` + request.command);
|
|
910
913
|
}
|
|
911
914
|
};
|
|
912
|
-
let runOnEndCallbacks = (result, done) => done();
|
|
915
|
+
let runOnEndCallbacks = (result, logPluginError, done) => done();
|
|
913
916
|
if (onEndCallbacks.length > 0) {
|
|
914
|
-
runOnEndCallbacks = (result, done) => {
|
|
917
|
+
runOnEndCallbacks = (result, logPluginError, done) => {
|
|
915
918
|
(async () => {
|
|
916
919
|
for (const {name, callback: callback2, note} of onEndCallbacks) {
|
|
917
920
|
try {
|
|
918
921
|
await callback2(result);
|
|
919
922
|
} catch (e) {
|
|
920
|
-
result.errors.push(
|
|
923
|
+
result.errors.push(await new Promise((resolve) => logPluginError(e, name, note && note(), resolve)));
|
|
921
924
|
}
|
|
922
925
|
}
|
|
923
926
|
})().then(done);
|
|
@@ -992,15 +995,20 @@ function createChannel(streamIn) {
|
|
|
992
995
|
plugins = value;
|
|
993
996
|
}
|
|
994
997
|
}
|
|
995
|
-
let
|
|
998
|
+
let logPluginError = (e, pluginName, note, done) => {
|
|
996
999
|
let flags = [];
|
|
997
1000
|
try {
|
|
998
1001
|
pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault);
|
|
999
1002
|
} catch (e2) {
|
|
1000
1003
|
}
|
|
1001
|
-
const
|
|
1002
|
-
sendRequest(refs, {command: "error", flags, error}, () => {
|
|
1003
|
-
|
|
1004
|
+
const message = extractErrorMessageV8(e, streamIn, details, note, pluginName);
|
|
1005
|
+
sendRequest(refs, {command: "error", flags, error: message}, () => {
|
|
1006
|
+
message.detail = details.load(message.detail);
|
|
1007
|
+
done(message);
|
|
1008
|
+
});
|
|
1009
|
+
};
|
|
1010
|
+
let handleError = (e, pluginName) => {
|
|
1011
|
+
logPluginError(e, pluginName, void 0, (error) => {
|
|
1004
1012
|
callback(failureErrorWithLog("Build failed", [error], []), null);
|
|
1005
1013
|
});
|
|
1006
1014
|
};
|
|
@@ -1012,9 +1020,10 @@ function createChannel(streamIn) {
|
|
|
1012
1020
|
handleError(result.error, result.pluginName);
|
|
1013
1021
|
} else {
|
|
1014
1022
|
try {
|
|
1015
|
-
buildOrServeContinue(
|
|
1023
|
+
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
|
1016
1024
|
key,
|
|
1017
1025
|
details,
|
|
1026
|
+
logPluginError,
|
|
1018
1027
|
requestPlugins: result.requestPlugins,
|
|
1019
1028
|
runOnEndCallbacks: result.runOnEndCallbacks,
|
|
1020
1029
|
pluginRefs: result.pluginRefs
|
|
@@ -1026,11 +1035,12 @@ function createChannel(streamIn) {
|
|
|
1026
1035
|
}, (e) => handleError(e, ""));
|
|
1027
1036
|
} else {
|
|
1028
1037
|
try {
|
|
1029
|
-
buildOrServeContinue(
|
|
1038
|
+
buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
|
|
1030
1039
|
key,
|
|
1031
1040
|
details,
|
|
1041
|
+
logPluginError,
|
|
1032
1042
|
requestPlugins: null,
|
|
1033
|
-
runOnEndCallbacks: (result, done) => done(),
|
|
1043
|
+
runOnEndCallbacks: (result, logPluginError2, done) => done(),
|
|
1034
1044
|
pluginRefs: null
|
|
1035
1045
|
}));
|
|
1036
1046
|
} catch (e) {
|
|
@@ -1048,6 +1058,7 @@ function createChannel(streamIn) {
|
|
|
1048
1058
|
callback,
|
|
1049
1059
|
key,
|
|
1050
1060
|
details,
|
|
1061
|
+
logPluginError,
|
|
1051
1062
|
requestPlugins,
|
|
1052
1063
|
runOnEndCallbacks,
|
|
1053
1064
|
pluginRefs
|
|
@@ -1109,7 +1120,7 @@ function createChannel(streamIn) {
|
|
|
1109
1120
|
warnings: replaceDetailsInMessages(response.warnings, details)
|
|
1110
1121
|
};
|
|
1111
1122
|
copyResponseToResult(response, result);
|
|
1112
|
-
runOnEndCallbacks(result, () => {
|
|
1123
|
+
runOnEndCallbacks(result, logPluginError, () => {
|
|
1113
1124
|
if (result.errors.length > 0) {
|
|
1114
1125
|
return callback2(failureErrorWithLog("Build failed", result.errors, result.warnings), null);
|
|
1115
1126
|
}
|
|
@@ -1169,7 +1180,7 @@ function createChannel(streamIn) {
|
|
|
1169
1180
|
warnings: replaceDetailsInMessages(watchResponse.warnings, details)
|
|
1170
1181
|
};
|
|
1171
1182
|
copyResponseToResult(watchResponse, result2);
|
|
1172
|
-
runOnEndCallbacks(result2, () => {
|
|
1183
|
+
runOnEndCallbacks(result2, logPluginError, () => {
|
|
1173
1184
|
if (result2.errors.length > 0) {
|
|
1174
1185
|
if (watch.onRebuild)
|
|
1175
1186
|
watch.onRebuild(failureErrorWithLog("Build failed", result2.errors, result2.warnings), null);
|
|
@@ -1602,7 +1613,7 @@ var fsAsync = {
|
|
|
1602
1613
|
}
|
|
1603
1614
|
}
|
|
1604
1615
|
};
|
|
1605
|
-
var version = "0.11.
|
|
1616
|
+
var version = "0.11.20";
|
|
1606
1617
|
var build = (options) => ensureServiceIsRunning().build(options);
|
|
1607
1618
|
var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
|
|
1608
1619
|
var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
|
|
@@ -1690,7 +1701,7 @@ var ensureServiceIsRunning = () => {
|
|
|
1690
1701
|
if (longLivedService)
|
|
1691
1702
|
return longLivedService;
|
|
1692
1703
|
let [command, args] = esbuildCommandAndArgs();
|
|
1693
|
-
let child = child_process.spawn(command, args.concat(`--service=${"0.11.
|
|
1704
|
+
let child = child_process.spawn(command, args.concat(`--service=${"0.11.20"}`, "--ping"), {
|
|
1694
1705
|
windowsHide: true,
|
|
1695
1706
|
stdio: ["pipe", "pipe", "inherit"],
|
|
1696
1707
|
cwd: defaultWD
|
|
@@ -1788,7 +1799,7 @@ var runServiceSync = (callback) => {
|
|
|
1788
1799
|
isBrowser: false
|
|
1789
1800
|
});
|
|
1790
1801
|
callback(service);
|
|
1791
|
-
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.11.
|
|
1802
|
+
let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.11.20"}`), {
|
|
1792
1803
|
cwd: defaultWD,
|
|
1793
1804
|
windowsHide: true,
|
|
1794
1805
|
input: stdin,
|