style(ngcc): reformat of ngcc after clang update (#36447)
PR Close #36447
This commit is contained in:

committed by
Kara Erickson

parent
c8bef1259c
commit
8be8466a00
@ -387,7 +387,7 @@ runInEachFileSystem(() => {
|
||||
reExportsWithoutRequire?: string[];
|
||||
}
|
||||
|
||||
function commonJs(importsPerType: ImportsPerType | string[], exportNames: string[] = []): string {
|
||||
function commonJs(importsPerType: ImportsPerType|string[], exportNames: string[] = []): string {
|
||||
if (Array.isArray(importsPerType)) {
|
||||
importsPerType = {varDeclaration: importsPerType};
|
||||
}
|
||||
@ -414,8 +414,9 @@ runInEachFileSystem(() => {
|
||||
} = importsPerType;
|
||||
|
||||
// var foo = require('...');
|
||||
importsOfTypeVarDeclaration.forEach(
|
||||
p => { importStatements.push(`var ${pathToVarName(p)} = require('${p}');`); });
|
||||
importsOfTypeVarDeclaration.forEach(p => {
|
||||
importStatements.push(`var ${pathToVarName(p)} = require('${p}');`);
|
||||
});
|
||||
|
||||
// var foo = require('...'), bar = require('...');
|
||||
importsOfTypeVarDeclarations.forEach(pp => {
|
||||
@ -424,8 +425,9 @@ runInEachFileSystem(() => {
|
||||
});
|
||||
|
||||
// exports.foo = require('...');
|
||||
importsOfTypePropAssignment.forEach(
|
||||
p => { importStatements.push(`exports.${pathToVarName(p)} = require('${p}');`); });
|
||||
importsOfTypePropAssignment.forEach(p => {
|
||||
importStatements.push(`exports.${pathToVarName(p)} = require('${p}');`);
|
||||
});
|
||||
|
||||
// module.exports = {foo: require('...')};
|
||||
const propAssignments =
|
||||
@ -434,15 +436,19 @@ runInEachFileSystem(() => {
|
||||
importStatements.push(`module.exports = {${propAssignments}\n};`);
|
||||
|
||||
// require('...');
|
||||
importsOfTypeForSideEffects.forEach(p => { importStatements.push(`require('${p}');`); });
|
||||
importsOfTypeForSideEffects.forEach(p => {
|
||||
importStatements.push(`require('${p}');`);
|
||||
});
|
||||
|
||||
// __export(require('...'));
|
||||
importsOfTypeReExportsWithEmittedHelper.forEach(
|
||||
p => { importStatements.push(`__export(require('${p}'));`); });
|
||||
importsOfTypeReExportsWithEmittedHelper.forEach(p => {
|
||||
importStatements.push(`__export(require('${p}'));`);
|
||||
});
|
||||
|
||||
// tslib_1.__exportStar(require('...'), exports);
|
||||
importsOfTypeReExportsWithImportedHelper.forEach(
|
||||
p => { importStatements.push(`tslib_1.__exportStar(require('${p}'), exports);`); });
|
||||
importsOfTypeReExportsWithImportedHelper.forEach(p => {
|
||||
importStatements.push(`tslib_1.__exportStar(require('${p}'), exports);`);
|
||||
});
|
||||
|
||||
// var foo = require('...');
|
||||
// __export(foo);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
import {DepGraph} from 'dependency-graph';
|
||||
|
||||
import {AbsoluteFsPath, FileSystem, absoluteFrom, getFileSystem, relativeFrom} from '../../../src/ngtsc/file_system';
|
||||
import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, relativeFrom} from '../../../src/ngtsc/file_system';
|
||||
import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing';
|
||||
import {DependencyInfo} from '../../src/dependencies/dependency_host';
|
||||
import {DependencyResolver, SortedEntryPointsInfo} from '../../src/dependencies/dependency_resolver';
|
||||
@ -254,7 +254,8 @@ runInEachFileSystem(() => {
|
||||
const result = resolver.sortEntryPointsByDependency([first]);
|
||||
expect(result.entryPoints).toEqual([first]);
|
||||
expect(logger.logs.warn).toEqual([[
|
||||
`Entry point 'first' contains deep imports into '${_('/deep/one')}'. This is probably not a problem, but may cause the compilation of entry points to be out of order.`
|
||||
`Entry point 'first' contains deep imports into '${
|
||||
_('/deep/one')}'. This is probably not a problem, but may cause the compilation of entry points to be out of order.`
|
||||
]]);
|
||||
});
|
||||
|
||||
@ -292,14 +293,14 @@ runInEachFileSystem(() => {
|
||||
const result = resolver.sortEntryPointsByDependency([testEntryPoint]);
|
||||
expect(result.entryPoints).toEqual([testEntryPoint]);
|
||||
expect(logger.logs.warn).toEqual([[
|
||||
`Entry point 'test-package' contains deep imports into '${_('/project/node_modules/deeper/one')}'. This is probably not a problem, but may cause the compilation of entry points to be out of order.`
|
||||
`Entry point 'test-package' contains deep imports into '${
|
||||
_('/project/node_modules/deeper/one')}'. This is probably not a problem, but may cause the compilation of entry points to be out of order.`
|
||||
]]);
|
||||
|
||||
});
|
||||
|
||||
it('should error if the entry point does not have a suitable format', () => {
|
||||
expect(() => resolver.sortEntryPointsByDependency([
|
||||
{ path: '/first', packageJson: {}, compiledByAngular: true } as EntryPoint
|
||||
{path: '/first', packageJson: {}, compiledByAngular: true} as EntryPoint
|
||||
])).toThrowError(`There is no appropriate source code format in '/first' entry-point.`);
|
||||
});
|
||||
|
||||
@ -307,7 +308,8 @@ runInEachFileSystem(() => {
|
||||
resolver = new DependencyResolver(fs, new MockLogger(), config, {esm2015: host}, host);
|
||||
expect(() => resolver.sortEntryPointsByDependency([first]))
|
||||
.toThrowError(
|
||||
`Could not find a suitable format for computing dependencies of entry-point: '${first.path}'.`);
|
||||
`Could not find a suitable format for computing dependencies of entry-point: '${
|
||||
first.path}'.`);
|
||||
});
|
||||
|
||||
it('should capture any dependencies that were ignored', () => {
|
||||
@ -462,7 +464,7 @@ runInEachFileSystem(() => {
|
||||
deps[entryPointPath].missing.forEach(
|
||||
dep => missing.add(fs.isRooted(dep) ? absoluteFrom(dep) : relativeFrom(dep)));
|
||||
if (deps[entryPointPath].deepImports) {
|
||||
deps[entryPointPath].deepImports !.forEach(dep => deepImports.add(dep));
|
||||
deps[entryPointPath].deepImports!.forEach(dep => deepImports.add(dep));
|
||||
}
|
||||
return {dependencies, missing, deepImports};
|
||||
};
|
||||
|
@ -14,7 +14,6 @@ import {createDependencyInfo} from '../../src/dependencies/dependency_host';
|
||||
import {DtsDependencyHost} from '../../src/dependencies/dts_dependency_host';
|
||||
|
||||
runInEachFileSystem(() => {
|
||||
|
||||
describe('DtsDependencyHost', () => {
|
||||
let _: typeof absoluteFrom;
|
||||
let host: DtsDependencyHost;
|
||||
|
@ -16,7 +16,6 @@ import {EsmDependencyHost, hasImportOrReexportStatements, isStringImportOrReexpo
|
||||
import {ModuleResolver} from '../../src/dependencies/module_resolver';
|
||||
|
||||
runInEachFileSystem(() => {
|
||||
|
||||
describe('EsmDependencyHost', () => {
|
||||
let _: typeof absoluteFrom;
|
||||
let host: EsmDependencyHost;
|
||||
|
@ -251,8 +251,10 @@ runInEachFileSystem(() => {
|
||||
exportNames.map(e => ` exports.${e.replace(/.+\./, '')} = ${e};`).join('\n');
|
||||
return `
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports${commonJsRequires}) :
|
||||
typeof define === 'function' && define.amd ? define('${moduleName}', ['exports'${amdDeps}], factory) :
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports${
|
||||
commonJsRequires}) :
|
||||
typeof define === 'function' && define.amd ? define('${moduleName}', ['exports'${
|
||||
amdDeps}], factory) :
|
||||
(factory(global.${moduleName}${globalParams}));
|
||||
}(this, (function (exports${params}) { 'use strict';
|
||||
${exportStatements}
|
||||
|
Reference in New Issue
Block a user