diff --git a/packages/preview2-shim/lib/browser/cli.js b/packages/preview2-shim/lib/browser/cli.js index 23fcb7495..d98601126 100644 --- a/packages/preview2-shim/lib/browser/cli.js +++ b/packages/preview2-shim/lib/browser/cli.js @@ -1,12 +1,26 @@ -let _env; +let _env, _args = [], _cwd = null; export function _setEnv (envObj) { _env = Object.entries(envObj); } +export function _setArgs (args) { + _args = args; +} + +export function _setCwd (cwd) { + _cwd = cwd; +} + export const environment = { getEnvironment () { - if (!_env) _env = []; + if (!_env) _setEnv(process.env); return _env; + }, + getArguments () { + return args; + }, + initialCwd () { + return _cwd; } }; diff --git a/packages/preview2-shim/lib/nodejs/cli.js b/packages/preview2-shim/lib/nodejs/cli.js index f18eecbf0..321410079 100644 --- a/packages/preview2-shim/lib/nodejs/cli.js +++ b/packages/preview2-shim/lib/nodejs/cli.js @@ -1,12 +1,26 @@ -let _env; +let _env, _args = [], _cwd = null; export function _setEnv (envObj) { _env = Object.entries(envObj); } +export function _setArgs (args) { + _args = args; +} + +export function _setCwd (cwd) { + _cwd = cwd; +} + export const environment = { getEnvironment () { if (!_env) _setEnv(process.env); return _env; + }, + getArguments () { + return args; + }, + initialCwd () { + return _cwd; } }; @@ -35,15 +49,11 @@ export const stderr = { }; export const terminalInput = { - dropTerminalInput () { - - } + dropTerminalInput () {} }; export const terminalOutput = { - dropTerminalOutput () { - - } + dropTerminalOutput () {} }; export const terminalStderr = {