esbuild 0.14.44 → 0.14.47

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 CHANGED
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
8
  var __copyProps = (to, from, except, desc) => {
26
9
  if (from && typeof from === "object" || typeof from === "function") {
27
10
  for (let key of __getOwnPropNames(from))
@@ -102,8 +85,8 @@ function validateBinaryVersion(...command) {
102
85
  const stdout = child_process.execFileSync(command.shift(), command, {
103
86
  stdio: "pipe"
104
87
  }).toString().trim();
105
- if (stdout !== "0.14.44") {
106
- throw new Error(`Expected ${JSON.stringify("0.14.44")} but got ${JSON.stringify(stdout)}`);
88
+ if (stdout !== "0.14.47") {
89
+ throw new Error(`Expected ${JSON.stringify("0.14.47")} but got ${JSON.stringify(stdout)}`);
107
90
  }
108
91
  }
109
92
  function isYarn() {
@@ -148,13 +131,13 @@ function extractFileFromTarGzip(buffer, subpath) {
148
131
  throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`);
149
132
  }
150
133
  function installUsingNPM(pkg, subpath, binPath) {
151
- const env = __spreadProps(__spreadValues({}, process.env), { npm_config_global: void 0 });
134
+ const env = { ...process.env, npm_config_global: void 0 };
152
135
  const esbuildLibDir = path2.dirname(require.resolve("esbuild"));
153
136
  const installDir = path2.join(esbuildLibDir, "npm-install");
154
137
  fs2.mkdirSync(installDir);
155
138
  try {
156
139
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
157
- child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.44"}`, { cwd: installDir, stdio: "pipe", env });
140
+ child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.47"}`, { cwd: installDir, stdio: "pipe", env });
158
141
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
159
142
  fs2.renameSync(installedBinPath, binPath);
160
143
  } finally {
@@ -203,7 +186,7 @@ function maybeOptimizePackage(binPath) {
203
186
  }
204
187
  }
205
188
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
206
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.44"}.tgz`;
189
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.47"}.tgz`;
207
190
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
208
191
  try {
209
192
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.d.ts CHANGED
@@ -21,6 +21,8 @@ interface CommonOptions {
21
21
  globalName?: string;
22
22
  /** Documentation: https://esbuild.github.io/api/#target */
23
23
  target?: string | string[];
24
+ /** Documentation: https://esbuild.github.io/api/#supported */
25
+ supported?: Record<string, boolean>;
24
26
 
25
27
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
26
28
  mangleProps?: RegExp;
@@ -148,6 +150,7 @@ export interface StdinOptions {
148
150
  }
149
151
 
150
152
  export interface Message {
153
+ id: string;
151
154
  pluginName: string;
152
155
  text: string;
153
156
  location: Location | null;
@@ -402,6 +405,7 @@ export interface OnLoadResult {
402
405
  }
403
406
 
404
407
  export interface PartialMessage {
408
+ id?: string;
405
409
  pluginName?: string;
406
410
  text?: string;
407
411
  location?: Partial<Location> | null;
package/lib/main.js CHANGED
@@ -1,27 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
8
  var __export = (target, all) => {
26
9
  for (var name in all)
27
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -320,6 +303,7 @@ function pushCommonFlags(flags, options, keys) {
320
303
  let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
321
304
  let define = getFlag(options, keys, "define", mustBeObject);
322
305
  let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
306
+ let supported = getFlag(options, keys, "supported", mustBeObject);
323
307
  let pure = getFlag(options, keys, "pure", mustBeArray);
324
308
  let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean);
325
309
  if (legalComments)
@@ -381,6 +365,13 @@ function pushCommonFlags(flags, options, keys) {
381
365
  flags.push(`--log-override:${key}=${logOverride[key]}`);
382
366
  }
383
367
  }
368
+ if (supported) {
369
+ for (let key in supported) {
370
+ if (key.indexOf("=") >= 0)
371
+ throw new Error(`Invalid supported: ${key}`);
372
+ flags.push(`--supported:${key}=${supported[key]}`);
373
+ }
374
+ }
384
375
  if (pure)
385
376
  for (let fn of pure)
386
377
  flags.push(`--pure:${fn}`);
@@ -755,8 +746,8 @@ function createChannel(streamIn) {
755
746
  if (isFirstPacket) {
756
747
  isFirstPacket = false;
757
748
  let binaryVersion = String.fromCharCode(...bytes);
758
- if (binaryVersion !== "0.14.44") {
759
- throw new Error(`Cannot start service: Host version "${"0.14.44"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
749
+ if (binaryVersion !== "0.14.47") {
750
+ throw new Error(`Cannot start service: Host version "${"0.14.47"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
760
751
  }
761
752
  return;
762
753
  }
@@ -1148,14 +1139,15 @@ function createChannel(streamIn) {
1148
1139
  handleError(result.error, result.pluginName);
1149
1140
  } else {
1150
1141
  try {
1151
- buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
1142
+ buildOrServeContinue({
1143
+ ...args,
1152
1144
  key,
1153
1145
  details,
1154
1146
  logPluginError,
1155
1147
  requestPlugins: result.requestPlugins,
1156
1148
  runOnEndCallbacks: result.runOnEndCallbacks,
1157
1149
  pluginRefs: result.pluginRefs
1158
- }));
1150
+ });
1159
1151
  } catch (e) {
1160
1152
  handleError(e, "");
1161
1153
  }
@@ -1163,14 +1155,15 @@ function createChannel(streamIn) {
1163
1155
  }, (e) => handleError(e, ""));
1164
1156
  } else {
1165
1157
  try {
1166
- buildOrServeContinue(__spreadProps(__spreadValues({}, args), {
1158
+ buildOrServeContinue({
1159
+ ...args,
1167
1160
  key,
1168
1161
  details,
1169
1162
  logPluginError,
1170
1163
  requestPlugins: null,
1171
1164
  runOnEndCallbacks: (result, logPluginError2, done) => done(),
1172
1165
  pluginRefs: null
1173
- }));
1166
+ });
1174
1167
  } catch (e) {
1175
1168
  handleError(e, "");
1176
1169
  }
@@ -1265,7 +1258,7 @@ function createChannel(streamIn) {
1265
1258
  throw new Error("Cannot rebuild");
1266
1259
  sendRequest(refs, { command: "rebuild", key }, (error2, response2) => {
1267
1260
  if (error2) {
1268
- const message = { pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1261
+ const message = { id: "", pluginName: "", text: error2, location: null, notes: [], detail: void 0 };
1269
1262
  return callback2(failureErrorWithLog("Build failed", [message], []), null);
1270
1263
  }
1271
1264
  buildResponseToResult(response2, (error3, result3) => {
@@ -1548,7 +1541,7 @@ function extractErrorMessageV8(e, streamIn, stash, note, pluginName) {
1548
1541
  location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), "");
1549
1542
  } catch {
1550
1543
  }
1551
- return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
1544
+ return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 };
1552
1545
  }
1553
1546
  function parseStackLinesV8(streamIn, lines, ident) {
1554
1547
  let at = " at ";
@@ -1647,6 +1640,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
1647
1640
  let index = 0;
1648
1641
  for (const message of messages) {
1649
1642
  let keys = {};
1643
+ let id = getFlag(message, keys, "id", mustBeString);
1650
1644
  let pluginName = getFlag(message, keys, "pluginName", mustBeString);
1651
1645
  let text = getFlag(message, keys, "text", mustBeString);
1652
1646
  let location = getFlag(message, keys, "location", mustBeObjectOrNull);
@@ -1668,6 +1662,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
1668
1662
  }
1669
1663
  }
1670
1664
  messagesClone.push({
1665
+ id: id || "",
1671
1666
  pluginName: pluginName || fallbackPluginName,
1672
1667
  text: text || "",
1673
1668
  location: sanitizeLocation(location, where),
@@ -1868,7 +1863,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1868
1863
  }
1869
1864
  }
1870
1865
  var _a;
1871
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.44";
1866
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.47";
1872
1867
  var esbuildCommandAndArgs = () => {
1873
1868
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1874
1869
  throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
@@ -1932,7 +1927,7 @@ var fsAsync = {
1932
1927
  }
1933
1928
  }
1934
1929
  };
1935
- var version = "0.14.44";
1930
+ var version = "0.14.47";
1936
1931
  var build = (options) => ensureServiceIsRunning().build(options);
1937
1932
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1938
1933
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2027,6 +2022,8 @@ var initialize = (options) => {
2027
2022
  options = validateInitializeOptions(options || {});
2028
2023
  if (options.wasmURL)
2029
2024
  throw new Error(`The "wasmURL" option only works in the browser`);
2025
+ if (options.wasmModule)
2026
+ throw new Error(`The "wasmModule" option only works in the browser`);
2030
2027
  if (options.worker)
2031
2028
  throw new Error(`The "worker" option only works in the browser`);
2032
2029
  if (initializeWasCalled)
@@ -2041,7 +2038,7 @@ var ensureServiceIsRunning = () => {
2041
2038
  if (longLivedService)
2042
2039
  return longLivedService;
2043
2040
  let [command, args] = esbuildCommandAndArgs();
2044
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.44"}`, "--ping"), {
2041
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.47"}`, "--ping"), {
2045
2042
  windowsHide: true,
2046
2043
  stdio: ["pipe", "pipe", "inherit"],
2047
2044
  cwd: defaultWD
@@ -2155,7 +2152,7 @@ var runServiceSync = (callback) => {
2155
2152
  esbuild: node_exports
2156
2153
  });
2157
2154
  callback(service);
2158
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.44"}`), {
2155
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.47"}`), {
2159
2156
  cwd: defaultWD,
2160
2157
  windowsHide: true,
2161
2158
  input: stdin,
@@ -2171,7 +2168,7 @@ var workerThreadService = null;
2171
2168
  var startWorkerThreadService = (worker_threads2) => {
2172
2169
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2173
2170
  let worker = new worker_threads2.Worker(__filename, {
2174
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.44" },
2171
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.47" },
2175
2172
  transferList: [workerPort],
2176
2173
  execArgv: []
2177
2174
  });
@@ -2180,7 +2177,7 @@ var startWorkerThreadService = (worker_threads2) => {
2180
2177
  let fakeBuildError = (text) => {
2181
2178
  let error = new Error(`Build failed with 1 error:
2182
2179
  error: ${text}`);
2183
- let errors = [{ pluginName: "", text, location: null, notes: [], detail: void 0 }];
2180
+ let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }];
2184
2181
  error.errors = errors;
2185
2182
  error.warnings = [];
2186
2183
  return error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.14.44",
3
+ "version": "0.14.47",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,26 +15,26 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "esbuild-android-64": "0.14.44",
19
- "esbuild-android-arm64": "0.14.44",
20
- "esbuild-darwin-64": "0.14.44",
21
- "esbuild-darwin-arm64": "0.14.44",
22
- "esbuild-freebsd-64": "0.14.44",
23
- "esbuild-freebsd-arm64": "0.14.44",
24
- "esbuild-linux-32": "0.14.44",
25
- "esbuild-linux-64": "0.14.44",
26
- "esbuild-linux-arm": "0.14.44",
27
- "esbuild-linux-arm64": "0.14.44",
28
- "esbuild-linux-mips64le": "0.14.44",
29
- "esbuild-linux-ppc64le": "0.14.44",
30
- "esbuild-linux-riscv64": "0.14.44",
31
- "esbuild-linux-s390x": "0.14.44",
32
- "esbuild-netbsd-64": "0.14.44",
33
- "esbuild-openbsd-64": "0.14.44",
34
- "esbuild-sunos-64": "0.14.44",
35
- "esbuild-windows-32": "0.14.44",
36
- "esbuild-windows-64": "0.14.44",
37
- "esbuild-windows-arm64": "0.14.44"
18
+ "esbuild-android-64": "0.14.47",
19
+ "esbuild-android-arm64": "0.14.47",
20
+ "esbuild-darwin-64": "0.14.47",
21
+ "esbuild-darwin-arm64": "0.14.47",
22
+ "esbuild-freebsd-64": "0.14.47",
23
+ "esbuild-freebsd-arm64": "0.14.47",
24
+ "esbuild-linux-32": "0.14.47",
25
+ "esbuild-linux-64": "0.14.47",
26
+ "esbuild-linux-arm": "0.14.47",
27
+ "esbuild-linux-arm64": "0.14.47",
28
+ "esbuild-linux-mips64le": "0.14.47",
29
+ "esbuild-linux-ppc64le": "0.14.47",
30
+ "esbuild-linux-riscv64": "0.14.47",
31
+ "esbuild-linux-s390x": "0.14.47",
32
+ "esbuild-netbsd-64": "0.14.47",
33
+ "esbuild-openbsd-64": "0.14.47",
34
+ "esbuild-sunos-64": "0.14.47",
35
+ "esbuild-windows-32": "0.14.47",
36
+ "esbuild-windows-64": "0.14.47",
37
+ "esbuild-windows-arm64": "0.14.47"
38
38
  },
39
39
  "license": "MIT"
40
40
  }