esbuild 0.19.10 → 0.19.11

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
@@ -200,7 +200,7 @@ for your current platform.`);
200
200
  "node_modules",
201
201
  ".cache",
202
202
  "esbuild",
203
- `pnpapi-${pkg.replace("/", "-")}-${"0.19.10"}-${path.basename(subpath)}`
203
+ `pnpapi-${pkg.replace("/", "-")}-${"0.19.11"}-${path.basename(subpath)}`
204
204
  );
205
205
  if (!fs.existsSync(binTargetPath)) {
206
206
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/lib/main.d.ts CHANGED
@@ -661,3 +661,16 @@ export interface InitializeOptions {
661
661
  }
662
662
 
663
663
  export let version: string
664
+
665
+ // Call this function to terminate esbuild's child process. The child process
666
+ // is not terminated and re-created for each API call because it's more
667
+ // efficient to keep it around when there are multiple API calls.
668
+ //
669
+ // In node this happens automatically before the parent node process exits. So
670
+ // you only need to call this if you know you will not make any more esbuild
671
+ // API calls and you want to clean up resources.
672
+ //
673
+ // Unlike node, Deno lacks the necessary APIs to clean up child processes
674
+ // automatically. You must manually call stop() in Deno when you're done
675
+ // using esbuild or Deno will continue running forever.
676
+ export declare function stop(): void;
package/lib/main.js CHANGED
@@ -39,6 +39,7 @@ __export(node_exports, {
39
39
  formatMessages: () => formatMessages,
40
40
  formatMessagesSync: () => formatMessagesSync,
41
41
  initialize: () => initialize,
42
+ stop: () => stop,
42
43
  transform: () => transform,
43
44
  transformSync: () => transformSync,
44
45
  version: () => version
@@ -746,8 +747,8 @@ function createChannel(streamIn) {
746
747
  if (isFirstPacket) {
747
748
  isFirstPacket = false;
748
749
  let binaryVersion = String.fromCharCode(...bytes);
749
- if (binaryVersion !== "0.19.10") {
750
- throw new Error(`Cannot start service: Host version "${"0.19.10"}" does not match binary version ${quote(binaryVersion)}`);
750
+ if (binaryVersion !== "0.19.11") {
751
+ throw new Error(`Cannot start service: Host version "${"0.19.11"}" does not match binary version ${quote(binaryVersion)}`);
751
752
  }
752
753
  return;
753
754
  }
@@ -1940,7 +1941,7 @@ for your current platform.`);
1940
1941
  "node_modules",
1941
1942
  ".cache",
1942
1943
  "esbuild",
1943
- `pnpapi-${pkg.replace("/", "-")}-${"0.19.10"}-${path.basename(subpath)}`
1944
+ `pnpapi-${pkg.replace("/", "-")}-${"0.19.11"}-${path.basename(subpath)}`
1944
1945
  );
1945
1946
  if (!fs.existsSync(binTargetPath)) {
1946
1947
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -1975,7 +1976,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1975
1976
  }
1976
1977
  }
1977
1978
  var _a;
1978
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.10";
1979
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.19.11";
1979
1980
  var esbuildCommandAndArgs = () => {
1980
1981
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1981
1982
  throw new Error(
@@ -2042,7 +2043,7 @@ var fsAsync = {
2042
2043
  }
2043
2044
  }
2044
2045
  };
2045
- var version = "0.19.10";
2046
+ var version = "0.19.11";
2046
2047
  var build = (options) => ensureServiceIsRunning().build(options);
2047
2048
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
2048
2049
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2131,6 +2132,12 @@ var analyzeMetafileSync = (metafile, options) => {
2131
2132
  }));
2132
2133
  return result;
2133
2134
  };
2135
+ var stop = () => {
2136
+ if (stopService)
2137
+ stopService();
2138
+ if (workerThreadService)
2139
+ workerThreadService.stop();
2140
+ };
2134
2141
  var initializeWasCalled = false;
