Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(core): mute mode printing in console in prod mode #6662

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
84a09d1
chore(core): mute mode printing in console in prod mode
samjulien Jan 23, 2016
36fae9f
fix(karma): fix running karma via gulp
Jan 30, 2016
49bca79
test: fix transformer tests
vsavkin Feb 2, 2016
0b46df0
fix(docs): `rxjs/add/operators/map` -> `rxjs/add/operator/map` (no 's').
KiaraGrouwstra Dec 20, 2015
2c30b4b
Update CHANGELOG.md
sceendy Dec 30, 2015
8fabf4d
docs(developer): add linting instructions
vepasto Jan 3, 2016
bd12cd9
docs(changelog): fix header for 2.0.0-beta.0
JoshAntBrown Jan 12, 2016
3969853
change event to use camel case
BeastCode Jan 23, 2016
d936cd5
docs(cheatsheet): change as to name in routing section
cebor Jan 24, 2016
b714a95
docs(http): Added base request options for test example
brandonroberts Dec 21, 2015
d583065
Typo: Hash_consing wiki link wrong Markdown syntax
OlsonDev Jan 6, 2016
d1c8d9f
feat(upgrade): support bindToController with binding definitions
0x-r4bbit Nov 13, 2015
046c668
build(router): refactor angular1 router build script
btford Jan 29, 2016
966e25f
build(router): make the build.js script portable to g3
alexeagle Feb 2, 2016
6c374c0
perf(dart/transform): Only process deferred libs when necessary
Jan 28, 2016
080252a
refactor(dart/transform): Error in name convert funcs on unexpected i…
Jan 28, 2016
ed82d7f
feat(ngFor): add custom trackBy function support
kara Feb 2, 2016
b0b66ae
docs(core): update QueryList's onChange to changes.subscribe
shuhei Jan 1, 2016
451fa1b
fix(Validators): fix Validators.required marking number zero as invalid
ericmartinezr Jan 21, 2016
35de702
fix(async): handle synchronous initial value in async pipe
robwormald Dec 18, 2015
73a122d
style(ReflectionCapabilities) _zipTypesAndAnnotations, not _zipTypesA…
Jan 17, 2016
a1d4a36
fix(WebWorkers): Fix flaky WebWorker test
jteplitz Feb 3, 2016
e734d23
chore(http): make all typings explicit
jeffbcross Feb 2, 2016
a1933ec
docs(http): fix example usage of MockBackend
chrisguttandin Jan 12, 2016
3c247b7
docs(http.ts): Fix MockBackend examples using backend.connections obs…
scatcher Jan 20, 2016
6b59a8c
fix(Headers): serializable toJSON
PatrickJS Jan 27, 2016
6271a0a
fix(router): fix incorrect url param value coercion of 1 to true
bkyarger Jan 6, 2016
50d0b2f
fix(compiler): fix interpolation regexp
wesleycho Dec 21, 2015
2ca138a
chore(release): bump version to beta.3
alexeagle Feb 3, 2016
223be25
docs(changelog): changelog for beta.3
alexeagle Feb 3, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 34 additions & 7 deletions CHANGELOG.md
@@ -1,3 +1,33 @@
<a name="2.0.0-beta.3"></a>
# 2.0.0-beta.3 (2016-02-03)


### Bug Fixes

