revert: fix(ivy): ngcc - resolve main property paths correctly (#31509)

This reverts commit 103a5b42ec.
This commit is contained in:
Matias Niemelä
2019-07-11 11:51:13 -04:00
parent 7ea6073534
commit db557221bc
6 changed files with 27 additions and 137 deletions

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import * as ts from 'typescript';
import {AbsoluteFsPath, FileSystem, absoluteFrom} from '../../src/ngtsc/file_system';
export function getOriginalSymbol(checker: ts.TypeChecker): (symbol: ts.Symbol) => ts.Symbol {
return function(symbol: ts.Symbol) {
@ -66,19 +65,3 @@ export type PathMappings = {
export function isRelativePath(path: string): boolean {
return /^\/|^\.\.?($|\/)/.test(path);
}
/**
* Attempt to resolve a `path` to a file by appending the provided `postFixes`
* to the `path` and checking if the file exists on disk.
* @returns An absolute path to the first matching existing file, or `null` if none exist.
*/
export function resolveFileWithPostfixes(
fs: FileSystem, path: AbsoluteFsPath, postFixes: string[]): AbsoluteFsPath|null {
for (const postFix of postFixes) {
const testPath = absoluteFrom(path + postFix);
if (fs.exists(testPath) && fs.stat(testPath).isFile()) {
return testPath;
}
}
return null;
}