bun 1.3.14 → 1.4.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.
Files changed (2) hide show
  1. package/install.js +34 -41
  2. package/package.json +13 -17
package/install.js CHANGED
@@ -42,7 +42,7 @@ var __async = (__this, __arguments, generator) => new Promise((resolve, reject)
42
42
  });
43
43
 
44
44
  // src/npm/install.ts
45
- var import_zlib = require("zlib");
45
+ var import_path2 = require("path"), import_zlib = require("zlib");
46
46
 
47
47
  // src/console.ts
48
48
  var isAction = !!process.env.GITHUB_ACTION, isDebug = process.env.DEBUG === "1" || process.env.LOG_LEVEL === "debug" || process.env.RUNNER_DEBUG === "1";
@@ -262,7 +262,7 @@ function spawn(cmd, args, options = {}) {
262
262
  __name(spawn, "spawn");
263
263
 
264
264
  // src/platform.ts
265
- var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" && isRosetta2() ? "arm64" : process.arch, avx2 = arch === "x64" && (os2 === "linux" && isLinuxAVX2() || os2 === "darwin" && isDarwinAVX2() || os2 === "win32" && isWindowsAVX2()), abi = os2 === "android" ? "android" : os2 === "linux" && isLinuxMusl() ? "musl" : void 0, platforms = [
265
+ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" && isRosetta2() ? "arm64" : process.arch, abi = os2 === "android" ? "android" : os2 === "linux" && isLinuxMusl() ? "musl" : void 0, platforms = [
266
266
  {
267
267
  os: "darwin",
268
268
  arch: "arm64",
@@ -272,13 +272,13 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
272
272
  {
273
273
  os: "darwin",
274
274
  arch: "x64",
275
- avx2: !0,
276
275
  bin: "bun-darwin-x64",
277
276
  exe: "bin/bun"
278
277
  },
279
278
  {
280
279
  os: "darwin",
281
280
  arch: "x64",
281
+ alias: !0,
282
282
  bin: "bun-darwin-x64-baseline",
283
283
  exe: "bin/bun"
284
284
  },
@@ -291,13 +291,13 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
291
291
  {
292
292
  os: "linux",
293
293
  arch: "x64",
294
- avx2: !0,
295
294
  bin: "bun-linux-x64",
296
295
  exe: "bin/bun"
297
296
  },
298
297
  {
299
298
  os: "linux",
300
299
  arch: "x64",
300
+ alias: !0,
301
301
  bin: "bun-linux-x64-baseline",
302
302
  exe: "bin/bun"
303
303
  },
@@ -312,7 +312,6 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
312
312
  os: "linux",
313
313
  arch: "x64",
314
314
  abi: "musl",
315
- avx2: !0,
316
315
  bin: "bun-linux-x64-musl",
317
316
  exe: "bin/bun"
318
317
  },
@@ -320,6 +319,7 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
320
319
  os: "linux",
321
320
  arch: "x64",
322
321
  abi: "musl",
322
+ alias: !0,
323
323
  bin: "bun-linux-x64-musl-baseline",
324
324
  exe: "bin/bun"
325
325
  },
@@ -356,13 +356,13 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
356
356
  {
357
357
  os: "win32",
358
358
  arch: "x64",
359
- avx2: !0,
360
359
  bin: "bun-windows-x64",
361
360
  exe: "bin/bun.exe"
362
361
  },
363
362
  {
364
363
  os: "win32",
365
364
  arch: "x64",
365
+ alias: !0,
366
366
  bin: "bun-windows-x64-baseline",
367
367
  exe: "bin/bun.exe"
368
368
  },
@@ -372,34 +372,37 @@ var os2 = process.platform, arch = os2 === "darwin" && process.arch === "x64" &&
372
372
  bin: "bun-windows-aarch64",
373
373
  exe: "bin/bun.exe"
374
374
  }
