esbuild 0.20.1 → 0.21.0

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
@@ -87,16 +87,14 @@ function pkgForSomeOtherPlatform() {
87
87
  for (const unixKey in knownUnixlikePackages) {
88
88
  try {
89
89
  const pkg = knownUnixlikePackages[unixKey];
90
- if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
91
- return pkg;
90
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
92
91
  } catch {
93
92
  }
94
93
  }
95
94
  for (const windowsKey in knownWindowsPackages) {
96
95
  try {
97
96
  const pkg = knownWindowsPackages[windowsKey];
98
- if (fs.existsSync(path.join(nodeModulesDirectory, pkg)))
99
- return pkg;
97
+ if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg;
100
98
  } catch {
101
99
  }
102
100
  }
@@ -200,7 +198,7 @@ for your current platform.`);
200
198
  "node_modules",
201
199
  ".cache",
202
200
  "esbuild",
203
- `pnpapi-${pkg.replace("/", "-")}-${"0.20.1"}-${path.basename(subpath)}`
201
+ `pnpapi-${pkg.replace("/", "-")}-${"0.21.0"}-${path.basename(subpath)}`
204
202
  );
205
203
  if (!fs.existsSync(binTargetPath)) {
206
204
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/install.js CHANGED
@@ -167,8 +167,7 @@ function extractFileFromTarGzip(buffer, subpath) {
167
167
  let size = parseInt(str(offset + 124, 12), 8);
168
168
  offset += 512;
169
169
  if (!isNaN(size)) {
170
- if (name === subpath)
171
- return buffer.subarray(offset, offset + size);
170
+ if (name === subpath) return buffer.subarray(offset, offset + size);
172
171
  offset += size + 511 & ~511;
173
172
  }
174
173
  }
@@ -203,10 +202,8 @@ function removeRecursive(dir) {
203
202
  } catch {
204
203
  continue;
205
204
  }
206
- if (stats.isDirectory())
207
- removeRecursive(entryPath);
208
- else
209
- fs2.unlinkSync(entryPath);
205
+ if (stats.isDirectory()) removeRecursive(entryPath);
206
+ else fs2.unlinkSync(entryPath);
210
207
  }
211
208
  fs2.rmdirSync(dir);
212
209
  }
package/lib/main.d.ts CHANGED
@@ -664,16 +664,40 @@ export let version: string
664
664
 
665
665
  // Call this function to terminate esbuild's child process. The child process
666
666
  // is not terminated and re-created after each API call because it's more
667
- // efficient to keep it around when there are multiple API calls. This child
668
- // process normally exits automatically when the parent process exits, so you
669
- // usually don't need to call this function.
667
+ // efficient to keep it around when there are multiple API calls.
670
668
  //
671
- // One reason you might want to call this is if you know you will not make any
672
- // more esbuild API calls and you want to clean up resources (since the esbuild
673
- // child process takes up some memory even when idle).
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.
674
676
  //
675
677
  // Another reason you might want to call this is if you are using esbuild from
676
678
  // within a Deno test. Deno fails tests that create a child process without
677
679
  // killing it before the test ends, so you have to call this function (and
678
680
  // await the returned promise) in every Deno test that uses esbuild.
679
681
  export declare function stop(): Promise<void>
682
+
683
+ // Note: These declarations exist to avoid type errors when you omit "dom" from
684
+ // "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
685
+ // global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
686
+ // with the browser DOM and is present in many non-browser JavaScript runtimes
687
+ // (e.g. node and deno). Declaring it here allows esbuild's API to be used in
688
+ // these scenarios.
689
+ //
690
+ // There's an open issue about getting this problem corrected (although these
691
+ // declarations will need to remain even if this is fixed for backward
692
+ // compatibility with older TypeScript versions):
693
+ //
694
+ // https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
695
+ //
696
+ declare global {
697
+ namespace WebAssembly {
698
+ interface Module {
699
+ }
700
+ }
701
+ interface URL {
702
+ }
703
+ }