esbuild 0.21.3 → 0.21.5

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
@@ -198,7 +198,7 @@ for your current platform.`);
198
198
  "node_modules",
199
199
  ".cache",
200
200
  "esbuild",
201
- `pnpapi-${pkg.replace("/", "-")}-${"0.21.3"}-${path.basename(subpath)}`
201
+ `pnpapi-${pkg.replace("/", "-")}-${"0.21.5"}-${path.basename(subpath)}`
202
202
  );
203
203
  if (!fs.existsSync(binTargetPath)) {
204
204
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/lib/main.d.ts CHANGED
@@ -340,6 +340,7 @@ export interface ResolveOptions {
340
340
  resolveDir?: string
341
341
  kind?: ImportKind
342
342
  pluginData?: any
343
+ with?: Record<string, string>
343
344
  }
344
345
 
345
346
  /** Documentation: https://esbuild.github.io/plugins/#resolve-results */
@@ -379,6 +380,7 @@ export interface OnResolveArgs {
379
380
  resolveDir: string
380
381
  kind: ImportKind
381
382
  pluginData: any
383
+ with: Record<string, string>
382
384
  }
383
385
 
384
386
  export type ImportKind =
package/lib/main.js CHANGED
@@ -662,8 +662,8 @@ function createChannel(streamIn) {
662
662
  if (isFirstPacket) {
663
663
  isFirstPacket = false;
664
664
  let binaryVersion = String.fromCharCode(...bytes);
665
- if (binaryVersion !== "0.21.3") {
666
- throw new Error(`Cannot start service: Host version "${"0.21.3"}" does not match binary version ${quote(binaryVersion)}`);
665
+ if (binaryVersion !== "0.21.5") {
666
+ throw new Error(`Cannot start service: Host version "${"0.21.5"}" does not match binary version ${quote(binaryVersion)}`);
667
667
  }
668
668
  return;
669
669
  }
@@ -1115,6 +1115,7 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1115
1115
  let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString);
1116
1116
  let kind = getFlag(options, keys2, "kind", mustBeString);
1117
1117
  let pluginData = getFlag(options, keys2, "pluginData", canBeAnything);
1118
+ let importAttributes = getFlag(options, keys2, "with", mustBeObject);
1118
1119
  checkForInvalidFlags(options, keys2, "in resolve() call");
1119
1120
  return new Promise((resolve2, reject) => {
1120
1121
  const request = {
@@ -1130,6 +1131,7 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1130
1131
  if (kind != null) request.kind = kind;
1131
1132
  else throw new Error(`Must specify "kind" when calling "resolve"`);
1132
1133
  if (pluginData != null) request.pluginData = details.store(pluginData);
1134
+ if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with");
1133
1135
  sendRequest(refs, request, (error, response) => {
1134
1136
  if (error !== null) reject(new Error(error));
1135
1137
  else resolve2({
@@ -1226,7 +1228,8 @@ var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn,
1226
1228
  namespace: request.namespace,
1227
1229
  resolveDir: request.resolveDir,
1228
1230
  kind: request.kind,
1229
- pluginData: details.load(request.pluginData)
1231
+ pluginData: details.load(request.pluginData),
1232
+ with: request.with
1230
1233
  });
1231
1234
  if (result != null) {
1232
1235
  if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name)} to return an object`);
@@ -1563,6 +1566,15 @@ function sanitizeStringArray(values, property) {
1563
1566
  }
1564
1567
  return result;
1565
1568
  }
1569
+ function sanitizeStringMap(map, property) {
1570
+ const result = /* @__PURE__ */ Object.create(null);
1571
+ for (const key in map) {
1572
+ const value = map[key];
1573
+ if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`);
1574
+ result[key] = value;
1575
+ }
1576
+ return result;
1577
+ }
1566
1578
  function convertOutputFiles({ path: path3, contents, hash }) {
1567
1579
  let text = null;
1568
1580
  return {
@@ -1755,7 +1767,7 @@ for your current platform.`);
1755
1767
  "node_modules",
1756
1768
  ".cache",
1757
1769
  "esbuild",
1758
- `pnpapi-${pkg.replace("/", "-")}-${"0.21.3"}-${path.basename(subpath)}`
1770
+ `pnpapi-${pkg.replace("/", "-")}-${"0.21.5"}-${path.basename(subpath)}`
1759
1771
  );
1760
1772
  if (!fs.existsSync(binTargetPath)) {
1761
1773
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -1790,7 +1802,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1790
1802
  }
1791
1803
  }
1792
1804
  var _a;
1793
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.21.3";
1805
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.21.5";
1794
1806
  var esbuildCommandAndArgs = () => {
1795
1807
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1796
1808
  throw new Error(
@@ -1857,7 +1869,7 @@ var fsAsync = {
1857
1869
  }
1858
1870
  }
1859
1871
  };
