Compare commits

...

11 Commits
2.2.3 ... 2.2.x

Author SHA1 Message Date
9a9a7ac7b5 docs(changelog): add changelog for 2.2.4 2016-11-30 15:18:38 -08:00
423dd2898a chore(release): cut the 2.2.4 release 2016-11-30 15:16:41 -08:00
ee2d6e572a fix(compiler): fix performance regression caused by 5b0f9e2
Fixes #13146
2016-11-30 15:13:39 -08:00
ba8645c529 Fix(http): invalidStateError response body
Check on null value failed with last version of mozilla.
Check on undefined type instead.
2016-11-30 15:13:39 -08:00
eba53fd16c fix(common): update DatePipe to allow closure compilation
Quote the date formats to prevent closure renaming.  These are specified as strings in templates using DatePipes and also need to be quoted here.
2016-11-30 15:13:39 -08:00
c0698de2ea doc(common): fix a typo in async pipe 2016-11-30 15:13:38 -08:00
dc6728e7ad refactor(core): remove unused import
APP_ID  was removed after 2.2.x
2016-11-30 15:13:38 -08:00
eb173bcd30 fix(compiler-cli): fix paths in source maps to be relative
The change looks bigger than it really is because I reordered the properties to match other tsconfigs we have.

The only real change is removal of sourceRoot property.

Fixes #13040
2016-11-30 15:13:38 -08:00
e39e16ae6a Keep console.log that are not called during compilation. 2016-11-30 15:13:38 -08:00
ff56da554f Check if console.error is defined 2016-11-30 15:13:38 -08:00
d160591453 refactor(lint): Don't allow console.log
Enable tslint check for `console.log` as a follow-up to
https://github.com/angular/angular/issues/13018
2016-11-30 15:13:38 -08:00
39 changed files with 112 additions and 67 deletions

View File

