diff --git a/cli/tests/testdata/npm/builtin_module_module/main.out b/cli/tests/testdata/npm/builtin_module_module/main.out index b0a370638c..160ba6503f 100644 --- a/cli/tests/testdata/npm/builtin_module_module/main.out +++ b/cli/tests/testdata/npm/builtin_module_module/main.out @@ -1,2 +1,4 @@ function function +function +true diff --git a/cli/tests/testdata/npm/registry/@denotest/builtin-module-module/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/builtin-module-module/1.0.0/index.js index cb610a613e..140f5ef215 100644 --- a/cli/tests/testdata/npm/registry/@denotest/builtin-module-module/1.0.0/index.js +++ b/cli/tests/testdata/npm/registry/@denotest/builtin-module-module/1.0.0/index.js @@ -2,4 +2,6 @@ import m1 from "node:module"; import m2 from "module"; console.log(typeof m1.Module); -console.log(typeof m2.Module); \ No newline at end of file +console.log(typeof m2.Module); +console.log(typeof m1); +console.log(m1 === m1.Module); diff --git a/ext/node/02_require.js b/ext/node/02_require.js index 0a3248eb8e..0cc6b9eb46 100644 --- a/ext/node/02_require.js +++ b/ext/node/02_require.js @@ -828,25 +828,7 @@ Module.Module = Module; - const m = { - _cache: Module._cache, - _extensions: Module._extensions, - _findPath: Module._findPath, - _initPaths: Module._initPaths, - _load: Module._load, - _nodeModulePaths: Module._nodeModulePaths, - _pathCache: Module._pathCache, - _preloadModules: Module._preloadModules, - _resolveFilename: Module._resolveFilename, - _resolveLookupPaths: Module._resolveLookupPaths, - builtinModules: Module.builtinModules, - createRequire: Module.createRequire, - globalPaths: Module.globalPaths, - Module, - wrap: Module.wrap, - }; - - node.nativeModuleExports.module = m; + node.nativeModuleExports.module = Module; function loadNativeModule(_id, request) { if (nativeModulePolyfill.has(request)) { @@ -890,7 +872,6 @@ toRealPath, cjsParseCache, readPackageScope, - moduleExports: m, }, }; })(globalThis); diff --git a/ext/node/module_es_shim.js b/ext/node/module_es_shim.js index ab128e7a9c..164e18db53 100644 --- a/ext/node/module_es_shim.js +++ b/ext/node/module_es_shim.js @@ -1,4 +1,4 @@ -const m = Deno[Deno.internal].require.moduleExports; +const m = Deno[Deno.internal].require.Module; export const _cache = m._cache; export const _extensions = m._extensions; export const _findPath = m._findPath;