diff --git a/src/compiler/sys/modules/os.ts b/src/compiler/sys/modules/os.ts index fde23c2d704..24366703ca4 100644 --- a/src/compiler/sys/modules/os.ts +++ b/src/compiler/sys/modules/os.ts @@ -1,5 +1,10 @@ +import { OS_PLATFORM } from '@utils'; + export const EOL = '\n'; +export const platform = () => (OS_PLATFORM === 'windows' ? 'win32' : OS_PLATFORM); + export default { EOL, + platform, }; diff --git a/src/utils/environment.ts b/src/utils/environment.ts index cb0d35e994d..450efdce98c 100644 --- a/src/utils/environment.ts +++ b/src/utils/environment.ts @@ -10,6 +10,8 @@ export const IS_NODE_ENV = typeof __filename === 'string' && (!((global as any) as Window).origin || typeof ((global as any) as Window).origin !== 'string'); +export const OS_PLATFORM = IS_NODE_ENV ? global.process.platform : IS_DENO_ENV ? (globalThis as any).Deno.build.os : ''; + export const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; export const IS_NODE_WINDOWS_ENV = IS_NODE_ENV && global.process.platform === 'win32';