@ -1,3 +1,15 @@
<a name="2.2.4"></a>
## [2.2.4](https://github.com/angular/angular/compare/2.2.3...2.2.4) (2016-11-30)
### Bug Fixes
* **common:** update DatePipe to allow closure compilation ([eba53fd](https://github.com/angular/angular/commit/eba53fd))
* **compiler:** fix performance regression caused by 5b0f9e2 ([ee2d6e5](https://github.com/angular/angular/commit/ee2d6e5)), closes [#13146](https://github.com/angular/angular/issues/13146)
* **compiler-cli:** fix paths in source maps to be relative ([eb173bc](https://github.com/angular/angular/commit/eb173bc)), closes [#13040](https://github.com/angular/angular/issues/13040)
<a name="2.2.3"></a>
## [2.2.3](https://github.com/angular/angular/compare/2.2.2...2.2.3) (2016-11-23)

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {browser} from 'protractor';
const assertEventsContainsName = function(events: any[], eventName: string) {

View File

@ -59,7 +59,7 @@ const _observableStrategy = new ObservableStrategy();
* {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
*
* It's also possible to use `async` with Observables. The example below binds the `time` Observable
* to the view. The Observable continuesly updates the view with the current time.
* to the view. The Observable continuously updates the view with the current time.
*
* {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
*

View File

@ -46,7 +46,7 @@ export class CodeGenerator {
let root = this.options.basePath;
for (const eachRootDir of this.options.rootDirs || []) {
if (this.options.trace) {
console.log(`Check if ${filePath} is under rootDirs element ${eachRootDir}`);
console.error(`Check if ${filePath} is under rootDirs element ${eachRootDir}`);
}
if (path.relative(eachRootDir, filePath).indexOf('.') !== 0) {
root = eachRootDir;
@ -161,7 +161,7 @@ export function extractProgramSymbols(
const moduleMetadata = staticReflector.getModuleMetadata(absSrcPath);
if (!moduleMetadata) {
console.log(`WARNING: no metadata found for ${absSrcPath}`);
console.warn(`WARNING: no metadata found for ${absSrcPath}`);
return;
}

View File

@ -49,7 +49,7 @@ export class PathMappedReflectorHost extends ReflectorHost {
ts.resolveModuleName(m, rootedContainingFile, this.options, this.context).resolvedModule;
if (resolved) {
if (this.options.traceResolution) {
console.log('resolve', m, containingFile, '=>', resolved.resolvedFileName);
console.error('resolve', m, containingFile, '=>', resolved.resolvedFileName);
}
return resolved.resolvedFileName;
}
@ -67,7 +67,7 @@ export class PathMappedReflectorHost extends ReflectorHost {
containingFile = this.resolveAssetUrl(containingFile, '');
if (this.options.traceResolution) {
console.log(
console.error(
'getImportPath from containingFile', containingFile, 'to importedFile', importedFile);
}

View File

@ -152,7 +152,7 @@ export class StaticReflector implements ReflectorReader {
}
return parameters;
} catch (e) {
console.log(`Failed on type ${JSON.stringify(type)} with error ${e}`);
console.error(`Failed on type ${JSON.stringify(type)} with error ${e}`);
throw e;
}
}

View File

@ -1,11 +1,11 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"sourceMap": true,
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"module": "commonjs",
"outDir": "../../../dist/packages-dist/compiler-cli",
"paths": {
"@angular/core": ["../../../dist/packages-dist/core"],
"@angular/common": ["../../../dist/packages-dist/common"],
@ -14,11 +14,11 @@
"@angular/platform-browser": ["../../../dist/packages-dist/platform-browser"],
"@angular/tsc-wrapped": ["../../../dist/tools/@angular/tsc-wrapped"]
},
"experimentalDecorators": true,
"rootDir": ".",
"sourceRoot": ".",
"outDir": "../../../dist/packages-dist/compiler-cli",
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"lib": ["es6", "dom"],
"skipLibCheck": true
},
"exclude": ["integrationtest"],

View File

@ -141,7 +141,7 @@ export class CompileMetadataResolver {
return null;
}
private _loadDirectiveMetadata(directiveType: any, isSync: boolean): Promise<any> {
private _loadDirectiveMetadata(directiveType: any, isSync: boolean): () => Promise<any> {
if (this._directiveCache.has(directiveType)) {
return;
}
@ -191,7 +191,7 @@ export class CompileMetadataResolver {
if (isSync) {
throw new ComponentStillLoadingError(directiveType);
}
return templateMeta.asyncResult.then(createDirectiveMetadata);
return () => templateMeta.asyncResult.then(createDirectiveMetadata);
}
} else {
// directive
@ -441,8 +441,10 @@ export class CompileMetadataResolver {
transitiveModule.directives.push(declaredIdentifier);
declaredDirectives.push(declaredIdentifier);
this._addTypeToModule(declaredType, moduleType);
transitiveModule.directiveLoaders.push(
() => this._loadDirectiveMetadata(declaredType, isSync));
const loader = this._loadDirectiveMetadata(declaredType, isSync);
if (loader) {
transitiveModule.directiveLoaders.push(loader);
}
} else if (this._pipeResolver.isPipe(declaredType)) {
transitiveModule.pipesSet.add(declaredType);
transitiveModule.pipes.push(declaredIdentifier);

View File

@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {APP_ID} from '../application_tokens';
import {SimpleChange, devModeEqual} from '../change_detection/change_detection';
import {UNINITIALIZED} from '../change_detection/change_detection_util';
import {Inject, Injectable} from '../di';

View File

@ -5,6 +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
*/
/* tslint:disable:no-console */
import * as webdriver from 'selenium-webdriver';
declare var browser: any;
declare var expect: any;

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Observable
import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Observable
import 'rxjs/add/operator/map';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Observable
import {Observable} from 'rxjs/Observable';
import {Subscriber} from 'rxjs/Subscriber';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Component
import {Component} from '@angular/core';
import {FormArray, FormControl, FormGroup} from '@angular/forms';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Component
import {Component} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Component
import {Component} from '@angular/core';
import {NgForm} from '@angular/forms';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Component
import {Component} from '@angular/core';
import {NgForm} from '@angular/forms';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
// #docregion Component
import {Component} from '@angular/core';
import {FormControl, FormGroup, Validators} from '@angular/forms';

View File

@ -44,6 +44,7 @@ const DATE_FORMATS_SPLIT =
/((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
const PATTERN_ALIASES: {[format: string]: DateFormatterFn} = {
// Keys are quoted so they do not get renamed during closure compilation.
'yMMMdjms': datePartGetterFactory(combine([
digitCondition('year', 1),
nameCondition('month', 3),
@ -72,48 +73,50 @@ const PATTERN_ALIASES: {[format: string]: DateFormatterFn} = {
};
const DATE_FORMATS: {[format: string]: DateFormatterFn} = {
yyyy: datePartGetterFactory(digitCondition('year', 4)),
yy: datePartGetterFactory(digitCondition('year', 2)),
y: datePartGetterFactory(digitCondition('year', 1)),
MMMM: datePartGetterFactory(nameCondition('month', 4)),
MMM: datePartGetterFactory(nameCondition('month', 3)),
MM: datePartGetterFactory(digitCondition('month', 2)),
M: datePartGetterFactory(digitCondition('month', 1)),
LLLL: datePartGetterFactory(nameCondition('month', 4)),
L: datePartGetterFactory(nameCondition('month', 1)),
dd: datePartGetterFactory(digitCondition('day', 2)),
d: datePartGetterFactory(digitCondition('day', 1)),
HH: digitModifier(
// Keys are quoted so they do not get renamed.
'yyyy': datePartGetterFactory(digitCondition('year', 4)),
'yy': datePartGetterFactory(digitCondition('year', 2)),
'y': datePartGetterFactory(digitCondition('year', 1)),
'MMMM': datePartGetterFactory(nameCondition('month', 4)),
'MMM': datePartGetterFactory(nameCondition('month', 3)),
'MM': datePartGetterFactory(digitCondition('month', 2)),
'M': datePartGetterFactory(digitCondition('month', 1)),
'LLLL': datePartGetterFactory(nameCondition('month', 4)),
'L': datePartGetterFactory(nameCondition('month', 1)),
'dd': datePartGetterFactory(digitCondition('day', 2)),
'd': datePartGetterFactory(digitCondition('day', 1)),
'HH': digitModifier(
hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
H: hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
hh: digitModifier(
'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
'hh': digitModifier(
hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
h: hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
jj: datePartGetterFactory(digitCondition('hour', 2)),
j: datePartGetterFactory(digitCondition('hour', 1)),
mm: digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
m: datePartGetterFactory(digitCondition('minute', 1)),
ss: digitModifier(datePartGetterFactory(digitCondition('second', 2))),
s: datePartGetterFactory(digitCondition('second', 1)),
'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
'jj': datePartGetterFactory(digitCondition('hour', 2)),
'j': datePartGetterFactory(digitCondition('hour', 1)),
'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
'm': datePartGetterFactory(digitCondition('minute', 1)),
'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
's': datePartGetterFactory(digitCondition('second', 1)),
// while ISO 8601 requires fractions to be prefixed with `.` or `,`
// we can be just safely rely on using `sss` since we currently don't support single or two digit
// fractions
sss: datePartGetterFactory(digitCondition('second', 3)),
EEEE: datePartGetterFactory(nameCondition('weekday', 4)),
EEE: datePartGetterFactory(nameCondition('weekday', 3)),
EE: datePartGetterFactory(nameCondition('weekday', 2)),
E: datePartGetterFactory(nameCondition('weekday', 1)),
a: hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
Z: timeZoneGetter('short'),
z: timeZoneGetter('long'),
ww: datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the
// first Thursday of the year. not support ?
w: datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday
'sss': datePartGetterFactory(digitCondition('second', 3)),
'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
'EE': datePartGetterFactory(nameCondition('weekday', 2)),
'E': datePartGetterFactory(nameCondition('weekday', 1)),
'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
'Z': timeZoneGetter('short'),
'z': timeZoneGetter('long'),
'ww': datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the
// first Thursday of the year. not support ?
'w':
datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday
// of the year not support ?
G: datePartGetterFactory(nameCondition('era', 1)),
GG: datePartGetterFactory(nameCondition('era', 2)),
GGG: datePartGetterFactory(nameCondition('era', 3)),
GGGG: datePartGetterFactory(nameCondition('era', 4))
'G': datePartGetterFactory(nameCondition('era', 1)),
'GG': datePartGetterFactory(nameCondition('era', 2)),
'GGG': datePartGetterFactory(nameCondition('era', 3)),
'GGGG': datePartGetterFactory(nameCondition('era', 4))
};

View File

@ -129,6 +129,7 @@ export function isJsObject(o: any): boolean {
}
export function print(obj: Error | Object) {
// tslint:disable-next-line:no-console
console.log(obj);
}

View File

@ -59,7 +59,7 @@ export class XHRConnection implements Connection {
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
// response/responseType properties were introduced in ResourceLoader Level2 spec
// (supported by IE10)
body = _xhr.response == null ? _xhr.responseText : _xhr.response;
body = (typeof _xhr.response === 'undefined') ? _xhr.responseText : _xhr.response;
// Implicitly strip a potential XSSI prefix.
if (typeof body === 'string') {

View File

@ -85,6 +85,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
log(error: string): void {
if (window.console) {
// tslint:disable-next-line:no-console
window.console.log && window.console.log(error);
}
}

View File

@ -36,6 +36,7 @@ export class AngularProfiler {
constructor(ref: ComponentRef<any>) { this.appRef = ref.injector.get(ApplicationRef); }
// tslint:disable:no-console
/**
* Exercises change detection in a loop and then prints the average amount of
* time in milliseconds how long a single round of change detection takes for

View File

@ -63,6 +63,7 @@ export class Parse5DomAdapter extends DomAdapter {
logError(error: string) { console.error(error); }
// tslint:disable-next-line:no-console
log(error: string) { console.log(error); }
logGroup(error: string) { console.error(error); }

View File

@ -22,10 +22,12 @@ export class WorkerDomAdapter extends DomAdapter {
if (console.error) {
console.error(error);
} else {
// tslint:disable-next-line:no-console
console.log(error);
}
}
// tslint:disable-next-line:no-console
log(error: any /** TODO #9100 */) { console.log(error); }
logGroup(error: any /** TODO #9100 */) {
@ -33,6 +35,7 @@ export class WorkerDomAdapter extends DomAdapter {
console.group(error);
this.logError(error);
} else {
// tslint:disable-next-line:no-console
console.log(error);
}
}

View File

@ -15,7 +15,12 @@ export function stringify(obj: any): string {
export function onError(e: any) {
// TODO: (misko): We seem to not have a stack trace here!
console.log(e, e.stack);
if (console.error) {
console.error(e, e.stack);
} else {
// tslint:disable-next-line:no-console
console.log(e, e.stack);
}
throw e;
}

View File

@ -41,7 +41,7 @@ export function main() {
it('should throw an uncaught error', fakeAsync(() => {
const resolveSpy = jasmine.createSpy('resolveSpy');
spyOn(console, 'log');
spyOn(console, 'error');
expect(() => {
adapter.bootstrap(html('<ng2></ng2>'), ['ng1']).ready(resolveSpy);
@ -50,14 +50,14 @@ export function main() {
expect(resolveSpy).not.toHaveBeenCalled();
}));
it('should properly log to the console and re-throw', fakeAsync(() => {
spyOn(console, 'log');
it('should output an error message to the console and re-throw', fakeAsync(() => {
spyOn(console, 'error');
expect(() => {
adapter.bootstrap(html('<ng2></ng2>'), ['ng1']);
flushMicrotasks();
}).toThrowError();
expect(console.log).toHaveBeenCalled();
expect(console.log).toHaveBeenCalledWith(jasmine.any(Error), jasmine.any(String));
expect(console.error).toHaveBeenCalled();
expect(console.error).toHaveBeenCalledWith(jasmine.any(Error), jasmine.any(String));
}));
});

View File

@ -24,7 +24,6 @@ describe('ng2 largetable benchmark', function() {
['interpolation', 'interpolationAttr', 'interpolationFn'].forEach(function(benchmarkType) {
it('should log the ng stats with: ' + benchmarkType, function(done) {
console.log('executing for type', benchmarkType);
runClickBenchmark({
url: URL,
buttons: ['#ng2DestroyDom', '#ng2CreateDom'],

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
urlParamsToForm();
export function getIntParameter(name: string) {

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {browser} from 'protractor';
const yargs = require('yargs');

View File

@ -67,7 +67,7 @@ describe('WebWorkers Animations', function() {
browser.wait(protractor.until.elementLocated(by.css(selector + ' .box')), 5000)
.then(() => {}, () => {
// jasmine will timeout if this gets called too many times
console.log('>> unexpected timeout -> browser.refresh()');
console.error('>> unexpected timeout -> browser.refresh()');
browser.refresh();
waitForBootstrap();
});

View File

@ -67,7 +67,7 @@ describe('WebWorkers Input', function() {
},
() => {
// jasmine will timeout if this gets called too many times
console.log('>> unexpected timeout -> browser.refresh()');
console.error('>> unexpected timeout -> browser.refresh()');
browser.refresh();
waitForBootstrap();
});

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {Component, Host, NgModule} from '@angular/core';
import {AbstractControl, FormBuilder, FormGroup, FormGroupDirective, ReactiveFormsModule, Validators} from '@angular/forms';
import {BrowserModule} from '@angular/platform-browser';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {Component, Directive, Host, NgModule} from '@angular/core';
import {FormControl, FormGroup, FormsModule, NG_VALIDATORS, NgForm} from '@angular/forms';

View File

@ -1,6 +1,6 @@
{
"name": "angular-srcs",
"version": "2.2.3",
"version": "2.2.4",
"private": true,
"branchPattern": "2.0.*",
"description": "Angular 2 - a web framework for modern web apps",

View File

@ -28,6 +28,7 @@ export interface CompilerInterface {
const DEBUG = false;
function debug(msg: string, ...o: any[]) {
// tslint:disable-next-line:no-console
if (DEBUG) console.log(msg, ...o);
}

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {spawn} from 'child_process';
import {existsSync, mkdirSync, writeFileSync} from 'fs';

View File

@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
/* tslint:disable:no-console */
import {spawn} from 'child_process';
import {platform} from 'os';
import {normalize} from 'path';

View File

@ -5,6 +5,7 @@
],
"rules": {
"file-header": [true, "Copyright Google Inc\\."],
"no-console": [true, "log"],
"no-duplicate-imports": true,
"no-duplicate-variable": true,
"no-jasmine-focus": true,