refactor(ngcc): rename `EntryPoint#package` to `EntryPoint#packagePath` (#37040)

Rename the `package` property to `packagePath` on the `EntryPoint`
interface. This makes it more clear that the `packagePath` property
holds the absolute path to the containing package (similar to how `path`
holds the path to the entry-point). This will also align with the
`packageName` property that will be added in a subsequent commit.

This commit also re-orders the `EntryPoint` properties to group related
properties together and to match the order of properties on instances
with that on the interface.

PR Close #37040
This commit is contained in:
George Kalpakas 2020-06-08 22:04:28 +03:00 committed by Misko Hevery
parent e7a0e87c41
commit 8197557fcf
23 changed files with 89 additions and 85 deletions

View File

@ -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 : {};

View File

@ -225,7 +225,7 @@ export class DependencyResolver {
private filterIgnorableDeepImports(entryPoint: EntryPoint, deepImports: Set<AbsoluteFsPath>):
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)));

View File

@ -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:

View File

@ -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;

View File

@ -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.

View File

@ -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[] = [];

View File

@ -63,7 +63,7 @@ export function cleanOutdatedPackages(fileSystem: FileSystem, entryPoints: Entry
const packagesToClean = new Set<AbsoluteFsPath>();
for (const entryPoint of entryPoints) {
if (needsCleaning(entryPoint.packageJson)) {
packagesToClean.add(entryPoint.package);
packagesToClean.add(entryPoint.packagePath);
}
}

View File

@ -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).

View File

@ -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'));

View File

@ -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(

View File

@ -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)]);
}
});
});

View File

@ -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)]);
}
});
});

View File

@ -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)]);
}
});

View File

@ -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,

View File

@ -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,

View File

@ -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(),

View File

@ -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,

View File

@ -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');

View File

@ -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 {

View File

@ -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 {

View File

@ -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();

View File

@ -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 {

View File

@ -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,