From 23c8d4822a11088f24ef800d788d7688d0c73065 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 5 Jan 2026 13:38:11 -0800 Subject: [PATCH] better naming --- src/prelude/index.ts | 25 ++++++++++++------------- src/utils/utils.tsx | 3 +-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/prelude/index.ts b/src/prelude/index.ts index 04a2ccb..cada59d 100644 --- a/src/prelude/index.ts +++ b/src/prelude/index.ts @@ -19,7 +19,7 @@ import { list } from './list' import { math } from './math' import { str } from './str' import { types } from './types' -import { isServer } from '#utils/utils' +import { runningInBrowser } from '#utils/utils' export const globals: Record = { date, @@ -32,8 +32,18 @@ export const globals: Record = { str, // shrimp runtime info - $: isServer + $: runningInBrowser ? { + args: [], + argv: [], + env: {}, + pid: 0, + cwd: '', + script: { + name: '', + path: '.', + }, + } : { args: Bun.argv.slice(3), argv: Bun.argv.slice(1), env: process.env, @@ -44,17 +54,6 @@ export const globals: Record = { path: resolve(join('.', Bun.argv[2] ?? '')), }, } - : { - args: [], - argv: [], - env: {}, - pid: 0, - cwd: '', - script: { - name: '', - path: '.', - }, - }, // hello echo: (...args: any[]) => { diff --git a/src/utils/utils.tsx b/src/utils/utils.tsx index a155fec..9fe6749 100644 --- a/src/utils/utils.tsx +++ b/src/utils/utils.tsx @@ -144,5 +144,4 @@ export const isDebug = (): boolean => { return false } -export const isBrowser = typeof window !== 'undefined' -export const isServer = typeof process !== 'undefined' +export const runningInBrowser = typeof window !== 'undefined'