Skip to content

Commit 6ddf9ab

Browse files
fixup: remove changes for get full packagejson
1 parent 70dd5f8 commit 6ddf9ab

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

lib/internal/modules/package_json_reader.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@ const { resolve, sep } = require('path');
1212
const { kEmptyObject } = require('internal/util');
1313

1414
/**
15-
* @typedef {import('typings/internalBinding/modules').FullPackageConfig} FullPackageConfig
1615
* @typedef {import('typings/internalBinding/modules').PackageConfig} PackageConfig
1716
* @typedef {import('typings/internalBinding/modules').SerializedPackageConfig} SerializedPackageConfig
1817
*/
1918

2019
/**
2120
* @param {string} path
2221
* @param {SerializedPackageConfig} contents
23-
* @param {boolean} everything
24-
* @returns {everything extends true ? FullPackageConfig : PackageConfig}
22+
* @returns {PackageConfig}
2523
*/
26-
function deserializePackageJSON(path, contents, everything = false) {
24+
function deserializePackageJSON(path, contents) {
2725
if (contents === undefined) {
2826
return {
2927
__proto__: null,
@@ -71,7 +69,6 @@ function deserializePackageJSON(path, contents, everything = false) {
7169
ObjectDefineProperty(this, 'exports', { __proto__: null, value });
7270
return this.exports;
7371
},
74-
...(everything && contents[6]),
7572
};
7673
}
7774

@@ -113,17 +110,16 @@ function readPackage(requestPath) {
113110
* Get the nearest parent package.json file from a given path.
114111
* Return the package.json data and the path to the package.json file, or undefined.
115112
* @param {string} checkPath The path to start searching from.
116-
* @param {boolean} everything Whether to include unrecognised fields.
117113
* @returns {undefined | {data: PackageConfig, path: string}}
118114
*/
119-
function getNearestParentPackageJSON(checkPath, everything = false) {
115+
function getNearestParentPackageJSON(checkPath) {
120116
const result = modulesBinding.getNearestParentPackageJSON(checkPath);
121117

122118
if (result === undefined) {
123119
return undefined;
124120
}
125121

126-
const data = deserializePackageJSON(checkPath, result, everything);
122+
const data = deserializePackageJSON(checkPath, result);
127123

128124
// Path should be the root folder of the matched package.json
129125
// For example for ~/path/package.json, it should be ~/path
@@ -144,14 +140,13 @@ function findNearestPackageJSON(origin) {
144140
/**
145141
* Returns the package configuration for the given resolved URL.
146142
* @param {URL | string} resolved - The resolved URL.
147-
* @param {boolean} everything - Whether to include unrecognised fields.
148143
* @returns {PackageConfig} - The package configuration.
149144
*/
150-
function getPackageScopeConfig(resolved, everything = false) {
145+
function getPackageScopeConfig(resolved) {
151146
const result = modulesBinding.getPackageScopeConfig(`${resolved}`);
152147

153148
if (ArrayIsArray(result)) {
154-
return deserializePackageJSON(`${resolved}`, result, everything);
149+
return deserializePackageJSON(`${resolved}`, result);
155150
}
156151

157152
// This means that the response is a string

lib/module.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const {
1111
getCompileCacheDir,
1212
} = require('internal/modules/helpers');
1313
const {
14-
getPackageScopeConfig,
1514
findNearestPackageJSON,
1615
} = require('internal/modules/package_json_reader');
1716

@@ -23,6 +22,5 @@ Module.enableCompileCache = enableCompileCache;
2322
Module.flushCompileCache = flushCompileCache;
2423

2524
Module.getCompileCacheDir = getCompileCacheDir;
26-
Module.getPackageScopeConfig = getPackageScopeConfig;
2725
Module.findNearestPackageJSON = findNearestPackageJSON;
2826
module.exports = Module;

typings/internalBinding/modules.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ export type PackageConfig = {
88
exports?: string | string[] | Record<string, unknown>
99
imports?: string | string[] | Record<string, unknown>
1010
}
11-
export type FullPackageConfig = PackageConfig & {
12-
[key: string]: unknown,
13-
}
1411
export type SerializedPackageConfig = [
1512
PackageConfig['name'],
1613
PackageConfig['main'],

0 commit comments

Comments
 (0)