Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
module: remove unnecessary readPackage function
  • Loading branch information
dario-piotrowicz committed Mar 23, 2025
commit 1a7f26e99107fda201a3744e338439230958a1c7
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function initializeCJS() {
// -> a.<ext>
// -> a/index.<ext>

let _readPackage = packageJsonReader.readPackage;
let _readPackage = (requestPath) => packageJsonReader.read(path.resolve(requestPath, 'package.json'));
ObjectDefineProperty(Module, '_readPackage', {
__proto__: null,
get() { return _readPackage; },
Expand Down
12 changes: 0 additions & 12 deletions lib/internal/modules/package_json_reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,6 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
};
}

/**
* @deprecated Expected to be removed in favor of `read` in the future.
* Behaves the same was as `read`, but appends package.json to the path.
* @param {string} requestPath
* @return {PackageConfig}
*/
function readPackage(requestPath) {
// TODO(@anonrig): Remove this function.
return read(path.resolve(requestPath, 'package.json'));
}

/**
* Get the nearest parent package.json file from a given path.
* Return the package.json data and the path to the package.json file, or undefined.
Expand Down Expand Up @@ -320,7 +309,6 @@ function findPackageJSON(specifier, base = 'data:') {

module.exports = {
read,
readPackage,
getNearestParentPackageJSON,
getPackageScopeConfig,
getPackageType,
Expand Down
Loading