2135
2142
  var initialize = (options) => {
2136
2143
  options = validateInitializeOptions(options || {});
@@ -2148,11 +2155,12 @@ var initialize = (options) => {
2148
2155
  };
2149
2156
  var defaultWD = process.cwd();
2150
2157
  var longLivedService;
2158
+ var stopService;
2151
2159
  var ensureServiceIsRunning = () => {
2152
2160
  if (longLivedService)
2153
2161
  return longLivedService;
2154
2162
  let [command, args] = esbuildCommandAndArgs();
2155
- let child = child_process.spawn(command, args.concat(`--service=${"0.19.10"}`, "--ping"), {
2163
+ let child = child_process.spawn(command, args.concat(`--service=${"0.19.11"}`, "--ping"), {
2156
2164
  windowsHide: true,
2157
2165
  stdio: ["pipe", "pipe", "inherit"],
2158
2166
  cwd: defaultWD
@@ -2175,6 +2183,14 @@ var ensureServiceIsRunning = () => {
2175
2183
  const stdout = child.stdout;
2176
2184
  stdout.on("data", readFromStdout);
2177
2185
  stdout.on("end", afterClose);
2186
+ stopService = () => {
2187
+ stdin.destroy();
2188
+ stdout.destroy();
2189
+ child.kill();
2190
+ initializeWasCalled = false;
2191
+ longLivedService = void 0;
2192
+ stopService = void 0;
2193
+ };
2178
2194
  let refCount = 0;
2179
2195
  child.unref();
2180
2196
  if (stdin.unref) {
@@ -2252,7 +2268,7 @@ var runServiceSync = (callback) => {
2252
2268
  esbuild: node_exports
2253
2269
  });
2254
2270
  callback(service);
2255
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.10"}`), {
2271
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.19.11"}`), {
2256
2272
  cwd: defaultWD,
2257
2273
  windowsHide: true,
2258
2274
  input: stdin,
@@ -2272,7 +2288,7 @@ var workerThreadService = null;
2272
2288
  var startWorkerThreadService = (worker_threads2) => {
2273
2289
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2274
2290
  let worker = new worker_threads2.Worker(__filename, {
2275
- workerData: { workerPort, defaultWD, esbuildVersion: "0.19.10" },
2291
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.19.11" },
2276
2292
  transferList: [workerPort],
2277
2293
  // From node's documentation: https://nodejs.org/api/worker_threads.html
2278
2294
  //
@@ -2338,6 +2354,10 @@ error: ${text}`);
2338
2354
  },
2339
2355
  analyzeMetafileSync(metafile, options) {
2340
2356
  return runCallSync("analyzeMetafile", [metafile, options]);
2357
+ },
2358
+ stop() {
2359
+ worker.terminate();
2360
+ workerThreadService = null;
2341
2361
  }
2342
2362
  };
2343
2363
  };
@@ -2408,6 +2428,7 @@ var node_default = node_exports;
2408
2428
  formatMessages,
2409
2429
  formatMessagesSync,
2410
2430
  initialize,
2431
+ stop,
2411
2432
  transform,
2412
2433
  transformSync,
2413
2434
  version
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.19.10",
3
+ "version": "0.19.11",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,29 +15,29 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@esbuild/aix-ppc64": "0.19.10",
19
- "@esbuild/android-arm": "0.19.10",
20
- "@esbuild/android-arm64": "0.19.10",
21
- "@esbuild/android-x64": "0.19.10",
22
- "@esbuild/darwin-arm64": "0.19.10",
23
- "@esbuild/darwin-x64": "0.19.10",
24
- "@esbuild/freebsd-arm64": "0.19.10",
25
- "@esbuild/freebsd-x64": "0.19.10",
26
- "@esbuild/linux-arm": "0.19.10",
27
- "@esbuild/linux-arm64": "0.19.10",
28
- "@esbuild/linux-ia32": "0.19.10",
29
- "@esbuild/linux-loong64": "0.19.10",
30
- "@esbuild/linux-mips64el": "0.19.10",
31
- "@esbuild/linux-ppc64": "0.19.10",
32
- "@esbuild/linux-riscv64": "0.19.10",
33
- "@esbuild/linux-s390x": "0.19.10",
34
- "@esbuild/linux-x64": "0.19.10",
35
- "@esbuild/netbsd-x64": "0.19.10",
36
- "@esbuild/openbsd-x64": "0.19.10",
37
- "@esbuild/sunos-x64": "0.19.10",
38
- "@esbuild/win32-arm64": "0.19.10",
39
- "@esbuild/win32-ia32": "0.19.10",
40
- "@esbuild/win32-x64": "0.19.10"
18
+ "@esbuild/aix-ppc64": "0.19.11",
19
+ "@esbuild/android-arm": "0.19.11",
20
+ "@esbuild/android-arm64": "0.19.11",
21
+ "@esbuild/android-x64": "0.19.11",
22
+ "@esbuild/darwin-arm64": "0.19.11",
23
+ "@esbuild/darwin-x64": "0.19.11",
24
+ "@esbuild/freebsd-arm64": "0.19.11",
25
+ "@esbuild/freebsd-x64": "0.19.11",
26
+ "@esbuild/linux-arm": "0.19.11",
27
+ "@esbuild/linux-arm64": "0.19.11",
28
+ "@esbuild/linux-ia32": "0.19.11",
29
+ "@esbuild/linux-loong64": "0.19.11",
30
+ "@esbuild/linux-mips64el": "0.19.11",
31
+ "@esbuild/linux-ppc64": "0.19.11",
32
+ "@esbuild/linux-riscv64": "0.19.11",
33
+ "@esbuild/linux-s390x": "0.19.11",
34
+ "@esbuild/linux-x64": "0.19.11",
35
+ "@esbuild/netbsd-x64": "0.19.11",
36
+ "@esbuild/openbsd-x64": "0.19.11",
37
+ "@esbuild/sunos-x64": "0.19.11",
38
+ "@esbuild/win32-arm64": "0.19.11",
39
+ "@esbuild/win32-ia32": "0.19.11",
40
+ "@esbuild/win32-x64": "0.19.11"
41
41
  },
42
42
  "license": "MIT"
43
43
  }