* **bundle:** add angular2/platform/testing/browser to SystemJS testing bundle ([ae7d2ab](https://github.com/angular/angular/commit/ae7d2ab))
* **circle:** pre-dependencies `npm install npm` ([36a0e04](https://github.com/angular/angular/commit/36a0e04)), closes [#6777](https://github.com/angular/angular/issues/6777)
* **dart/transform:** Handle edge cases in ReflectionRemover ([3e9b532](https://github.com/angular/angular/commit/3e9b532)), closes [#6749](https://github.com/angular/angular/issues/6749)
* **docs:** `rxjs/add/operators/map` -> `rxjs/add/operator/map` (no 's'). ([2a302aa](https://github.com/angular/angular/commit/2a302aa))
* **karma:** fix running karma via gulp ([27daeaf](https://github.com/angular/angular/commit/27daeaf))
* **query:** don’t cross component boundaries ([c6adbf6](https://github.com/angular/angular/commit/c6adbf6)), closes [#6759](https://github.com/angular/angular/issues/6759)
* **query:** update view queries that query directives in embedded views ([1f7a41c](https://github.com/angular/angular/commit/1f7a41c)), closes [#6747](https://github.com/angular/angular/issues/6747)
* **WebWorkers:** Add support for transitionend events. ([c2a38c0](https://github.com/angular/angular/commit/c2a38c0)), closes [#6649](https://github.com/angular/angular/issues/6649)
* **zone:** correct incorrect calls to zone ([3211938](https://github.com/angular/angular/commit/3211938))

### Features

* **change_detection:** allow all legal programs in the dev mode ([42231f5](https://github.com/angular/angular/commit/42231f5))
* **dart/transform:** Generate all code into <file>.template.dart ([8c36aa8](https://github.com/angular/angular/commit/8c36aa8))
* **debug:** replace DebugElement with new Debug DOM ([e1bf3d3](https://github.com/angular/angular/commit/e1bf3d3))
* **ngFor:** add custom trackBy function support ([cee2318](https://github.com/angular/angular/commit/cee2318)), closes [#6779](https://github.com/angular/angular/issues/6779)
* **upgrade:** support bindToController with binding definitions ([99e6500](https://github.com/angular/angular/commit/99e6500)), closes [#4784](https://github.com/angular/angular/issues/4784)
* **WebWorker:** Add Router Support for WebWorker Apps ([8bea667](https://github.com/angular/angular/commit/8bea667)), closes [#3563](https://github.com/angular/angular/issues/3563)

### Performance Improvements

* **dart/transform:** Only process deferred libs when necessary ([f56df65](https://github.com/angular/angular/commit/f56df65)), closes [#6745](https://github.com/angular/angular/issues/6745)


<a name="2.0.0-beta.2"></a>
# 2.0.0-beta.2 (2016-01-28)

Expand Down Expand Up @@ -124,10 +154,7 @@ setBaseTestProviders(TEST_BROWSER_PLATFORM_PROVIDERS,

### BREAKING CHANGES

* Before
Previously Angular would run in dev prod mode by default, and you could enable the dev mode by calling enableDevMode.
After
Now, Angular runs in the dev mode by default, and you can enable the prod mode by calling enableProdMode.
* Previously, Angular would run in dev prod mode by default, and you could enable the dev mode by calling enableDevMode. Now, Angular runs in the dev mode by default, and you can enable the prod mode by calling enableProdMode.



Expand Down Expand Up @@ -204,11 +231,11 @@ bundle. `ngUpgrade` has a dedicated `upgrade.js` bundle now.

* `Observable` are no more re-exported from `angular2/core`

Before
Before
```
import {Observable} from 'angular2/core'
```
After
After
```
import {Observable} from 'rxjs/Observable';
```
Expand Down Expand Up @@ -429,7 +456,7 @@ import * as core from 'angular2/core';
* Operators and Observables from RxJS (e.g. .map(), .toArray(), .toPromise(), etc ) now need to be explicitly imported (once per operator in your app)
```
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operators/map';
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/interval';

Observable.interval(1000).subscribe(...);
Expand Down
14 changes: 12 additions & 2 deletions DEVELOPER.md
Expand Up @@ -9,7 +9,7 @@ JS and Dart versions. It also explains the basic mechanics of using `git`, `node
* [Installing NPM Modules and Dart Packages](#installing-npm-modules-and-dart-packages)
* [Build commands](#build-commands)
* [Running Tests Locally](#running-tests-locally)
* [Formatting](#clang-format)
* [Code Style](#code-style)
* [Project Information](#project-information)
* [CI using Travis](#ci-using-travis)
* [Transforming Dart code](#transforming-dart-code)
Expand Down Expand Up @@ -227,7 +227,9 @@ Angular specific command line options when running protractor:
Angular specific command line options when running protractor (e.g. force gc, ...):
`$(npm bin)/protractor protractor-{js|dart2js}-conf.js --ng-help`

## Formatting with <a name="clang-format">clang-format</a>
## Code Style

### Formatting with <a name="clang-format">clang-format</a>

We use [clang-format](http://clang.llvm.org/docs/ClangFormat.html) to automatically enforce code
style for our TypeScript code. This allows us to focus our code reviews more on the content, and
Expand Down Expand Up @@ -273,6 +275,14 @@ to some whitespace difference.
* `clang-format` integrations are also available for many popular editors (`vim`, `emacs`,
`Sublime Text`, etc.).

### Linting

We use [tslint](https://github.com/palantir/tslint) for linting. See linting rules in [gulpfile](gulpfile.js). To lint, run

```shell
$ gulp lint
```

## Generating the API documentation

The following gulp task will generate the API docs in the `dist/angular.io/partials/api/angular2`:
Expand Down
8 changes: 6 additions & 2 deletions gulpfile.js
Expand Up @@ -627,7 +627,11 @@ gulp.task('!test.unit.router/karma-run', function(done) {
});
});

gulp.task('buildRouter.dev', function() { buildRouter(); });
gulp.task('buildRouter.dev', function() {
var modulesSrcDir = __dirname + '/modules';
var distDir = __dirname + '/dist';
buildRouter(modulesSrcDir, distDir);
});

gulp.task('test.unit.dart', function(done) {
printModulesWarning();
Expand Down Expand Up @@ -826,7 +830,7 @@ gulp.task('test.unit.js/ci', function(done) {
reporters: ['dots'],
browsers: browserConf.browsersToRun
},
done)
function(err) { done(); })
.start();
});

Expand Down
50 changes: 38 additions & 12 deletions modules/angular1_router/build.js
Expand Up @@ -21,18 +21,25 @@ var files = [

var PRELUDE = '(function(){\n';
var POSTLUDE = '\n}());\n';
var FACADES = fs.readFileSync(__dirname + '/lib/facades.es5', 'utf8');
var DIRECTIVES = fs.readFileSync(__dirname + '/src/ng_outlet.ts', 'utf8');
var moduleTemplate = fs.readFileSync(__dirname + '/src/module_template.js', 'utf8');

function main() {
var dir = __dirname + '/../angular2/src/router/';
function main(modulesDirectory) {
var angular1RouterModuleDirectory = modulesDirectory + '/angular1_router';

var facades = fs.readFileSync(
angular1RouterModuleDirectory + '/lib/facades.es5', 'utf8');
var directives = fs.readFileSync(
angular1RouterModuleDirectory + '/src/ng_outlet.ts', 'utf8');
var moduleTemplate = fs.readFileSync(
angular1RouterModuleDirectory + '/src/module_template.js', 'utf8');

var dir = modulesDirectory + '/angular2/src/router/';
var sharedCode = files.reduce(function (prev, file) {
return prev + transform(fs.readFileSync(dir + file, 'utf8'));
}, '');

var out = moduleTemplate.replace('//{{FACADES}}', FACADES).replace('//{{SHARED_CODE}}', sharedCode);
return PRELUDE + transform(DIRECTIVES) + out + POSTLUDE;
var out = moduleTemplate.replace('//{{FACADES}}', facades)
.replace('//{{SHARED_CODE}}', sharedCode);
return PRELUDE + transform(directives) + out + POSTLUDE;
}

/*
Expand Down Expand Up @@ -62,10 +69,29 @@ function isFacadeModule(modulePath) {
modulePath === 'angular2/src/core/reflection/reflection';
}

module.exports = function () {
var dist = __dirname + '/../../dist';
if (!fs.existsSync(dist)) {
fs.mkdirSync(dist);
module.exports = function(modulesDirectory, outputDirectory) {
if (!fs.existsSync(outputDirectory)) {
fs.mkdirSync(outputDirectory);
}
fs.writeFileSync(dist + '/angular_1_router.js', main());
fs.writeFileSync(
outputDirectory + '/angular_1_router.js', main(modulesDirectory));
};

// CLI entry point
if (require.main === module) {
try {
var args = process.argv;
args.shift(); // node
args.shift(); // scriptfile.js
if (args.length < 2) {
console.log("usage: $0 outFile path/to/modules");
process.exit(1);
}
var outfile = args.shift();
var directory = args.shift();
fs.writeFileSync(outfile, main(directory));
} catch (e) {
console.log(e.message);
process.exit(1);
}
}
12 changes: 6 additions & 6 deletions modules/angular2/docs/cheatsheet/routing.md
Expand Up @@ -10,16 +10,16 @@ Routing and navigation
@cheatsheetItem
syntax(ts):
`@RouteConfig([
{ path: '/:myParam', component: MyComponent, as: 'MyCmp' },
{ path: '/staticPath', component: ..., as: ...},
{ path: '/*wildCardParam', component: ..., as: ...}
{ path: '/:myParam', component: MyComponent, name: 'MyCmp' },
{ path: '/staticPath', component: ..., name: ...},
{ path: '/*wildCardParam', component: ..., name: ...}
])
class MyComponent() {}`|`@RouteConfig`
syntax(js):
`var MyComponent = ng.router.RouteConfig([
{ path: '/:myParam', component: MyComponent, as: 'MyCmp' },
{ path: '/staticPath', component: ..., as: ...},
{ path: '/*wildCardParam', component: ..., as: ...}
{ path: '/:myParam', component: MyComponent, name: 'MyCmp' },
{ path: '/staticPath', component: ..., name: ...},
{ path: '/*wildCardParam', component: ..., name: ...}
]).Class({
constructor: function() {}
});`|`ng.router.RouteConfig`
Expand Down
12 changes: 8 additions & 4 deletions modules/angular2/http.ts
Expand Up @@ -141,7 +141,8 @@ export {URLSearchParams} from './src/http/url_search_params';
* // Send a response to the request
* connection.mockRespond(response);
* });
* });
* }
* });
*
* http.get('people.json').observer({
* next: res => {
Expand All @@ -156,7 +157,8 @@ export const HTTP_PROVIDERS: any[] = [
// issue: https://github.com/angular/angular/issues/3183
provide(Http,
{
useFactory: (xhrBackend, requestOptions) => new Http(xhrBackend, requestOptions),
useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions) =>
new Http(xhrBackend, requestOptions),
deps: [XHRBackend, RequestOptions]
}),
BrowserXhr,
Expand Down Expand Up @@ -268,7 +270,8 @@ export const HTTP_BINDINGS = HTTP_PROVIDERS;
* // Send a response to the request
* connection.mockRespond(response);
* });
* });
* }
* });

* jsonp.get('people.json').observer({
* next: res => {
Expand All @@ -283,7 +286,8 @@ export const JSONP_PROVIDERS: any[] = [
// issue: https://github.com/angular/angular/issues/3183
provide(Jsonp,
{
useFactory: (jsonpBackend, requestOptions) => new Jsonp(jsonpBackend, requestOptions),
useFactory: (jsonpBackend: JSONPBackend, requestOptions: RequestOptions) =>
new Jsonp(jsonpBackend, requestOptions),
deps: [JSONPBackend, RequestOptions]
}),
BrowserJsonp,
Expand Down
10 changes: 7 additions & 3 deletions modules/angular2/src/common/directives/ng_for.ts
Expand Up @@ -6,7 +6,8 @@ import {
IterableDiffers,
ViewContainerRef,
TemplateRef,
EmbeddedViewRef
EmbeddedViewRef,
TrackByFn
} from 'angular2/core';
import {isPresent, isBlank} from 'angular2/src/facade/lang';

Expand Down Expand Up @@ -59,10 +60,11 @@ import {isPresent, isBlank} from 'angular2/src/facade/lang';
* See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
* example.
*/
@Directive({selector: '[ngFor][ngForOf]', inputs: ['ngForOf', 'ngForTemplate']})
@Directive({selector: '[ngFor][ngForOf]', inputs: ['ngForTrackBy', 'ngForOf', 'ngForTemplate']})
export class NgFor implements DoCheck {
/** @internal */
_ngForOf: any;
_ngForTrackBy: TrackByFn;
private _differ: IterableDiffer;

constructor(private _viewContainer: ViewContainerRef, private _templateRef: TemplateRef,
Expand All @@ -71,7 +73,7 @@ export class NgFor implements DoCheck {
set ngForOf(value: any) {
this._ngForOf = value;
if (isBlank(this._differ) && isPresent(value)) {
this._differ = this._iterableDiffers.find(value).create(this._cdr);
this._differ = this._iterableDiffers.find(value).create(this._cdr, this._ngForTrackBy);
}
}

Expand All @@ -81,6 +83,8 @@ export class NgFor implements DoCheck {
}
}

set ngForTrackBy(value: TrackByFn) { this._ngForTrackBy = value; }

ngDoCheck() {
if (isPresent(this._differ)) {
var changes = this._differ.diff(this._ngForOf);
Expand Down
Expand Up @@ -57,7 +57,7 @@ class ObservableListDiff extends DefaultIterableDiffer {
class ObservableListDiffFactory implements IterableDifferFactory {
const ObservableListDiffFactory();
bool supports(obj) => obj is ObservableList;
IterableDiffer create(ChangeDetectorRef cdRef) {
IterableDiffer create(ChangeDetectorRef cdRef, [Function trackByFn]) {
return new ObservableListDiff(cdRef);
}
}
6 changes: 4 additions & 2 deletions modules/angular2/src/common/forms/validators.ts
@@ -1,4 +1,4 @@
import {isBlank, isPresent, CONST_EXPR} from 'angular2/src/facade/lang';
import {isBlank, isPresent, CONST_EXPR, isString} from 'angular2/src/facade/lang';
import {PromiseWrapper} from 'angular2/src/facade/promise';
import {ObservableWrapper} from 'angular2/src/facade/async';
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
Expand Down Expand Up @@ -44,7 +44,9 @@ export class Validators {
* Validator that requires controls to have a non-empty value.
*/
static required(control: modelModule.Control): {[key: string]: boolean} {
return isBlank(control.value) || control.value == "" ? {"required": true} : null;
return isBlank(control.value) || (isString(control.value) && control.value == "") ?
{"required": true} :
null;
}

/**
Expand Down
1 change: 1 addition & 0 deletions modules/angular2/src/common/pipes/async_pipe.ts
Expand Up @@ -81,6 +81,7 @@ export class AsyncPipe implements PipeTransform, OnDestroy {
if (isPresent(obj)) {
this._subscribe(obj);
}
this._latestReturnedValue = this._latestValue;
return this._latestValue;
}

Expand Down
9 changes: 4 additions & 5 deletions modules/angular2/src/core/application_ref.ts
Expand Up @@ -456,11 +456,10 @@ export class ApplicationRef_ extends ApplicationRef {
});
return completer.promise.then(_ => {
let c = this._injector.get(Console);
let modeDescription =
assertionsEnabled() ?
"in the development mode. Call enableProdMode() to enable the production mode." :
"in the production mode. Call enableDevMode() to enable the development mode.";
c.log(`Angular 2 is running ${modeDescription}`);
if (assertionsEnabled()) {
c.log(
"Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.");
}
return _;
});
}
Expand Down
3 changes: 2 additions & 1 deletion modules/angular2/src/core/change_detection.ts
Expand Up @@ -20,5 +20,6 @@ export {
IterableDifferFactory,
KeyValueDiffers,
KeyValueDiffer,
KeyValueDifferFactory
KeyValueDifferFactory,
TrackByFn
} from './change_detection/change_detection';
@@ -1,4 +1,4 @@
import {IterableDiffers, IterableDifferFactory} from './differs/iterable_differs';
import {IterableDiffers, IterableDifferFactory, TrackByFn} from './differs/iterable_differs';
import {DefaultIterableDifferFactory} from './differs/default_iterable_differ';
import {KeyValueDiffers, KeyValueDifferFactory} from './differs/keyvalue_differs';
import {DefaultKeyValueDifferFactory} from './differs/default_keyvalue_differ';
Expand Down Expand Up @@ -37,7 +37,12 @@ export {BindingRecord, BindingTarget} from './binding_record';
export {DirectiveIndex, DirectiveRecord} from './directive_record';
export {DynamicChangeDetector} from './dynamic_change_detector';
export {ChangeDetectorRef} from './change_detector_ref';
export {IterableDiffers, IterableDiffer, IterableDifferFactory} from './differs/iterable_differs';
export {
IterableDiffers,
IterableDiffer,
IterableDifferFactory,
TrackByFn
} from './differs/iterable_differs';
export {KeyValueDiffers, KeyValueDiffer, KeyValueDifferFactory} from './differs/keyvalue_differs';
export {PipeTransform} from './pipe_transform';
export {WrappedValue, SimpleChange} from './change_detection_util';
Expand Down