375
- ], supportedPlatforms = platforms.filter(
376
- (platform) => platform.os === os2 && platform.arch === arch && (!platform.avx2 || avx2) && (!platform.abi || abi === platform.abi)
377
- ).sort((a, b) => a.avx2 === b.avx2 ? 0 : a.avx2 ? -1 : 1);
378
- function isLinuxMusl() {
379
- try {
380
- return exists("/etc/alpine-release");
381
- } catch (error2) {
382
- return debug("isLinuxMusl failed", error2), !1;
383
- }
375
+ ];
376
+ function getSupportedPlatforms(os3, arch2, abi2) {
377
+ return platforms.filter(
378
+ (platform) => platform.os === os3 && platform.arch === arch2 && !platform.alias && (!platform.abi || abi2 === platform.abi)
379
+ ).sort((a, b) => Number(a.abi !== abi2) - Number(b.abi !== abi2));
384
380
  }
385
- __name(isLinuxMusl, "isLinuxMusl");
386
- function isLinuxAVX2() {
381
+ __name(getSupportedPlatforms, "getSupportedPlatforms");
382
+ var supportedPlatforms = getSupportedPlatforms(os2, arch, abi);
383
+ function isLinuxMusl() {
387
384
  try {
388
- return read("/proc/cpuinfo").includes("avx2");
385
+ if (process.report) {
386
+ let excludeNetwork = process.report.excludeNetwork;
387
+ process.report.excludeNetwork = !0;
388
+ try {
389
+ let report = process.report.getReport();
390
+ if (report && report.header)
391
+ return !report.header.glibcVersionRuntime;
392
+ } finally {
393
+ process.report.excludeNetwork = excludeNetwork;
394
+ }
395
+ }
389
396
  } catch (error2) {
390
- return debug("isLinuxAVX2 failed", error2), !1;
397
+ debug("process.report.getReport failed", error2);
391
398
  }
392
- }
393
- __name(isLinuxAVX2, "isLinuxAVX2");
394
- function isDarwinAVX2() {
395
399
  try {
396
- let { exitCode, stdout } = spawn("sysctl", ["-n", "machdep.cpu"]);
397
- return exitCode === 0 && stdout.includes("AVX2");
400
+ return exists("/etc/alpine-release");
398
401
  } catch (error2) {
399
- return debug("isDarwinAVX2 failed", error2), !1;
402
+ return debug("isLinuxMusl failed", error2), !1;
400
403
  }
401
404
  }
402
- __name(isDarwinAVX2, "isDarwinAVX2");
405
+ __name(isLinuxMusl, "isLinuxMusl");
403
406
  function isRosetta2() {
404
407
  try {
405
408
  let { exitCode, stdout } = spawn("sysctl", ["-n", "sysctl.proc_translated"]);
@@ -409,17 +412,6 @@ function isRosetta2() {
409
412
  }
410
413
  }
411
414
  __name(isRosetta2, "isRosetta2");
412
- function isWindowsAVX2() {
413
- try {
414
- return spawn("powershell", [
415
- "-c",
416
- `(Add-Type -MemberDefinition '[DllImport("kernel32.dll")] public static extern bool IsProcessorFeaturePresent(int ProcessorFeature);' -Name 'Kernel32' -Namespace 'Win32' -PassThru)::IsProcessorFeaturePresent(40);`
417
- ]).stdout.trim() === "True";
418
- } catch (error2) {
419
- return debug("isWindowsAVX2 failed", error2), !1;
420
- }
421
- }
422
- __name(isWindowsAVX2, "isWindowsAVX2");
423
415
 
424
416
  // src/npm/install.ts
425
417
  function importBun() {
@@ -475,7 +467,7 @@ function installBun(platform, dst) {
475
467
  write(join(cwd, "package.json"), "{}");
476
468
  let { exitCode } = spawn(
477
469
  "npm",
478
- ["install", "--loglevel=error", "--prefer-offline", "--no-audit", "--progress=false", `${module2}@1.3.14`],
470
+ ["install", "--loglevel=error", "--prefer-offline", "--no-audit", "--progress=false", `${module2}@1.4.0`],
479
471
  {
480
472
  cwd,
481
473
  stdio: "pipe",
@@ -496,7 +488,7 @@ function installBun(platform, dst) {
496
488
  __name(installBun, "installBun");
497
489
  function downloadBun(platform, dst) {
498
490
  return __async(this, null, function* () {
499
- let tgz = yield (yield fetch(`https://registry.npmjs.org/@oven/${platform.bin}/-/${platform.bin}-1.3.14.tgz`)).arrayBuffer(), buffer;
491
+ let tgz = yield (yield fetch(`https://registry.npmjs.org/@oven/${platform.bin}/-/${platform.bin}-1.4.0.tgz`)).arrayBuffer(), buffer;
500
492
  try {
501
493
  buffer = (0, import_zlib.unzipSync)(tgz);
502
494
  } catch (cause) {
@@ -510,9 +502,10 @@ function downloadBun(platform, dst) {
510
502
  for (; offset < buffer.length; ) {
511
503
  let name = str(offset, 100).replace("package/", ""), size = parseInt(str(offset + 124, 12), 8);
512
504
  if (offset += 512, !isNaN(size)) {
513
- if (write(join(dst, name), buffer.subarray(offset, offset + size)), name === platform.exe)
505
+ let entryPath = join(dst, name), entryName = (0, import_path2.relative)(dst, entryPath);
506
+ if (entryName && !entryName.startsWith("..") && !(0, import_path2.isAbsolute)(entryName) && (write(entryPath, buffer.subarray(offset, offset + size)), name === platform.exe))
514
507
  try {
515
- chmod(join(dst, name), 493);
508
+ chmod(entryPath, 493);
516
509
  } catch (error2) {
517
510
  debug("chmod failed", error2);
518
511
  }
package/package.json CHANGED
@@ -1,27 +1,23 @@
1
1
  {
2
2
  "name": "bun",
3
3
  "description": "Bun is a fast all-in-one JavaScript runtime.",
4
- "version": "1.3.14",
4
+ "version": "1.4.0",
5
5
  "scripts": {
6
6
  "postinstall": "node install.js"
7
7
  },
8
8
  "optionalDependencies": {
9
- "@oven/bun-darwin-aarch64": "1.3.14",
10
- "@oven/bun-darwin-x64": "1.3.14",
11
- "@oven/bun-darwin-x64-baseline": "1.3.14",
12
- "@oven/bun-linux-aarch64": "1.3.14",
13
- "@oven/bun-linux-x64": "1.3.14",
14
- "@oven/bun-linux-x64-baseline": "1.3.14",
15
- "@oven/bun-linux-aarch64-musl": "1.3.14",
16
- "@oven/bun-linux-x64-musl": "1.3.14",
17
- "@oven/bun-linux-x64-musl-baseline": "1.3.14",
18
- "@oven/bun-linux-aarch64-android": "1.3.14",
19
- "@oven/bun-linux-x64-android": "1.3.14",
20
- "@oven/bun-freebsd-aarch64": "1.3.14",
21
- "@oven/bun-freebsd-x64": "1.3.14",
22
- "@oven/bun-windows-x64": "1.3.14",
23
- "@oven/bun-windows-x64-baseline": "1.3.14",
24
- "@oven/bun-windows-aarch64": "1.3.14"
9
+ "@oven/bun-darwin-aarch64": "1.4.0",
10
+ "@oven/bun-darwin-x64": "1.4.0",
11
+ "@oven/bun-linux-aarch64": "1.4.0",
12
+ "@oven/bun-linux-x64": "1.4.0",
13
+ "@oven/bun-linux-aarch64-musl": "1.4.0",
14
+ "@oven/bun-linux-x64-musl": "1.4.0",
15
+ "@oven/bun-linux-aarch64-android": "1.4.0",
16
+ "@oven/bun-linux-x64-android": "1.4.0",
17
+ "@oven/bun-freebsd-aarch64": "1.4.0",
18
+ "@oven/bun-freebsd-x64": "1.4.0",
19
+ "@oven/bun-windows-x64": "1.4.0",
20
+ "@oven/bun-windows-aarch64": "1.4.0"
25
21
  },
26
22
  "bin": {
27
23
  "bun": "bin/bun.exe",