diff --git a/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts b/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts index 39c33405f8..be5e49ec68 100644 --- a/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts +++ b/packages/compiler-cli/ngcc/src/analysis/decoration_analyzer.ts @@ -58,7 +58,7 @@ export class DecorationAnalyzer { private host = this.bundle.src.host; private typeChecker = this.bundle.src.program.getTypeChecker(); private rootDirs = this.bundle.rootDirs; - private packagePath = this.bundle.entryPoint.package; + private packagePath = this.bundle.entryPoint.packagePath; private isCore = this.bundle.isCore; private compilerOptions = this.tsConfig !== null ? this.tsConfig.options : {}; diff --git a/packages/compiler-cli/ngcc/src/dependencies/dependency_resolver.ts b/packages/compiler-cli/ngcc/src/dependencies/dependency_resolver.ts index aff2dda3ef..05f19c2a53 100644 --- a/packages/compiler-cli/ngcc/src/dependencies/dependency_resolver.ts +++ b/packages/compiler-cli/ngcc/src/dependencies/dependency_resolver.ts @@ -225,7 +225,7 @@ export class DependencyResolver { private filterIgnorableDeepImports(entryPoint: EntryPoint, deepImports: Set): AbsoluteFsPath[] { const version = (entryPoint.packageJson.version || null) as string | null; - const packageConfig = this.config.getPackageConfig(entryPoint.package, version); + const packageConfig = this.config.getPackageConfig(entryPoint.packagePath, version); const matchers = packageConfig.ignorableDeepImportMatchers || []; return Array.from(deepImports) .filter(deepImport => !matchers.some(matcher => matcher.test(deepImport))); diff --git a/packages/compiler-cli/ngcc/src/packages/entry_point.ts b/packages/compiler-cli/ngcc/src/packages/entry_point.ts index de6a2bc624..6ac2b37eae 100644 --- a/packages/compiler-cli/ngcc/src/packages/entry_point.ts +++ b/packages/compiler-cli/ngcc/src/packages/entry_point.ts @@ -24,14 +24,14 @@ export type EntryPointFormat = 'esm5'|'esm2015'|'umd'|'commonjs'; * to each of the possible entry-point formats. */ export interface EntryPoint extends JsonObject { - /** The name of the package (e.g. `@angular/core`). */ + /** The name of the entry-point (e.g. `@angular/core` or `@angular/common/http`). */ name: string; - /** The parsed package.json file for this entry-point. */ - packageJson: EntryPointPackageJson; - /** The path to the package that contains this entry-point. */ - package: AbsoluteFsPath; /** The path to this entry point. */ path: AbsoluteFsPath; + /** The path to the package that contains this entry-point. */ + packagePath: AbsoluteFsPath; + /** The parsed package.json file for this entry-point. */ + packageJson: EntryPointPackageJson; /** The path to a typings (.d.ts) file for this entry-point. */ typings: AbsoluteFsPath; /** Is this EntryPoint compiled with the Angular View Engine compiler? */ @@ -166,9 +166,9 @@ export function getEntryPointInfo( const entryPointInfo: EntryPoint = { name: entryPointPackageJson.name, - packageJson: entryPointPackageJson, - package: packagePath, path: entryPointPath, + packagePath, + packageJson: entryPointPackageJson, typings: resolve(entryPointPath, typings), compiledByAngular, ignoreMissingDependencies: diff --git a/packages/compiler-cli/ngcc/src/packages/entry_point_bundle.ts b/packages/compiler-cli/ngcc/src/packages/entry_point_bundle.ts index bd4cb5733c..41ba3d33ea 100644 --- a/packages/compiler-cli/ngcc/src/packages/entry_point_bundle.ts +++ b/packages/compiler-cli/ngcc/src/packages/entry_point_bundle.ts @@ -47,7 +47,7 @@ export function makeEntryPointBundle( mirrorDtsFromSrc: boolean = false, enableI18nLegacyMessageIdFormat: boolean = true): EntryPointBundle { // Create the TS program and necessary helpers. - const rootDir = entryPoint.package; + const rootDir = entryPoint.packagePath; const options: ts .CompilerOptions = {allowJs: true, maxNodeModuleJsDepth: Infinity, rootDir, ...pathMappings}; const srcHost = new NgccSourcesCompilerHost(fs, options, entryPoint.path); @@ -57,12 +57,12 @@ export function makeEntryPointBundle( const absFormatPath = fs.resolve(entryPoint.path, formatPath); const typingsPath = fs.resolve(entryPoint.path, entryPoint.typings); const src = makeBundleProgram( - fs, isCore, entryPoint.package, absFormatPath, 'r3_symbols.js', options, srcHost); + fs, isCore, entryPoint.packagePath, absFormatPath, 'r3_symbols.js', options, srcHost); const additionalDtsFiles = transformDts && mirrorDtsFromSrc ? computePotentialDtsFilesFromJsFiles(fs, src.program, absFormatPath, typingsPath) : []; const dts = transformDts ? makeBundleProgram( - fs, isCore, entryPoint.package, typingsPath, 'r3_symbols.d.ts', + fs, isCore, entryPoint.packagePath, typingsPath, 'r3_symbols.d.ts', options, dtsHost, additionalDtsFiles) : null; const isFlatCore = isCore && src.r3SymbolsFile === null; diff --git a/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts b/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts index 7855152ce9..09d3a2265b 100644 --- a/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts +++ b/packages/compiler-cli/ngcc/src/packages/entry_point_manifest.ts @@ -126,7 +126,7 @@ export class EntryPointManifest { lockFileHash: lockFileHash, entryPointPaths: entryPoints.map(e => { const entryPointPaths: EntryPointPaths = [ - this.fs.relative(basePath, e.entryPoint.package), + this.fs.relative(basePath, e.entryPoint.packagePath), this.fs.relative(basePath, e.entryPoint.path), ]; // Only add depInfo arrays if needed. diff --git a/packages/compiler-cli/ngcc/src/packages/transformer.ts b/packages/compiler-cli/ngcc/src/packages/transformer.ts index baa4cf7b84..9df8b25263 100644 --- a/packages/compiler-cli/ngcc/src/packages/transformer.ts +++ b/packages/compiler-cli/ngcc/src/packages/transformer.ts @@ -148,7 +148,7 @@ export class Transformer { const referencesRegistry = new NgccReferencesRegistry(reflectionHost); const switchMarkerAnalyzer = - new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.package); + new SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath); const switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program); const diagnostics: ts.Diagnostic[] = []; diff --git a/packages/compiler-cli/ngcc/src/writing/cleaning/package_cleaner.ts b/packages/compiler-cli/ngcc/src/writing/cleaning/package_cleaner.ts index 268f01f413..872f180cef 100644 --- a/packages/compiler-cli/ngcc/src/writing/cleaning/package_cleaner.ts +++ b/packages/compiler-cli/ngcc/src/writing/cleaning/package_cleaner.ts @@ -63,7 +63,7 @@ export function cleanOutdatedPackages(fileSystem: FileSystem, entryPoints: Entry const packagesToClean = new Set(); for (const entryPoint of entryPoints) { if (needsCleaning(entryPoint.packageJson)) { - packagesToClean.add(entryPoint.package); + packagesToClean.add(entryPoint.packagePath); } } diff --git a/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts b/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts index 4c2c3fab5a..8af6835edc 100644 --- a/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts +++ b/packages/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.ts @@ -39,9 +39,9 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter { formatProperties: EntryPointJsonProperty[]) { // The new folder is at the root of the overall package const entryPoint = bundle.entryPoint; - const ngccFolder = join(entryPoint.package, NGCC_DIRECTORY); - this.copyBundle(bundle, entryPoint.package, ngccFolder); - transformedFiles.forEach(file => this.writeFile(file, entryPoint.package, ngccFolder)); + const ngccFolder = join(entryPoint.packagePath, NGCC_DIRECTORY); + this.copyBundle(bundle, entryPoint.packagePath, ngccFolder); + transformedFiles.forEach(file => this.writeFile(file, entryPoint.packagePath, ngccFolder)); this.updatePackageJson(entryPoint, formatProperties, ngccFolder); } @@ -59,7 +59,7 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter { // Revert the transformed files. for (const filePath of transformedFilePaths) { - this.revertFile(filePath, entryPoint.package); + this.revertFile(filePath, entryPoint.packagePath); } // Revert any changes to `package.json`. @@ -118,7 +118,7 @@ export class NewEntryPointFileWriter extends InPlaceFileWriter { const oldFormatProp = formatProperties[0]!; const oldFormatPath = packageJson[oldFormatProp]!; const oldAbsFormatPath = join(entryPoint.path, oldFormatPath); - const newAbsFormatPath = join(ngccFolder, relative(entryPoint.package, oldAbsFormatPath)); + const newAbsFormatPath = join(ngccFolder, relative(entryPoint.packagePath, oldAbsFormatPath)); const newFormatPath = relative(entryPoint.path, newAbsFormatPath); // Update all properties in `package.json` (both in memory and on disk). diff --git a/packages/compiler-cli/ngcc/test/analysis/switch_marker_analyzer_spec.ts b/packages/compiler-cli/ngcc/test/analysis/switch_marker_analyzer_spec.ts index 7e49df912e..e04d3b11eb 100644 --- a/packages/compiler-cli/ngcc/test/analysis/switch_marker_analyzer_spec.ts +++ b/packages/compiler-cli/ngcc/test/analysis/switch_marker_analyzer_spec.ts @@ -82,7 +82,7 @@ runInEachFileSystem(() => { 'test', 'esm2015', false, [_('/node_modules/test/entrypoint.js')]); const program = bundle.src.program; const host = new Esm2015ReflectionHost(new MockLogger(), false, bundle.src); - const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.package); + const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath); const analysis = analyzer.analyzeProgram(program); const entrypoint = getSourceFileOrError(program, _('/node_modules/test/entrypoint.js')); @@ -113,7 +113,7 @@ runInEachFileSystem(() => { 'test', 'esm2015', false, [_('/node_modules/test/entrypoint.js')]); const program = bundle.src.program; const host = new Esm2015ReflectionHost(new MockLogger(), false, bundle.src); - const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.package); + const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath); const analysis = analyzer.analyzeProgram(program); const x = getSourceFileOrError(program, _('/node_modules/other/x.js')); @@ -126,7 +126,7 @@ runInEachFileSystem(() => { 'test', 'esm2015', false, [_('/node_modules/test/entrypoint.js')]); const program = bundle.src.program; const host = new Esm2015ReflectionHost(new MockLogger(), false, bundle.src); - const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.package); + const analyzer = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath); const analysis = analyzer.analyzeProgram(program); const x = getSourceFileOrError(program, _('/node_modules/test/node_modules/nested/e.js')); diff --git a/packages/compiler-cli/ngcc/test/dependencies/dependency_resolver_spec.ts b/packages/compiler-cli/ngcc/test/dependencies/dependency_resolver_spec.ts index e61baf1194..a8e9bad12e 100644 --- a/packages/compiler-cli/ngcc/test/dependencies/dependency_resolver_spec.ts +++ b/packages/compiler-cli/ngcc/test/dependencies/dependency_resolver_spec.ts @@ -60,52 +60,52 @@ runInEachFileSystem(() => { first = { name: 'first', path: _('/first'), - package: _('/first'), + packagePath: _('/first'), packageJson: {esm5: './index.js'}, + typings: _('/first/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/first/index.d.ts'), } as EntryPoint; second = { path: _('/second'), - package: _('/second'), + packagePath: _('/second'), packageJson: {esm2015: './sub/index.js'}, + typings: _('/second/sub/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/second/sub/index.d.ts'), } as EntryPoint; third = { path: _('/third'), - package: _('/third'), + packagePath: _('/third'), packageJson: {fesm5: './index.js'}, + typings: _('/third/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/third/index.d.ts'), } as EntryPoint; fourth = { path: _('/fourth'), - package: _('/fourth'), + packagePath: _('/fourth'), packageJson: {fesm2015: './sub2/index.js'}, + typings: _('/fourth/sub2/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/fourth/sub2/index.d.ts'), } as EntryPoint; fifth = { path: _('/fifth'), - package: _('/fifth'), + packagePath: _('/fifth'), packageJson: {module: './index.js'}, + typings: _('/fifth/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/fifth/index.d.ts'), } as EntryPoint; sixthIgnoreMissing = { path: _('/sixth'), - package: _('/sixth'), + packagePath: _('/sixth'), packageJson: {module: './index.js'}, + typings: _('/sixth/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: true, - typings: _('/sixth/index.d.ts'), } as EntryPoint; dependencies = { @@ -291,11 +291,11 @@ runInEachFileSystem(() => { const testEntryPoint = { name: 'test-package', path: _('/project/node_modules/test-package'), - package: _('/project/node_modules/test-package'), + packagePath: _('/project/node_modules/test-package'), packageJson: {esm5: './index.js'}, + typings: _('/project/node_modules/test-package/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, - typings: _('/project/node_modules/test-package/index.d.ts'), } as EntryPoint; const result = resolver.sortEntryPointsByDependency( diff --git a/packages/compiler-cli/ngcc/test/entry_point_finder/directory_walker_entry_point_finder_spec.ts b/packages/compiler-cli/ngcc/test/entry_point_finder/directory_walker_entry_point_finder_spec.ts index a5f8739f6c..89a55c7bb7 100644 --- a/packages/compiler-cli/ngcc/test/entry_point_finder/directory_walker_entry_point_finder_spec.ts +++ b/packages/compiler-cli/ngcc/test/entry_point_finder/directory_walker_entry_point_finder_spec.ts @@ -451,7 +451,8 @@ runInEachFileSystem(() => { function dumpEntryPointPaths( basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] { - return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]); + return entryPoints.map( + x => [relative(basePath, x.packagePath), relative(basePath, x.path)]); } }); }); diff --git a/packages/compiler-cli/ngcc/test/entry_point_finder/program_based_entry_point_finder_spec.ts b/packages/compiler-cli/ngcc/test/entry_point_finder/program_based_entry_point_finder_spec.ts index cb2deb2319..047d411f98 100644 --- a/packages/compiler-cli/ngcc/test/entry_point_finder/program_based_entry_point_finder_spec.ts +++ b/packages/compiler-cli/ngcc/test/entry_point_finder/program_based_entry_point_finder_spec.ts @@ -159,7 +159,8 @@ runInEachFileSystem(() => { function dumpEntryPointPaths( basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] { - return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]); + return entryPoints.map( + x => [relative(basePath, x.packagePath), relative(basePath, x.path)]); } }); }); diff --git a/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts b/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts index ba501f9427..71c93c2d40 100644 --- a/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts +++ b/packages/compiler-cli/ngcc/test/entry_point_finder/targeted_entry_point_finder_spec.ts @@ -318,7 +318,7 @@ runInEachFileSystem(() => { const entryPoint = entryPoints[0]; expect(entryPoint.name).toEqual('secondary'); expect(entryPoint.path).toEqual(_Abs('/path_mapped/dist/primary/secondary')); - expect(entryPoint.package).toEqual(_Abs('/path_mapped/dist/primary')); + expect(entryPoint.packagePath).toEqual(_Abs('/path_mapped/dist/primary')); }); it('should correctly compute an entry-point whose path starts with the same string as another entry-point, via pathMappings', @@ -381,7 +381,8 @@ runInEachFileSystem(() => { function dumpEntryPointPaths( basePath: AbsoluteFsPath, entryPoints: EntryPoint[]): [string, string][] { - return entryPoints.map(x => [relative(basePath, x.package), relative(basePath, x.path)]); + return entryPoints.map( + x => [relative(basePath, x.packagePath), relative(basePath, x.path)]); } }); diff --git a/packages/compiler-cli/ngcc/test/helpers/utils.ts b/packages/compiler-cli/ngcc/test/helpers/utils.ts index 353ea13d4c..baa4d2ec28 100644 --- a/packages/compiler-cli/ngcc/test/helpers/utils.ts +++ b/packages/compiler-cli/ngcc/test/helpers/utils.ts @@ -21,9 +21,9 @@ export function makeTestEntryPoint( entryPointName: string, packageName: string = entryPointName, config?: TestConfig): EntryPoint { return { name: entryPointName, - packageJson: {name: entryPointName}, - package: absoluteFrom(`/node_modules/${packageName}`), path: absoluteFrom(`/node_modules/${entryPointName}`), + packagePath: absoluteFrom(`/node_modules/${packageName}`), + packageJson: {name: entryPointName}, typings: absoluteFrom(`/node_modules/${entryPointName}/index.d.ts`), compiledByAngular: true, ignoreMissingDependencies: false, @@ -43,8 +43,9 @@ export function makeTestEntryPointBundle( enableI18nLegacyMessageIdFormat = false): EntryPointBundle { const entryPoint = makeTestEntryPoint(packageName, packageName, config); const src = makeTestBundleProgram(srcRootNames[0], isCore); - const dts = - dtsRootNames ? makeTestDtsBundleProgram(dtsRootNames[0], entryPoint.package, isCore) : null; + const dts = dtsRootNames ? + makeTestDtsBundleProgram(dtsRootNames[0], entryPoint.packagePath, isCore) : + null; const isFlatCore = isCore && src.r3SymbolsFile === null; return { entryPoint, diff --git a/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts b/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts index 11ebc0d41f..81711a1140 100644 --- a/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts +++ b/packages/compiler-cli/ngcc/test/packages/entry_point_bundle_spec.ts @@ -167,9 +167,9 @@ runInEachFileSystem(() => { const fs = getFileSystem(); const entryPoint: EntryPoint = { name: 'test', - packageJson: {name: 'test'}, - package: absoluteFrom('/node_modules/test'), path: absoluteFrom('/node_modules/test'), + packagePath: absoluteFrom('/node_modules/test'), + packageJson: {name: 'test'}, typings: absoluteFrom('/node_modules/test/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, @@ -217,9 +217,9 @@ runInEachFileSystem(() => { const fs = getFileSystem(); const entryPoint: EntryPoint = { name: 'test', - packageJson: {name: 'test'}, - package: absoluteFrom('/node_modules/test'), path: absoluteFrom('/node_modules/test'), + packagePath: absoluteFrom('/node_modules/test'), + packageJson: {name: 'test'}, typings: absoluteFrom('/node_modules/test/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, @@ -239,9 +239,9 @@ runInEachFileSystem(() => { const fs = getFileSystem(); const entryPoint: EntryPoint = { name: 'internal', - packageJson: {name: 'internal'}, - package: absoluteFrom('/node_modules/internal'), path: absoluteFrom('/node_modules/internal'), + packagePath: absoluteFrom('/node_modules/internal'), + packageJson: {name: 'internal'}, typings: absoluteFrom('/node_modules/internal/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, @@ -261,9 +261,9 @@ runInEachFileSystem(() => { const fs = getFileSystem(); const entryPoint: EntryPoint = { name: 'test', - packageJson: {name: 'test'}, - package: absoluteFrom('/node_modules/test'), path: absoluteFrom('/node_modules/test'), + packagePath: absoluteFrom('/node_modules/test'), + packageJson: {name: 'test'}, typings: absoluteFrom('/node_modules/test/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, @@ -284,9 +284,9 @@ runInEachFileSystem(() => { const fs = getFileSystem(); const entryPoint: EntryPoint = { name: 'secondary', - packageJson: {name: 'secondary'}, - package: absoluteFrom('/node_modules/primary'), path: absoluteFrom('/node_modules/primary/secondary'), + packagePath: absoluteFrom('/node_modules/primary'), + packageJson: {name: 'secondary'}, typings: absoluteFrom('/node_modules/primary/secondary/index.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, diff --git a/packages/compiler-cli/ngcc/test/packages/entry_point_manifest_spec.ts b/packages/compiler-cli/ngcc/test/packages/entry_point_manifest_spec.ts index ee93246df8..4c3cb4b399 100644 --- a/packages/compiler-cli/ngcc/test/packages/entry_point_manifest_spec.ts +++ b/packages/compiler-cli/ngcc/test/packages/entry_point_manifest_spec.ts @@ -148,9 +148,9 @@ runInEachFileSystem(() => { expect(entryPoints).toEqual([{ entryPoint: { name: 'some_package/valid_entry_point', - packageJson: jasmine.any(Object), - package: _Abs('/project/node_modules/some_package'), path: _Abs('/project/node_modules/some_package/valid_entry_point'), + packagePath: _Abs('/project/node_modules/some_package'), + packageJson: jasmine.any(Object), typings: _Abs('/project/node_modules/some_package/valid_entry_point/valid_entry_point.d.ts'), compiledByAngular: true, @@ -298,8 +298,8 @@ runInEachFileSystem(() => { fs.writeFile(_Abs('/project/package-lock.json'), 'LOCK FILE CONTENTS'); const entryPoint1: EntryPointWithDependencies = { entryPoint: { - package: _Abs('/project/node_modules/package-1/'), path: _Abs('/project/node_modules/package-1/'), + packagePath: _Abs('/project/node_modules/package-1/'), } as any, depInfo: { dependencies: new Set([ @@ -312,8 +312,8 @@ runInEachFileSystem(() => { }; const entryPoint2: EntryPointWithDependencies = { entryPoint: { - package: _Abs('/project/node_modules/package-2/'), path: _Abs('/project/node_modules/package-2/entry-point'), + packagePath: _Abs('/project/node_modules/package-2/'), } as any, depInfo: { dependencies: new Set(), diff --git a/packages/compiler-cli/ngcc/test/packages/entry_point_spec.ts b/packages/compiler-cli/ngcc/test/packages/entry_point_spec.ts index 4a9a0d9028..3e0ad554b3 100644 --- a/packages/compiler-cli/ngcc/test/packages/entry_point_spec.ts +++ b/packages/compiler-cli/ngcc/test/packages/entry_point_spec.ts @@ -44,11 +44,11 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/valid_entry_point')); expect(entryPoint).toEqual({ name: 'some_package/valid_entry_point', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/valid_entry_point'), + packagePath: SOME_PACKAGE, + packageJson: loadPackageJson(fs, '/project/node_modules/some_package/valid_entry_point'), typings: _(`/project/node_modules/some_package/valid_entry_point/valid_entry_point.d.ts`), - packageJson: loadPackageJson(fs, '/project/node_modules/some_package/valid_entry_point'), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -107,10 +107,10 @@ runInEachFileSystem(() => { }; expect(entryPoint).toEqual({ name: 'some_package/valid_entry_point', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/valid_entry_point'), - typings: _('/project/node_modules/some_package/valid_entry_point/some_other.d.ts'), + packagePath: SOME_PACKAGE, packageJson: overriddenPackageJson, + typings: _('/project/node_modules/some_package/valid_entry_point/some_other.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -155,11 +155,11 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/missing_package_json')); expect(entryPoint).toEqual({ name: 'some_package/missing_package_json', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/missing_package_json'), + packagePath: SOME_PACKAGE, + packageJson: {name: 'some_package/missing_package_json', ...override}, typings: _( '/project/node_modules/some_package/missing_package_json/missing_package_json.d.ts'), - packageJson: {name: 'some_package/missing_package_json', ...override}, compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -236,10 +236,10 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/missing_typings')); expect(entryPoint).toEqual({ name: 'some_package/missing_typings', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/missing_typings'), - typings: _(`/project/node_modules/some_package/missing_typings/${typingsPath}.d.ts`), + packagePath: SOME_PACKAGE, packageJson: loadPackageJson(fs, '/project/node_modules/some_package/missing_typings'), + typings: _(`/project/node_modules/some_package/missing_typings/${typingsPath}.d.ts`), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -261,10 +261,10 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/missing_metadata')); expect(entryPoint).toEqual({ name: 'some_package/missing_metadata', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/missing_metadata'), - typings: _(`/project/node_modules/some_package/missing_metadata/missing_metadata.d.ts`), + packagePath: SOME_PACKAGE, packageJson: loadPackageJson(fs, '/project/node_modules/some_package/missing_metadata'), + typings: _(`/project/node_modules/some_package/missing_metadata/missing_metadata.d.ts`), compiledByAngular: false, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -290,10 +290,10 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/missing_metadata')); expect(entryPoint).toEqual({ name: 'some_package/missing_metadata', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/missing_metadata'), - typings: _('/project/node_modules/some_package/missing_metadata/missing_metadata.d.ts'), + packagePath: SOME_PACKAGE, packageJson: loadPackageJson(fs, '/project/node_modules/some_package/missing_metadata'), + typings: _('/project/node_modules/some_package/missing_metadata/missing_metadata.d.ts'), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -318,12 +318,12 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/types_rather_than_typings')); expect(entryPoint).toEqual({ name: 'some_package/types_rather_than_typings', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/types_rather_than_typings'), - typings: _( - `/project/node_modules/some_package/types_rather_than_typings/types_rather_than_typings.d.ts`), + packagePath: SOME_PACKAGE, packageJson: loadPackageJson(fs, '/project/node_modules/some_package/types_rather_than_typings'), + typings: _( + `/project/node_modules/some_package/types_rather_than_typings/types_rather_than_typings.d.ts`), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, @@ -353,10 +353,10 @@ runInEachFileSystem(() => { _('/project/node_modules/some_package/material_style')); expect(entryPoint).toEqual({ name: 'some_package/material_style', - package: SOME_PACKAGE, path: _('/project/node_modules/some_package/material_style'), - typings: _(`/project/node_modules/some_package/material_style/material_style.d.ts`), + packagePath: SOME_PACKAGE, packageJson: loadPackageJson(fs, '/project/node_modules/some_package/material_style'), + typings: _(`/project/node_modules/some_package/material_style/material_style.d.ts`), compiledByAngular: true, ignoreMissingDependencies: false, generateDeepReexports: false, diff --git a/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts index d78ba9d4e5..4439902ba4 100644 --- a/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/commonjs_rendering_formatter_spec.ts @@ -156,7 +156,7 @@ exports.D = D; const referencesRegistry = new NgccReferencesRegistry(host); const decorationAnalyses = new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram(); - const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host, bundle.entryPoint.package) + const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath) .analyzeProgram(bundle.src.program); const renderer = new CommonJsRenderingFormatter(host, false); const importManager = new ImportManager(new NoopImportRewriter(), 'i'); diff --git a/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts index ee74ce34b3..695fdcc03f 100644 --- a/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/esm5_rendering_formatter_spec.ts @@ -33,8 +33,8 @@ function setup(file: {name: AbsoluteFsPath, contents: string}) { const referencesRegistry = new NgccReferencesRegistry(host); const decorationAnalyses = new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram(); - const switchMarkerAnalyses = - new SwitchMarkerAnalyzer(host, bundle.entryPoint.package).analyzeProgram(bundle.src.program); + const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath) + .analyzeProgram(bundle.src.program); const renderer = new Esm5RenderingFormatter(host, false); const importManager = new ImportManager(new NoopImportRewriter(), IMPORT_PREFIX); return { diff --git a/packages/compiler-cli/ngcc/test/rendering/esm_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/esm_rendering_formatter_spec.ts index 7ad92a84c7..bfa234439a 100644 --- a/packages/compiler-cli/ngcc/test/rendering/esm_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/esm_rendering_formatter_spec.ts @@ -38,8 +38,8 @@ function setup(files: TestFile[], dtsFiles?: TestFile[]) { const referencesRegistry = new NgccReferencesRegistry(host); const decorationAnalyses = new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram(); - const switchMarkerAnalyses = - new SwitchMarkerAnalyzer(host, bundle.entryPoint.package).analyzeProgram(bundle.src.program); + const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath) + .analyzeProgram(bundle.src.program); const renderer = new EsmRenderingFormatter(host, false); const importManager = new ImportManager(new NoopImportRewriter(), IMPORT_PREFIX); return { diff --git a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts index e8011f0648..d32c194d13 100644 --- a/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/renderer_spec.ts @@ -90,8 +90,8 @@ function createTestRenderer( const referencesRegistry = new NgccReferencesRegistry(host); const decorationAnalyses = new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram(); - const switchMarkerAnalyses = - new SwitchMarkerAnalyzer(host, bundle.entryPoint.package).analyzeProgram(bundle.src.program); + const switchMarkerAnalyses = new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath) + .analyzeProgram(bundle.src.program); const privateDeclarationsAnalyses = new PrivateDeclarationsAnalyzer(host, referencesRegistry).analyzeProgram(bundle.src.program); const testFormatter = new TestRenderingFormatter(); diff --git a/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts b/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts index 05c0c30859..e1f98f57a6 100644 --- a/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts +++ b/packages/compiler-cli/ngcc/test/rendering/umd_rendering_formatter_spec.ts @@ -34,7 +34,7 @@ function setup(file: TestFile) { const decorationAnalyses = new DecorationAnalyzer(fs, bundle, host, referencesRegistry).analyzeProgram(); const switchMarkerAnalyses = - new SwitchMarkerAnalyzer(host, bundle.entryPoint.package).analyzeProgram(src.program); + new SwitchMarkerAnalyzer(host, bundle.entryPoint.packagePath).analyzeProgram(src.program); const renderer = new UmdRenderingFormatter(host, false); const importManager = new ImportManager(new NoopImportRewriter(), 'i'); return { diff --git a/packages/compiler-cli/ngcc/test/writing/new_entry_point_file_writer_spec.ts b/packages/compiler-cli/ngcc/test/writing/new_entry_point_file_writer_spec.ts index 439f3c72dd..d1ae0ab40c 100644 --- a/packages/compiler-cli/ngcc/test/writing/new_entry_point_file_writer_spec.ts +++ b/packages/compiler-cli/ngcc/test/writing/new_entry_point_file_writer_spec.ts @@ -577,7 +577,7 @@ runInEachFileSystem(() => { it('should revert changes to `package.json`', () => { const entryPoint = esm5bundle.entryPoint; - const packageJsonPath = join(entryPoint.package, 'package.json'); + const packageJsonPath = join(entryPoint.packagePath, 'package.json'); fileWriter.writeBundle( esm5bundle,