fix: 解决问题

This commit is contained in:
2025-12-28 10:52:04 +08:00
parent 868979a423
commit 9f51d27398
18 changed files with 57061 additions and 201 deletions

View File

@@ -0,0 +1,19 @@
export const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof document.createElement === 'function';
// @ts-ignore
export const isDeno = typeof Deno !== 'undefined' && typeof Deno.version === 'object' && typeof Deno.version.deno === 'string';
// @ts-ignore
export const isBun = typeof Bun !== 'undefined' && typeof Bun.version === 'string';
export const getEngine = () => {
if (isBun) {
return 'bun';
} else if (isNode) {
return 'node';
} else if (isBrowser) {
return 'browser';
} else if (isDeno) {
return 'deno';
}
return 'unknown';
};