diff --git a/packages/compiler-cli/ngcc/src/file_system/node_js_file_system.ts b/packages/compiler-cli/ngcc/src/file_system/node_js_file_system.ts index 7f821c3986..8f4e7c797c 100644 --- a/packages/compiler-cli/ngcc/src/file_system/node_js_file_system.ts +++ b/packages/compiler-cli/ngcc/src/file_system/node_js_file_system.ts @@ -23,7 +23,7 @@ export class NodeJSFileSystem implements FileSystem { readdir(path: AbsoluteFsPath): PathSegment[] { return fs.readdirSync(path) as PathSegment[]; } lstat(path: AbsoluteFsPath): fs.Stats { return fs.lstatSync(path); } stat(path: AbsoluteFsPath): fs.Stats { return fs.statSync(path); } - pwd() { return AbsoluteFsPath.fromUnchecked(process.cwd()); } + pwd() { return AbsoluteFsPath.from(process.cwd()); } copyFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { cp(from, to); } moveFile(from: AbsoluteFsPath, to: AbsoluteFsPath): void { mv(from, to); } ensureDir(path: AbsoluteFsPath): void { mkdir('-p', path); } diff --git a/packages/compiler-cli/ngcc/src/packages/entry_point_finder.ts b/packages/compiler-cli/ngcc/src/packages/entry_point_finder.ts index f739669480..d1546a7466 100644 --- a/packages/compiler-cli/ngcc/src/packages/entry_point_finder.ts +++ b/packages/compiler-cli/ngcc/src/packages/entry_point_finder.ts @@ -92,7 +92,7 @@ export class EntryPointFinder { entryPoints.push(...this.getEntryPointsForPackage(packagePath)); // Also check for any nested node_modules in this package - const nestedNodeModulesPath = AbsoluteFsPath.resolve(packagePath, 'node_modules'); + const nestedNodeModulesPath = AbsoluteFsPath.join(packagePath, 'node_modules'); if (this.fs.exists(nestedNodeModulesPath)) { entryPoints.push(...this.walkDirectoryForEntryPoints(nestedNodeModulesPath)); } diff --git a/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts b/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts index f8c9023005..95e33310f3 100644 --- a/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts +++ b/packages/compiler-cli/ngcc/test/integration/ngcc_spec.ts @@ -7,8 +7,9 @@ */ import {AbsoluteFsPath} from '@angular/compiler-cli/src/ngtsc/path'; -import {existsSync, readFileSync, readdirSync, statSync, writeFileSync} from 'fs'; +import {existsSync, readFileSync, readdirSync, statSync, symlinkSync} from 'fs'; import * as mockFs from 'mock-fs'; +import * as path from 'path'; import {getAngularPackagesFromRunfiles, resolveNpmTreeArtifact} from '../../../test/runfile_helpers'; import {NodeJSFileSystem} from '../../src/file_system/node_js_file_system'; @@ -333,10 +334,15 @@ describe('ngcc main()', () => { function createMockFileSystem() { + const typeScriptPath = path.join(process.env.RUNFILES !, 'typescript'); + if (!existsSync(typeScriptPath)) { + symlinkSync(resolveNpmTreeArtifact('typescript'), typeScriptPath, 'junction'); + } + mockFs({ '/node_modules/@angular': loadAngularPackages(), - '/node_modules/rxjs': loadDirectory(resolveNpmTreeArtifact('rxjs', 'index.js')), - '/node_modules/tslib': loadDirectory(resolveNpmTreeArtifact('tslib', 'tslib.js')), + '/node_modules/rxjs': loadDirectory(resolveNpmTreeArtifact('rxjs')), + '/node_modules/tslib': loadDirectory(resolveNpmTreeArtifact('tslib')), '/node_modules/test-package': { 'package.json': '{"name": "test-package", "es2015": "./index.js", "typings": "./index.d.ts"}', // no metadata.json file so not compiled by Angular.