esbuild 0.16.12 → 0.16.14

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
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
+ // If the importer is in node compatibility mode or this is not an ESM
19
+ // file that has been converted to a CommonJS file using a Babel-
20
+ // compatible transform (i.e. "__esModule" has not been set), then set
21
+ // "default" to the CommonJS "module.exports" for node compatibility.
18
22
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
19
23
  mod
20
24
  ));
@@ -190,7 +194,7 @@ for your current platform.`);
190
194
  "node_modules",
191
195
  ".cache",
192
196
  "esbuild",
193
- `pnpapi-${pkg.replace("/", "-")}-${"0.16.12"}-${path.basename(subpath)}`
197
+ `pnpapi-${pkg.replace("/", "-")}-${"0.16.14"}-${path.basename(subpath)}`
194
198
  );
195
199
  if (!fs.existsSync(binTargetPath)) {
196
200
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/install.js CHANGED
@@ -14,6 +14,10 @@ var __copyProps = (to, from, except, desc) => {
14
14
  return to;
15
15
  };
16
16
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
17
21
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
18
22
  mod
19
23
  ));
@@ -87,11 +91,43 @@ var toPath = path2.join(__dirname, "bin", "esbuild");
87
91
  var isToPathJS = true;
88
92
  function validateBinaryVersion(...command) {
89
93
  command.push("--version");
90
- const stdout = child_process.execFileSync(command.shift(), command, {
91
- stdio: "pipe"
92
- }).toString().trim();
93
- if (stdout !== "0.16.12") {
94
- throw new Error(`Expected ${JSON.stringify("0.16.12")} but got ${JSON.stringify(stdout)}`);
94
+ let stdout;
95
+ try {
96
+ stdout = child_process.execFileSync(command.shift(), command, {
97
+ // Without this, this install script strangely crashes with the error
98
+ // "EACCES: permission denied, write" but only on Ubuntu Linux when node is
99
+ // installed from the Snap Store. This is not a problem when you download
100
+ // the official version of node. The problem appears to be that stderr
101
+ // (i.e. file descriptor 2) isn't writable?
102
+ //
103
+ // More info:
104
+ // - https://snapcraft.io/ (what the Snap Store is)
105
+ // - https://nodejs.org/dist/ (download the official version of node)
106
+ // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035
107
+ //
108
+ stdio: "pipe"
109
+ }).toString().trim();
110
+ } catch (err) {
111
+ if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) {
112
+ let os3 = "this version of macOS";
113
+ try {
114
+ os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim();
115
+ } catch {
116
+ }
117
+ throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated.
118
+
119
+ The Go compiler (which esbuild relies on) no longer supports ${os3},
120
+ which means the "esbuild" binary executable can't be run. You can either:
121
+
122
+ * Update your version of macOS to one that the Go compiler supports
123
+ * Use the "esbuild-wasm" package instead of the "esbuild" package
124
+ * Build esbuild yourself using an older version of the Go compiler
125
+ `);
126
+ }
127
+ throw err;
128
+ }
129
+ if (stdout !== "0.16.14") {
130
+ throw new Error(`Expected ${JSON.stringify("0.16.14")} but got ${JSON.stringify(stdout)}`);
95
131
  }
96
132
  }
97
133
  function isYarn() {
@@ -143,7 +179,7 @@ function installUsingNPM(pkg, subpath, binPath) {
143
179
  try {
144
180
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
145
181
  child_process.execSync(
146
- `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.16.12"}`,
182
+ `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.16.14"}`,
147
183
  { cwd: installDir, stdio: "pipe", env }
148
184
  );
149
185
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
@@ -194,7 +230,7 @@ function maybeOptimizePackage(binPath) {
194
230
  }
195
231
  }
196
232
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
197
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.16.12"}.tgz`;
233
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.16.14"}.tgz`;
198
234
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
199
235
  try {
200
236
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.d.ts CHANGED
@@ -442,6 +442,7 @@ export interface Metafile {
442
442
  path: string
443
443
  kind: ImportKind
444
444
  external?: boolean
445
+ original?: string
445
446
  }[]
446
447
  }
447
448
  }
package/lib/main.js CHANGED
@@ -18,6 +18,10 @@ var __copyProps = (to, from, except, desc) => {
18
18
  return to;
19
19
  };
20
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
25
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
26
  mod
23
27
  ));
