* @internal * Does not try `@types/${packageName}` - use a second pass if needed.
(packageName, containingDirectory, options, host, cache)
| 42692 | * Does not try `@types/${packageName}` - use a second pass if needed. |
| 42693 | */ |
| 42694 | function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) { |
| 42695 | var moduleResolutionState = { |
| 42696 | compilerOptions: options, |
| 42697 | host: host, |
| 42698 | traceEnabled: isTraceEnabled(options, host), |
| 42699 | failedLookupLocations: [], |
| 42700 | packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), |
| 42701 | conditions: ts.emptyArray, |
| 42702 | features: NodeResolutionFeatures.None, |
| 42703 | requestContainingDirectory: containingDirectory, |
| 42704 | reportDiagnostic: ts.noop |
| 42705 | }; |
| 42706 | return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) { |
| 42707 | if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { |
| 42708 | var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules"); |
| 42709 | var candidate = ts.combinePaths(nodeModulesFolder, packageName); |
| 42710 | return getPackageJsonInfo(candidate, /*onlyRecordFailures*/ false, moduleResolutionState); |
| 42711 | } |
| 42712 | }); |
| 42713 | } |
| 42714 | ts.resolvePackageNameToPackageJson = resolvePackageNameToPackageJson; |
| 42715 | /** |
| 42716 | * Given a set of options, returns the set of type directive names |
nothing calls this directly
no test coverage detected