esbuild 0.14.21 → 0.14.24

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
@@ -46,9 +46,13 @@ var knownUnixlikePackages = {
46
46
  "openbsd x64 LE": "esbuild-openbsd-64",
47
47
  "sunos x64 LE": "esbuild-sunos-64"
48
48
  };
49
+ var knownWebAssemblyFallbackPackages = {
50
+ "android x64 LE": "esbuild-android-64"
51
+ };
49
52
  function pkgAndSubpathForCurrentPlatform() {
50
53
  let pkg;
51
54
  let subpath;
55
+ let isWASM2 = false;
52
56
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
53
57
  if (platformKey in knownWindowsPackages) {
54
58
  pkg = knownWindowsPackages[platformKey];
@@ -56,10 +60,14 @@ function pkgAndSubpathForCurrentPlatform() {
56
60
  } else if (platformKey in knownUnixlikePackages) {
57
61
  pkg = knownUnixlikePackages[platformKey];
58
62
  subpath = "bin/esbuild";
63
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
64
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
65
+ subpath = "bin/esbuild";
66
+ isWASM2 = true;
59
67
  } else {
60
68
  throw new Error(`Unsupported platform: ${platformKey}`);
61
69
  }
62
- return { pkg, subpath };
70
+ return { pkg, subpath, isWASM: isWASM2 };
63
71
  }
64
72
  function pkgForSomeOtherPlatform() {
65
73
  const libMainJS = require.resolve("esbuild");
@@ -90,15 +98,15 @@ function downloadedBinPath(pkg, subpath) {
90
98
  }
91
99
  function generateBinPath() {
92
100
  if (ESBUILD_BINARY_PATH) {
93
- return ESBUILD_BINARY_PATH;
101
+ return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
94
102
  }
95
- const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
96
- let binPath;
103
+ const { pkg, subpath, isWASM: isWASM2 } = pkgAndSubpathForCurrentPlatform();
104
+ let binPath2;
97
105
  try {
98
- binPath = require.resolve(`${pkg}/${subpath}`);
106
+ binPath2 = require.resolve(`${pkg}/${subpath}`);
99
107
  } catch (e) {
100
- binPath = downloadedBinPath(pkg, subpath);
101
- if (!fs.existsSync(binPath)) {
108
+ binPath2 = downloadedBinPath(pkg, subpath);
109
+ if (!fs.existsSync(binPath2)) {
102
110
  try {
103
111
  require.resolve(pkg);
104
112
  } catch {
@@ -151,13 +159,18 @@ by esbuild to install the correct binary executable for your current platform.`)
151
159
  const esbuildLibDir = path.dirname(require.resolve("esbuild"));
152
160
  const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`);
153
161
  if (!fs.existsSync(binTargetPath)) {
154
- fs.copyFileSync(binPath, binTargetPath);
162
+ fs.copyFileSync(binPath2, binTargetPath);
155
163
  fs.chmodSync(binTargetPath, 493);
156
164
  }
157
- return binTargetPath;
165
+ return { binPath: binTargetPath, isWASM: isWASM2 };
158
166
  }
159
- return binPath;
167
+ return { binPath: binPath2, isWASM: isWASM2 };
160
168
  }
161
169
 
162
170
  // lib/npm/node-shim.ts
163
- require("child_process").execFileSync(generateBinPath(), process.argv.slice(2), { stdio: "inherit" });
171
+ var { binPath, isWASM } = generateBinPath();
172
+ if (isWASM) {
173
+ require("child_process").execFileSync("node", [binPath].concat(process.argv.slice(2)), { stdio: "inherit" });
174
+ } else {
175
+ require("child_process").execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
176
+ }
package/install.js CHANGED
@@ -62,9 +62,13 @@ var knownUnixlikePackages = {
62
62
  "openbsd x64 LE": "esbuild-openbsd-64",
63
63
  "sunos x64 LE": "esbuild-sunos-64"
64
64
  };
65
+ var knownWebAssemblyFallbackPackages = {
66
+ "android x64 LE": "esbuild-android-64"
67
+ };
65
68
  function pkgAndSubpathForCurrentPlatform() {
66
69
  let pkg;
67
70
  let subpath;
71
+ let isWASM = false;
68
72
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
69
73
  if (platformKey in knownWindowsPackages) {
70
74
  pkg = knownWindowsPackages[platformKey];
@@ -72,10 +76,14 @@ function pkgAndSubpathForCurrentPlatform() {
72
76
  } else if (platformKey in knownUnixlikePackages) {
73
77
  pkg = knownUnixlikePackages[platformKey];
74
78
  subpath = "bin/esbuild";
79
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
80
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
81
+ subpath = "bin/esbuild";
82
+ isWASM = true;
75
83
  } else {
76
84
  throw new Error(`Unsupported platform: ${platformKey}`);
77
85
  }
78
- return { pkg, subpath };
86
+ return { pkg, subpath, isWASM };
79
87
  }
80
88
  function downloadedBinPath(pkg, subpath) {
81
89
  const esbuildLibDir = path.dirname(require.resolve("esbuild"));
@@ -96,8 +104,8 @@ function validateBinaryVersion(...command) {
96
104
  const stdout = child_process.execFileSync(command.shift(), command, {
97
105
  stdio: "pipe"
98
106
  }).toString().trim();
99
- if (stdout !== "0.14.21") {
100
- throw new Error(`Expected ${JSON.stringify("0.14.21")} but got ${JSON.stringify(stdout)}`);
107
+ if (stdout !== "0.14.24") {
108
+ throw new Error(`Expected ${JSON.stringify("0.14.24")} but got ${JSON.stringify(stdout)}`);
101
109
  }
102
110
  }
103
111
  function isYarn() {
@@ -148,7 +156,7 @@ function installUsingNPM(pkg, subpath, binPath) {
148
156
  fs2.mkdirSync(installDir);
149
157
  try {
150
158
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
151
- child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.21"}`, { cwd: installDir, stdio: "pipe", env });
159
+ child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.24"}`, { cwd: installDir, stdio: "pipe", env });
152
160
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
153
161
  fs2.renameSync(installedBinPath, binPath);
154
162
  } finally {
@@ -197,7 +205,7 @@ function maybeOptimizePackage(binPath) {
197
205
  }
198
206
  }
199
207
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
200
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.21"}.tgz`;
208
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.24"}.tgz`;
201
209
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
202
210
  try {
203
211
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.d.ts CHANGED
@@ -7,7 +7,7 @@ export type Drop = 'console' | 'debugger';
7
7
 
8
8
  interface CommonOptions {
9
9
  /** Documentation: https://esbuild.github.io/api/#sourcemap */
10
- sourcemap?: boolean | 'inline' | 'external' | 'both';
10
+ sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both';
11
11
  /** Documentation: https://esbuild.github.io/api/#legal-comments */
12
12
  legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external';
13
13
  /** Documentation: https://esbuild.github.io/api/#source-root */
@@ -27,6 +27,8 @@ interface CommonOptions {
27
27
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
28
28
  reserveProps?: RegExp;
29
29
  /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
+ mangleQuoted?: boolean;
31
+ /** Documentation: https://esbuild.github.io/api/#mangle-props */
30
32
  mangleCache?: Record<string, string | false>;
31
33
  /** Documentation: https://esbuild.github.io/api/#drop */
32
34
  drop?: Drop[];
package/lib/main.js CHANGED
@@ -50,6 +50,7 @@ __export(node_exports, {
50
50
  analyzeMetafileSync: () => analyzeMetafileSync,
51
51
  build: () => build,
52
52
  buildSync: () => buildSync,
53
+ default: () => node_default,
53
54
  formatMessages: () => formatMessages,
54
55
  formatMessagesSync: () => formatMessagesSync,
55
56
  initialize: () => initialize,
@@ -307,6 +308,7 @@ function pushCommonFlags(flags, options, keys) {
307
308
  let globalName = getFlag(options, keys, "globalName", mustBeString);
308
309
  let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
309
310
  let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
311
+ let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
310
312
  let minify = getFlag(options, keys, "minify", mustBeBoolean);
311
313
  let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
312
314
  let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
@@ -358,6 +360,8 @@ function pushCommonFlags(flags, options, keys) {
358
360
  flags.push(`--mangle-props=${mangleProps.source}`);
359
361
  if (reserveProps)
360
362
  flags.push(`--reserve-props=${reserveProps.source}`);
363
+ if (mangleQuoted !== void 0)
364
+ flags.push(`--mangle-quoted=${mangleQuoted}`);
361
365
  if (jsx)
362
366
  flags.push(`--jsx=${jsx}`);
363
367
  if (jsxFactory)
@@ -744,8 +748,8 @@ function createChannel(streamIn) {
744
748
  if (isFirstPacket) {
745
749
  isFirstPacket = false;
746
750
  let binaryVersion = String.fromCharCode(...bytes);
747
- if (binaryVersion !== "0.14.21") {
748
- throw new Error(`Cannot start service: Host version "${"0.14.21"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
751
+ if (binaryVersion !== "0.14.24") {
752
+ throw new Error(`Cannot start service: Host version "${"0.14.24"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
749
753
  }
750
754
  return;
751
755
  }
@@ -1717,9 +1721,13 @@ var knownUnixlikePackages = {
1717
1721
  "openbsd x64 LE": "esbuild-openbsd-64",
1718
1722
  "sunos x64 LE": "esbuild-sunos-64"
1719
1723
  };
1724
+ var knownWebAssemblyFallbackPackages = {
1725
+ "android x64 LE": "esbuild-android-64"
1726
+ };
1720
1727
  function pkgAndSubpathForCurrentPlatform() {
1721
1728
  let pkg;
1722
1729
  let subpath;
1730
+ let isWASM = false;
1723
1731
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
1724
1732
  if (platformKey in knownWindowsPackages) {
1725
1733
  pkg = knownWindowsPackages[platformKey];
@@ -1727,10 +1735,14 @@ function pkgAndSubpathForCurrentPlatform() {
1727
1735
  } else if (platformKey in knownUnixlikePackages) {
1728
1736
  pkg = knownUnixlikePackages[platformKey];
1729
1737
  subpath = "bin/esbuild";
1738
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
1739
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
1740
+ subpath = "bin/esbuild";
1741
+ isWASM = true;
1730
1742
  } else {
1731
1743
  throw new Error(`Unsupported platform: ${platformKey}`);
1732
1744
  }
1733
- return { pkg, subpath };
1745
+ return { pkg, subpath, isWASM };
1734
1746
  }
1735
1747
  function pkgForSomeOtherPlatform() {
1736
1748
  const libMainJS = require.resolve("esbuild");
@@ -1761,9 +1773,9 @@ function downloadedBinPath(pkg, subpath) {
1761
1773
  }
1762
1774
  function generateBinPath() {
1763
1775
  if (ESBUILD_BINARY_PATH) {
1764
- return ESBUILD_BINARY_PATH;
1776
+ return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
1765
1777
  }
1766
- const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
1778
+ const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
1767
1779
  let binPath;
1768
1780
  try {
1769
1781
  binPath = require.resolve(`${pkg}/${subpath}`);
@@ -1825,9 +1837,9 @@ by esbuild to install the correct binary executable for your current platform.`)
1825
1837
  fs.copyFileSync(binPath, binTargetPath);
1826
1838
  fs.chmodSync(binTargetPath, 493);
1827
1839
  }
1828
- return binTargetPath;
1840
+ return { binPath: binTargetPath, isWASM };
1829
1841
  }
1830
- return binPath;
1842
+ return { binPath, isWASM };
1831
1843
  }
1832
1844
 
1833
1845
  // lib/npm/node.ts
@@ -1849,7 +1861,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1849
1861
  }
1850
1862
  }
1851
1863
  var _a;
1852
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.21";
1864
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.24";
1853
1865
  var esbuildCommandAndArgs = () => {
1854
1866
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1855
1867
  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.
@@ -1859,7 +1871,12 @@ More information: The file containing the code for esbuild's JavaScript API (${_
1859
1871
  if (false) {
1860
1872
  return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]];
1861
1873
  }
1862
- return [generateBinPath(), []];
1874
+ const { binPath, isWASM } = generateBinPath();
1875
+ if (isWASM) {
1876
+ return ["node", [binPath]];
1877
+ } else {
1878
+ return [binPath, []];
1879
+ }
1863
1880
  };
1864
1881
  var isTTY = () => tty.isatty(2);
1865
1882
  var fsSync = {
@@ -1908,7 +1925,7 @@ var fsAsync = {
1908
1925
  }
1909
1926
  }
1910
1927
  };
1911
- var version = "0.14.21";
1928
+ var version = "0.14.24";
1912
1929
  var build = (options) => ensureServiceIsRunning().build(options);
1913
1930
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1914
1931
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2017,20 +2034,24 @@ var ensureServiceIsRunning = () => {
2017
2034
  if (longLivedService)
2018
2035
  return longLivedService;
2019
2036
  let [command, args] = esbuildCommandAndArgs();
2020
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.21"}`, "--ping"), {
2037
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.24"}`, "--ping"), {
2021
2038
  windowsHide: true,
2022
2039
  stdio: ["pipe", "pipe", "inherit"],
2023
2040
  cwd: defaultWD
2024
2041
  });
2025
2042
  let { readFromStdout, afterClose, service } = createChannel({
2026
2043
  writeToStdin(bytes) {
2027
- child.stdin.write(bytes);
2044
+ child.stdin.write(bytes, (err) => {
2045
+ if (err)
2046
+ afterClose();
2047
+ });
2028
2048
  },
2029
2049
  readFileSync: fs2.readFileSync,
2030
2050
  isSync: false,
2031
2051
  isBrowser: false,
2032
2052
  esbuild: node_exports
2033
2053
  });
2054
+ child.stdin.on("error", afterClose);
2034
2055
  const stdin = child.stdin;
2035
2056
  const stdout = child.stdout;
2036
2057
  stdout.on("data", readFromStdout);
@@ -2126,7 +2147,7 @@ var runServiceSync = (callback) => {
2126
2147
  esbuild: node_exports
2127
2148
  });
2128
2149
  callback(service);
2129
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.21"}`), {
2150
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.24"}`), {
2130
2151
  cwd: defaultWD,
2131
2152
  windowsHide: true,
2132
2153
  input: stdin,
@@ -2142,7 +2163,7 @@ var workerThreadService = null;
2142
2163
  var startWorkerThreadService = (worker_threads2) => {
2143
2164
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2144
2165
  let worker = new worker_threads2.Worker(__filename, {
2145
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.21" },
2166
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.24" },
2146
2167
  transferList: [workerPort],
2147
2168
  execArgv: []
2148
2169
  });
@@ -2257,6 +2278,7 @@ var startSyncServiceWorker = () => {
2257
2278
  if (isInternalWorkerThread) {
2258
2279
  startSyncServiceWorker();
2259
2280
  }
2281
+ var node_default = node_exports;
2260
2282
  module.exports = __toCommonJS(node_exports);
2261
2283
  // Annotate the CommonJS export names for ESM import in node:
2262
2284
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.14.21",
3
+ "version": "0.14.24",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,25 +15,26 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "esbuild-android-arm64": "0.14.21",
19
- "esbuild-darwin-64": "0.14.21",
20
- "esbuild-darwin-arm64": "0.14.21",
21
- "esbuild-freebsd-64": "0.14.21",
22
- "esbuild-freebsd-arm64": "0.14.21",
23
- "esbuild-linux-32": "0.14.21",
24
- "esbuild-linux-64": "0.14.21",
25
- "esbuild-linux-arm": "0.14.21",
26
- "esbuild-linux-arm64": "0.14.21",
27
- "esbuild-linux-mips64le": "0.14.21",
28
- "esbuild-linux-ppc64le": "0.14.21",
29
- "esbuild-linux-riscv64": "0.14.21",
30
- "esbuild-linux-s390x": "0.14.21",
31
- "esbuild-netbsd-64": "0.14.21",
32
- "esbuild-openbsd-64": "0.14.21",
33
- "esbuild-sunos-64": "0.14.21",
34
- "esbuild-windows-32": "0.14.21",
35
- "esbuild-windows-64": "0.14.21",
36
- "esbuild-windows-arm64": "0.14.21"
18
+ "esbuild-android-64": "0.14.24",
19
+ "esbuild-android-arm64": "0.14.24",
20
+ "esbuild-darwin-64": "0.14.24",
21
+ "esbuild-darwin-arm64": "0.14.24",
22
+ "esbuild-freebsd-64": "0.14.24",
23
+ "esbuild-freebsd-arm64": "0.14.24",
24
+ "esbuild-linux-32": "0.14.24",
25
+ "esbuild-linux-64": "0.14.24",
26
+ "esbuild-linux-arm": "0.14.24",
27
+ "esbuild-linux-arm64": "0.14.24",
28
+ "esbuild-linux-mips64le": "0.14.24",
29
+ "esbuild-linux-ppc64le": "0.14.24",
30
+ "esbuild-linux-riscv64": "0.14.24",
31
+ "esbuild-linux-s390x": "0.14.24",
32
+ "esbuild-netbsd-64": "0.14.24",
33
+ "esbuild-openbsd-64": "0.14.24",
34
+ "esbuild-sunos-64": "0.14.24",
35
+ "esbuild-windows-32": "0.14.24",
36
+ "esbuild-windows-64": "0.14.24",
37
+ "esbuild-windows-arm64": "0.14.24"
37
38
  },
38
39
  "license": "MIT"
39
40
  }