From 75209e12f19ca5d4a2a7c9008fba63a487ad8e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 15 Feb 2023 19:44:52 +0100 Subject: 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@/" 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 Co-authored-by: Divy Srivastava --- cli/tests/testdata/run/node_builtin_modules/mod.js | 1 + cli/tests/testdata/run/node_builtin_modules/mod.js.out | 6 ++++++ cli/tests/testdata/run/node_builtin_modules/mod.ts | 1 + cli/tests/testdata/run/node_builtin_modules/mod.ts.out | 6 ++++++ 4 files changed, 14 insertions(+) (limited to 'cli/tests/testdata/run/node_builtin_modules') diff --git a/cli/tests/testdata/run/node_builtin_modules/mod.js b/cli/tests/testdata/run/node_builtin_modules/mod.js index 4d3f48695..a01ac4422 100644 --- a/cli/tests/testdata/run/node_builtin_modules/mod.js +++ b/cli/tests/testdata/run/node_builtin_modules/mod.js @@ -2,3 +2,4 @@ import { createRequire } from "node:module"; console.log(createRequire); import process from "node:process"; console.log(process.version); +console.log(process.argv); diff --git a/cli/tests/testdata/run/node_builtin_modules/mod.js.out b/cli/tests/testdata/run/node_builtin_modules/mod.js.out index d49dbb321..0d96b31ab 100644 --- a/cli/tests/testdata/run/node_builtin_modules/mod.js.out +++ b/cli/tests/testdata/run/node_builtin_modules/mod.js.out @@ -1,2 +1,8 @@ [Function: createRequire] v[WILDCARD].[WILDCARD].[WILDCARD] +[ + "[WILDCARD]", + "[WILDCARD]mod.js", + "hello", + "there" +] diff --git a/cli/tests/testdata/run/node_builtin_modules/mod.ts b/cli/tests/testdata/run/node_builtin_modules/mod.ts index 4d3f48695..a01ac4422 100644 --- a/cli/tests/testdata/run/node_builtin_modules/mod.ts +++ b/cli/tests/testdata/run/node_builtin_modules/mod.ts @@ -2,3 +2,4 @@ import { createRequire } from "node:module"; console.log(createRequire); import process from "node:process"; console.log(process.version); +console.log(process.argv); diff --git a/cli/tests/testdata/run/node_builtin_modules/mod.ts.out b/cli/tests/testdata/run/node_builtin_modules/mod.ts.out index d49dbb321..f19bd81e6 100644 --- a/cli/tests/testdata/run/node_builtin_modules/mod.ts.out +++ b/cli/tests/testdata/run/node_builtin_modules/mod.ts.out @@ -1,2 +1,8 @@ [Function: createRequire] v[WILDCARD].[WILDCARD].[WILDCARD] +[ + "[WILDCARD]", + "[WILDCARD]mod.ts", + "hello", + "there" +] -- cgit v1.2.3