1860
- var version = "0.21.3";
1872
+ var version = "0.21.5";
1861
1873
  var build = (options) => ensureServiceIsRunning().build(options);
1862
1874
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
1863
1875
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -1960,7 +1972,7 @@ var stopService;
1960
1972
  var ensureServiceIsRunning = () => {
1961
1973
  if (longLivedService) return longLivedService;
1962
1974
  let [command, args] = esbuildCommandAndArgs();
1963
- let child = child_process.spawn(command, args.concat(`--service=${"0.21.3"}`, "--ping"), {
1975
+ let child = child_process.spawn(command, args.concat(`--service=${"0.21.5"}`, "--ping"), {
1964
1976
  windowsHide: true,
1965
1977
  stdio: ["pipe", "pipe", "inherit"],
1966
1978
  cwd: defaultWD
@@ -2064,7 +2076,7 @@ var runServiceSync = (callback) => {
2064
2076
  esbuild: node_exports
2065
2077
  });
2066
2078
  callback(service);
2067
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.21.3"}`), {
2079
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.21.5"}`), {
2068
2080
  cwd: defaultWD,
2069
2081
  windowsHide: true,
2070
2082
  input: stdin,
@@ -2084,7 +2096,7 @@ var workerThreadService = null;
2084
2096
  var startWorkerThreadService = (worker_threads2) => {
2085
2097
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2086
2098
  let worker = new worker_threads2.Worker(__filename, {
2087
- workerData: { workerPort, defaultWD, esbuildVersion: "0.21.3" },
2099
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.21.5" },
2088
2100
  transferList: [workerPort],
2089
2101
  // From node's documentation: https://nodejs.org/api/worker_threads.html
2090
2102
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.21.3",
3
+ "version": "0.21.5",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,29 +18,29 @@
18
18
  "esbuild": "bin/esbuild"
19
19
  },
20
20
  "optionalDependencies": {
21
- "@esbuild/aix-ppc64": "0.21.3",
22
- "@esbuild/android-arm": "0.21.3",
23
- "@esbuild/android-arm64": "0.21.3",
24
- "@esbuild/android-x64": "0.21.3",
25
- "@esbuild/darwin-arm64": "0.21.3",
26
- "@esbuild/darwin-x64": "0.21.3",
27
- "@esbuild/freebsd-arm64": "0.21.3",
28
- "@esbuild/freebsd-x64": "0.21.3",
29
- "@esbuild/linux-arm": "0.21.3",
30
- "@esbuild/linux-arm64": "0.21.3",
31
- "@esbuild/linux-ia32": "0.21.3",
32
- "@esbuild/linux-loong64": "0.21.3",
33
- "@esbuild/linux-mips64el": "0.21.3",
34
- "@esbuild/linux-ppc64": "0.21.3",
35
- "@esbuild/linux-riscv64": "0.21.3",
36
- "@esbuild/linux-s390x": "0.21.3",
37
- "@esbuild/linux-x64": "0.21.3",
38
- "@esbuild/netbsd-x64": "0.21.3",
39
- "@esbuild/openbsd-x64": "0.21.3",
40
- "@esbuild/sunos-x64": "0.21.3",
41
- "@esbuild/win32-arm64": "0.21.3",
42
- "@esbuild/win32-ia32": "0.21.3",
43
- "@esbuild/win32-x64": "0.21.3"
21
+ "@esbuild/aix-ppc64": "0.21.5",
22
+ "@esbuild/android-arm": "0.21.5",
23
+ "@esbuild/android-arm64": "0.21.5",
24
+ "@esbuild/android-x64": "0.21.5",
25
+ "@esbuild/darwin-arm64": "0.21.5",
26
+ "@esbuild/darwin-x64": "0.21.5",
27
+ "@esbuild/freebsd-arm64": "0.21.5",
28
+ "@esbuild/freebsd-x64": "0.21.5",
29
+ "@esbuild/linux-arm": "0.21.5",
30
+ "@esbuild/linux-arm64": "0.21.5",
31
+ "@esbuild/linux-ia32": "0.21.5",
32
+ "@esbuild/linux-loong64": "0.21.5",
33
+ "@esbuild/linux-mips64el": "0.21.5",
34
+ "@esbuild/linux-ppc64": "0.21.5",
35
+ "@esbuild/linux-riscv64": "0.21.5",
36
+ "@esbuild/linux-s390x": "0.21.5",
37
+ "@esbuild/linux-x64": "0.21.5",
38
+ "@esbuild/netbsd-x64": "0.21.5",
39
+ "@esbuild/openbsd-x64": "0.21.5",
40
+ "@esbuild/sunos-x64": "0.21.5",
41
+ "@esbuild/win32-arm64": "0.21.5",
42
+ "@esbuild/win32-ia32": "0.21.5",
43
+ "@esbuild/win32-x64": "0.21.5"
44
44
  },
45
45
  "license": "MIT"
46
46
  }