recorver code
This commit is contained in:
19
src/auto/runtime.ts
Normal file
19
src/auto/runtime.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
type RuntimeEngine = 'node' | 'deno' | 'bun';
|
||||
|
||||
type Runtime = {
|
||||
isNode?: boolean;
|
||||
isDeno?: boolean;
|
||||
isBun?: boolean;
|
||||
engine: RuntimeEngine;
|
||||
};
|
||||
export const getRuntime = (): Runtime => {
|
||||
// @ts-ignore
|
||||
if (typeof Deno !== 'undefined') {
|
||||
return { isDeno: true, engine: 'deno' };
|
||||
}
|
||||
// @ts-ignore
|
||||
if (typeof Bun !== 'undefined') {
|
||||
return { isBun: true, engine: 'bun' };
|
||||
}
|
||||
return { isNode: true, engine: 'node' };
|
||||
};
|
Reference in New Issue
Block a user