mirror of
https://github.com/oven-sh/bun
synced 2026-02-03 15:38:46 +00:00
Compare commits
53 Commits
dave/test-
...
fix-format
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88063eaad5 | ||
|
|
da2d1e12ed | ||
|
|
6b54dbfa07 | ||
|
|
1dfa557ca4 | ||
|
|
29d1b4db74 | ||
|
|
85edb39a2f | ||
|
|
f0384f39b7 | ||
|
|
2e1b19b9fd | ||
|
|
53ce1ff6c1 | ||
|
|
eee9b51df3 | ||
|
|
f0036cc6c1 | ||
|
|
77a25c0188 | ||
|
|
a3777b8c22 | ||
|
|
0d9d7a3436 | ||
|
|
d5e7846eaf | ||
|
|
582a53e26e | ||
|
|
57d9cfc24d | ||
|
|
31dc58fa79 | ||
|
|
03bb9fd9b5 | ||
|
|
f270f235c8 | ||
|
|
8d1b5856d3 | ||
|
|
bf488d0b19 | ||
|
|
9dc0672840 | ||
|
|
b1d0cb0ea3 | ||
|
|
155ba7ebdf | ||
|
|
3757a3e30f | ||
|
|
4b443db0d8 | ||
|
|
d74ae08946 | ||
|
|
a7a5ed2fba | ||
|
|
7d7c9877a4 | ||
|
|
1cd43f5bae | ||
|
|
56b6ed6d97 | ||
|
|
85dd8ef0d4 | ||
|
|
6cb0de3921 | ||
|
|
2c1dcb5a1d | ||
|
|
d3f3900da7 | ||
|
|
ef18731db1 | ||
|
|
7fb15e5a03 | ||
|
|
2b017cd0ad | ||
|
|
9f857fa418 | ||
|
|
1cde69d0f1 | ||
|
|
800e378b6e | ||
|
|
dfe8fb50d9 | ||
|
|
0f6cfc0b16 | ||
|
|
019cfb7927 | ||
|
|
7887689fd0 | ||
|
|
888d8301ca | ||
|
|
704c169e04 | ||
|
|
c16e34078a | ||
|
|
bc9e022c86 | ||
|
|
a88b8130b9 | ||
|
|
2139e8442a | ||
|
|
f50a80a7c1 |
@@ -1,841 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Build and test Bun on macOS, Linux, and Windows.
|
||||
* @link https://buildkite.com/docs/pipelines/defining-steps
|
||||
*/
|
||||
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
getBootstrapVersion,
|
||||
getBuildNumber,
|
||||
getCanaryRevision,
|
||||
getChangedFiles,
|
||||
getCommit,
|
||||
getCommitMessage,
|
||||
getEnv,
|
||||
getLastSuccessfulBuild,
|
||||
getMainBranch,
|
||||
getTargetBranch,
|
||||
isBuildkite,
|
||||
isFork,
|
||||
isMainBranch,
|
||||
isMergeQueue,
|
||||
printEnvironment,
|
||||
spawnSafe,
|
||||
toYaml,
|
||||
uploadArtifact,
|
||||
} from "../scripts/utils.mjs";
|
||||
|
||||
/**
|
||||
* @typedef PipelineOptions
|
||||
* @property {string} [buildId]
|
||||
* @property {boolean} [buildImages]
|
||||
* @property {boolean} [publishImages]
|
||||
* @property {boolean} [skipTests]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {PipelineOptions} options
|
||||
*/
|
||||
function getPipeline(options) {
|
||||
const { buildId, buildImages, publishImages, skipTests } = options;
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
* @link https://github.com/buildkite/emojis#emoji-reference
|
||||
*/
|
||||
const getEmoji = string => {
|
||||
if (string === "amazonlinux") {
|
||||
return ":aws:";
|
||||
}
|
||||
return `:${string}:`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {"linux" | "darwin" | "windows"} Os
|
||||
* @typedef {"aarch64" | "x64"} Arch
|
||||
* @typedef {"musl"} Abi
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Target
|
||||
* @property {Os} os
|
||||
* @property {Arch} arch
|
||||
* @property {Abi} [abi]
|
||||
* @property {boolean} [baseline]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getTargetKey = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let key = `${os}-${arch}`;
|
||||
if (abi) {
|
||||
key += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
key += "-baseline";
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getTargetLabel = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let label = `${getEmoji(os)} ${arch}`;
|
||||
if (abi) {
|
||||
label += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
label += "-baseline";
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef Platform
|
||||
* @property {Os} os
|
||||
* @property {Arch} arch
|
||||
* @property {Abi} [abi]
|
||||
* @property {boolean} [baseline]
|
||||
* @property {string} [distro]
|
||||
* @property {string} release
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getPlatformKey = platform => {
|
||||
const { os, arch, abi, baseline, distro, release } = platform;
|
||||
const target = getTargetKey({ os, arch, abi, baseline });
|
||||
if (distro) {
|
||||
return `${target}-${distro}-${release.replace(/\./g, "")}`;
|
||||
}
|
||||
return `${target}-${release.replace(/\./g, "")}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getPlatformLabel = platform => {
|
||||
const { os, arch, baseline, distro, release } = platform;
|
||||
let label = `${getEmoji(distro || os)} ${release} ${arch}`;
|
||||
if (baseline) {
|
||||
label += "-baseline";
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getImageKey = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
if (distro) {
|
||||
return `${os}-${arch}-${distro}-${release.replace(/\./g, "")}`;
|
||||
}
|
||||
return `${os}-${arch}-${release.replace(/\./g, "")}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getImageLabel = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
return `${getEmoji(distro || os)} ${release} ${arch}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} [limit]
|
||||
* @link https://buildkite.com/docs/pipelines/command-step#retry-attributes
|
||||
*/
|
||||
const getRetry = (limit = 0) => {
|
||||
return {
|
||||
automatic: [
|
||||
{ exit_status: 1, limit },
|
||||
{ exit_status: -1, limit: 3 },
|
||||
{ exit_status: 255, limit: 3 },
|
||||
{ signal_reason: "agent_stop", limit: 3 },
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
* @link https://buildkite.com/docs/pipelines/managing-priorities
|
||||
*/
|
||||
const getPriority = () => {
|
||||
if (isFork()) {
|
||||
return -1;
|
||||
}
|
||||
if (isMainBranch()) {
|
||||
return 2;
|
||||
}
|
||||
if (isMergeQueue()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Record<string, string | undefined>}
|
||||
*/
|
||||
const getBuildEnv = target => {
|
||||
const { baseline, abi } = target;
|
||||
return {
|
||||
ENABLE_BASELINE: baseline ? "ON" : "OFF",
|
||||
ABI: abi === "musl" ? "musl" : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getBuildToolchain = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let key = `${os}-${arch}`;
|
||||
if (abi) {
|
||||
key += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
key += "-baseline";
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Agents
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Record<string, string | undefined>} Agent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const isUsingNewAgent = platform => {
|
||||
const { os } = platform;
|
||||
if (os === "linux") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {"v1" | "v2"} version
|
||||
* @param {Platform} platform
|
||||
* @param {string} [instanceType]
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getEmphemeralAgent = (version, platform, instanceType) => {
|
||||
const { os, arch, abi, distro, release } = platform;
|
||||
if (version === "v1") {
|
||||
return {
|
||||
robobun: true,
|
||||
os,
|
||||
arch,
|
||||
distro,
|
||||
release,
|
||||
};
|
||||
}
|
||||
let image;
|
||||
if (distro) {
|
||||
image = `${os}-${arch}-${distro}-${release}`;
|
||||
} else {
|
||||
image = `${os}-${arch}-${release}`;
|
||||
}
|
||||
if (buildImages && !publishImages) {
|
||||
image += `-build-${getBuildNumber()}`;
|
||||
} else {
|
||||
image += `-v${getBootstrapVersion()}`;
|
||||
}
|
||||
return {
|
||||
robobun: true,
|
||||
robobun2: true,
|
||||
os,
|
||||
arch,
|
||||
abi,
|
||||
distro,
|
||||
release,
|
||||
"image-name": image,
|
||||
"instance-type": instanceType,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getBuildAgent = target => {
|
||||
const { os, arch, abi } = target;
|
||||
if (isUsingNewAgent(target)) {
|
||||
const instanceType = arch === "aarch64" ? "c8g.8xlarge" : "c7i.8xlarge";
|
||||
return getEmphemeralAgent("v2", target, instanceType);
|
||||
}
|
||||
return {
|
||||
queue: `build-${os}`,
|
||||
os,
|
||||
arch,
|
||||
abi,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getZigAgent = platform => {
|
||||
const { arch } = platform;
|
||||
const instanceType = arch === "aarch64" ? "c8g.2xlarge" : "c7i.2xlarge";
|
||||
return {
|
||||
robobun: true,
|
||||
robobun2: true,
|
||||
os: "linux",
|
||||
arch,
|
||||
distro: "debian",
|
||||
release: "11",
|
||||
"image-name": `linux-${arch}-debian-11-v5`, // v5 is not on main yet
|
||||
"instance-type": instanceType,
|
||||
};
|
||||
// TODO: Temporarily disable due to configuration
|
||||
// return {
|
||||
// queue: "build-zig",
|
||||
// };
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getTestAgent = platform => {
|
||||
const { os, arch, release } = platform;
|
||||
if (isUsingNewAgent(platform)) {
|
||||
const instanceType = arch === "aarch64" ? "t4g.large" : "t3.large";
|
||||
return getEmphemeralAgent("v2", platform, instanceType);
|
||||
}
|
||||
if (os === "darwin") {
|
||||
return {
|
||||
os,
|
||||
arch,
|
||||
release,
|
||||
queue: "test-darwin",
|
||||
};
|
||||
}
|
||||
return getEmphemeralAgent("v1", platform);
|
||||
};
|
||||
|
||||
/**
|
||||
* Steps
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Step
|
||||
* @property {string} key
|
||||
* @property {string} [label]
|
||||
* @property {Record<string, string | undefined>} [agents]
|
||||
* @property {Record<string, string | undefined>} [env]
|
||||
* @property {string} command
|
||||
* @property {string[]} [depends_on]
|
||||
* @property {Record<string, string | undefined>} [retry]
|
||||
* @property {boolean} [cancel_on_build_failing]
|
||||
* @property {boolean} [soft_fail]
|
||||
* @property {number} [parallelism]
|
||||
* @property {number} [concurrency]
|
||||
* @property {string} [concurrency_group]
|
||||
* @property {number} [priority]
|
||||
* @property {number} [timeout_in_minutes]
|
||||
* @link https://buildkite.com/docs/pipelines/command-step
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @param {string} [step]
|
||||
* @returns {string[]}
|
||||
*/
|
||||
const getDependsOn = (platform, step) => {
|
||||
if (imagePlatforms.has(getImageKey(platform))) {
|
||||
const key = `${getImageKey(platform)}-build-image`;
|
||||
if (key !== step) {
|
||||
return [key];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildImageStep = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
const action = publishImages ? "publish-image" : "create-image";
|
||||
return {
|
||||
key: `${getImageKey(platform)}-build-image`,
|
||||
label: `${getImageLabel(platform)} - build-image`,
|
||||
agents: {
|
||||
queue: "build-image",
|
||||
},
|
||||
env: {
|
||||
DEBUG: "1",
|
||||
},
|
||||
retry: getRetry(),
|
||||
command: `node ./scripts/machine.mjs ${action} --ci --cloud=aws --os=${os} --arch=${arch} --distro=${distro} --distro-version=${release}`,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildVendorStep = platform => {
|
||||
return {
|
||||
key: `${getTargetKey(platform)}-build-vendor`,
|
||||
label: `${getTargetLabel(platform)} - build-vendor`,
|
||||
depends_on: getDependsOn(platform),
|
||||
agents: getBuildAgent(platform),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: getBuildEnv(platform),
|
||||
command: "bun run build:ci --target dependencies",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildCppStep = platform => {
|
||||
return {
|
||||
key: `${getTargetKey(platform)}-build-cpp`,
|
||||
label: `${getTargetLabel(platform)} - build-cpp`,
|
||||
depends_on: getDependsOn(platform),
|
||||
agents: getBuildAgent(platform),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: {
|
||||
BUN_CPP_ONLY: "ON",
|
||||
...getBuildEnv(platform),
|
||||
},
|
||||
command: "bun run build:ci --target bun",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildZigStep = platform => {
|
||||
const toolchain = getBuildToolchain(platform);
|
||||
return {
|
||||
key: `${getTargetKey(platform)}-build-zig`,
|
||||
label: `${getTargetLabel(platform)} - build-zig`,
|
||||
depends_on: getDependsOn(platform),
|
||||
agents: getZigAgent(platform),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: getBuildEnv(platform),
|
||||
command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildBunStep = platform => {
|
||||
return {
|
||||
key: `${getTargetKey(platform)}-build-bun`,
|
||||
label: `${getTargetLabel(platform)} - build-bun`,
|
||||
depends_on: [
|
||||
`${getTargetKey(platform)}-build-vendor`,
|
||||
`${getTargetKey(platform)}-build-cpp`,
|
||||
`${getTargetKey(platform)}-build-zig`,
|
||||
],
|
||||
agents: getBuildAgent(platform),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: {
|
||||
BUN_LINK_ONLY: "ON",
|
||||
...getBuildEnv(platform),
|
||||
},
|
||||
command: "bun run build:ci --target bun",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getTestBunStep = platform => {
|
||||
const { os } = platform;
|
||||
let command;
|
||||
if (os === "windows") {
|
||||
command = `node .\\scripts\\runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
|
||||
} else {
|
||||
command = `./scripts/runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
|
||||
}
|
||||
let parallelism;
|
||||
if (os === "darwin") {
|
||||
parallelism = 2;
|
||||
} else {
|
||||
parallelism = 10;
|
||||
}
|
||||
let env;
|
||||
let depends = [];
|
||||
if (buildId) {
|
||||
env = {
|
||||
BUILDKITE_ARTIFACT_BUILD_ID: buildId,
|
||||
};
|
||||
} else {
|
||||
depends = [`${getTargetKey(platform)}-build-bun`];
|
||||
}
|
||||
let retry;
|
||||
if (os !== "windows") {
|
||||
// When the runner fails on Windows, Buildkite only detects an exit code of 1.
|
||||
// Because of this, we don't know if the run was fatal, or soft-failed.
|
||||
retry = getRetry(1);
|
||||
}
|
||||
let soft_fail;
|
||||
if (isMainBranch()) {
|
||||
soft_fail = true;
|
||||
} else {
|
||||
soft_fail = [{ exit_status: 2 }];
|
||||
}
|
||||
return {
|
||||
key: `${getPlatformKey(platform)}-test-bun`,
|
||||
label: `${getPlatformLabel(platform)} - test-bun`,
|
||||
depends_on: [...depends, ...getDependsOn(platform)],
|
||||
agents: getTestAgent(platform),
|
||||
retry,
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
soft_fail,
|
||||
parallelism,
|
||||
command,
|
||||
env,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Config
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Platform[]}
|
||||
*/
|
||||
const buildPlatforms = [
|
||||
{ os: "darwin", arch: "aarch64", release: "14" },
|
||||
{ os: "darwin", arch: "x64", release: "14" },
|
||||
{ os: "linux", arch: "aarch64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
|
||||
{ os: "windows", arch: "x64", release: "2019" },
|
||||
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
|
||||
];
|
||||
|
||||
/**
|
||||
* @type {Platform[]}
|
||||
*/
|
||||
const testPlatforms = [
|
||||
{ os: "darwin", arch: "aarch64", release: "14" },
|
||||
{ os: "darwin", arch: "aarch64", release: "13" },
|
||||
{ os: "darwin", arch: "x64", release: "14" },
|
||||
{ os: "darwin", arch: "x64", release: "13" },
|
||||
{ os: "linux", arch: "aarch64", distro: "debian", release: "12" },
|
||||
{ os: "linux", arch: "aarch64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", distro: "debian", release: "12" },
|
||||
{ os: "linux", arch: "x64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "12" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "20.04" },
|
||||
{ os: "linux", arch: "x64", distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "x64", distro: "ubuntu", release: "20.04" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "20.04" },
|
||||
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
|
||||
{ os: "windows", arch: "x64", release: "2019" },
|
||||
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
|
||||
];
|
||||
|
||||
const imagePlatforms = new Map(
|
||||
[...buildPlatforms, ...testPlatforms]
|
||||
.filter(platform => buildImages && isUsingNewAgent(platform))
|
||||
.map(platform => [getImageKey(platform), platform]),
|
||||
);
|
||||
|
||||
/**
|
||||
* @type {Step[]}
|
||||
*/
|
||||
const steps = [];
|
||||
|
||||
if (imagePlatforms.size) {
|
||||
steps.push({
|
||||
group: ":docker:",
|
||||
steps: [...imagePlatforms.values()].map(platform => getBuildImageStep(platform)),
|
||||
});
|
||||
}
|
||||
|
||||
for (const platform of buildPlatforms) {
|
||||
const { os, arch, abi, baseline } = platform;
|
||||
|
||||
/** @type {Step[]} */
|
||||
const platformSteps = [];
|
||||
|
||||
if (buildImages || !buildId) {
|
||||
platformSteps.push(
|
||||
getBuildVendorStep(platform),
|
||||
getBuildCppStep(platform),
|
||||
getBuildZigStep(platform),
|
||||
getBuildBunStep(platform),
|
||||
);
|
||||
}
|
||||
|
||||
if (!skipTests) {
|
||||
platformSteps.push(
|
||||
...testPlatforms
|
||||
.filter(
|
||||
testPlatform =>
|
||||
testPlatform.os === os &&
|
||||
testPlatform.arch === arch &&
|
||||
testPlatform.abi === abi &&
|
||||
testPlatform.baseline === baseline,
|
||||
)
|
||||
.map(testPlatform => getTestBunStep(testPlatform)),
|
||||
);
|
||||
}
|
||||
|
||||
if (!platformSteps.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
steps.push({
|
||||
key: getTargetKey(platform),
|
||||
group: getTargetLabel(platform),
|
||||
steps: platformSteps,
|
||||
});
|
||||
}
|
||||
|
||||
if (isMainBranch() && !isFork()) {
|
||||
steps.push({
|
||||
label: ":github:",
|
||||
agents: {
|
||||
queue: "test-darwin",
|
||||
},
|
||||
depends_on: buildPlatforms.map(platform => `${getTargetKey(platform)}-build-bun`),
|
||||
command: ".buildkite/scripts/upload-release.sh",
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
priority: getPriority(),
|
||||
steps,
|
||||
};
|
||||
}
|
||||
|
||||
async function main() {
|
||||
printEnvironment();
|
||||
|
||||
console.log("Checking last successful build...");
|
||||
const lastBuild = await getLastSuccessfulBuild();
|
||||
if (lastBuild) {
|
||||
const { id, path, commit_id: commit } = lastBuild;
|
||||
console.log(" - Build ID:", id);
|
||||
console.log(" - Build URL:", new URL(path, "https://buildkite.com/").toString());
|
||||
console.log(" - Commit:", commit);
|
||||
} else {
|
||||
console.log(" - No build found");
|
||||
}
|
||||
|
||||
let changedFiles;
|
||||
// FIXME: Fix various bugs when calculating changed files
|
||||
// false -> !isFork() && !isMainBranch()
|
||||
if (false) {
|
||||
console.log("Checking changed files...");
|
||||
const baseRef = lastBuild?.commit_id || getTargetBranch() || getMainBranch();
|
||||
console.log(" - Base Ref:", baseRef);
|
||||
const headRef = getCommit();
|
||||
console.log(" - Head Ref:", headRef);
|
||||
|
||||
changedFiles = await getChangedFiles(undefined, baseRef, headRef);
|
||||
if (changedFiles) {
|
||||
if (changedFiles.length) {
|
||||
changedFiles.forEach(filename => console.log(` - ${filename}`));
|
||||
} else {
|
||||
console.log(" - No changed files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const isDocumentationFile = filename => /^(\.vscode|\.github|bench|docs|examples)|\.(md)$/i.test(filename);
|
||||
const isTestFile = filename => /^test/i.test(filename) || /runner\.node\.mjs$/i.test(filename);
|
||||
|
||||
console.log("Checking if CI should be forced...");
|
||||
let forceBuild;
|
||||
let ciFileChanged;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(force ci|ci force|ci force build)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
forceBuild = true;
|
||||
}
|
||||
for (const coref of [".buildkite/ci.mjs", "scripts/utils.mjs", "scripts/bootstrap.sh", "scripts/machine.mjs"]) {
|
||||
if (changedFiles && changedFiles.includes(coref)) {
|
||||
console.log(" - Yes, because the list of changed files contains:", coref);
|
||||
forceBuild = true;
|
||||
ciFileChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should be skipped...");
|
||||
if (!forceBuild) {
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(skip ci|no ci|ci skip|ci no)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
return;
|
||||
}
|
||||
if (changedFiles && changedFiles.every(filename => isDocumentationFile(filename))) {
|
||||
console.log(" - Yes, because all changed files are documentation");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should re-build images...");
|
||||
let buildImages;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(build images?|images? build)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
buildImages = true;
|
||||
}
|
||||
if (ciFileChanged) {
|
||||
console.log(" - Yes, because a core CI file changed");
|
||||
buildImages = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should publish images...");
|
||||
let publishImages;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(publish images?|images? publish)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
publishImages = true;
|
||||
buildImages = true;
|
||||
}
|
||||
if (ciFileChanged && isMainBranch()) {
|
||||
console.log(" - Yes, because a core CI file changed and this is main branch");
|
||||
publishImages = true;
|
||||
buildImages = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if build should be skipped...");
|
||||
let skipBuild;
|
||||
if (!forceBuild) {
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(only tests?|tests? only|skip build|no build|build skip|build no)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
skipBuild = true;
|
||||
}
|
||||
if (changedFiles && changedFiles.every(filename => isTestFile(filename) || isDocumentationFile(filename))) {
|
||||
console.log(" - Yes, because all changed files are tests or documentation");
|
||||
skipBuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if tests should be skipped...");
|
||||
let skipTests;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(skip tests?|tests? skip|no tests?|tests? no)\]/i.exec(message);
|
||||
if (match) {
|
||||
console.log(" - Yes, because commit message contains:", match[1]);
|
||||
skipTests = true;
|
||||
}
|
||||
if (isMainBranch()) {
|
||||
console.log(" - Yes, because we're on main branch");
|
||||
skipTests = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if build is a named release...");
|
||||
let buildRelease;
|
||||
if (/^(1|true|on|yes)$/i.test(getEnv("RELEASE", false))) {
|
||||
console.log(" - Yes, because RELEASE environment variable is set");
|
||||
buildRelease = true;
|
||||
} else {
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(release|release build|build release)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
buildRelease = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Generating pipeline...");
|
||||
const pipeline = getPipeline({
|
||||
buildId: lastBuild && skipBuild && !forceBuild ? lastBuild.id : undefined,
|
||||
buildImages,
|
||||
publishImages,
|
||||
skipTests,
|
||||
});
|
||||
|
||||
const content = toYaml(pipeline);
|
||||
const contentPath = join(process.cwd(), ".buildkite", "ci.yml");
|
||||
writeFileSync(contentPath, content);
|
||||
|
||||
console.log("Generated pipeline:");
|
||||
console.log(" - Path:", contentPath);
|
||||
console.log(" - Size:", (content.length / 1024).toFixed(), "KB");
|
||||
if (isBuildkite) {
|
||||
await uploadArtifact(contentPath);
|
||||
}
|
||||
|
||||
if (isBuildkite) {
|
||||
console.log("Setting canary revision...");
|
||||
const canaryRevision = buildRelease ? 0 : await getCanaryRevision();
|
||||
await spawnSafe(["buildkite-agent", "meta-data", "set", "canary", `${canaryRevision}`], { stdio: "inherit" });
|
||||
|
||||
console.log("Uploading pipeline...");
|
||||
await spawnSafe(["buildkite-agent", "pipeline", "upload", contentPath], { stdio: "inherit" });
|
||||
}
|
||||
}
|
||||
|
||||
await main();
|
||||
766
.buildkite/ci.yml
Normal file
766
.buildkite/ci.yml
Normal file
@@ -0,0 +1,766 @@
|
||||
# Build and test Bun on macOS, Linux, and Windows.
|
||||
# https://buildkite.com/docs/pipelines/defining-steps
|
||||
#
|
||||
# If a step has the `robobun: true` label, robobun will listen
|
||||
# to webhooks from Buildkite and provision a VM to run the step.
|
||||
#
|
||||
# Changes to this file will be automatically uploaded on the next run
|
||||
# for a particular commit.
|
||||
|
||||
steps:
|
||||
# macOS aarch64
|
||||
- key: "darwin-aarch64"
|
||||
group: ":darwin: aarch64"
|
||||
steps:
|
||||
- key: "darwin-aarch64-build-vendor"
|
||||
label: ":darwin: aarch64 - build-vendor"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "darwin-aarch64-build-cpp"
|
||||
label: ":darwin: aarch64 - build-cpp"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-aarch64-build-zig"
|
||||
label: ":darwin: aarch64 - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain darwin-aarch64"
|
||||
|
||||
- key: "darwin-aarch64-build-bun"
|
||||
label: ":darwin: aarch64 - build-bun"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-vendor"
|
||||
- "darwin-aarch64-build-cpp"
|
||||
- "darwin-aarch64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-aarch64-test-macos-14"
|
||||
label: ":darwin: 14 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
release: "14"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
|
||||
|
||||
- key: "darwin-aarch64-test-macos-13"
|
||||
label: ":darwin: 13 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
release: "13"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
|
||||
|
||||
# macOS x64
|
||||
- key: "darwin-x64"
|
||||
group: ":darwin: x64"
|
||||
steps:
|
||||
- key: "darwin-x64-build-vendor"
|
||||
label: ":darwin: x64 - build-vendor"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "darwin-x64-build-cpp"
|
||||
label: ":darwin: x64 - build-cpp"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-x64-build-zig"
|
||||
label: ":darwin: x64 - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain darwin-x64"
|
||||
|
||||
- key: "darwin-x64-build-bun"
|
||||
label: ":darwin: x64 - build-bun"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "darwin-x64-build-vendor"
|
||||
- "darwin-x64-build-cpp"
|
||||
- "darwin-x64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-x64-test-macos-14"
|
||||
label: ":darwin: 14 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-x64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
release: "14"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
|
||||
|
||||
- key: "darwin-x64-test-macos-13"
|
||||
label: ":darwin: 13 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-x64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
release: "13"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
|
||||
|
||||
# Linux x64
|
||||
- key: "linux-x64"
|
||||
group: ":linux: x64"
|
||||
steps:
|
||||
- key: "linux-x64-build-vendor"
|
||||
label: ":linux: x64 - build-vendor"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "linux-x64-build-cpp"
|
||||
label: ":linux: x64 - build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-build-zig"
|
||||
label: ":linux: x64 - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-x64"
|
||||
|
||||
- key: "linux-x64-build-bun"
|
||||
label: ":linux: x64 - build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "linux-x64-build-vendor"
|
||||
- "linux-x64-build-cpp"
|
||||
- "linux-x64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-test-debian-12"
|
||||
label: ":debian: 12 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
- key: "linux-x64-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
- key: "linux-x64-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
# Linux x64-baseline
|
||||
- key: "linux-x64-baseline"
|
||||
group: ":linux: x64-baseline"
|
||||
steps:
|
||||
- key: "linux-x64-baseline-build-vendor"
|
||||
label: ":linux: x64-baseline - build-vendor"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "linux-x64-baseline-build-cpp"
|
||||
label: ":linux: x64-baseline - build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-baseline-build-zig"
|
||||
label: ":linux: x64-baseline - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-x64-baseline"
|
||||
|
||||
- key: "linux-x64-baseline-build-bun"
|
||||
label: ":linux: x64-baseline - build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-vendor"
|
||||
- "linux-x64-baseline-build-cpp"
|
||||
- "linux-x64-baseline-build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-debian-12"
|
||||
label: ":debian: 12 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
# Linux aarch64
|
||||
- key: "linux-aarch64"
|
||||
group: ":linux: aarch64"
|
||||
steps:
|
||||
- key: "linux-aarch64-build-vendor"
|
||||
label: ":linux: aarch64 - build-vendor"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "linux-aarch64-build-cpp"
|
||||
label: ":linux: aarch64 - build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-aarch64-build-zig"
|
||||
label: ":linux: aarch64 - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-aarch64"
|
||||
|
||||
- key: "linux-aarch64-build-bun"
|
||||
label: ":linux: aarch64 - build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
depends_on:
|
||||
- "linux-aarch64-build-vendor"
|
||||
- "linux-aarch64-build-cpp"
|
||||
- "linux-aarch64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-aarch64-test-debian-12"
|
||||
label: ":debian: 12 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
- key: "linux-aarch64-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
- key: "linux-aarch64-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
# Windows x64
|
||||
- key: "windows-x64"
|
||||
group: ":windows: x64"
|
||||
steps:
|
||||
- key: "windows-x64-build-vendor"
|
||||
label: ":windows: x64 - build-vendor"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "windows-x64-build-cpp"
|
||||
label: ":windows: x64 - build-cpp"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-build-zig"
|
||||
label: ":windows: x64 - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain windows-x64"
|
||||
|
||||
- key: "windows-x64-build-bun"
|
||||
label: ":windows: x64 - build-bun"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "windows-x64-build-vendor"
|
||||
- "windows-x64-build-cpp"
|
||||
- "windows-x64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-test-bun"
|
||||
label: ":windows: x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 1
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "windows-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "node .\\scripts\\runner.node.mjs --step windows-x64-build-bun"
|
||||
|
||||
# Windows x64-baseline
|
||||
- key: "windows-x64-baseline"
|
||||
group: ":windows: x64-baseline"
|
||||
steps:
|
||||
- key: "windows-x64-baseline-build-vendor"
|
||||
label: ":windows: x64-baseline - build-vendor"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target vendor"
|
||||
|
||||
- key: "windows-x64-baseline-build-cpp"
|
||||
label: ":windows: x64-baseline - build-cpp"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-baseline-build-zig"
|
||||
label: ":windows: x64-baseline - build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain windows-x64-baseline"
|
||||
|
||||
- key: "windows-x64-baseline-build-bun"
|
||||
label: ":windows: x64-baseline - build-bun"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "windows-x64-baseline-build-vendor"
|
||||
- "windows-x64-baseline-build-cpp"
|
||||
- "windows-x64-baseline-build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-baseline-test-bun"
|
||||
label: ":windows: x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 1
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "windows-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "node .\\scripts\\runner.node.mjs --step windows-x64-baseline-build-bun"
|
||||
@@ -2,10 +2,96 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
function assert_build() {
|
||||
if [ -z "$BUILDKITE_REPO" ]; then
|
||||
echo "error: Cannot find repository for this build"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$BUILDKITE_COMMIT" ]; then
|
||||
echo "error: Cannot find commit for this build"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_buildkite_agent() {
|
||||
if ! command -v buildkite-agent &> /dev/null; then
|
||||
echo "error: Cannot find buildkite-agent, please install it:"
|
||||
echo "https://buildkite.com/docs/agent/v3/install"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_jq() {
|
||||
assert_command "jq" "jq" "https://stedolan.github.io/jq/"
|
||||
}
|
||||
|
||||
function assert_curl() {
|
||||
assert_command "curl" "curl" "https://curl.se/download.html"
|
||||
}
|
||||
|
||||
function assert_command() {
|
||||
local command="$1"
|
||||
local package="$2"
|
||||
local help_url="$3"
|
||||
if ! command -v "$command" &> /dev/null; then
|
||||
echo "warning: $command is not installed, installing..."
|
||||
if command -v brew &> /dev/null; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install "$package"
|
||||
else
|
||||
echo "error: Cannot install $command, please install it"
|
||||
if [ -n "$help_url" ]; then
|
||||
echo ""
|
||||
echo "hint: See $help_url for help"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_release() {
|
||||
if [ "$RELEASE" == "1" ]; then
|
||||
run_command buildkite-agent meta-data set canary "0"
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_canary() {
|
||||
local canary="$(buildkite-agent meta-data get canary 2>/dev/null)"
|
||||
if [ -z "$canary" ]; then
|
||||
local repo=$(echo "$BUILDKITE_REPO" | sed -E 's#https://github.com/([^/]+)/([^/]+).git#\1/\2#g')
|
||||
local tag="$(curl -sL "https://api.github.com/repos/$repo/releases/latest" | jq -r ".tag_name")"
|
||||
if [ "$tag" == "null" ]; then
|
||||
canary="1"
|
||||
else
|
||||
local revision=$(curl -sL "https://api.github.com/repos/$repo/compare/$tag...$BUILDKITE_COMMIT" | jq -r ".ahead_by")
|
||||
if [ "$revision" == "null" ]; then
|
||||
canary="1"
|
||||
else
|
||||
canary="$revision"
|
||||
fi
|
||||
fi
|
||||
run_command buildkite-agent meta-data set canary "$canary"
|
||||
fi
|
||||
}
|
||||
|
||||
function upload_buildkite_pipeline() {
|
||||
local path="$1"
|
||||
if [ ! -f "$path" ]; then
|
||||
echo "error: Cannot find pipeline: $path"
|
||||
exit 1
|
||||
fi
|
||||
run_command buildkite-agent pipeline upload "$path"
|
||||
}
|
||||
|
||||
function run_command() {
|
||||
set -x
|
||||
"$@"
|
||||
{ set +x; } 2>/dev/null
|
||||
}
|
||||
|
||||
run_command node ".buildkite/ci.mjs"
|
||||
assert_build
|
||||
assert_buildkite_agent
|
||||
assert_jq
|
||||
assert_curl
|
||||
assert_release
|
||||
assert_canary
|
||||
upload_buildkite_pipeline ".buildkite/ci.yml"
|
||||
|
||||
@@ -162,27 +162,6 @@ function upload_s3_file() {
|
||||
run_command aws --endpoint-url="$AWS_ENDPOINT" s3 cp "$file" "s3://$AWS_BUCKET/$folder/$file"
|
||||
}
|
||||
|
||||
function send_bench_webhook() {
|
||||
if [ -z "$BENCHMARK_URL" ]; then
|
||||
echo "error: \$BENCHMARK_URL is not set"
|
||||
# exit 1 # TODO: this isn't live yet
|
||||
return
|
||||
fi
|
||||
|
||||
local tag="$1"
|
||||
local commit="$BUILDKITE_COMMIT"
|
||||
local artifact_path="${commit}"
|
||||
|
||||
if [ "$tag" == "canary" ]; then
|
||||
artifact_path="${commit}-canary"
|
||||
fi
|
||||
|
||||
local artifact_url="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/$artifact_path/bun-linux-x64.zip"
|
||||
local webhook_url="$BENCHMARK_URL?tag=$tag&commit=$commit&artifact_url=$artifact_url"
|
||||
|
||||
curl -X POST "$webhook_url"
|
||||
}
|
||||
|
||||
function create_release() {
|
||||
assert_main
|
||||
assert_buildkite_agent
|
||||
@@ -202,12 +181,6 @@ function create_release() {
|
||||
bun-linux-x64-profile.zip
|
||||
bun-linux-x64-baseline.zip
|
||||
bun-linux-x64-baseline-profile.zip
|
||||
bun-linux-aarch64-musl.zip
|
||||
bun-linux-aarch64-musl-profile.zip
|
||||
bun-linux-x64-musl.zip
|
||||
bun-linux-x64-musl-profile.zip
|
||||
bun-linux-x64-musl-baseline.zip
|
||||
bun-linux-x64-musl-baseline-profile.zip
|
||||
bun-windows-x64.zip
|
||||
bun-windows-x64-profile.zip
|
||||
bun-windows-x64-baseline.zip
|
||||
@@ -233,7 +206,6 @@ function create_release() {
|
||||
|
||||
update_github_release "$tag"
|
||||
create_sentry_release "$tag"
|
||||
send_bench_webhook "$tag"
|
||||
}
|
||||
|
||||
function assert_canary() {
|
||||
|
||||
1539
.docker/chrome.json
Normal file
1539
.docker/chrome.json
Normal file
File diff suppressed because it is too large
Load Diff
14
.docker/chromium.pref
Normal file
14
.docker/chromium.pref
Normal file
@@ -0,0 +1,14 @@
|
||||
# Note: 2 blank lines are required between entries
|
||||
Package: *
|
||||
Pin: release a=eoan
|
||||
Pin-Priority: 500
|
||||
|
||||
Package: *
|
||||
Pin: origin "ftp.debian.org"
|
||||
Pin-Priority: 300
|
||||
|
||||
# Pattern includes 'chromium', 'chromium-browser' and similarly
|
||||
# named dependencies:
|
||||
Package: chromium*
|
||||
Pin: origin "ftp.debian.org"
|
||||
Pin-Priority: 700
|
||||
8
.docker/copy-bun-binary.sh
Normal file
8
.docker/copy-bun-binary.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
name=$(openssl rand -hex 12)
|
||||
id=$(docker create --name=bun-binary-$name $CONTAINER_TAG)
|
||||
docker container cp bun-binary-$name:$BUN_RELEASE_DIR bun-binary
|
||||
echo -e "bun-binary-$name"
|
||||
3
.docker/debian.list
Normal file
3
.docker/debian.list
Normal file
@@ -0,0 +1,3 @@
|
||||
deb http://deb.debian.org/debian buster main
|
||||
deb http://deb.debian.org/debian buster-updates main
|
||||
deb http://deb.debian.org/debian-security buster/updates main
|
||||
34
.docker/dockerfile-common.sh
Normal file
34
.docker/dockerfile-common.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
export DOCKER_BUILDKIT=1
|
||||
|
||||
export BUILDKIT_ARCH=$(uname -m)
|
||||
export ARCH=${BUILDKIT_ARCH}
|
||||
|
||||
if [ "$BUILDKIT_ARCH" == "amd64" ]; then
|
||||
export BUILDKIT_ARCH="amd64"
|
||||
export ARCH=x64
|
||||
fi
|
||||
|
||||
if [ "$BUILDKIT_ARCH" == "x86_64" ]; then
|
||||
export BUILDKIT_ARCH="amd64"
|
||||
export ARCH=x64
|
||||
fi
|
||||
|
||||
if [ "$BUILDKIT_ARCH" == "arm64" ]; then
|
||||
export BUILDKIT_ARCH="arm64"
|
||||
export ARCH=aarch64
|
||||
fi
|
||||
|
||||
if [ "$BUILDKIT_ARCH" == "aarch64" ]; then
|
||||
export BUILDKIT_ARCH="arm64"
|
||||
export ARCH=aarch64
|
||||
fi
|
||||
|
||||
if [ "$BUILDKIT_ARCH" == "armv7l" ]; then
|
||||
echo "Unsupported platform: $BUILDKIT_ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export BUILD_ID=$(cat build-id)
|
||||
export CONTAINER_NAME=bun-linux-$ARCH
|
||||
export DEBUG_CONTAINER_NAME=debug-bun-linux-$ARCH
|
||||
export TEMP=/tmp/bun-0.0.$BUILD_ID
|
||||
11
.docker/pull.sh
Normal file
11
.docker/pull.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
docker pull bunbunbunbun/bun-test-base:latest --platform=linux/amd64
|
||||
docker pull bunbunbunbun/bun-base:latest --platform=linux/amd64
|
||||
docker pull bunbunbunbun/bun-base-with-zig-and-webkit:latest --platform=linux/amd64
|
||||
|
||||
docker tag bunbunbunbun/bun-test-base:latest bun-base:latest
|
||||
docker tag bunbunbunbun/bun-base:latest bun-base:latest
|
||||
docker tag bunbunbunbun/bun-base-with-zig-and-webkit:latest bun-base-with-zig-and-webkit:latest
|
||||
47
.docker/run-dockerfile.sh
Normal file
47
.docker/run-dockerfile.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
source "dockerfile-common.sh"
|
||||
|
||||
export $CONTAINER_NAME=$CONTAINER_NAME-local
|
||||
|
||||
rm -rf $TEMP
|
||||
mkdir -p $TEMP
|
||||
|
||||
docker build . --target release --progress=plain -t $CONTAINER_NAME:latest --build-arg BUILDKIT_INLINE_CACHE=1 --platform=linux/$BUILDKIT_ARCH --cache-from $CONTAINER_NAME:latest
|
||||
|
||||
if (($?)); then
|
||||
echo "Failed to build container"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
id=$(docker create $CONTAINER_NAME:latest)
|
||||
docker cp $id:/home/ubuntu/bun-release $TEMP/$CONTAINER_NAME
|
||||
if (($?)); then
|
||||
echo "Failed to cp container"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd $TEMP
|
||||
mkdir -p $TEMP/$CONTAINER_NAME $TEMP/$DEBUG_CONTAINER_NAME
|
||||
mv $CONTAINER_NAME/bun-profile $DEBUG_CONTAINER_NAME/bun
|
||||
zip -r $CONTAINER_NAME.zip $CONTAINER_NAME
|
||||
zip -r $DEBUG_CONTAINER_NAME.zip $DEBUG_CONTAINER_NAME
|
||||
docker rm -v $id
|
||||
abs=$(realpath $TEMP/$CONTAINER_NAME.zip)
|
||||
debug_abs=$(realpath $TEMP/$DEBUG_CONTAINER_NAME.zip)
|
||||
|
||||
case $(uname -s) in
|
||||
"Linux") target="linux" ;;
|
||||
*) target="other" ;;
|
||||
esac
|
||||
|
||||
if [ "$target" = "linux" ]; then
|
||||
if command -v bun --version >/dev/null; then
|
||||
cp $TEMP/$CONTAINER_NAME/bun $(which bun)
|
||||
cp $TEMP/$DEBUG_CONTAINER_NAME/bun $(which bun-profile)
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Saved to:"
|
||||
echo $debug_abs
|
||||
echo $abs
|
||||
9
.docker/run-test.sh
Executable file
9
.docker/run-test.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
bun install
|
||||
bun install --cwd ./test/snippets
|
||||
bun install --cwd ./test/scripts
|
||||
|
||||
make $BUN_TEST_NAME
|
||||
5
.docker/runner.sh
Normal file
5
.docker/runner.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --env BUN_TEST_NAME=$BUN_TEST_NAME --ulimit memlock=-1:-1 --init --rm bun-test:latest
|
||||
5
.docker/unit-tests.sh
Normal file
5
.docker/unit-tests.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --ulimit memlock=-1:-1 --init --rm bun-unit-tests:latest
|
||||
@@ -11,8 +11,5 @@ packages/**/bun-profile
|
||||
src/bun.js/WebKit
|
||||
src/bun.js/WebKit/LayoutTests
|
||||
zig-build
|
||||
.zig-cache
|
||||
zig-out
|
||||
build
|
||||
vendor
|
||||
node_modules
|
||||
zig-cache
|
||||
zig-out
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -49,5 +49,3 @@ vendor/brotli/** linguist-vendored
|
||||
|
||||
test/js/node/test/fixtures linguist-vendored
|
||||
test/js/node/test/common linguist-vendored
|
||||
|
||||
test/js/bun/css/files linguist-vendored
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
name: 🇹 TypeScript Type Bug Report
|
||||
description: Report an issue with TypeScript types
|
||||
labels: [bug, types]
|
||||
labels: [bug, typescript]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
||||
@@ -11,8 +11,8 @@ body:
|
||||
- type: textarea
|
||||
id: package_json
|
||||
attributes:
|
||||
label: "`package.json` file"
|
||||
description: "Can you upload your `package.json` file? This helps us reproduce the crash."
|
||||
label: `package.json` file
|
||||
description: Can you upload your `package.json` file? This helps us reproduce the crash.
|
||||
render: json
|
||||
- type: textarea
|
||||
id: repro
|
||||
|
||||
1
.github/actions/setup-bun/action.yml
vendored
1
.github/actions/setup-bun/action.yml
vendored
@@ -47,5 +47,4 @@ runs:
|
||||
mkdir -p ${{ runner.temp }}/.bun/bin
|
||||
mv ${target}/bun* ${{ runner.temp }}/.bun/bin/
|
||||
chmod +x ${{ runner.temp }}/.bun/bin/*
|
||||
ln -fs ${{ runner.temp }}/.bun/bin/bun ${{ runner.temp }}/.bun/bin/bunx
|
||||
echo "${{ runner.temp }}/.bun/bin" >> ${GITHUB_PATH}
|
||||
|
||||
41
.github/workflows/clang-format.yml
vendored
41
.github/workflows/clang-format.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: clang-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
LLVM_VERSION: "18.1.8"
|
||||
LLVM_VERSION_MAJOR: "18"
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
name: clang-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
|
||||
- name: Clang Format
|
||||
env:
|
||||
LLVM_VERSION: ${{ env.LLVM_VERSION }}
|
||||
run: |
|
||||
bun run clang-format
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run clang-format`"
|
||||
41
.github/workflows/clang-tidy.yml
vendored
41
.github/workflows/clang-tidy.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: clang-tidy
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
LLVM_VERSION: "18.1.8"
|
||||
LLVM_VERSION_MAJOR: "18"
|
||||
|
||||
jobs:
|
||||
clang-tidy:
|
||||
name: clang-tidy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
|
||||
- name: Clang Tidy
|
||||
env:
|
||||
LLVM_VERSION: ${{ env.LLVM_VERSION }}
|
||||
run: |
|
||||
bun run clang-tidy:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run clang-tidy`"
|
||||
61
.github/workflows/format.yml
vendored
Normal file
61
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
name: Format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: format-${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run-id:
|
||||
type: string
|
||||
description: The workflow ID to download artifacts (skips the build step)
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.prettierrc-ci
|
||||
.github
|
||||
.vscode
|
||||
src
|
||||
scripts
|
||||
packages
|
||||
test
|
||||
bench
|
||||
package.json
|
||||
bun.lockb
|
||||
.clang-format
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.1.25"
|
||||
- name: Setup Zig
|
||||
uses: mlugg/setup-zig@v1
|
||||
with:
|
||||
version: 0.13.0
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Format
|
||||
run: |
|
||||
bun fmt
|
||||
- name: Format Zig
|
||||
run: |
|
||||
bun fmt:zig
|
||||
- name: Format Cpp
|
||||
run: |
|
||||
bun fmt:cpp
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: Apply formatting changes
|
||||
58
.github/workflows/labeled.yml
vendored
58
.github/workflows/labeled.yml
vendored
@@ -83,26 +83,6 @@ jobs:
|
||||
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
|
||||
|
||||
rm -rf is-outdated.txt outdated.txt latest.txt
|
||||
- name: Generate comment text with Sentry Link
|
||||
if: github.event.label.name == 'crash'
|
||||
# ignore if fail
|
||||
continue-on-error: true
|
||||
id: generate-comment-text
|
||||
env:
|
||||
GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_EVENTS_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
bun scripts/associate-issue-with-sentry.ts
|
||||
|
||||
if [[ -f "sentry-link.txt" ]]; then
|
||||
echo "sentry-link=$(cat sentry-link.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
if [[ -f "sentry-id.txt" ]]; then
|
||||
echo "sentry-id=$(cat sentry-id.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v3
|
||||
if: github.event.label.name == 'crash'
|
||||
@@ -112,7 +92,7 @@ jobs:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
labels: ${{ steps.add-labels.outputs.labels }}
|
||||
- name: Comment outdated
|
||||
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
|
||||
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
@@ -126,40 +106,6 @@ jobs:
|
||||
```sh
|
||||
bun upgrade
|
||||
```
|
||||
- name: Comment with Sentry Link and outdated version
|
||||
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
@${{ github.event.issue.user.login }}, thank you for reporting this crash. The latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.oudated }}.
|
||||
|
||||
Are you able to reproduce this crash on the latest version of Bun?
|
||||
|
||||
```sh
|
||||
bun upgrade
|
||||
```
|
||||
|
||||
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
|
||||
|
||||
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
|
||||
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
|
||||
- name: Comment with Sentry Link
|
||||
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated != 'true'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Thank you for reporting this crash.
|
||||
|
||||
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
|
||||
|
||||
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
|
||||
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
|
||||
- name: Comment needs repro
|
||||
if: github.event.label.name == 'needs repro'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
@@ -168,4 +114,4 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun), [CodeSandbox](https://codesandbox.io/templates/bun), or provide a bulleted list of commands to run that reproduce this issue. Issues marked with `needs repro` will be closed if they have no activity within 3 days.
|
||||
Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository, [Replit](https://replit.com/@replit/Bun), or [CodeSandbox](https://codesandbox.io/templates/bun). Issues marked with `needs repro` will be closed if they have no activity within 3 days.
|
||||
|
||||
30
.github/workflows/lint-cpp.yml
vendored
Normal file
30
.github/workflows/lint-cpp.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
name: lint-cpp
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.run-id || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run-id:
|
||||
type: string
|
||||
description: The workflow ID to download artifacts (skips the build step)
|
||||
# pull_request:
|
||||
# paths:
|
||||
# - ".github/workflows/lint-cpp.yml"
|
||||
# - "**/*.cpp"
|
||||
# - "vendor/**/*"
|
||||
# - "CMakeLists.txt"
|
||||
|
||||
jobs:
|
||||
lint-cpp:
|
||||
if: ${{ !inputs.run-id }}
|
||||
name: Lint C++
|
||||
uses: ./.github/workflows/run-lint-cpp.yml
|
||||
secrets: inherit
|
||||
with:
|
||||
pr-number: ${{ github.event.number }}
|
||||
37
.github/workflows/prettier-format.yml
vendored
37
.github/workflows/prettier-format.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: prettier-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
jobs:
|
||||
prettier-format:
|
||||
name: prettier-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Setup Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Prettier Format
|
||||
run: |
|
||||
bun run prettier:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run prettier:extra`"
|
||||
56
.github/workflows/run-format.yml
vendored
Normal file
56
.github/workflows/run-format.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
zig-version:
|
||||
type: string
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
sparse-checkout: |
|
||||
.prettierrc-ci
|
||||
.github
|
||||
.vscode
|
||||
src
|
||||
scripts
|
||||
packages
|
||||
test
|
||||
bench
|
||||
package.json
|
||||
bun.lockb
|
||||
.clang-format
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: "1.1.25"
|
||||
- name: Setup Zig
|
||||
uses: mlugg/setup-zig@v1
|
||||
with:
|
||||
version: ${{ inputs.zig-version }}
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Format
|
||||
run: |
|
||||
bun fmt
|
||||
- name: Format Zig
|
||||
run: |
|
||||
bun fmt:zig
|
||||
- name: Format Cpp
|
||||
run: |
|
||||
bun fmt:cpp
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: Apply formatting changes
|
||||
84
.github/workflows/run-lint-cpp.yml
vendored
Normal file
84
.github/workflows/run-lint-cpp.yml
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
name: lint-cpp
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
LLVM_VERSION: 18
|
||||
LC_CTYPE: "en_US.UTF-8"
|
||||
LC_ALL: "en_US.UTF-8"
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
pr-number:
|
||||
required: true
|
||||
type: number
|
||||
|
||||
jobs:
|
||||
lint-cpp:
|
||||
name: Lint C++
|
||||
runs-on: ${{ github.repository_owner == 'oven-sh' && 'macos-13-xlarge' || 'macos-13' }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: 1.1.23
|
||||
- name: Install Dependencies
|
||||
env:
|
||||
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
|
||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
run: |
|
||||
brew install \
|
||||
llvm@${{ env.LLVM_VERSION }} \
|
||||
ninja \
|
||||
coreutils \
|
||||
openssl@1.1 \
|
||||
libiconv \
|
||||
gnu-sed --force --overwrite
|
||||
echo "$(brew --prefix coreutils)/libexec/gnubin" >> $GITHUB_PATH
|
||||
echo "$(brew --prefix llvm@$LLVM_VERSION)/bin" >> $GITHUB_PATH
|
||||
brew link --overwrite llvm@$LLVM_VERSION
|
||||
- name: Bun install
|
||||
run: |
|
||||
bun install
|
||||
- name: clang-tidy
|
||||
id: format
|
||||
env:
|
||||
CPU_TARGET: native
|
||||
BUN_SILENT: 1
|
||||
run: |
|
||||
rm -f did_fail format.log
|
||||
echo "${{ inputs.pr-number }}" > pr-number.txt
|
||||
echo "pr_number=$(cat pr-number.txt)" >> $GITHUB_OUTPUT
|
||||
bun run --silent build:tidy &> >(tee -p format.log) && echo 0 > did_succeed.txt
|
||||
# Upload format.log as github artifact for the workflow
|
||||
if [ -f did_succeed.txt ]; then
|
||||
echo "0" > did_fail.txt
|
||||
else
|
||||
echo "1" > did_fail.txt
|
||||
fi
|
||||
echo "did_fail=$(cat did_fail.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Upload format.log
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: format.log
|
||||
path: format.log
|
||||
- name: Upload PR
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: pr-number.txt
|
||||
path: pr-number.txt
|
||||
- name: Upload PR
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: did_fail.txt
|
||||
path: did_fail.txt
|
||||
- name: Fail if formatting failed
|
||||
if: ${{ steps.format.outputs.did_fail == '1' }}
|
||||
run: exit 1
|
||||
34
.github/workflows/zig-format.yml
vendored
34
.github/workflows/zig-format.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: zig-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
jobs:
|
||||
zig-format:
|
||||
name: zig-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Zig Format
|
||||
run: |
|
||||
bun run zig-format:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run zig-format`"
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -26,7 +26,6 @@
|
||||
*.db
|
||||
*.dmg
|
||||
*.dSYM
|
||||
*.generated.ts
|
||||
*.jsb
|
||||
*.lib
|
||||
*.log
|
||||
@@ -54,8 +53,8 @@
|
||||
/test-report.md
|
||||
/test.js
|
||||
/test.ts
|
||||
/test.zig
|
||||
/testdir
|
||||
/test.zig
|
||||
build
|
||||
build.ninja
|
||||
bun-binary
|
||||
@@ -112,10 +111,8 @@ pnpm-lock.yaml
|
||||
profile.json
|
||||
README.md.template
|
||||
release/
|
||||
scripts/env.local
|
||||
sign.*.json
|
||||
sign.json
|
||||
src/bake/generated.ts
|
||||
src/bun.js/bindings-obj
|
||||
src/bun.js/bindings/GeneratedJS2Native.zig
|
||||
src/bun.js/debug-bindings-obj
|
||||
@@ -134,7 +131,6 @@ src/runtime.version
|
||||
src/tests.zig
|
||||
test.txt
|
||||
test/js/bun/glob/fixtures
|
||||
test/node.js/upstream
|
||||
tsconfig.tsbuildinfo
|
||||
txt.js
|
||||
x64
|
||||
@@ -145,10 +141,9 @@ test/node.js/upstream
|
||||
.zig-cache
|
||||
scripts/env.local
|
||||
*.generated.ts
|
||||
src/bake/generated.ts
|
||||
test/cli/install/registry/packages/publish-pkg-*
|
||||
test/cli/install/registry/packages/@secret/publish-pkg-8
|
||||
test/js/third_party/prisma/prisma/sqlite/dev.db-journal
|
||||
|
||||
# Temporary files
|
||||
/tmp
|
||||
|
||||
# Dependencies
|
||||
/vendor
|
||||
@@ -156,23 +151,18 @@ test/js/third_party/prisma/prisma/sqlite/dev.db-journal
|
||||
# Dependencies (before CMake)
|
||||
# These can be removed in the far future
|
||||
/src/bun.js/WebKit
|
||||
/src/deps/WebKit
|
||||
/src/deps/boringssl
|
||||
/src/deps/brotli
|
||||
/src/deps/c*ares
|
||||
/src/deps/lol*html
|
||||
/src/deps/libarchive
|
||||
/src/deps/libdeflate
|
||||
/src/deps/libuv
|
||||
/src/deps/lol*html
|
||||
/src/deps/ls*hpack
|
||||
/src/deps/mimalloc
|
||||
/src/deps/picohttpparser
|
||||
/src/deps/tinycc
|
||||
/src/deps/WebKit
|
||||
/src/deps/zig
|
||||
/src/deps/zlib
|
||||
/src/deps/zstd
|
||||
|
||||
# Generated files
|
||||
|
||||
.buildkite/ci.yml
|
||||
*.sock
|
||||
/src/deps/zlib
|
||||
/src/deps/zig
|
||||
|
||||
31
.prettierrc-ci
Normal file
31
.prettierrc-ci
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"printWidth": 120,
|
||||
"trailingComma": "all",
|
||||
"useTabs": false,
|
||||
"quoteProps": "preserve",
|
||||
"plugins": [
|
||||
"prettier-plugin-organize-imports"
|
||||
],
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
".vscode/*.json"
|
||||
],
|
||||
"options": {
|
||||
"parser": "jsonc",
|
||||
"quoteProps": "preserve",
|
||||
"singleQuote": false,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.md"
|
||||
],
|
||||
"options": {
|
||||
"printWidth": 80
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
133
.vscode/launch.json
generated
vendored
133
.vscode/launch.json
generated
vendored
@@ -14,7 +14,7 @@
|
||||
"name": "bun test [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -22,8 +22,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -31,7 +29,7 @@
|
||||
"name": "bun test [file] --only",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--only", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -39,8 +37,6 @@
|
||||
"BUN_DEBUG_jest": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -54,7 +50,7 @@
|
||||
"name": "bun test [file] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -62,8 +58,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -71,7 +65,7 @@
|
||||
"name": "bun test [file] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "0",
|
||||
@@ -79,8 +73,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -88,7 +80,7 @@
|
||||
"name": "bun test [file] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--watch", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -96,8 +88,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -105,7 +95,7 @@
|
||||
"name": "bun test [file] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--hot", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -113,8 +103,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -122,7 +110,7 @@
|
||||
"name": "bun test [file] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -131,8 +119,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -145,7 +131,7 @@
|
||||
"name": "bun test [file] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -154,8 +140,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -176,8 +160,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -190,14 +172,8 @@
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
"BUN_DEBUG_IncrementalGraph": "1",
|
||||
"BUN_DEBUG_Bake": "1",
|
||||
"BUN_DEBUG_reload_file_list": "1",
|
||||
"GOMAXPROCS": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -212,8 +188,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -224,15 +198,10 @@
|
||||
"cwd": "${fileDirname}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
// "BUN_DEBUG_DEBUGGER": "1",
|
||||
// "BUN_DEBUG_INTERNAL_DEBUGGER": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
// "BUN_INSPECT": "ws+unix:///var/folders/jk/8fzl9l5119598vsqrmphsw7m0000gn/T/tl15npi7qtf.sock?report=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -247,8 +216,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -264,8 +231,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -286,8 +251,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -301,7 +264,7 @@
|
||||
"name": "bun test [...]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -309,8 +272,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -318,7 +279,7 @@
|
||||
"name": "bun test [...] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -326,8 +287,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -335,7 +294,7 @@
|
||||
"name": "bun test [...] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -343,8 +302,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -352,7 +309,7 @@
|
||||
"name": "bun test [...] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--watch", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -360,8 +317,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -369,7 +324,7 @@
|
||||
"name": "bun test [...] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--hot", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -377,8 +332,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -386,7 +339,7 @@
|
||||
"name": "bun test [...] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -395,8 +348,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -409,7 +360,7 @@
|
||||
"name": "bun test [...] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -418,8 +369,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -440,8 +389,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
// bun test [*]
|
||||
{
|
||||
@@ -450,15 +397,13 @@
|
||||
"name": "bun test [*]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -466,15 +411,13 @@
|
||||
"name": "bun test [*] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -482,7 +425,7 @@
|
||||
"name": "bun test [*] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -490,8 +433,6 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -511,8 +452,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -527,8 +466,6 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
// Windows: bun test [file]
|
||||
{
|
||||
@@ -540,7 +477,7 @@
|
||||
"name": "Windows: bun test [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -569,7 +506,7 @@
|
||||
"name": "Windows: bun test --only [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--only", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -598,7 +535,7 @@
|
||||
"name": "Windows: bun test [file] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -627,7 +564,7 @@
|
||||
"name": "Windows: bun test [file] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -656,7 +593,7 @@
|
||||
"name": "Windows: bun test [file] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -694,7 +631,7 @@
|
||||
"name": "Windows: bun test [file] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -881,7 +818,7 @@
|
||||
"name": "Windows: bun test [...]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -910,7 +847,7 @@
|
||||
"name": "Windows: bun test [...] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -939,7 +876,7 @@
|
||||
"name": "Windows: bun test [...] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -968,7 +905,7 @@
|
||||
"name": "Windows: bun test [...] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--watch", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -997,7 +934,7 @@
|
||||
"name": "Windows: bun test [...] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--hot", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1026,7 +963,7 @@
|
||||
"name": "Windows: bun test [...] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1064,7 +1001,7 @@
|
||||
"name": "Windows: bun test [...] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1129,7 +1066,7 @@
|
||||
"name": "Windows: bun test [*]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1154,7 +1091,7 @@
|
||||
"name": "Windows: bun test [*] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1183,7 +1120,7 @@
|
||||
"name": "Windows: bun test [*] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1241,8 +1178,6 @@
|
||||
},
|
||||
],
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
|
||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -52,15 +52,12 @@
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.errorSquiggles": "enabled",
|
||||
"[cpp]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
"[c]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
"[h]": {
|
||||
"editor.tabSize": 4,
|
||||
"editor.defaultFormatter": "xaver.clang-format",
|
||||
},
|
||||
"clangd.arguments": ["-header-insertion=never"],
|
||||
@@ -78,7 +75,7 @@
|
||||
"prettier.prettierPath": "./node_modules/prettier",
|
||||
|
||||
// TypeScript
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.tsdk": "${workspaceFolder}/node_modules/typescript/lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
},
|
||||
|
||||
59
.vscode/tasks.json
vendored
59
.vscode/tasks.json
vendored
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Build Bun",
|
||||
"type": "shell",
|
||||
"command": "bun run build",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true,
|
||||
},
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "zig",
|
||||
"fileLocation": ["relative", "${workspaceFolder}"],
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^(.+?):(\\d+):(\\d+): (error|warning|note): (.+)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5,
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s+(.+)$",
|
||||
"message": 1,
|
||||
"loop": true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"owner": "clang",
|
||||
"fileLocation": ["relative", "${workspaceFolder}"],
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^([^:]+):(\\d+):(\\d+):\\s+(warning|error|note|remark):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5,
|
||||
},
|
||||
{
|
||||
"regexp": "^\\s*(.*)$",
|
||||
"message": 1,
|
||||
"loop": true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
"presentation": {
|
||||
"reveal": "always",
|
||||
"panel": "shared",
|
||||
"clear": true,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -30,7 +30,6 @@ include(CompilerFlags)
|
||||
|
||||
# --- Tools ---
|
||||
|
||||
include(SetupGit)
|
||||
include(SetupBuildkite)
|
||||
include(SetupBun)
|
||||
include(SetupEsbuild)
|
||||
@@ -39,13 +38,25 @@ include(SetupRust)
|
||||
|
||||
# --- Targets ---
|
||||
|
||||
include(BuildBoringSSL)
|
||||
include(BuildBrotli)
|
||||
include(BuildCares)
|
||||
include(BuildLibDeflate)
|
||||
include(BuildLibuv)
|
||||
include(BuildLolHtml)
|
||||
include(BuildLshpack)
|
||||
include(BuildMimalloc)
|
||||
include(BuildPicoHTTPParser)
|
||||
include(BuildTinyCC)
|
||||
include(BuildSQLite)
|
||||
include(BuildWebKit)
|
||||
include(BuildZlib)
|
||||
include(BuildLibArchive) # must be loaded after zlib
|
||||
include(BuildZstd)
|
||||
include(BuildBun)
|
||||
|
||||
# --- Analysis ---
|
||||
|
||||
if(ENABLE_ANALYSIS)
|
||||
include(RunClangFormat)
|
||||
include(RunClangTidy)
|
||||
include(RunZigFormat)
|
||||
include(RunPrettier)
|
||||
endif()
|
||||
include(RunClangFormat)
|
||||
include(RunClangTidy)
|
||||
include(RunZigFormat)
|
||||
|
||||
@@ -11,7 +11,7 @@ Bun currently requires `glibc >=2.32` in development which means if you're on Ub
|
||||
|
||||
Using your system's package manager, install Bun's dependencies:
|
||||
|
||||
{% codetabs group="os" %}
|
||||
{% codetabs %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
|
||||
@@ -30,7 +30,7 @@ $ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config
|
||||
```
|
||||
|
||||
```bash#openSUSE Tumbleweed
|
||||
$ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable
|
||||
$ sudo zypper install go cmake ninja automake git rustup && rustup toolchain install stable
|
||||
```
|
||||
|
||||
{% /codetabs %}
|
||||
@@ -60,7 +60,7 @@ $ brew install bun
|
||||
|
||||
Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
|
||||
|
||||
{% codetabs group="os" %}
|
||||
{% codetabs %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
$ brew install llvm@18
|
||||
@@ -77,8 +77,8 @@ $ sudo pacman -S llvm clang lld
|
||||
|
||||
```bash#Fedora
|
||||
$ sudo dnf install 'dnf-command(copr)'
|
||||
$ sudo dnf copr enable -y @fedora-llvm-team/llvm17
|
||||
$ sudo dnf install llvm16 clang16 lld16-devel
|
||||
$ sudo dnf copr enable -y @fedora-llvm-team/llvm-snapshots
|
||||
$ sudo dnf install llvm clang lld
|
||||
```
|
||||
|
||||
```bash#openSUSE Tumbleweed
|
||||
@@ -97,7 +97,7 @@ $ which clang-16
|
||||
|
||||
If not, run this to manually add it:
|
||||
|
||||
{% codetabs group="os" %}
|
||||
{% codetabs %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
# use fish_add_path if you're using fish
|
||||
@@ -116,26 +116,42 @@ $ export PATH="$PATH:/usr/lib/llvm16/bin"
|
||||
|
||||
## Building Bun
|
||||
|
||||
After cloning the repository, run the following command to build. This may take a while as it will clone submodules and build dependencies.
|
||||
After cloning the repository, run the following command to run the first build. This may take a while as it will clone submodules and build dependencies.
|
||||
|
||||
```bash
|
||||
$ bun setup
|
||||
```
|
||||
|
||||
The binary will be located at `./build/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun.
|
||||
|
||||
```bash
|
||||
$ build/bun-debug --version
|
||||
x.y.z_debug
|
||||
```
|
||||
|
||||
To rebuild, you can invoke `bun run build`
|
||||
|
||||
```bash
|
||||
$ bun run build
|
||||
```
|
||||
|
||||
The binary will be located at `./build/debug/bun-debug`. It is recommended to add this to your `$PATH`. To verify the build worked, let's print the version number on the development build of Bun.
|
||||
These two scripts, `setup` and `build`, are aliases to do roughly the following:
|
||||
|
||||
```bash
|
||||
$ build/debug/bun-debug --version
|
||||
x.y.z_debug
|
||||
$ ./scripts/setup.sh
|
||||
$ cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug
|
||||
$ ninja -C build # 'bun run build' runs just this
|
||||
```
|
||||
|
||||
Advanced users can pass CMake flags to customize the build.
|
||||
|
||||
## VSCode
|
||||
|
||||
VSCode is the recommended IDE for working on Bun, as it has been configured. Once opening, you can run `Extensions: Show Recommended Extensions` to install the recommended extensions for Zig and C++. ZLS is automatically configured.
|
||||
|
||||
If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./vendor/zig/zig.exe`. The filename is `zig.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension).
|
||||
If you use a different editor, make sure that you tell ZLS to use the automatically installed Zig compiler, which is located at `./.cache/zig/zig.exe`. The filename is `zig.exe` so that it works as expected on Windows, but it still works on macOS/Linux (it just has a surprising file extension).
|
||||
|
||||
We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-debug` in your terminal:
|
||||
We recommend adding `./build` to your `$PATH` so that you can run `bun-debug` in your terminal:
|
||||
|
||||
```sh
|
||||
$ bun-debug
|
||||
@@ -164,7 +180,7 @@ To compile a release build of Bun, run:
|
||||
$ bun run build:release
|
||||
```
|
||||
|
||||
The binary will be located at `./build/release/bun` and `./build/release/bun-profile`.
|
||||
The binary will be located at `./build-release/bun` and `./build-release/bun-profile`.
|
||||
|
||||
### Download release build from pull requests
|
||||
|
||||
@@ -173,8 +189,8 @@ To save you time spent building a release build locally, we provide a way to run
|
||||
To run a release build from a pull request, you can use the `bun-pr` npm package:
|
||||
|
||||
```sh
|
||||
bunx bun-pr <pr-number>
|
||||
bunx bun-pr <branch-name>
|
||||
bunx bun-pr pr-number
|
||||
bunx bun-pr branch/branch-name
|
||||
bunx bun-pr "https://github.com/oven-sh/bun/pull/1234566"
|
||||
```
|
||||
|
||||
@@ -206,18 +222,24 @@ $ valgrind --fair-sched=try --track-origins=yes bun-debug <args>
|
||||
|
||||
## Building WebKit locally + Debug mode of JSC
|
||||
|
||||
{% callout %}
|
||||
|
||||
**TODO**: This is out of date. TLDR is pass `-DUSE_DEBUG_JSC=1` or `-DWEBKIT_DIR=...` to CMake. it will probably need more fiddling. ask @paperdave if you need this.
|
||||
|
||||
{% /callout %}
|
||||
|
||||
WebKit is not cloned by default (to save time and disk space). To clone and build WebKit locally, run:
|
||||
|
||||
```bash
|
||||
# Clone WebKit into ./vendor/WebKit
|
||||
$ git clone https://github.com/oven-sh/WebKit vendor/WebKit
|
||||
|
||||
# Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
|
||||
# Optionally, you can use `make jsc` for a release build
|
||||
$ make jsc-debug
|
||||
|
||||
# Build bun with the local JSC build
|
||||
$ bun run build:local
|
||||
# once you run this, `make submodule` can be used to automatically
|
||||
# update WebKit and the other submodules
|
||||
$ git submodule update --init --depth 1 --checkout src/bun.js/WebKit
|
||||
# to make a jsc release build
|
||||
$ make jsc
|
||||
# JSC debug build does not work perfectly with Bun yet, this is actively being
|
||||
# worked on and will eventually become the default.
|
||||
$ make jsc-build-linux-compile-debug cpp
|
||||
$ make jsc-build-mac-compile-debug cpp
|
||||
```
|
||||
|
||||
Note that the WebKit folder, including build artifacts, is 8GB+ in size.
|
||||
@@ -285,17 +307,17 @@ If you see this error when compiling, run:
|
||||
$ xcode-select --install
|
||||
```
|
||||
|
||||
### Cannot find `libatomic.a`
|
||||
## Cannot find `libatomic.a`
|
||||
|
||||
Bun defaults to linking `libatomic` statically, as not all systems have it. If you are building on a distro that does not have a static libatomic available, you can run the following command to enable dynamic linking:
|
||||
|
||||
```bash
|
||||
$ bun run build -DUSE_STATIC_LIBATOMIC=OFF
|
||||
$ bun setup -DUSE_STATIC_LIBATOMIC=OFF
|
||||
```
|
||||
|
||||
The built version of Bun may not work on other systems if compiled this way.
|
||||
|
||||
### ccache conflicts with building TinyCC on macOS
|
||||
## ccache conflicts with building TinyCC on macOS
|
||||
|
||||
If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
|
||||
|
||||
@@ -303,9 +325,3 @@ If you run into issues with `ccache` when building TinyCC, try reinstalling ccac
|
||||
brew uninstall ccache
|
||||
brew install ccache
|
||||
```
|
||||
|
||||
## Using bun-debug
|
||||
|
||||
- Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
|
||||
- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
|
||||
- Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts`
|
||||
|
||||
27
Makefile
27
Makefile
@@ -77,7 +77,7 @@ BUN_RELEASE_BIN = $(PACKAGE_DIR)/bun
|
||||
PRETTIER ?= $(shell which prettier 2>/dev/null || echo "./node_modules/.bin/prettier")
|
||||
ESBUILD = "$(shell which esbuild 2>/dev/null || echo "./node_modules/.bin/esbuild")"
|
||||
DSYMUTIL ?= $(shell which dsymutil 2>/dev/null || which dsymutil-15 2>/dev/null)
|
||||
WEBKIT_DIR ?= $(realpath vendor/WebKit)
|
||||
WEBKIT_DIR ?= $(realpath src/bun.js/WebKit)
|
||||
WEBKIT_RELEASE_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Release
|
||||
WEBKIT_DEBUG_DIR ?= $(WEBKIT_DIR)/WebKitBuild/Debug
|
||||
WEBKIT_RELEASE_DIR_LTO ?= $(WEBKIT_DIR)/WebKitBuild/ReleaseLTO
|
||||
@@ -138,8 +138,8 @@ endif
|
||||
SED = $(shell which gsed 2>/dev/null || which sed 2>/dev/null)
|
||||
|
||||
BUN_DIR ?= $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||
BUN_DEPS_DIR ?= $(shell pwd)/vendor
|
||||
BUN_DEPS_OUT_DIR ?= $(shell pwd)/build/release
|
||||
BUN_DEPS_DIR ?= $(shell pwd)/src/deps
|
||||
BUN_DEPS_OUT_DIR ?= $(shell pwd)/build/bun-deps
|
||||
CPU_COUNT = 2
|
||||
ifeq ($(OS_NAME),darwin)
|
||||
CPU_COUNT = $(shell sysctl -n hw.logicalcpu)
|
||||
@@ -689,10 +689,19 @@ assert-deps:
|
||||
@test $(shell cargo --version | awk '{print $$2}' | cut -d. -f2) -gt 57 || (echo -e "ERROR: cargo version must be at least 1.57."; exit 1)
|
||||
@echo "You have the dependencies installed! Woo"
|
||||
|
||||
# the following allows you to run `make submodule` to update or init submodules. but we will exclude webkit
|
||||
# unless you explicitly clone it yourself (a huge download)
|
||||
SUBMODULE_NAMES=$(shell cat .gitmodules | grep 'path = ' | awk '{print $$3}')
|
||||
ifeq ("$(wildcard src/bun.js/WebKit/.git)", "")
|
||||
SUBMODULE_NAMES := $(filter-out src/bun.js/WebKit, $(SUBMODULE_NAMES))
|
||||
endif
|
||||
|
||||
.PHONY: init-submodules
|
||||
init-submodules: submodule # (backwards-compatibility alias)
|
||||
|
||||
.PHONY: submodule
|
||||
submodule: ## to init or update all submodules
|
||||
git submodule update --init --recursive --progress --depth=1 --checkout $(SUBMODULE_NAMES)
|
||||
|
||||
.PHONY: build-obj
|
||||
build-obj:
|
||||
@@ -795,7 +804,7 @@ cls:
|
||||
@echo -e "\n\n---\n\n"
|
||||
|
||||
jsc-check:
|
||||
@ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo -e "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/vendor/WebKit -f $(shell pwd)/vendor/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1)
|
||||
@ls $(JSC_BASE_DIR) >/dev/null 2>&1 || (echo -e "Failed to access WebKit build. Please compile the WebKit submodule using the Dockerfile at $(shell pwd)/src/javascript/WebKit/Dockerfile and then copy from /output in the Docker container to $(JSC_BASE_DIR). You can override the directory via JSC_BASE_DIR. \n\n DOCKER_BUILDKIT=1 docker build -t bun-webkit $(shell pwd)/src/bun.js/WebKit -f $(shell pwd)/src/bun.js/WebKit/Dockerfile --progress=plain\n\n docker container create bun-webkit\n\n # Get the container ID\n docker container ls\n\n docker cp DOCKER_CONTAINER_ID_YOU_JUST_FOUND:/output $(JSC_BASE_DIR)" && exit 1)
|
||||
@ls $(JSC_INCLUDE_DIR) >/dev/null 2>&1 || (echo "Failed to access WebKit include directory at $(JSC_INCLUDE_DIR)." && exit 1)
|
||||
@ls $(JSC_LIB) >/dev/null 2>&1 || (echo "Failed to access WebKit lib directory at $(JSC_LIB)." && exit 1)
|
||||
|
||||
@@ -936,7 +945,7 @@ jsc-bindings: headers bindings
|
||||
|
||||
.PHONY: clone-submodules
|
||||
clone-submodules:
|
||||
git -c submodule."vendor/WebKit".update=none submodule update --init --recursive --depth=1 --progress
|
||||
git -c submodule."src/bun.js/WebKit".update=none submodule update --init --recursive --depth=1 --progress
|
||||
|
||||
|
||||
.PHONY: headers
|
||||
@@ -1256,7 +1265,7 @@ jsc-build-mac-compile:
|
||||
-DENABLE_STATIC_JSC=ON \
|
||||
-DENABLE_SINGLE_THREADED_VM_ENTRY_SCOPE=ON \
|
||||
-DALLOW_LINE_AND_COLUMN_NUMBER_IN_BUILTINS=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DUSE_THIN_ARCHIVES=OFF \
|
||||
-DBUN_FAST_TLS=ON \
|
||||
-DENABLE_FTL_JIT=ON \
|
||||
@@ -1268,7 +1277,7 @@ jsc-build-mac-compile:
|
||||
$(WEBKIT_DIR) \
|
||||
$(WEBKIT_RELEASE_DIR) && \
|
||||
CFLAGS="$(CFLAGS) -ffat-lto-objects" CXXFLAGS="$(CXXFLAGS) -ffat-lto-objects" \
|
||||
cmake --build $(WEBKIT_RELEASE_DIR) --config RelWithDebInfo --target jsc
|
||||
cmake --build $(WEBKIT_RELEASE_DIR) --config Release --target jsc
|
||||
|
||||
.PHONY: jsc-build-mac-compile-lto
|
||||
jsc-build-mac-compile-lto:
|
||||
@@ -1370,7 +1379,7 @@ jsc-build-linux-compile-config-debug:
|
||||
$(WEBKIT_DEBUG_DIR)
|
||||
|
||||
# If you get "Error: could not load cache"
|
||||
# run rm -rf vendor/WebKit/CMakeCache.txt
|
||||
# run rm -rf src/bun.js/WebKit/CMakeCache.txt
|
||||
.PHONY: jsc-build-linux-compile-build
|
||||
jsc-build-linux-compile-build:
|
||||
mkdir -p $(WEBKIT_RELEASE_DIR) && \
|
||||
@@ -1405,7 +1414,7 @@ jsc-build-copy-debug:
|
||||
cp $(WEBKIT_DEBUG_DIR)/lib/libbmalloc.a $(BUN_DEPS_OUT_DIR)/libbmalloc.a
|
||||
|
||||
clean-jsc:
|
||||
cd vendor/WebKit && rm -rf **/CMakeCache.txt **/CMakeFiles && rm -rf vendor/WebKit/WebKitBuild
|
||||
cd src/bun.js/WebKit && rm -rf **/CMakeCache.txt **/CMakeFiles && rm -rf src/bun.js/WebKit/WebKitBuild
|
||||
clean-bindings:
|
||||
rm -rf $(OBJ_DIR)/*.o $(DEBUG_OBJ_DIR)/*.o $(DEBUG_OBJ_DIR)/webcore/*.o $(DEBUG_BINDINGS_OBJ) $(OBJ_DIR)/webcore/*.o $(BINDINGS_OBJ) $(OBJ_DIR)/*.d $(DEBUG_OBJ_DIR)/*.d
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<a href="https://bun.sh"><img src="https://github.com/user-attachments/assets/50282090-adfd-4ddb-9e27-c30753c6b161" alt="Logo" height=170></a>
|
||||
<a href="https://bun.sh"><img src="https://user-images.githubusercontent.com/709451/182802334-d9c42afe-f35d-4a7b-86ea-9985f73f20c3.png" alt="Logo" height=170></a>
|
||||
</p>
|
||||
<h1 align="center">Bun</h1>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
bench/bun.lockb
BIN
bench/bun.lockb
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { copyFileSync, statSync, writeFileSync } from "node:fs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
function runner(ready) {
|
||||
for (let size of [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
const crypto = require("node:crypto");
|
||||
|
||||
const keyPair = crypto.generateKeyPairSync("rsa", {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
const crypto = require("node:crypto");
|
||||
|
||||
const keyPair = crypto.generateKeyPairSync("rsa", {
|
||||
modulusLength: 2048,
|
||||
publicKeyEncoding: {
|
||||
type: "spki",
|
||||
format: "pem",
|
||||
},
|
||||
privateKeyEncoding: {
|
||||
type: "pkcs8",
|
||||
format: "pem",
|
||||
},
|
||||
});
|
||||
|
||||
// Max message size for 2048-bit RSA keys
|
||||
const plaintext = crypto.getRandomValues(Buffer.alloc(245));
|
||||
|
||||
bench("RSA sign RSA_PKCS1_PADDING round-trip", () => {
|
||||
const sig = crypto.privateEncrypt(keyPair.privateKey, plaintext);
|
||||
crypto.publicDecrypt(keyPair.publicKey, sig);
|
||||
});
|
||||
|
||||
await run();
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const MAP_SIZE = 10_000;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const SET_SIZE = 10_000;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { group } from "mitata";
|
||||
import EventEmitterNative from "node:events";
|
||||
import { group } from "../runner.mjs";
|
||||
|
||||
export const implementations = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
var id = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
var id = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
// Pseudo RNG is derived from https://stackoverflow.com/a/424445
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const count = 100;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const count = 100;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CString, dlopen, ptr } from "bun:ffi";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "mitata";
|
||||
|
||||
const { napiNoop, napiHash, napiString } = require(import.meta.dir + "/src/ffi_napi_bench.node");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
const extension = "darwin" !== Deno.build.os ? "so" : "dylib";
|
||||
const path = new URL("src/target/release/libffi_napi_bench." + extension, import.meta.url).pathname;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { bench, group, run } from "mitata";
|
||||
import { createRequire } from "node:module";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { napiNoop, napiHash, napiString } = require("./src/ffi_napi_bench.node");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "bench",
|
||||
"scripts": {
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"deps": "cd src && bun run deps",
|
||||
"build": "cd src && bun run build",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import braces from "braces";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "mitata";
|
||||
|
||||
// const iterations = 1000;
|
||||
const iterations = 100;
|
||||
@@ -10,16 +10,15 @@ const veryComplexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}}{1,2,{3,4},5}";
|
||||
|
||||
console.log(braces(complexPattern, { expand: true }));
|
||||
function benchPattern(pattern, name) {
|
||||
const _name = `${name} pattern: "${pattern}"`;
|
||||
group({ name: _name, summary: true }, () => {
|
||||
group({ name: `${name} pattern: "${pattern}"`, summary: true }, () => {
|
||||
if (typeof Bun !== "undefined")
|
||||
bench(`Bun (${_name})`, () => {
|
||||
bench("Bun", () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
Bun.$.braces(pattern);
|
||||
}
|
||||
});
|
||||
|
||||
bench(`micromatch/braces ${_name}`, () => {
|
||||
bench("micromatch/braces", () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
braces(pattern, { expand: true });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import micromatch from "micromatch";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
const Glob = typeof Bun !== "undefined" ? Bun.Glob : undefined;
|
||||
const doMatch = typeof Bun === "undefined" ? micromatch.isMatch : (a, b) => new Glob(b).match(a);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fg from "fast-glob";
|
||||
import { fdir } from "fdir";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "mitata";
|
||||
|
||||
const normalPattern = "*.ts";
|
||||
const recursivePattern = "**/*.ts";
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package benchmark;
|
||||
|
||||
service BenchmarkService {
|
||||
rpc Ping(Request) returns (Response);
|
||||
}
|
||||
|
||||
message Request {
|
||||
string message = 1;
|
||||
}
|
||||
|
||||
message Response {
|
||||
string message = 1;
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
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
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,31 +0,0 @@
|
||||
const grpc = require("@grpc/grpc-js");
|
||||
const protoLoader = require("@grpc/proto-loader");
|
||||
const packageDefinition = protoLoader.loadSync("benchmark.proto", {});
|
||||
const proto = grpc.loadPackageDefinition(packageDefinition).benchmark;
|
||||
const fs = require("fs");
|
||||
|
||||
function ping(call, callback) {
|
||||
callback(null, { message: "Hello, World" });
|
||||
}
|
||||
|
||||
function main() {
|
||||
const server = new grpc.Server();
|
||||
server.addService(proto.BenchmarkService.service, { ping: ping });
|
||||
const tls = !!process.env.TLS && (process.env.TLS === "1" || process.env.TLS === "true");
|
||||
const port = process.env.PORT || 50051;
|
||||
const host = process.env.HOST || "localhost";
|
||||
let credentials;
|
||||
if (tls) {
|
||||
const ca = fs.readFileSync("./cert.pem");
|
||||
const key = fs.readFileSync("./key.pem");
|
||||
const cert = fs.readFileSync("./cert.pem");
|
||||
credentials = grpc.ServerCredentials.createSsl(ca, [{ private_key: key, cert_chain: cert }]);
|
||||
} else {
|
||||
credentials = grpc.ServerCredentials.createInsecure();
|
||||
}
|
||||
server.bindAsync(`${host}:${port}`, credentials, () => {
|
||||
console.log(`Server running at ${tls ? "https" : "http"}://${host}:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
@@ -1,52 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
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
|
||||
z/cCLOrUJfealezimyd8SKPWPeHhrA==
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "bench",
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bun:server": "TLS=1 PORT=50051 bun ./index.js",
|
||||
"node:server": "TLS=1 PORT=50051 node ./index.js",
|
||||
"bench": "ghz --cacert ./cert.pem --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051",
|
||||
"bench:insecure": "ghz --insecure --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "1.12.0",
|
||||
"@grpc/proto-loader": "0.7.10"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { gunzipSync, gzipSync } from "bun";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "mitata";
|
||||
|
||||
const data = await Bun.file(require.resolve("@babel/standalone/babel.min.js")).arrayBuffer();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
const data = new TextEncoder().encode("Hello World!".repeat(9999));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from "fs";
|
||||
import { bench, run } from "mitata";
|
||||
import { createRequire } from "module";
|
||||
import { gunzipSync, gzipSync } from "zlib";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const data = readFileSync(require.resolve("@babel/standalone/babel.min.js"));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("JSON.stringify({hello: 'world'})", () => JSON.stringify({ hello: "world" }));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("console.log('hello')", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
bench("console.log", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("console.log", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "bun bun.js | grep iter",
|
||||
"bench:node": "node node.mjs | grep iter",
|
||||
"bench:deno": "deno run -A --unstable deno.mjs | grep iter",
|
||||
"bench:bun": "$BUN bun.js | grep iter",
|
||||
"bench:node": "$NODE node.mjs | grep iter",
|
||||
"bench:deno": "$DENO run -A --unstable deno.mjs | grep iter",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
import {
|
||||
arch,
|
||||
cpus,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import {
|
||||
arch,
|
||||
cpus,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
userInfo,
|
||||
version,
|
||||
} from "node:os";
|
||||
import { bench, run } from "../../runner.mjs";
|
||||
|
||||
bench("cpus()", () => cpus());
|
||||
bench("networkInterfaces()", () => networkInterfaces());
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench": "bun run bench:bun && bun run bench:node"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,17 +7,13 @@
|
||||
"@swc/core": "^1.2.133",
|
||||
"benchmark": "^2.1.4",
|
||||
"braces": "^3.0.2",
|
||||
"color": "^4.2.3",
|
||||
"esbuild": "^0.14.12",
|
||||
"eventemitter3": "^5.0.0",
|
||||
"execa": "^8.0.1",
|
||||
"fast-glob": "3.3.1",
|
||||
"fdir": "^6.1.0",
|
||||
"mitata": "^1.0.10",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"mitata": "^0.1.6",
|
||||
"string-width": "7.1.0",
|
||||
"tinycolor2": "^1.6.0",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
import * as Mitata from "mitata";
|
||||
import process from "node:process";
|
||||
|
||||
const asJSON = !!process?.env?.BENCHMARK_RUNNER;
|
||||
|
||||
/** @param {Parameters<typeof Mitata["run"]>["0"]} opts */
|
||||
export function run(opts = {}) {
|
||||
if (asJSON) {
|
||||
opts.format = "json";
|
||||
}
|
||||
|
||||
return Mitata.run(opts);
|
||||
}
|
||||
|
||||
export const bench = Mitata.bench;
|
||||
|
||||
export function group(_name, fn) {
|
||||
return Mitata.group(fn);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
function doIt(...args) {
|
||||
// we use .at() to prevent constant folding optimizations
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// https://github.com/oven-sh/bun/issues/1096
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
const identity = x => x;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
var myArray = new Array(5);
|
||||
bench("[1, 2, 3, 4, 5].shift()", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
var comparator = (a, b) => a - b;
|
||||
|
||||
const numbers = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @runtime bun
|
||||
import { ArrayBufferSink } from "bun";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
var short = "Hello World!";
|
||||
var shortUTF16 = "Hello World 💕💕💕";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as assert from "assert";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
bench("deepEqual", () => {
|
||||
assert.deepEqual({ foo: "123", bar: "baz" }, { foo: "123", bar: "baz" });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "mitata";
|
||||
|
||||
bench("noop", function () {});
|
||||
bench("async function(){}", async function () {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
function makeBenchmark(size) {
|
||||
const latin1 = btoa("A".repeat(size));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
bench("new Blob(['hello world'])", function () {
|
||||
return new Blob(["hello world"]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
function makeBenchmark(size, isToString) {
|
||||
const base64Input = Buffer.alloc(size, "latin1").toString("base64");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
|
||||
const first = Buffer.allocUnsafe(size);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @runtime bun,node,deno
|
||||
import { Buffer } from "node:buffer";
|
||||
import process from "node:process";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
const N = parseInt(process.env.RUN_COUNTER ?? "10000", 10);
|
||||
var isBuffer = new Buffer(0);
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
|
||||
for (let fillSize of [4, 8, 16, 11]) {
|
||||
const buffer = Buffer.allocUnsafe(size);
|
||||
|
||||
const pattern = "x".repeat(fillSize);
|
||||
|
||||
bench(`Buffer.fill ${size} bytes with ${fillSize} byte value`, () => {
|
||||
buffer.fill(pattern);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await run();
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Buffer } from "node:buffer";
|
||||
import crypto from "node:crypto";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
const bigBuffer = Buffer.from("hello world".repeat(10000));
|
||||
const converted = bigBuffer.toString("base64");
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import Color from "color";
|
||||
import tinycolor from "tinycolor2";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const inputs = ["#f00", "rgb(255, 0, 0)", "rgba(255, 0, 0, 1)", "hsl(0, 100%, 50%)"];
|
||||
|
||||
for (const input of inputs) {
|
||||
group(`${input}`, () => {
|
||||
if (typeof Bun !== "undefined") {
|
||||
bench(`Bun.color() (${input})`, () => {
|
||||
Bun.color(input, "css");
|
||||
});
|
||||
}
|
||||
|
||||
bench(`color (${input})`, () => {
|
||||
Color(input).hex();
|
||||
});
|
||||
|
||||
bench(`'tinycolor2' (${input})`, () => {
|
||||
tinycolor(input).toHexString();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
await run();
|
||||
@@ -1,6 +1,6 @@
|
||||
import { allocUnsafe } from "bun";
|
||||
import { readFileSync } from "fs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
|
||||
function polyfill(chunks) {
|
||||
var size = 0;
|
||||
@@ -41,16 +41,15 @@ const chunkGroups = [
|
||||
];
|
||||
|
||||
for (const chunks of chunkGroups) {
|
||||
const name = `${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`
|
||||
group(name, () => {
|
||||
bench(`Bun.concatArrayBuffers (${name})`, () => {
|
||||
group(`${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`, () => {
|
||||
bench("Bun.concatArrayBuffers", () => {
|
||||
Bun.concatArrayBuffers(chunks);
|
||||
});
|
||||
bench(`Uint8Array.set (${name})`, () => {
|
||||
bench("Uint8Array.set", () => {
|
||||
polyfill(chunks);
|
||||
});
|
||||
|
||||
bench(`Uint8Array.set (uninitialized memory) (${name})`, () => {
|
||||
bench("Uint8Array.set (uninitialized memory)", () => {
|
||||
polyfillUninitialized(chunks);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
|
||||
const json = {
|
||||
login: "wongmjane",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mkdirSync, rmSync, writeFileSync } from "fs";
|
||||
import { cp } from "fs/promises";
|
||||
import { tmpdir } from "os";
|
||||
import { join, resolve } from "path";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
import { fileURLToPath } from "url";
|
||||
const hugeDirectory = (() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// https://github.com/oven-sh/bun/issues/2190
|
||||
import { bench, run } from "mitata";
|
||||
import { createHash } from "node:crypto";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const data =
|
||||
"Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// so it can run in environments without node module resolution
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
|
||||
import crypto from "node:crypto";
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user