Skip to content

Commit 7240685

Browse files
committed
Allow monkey-patching internalModuleStat
1 parent c9a1da0 commit 7240685

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/internal/modules/cjs/loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const fs = require('fs');
8484
const internalFS = require('internal/fs/utils');
8585
const path = require('path');
8686
const { sep } = path;
87-
const { internalModuleStat } = internalBinding('fs');
87+
const internalFsBinding = internalBinding('fs');
8888
const packageJsonReader = require('internal/modules/package_json_reader');
8989
const { safeGetenv } = internalBinding('credentials');
9090
const {
@@ -148,7 +148,7 @@ function stat(filename) {
148148
const result = statCache.get(filename);
149149
if (result !== undefined) return result;
150150
}
151-
const result = internalModuleStat(filename);
151+
const result = internalFsBinding.internalModuleStat(filename);
152152
if (statCache !== null && result >= 0) {
153153
// Only set cache when `internalModuleStat(filename)` succeeds.
154154
statCache.set(filename, result);

lib/internal/modules/package_json_reader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const { SafeMap } = primordials;
4-
const { internalModuleReadJSON } = internalBinding('fs');
4+
const internalFsBinding = internalBinding('fs');
55
const { pathToFileURL } = require('url');
66
const { toNamespacedPath } = require('path');
77

@@ -18,7 +18,7 @@ function read(jsonPath) {
1818
return cache.get(jsonPath);
1919
}
2020

21-
const { 0: string, 1: containsKeys } = internalModuleReadJSON(
21+
const { 0: string, 1: containsKeys } = internalFsBinding.internalModuleReadJSON(
2222
toNamespacedPath(jsonPath)
2323
);
2424
const result = { string, containsKeys };

0 commit comments

Comments
 (0)