esbuild 0.14.12 → 0.14.13

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
@@ -60,6 +60,29 @@ function pkgAndSubpathForCurrentPlatform() {
60
60
  }
61
61
  return { pkg, subpath };
62
62
  }
63
+ function pkgForSomeOtherPlatform() {
64
+ const libMainJS = require.resolve("esbuild");
65
+ const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
66
+ if (path.basename(nodeModulesDirectory) === "node_modules") {
67
+ for (const unixKey in knownUnixlikePackages) {
68
+ try {
69
+ const pkg = knownUnixlikePackages[unixKey];
70
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
71
+ return pkg;
72
+ } catch {
73
+ }
74
+ }
75
+ for (const windowsKey in knownWindowsPackages) {
76
+ try {
77
+ const pkg = knownWindowsPackages[windowsKey];
78
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
79
+ return pkg;
80
+ } catch {
81
+ }
82
+ }
83
+ }
84
+ return null;
85
+ }
63
86
  function downloadedBinPath(pkg, subpath) {
64
87
  const esbuildLibDir = path.dirname(require.resolve("esbuild"));
65
88
  return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
@@ -78,6 +101,36 @@ function generateBinPath() {
78
101
  try {
79
102
  require.resolve(pkg);
80
103
  } catch {
104
+ const otherPkg = pkgForSomeOtherPlatform();
105
+ if (otherPkg) {
106
+ throw new Error(`
107
+ You installed esbuild on another platform than the one you're currently using.
108
+ This won't work because esbuild is written with native code and needs to
109
+ install a platform-specific binary executable.
110
+
111
+ Specifically the "${otherPkg}" package is present but this platform
112
+ needs the "${pkg}" package instead. People often get into this
113
+ situation by installing esbuild on Windows or macOS and copying "node_modules"
114
+ into a Docker image that runs Linux, or by copying "node_modules" between
115
+ Windows and WSL environments.
116
+
117
+ If you are installing with npm, you can try not copying the "node_modules"
118
+ directory when you copy the files over, and running "npm ci" or "npm install"
119
+ on the destination platform after the copy. Or you could consider using yarn
120
+ instead which has built-in support for installing a package on multiple
121
+ platforms simultaneously.
122
+
123
+ If you are installing with yarn, you can try listing both this platform and the
124
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
125
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
126
+ Keep in mind that this means multiple copies of esbuild will be present.
127
+
128
+ Another alternative is to use the "esbuild-wasm" package instead, which works
129
+ the same way on all platforms. But it comes with a heavy performance cost and
130
+ can sometimes be 10x slower than the "esbuild" package, so you may also not
131
+ want to do that.
132
+ `);
133
+ }
81
134
  throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
82
135
 
83
136
  If you are installing esbuild with npm, make sure that you don't specify the
package/install.js CHANGED
@@ -93,8 +93,8 @@ var isToPathJS = true;
93
93
  function validateBinaryVersion(...command) {
94
94
  command.push("--version");
95
95
  const stdout = child_process.execFileSync(command.shift(), command).toString().trim();
96
- if (stdout !== "0.14.12") {
97
- throw new Error(`Expected ${JSON.stringify("0.14.12")} but got ${JSON.stringify(stdout)}`);
96
+ if (stdout !== "0.14.13") {
97
+ throw new Error(`Expected ${JSON.stringify("0.14.13")} but got ${JSON.stringify(stdout)}`);
98
98
  }
99
99
  }
100
100
  function isYarn() {
@@ -145,7 +145,7 @@ function installUsingNPM(pkg, subpath, binPath) {
145
145
  fs2.mkdirSync(installDir);
146
146
  try {
147
147
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
148
- child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.12"}`, { cwd: installDir, stdio: "pipe", env });
148
+ child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.13"}`, { cwd: installDir, stdio: "pipe", env });
149
149
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
150
150
  fs2.renameSync(installedBinPath, binPath);
151
151
  } finally {
@@ -194,7 +194,7 @@ function maybeOptimizePackage(binPath) {
194
194
  }
195
195
  }
196
196
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
197
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.12"}.tgz`;
197
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.13"}.tgz`;
198
198
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
199
199
  try {
200
200
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.js CHANGED
@@ -717,8 +717,8 @@ function createChannel(streamIn) {
717
717
  if (isFirstPacket) {
718
718
  isFirstPacket = false;
719
719
  let binaryVersion = String.fromCharCode(...bytes);
720
- if (binaryVersion !== "0.14.12") {
721
- throw new Error(`Cannot start service: Host version "${"0.14.12"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
720
+ if (binaryVersion !== "0.14.13") {
721
+ throw new Error(`Cannot start service: Host version "${"0.14.13"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
722
722
  }
723
723
  return;
724
724
  }
@@ -1687,6 +1687,29 @@ function pkgAndSubpathForCurrentPlatform() {
1687
1687
  }
1688
1688
  return { pkg, subpath };
1689
1689
  }
1690
+ function pkgForSomeOtherPlatform() {
1691
+ const libMainJS = require.resolve("esbuild");
1692
+ const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS)));
1693
+ if (path.basename(nodeModulesDirectory) === "node_modules") {
1694
+ for (const unixKey in knownUnixlikePackages) {
1695
+ try {
1696
+ const pkg = knownUnixlikePackages[unixKey];
1697
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
1698
+ return pkg;
1699
+ } catch {
1700
+ }
1701
+ }
1702
+ for (const windowsKey in knownWindowsPackages) {
1703
+ try {
1704
+ const pkg = knownWindowsPackages[windowsKey];
1705
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
1706
+ return pkg;
1707
+ } catch {
1708
+ }
1709
+ }
1710
+ }
1711
+ return null;
1712
+ }
1690
1713
  function downloadedBinPath(pkg, subpath) {
1691
1714
  const esbuildLibDir = path.dirname(require.resolve("esbuild"));
1692
1715
  return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`);
@@ -1705,6 +1728,36 @@ function generateBinPath() {
1705
1728
  try {
1706
1729
  require.resolve(pkg);
1707
1730
  } catch {
1731
+ const otherPkg = pkgForSomeOtherPlatform();
1732
+ if (otherPkg) {
1733
+ throw new Error(`
1734
+ You installed esbuild on another platform than the one you're currently using.
1735
+ This won't work because esbuild is written with native code and needs to
1736
+ install a platform-specific binary executable.
1737
+
1738
+ Specifically the "${otherPkg}" package is present but this platform
1739
+ needs the "${pkg}" package instead. People often get into this
1740
+ situation by installing esbuild on Windows or macOS and copying "node_modules"
1741
+ into a Docker image that runs Linux, or by copying "node_modules" between
1742
+ Windows and WSL environments.
1743
+
1744
+ If you are installing with npm, you can try not copying the "node_modules"
1745
+ directory when you copy the files over, and running "npm ci" or "npm install"
1746
+ on the destination platform after the copy. Or you could consider using yarn
1747
+ instead which has built-in support for installing a package on multiple
1748
+ platforms simultaneously.
1749
+
1750
+ If you are installing with yarn, you can try listing both this platform and the
1751
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
1752
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
1753
+ Keep in mind that this means multiple copies of esbuild will be present.
1754
+
1755
+ Another alternative is to use the "esbuild-wasm" package instead, which works
1756
+ the same way on all platforms. But it comes with a heavy performance cost and
1757
+ can sometimes be 10x slower than the "esbuild" package, so you may also not
1758
+ want to do that.
1759
+ `);
1760
+ }
1708
1761
  throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild.
1709
1762
 
1710
1763
  If you are installing esbuild with npm, make sure that you don't specify the
@@ -1751,7 +1804,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1751
1804
  }
1752
1805
  }
1753
1806
  var _a;
1754
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.12";
1807
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.13";
1755
1808
  var esbuildCommandAndArgs = () => {
1756
1809
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1757
1810
  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.
@@ -1810,7 +1863,7 @@ var fsAsync = {
1810
1863
  }
1811
1864
  }
1812
1865
  };
1813
- var version = "0.14.12";
1866
+ var version = "0.14.13";
1814
1867
  var build = (options) => ensureServiceIsRunning().build(options);
1815
1868
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1816
1869
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1919,7 +1972,7 @@ var ensureServiceIsRunning = () => {
1919
1972
  if (longLivedService)
1920
1973
  return longLivedService;
1921
1974
  let [command, args] = esbuildCommandAndArgs();
1922
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.12"}`, "--ping"), {
1975
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.13"}`, "--ping"), {
1923
1976
  windowsHide: true,
1924
1977
  stdio: ["pipe", "pipe", "inherit"],
1925
1978
  cwd: defaultWD
@@ -2028,7 +2081,7 @@ var runServiceSync = (callback) => {
2028
2081
  esbuild: node_exports
2029
2082
  });
2030
2083
  callback(service);
2031
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.12"}`), {
2084
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.13"}`), {
2032
2085
  cwd: defaultWD,
2033
2086
  windowsHide: true,
2034
2087
  input: stdin,
@@ -2044,7 +2097,7 @@ var workerThreadService = null;
2044
2097
  var startWorkerThreadService = (worker_threads2) => {
2045
2098
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2046
2099
  let worker = new worker_threads2.Worker(__filename, {
2047
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.12" },
2100
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.13" },
2048
2101
  transferList: [workerPort],
2049
2102
  execArgv: []
2050
2103
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.14.12",
3
+ "version": "0.14.13",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -12,24 +12,24 @@
12
12
  "esbuild": "bin/esbuild"
13
13
  },
14
14
  "optionalDependencies": {
15
- "esbuild-android-arm64": "0.14.12",
16
- "esbuild-darwin-64": "0.14.12",
17
- "esbuild-darwin-arm64": "0.14.12",
18
- "esbuild-freebsd-64": "0.14.12",
19
- "esbuild-freebsd-arm64": "0.14.12",
20
- "esbuild-linux-32": "0.14.12",
21
- "esbuild-linux-64": "0.14.12",
22
- "esbuild-linux-arm": "0.14.12",
23
- "esbuild-linux-arm64": "0.14.12",
24
- "esbuild-linux-mips64le": "0.14.12",
25
- "esbuild-linux-ppc64le": "0.14.12",
26
- "esbuild-linux-s390x": "0.14.12",
27
- "esbuild-netbsd-64": "0.14.12",
28
- "esbuild-openbsd-64": "0.14.12",
29
- "esbuild-sunos-64": "0.14.12",
30
- "esbuild-windows-32": "0.14.12",
31
- "esbuild-windows-64": "0.14.12",
32
- "esbuild-windows-arm64": "0.14.12"
15
+ "esbuild-android-arm64": "0.14.13",
16
+ "esbuild-darwin-64": "0.14.13",
17
+ "esbuild-darwin-arm64": "0.14.13",
18
+ "esbuild-freebsd-64": "0.14.13",
19
+ "esbuild-freebsd-arm64": "0.14.13",
20
+ "esbuild-linux-32": "0.14.13",
21
+ "esbuild-linux-64": "0.14.13",
22
+ "esbuild-linux-arm": "0.14.13",
23
+ "esbuild-linux-arm64": "0.14.13",
24
+ "esbuild-linux-mips64le": "0.14.13",
25
+ "esbuild-linux-ppc64le": "0.14.13",
26
+ "esbuild-linux-s390x": "0.14.13",
27
+ "esbuild-netbsd-64": "0.14.13",
28
+ "esbuild-openbsd-64": "0.14.13",
29
+ "esbuild-sunos-64": "0.14.13",
30
+ "esbuild-windows-32": "0.14.13",
31
+ "esbuild-windows-64": "0.14.13",
32
+ "esbuild-windows-arm64": "0.14.13"
33
33
  },
34
34
  "license": "MIT"
35
35
  }