esbuild 0.14.22 → 0.14.25

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.22") {
100
- throw new Error(`Expected ${JSON.stringify("0.14.22")} but got ${JSON.stringify(stdout)}`);
107
+ if (stdout !== "0.14.25") {
108
+ throw new Error(`Expected ${JSON.stringify("0.14.25")} 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.22"}`, { cwd: installDir, stdio: "pipe", env });
159
+ child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.25"}`, { 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.22"}.tgz`;
208
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.25"}.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
@@ -308,6 +308,7 @@ function pushCommonFlags(flags, options, keys) {
308
308
  let globalName = getFlag(options, keys, "globalName", mustBeString);
309
309
  let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp);
310
310
  let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp);
311
+ let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean);
311
312
  let minify = getFlag(options, keys, "minify", mustBeBoolean);
312
313
  let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean);
313
314
  let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean);
@@ -359,6 +360,8 @@ function pushCommonFlags(flags, options, keys) {
359
360
  flags.push(`--mangle-props=${mangleProps.source}`);
360
361
  if (reserveProps)
361
362
  flags.push(`--reserve-props=${reserveProps.source}`);
363
+ if (mangleQuoted !== void 0)
364
+ flags.push(`--mangle-quoted=${mangleQuoted}`);
362
365
  if (jsx)
363
366
  flags.push(`--jsx=${jsx}`);
364
367
  if (jsxFactory)
@@ -745,8 +748,8 @@ function createChannel(streamIn) {
745
748
  if (isFirstPacket) {
746
749
  isFirstPacket = false;
747
750
  let binaryVersion = String.fromCharCode(...bytes);
748
- if (binaryVersion !== "0.14.22") {
749
- throw new Error(`Cannot start service: Host version "${"0.14.22"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
751
+ if (binaryVersion !== "0.14.25") {
752
+ throw new Error(`Cannot start service: Host version "${"0.14.25"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
750
753
  }
751
754
  return;
752
755
  }
@@ -1718,9 +1721,13 @@ var knownUnixlikePackages = {
1718
1721
  "openbsd x64 LE": "esbuild-openbsd-64",
1719
1722
  "sunos x64 LE": "esbuild-sunos-64"
1720
1723
  };
1724
+ var knownWebAssemblyFallbackPackages = {
1725
+ "android x64 LE": "esbuild-android-64"
1726
+ };
1721
1727
  function pkgAndSubpathForCurrentPlatform() {
1722
1728
  let pkg;
1723
1729
  let subpath;
1730
+ let isWASM = false;
1724
1731
  let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`;
1725
1732
  if (platformKey in knownWindowsPackages) {
1726
1733
  pkg = knownWindowsPackages[platformKey];
@@ -1728,10 +1735,14 @@ function pkgAndSubpathForCurrentPlatform() {
1728
1735
  } else if (platformKey in knownUnixlikePackages) {
1729
1736
  pkg = knownUnixlikePackages[platformKey];
1730
1737
  subpath = "bin/esbuild";
1738
+ } else if (platformKey in knownWebAssemblyFallbackPackages) {
1739
+ pkg = knownWebAssemblyFallbackPackages[platformKey];
1740
+ subpath = "bin/esbuild";
1741
+ isWASM = true;
1731
1742
  } else {
1732
1743
  throw new Error(`Unsupported platform: ${platformKey}`);
1733
1744
  }
1734
- return { pkg, subpath };
1745
+ return { pkg, subpath, isWASM };
1735
1746
  }
1736
1747
  function pkgForSomeOtherPlatform() {
1737
1748
  const libMainJS = require.resolve("esbuild");
@@ -1762,9 +1773,9 @@ function downloadedBinPath(pkg, subpath) {
1762
1773
  }
1763
1774
  function generateBinPath() {
1764
1775
  if (ESBUILD_BINARY_PATH) {
1765
- return ESBUILD_BINARY_PATH;
1776
+ return { binPath: ESBUILD_BINARY_PATH, isWASM: false };
1766
1777
  }
1767
- const { pkg, subpath } = pkgAndSubpathForCurrentPlatform();
1778
+ const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform();
1768
1779
  let binPath;
1769
1780
  try {
1770
1781
  binPath = require.resolve(`${pkg}/${subpath}`);
@@ -1826,9 +1837,9 @@ by esbuild to install the correct binary executable for your current platform.`)
1826
1837
  fs.copyFileSync(binPath, binTargetPath);
1827
1838
  fs.chmodSync(binTargetPath, 493);
1828
1839
  }
1829
- return binTargetPath;
1840
+ return { binPath: binTargetPath, isWASM };
1830
1841
  }
1831
- return binPath;
1842
+ return { binPath, isWASM };
1832
1843
  }
1833
1844
 
1834
1845
  // lib/npm/node.ts
@@ -1850,7 +1861,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1850
1861
  }
1851
1862
  }
1852
1863
  var _a;
1853
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.22";
1864
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.25";
1854
1865
  var esbuildCommandAndArgs = () => {
1855
1866
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1856
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.
@@ -1860,7 +1871,12 @@ More information: The file containing the code for esbuild's JavaScript API (${_
1860
1871
  if (false) {
1861
1872
  return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]];
1862
1873
  }
1863
- return [generateBinPath(), []];
1874
+ const { binPath, isWASM } = generateBinPath();
1875
+ if (isWASM) {
1876
+ return ["node", [binPath]];
1877
+ } else {
1878
+ return [binPath, []];
1879
+ }
1864
1880
  };
1865
1881
  var isTTY = () => tty.isatty(2);
1866
1882
  var fsSync = {
@@ -1909,7 +1925,7 @@ var fsAsync = {
1909
1925
  }
1910
1926
  }
1911
1927
  };
1912
- var version = "0.14.22";
1928
+ var version = "0.14.25";
1913
1929
  var build = (options) => ensureServiceIsRunning().build(options);
1914
1930
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1915
1931
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2018,7 +2034,7 @@ var ensureServiceIsRunning = () => {
2018
2034
  if (longLivedService)
2019
2035
  return longLivedService;
2020
2036
  let [command, args] = esbuildCommandAndArgs();
2021
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.22"}`, "--ping"), {
2037
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.25"}`, "--ping"), {
2022
2038
  windowsHide: true,
2023
2039
  stdio: ["pipe", "pipe", "inherit"],
2024
2040
  cwd: defaultWD
@@ -2131,7 +2147,7 @@ var runServiceSync = (callback) => {
2131
2147
  esbuild: node_exports
2132
2148
  });
2133
2149
  callback(service);
2134
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.22"}`), {
2150
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.25"}`), {
2135
2151
  cwd: defaultWD,
2136
2152
  windowsHide: true,
2137
2153
  input: stdin,
@@ -2147,7 +2163,7 @@ var workerThreadService = null;
2147
2163
  var startWorkerThreadService = (worker_threads2) => {
2148
2164
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2149
2165
  let worker = new worker_threads2.Worker(__filename, {
2150
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.22" },
2166
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.25" },
2151
2167
  transferList: [workerPort],
2152
2168
  execArgv: []
2153
2169
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.14.22",
3
+ "version": "0.14.25",
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.22",
19
- "esbuild-darwin-64": "0.14.22",
20
- "esbuild-darwin-arm64": "0.14.22",
21
- "esbuild-freebsd-64": "0.14.22",
22
- "esbuild-freebsd-arm64": "0.14.22",
23
- "esbuild-linux-32": "0.14.22",
24
- "esbuild-linux-64": "0.14.22",
25
- "esbuild-linux-arm": "0.14.22",
26
- "esbuild-linux-arm64": "0.14.22",
27
- "esbuild-linux-mips64le": "0.14.22",
28
- "esbuild-linux-ppc64le": "0.14.22",
29
- "esbuild-linux-riscv64": "0.14.22",
30
- "esbuild-linux-s390x": "0.14.22",
31
- "esbuild-netbsd-64": "0.14.22",
32
- "esbuild-openbsd-64": "0.14.22",
33
- "esbuild-sunos-64": "0.14.22",
34
- "esbuild-windows-32": "0.14.22",
35
- "esbuild-windows-64": "0.14.22",
36
- "esbuild-windows-arm64": "0.14.22"
18
+ "esbuild-android-64": "0.14.25",
19
+ "esbuild-android-arm64": "0.14.25",
20
+ "esbuild-darwin-64": "0.14.25",
21
+ "esbuild-darwin-arm64": "0.14.25",
22
+ "esbuild-freebsd-64": "0.14.25",
23
+ "esbuild-freebsd-arm64": "0.14.25",
24
+ "esbuild-linux-32": "0.14.25",
25
+ "esbuild-linux-64": "0.14.25",
26
+ "esbuild-linux-arm": "0.14.25",
27
+ "esbuild-linux-arm64": "0.14.25",
28
+ "esbuild-linux-mips64le": "0.14.25",
29
+ "esbuild-linux-ppc64le": "0.14.25",
30
+ "esbuild-linux-riscv64": "0.14.25",
31
+ "esbuild-linux-s390x": "0.14.25",
32
+ "esbuild-netbsd-64": "0.14.25",
33
+ "esbuild-openbsd-64": "0.14.25",
34
+ "esbuild-sunos-64": "0.14.25",
35
+ "esbuild-windows-32": "0.14.25",
36
+ "esbuild-windows-64": "0.14.25",
37
+ "esbuild-windows-arm64": "0.14.25"
37
38
  },
38
39
  "license": "MIT"
39
40
  }