diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-02-15 19:44:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 19:44:52 +0100 |
commit | 75209e12f19ca5d4a2a7c9008fba63a487ad8e6a (patch) | |
tree | c122feabbceeef070de4d4eb23667c6153ea7eb1 /ext/node/polyfills/internal/child_process.ts | |
parent | c4b9a91e27a32c0949688034c2449936c01a44a9 (diff) |
feat: wire up ext/node to the Node compatibility layer (#17785)
This PR changes Node.js/npm compatibility layer to use polyfills for
built-in Node.js
embedded in the snapshot (that are coming from "ext/node" extension).
As a result loading `std/node`, either from
"https://deno.land/std@<latest>/" or
from "DENO_NODE_COMPAT_URL" env variable were removed. All code that is
imported via "npm:" specifiers now uses code embedded in the snapshot.
Several fixes were applied to various modules in "ext/node" to make
tests pass.
---------
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Co-authored-by: Divy Srivastava <dj.srivastava23@gmail.com>
Diffstat (limited to 'ext/node/polyfills/internal/child_process.ts')
-rw-r--r-- | ext/node/polyfills/internal/child_process.ts | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 92aa8d4fa..81a404c14 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -67,10 +67,6 @@ export function mapValues<T, O>( type NodeStdio = "pipe" | "overlapped" | "ignore" | "inherit" | "ipc"; type DenoStdio = "inherit" | "piped" | "null"; -// @ts-ignore Deno[Deno.internal] is used on purpose here -const DenoCommand = Deno[Deno.internal]?.nodeUnstable?.Command || - Deno.Command; - export function stdioStringToArray( stdio: NodeStdio, channel: NodeStdio | number, @@ -183,9 +179,8 @@ export class ChildProcess extends EventEmitter { this.spawnargs = [cmd, ...cmdArgs]; const stringEnv = mapValues(env, (value) => value.toString()); - try { - this.#process = new DenoCommand(cmd, { + this.#process = new Deno.Command(cmd, { args: cmdArgs, cwd, env: stringEnv, @@ -804,7 +799,7 @@ export function spawnSync( const result: SpawnSyncResult = {}; try { - const output = new DenoCommand(command, { + const output = new Deno.Command(command, { args, cwd, env, |