build: reformat repo to new clang@1.4.0 (#36613)

PR Close #36613
This commit is contained in:
Joey Perrott
2020-04-13 16:40:21 -07:00
committed by atscott
parent 5e80e7e216
commit 698b0288be
1160 changed files with 31667 additions and 24000 deletions

View File

@ -67,8 +67,8 @@ function checkEnvironment(reqs) {
if (!semver.satisfies(foundNodeVersion, reqs.requiredNodeVersion)) {
issues.push(
'You are running unsupported node version. Found: ' + foundNodeVersion + ' Expected: ' +
reqs.requiredNodeVersion + '. Use nvm to update your node version.');
'You are running unsupported node version. Found: ' + foundNodeVersion +
' Expected: ' + reqs.requiredNodeVersion + '. Use nvm to update your node version.');
}
if (yarnErr) {
@ -99,7 +99,9 @@ function printWarning(issues) {
console.warn('');
console.warn('!'.repeat(110));
console.warn('!!! Your environment is not in a good shape. Following issues were found:');
issues.forEach(function(issue) { console.warn('!!! - ' + issue); });
issues.forEach(function(issue) {
console.warn('!!! - ' + issue);
});
console.warn('!'.repeat(110));
console.warn('');

View File

@ -140,8 +140,8 @@ function buildQueryAndParams(username: string, date: string) {
label: `${ORG}/${repo} Issue Authored`,
},
[`${repo.replace(/[\/\-]/g, '_')}_issues_involved`]: {
query:
`repo:${ORG}/${repo} is:issue -author:${username} involves:${username} ${updatedOrCreated}:>${date}`,
query: `repo:${ORG}/${repo} is:issue -author:${username} involves:${username} ${
updatedOrCreated}:>${date}`,
label: `${ORG}/${repo} Issue Involved`,
},
[`${repo.replace(/[\/\-]/g, '_')}_pr_author`]: {
@ -153,13 +153,13 @@ function buildQueryAndParams(username: string, date: string) {
label: `${ORG}/${repo} PR Involved`,
},
[`${repo.replace(/[\/\-]/g, '_')}_pr_reviewed`]: {
query:
`repo:${ORG}/${repo} is:pr -author:${username} reviewed-by:${username} ${updatedOrCreated}:>${date}`,
query: `repo:${ORG}/${repo} is:pr -author:${username} reviewed-by:${username} ${
updatedOrCreated}:>${date}`,
label: `${ORG}/${repo} PR Reviewed`,
},
[`${repo.replace(/[\/\-]/g, '_')}_pr_commented`]: {
query:
`repo:${ORG}/${repo} is:pr -author:${username} commenter:${username} ${updatedOrCreated}:>${date}`,
query: `repo:${ORG}/${repo} is:pr -author:${username} commenter:${username} ${
updatedOrCreated}:>${date}`,
label: `${ORG}/${repo} PR Commented`,
},
};
@ -172,8 +172,8 @@ function buildQueryAndParams(username: string, date: string) {
label: `${ORG} org Issue Authored`,
},
[`${ORG}_org_issues_involved`]: {
query:
`org:${ORG} is:issue -author:${username} involves:${username} ${updatedOrCreated}:>${date}`,
query: `org:${ORG} is:issue -author:${username} involves:${username} ${updatedOrCreated}:>${
date}`,
label: `${ORG} org Issue Involved`,
},
[`${ORG}_org_pr_author`]: {
@ -185,8 +185,8 @@ function buildQueryAndParams(username: string, date: string) {
label: `${ORG} org PR Involved`,
},
[`${ORG}_org_pr_reviewed`]: {
query:
`org:${ORG} is:pr -author:${username} reviewed-by:${username} ${updatedOrCreated}:>${date}`,
query: `org:${ORG} is:pr -author:${username} reviewed-by:${username} ${updatedOrCreated}:>${
date}`,
label: `${ORG} org PR Reviewed`,
},
[`${ORG}_org_pr_commented`]: {

View File

@ -138,7 +138,9 @@ function generateAllLocalesFile(LOCALES, ALIASES) {
return str;
}
function formatLocale(locale) { return locale.replace(/-/g, '_'); }
function formatLocale(locale) {
return locale.replace(/-/g, '_');
}
// clang-format off
return `${HEADER}
import {registerLocaleData} from '../src/i18n/locale_data';

View File

@ -53,7 +53,9 @@ module.exports.stringify = function(obj, quoteKeys) {
}
}
function isDate(obj) { return Object.prototype.toString.call(obj) === '[object Date]'; }
function isDate(obj) {
return Object.prototype.toString.call(obj) === '[object Date]';
}
var objStack = [];
function checkForCircular(obj) {
@ -130,7 +132,8 @@ module.exports.stringify = function(obj, quoteKeys) {
buffer += 'null';
} /* else if (typeof res === 'undefined') { // modified to support empty array values
buffer += '';
}*/ else {
}*/
else {
buffer += res;
}
if (i < obj_part.length - 1) {

View File

@ -179,7 +179,8 @@ class TestRunner {
if (args.length > 0) {
packageJsonFile = args[0];
}
log(`running test command ${this.successful+1} of ${this.config.commands.length}: patching '${packageJsonFile}' in '${this.testRoot}'`);
log(`running test command ${this.successful + 1} of ${
this.config.commands.length}: patching '${packageJsonFile}' in '${this.testRoot}'`);
this._patchPackageJson(packageJsonFile);
} break;
@ -189,14 +190,16 @@ class TestRunner {
}
const runfilesBinary = runfiles.resolveWorkspaceRelative(binary);
binary = fs.existsSync(runfilesBinary) ? runfilesBinary : binary;
log(`running test command ${this.successful+1} of ${this.config.commands.length}: '${binary} ${args.join(' ')}' in '${this.testRoot}'`);
log(`running test command ${this.successful + 1} of ${this.config.commands.length}: '${
binary} ${args.join(' ')}' in '${this.testRoot}'`);
const spawnedProcess = spawnSync(binary, args, {cwd: this.testRoot, stdio: 'inherit'});
if (spawnedProcess.error) {
fail(
`test command ${testRunner.successful+1} '${binary} ${args.join(' ')}' failed with ${spawnedProcess.error.code}`);
fail(`test command ${testRunner.successful + 1} '${binary} ${
args.join(' ')}' failed with ${spawnedProcess.error.code}`);
}
if (spawnedProcess.status) {
log(`test command ${testRunner.successful+1} '${binary} ${args.join(' ')}' failed with status code ${spawnedProcess.status}`);
log(`test command ${testRunner.successful + 1} '${binary} ${
args.join(' ')}' failed with status code ${spawnedProcess.status}`);
return spawnedProcess.status;
}
}
@ -225,17 +228,20 @@ class TestRunner {
if (contents.dependencies && contents.dependencies[key]) {
replacements++;
contents.dependencies[key] = replacement;
log(`overriding dependencies['${key}'] npm package with 'file:${path}' in package.json file`);
log(`overriding dependencies['${key}'] npm package with 'file:${
path}' in package.json file`);
}
if (contents.devDependencies && contents.devDependencies[key]) {
replacements++;
contents.devDependencies[key] = replacement;
log(`overriding devDependencies['${key}'] npm package with 'file:${path}' in package.json file`);
log(`overriding devDependencies['${key}'] npm package with 'file:${
path}' in package.json file`);
}
if (contents.resolutions && contents.resolutions[key]) {
replacements++;
contents.resolutions[key] = replacement;
log(`overriding resolutions['${key}'] npm package with 'file:${path}' in package.json file`);
log(`overriding resolutions['${key}'] npm package with 'file:${
path}' in package.json file`);
}
// TODO: handle other formats for resolutions such as `some-package/${key}` or
// `some-package/**/${key}`
@ -243,7 +249,8 @@ class TestRunner {
if (contents.resolutions && contents.resolutions[altKey]) {
replacements++;
contents.resolutions[altKey] = replacement;
log(`overriding resolutions['${altKey}'] npm package with 'file:${path}' in package.json file`);
log(`overriding resolutions['${altKey}'] npm package with 'file:${
path}' in package.json file`);
}
}
// check packages that must be replaced
@ -263,8 +270,8 @@ class TestRunner {
const contentsEncoded = JSON.stringify(contents, null, 2);
log(`package.json file:\n${contentsEncoded}`);
if (failedPackages.length) {
fail(
`expected replacements of npm packages ${JSON.stringify(failedPackages)} not found; add these to the npm_packages attribute`);
fail(`expected replacements of npm packages ${
JSON.stringify(failedPackages)} not found; add these to the npm_packages attribute`);
}
if (replacements) {
fs.writeFileSync(packageJson, contentsEncoded);
@ -314,7 +321,8 @@ class TestRunner {
log(`configuring test in-place under ${this.testRoot}`);
} else {
this.testRoot = copyToTmp(this.config.testFiles);
log(`test files from '${rootDirectory(this.config.testFiles)}' copied to tmp folder ${this.testRoot}`);
log(`test files from '${rootDirectory(this.config.testFiles)}' copied to tmp folder ${
this.testRoot}`);
}
}

View File

@ -16,7 +16,7 @@ try {
// is introduced in node 10.2.0
console.warn(
`Running postinstall-patches.js script in an external repository requires --preserve-symlinks-main node flag introduced in node 10.2.0. ` +
`Current node version is ${process.version}. Node called with '${process.argv.join(" ")}'.`);
`Current node version is ${process.version}. Node called with '${process.argv.join(' ')}'.`);
process.exit(0);
}

View File

@ -59,7 +59,6 @@ _main(...process.argv.slice(2)).catch(err => {
// Helpers
async function _main(repository, prNumber) {
const target = await getRefsAndShasForTarget(prNumber);
// Log known refs and shas
@ -80,12 +79,13 @@ async function _main(repository, prNumber) {
// Check if the files changed between the latest commit from origin and the common ancestor SHA
// includes the CircleCI config.
const {stdout: circleCIConfigChanged} = await exec(
`git diff --name-only origin/${target.base.ref} ${target.commonAncestorSha} -- .circleci/config.yml`);
const {stdout: circleCIConfigChanged} = await exec(`git diff --name-only origin/${
target.base.ref} ${target.commonAncestorSha} -- .circleci/config.yml`);
if (!!circleCIConfigChanged) {
throw Error(`
CircleCI config on ${target.base.ref} has been modified since commit ${target.commonAncestorSha.slice(0, 7)},
CircleCI config on ${target.base.ref} has been modified since commit ${
target.commonAncestorSha.slice(0, 7)},
which this PR is based on.
Please rebase the PR on ${target.base.ref} after fetching from upstream.

View File

@ -8,28 +8,32 @@
// rxjs/operators
(function(factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
} else if (typeof define === 'function' && define.amd) {
define('rxjs/operators', ['exports', 'rxjs'], factory);
}
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
} else if (typeof define === 'function' && define.amd) {
define('rxjs/operators', ['exports', 'rxjs'], factory);
}
})(function(exports, rxjs) {
'use strict';
Object.keys(rxjs.operators).forEach(function(key) { exports[key] = rxjs.operators[key]; });
Object.defineProperty(exports, '__esModule', {value: true});
'use strict';
Object.keys(rxjs.operators).forEach(function(key) {
exports[key] = rxjs.operators[key];
});
Object.defineProperty(exports, '__esModule', {value: true});
});
// rxjs/testing
(function(factory) {
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
} else if (typeof define === 'function' && define.amd) {
define('rxjs/testing', ['exports', 'rxjs'], factory);
}
if (typeof module === 'object' && typeof module.exports === 'object') {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
} else if (typeof define === 'function' && define.amd) {
define('rxjs/testing', ['exports', 'rxjs'], factory);
}
})(function(exports, rxjs) {
'use strict';
Object.keys(rxjs.testing).forEach(function(key) { exports[key] = rxjs.testing[key]; });
Object.defineProperty(exports, '__esModule', {value: true});
'use strict';
Object.keys(rxjs.testing).forEach(function(key) {
exports[key] = rxjs.testing[key];
});
Object.defineProperty(exports, '__esModule', {value: true});
});

View File

@ -40,7 +40,7 @@ export function compareFileSizeData(
/** Compares two file size entries and returns an array of size differences. */
function compareSizeEntry(
actual: DirectorySizeEntry | number, expected: DirectorySizeEntry | number, filePath: string,
actual: DirectorySizeEntry|number, expected: DirectorySizeEntry|number, filePath: string,
threshold: Threshold) {
if (typeof actual !== 'number' && typeof expected !== 'number') {
return compareDirectorySizeEntry(actual, expected, filePath, threshold);

View File

@ -9,7 +9,6 @@
import {compareFileSizeData} from './file_size_compare';
describe('file size compare', () => {
it('should report if size entry differ by more than the specified max percentage diff', () => {
const diffs = compareFileSizeData(
{

View File

@ -47,18 +47,14 @@ export function omitCommonPathPrefix(entry: DirectorySizeEntry): DirectorySizeEn
}
function _sortDirectorySizeEntryObject(oldObject: DirectorySizeEntry): DirectorySizeEntry {
return Object.keys(oldObject)
.sort(_sortSizeEntryKeys)
.reduce(
(result, key) => {
if (typeof oldObject[key] === 'number') {
result[key] = oldObject[key];
} else {
result[key] = _sortDirectorySizeEntryObject(oldObject[key] as DirectorySizeEntry);
}
return result;
},
{} as DirectorySizeEntry);
return Object.keys(oldObject).sort(_sortSizeEntryKeys).reduce((result, key) => {
if (typeof oldObject[key] === 'number') {
result[key] = oldObject[key];
} else {
result[key] = _sortDirectorySizeEntryObject(oldObject[key] as DirectorySizeEntry);
}
return result;
}, {} as DirectorySizeEntry);
}
function _sortSizeEntryKeys(a: string, b: string) {

View File

@ -6,16 +6,16 @@
* found in the LICENSE file at https://angular.io/license
*/
import {readFileSync, writeFileSync} from 'fs';
import {SizeTracker} from './size_tracker';
import chalk from 'chalk';
import {readFileSync, writeFileSync} from 'fs';
import {compareFileSizeData} from './file_size_compare';
import {FileSizeData} from './file_size_data';
import {SizeTracker} from './size_tracker';
if (require.main === module) {
const
[filePath, sourceMapPath, goldenPath, maxPercentageDiffArg, maxSizeDiffArg, writeGoldenArg,
requiredCompileMode] = process.argv.slice(2);
const [filePath, sourceMapPath, goldenPath, maxPercentageDiffArg, maxSizeDiffArg, writeGoldenArg, requiredCompileMode] =
process.argv.slice(2);
const status = main(
require.resolve(filePath), require.resolve(sourceMapPath), require.resolve(goldenPath),
writeGoldenArg === 'true', parseInt(maxPercentageDiffArg), parseInt(maxSizeDiffArg),
@ -62,7 +62,7 @@ export function main(
const bazelTargetName = process.env['TEST_TARGET'];
console.error(`\nThe golden file can be updated with the following command:`);
console.error(
` yarn bazel run --config=${ivyEnabled ? 'ivy' : 'view-engine'} ${bazelTargetName}.accept`);
console.error(` yarn bazel run --config=${ivyEnabled ? 'ivy' : 'view-engine'} ${
bazelTargetName}.accept`);
return false;
}

View File

@ -12,12 +12,14 @@ import {SourceMapGenerator} from 'source-map';
import {SizeTracker} from './size_tracker';
const testTempDir = process.env['TEST_TMPDIR'] !;
const testTempDir = process.env['TEST_TMPDIR']!;
describe('size tracking', () => {
let generator: SourceMapGenerator;
beforeEach(() => { generator = new SourceMapGenerator(); });
beforeEach(() => {
generator = new SourceMapGenerator();
});
function writeFile(filePath: string, content: string): string {
const tmpFilePath = join(testTempDir, filePath);

View File

@ -41,7 +41,9 @@ module.exports = function getMappings(bundlePath) {
matchData.push({
genLineIndex,
sourceLineIndex,
sourceFile: sourceMap.sources[sourceFileIndex], genText, sourceText
sourceFile: sourceMap.sources[sourceFileIndex],
genText,
sourceText
});
}
@ -59,6 +61,7 @@ function getFile(filePath) {
}
function decodeLines(sourceMap) {
return sourceMap.mappings.split(';').map(
line => { return line.split(',').map(seg => vlq.decode(seg)); });
return sourceMap.mappings.split(';').map(line => {
return line.split(',').map(seg => vlq.decode(seg));
});
}

View File

@ -12,7 +12,7 @@ import {SymbolExtractor} from './symbol_extractor';
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER'] as string);
if (require.main === module) {
const args = process.argv.slice(2) as[string, string];
const args = process.argv.slice(2) as [string, string];
process.exitCode = main(args) ? 0 : 1;
}
@ -23,7 +23,7 @@ if (require.main === module) {
* cli javascriptFilePath.js goldenFilePath.json
* ```
*/
function main(argv: [string, string, string] | [string, string]): boolean {
function main(argv: [string, string, string]|[string, string]): boolean {
const javascriptFilePath = runfiles.resolveWorkspaceRelative(argv[0]);
const goldenFilePath = runfiles.resolveWorkspaceRelative(argv[1]);
const doUpdate = argv[2] == '--accept';
@ -44,8 +44,8 @@ function main(argv: [string, string, string] | [string, string]): boolean {
const ivyEnabled = process.env['angular_ivy_enabled'] == 'True';
console.error(`TEST FAILED!`);
console.error(` To update the golden file run: `);
console.error(
` yarn bazel run --config=${ivyEnabled ? 'ivy' : 'view-engine'} ${process.env['TEST_TARGET']}.accept`);
console.error(` yarn bazel run --config=${ivyEnabled ? 'ivy' : 'view-engine'} ${
process.env['TEST_TARGET']}.accept`);
}
}
return passed;

View File

@ -9,7 +9,9 @@
import * as ts from 'typescript';
export interface Symbol { name: string; }
export interface Symbol {
name: string;
}
export class SymbolExtractor {
public actual: Symbol[];
@ -75,7 +77,7 @@ export class SymbolExtractor {
// All symbols in the golden file start out with a count corresponding to the number of symbols
// with that name. Once they are matched with symbols in the actual output, the count should
// even out to 0.
(expected as(Symbol | string)[]).forEach((nameOrSymbol) => {
(expected as (Symbol | string)[]).forEach((nameOrSymbol) => {
const symbolName = typeof nameOrSymbol == 'string' ? nameOrSymbol : nameOrSymbol.name;
diff[symbolName] = (diff[symbolName] || 0) + 1;
});

View File

@ -10,6 +10,10 @@
function A() {
function ignoreA() {}
}
function B() { let ignoreB = {}; }
!function() { let ignoreC = {}; };
function B() {
let ignoreB = {};
}
!function() {
let ignoreC = {};
};
}();

View File

@ -9,79 +9,84 @@
!function() {
'use strict';
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
var ChangeDetectionStrategy, ChangeDetectorStatus, ViewEncapsulation;
Object;
ChangeDetectionStrategy || (ChangeDetectionStrategy = {});
ChangeDetectorStatus || (ChangeDetectorStatus = {});
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ Object;
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
Object;
ViewEncapsulation || (ViewEncapsulation = {});
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ 'undefined' != typeof window &&
window,
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ 'undefined' != typeof window && window,
'undefined' != typeof self && 'undefined' != typeof WorkerGlobalScope &&
self instanceof WorkerGlobalScope && self,
'undefined' != typeof global && global;
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
String;
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
Function;
var __window$1 = 'undefined' != typeof window && window, __self$1 = 'undefined' != typeof self &&
'undefined' != typeof WorkerGlobalScope && self instanceof WorkerGlobalScope && self,
var __window$1 = 'undefined' != typeof window && window,
__self$1 = 'undefined' != typeof self && 'undefined' != typeof WorkerGlobalScope &&
self instanceof WorkerGlobalScope && self,
__global$1 = 'undefined' != typeof global && global,
_root = __window$1 || __global$1 || __self$1;
!function() {
if (!_root) throw new Error('RxJS could not find any global context (window, self, global)');
}();
Array;
!function() { Object.setPrototypeOf || Array; }();
!function() {
Object.setPrototypeOf || Array;
}();
Error;
var RendererStyleFlags2, Symbol$1 = _root.Symbol;
'function' == typeof Symbol$1 && 'function' == typeof Symbol$1.for &&
Symbol$1.for ('rxSubscriber'),
function() { Object.setPrototypeOf || Array; }();
Symbol$1.for('rxSubscriber'),
function() {
Object.setPrototypeOf || Array;
}();
!function(context) {
var $$observable, Symbol = _root.Symbol;
if ('function' == typeof Symbol)
@ -94,9 +99,15 @@
else
$$observable = '@@observable';
}();
(function() { Object.setPrototypeOf || Array; })(),
function() { Object.setPrototypeOf || Array; }();
!function() { Object.setPrototypeOf || Array; }();
(function() {
Object.setPrototypeOf || Array;
})(),
function() {
Object.setPrototypeOf || Array;
}();
!function() {
Object.setPrototypeOf || Array;
}();
(function(root) {
var Symbol = root.Symbol;
if ('function' == typeof Symbol) {
@ -113,14 +124,28 @@
return key;
}
})(_root),
function() { Object.setPrototypeOf || Array; }();
(function() { Object.setPrototypeOf || Array; })(),
function() { Object.setPrototypeOf || Array; }();
!function() { Object.setPrototypeOf || Array; }();
Error, function() { Object.setPrototypeOf || Array; }(), function() {
function() {
Object.setPrototypeOf || Array;
}();
(function() {
Object.setPrototypeOf || Array;
}(), function() { Object.setPrototypeOf || Array; }();
!function() { Object.setPrototypeOf || Array; }();
})(),
function() {
Object.setPrototypeOf || Array;
}();
!function() {
Object.setPrototypeOf || Array;
}();
Error, function() {
Object.setPrototypeOf || Array;
}(), function() {
Object.setPrototypeOf || Array;
}(), function() {
Object.setPrototypeOf || Array;
}();
!function() {
Object.setPrototypeOf || Array;
}();
Object;
RendererStyleFlags2 || (RendererStyleFlags2 = {});
var RendererStyleFlags3, _renderCompCount = 0;
@ -131,53 +156,56 @@
for (var i = 0; i < arr.length; i += 2) arr[1 | i].call(data[arr[i]]);
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ (data, hooksToCall);
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
(data, hooksToCall);
}
RendererStyleFlags3 || (RendererStyleFlags3 = {});
var domRendererFactory3 = {
createRenderer: function(hostElement, rendererType) { return document; }
createRenderer: function(hostElement, rendererType) {
return document;
}
};
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ function
getNextLNodeWithProjection(node) {
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
function getNextLNodeWithProjection(node) {
var pNextOrParent = node.pNextOrParent;
return pNextOrParent ? 1 == (3 & pNextOrParent.flags) ? null : pNextOrParent : node.next;
}
@ -210,12 +238,12 @@
'string' == typeof value ? value : null == value ? '' : '' + value;
}
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
var renderer, rendererFactory, previousOrParentNode, isParent, tData, currentView, currentQueries,
creationMode, data, bindingIndex;
currentView = createLView(null, null, createTView());
@ -325,33 +353,34 @@
var oldView = enterView(hostView, node);
try {
rendererFactory.begin && rendererFactory.begin();
template ? template(componentOrContext, creationMode) : function(
directiveIndex, elementIndex) {
!function(currentView, tView, creationMode) {
if (1 === currentView.lifecycleStage) {
executeHooks(currentView.data, tView.initHooks, tView.checkHooks, creationMode);
currentView.lifecycleStage = 2;
}
}(currentView, currentView.tView, creationMode);
!function(currentView, tView, creationMode) {
if (currentView.lifecycleStage < 3) {
executeHooks(
currentView.data, tView.contentHooks, tView.contentCheckHooks, creationMode);
currentView.lifecycleStage = 3;
}
}(currentView, currentView.tView, creationMode);
var template = tData[1].template;
if (null != template) {
var element = data[0], directive = getDirectiveInstance(data[1]),
oldView = enterView(element.data, element);
try {
template(directive, creationMode);
} finally {
refreshDynamicChildren();
leaveView(oldView);
}
}
}();
template ?
template(componentOrContext, creationMode) :
function(directiveIndex, elementIndex) {
!function(currentView, tView, creationMode) {
if (1 === currentView.lifecycleStage) {
executeHooks(currentView.data, tView.initHooks, tView.checkHooks, creationMode);
currentView.lifecycleStage = 2;
}
}(currentView, currentView.tView, creationMode);
!function(currentView, tView, creationMode) {
if (currentView.lifecycleStage < 3) {
executeHooks(
currentView.data, tView.contentHooks, tView.contentCheckHooks, creationMode);
currentView.lifecycleStage = 3;
}
}(currentView, currentView.tView, creationMode);
var template = tData[1].template;
if (null != template) {
var element = data[0], directive = getDirectiveInstance(data[1]),
oldView = enterView(element.data, element);
try {
template(directive, creationMode);
} finally {
refreshDynamicChildren();
leaveView(oldView);
}
}
}();
} finally {
rendererFactory.end && rendererFactory.end();
leaveView(oldView);
@ -400,54 +429,56 @@
return newObj;
}
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
*@license
*Copyright Google Inc. All Rights Reserved.
*
*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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ Object;
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ !
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
Object;
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
!
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
function(componentType, opts) {
void 0 === opts && (opts = {});
var component, rendererFactory = opts.rendererFactory || domRendererFactory3,
@ -492,8 +523,9 @@
for (var attrs = tNode.attrs, i = 0; i < attrs.length; i += 2) {
var minifiedInputName = inputs[attrs[i]];
void 0 !== minifiedInputName &&
(initialInputData[directiveIndex] || (initialInputData[directiveIndex] = [
])).push(minifiedInputName, attrs[1 | i]);
(initialInputData[directiveIndex] ||
(initialInputData[directiveIndex] = []))
.push(minifiedInputName, attrs[1 | i]);
}
return initialInputData;
}(directiveIndex, directiveDef.inputs, tNode));
@ -504,12 +536,12 @@
}(instance, 0, tNode);
!
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
function(index, onInit, doCheck, tView) {
if (!0 === tView.firstCreatePass) {
null != onInit && (tView.initHooks || (tView.initHooks = [])).push(1, onInit);
@ -524,28 +556,32 @@
} finally {
leaveView(oldView);
}
opts.features &&
opts.features.forEach(function(feature) { return feature(component, componentDef); });
opts.features && opts.features.forEach(function(feature) {
return feature(component, componentDef);
});
!function(component) {
var hostNode = component.__ngHostLNode__;
renderComponentOrTemplate(hostNode, hostNode.view, component);
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ (component);
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
(component);
}(function() {
function HelloWorld() { this.name = 'World'; }
function HelloWorld() {
this.name = 'World';
}
HelloWorld.ɵcmp = function(componentDefinition) {
var type = componentDefinition.type, def = {
type: type,
@ -578,12 +614,16 @@
onDestroy: type.prototype.ngOnDestroy || null
},
feature = componentDefinition.features;
feature && feature.forEach(function(fn) { return fn(def); });
feature && feature.forEach(function(fn) {
return fn(def);
});
return def;
}({
type: HelloWorld,
tag: 'hello-world',
factory: function() { return new HelloWorld(); },
factory: function() {
return new HelloWorld();
},
template: function(ctx, cm) {
cm && function(index, value) {
createLNode(0, 3, null);
@ -635,19 +675,20 @@
}
}
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/ (existingNode, currentView);
* @license
* Copyright Google Inc. All Rights Reserved.
*
* 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
*/
(existingNode, currentView);
}
}(0, function(prefix, value, suffix) {
return function(value) {

View File

@ -16,7 +16,9 @@ var bundle = function(exports) {
console.log('Hello, Alice in Wonderland');
var A = function() {
function A() {}
A.prototype.a = function() { return document.a; };
A.prototype.a = function() {
return document.a;
};
return A;
}();
// tslint:disable-next-line:no-console

View File

@ -6,4 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
(function() { var Class = function() {}, fn = function() {}; })();
(function() {
var Class = function() {}, fn = function() {};
})();

View File

@ -12,10 +12,14 @@
console.log('Hello, Alice in Wonderland');
var A = function() {
function A() {}
return A.prototype.a = function() { return document.a; }, A;
return A.prototype.a = function() {
return document.a;
}, A;
}(), B = function() {
function B() {}
return B.prototype.b = function() { return window.b; }, B;
return B.prototype.b = function() {
return window.b;
}, B;
}();
var ignore_no_initializer;
// tslint:disable-next-line:no-console

View File

@ -9,9 +9,10 @@
import {createPatch} from 'diff';
import * as fs from 'fs';
import * as path from 'path';
import {SerializationOptions, publicApi} from './serializer';
export {SerializationOptions, publicApi} from './serializer';
import {publicApi, SerializationOptions} from './serializer';
export {publicApi, SerializationOptions} from './serializer';
export function generateGoldenFile(
entrypoint: string, outFile: string, options: SerializationOptions = {}): void {

View File

@ -60,7 +60,7 @@ export interface SerializationOptions {
paramTags?: JsDocTagOptions;
}
export type DiagnosticSeverity = 'warn' | 'error' | 'none';
export type DiagnosticSeverity = 'warn'|'error'|'none';
export function publicApi(fileName: string, options: SerializationOptions = {}): string {
return publicApiInternal(ts.createCompilerHost(baseTsOptions), fileName, baseTsOptions, options);
@ -324,7 +324,8 @@ class ResolvedDeclarationEmitter {
this.diagnostics.push({
type: 'error',
message: createErrorMessage(
node, 'Required jsdoc tags - One of the tags: ' +
node,
'Required jsdoc tags - One of the tags: ' +
requireAtLeastOne.map(tag => `"@${tag}"`).join(', ') +
` - must exist on ${getName(node)}.`)
});
@ -335,7 +336,8 @@ class ResolvedDeclarationEmitter {
this.diagnostics.push({
type: 'error',
message: createErrorMessage(
node, 'Banned jsdoc tags - ' + bannedTagsFound.map(tag => `"@${tag}"`).join(', ') +
node,
'Banned jsdoc tags - ' + bannedTagsFound.map(tag => `"@${tag}"`).join(', ') +
` - were found on ${getName(node)}.`)
});
}
@ -437,7 +439,7 @@ function hasModifier(node: ts.Node, modifierKind: ts.SyntaxKind): boolean {
return !!node.modifiers && node.modifiers.some(x => x.kind === modifierKind);
}
function applyDefaultTagOptions(tagOptions: JsDocTagOptions | undefined): JsDocTagOptions {
function applyDefaultTagOptions(tagOptions: JsDocTagOptions|undefined): JsDocTagOptions {
return {requireAtLeastOne: [], banned: [], toCopy: [], ...tagOptions};
}

View File

@ -23,7 +23,9 @@ describe('cli: e2e test', () => {
}
});
afterEach(() => { unlinkRecursively(outDir); });
afterEach(() => {
unlinkRecursively(outDir);
});
it('should print usage without any argument', () => {
const {stderr} = execute([]);

View File

@ -26,14 +26,17 @@ describe('integration test: public api', () => {
_warn = null;
});
it('should handle empty files',
() => { check('test/fixtures/empty.d.ts', 'test/fixtures/empty_expected.d.ts'); });
it('should handle empty files', () => {
check('test/fixtures/empty.d.ts', 'test/fixtures/empty_expected.d.ts');
});
it('should include symbols',
() => { check('test/fixtures/simple.d.ts', 'test/fixtures/simple_expected.d.ts'); });
it('should include symbols', () => {
check('test/fixtures/simple.d.ts', 'test/fixtures/simple_expected.d.ts');
});
it('should include symbols reexported explicitly',
() => { check('test/fixtures/reexported.d.ts', 'test/fixtures/reexported_expected.d.ts'); });
it('should include symbols reexported explicitly', () => {
check('test/fixtures/reexported.d.ts', 'test/fixtures/reexported_expected.d.ts');
});
it('should include symbols reexported with *', () => {
check('test/fixtures/reexported_star.d.ts', 'test/fixtures/reexported_star_expected.d.ts');
@ -95,7 +98,9 @@ describe('integration test: generateGoldenFile', () => {
}
});
afterEach(() => { unlinkRecursively(outDir); });
afterEach(() => {
unlinkRecursively(outDir);
});
it('should generate a golden file', () => {

View File

@ -9,7 +9,7 @@
import * as chai from 'chai';
import * as ts from 'typescript';
import {SerializationOptions, publicApiInternal} from '../lib/serializer';
import {publicApiInternal, SerializationOptions} from '../lib/serializer';
const classesAndInterfaces = `
export declare class A {
@ -639,8 +639,9 @@ function check(
function checkThrows(
files: {[name: string]: string}, error: string, options: SerializationOptions = {}) {
chai.assert.throws(
() => { publicApiInternal(getMockHost(files), 'file.d.ts', {}, options); }, error);
chai.assert.throws(() => {
publicApiInternal(getMockHost(files), 'file.d.ts', {}, options);
}, error);
}
function stripExtraIndentation(text: string) {
@ -648,7 +649,7 @@ function stripExtraIndentation(text: string) {
// Ignore first and last new line
lines = lines.slice(1, lines.length - 1);
const commonIndent = lines.reduce((min, line) => {
const indent = /^( *)/.exec(line) ![1].length;
const indent = /^( *)/.exec(line)![1].length;
// Ignore empty line
return line.length ? Math.min(min, indent) : min;
}, text.length);

View File

@ -43,7 +43,9 @@ async function requestDataFromGithub(url) {
const contentType = res.headers['content-type'];
let rawData = '';
res.on('data', (chunk) => { rawData += chunk; });
res.on('data', (chunk) => {
rawData += chunk;
});
res.on('end', () => {
let error;
if (statusCode !== 200) {
@ -67,7 +69,9 @@ async function requestDataFromGithub(url) {
}
});
})
.on('error', (e) => { reject(e); });
.on('error', (e) => {
reject(e);
});
});
}
// clang-format off
@ -116,7 +120,7 @@ async function getRefsAndShasForTarget(prNumber, suppressLog) {
// If the script is called directly, log the output of the refs and sha for the
// requested PR.
if (require.main === module) {
const run = async() => {
const run = async () => {
const prNumber = Number.parseInt(process.argv[2], 10);
if (!!prNumber) {
console.info(JSON.stringify(await getRefsAndShasForTarget(prNumber, true)));