better naming
This commit is contained in:
parent
d1b16ce3e1
commit
23c8d4822a
|
|
@ -19,7 +19,7 @@ import { list } from './list'
|
||||||
import { math } from './math'
|
import { math } from './math'
|
||||||
import { str } from './str'
|
import { str } from './str'
|
||||||
import { types } from './types'
|
import { types } from './types'
|
||||||
import { isServer } from '#utils/utils'
|
import { runningInBrowser } from '#utils/utils'
|
||||||
|
|
||||||
export const globals: Record<string, any> = {
|
export const globals: Record<string, any> = {
|
||||||
date,
|
date,
|
||||||
|
|
@ -32,8 +32,18 @@ export const globals: Record<string, any> = {
|
||||||
str,
|
str,
|
||||||
|
|
||||||
// shrimp runtime info
|
// shrimp runtime info
|
||||||
$: isServer
|
$: runningInBrowser
|
||||||
? {
|
? {
|
||||||
|
args: [],
|
||||||
|
argv: [],
|
||||||
|
env: {},
|
||||||
|
pid: 0,
|
||||||
|
cwd: '',
|
||||||
|
script: {
|
||||||
|
name: '',
|
||||||
|
path: '.',
|
||||||
|
},
|
||||||
|
} : {
|
||||||
args: Bun.argv.slice(3),
|
args: Bun.argv.slice(3),
|
||||||
argv: Bun.argv.slice(1),
|
argv: Bun.argv.slice(1),
|
||||||
env: process.env,
|
env: process.env,
|
||||||
|
|
@ -44,17 +54,6 @@ export const globals: Record<string, any> = {
|
||||||
path: resolve(join('.', Bun.argv[2] ?? '')),
|
path: resolve(join('.', Bun.argv[2] ?? '')),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {
|
|
||||||
args: [],
|
|
||||||
argv: [],
|
|
||||||
env: {},
|
|
||||||
pid: 0,
|
|
||||||
cwd: '',
|
|
||||||
script: {
|
|
||||||
name: '',
|
|
||||||
path: '.',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
// hello
|
// hello
|
||||||
echo: (...args: any[]) => {
|
echo: (...args: any[]) => {
|
||||||
|
|
|
||||||
|
|
@ -144,5 +144,4 @@ export const isDebug = (): boolean => {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isBrowser = typeof window !== 'undefined'
|
export const runningInBrowser = typeof window !== 'undefined'
|
||||||
export const isServer = typeof process !== 'undefined'
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user