module: remove unnecessary readPackage
function
PR-URL: https://github.com/nodejs/node/pull/57596 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
parent
79eddc613b
commit
d7a1565350
@ -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; },
|
||||
|
@ -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.
|
||||
@ -320,7 +309,6 @@ function findPackageJSON(specifier, base = 'data:') {
|
||||
|
||||
module.exports = {
|
||||
read,
|
||||
readPackage,
|
||||
getNearestParentPackageJSON,
|
||||
getPackageScopeConfig,
|
||||
getPackageType,
|
||||
|
Loading…
x
Reference in New Issue
Block a user