style(ngcc): reformat of ngcc after clang update (#36447)

PR Close #36447
This commit is contained in:
Pete Bacon Darwin
2020-04-06 08:30:08 +01:00
committed by Kara Erickson
parent bfa55162de
commit 74b7a8eaf5
118 changed files with 1386 additions and 1046 deletions

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AbsoluteFsPath, FileSystem, PathSegment, absoluteFrom, getFileSystem} from '../../../../src/ngtsc/file_system';
import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, PathSegment} from '../../../../src/ngtsc/file_system';
import {runInEachFileSystem} from '../../../../src/ngtsc/file_system/testing';
import {EntryPointPackageJson} from '../../../src/packages/entry_point';
import {BackupFileCleaner, NgccDirectoryCleaner, PackageJsonCleaner} from '../../../src/writing/cleaning/cleaning_strategies';
@ -21,9 +21,10 @@ runInEachFileSystem(() => {
});
describe('PackageJsonCleaner', () => {
let packageJsonPath: AbsoluteFsPath;
beforeEach(() => { packageJsonPath = _abs('/node_modules/pkg/package.json'); });
beforeEach(() => {
packageJsonPath = _abs('/node_modules/pkg/package.json');
});
describe('canClean()', () => {
it('should return true if the basename is package.json', () => {
@ -150,7 +151,6 @@ runInEachFileSystem(() => {
});
describe('canClean()', () => {
it('should return true if the file name ends in .__ivy_ngcc_bak and the processed file exists',
() => {
const strategy = new BackupFileCleaner(fs);
@ -192,7 +192,9 @@ runInEachFileSystem(() => {
describe('NgccDirectoryCleaner', () => {
let ivyDirectory: AbsoluteFsPath;
beforeEach(() => { ivyDirectory = _abs('/node_modules/pkg/__ivy_ngcc__'); });
beforeEach(() => {
ivyDirectory = _abs('/node_modules/pkg/__ivy_ngcc__');
});
describe('canClean()', () => {
it('should return true if the path is a directory and is called __ivy_ngcc__', () => {

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AbsoluteFsPath, FileSystem, PathSegment, absoluteFrom, getFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system';
import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, PathSegment} from '@angular/compiler-cli/src/ngtsc/file_system';
import {runInEachFileSystem} from '../../../../src/ngtsc/file_system/testing';
import {CleaningStrategy} from '../../../src/writing/cleaning/cleaning_strategies';

View File

@ -14,7 +14,6 @@ import {MockLogger} from '../helpers/mock_logger';
runInEachFileSystem(() => {
describe('InPlaceFileWriter', () => {
let _: typeof absoluteFrom;
beforeEach(() => {
@ -79,8 +78,8 @@ runInEachFileSystem(() => {
() => fileWriter.writeBundle(
{} as EntryPointBundle,
[{path: absoluteBackupPath, contents: 'MODIFIED BACKED UP'}]))
.toThrowError(
`Tried to overwrite ${absoluteBackupPath}.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.`);
.toThrowError(`Tried to overwrite ${
absoluteBackupPath}.__ivy_ngcc_bak with an ngcc back up file, which is disallowed.`);
});
it('should log an error, and skip writing the file, if the backup file already exists and errorOnFailedEntryPoint is false',
@ -95,7 +94,9 @@ runInEachFileSystem(() => {
expect(fs.readFile(absoluteBackupPath)).toEqual('ORIGINAL ALREADY BACKED UP');
expect(fs.readFile(_(absoluteBackupPath + '.__ivy_ngcc_bak'))).toEqual('BACKED UP');
expect(logger.logs.error).toEqual([[
`Tried to write ${absoluteBackupPath}.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, ${absoluteBackupPath}.\n` +
`Tried to write ${
absoluteBackupPath}.__ivy_ngcc_bak with an ngcc back up file but it already exists so not writing, nor backing up, ${
absoluteBackupPath}.\n` +
`This error may be because two or more entry-points overlap and ngcc has been asked to process some files more than once.\n` +
`You should check other entry-points in this package and set up a config to ignore any that you are not using.`
]]);

View File

@ -5,11 +5,11 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {FileSystem, absoluteFrom, getFileSystem} from '../../../src/ngtsc/file_system';
import {absoluteFrom, FileSystem, getFileSystem} from '../../../src/ngtsc/file_system';
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
import {loadTestFiles} from '../../../test/helpers';
import {NgccConfiguration} from '../../src/packages/configuration';
import {EntryPoint, EntryPointFormat, EntryPointJsonProperty, INCOMPATIBLE_ENTRY_POINT, NO_ENTRY_POINT, getEntryPointInfo} from '../../src/packages/entry_point';
import {EntryPoint, EntryPointFormat, EntryPointJsonProperty, getEntryPointInfo, INCOMPATIBLE_ENTRY_POINT, NO_ENTRY_POINT} from '../../src/packages/entry_point';
import {EntryPointBundle, makeEntryPointBundle} from '../../src/packages/entry_point_bundle';
import {FileWriter} from '../../src/writing/file_writer';
import {NewEntryPointFileWriter} from '../../src/writing/new_entry_point_file_writer';
@ -19,7 +19,6 @@ import {loadPackageJson} from '../packages/entry_point_spec';
runInEachFileSystem(() => {
describe('NewEntryPointFileWriter', () => {
let _: typeof absoluteFrom;
let fs: FileSystem;
let fileWriter: FileWriter;
@ -107,7 +106,7 @@ runInEachFileSystem(() => {
fs, logger, /* errorOnFailedEntryPoint */ true, new DirectPackageJsonUpdater(fs));
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, logger, _('/node_modules/test'), _('/node_modules/test')) !;
fs, config, logger, _('/node_modules/test'), _('/node_modules/test'))!;
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
@ -247,7 +246,7 @@ runInEachFileSystem(() => {
fs, logger, /* errorOnFailedEntryPoint */ true, new DirectPackageJsonUpdater(fs));
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, logger, _('/node_modules/test'), _('/node_modules/test/a')) !;
fs, config, logger, _('/node_modules/test'), _('/node_modules/test/a'))!;
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
@ -376,7 +375,7 @@ runInEachFileSystem(() => {
fs, logger, /* errorOnFailedEntryPoint */ true, new DirectPackageJsonUpdater(fs));
const config = new NgccConfiguration(fs, _('/'));
const result = getEntryPointInfo(
fs, config, new MockLogger(), _('/node_modules/test'), _('/node_modules/test/b')) !;
fs, config, new MockLogger(), _('/node_modules/test'), _('/node_modules/test/b'))!;
if (result === NO_ENTRY_POINT || result === INCOMPATIBLE_ENTRY_POINT) {
return fail(`Expected an entry point but got ${result}`);
}
@ -501,6 +500,6 @@ runInEachFileSystem(() => {
fs: FileSystem, entryPoint: EntryPoint, formatProperty: EntryPointJsonProperty,
format: EntryPointFormat): EntryPointBundle {
return makeEntryPointBundle(
fs, entryPoint, entryPoint.packageJson[formatProperty] !, false, format, true);
fs, entryPoint, entryPoint.packageJson[formatProperty]!, false, format, true);
}
});

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {AbsoluteFsPath, FileSystem, absoluteFrom, getFileSystem} from '../../../src/ngtsc/file_system';
import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem} from '../../../src/ngtsc/file_system';
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
import {loadTestFiles} from '../../../test/helpers';
import {JsonObject} from '../../src/packages/entry_point';