@@ -735,8 +739,8 @@ function createChannel(streamIn) {
735
739
  if (isFirstPacket) {
736
740
  isFirstPacket = false;
737
741
  let binaryVersion = String.fromCharCode(...bytes);
738
- if (binaryVersion !== "0.16.12") {
739
- throw new Error(`Cannot start service: Host version "${"0.16.12"}" does not match binary version ${quote(binaryVersion)}`);
742
+ if (binaryVersion !== "0.16.14") {
743
+ throw new Error(`Cannot start service: Host version "${"0.16.14"}" does not match binary version ${quote(binaryVersion)}`);
740
744
  }
741
745
  return;
742
746
  }
@@ -1860,7 +1864,7 @@ for your current platform.`);
1860
1864
  "node_modules",
1861
1865
  ".cache",
1862
1866
  "esbuild",
1863
- `pnpapi-${pkg.replace("/", "-")}-${"0.16.12"}-${path.basename(subpath)}`
1867
+ `pnpapi-${pkg.replace("/", "-")}-${"0.16.14"}-${path.basename(subpath)}`
1864
1868
  );
1865
1869
  if (!fs.existsSync(binTargetPath)) {
1866
1870
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -1887,12 +1891,13 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1887
1891
  } catch {
1888
1892
  }
1889
1893
  let [major, minor] = process.versions.node.split(".");
1890
- if (+major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13) {
1894
+ if (// <v12.17.0 does not work
1895
+ +major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13) {
1891
1896
  worker_threads = void 0;
1892
1897
  }
1893
1898
  }
1894
1899
  var _a;
1895
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.16.12";
1900
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.16.14";
1896
1901
  var esbuildCommandAndArgs = () => {
1897
1902
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1898
1903
  throw new Error(
@@ -1959,7 +1964,7 @@ var fsAsync = {
1959
1964
  }
1960
1965
  }
1961
1966
  };
1962
- var version = "0.16.12";
1967
+ var version = "0.16.14";
1963
1968
  var build = (options) => ensureServiceIsRunning().build(options);
1964
1969
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1965
1970
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2070,7 +2075,7 @@ var ensureServiceIsRunning = () => {
2070
2075
  if (longLivedService)
2071
2076
  return longLivedService;
2072
2077
  let [command, args] = esbuildCommandAndArgs();
2073
- let child = child_process.spawn(command, args.concat(`--service=${"0.16.12"}`, "--ping"), {
2078
+ let child = child_process.spawn(command, args.concat(`--service=${"0.16.14"}`, "--ping"), {
2074
2079
  windowsHide: true,
2075
2080
  stdio: ["pipe", "pipe", "inherit"],
2076
2081
  cwd: defaultWD
@@ -2184,10 +2189,14 @@ var runServiceSync = (callback) => {
2184
2189
  esbuild: node_exports
2185
2190
  });
2186
2191
  callback(service);
2187
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.16.12"}`), {
2192
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.16.14"}`), {
2188
2193
  cwd: defaultWD,
2189
2194
  windowsHide: true,
2190
2195
  input: stdin,
2196
+ // We don't know how large the output could be. If it's too large, the
2197
+ // command will fail with ENOBUFS. Reserve 16mb for now since that feels
2198
+ // like it should be enough. Also allow overriding this with an environment
2199
+ // variable.
2191
2200
  maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024
2192
2201
  });
2193
2202
  readFromStdout(stdout);
