esbuild 0.14.50 → 0.14.53

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
@@ -43,6 +43,7 @@ var knownUnixlikePackages = {
43
43
  "linux riscv64 LE": "esbuild-linux-riscv64",
44
44
  "linux s390x BE": "esbuild-linux-s390x",
45
45
  "linux x64 LE": "esbuild-linux-64",
46
+ "linux loong64 LE": "@esbuild/linux-loong64",
46
47
  "netbsd x64 LE": "esbuild-netbsd-64",
47
48
  "openbsd x64 LE": "esbuild-openbsd-64",
48
49
  "sunos x64 LE": "esbuild-sunos-64"
package/install.js CHANGED
@@ -42,6 +42,7 @@ var knownUnixlikePackages = {
42
42
  "linux riscv64 LE": "esbuild-linux-riscv64",
43
43
  "linux s390x BE": "esbuild-linux-s390x",
44
44
  "linux x64 LE": "esbuild-linux-64",
45
+ "linux loong64 LE": "@esbuild/linux-loong64",
45
46
  "netbsd x64 LE": "esbuild-netbsd-64",
46
47
  "openbsd x64 LE": "esbuild-openbsd-64",
47
48
  "sunos x64 LE": "esbuild-sunos-64"
@@ -88,8 +89,8 @@ function validateBinaryVersion(...command) {
88
89
  const stdout = child_process.execFileSync(command.shift(), command, {
89
90
  stdio: "pipe"
90
91
  }).toString().trim();
91
- if (stdout !== "0.14.50") {
92
- throw new Error(`Expected ${JSON.stringify("0.14.50")} but got ${JSON.stringify(stdout)}`);
92
+ if (stdout !== "0.14.53") {
93
+ throw new Error(`Expected ${JSON.stringify("0.14.53")} but got ${JSON.stringify(stdout)}`);
93
94
  }
94
95
  }
95
96
  function isYarn() {
@@ -141,7 +142,7 @@ function installUsingNPM(pkg, subpath, binPath) {
141
142
  try {
142
143
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
143
144
  child_process.execSync(
144
- `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.50"}`,
145
+ `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.53"}`,
145
146
  { cwd: installDir, stdio: "pipe", env }
146
147
  );
147
148
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
@@ -192,7 +193,7 @@ function maybeOptimizePackage(binPath) {
192
193
  }
193
194
  }
194
195
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
195
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.50"}.tgz`;
196
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.53"}.tgz`;
196
197
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
197
198
  try {
198
199
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.d.ts CHANGED
@@ -52,11 +52,15 @@ interface CommonOptions {
52
52
  ignoreAnnotations?: boolean;
53
53
 
54
54
  /** Documentation: https://esbuild.github.io/api/#jsx */
55
- jsx?: 'transform' | 'preserve';
55
+ jsx?: 'transform' | 'preserve' | 'automatic';
56
56
  /** Documentation: https://esbuild.github.io/api/#jsx-factory */
57
57
  jsxFactory?: string;
58
58
  /** Documentation: https://esbuild.github.io/api/#jsx-fragment */
59
59
  jsxFragment?: string;
60
+ /** Documentation: https://esbuild.github.io/api/#jsx-import-source */
61
+ jsxImportSource?: string;
62
+ /** Documentation: https://esbuild.github.io/api/#jsx-development */
63
+ jsxDev?: boolean;
60
64
 
61
65
  /** Documentation: https://esbuild.github.io/api/#define */
62
66
  define?: { [key: string]: string };
@@ -143,7 +147,7 @@ export interface WatchMode {
143
147
  }
144
148
 
145
149
  export interface StdinOptions {
146
- contents: string;
150
+ contents: string | Uint8Array;
147
151
  resolveDir?: string;
148
152
  sourcefile?: string;
149
153
  loader?: Loader;
@@ -495,7 +499,7 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
495
499
  *
496
500
  * Documentation: https://esbuild.github.io/api/#transform-api
497
501
  */
498
- export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
502
+ export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
499
503
 
500
504
  /**
501
505
  * Converts log messages to formatted message strings suitable for printing in
package/lib/main.js CHANGED
@@ -304,6 +304,8 @@ function pushCommonFlags(flags, options, keys) {
304
304
  let jsx = getFlag(options, keys, "jsx", mustBeString);
305
305
  let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString);
306
306
  let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString);
307
+ let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString);
308
+ let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean);
307
309
  let define = getFlag(options, keys, "define", mustBeObject);
308
310
  let logOverride = getFlag(options, keys, "logOverride", mustBeObject);
309
311
  let supported = getFlag(options, keys, "supported", mustBeObject);
@@ -357,6 +359,10 @@ function pushCommonFlags(flags, options, keys) {
357
359
  flags.push(`--jsx-factory=${jsxFactory}`);
358
360
  if (jsxFragment)
359
361
  flags.push(`--jsx-fragment=${jsxFragment}`);
362
+ if (jsxImportSource)
363
+ flags.push(`--jsx-import-source=${jsxImportSource}`);
364
+ if (jsxDev)
365
+ flags.push(`--jsx-dev`);
360
366
  if (define) {
361
367
  for (let key in define) {
362
368
  if (key.indexOf("=") >= 0)
@@ -543,7 +549,7 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
543
549
  }
544
550
  if (stdin) {
545
551
  let stdinKeys = /* @__PURE__ */ Object.create(null);
546
- let contents = getFlag(stdin, stdinKeys, "contents", mustBeString);
552
+ let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array);
547
553
  let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString);
548
554
  let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString);
549
555
  let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString);
@@ -554,7 +560,10 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
554
560
  flags.push(`--loader=${loader2}`);
555
561
  if (resolveDir)
556
562
  stdinResolveDir = resolveDir + "";
557
- stdinContents = contents ? contents + "" : "";
563
+ if (typeof contents === "string")
564
+ stdinContents = encodeUTF8(contents);
565
+ else if (contents instanceof Uint8Array)
566
+ stdinContents = contents;
558
567
  }
559
568
  let nodePaths = [];
560
569
  if (nodePathsInput) {
@@ -749,8 +758,8 @@ function createChannel(streamIn) {
749
758
  if (isFirstPacket) {
750
759
  isFirstPacket = false;
751
760
  let binaryVersion = String.fromCharCode(...bytes);
752
- if (binaryVersion !== "0.14.50") {
753
- throw new Error(`Cannot start service: Host version "${"0.14.50"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
761
+ if (binaryVersion !== "0.14.53") {
762
+ throw new Error(`Cannot start service: Host version "${"0.14.53"}" does not match binary version ${JSON.stringify(binaryVersion)}`);
754
763
  }
755
764
  return;
756
765
  }
@@ -1372,8 +1381,8 @@ function createChannel(streamIn) {
1372
1381
  const details = createObjectStash();
1373
1382
  let start = (inputPath) => {
1374
1383
  try {
1375
- if (typeof input !== "string")
1376
- throw new Error('The input to "transform" must be a string');
1384
+ if (typeof input !== "string" && !(input instanceof Uint8Array))
1385
+ throw new Error('The input to "transform" must be a string or a Uint8Array');
1377
1386
  let {
1378
1387
  flags,
1379
1388
  mangleCache
@@ -1382,7 +1391,7 @@ function createChannel(streamIn) {
1382
1391
  command: "transform",
1383
1392
  flags,
1384
1393
  inputFS: inputPath !== null,
1385
- input: inputPath !== null ? inputPath : input
1394
+ input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input
1386
1395
  };
1387
1396
  if (mangleCache)
1388
1397
  request.mangleCache = mangleCache;
@@ -1439,7 +1448,7 @@ function createChannel(streamIn) {
1439
1448
  });
1440
1449
  }
1441
1450
  };
1442
- if (typeof input === "string" && input.length > 1024 * 1024) {
1451
+ if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) {
1443
1452
  let next = start;
1444
1453
  start = () => fs3.writeFile(input, next);
1445
1454
  }
@@ -1698,8 +1707,11 @@ function convertOutputFiles({ path: path3, contents }) {
1698
1707
  path: path3,
1699
1708
  contents,
1700
1709
  get text() {
1701
- if (text === null)
1702
- text = decodeUTF8(contents);
1710
+ const binary = this.contents;
1711
+ if (text === null || binary !== contents) {
1712
+ contents = binary;
1713
+ text = decodeUTF8(binary);
1714
+ }
1703
1715
  return text;
1704
1716
  }
1705
1717
  };
@@ -1729,6 +1741,7 @@ var knownUnixlikePackages = {
1729
1741
  "linux riscv64 LE": "esbuild-linux-riscv64",
1730
1742
  "linux s390x BE": "esbuild-linux-s390x",
1731
1743
  "linux x64 LE": "esbuild-linux-64",
1744
+ "linux loong64 LE": "@esbuild/linux-loong64",
1732
1745
  "netbsd x64 LE": "esbuild-netbsd-64",
1733
1746
  "openbsd x64 LE": "esbuild-openbsd-64",
1734
1747
  "sunos x64 LE": "esbuild-sunos-64"
@@ -1873,7 +1886,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1873
1886
  }
1874
1887
  }
1875
1888
  var _a;
1876
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.50";
1889
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.53";
1877
1890
  var esbuildCommandAndArgs = () => {
1878
1891
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1879
1892
  throw new Error(
@@ -1939,7 +1952,7 @@ var fsAsync = {
1939
1952
  }
1940
1953
  }
1941
1954
  };
1942
- var version = "0.14.50";
1955
+ var version = "0.14.53";
1943
1956
  var build = (options) => ensureServiceIsRunning().build(options);
1944
1957
  var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions);
1945
1958
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2050,7 +2063,7 @@ var ensureServiceIsRunning = () => {
2050
2063
  if (longLivedService)
2051
2064
  return longLivedService;
2052
2065
  let [command, args] = esbuildCommandAndArgs();
2053
- let child = child_process.spawn(command, args.concat(`--service=${"0.14.50"}`, "--ping"), {
2066
+ let child = child_process.spawn(command, args.concat(`--service=${"0.14.53"}`, "--ping"), {
2054
2067
  windowsHide: true,
2055
2068
  stdio: ["pipe", "pipe", "inherit"],
2056
2069
  cwd: defaultWD
@@ -2164,7 +2177,7 @@ var runServiceSync = (callback) => {
2164
2177
  esbuild: node_exports
2165
2178
  });
2166
2179
  callback(service);
2167
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.50"}`), {
2180
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.53"}`), {
2168
2181
  cwd: defaultWD,
2169
2182
  windowsHide: true,
2170
2183
  input: stdin,
@@ -2180,7 +2193,7 @@ var workerThreadService = null;
2180
2193
  var startWorkerThreadService = (worker_threads2) => {
2181
2194
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2182
2195
  let worker = new worker_threads2.Worker(__filename, {
2183
- workerData: { workerPort, defaultWD, esbuildVersion: "0.14.50" },
2196
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.14.53" },
2184
2197
  transferList: [workerPort],
2185
2198
  execArgv: []
2186
2199
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.14.50",
3
+ "version": "0.14.53",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,26 +15,27 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "esbuild-android-64": "0.14.50",
19
- "esbuild-android-arm64": "0.14.50",
20
- "esbuild-darwin-64": "0.14.50",
21
- "esbuild-darwin-arm64": "0.14.50",
22
- "esbuild-freebsd-64": "0.14.50",
23
- "esbuild-freebsd-arm64": "0.14.50",
24
- "esbuild-linux-32": "0.14.50",
25
- "esbuild-linux-64": "0.14.50",
26
- "esbuild-linux-arm": "0.14.50",
27
- "esbuild-linux-arm64": "0.14.50",
28
- "esbuild-linux-mips64le": "0.14.50",
29
- "esbuild-linux-ppc64le": "0.14.50",
30
- "esbuild-linux-riscv64": "0.14.50",
31
- "esbuild-linux-s390x": "0.14.50",
32
- "esbuild-netbsd-64": "0.14.50",
33
- "esbuild-openbsd-64": "0.14.50",
34
- "esbuild-sunos-64": "0.14.50",
35
- "esbuild-windows-32": "0.14.50",
36
- "esbuild-windows-64": "0.14.50",
37
- "esbuild-windows-arm64": "0.14.50"
18
+ "@esbuild/linux-loong64": "0.14.53",
19
+ "esbuild-android-64": "0.14.53",
20
+ "esbuild-android-arm64": "0.14.53",
21
+ "esbuild-darwin-64": "0.14.53",
22
+ "esbuild-darwin-arm64": "0.14.53",
23
+ "esbuild-freebsd-64": "0.14.53",
24
+ "esbuild-freebsd-arm64": "0.14.53",
25
+ "esbuild-linux-32": "0.14.53",
26
+ "esbuild-linux-64": "0.14.53",
27
+ "esbuild-linux-arm": "0.14.53",
28
+ "esbuild-linux-arm64": "0.14.53",
29
+ "esbuild-linux-mips64le": "0.14.53",
30
+ "esbuild-linux-ppc64le": "0.14.53",
31
+ "esbuild-linux-riscv64": "0.14.53",
32
+ "esbuild-linux-s390x": "0.14.53",
33
+ "esbuild-netbsd-64": "0.14.53",
34
+ "esbuild-openbsd-64": "0.14.53",
35
+ "esbuild-sunos-64": "0.14.53",
36
+ "esbuild-windows-32": "0.14.53",
37
+ "esbuild-windows-64": "0.14.53",
38
+ "esbuild-windows-arm64": "0.14.53"
38
39
  },
39
40
  "license": "MIT"
40
41
  }