esbuild 0.14.43 → 0.14.46

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