esbuild 0.19.5 → 0.19.6

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.
Files changed (3) hide show
  1. package/bin/esbuild +1 -1
  2. package/lib/main.js +30 -22
  3. package/package.json +23 -23
package/bin/esbuild CHANGED
@@ -199,7 +199,7 @@ for your current platform.`);
199
199
  "node_modules",
200
200
  ".cache",
201
201
  "esbuild",
202
- `pnpapi-${pkg.replace("/", "-")}-${"0.19.5"}-${path.basename(subpath)}`
202
+ `pnpapi-${pkg.replace("/", "-")}-${"0.19.6"}-${path.basename(subpath)}`
203
203
  );
204
204
  if (!fs.existsSync(binTargetPath)) {
205
205
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/lib/main.js CHANGED
@@ -746,8 +746,8 @@ function createChannel(streamIn) {
746
746
  if (isFirstPacket) {
747
747
  isFirstPacket = false;
748
748
  let binaryVersion = String.fromCharCode(...bytes);
749
- if (binaryVersion !== "0.19.5") {
750
- throw new Error(`Cannot start service: Host version "${"0.19.5"}" does not match binary version ${quote(binaryVersion)}`);
749
+ if (binaryVersion !== "0.19.6") {
750
+ throw new Error(`Cannot start service: Host version "${"0.19.6"}" does not match binary version ${quote(binaryVersion)}`);
751
751
  }
752
752
  return;
753
753
  }
@@ -890,7 +890,6 @@ function createChannel(streamIn) {
890
890
  start(null);
891
891
  };
892
892
  let formatMessages2 = ({ callName, refs, messages, options, callback }) => {
893
- let result = sanitizeMessages(messages, "messages", null, "");
894
893
  if (!options)
895
894
  throw new Error(`Missing second argument in ${callName}() call`);
896
895
  let keys = {};
@@ -904,7 +903,7 @@ function createChannel(streamIn) {
904
903
  throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`);
905
904
  let request = {
906
905
  command: "format-msgs",
907
- messages: result,
906
+ messages: sanitizeMessages(messages, "messages", null, "", terminalWidth),
908
907
  isWarning: kind === "warning"
909
908
  };
910
909
  if (color !== void 0)
@@ -1356,9 +1355,9 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1356
1355
  let warnings = getFlag(result, keys, "warnings", mustBeArray);
1357
1356
  checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name)}`);
1358
1357
  if (errors != null)
1359
- response.errors.push(...sanitizeMessages(errors, "errors", details, name));
1358
+ response.errors.push(...sanitizeMessages(errors, "errors", details, name, void 0));
1360
1359
  if (warnings != null)
1361
- response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name));
1360
+ response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name, void 0));
1362
1361
  }
1363
1362
  } catch (e) {
1364
1363
  response.errors.push(extractErrorMessageV8(e, streamIn, details, note && note(), name));
@@ -1411,9 +1410,9 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1411
1410
  if (pluginData != null)
1412
1411
  response.pluginData = details.store(pluginData);
1413
1412
  if (errors != null)
1414
- response.errors = sanitizeMessages(errors, "errors", details, name);
1413
+ response.errors = sanitizeMessages(errors, "errors", details, name, void 0);
1415
1414
  if (warnings != null)
1416
- response.warnings = sanitizeMessages(warnings, "warnings", details, name);
1415
+ response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
1417
1416
  if (watchFiles != null)
1418
1417
  response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
1419
1418
  if (watchDirs != null)
@@ -1466,9 +1465,9 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1466
1465
  if (loader != null)
1467
1466
  response.loader = loader;
1468
1467
  if (errors != null)
1469
- response.errors = sanitizeMessages(errors, "errors", details, name);
1468
+ response.errors = sanitizeMessages(errors, "errors", details, name, void 0);
1470
1469
  if (warnings != null)
1471
- response.warnings = sanitizeMessages(warnings, "warnings", details, name);
1470
+ response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
1472
1471
  if (watchFiles != null)
1473
1472
  response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles");
1474
1473
  if (watchDirs != null)
@@ -1501,9 +1500,9 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1501
1500
  let warnings = getFlag(value, keys, "warnings", mustBeArray);
1502
1501
  checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name)}`);
1503
1502
  if (errors != null)
