2019-11-18 18:30:24 -05:00
|
|
|
import { notImplemented } from "./_utils.ts";
|
|
|
|
|
|
|
|
function on(_event: string, _callback: Function): void {
|
|
|
|
// TODO(rsp): to be implemented
|
|
|
|
notImplemented();
|
|
|
|
}
|
|
|
|
|
|
|
|
export const process = {
|
2020-06-12 15:23:38 -04:00
|
|
|
version: `v${Deno.version.deno}`,
|
|
|
|
versions: {
|
|
|
|
node: Deno.version.deno,
|
|
|
|
...Deno.version,
|
|
|
|
},
|
|
|
|
platform: Deno.build.os === "windows" ? "win32" : Deno.build.os,
|
|
|
|
arch: Deno.build.arch,
|
|
|
|
pid: Deno.pid,
|
|
|
|
cwd: Deno.cwd,
|
|
|
|
chdir: Deno.chdir,
|
|
|
|
exit: Deno.exit,
|
2019-11-18 18:30:24 -05:00
|
|
|
on,
|
|
|
|
get env(): { [index: string]: string } {
|
|
|
|
// using getter to avoid --allow-env unless it's used
|
2020-04-29 14:48:19 -04:00
|
|
|
return Deno.env.toObject();
|
2019-11-18 18:30:24 -05:00
|
|
|
},
|
|
|
|
get argv(): string[] {
|
|
|
|
// Deno.execPath() also requires --allow-env
|
|
|
|
return [Deno.execPath(), ...Deno.args];
|
2020-03-28 13:03:49 -04:00
|
|
|
},
|
2019-11-18 18:30:24 -05:00
|
|
|
};
|
2020-04-30 10:00:02 -04:00
|
|
|
|
2020-04-30 13:58:40 -04:00
|
|
|
Object.defineProperty(process, Symbol.toStringTag, {
|
|
|
|
enumerable: false,
|
|
|
|
writable: true,
|
|
|
|
configurable: false,
|
|
|
|
value: "process",
|
|
|
|
});
|
|
|
|
|
2020-04-30 10:00:02 -04:00
|
|
|
Object.defineProperty(globalThis, "process", {
|
|
|
|
value: process,
|
|
|
|
enumerable: false,
|
|
|
|
writable: true,
|
|
|
|
configurable: true,
|
|
|
|
});
|