MCPcopy Create free account
hub / github.com/nodejs/node / moduleSpecifierIsCoveredByPackageJson

Function moduleSpecifierIsCoveredByPackageJson

test/fixtures/snapshot/typescript.js:129245–129254  ·  view source on GitHub ↗
(specifier)

Source from the content-addressed store, hash-verified

129243 var usesNodeCoreModules;
129244 return { allowsImportingAmbientModule: allowsImportingAmbientModule, allowsImportingSourceFile: allowsImportingSourceFile, allowsImportingSpecifier: allowsImportingSpecifier };
129245 function moduleSpecifierIsCoveredByPackageJson(specifier) {
129246 var packageName = getNodeModuleRootSpecifier(specifier);
129247 for (var _i = 0, packageJsons_1 = packageJsons; _i < packageJsons_1.length; _i++) {
129248 var packageJson = packageJsons_1[_i];
129249 if (packageJson.has(packageName) || packageJson.has(ts.getTypesPackageName(packageName))) {
129250 return true;
129251 }
129252 }
129253 return false;
129254 }
129255 function allowsImportingAmbientModule(moduleSymbol, moduleSpecifierResolutionHost) {
129256 if (!packageJsons.length || !moduleSymbol.valueDeclaration) {
129257 return true;

Callers 3

allowsImportingSpecifierFunction · 0.85

Calls 2

hasMethod · 0.65

Tested by

no test coverage detected