1504
- newErrors = sanitizeMessages(errors, "errors", details, name);
1503
+ newErrors = sanitizeMessages(errors, "errors", details, name, void 0);
1505
1504
  if (warnings != null)
1506
- newWarnings = sanitizeMessages(warnings, "warnings", details, name);
1505
+ newWarnings = sanitizeMessages(warnings, "warnings", details, name, void 0);
1507
1506
  }
1508
1507
  } catch (e) {
1509
1508
  newErrors = [extractErrorMessageV8(e, streamIn, details, note && note(), name)];
@@ -1668,7 +1667,7 @@ function replaceDetailsInMessages(messages, stash) {
1668
1667
  }
1669
1668
  return messages;
1670
1669
  }
1671
- function sanitizeLocation(location, where) {
1670
+ function sanitizeLocation(location, where, terminalWidth) {
1672
1671
  if (location == null)
1673
1672
  return null;
1674
1673
  let keys = {};
@@ -1680,6 +1679,15 @@ function sanitizeLocation(location, where) {
1680
1679
  let lineText = getFlag(location, keys, "lineText", mustBeString);
1681
1680
  let suggestion = getFlag(location, keys, "suggestion", mustBeString);
1682
1681
  checkForInvalidFlags(location, keys, where);
1682
+ if (lineText) {
1683
+ const relevantASCII = lineText.slice(
1684
+ 0,
1685
+ (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80)
1686
+ );
1687
+ if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) {
1688
+ lineText = relevantASCII;
1689
+ }
1690
+ }
1683
1691
  return {
1684
1692
  file: file || "",
1685
1693
  namespace: namespace || "",
@@ -1690,7 +1698,7 @@ function sanitizeLocation(location, where) {
1690
1698
  suggestion: suggestion || ""
1691
1699
  };
1692
1700
  }
1693
- function sanitizeMessages(messages, property, stash, fallbackPluginName) {
1701
+ function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) {
1694
1702
  let messagesClone = [];
1695
1703
  let index = 0;
1696
1704
  for (const message of messages) {
@@ -1712,7 +1720,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
1712
1720
  checkForInvalidFlags(note, noteKeys, where);
1713
1721
  notesClone.push({
1714
1722
  text: noteText || "",
1715
- location: sanitizeLocation(noteLocation, where)
1723
+ location: sanitizeLocation(noteLocation, where, terminalWidth)
1716
1724
  });
1717
1725
  }
1718
1726
  }
@@ -1720,7 +1728,7 @@ function sanitizeMessages(messages, property, stash, fallbackPluginName) {
1720
1728
  id: id || "",
1721
1729
  pluginName: pluginName || fallbackPluginName,
1722
1730
  text: text || "",
1723
- location: sanitizeLocation(location, where),
1731
+ location: sanitizeLocation(location, where, terminalWidth),
1724
1732
  notes: notesClone,
1725
1733
  detail: stash ? stash.store(detail) : -1
1726
1734
  });
@@ -1930,7 +1938,7 @@ for your current platform.`);
1930
1938
  "node_modules",
1931
1939
  ".cache",
1932
1940
  "esbuild",
1933
- `pnpapi-${pkg.replace("/", "-")}-${"0.19.5"}-${path.basename(subpath)}`
1941
+ `pnpapi-${pkg.replace("/", "-")}-${"0.19.6"}-${path.basename(subpath)}`
1934
1942
  );
1935
1943
  if (!fs.existsSync(binTargetPath)) {
1936
1944
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -1965,7 +1973,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1965
1973
  }
1966
1974
  }
1967
1975
  var _a;
1968
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.5";
1976
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.6";
1969
1977
  var esbuildCommandAndArgs = () => {
1970
1978
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1971
1979
  throw new Error(
@@ -2032,7 +2040,7 @@ var fsAsync = {
2032
2040
  }
2033
2041
  }
2034
2042
  };
2035
- var version = "0.19.5";
2043
+ var version = "0.19.6";
2036
2044
  var build = (options) => ensureServiceIsRunning().build(options);
2037
2045
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
2038
2046
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2142,7 +2150,7 @@ var ensureServiceIsRunning = () => {
2142
2150
  if (longLivedService)
2143
2151
  return longLivedService;
2144
2152
  let [command, args] = esbuildCommandAndArgs();
2145
- let child = child_process.spawn(command, args.concat(`--service=${"0.19.5"}`, "--ping"), {
2153
+ let child = child_process.spawn(command, args.concat(`--service=${"0.19.6"}`, "--ping"), {
2146
2154
  windowsHide: true,
2147
2155
  stdio: ["pipe", "pipe", "inherit"],
2148
2156
  cwd: defaultWD
@@ -2242,7 +2250,7 @@ var runServiceSync = (callback) => {
2242
2250
  esbuild: node_exports
2243
2251
  });
2244
2252
  callback(service);
2245
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.5"}`), {
2253
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.6"}`), {
2246
2254
  cwd: defaultWD,
2247
2255
  windowsHide: true,
2248
2256
  input: stdin,
@@ -2262,7 +2270,7 @@ var workerThreadService = null;
2262
2270
  var startWorkerThreadService = (worker_threads2) => {
2263
2271
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2264
2272
  let worker = new worker_threads2.Worker(__filename, {
2265
- workerData: { workerPort, defaultWD, esbuildVersion: "0.19.5" },
2273
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.19.6" },
2266
2274
  transferList: [workerPort],
2267
2275
  // From node's documentation: https://nodejs.org/api/worker_threads.html
2268
2276
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,28 +15,28 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@esbuild/android-arm": "0.19.5",
19
- "@esbuild/android-arm64": "0.19.5",
20
- "@esbuild/android-x64": "0.19.5",
21
- "@esbuild/darwin-arm64": "0.19.5",
22
- "@esbuild/darwin-x64": "0.19.5",
23
- "@esbuild/freebsd-arm64": "0.19.5",
24
- "@esbuild/freebsd-x64": "0.19.5",
25
- "@esbuild/linux-arm": "0.19.5",
26
- "@esbuild/linux-arm64": "0.19.5",
27
- "@esbuild/linux-ia32": "0.19.5",
28
- "@esbuild/linux-loong64": "0.19.5",
29
- "@esbuild/linux-mips64el": "0.19.5",
30
- "@esbuild/linux-ppc64": "0.19.5",
31
- "@esbuild/linux-riscv64": "0.19.5",
32
- "@esbuild/linux-s390x": "0.19.5",
33
- "@esbuild/linux-x64": "0.19.5",
34
- "@esbuild/netbsd-x64": "0.19.5",
35
- "@esbuild/openbsd-x64": "0.19.5",
36
- "@esbuild/sunos-x64": "0.19.5",
37
- "@esbuild/win32-arm64": "0.19.5",
38
- "@esbuild/win32-ia32": "0.19.5",
39
- "@esbuild/win32-x64": "0.19.5"
18
+ "@esbuild/android-arm": "0.19.6",
19
+ "@esbuild/android-arm64": "0.19.6",
20
+ "@esbuild/android-x64": "0.19.6",
21
+ "@esbuild/darwin-arm64": "0.19.6",
22
+ "@esbuild/darwin-x64": "0.19.6",
23
+ "@esbuild/freebsd-arm64": "0.19.6",
24
+ "@esbuild/freebsd-x64": "0.19.6",
25
+ "@esbuild/linux-arm": "0.19.6",
26
+ "@esbuild/linux-arm64": "0.19.6",
27
+ "@esbuild/linux-ia32": "0.19.6",
28
+ "@esbuild/linux-loong64": "0.19.6",
29
+ "@esbuild/linux-mips64el": "0.19.6",
30
+ "@esbuild/linux-ppc64": "0.19.6",
31
+ "@esbuild/linux-riscv64": "0.19.6",
32
+ "@esbuild/linux-s390x": "0.19.6",
33
+ "@esbuild/linux-x64": "0.19.6",
34
+ "@esbuild/netbsd-x64": "0.19.6",
35
+ "@esbuild/openbsd-x64": "0.19.6",
36
+ "@esbuild/sunos-x64": "0.19.6",
37
+ "@esbuild/win32-arm64": "0.19.6",
38
+ "@esbuild/win32-ia32": "0.19.6",
39
+ "@esbuild/win32-x64": "0.19.6"
40
40
  },
41
41
  "license": "MIT"
42
42
  }