MCPcopy Index your code
hub / github.com/nodejs/node / getPackageScopeConfig

Function getPackageScopeConfig

lib/internal/modules/package_json_reader.js:192–214  ·  view source on GitHub ↗

* Returns the package configuration for the given resolved URL. * @param {URL | string} resolved - The resolved URL. * @returns {import('typings/internalBinding/modules').PackageConfig} - The package configuration.

(resolved)

Source from the content-addressed store, hash-verified

190 * @returns {import('typings/internalBinding/modules').PackageConfig} - The package configuration.
191 */
192function getPackageScopeConfig(resolved) {
193 const result = modulesBinding.getPackageScopeConfig(`${resolved}`);
194
195 if (ArrayIsArray(result)) {
196 const { data, exists, path } = deserializePackageJSON(`${resolved}`, result);
197
198 return {
199 __proto__: null,
200 ...data,
201 exists,
202 pjsonPath: path,
203 };
204 }
205
206 // This means that the response is a string
207 // and it is the path to the package.json file
208 return {
209 __proto__: null,
210 pjsonPath: result,
211 exists: false,
212 type: 'none',
213 };
214}
215
216/**
217 * Returns the package type for a given URL.

Callers 2

getPackageJSONURLFunction · 0.85

Calls 2

deserializePackageJSONFunction · 0.85
getPackageScopeConfigMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…