From 1727e1511b10df66346d2297efe1bf158cfd196c Mon Sep 17 00:00:00 2001 From: Omar Date: Thu, 21 Dec 2023 17:24:10 -0800 Subject: [PATCH 1/2] fix(isBun): fix ordering in array the order of the array caused it result in `node` even when it's `bun` also see https://discord.com/channels/876711213126520882/876711213126520885/1187564755347578921 --- src/runtimes.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtimes.ts b/src/runtimes.ts index f500ce8..963cb3a 100644 --- a/src/runtimes.ts +++ b/src/runtimes.ts @@ -20,8 +20,8 @@ export const isWorkerd = export const isDeno = !!globalThis.Deno; // https://nodejs.org/api/process.html#processrelease export const isLagon = !!globalThis.__lagon__; -export const isNode = globalThis.process?.release?.name === "node"; export const isBun = !!globalThis.Bun || !!globalThis.process?.versions?.bun; +export const isNode = !isBun && globalThis.process?.release?.name === "node"; export const isFastly = !!globalThis.fastly; const runtimeChecks: [boolean, RuntimeName][] = [ @@ -30,8 +30,8 @@ const runtimeChecks: [boolean, RuntimeName][] = [ [isWorkerd, "workerd"], [isDeno, "deno"], [isLagon, "lagon"], - [isNode, "node"], [isBun, "bun"], + [isNode, "node"], [isFastly, "fastly"], ]; From 0a65232c95bb33d47b0749cc71fe2433c0762d26 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 22 Dec 2023 10:22:12 +0100 Subject: [PATCH 2/2] revert `isNode` change --- src/runtimes.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtimes.ts b/src/runtimes.ts index 963cb3a..6193c10 100644 --- a/src/runtimes.ts +++ b/src/runtimes.ts @@ -20,8 +20,8 @@ export const isWorkerd = export const isDeno = !!globalThis.Deno; // https://nodejs.org/api/process.html#processrelease export const isLagon = !!globalThis.__lagon__; +export const isNode = globalThis.process?.release?.name === "node"; export const isBun = !!globalThis.Bun || !!globalThis.process?.versions?.bun; -export const isNode = !isBun && globalThis.process?.release?.name === "node"; export const isFastly = !!globalThis.fastly; const runtimeChecks: [boolean, RuntimeName][] = [