@@ -2200,8 +2209,17 @@ var workerThreadService = null;
2200
2209
  var startWorkerThreadService = (worker_threads2) => {
2201
2210
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2202
2211
  let worker = new worker_threads2.Worker(__filename, {
2203
- workerData: { workerPort, defaultWD, esbuildVersion: "0.16.12" },
2212
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.16.14" },
2204
2213
  transferList: [workerPort],
2214
+ // From node's documentation: https://nodejs.org/api/worker_threads.html
2215
+ //
2216
+ // Take care when launching worker threads from preload scripts (scripts loaded
2217
+ // and run using the `-r` command line flag). Unless the `execArgv` option is
2218
+ // explicitly set, new Worker threads automatically inherit the command line flags
2219
+ // from the running process and will preload the same preload scripts as the main
2220
+ // thread. If the preload script unconditionally launches a worker thread, every
2221
+ // thread spawned will spawn another until the application crashes.
2222
+ //
2205
2223
  execArgv: []
2206
2224
  });
2207
2225
  let nextID = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.16.12",
3
+ "version": "0.16.14",
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.16.12",
19
- "@esbuild/android-arm64": "0.16.12",
20
- "@esbuild/android-x64": "0.16.12",
21
- "@esbuild/darwin-arm64": "0.16.12",
22
- "@esbuild/darwin-x64": "0.16.12",
23
- "@esbuild/freebsd-arm64": "0.16.12",
24
- "@esbuild/freebsd-x64": "0.16.12",
25
- "@esbuild/linux-arm": "0.16.12",
26
- "@esbuild/linux-arm64": "0.16.12",
27
- "@esbuild/linux-ia32": "0.16.12",
28
- "@esbuild/linux-loong64": "0.16.12",
29
- "@esbuild/linux-mips64el": "0.16.12",
30
- "@esbuild/linux-ppc64": "0.16.12",
31
- "@esbuild/linux-riscv64": "0.16.12",
32
- "@esbuild/linux-s390x": "0.16.12",
33
- "@esbuild/linux-x64": "0.16.12",
34
- "@esbuild/netbsd-x64": "0.16.12",
35
- "@esbuild/openbsd-x64": "0.16.12",
36
- "@esbuild/sunos-x64": "0.16.12",
37
- "@esbuild/win32-arm64": "0.16.12",
38
- "@esbuild/win32-ia32": "0.16.12",
39
- "@esbuild/win32-x64": "0.16.12"
18
+ "@esbuild/android-arm": "0.16.14",
19
+ "@esbuild/android-arm64": "0.16.14",
20
+ "@esbuild/android-x64": "0.16.14",
21
+ "@esbuild/darwin-arm64": "0.16.14",
22
+ "@esbuild/darwin-x64": "0.16.14",
23
+ "@esbuild/freebsd-arm64": "0.16.14",
24
+ "@esbuild/freebsd-x64": "0.16.14",
25
+ "@esbuild/linux-arm": "0.16.14",
26
+ "@esbuild/linux-arm64": "0.16.14",
27
+ "@esbuild/linux-ia32": "0.16.14",
28
+ "@esbuild/linux-loong64": "0.16.14",
29
+ "@esbuild/linux-mips64el": "0.16.14",
30
+ "@esbuild/linux-ppc64": "0.16.14",
31
+ "@esbuild/linux-riscv64": "0.16.14",
32
+ "@esbuild/linux-s390x": "0.16.14",
33
+ "@esbuild/linux-x64": "0.16.14",
34
+ "@esbuild/netbsd-x64": "0.16.14",
35
+ "@esbuild/openbsd-x64": "0.16.14",
36
+ "@esbuild/sunos-x64": "0.16.14",
37
+ "@esbuild/win32-arm64": "0.16.14",
38
+ "@esbuild/win32-ia32": "0.16.14",
39
+ "@esbuild/win32-x64": "0.16.14"
40
40
  },
41
41
  "license": "MIT"
42
42
  }