mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Plugins + cross-compilation + Bun.build API support for Bun.build({compile}) (#21915)
### What does this PR do? in the name ### How did you verify your code works? tests, but using ci to see if anything else broke --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
@@ -23,6 +23,7 @@ export const isLinux = process.platform === "linux";
|
||||
export const isPosix = isMacOS || isLinux;
|
||||
export const isWindows = process.platform === "win32";
|
||||
export const isIntelMacOS = isMacOS && process.arch === "x64";
|
||||
export const isArm64 = process.arch === "arm64";
|
||||
export const isDebug = Bun.version.includes("debug");
|
||||
export const isCI = process.env.CI !== undefined;
|
||||
export const libcFamily: "glibc" | "musl" =
|
||||
@@ -263,6 +264,24 @@ export function tempDirWithFiles(
|
||||
return base;
|
||||
}
|
||||
|
||||
class DisposableString extends String {
|
||||
[Symbol.dispose]() {
|
||||
fs.rmSync(this + "", { recursive: true, force: true });
|
||||
}
|
||||
[Symbol.asyncDispose]() {
|
||||
return fs.promises.rm(this + "", { recursive: true, force: true });
|
||||
}
|
||||
}
|
||||
|
||||
export function tempDir(
|
||||
basename: string,
|
||||
filesOrAbsolutePathToCopyFolderFrom: DirectoryTree | string,
|
||||
): DisposableString {
|
||||
const base = tempDirWithFiles(basename, filesOrAbsolutePathToCopyFolderFrom);
|
||||
|
||||
return new DisposableString(base);
|
||||
}
|
||||
|
||||
export function tempDirWithFilesAnon(filesOrAbsolutePathToCopyFolderFrom: DirectoryTree | string): string {
|
||||
const base = tmpdirSync();
|
||||
makeTreeSync(base, filesOrAbsolutePathToCopyFolderFrom);
|
||||
|
||||
Reference in New Issue
Block a user