Skip to content

Commit d7a1565

Browse files
module: remove unnecessary readPackage function
PR-URL: #57596 Reviewed-By: Jacob Smith <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 79eddc6 commit d7a1565

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

lib/internal/modules/cjs/loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function initializeCJS() {
478478
// -> a.<ext>
479479
// -> a/index.<ext>
480480

481-
let _readPackage = packageJsonReader.readPackage;
481+
let _readPackage = (requestPath) => packageJsonReader.read(path.resolve(requestPath, 'package.json'));
482482
ObjectDefineProperty(Module, '_readPackage', {
483483
__proto__: null,
484484
get() { return _readPackage; },

lib/internal/modules/package_json_reader.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,6 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
124124
};
125125
}
126126

127-
/**
128-
* @deprecated Expected to be removed in favor of `read` in the future.
129-
* Behaves the same was as `read`, but appends package.json to the path.
130-
* @param {string} requestPath
131-
* @return {PackageConfig}
132-
*/
133-
function readPackage(requestPath) {
134-
// TODO(@anonrig): Remove this function.
135-
return read(path.resolve(requestPath, 'package.json'));
136-
}
137-
138127
/**
139128
* Get the nearest parent package.json file from a given path.
140129
* Return the package.json data and the path to the package.json file, or undefined.
@@ -320,7 +309,6 @@ function findPackageJSON(specifier, base = 'data:') {
320309

321310
module.exports = {
322311
read,
323-
readPackage,
324312
getNearestParentPackageJSON,
325313
getPackageScopeConfig,
326314
getPackageType,

0 commit comments

Comments
 (0)