Commit Graph

7687 Commits

Author SHA1 Message Date
Tobias Bosch 5c34066058 fix(compiler): only warn for `@Injectable` classes with invalid args.
In v2.x, users had to annotate classes that they intended to use as tokens with `@Injectable`. This is no longer required in v4.x for tokens,
and we now require the constructor parameters of classes annotated
with `@Injectable` to be statically analyzable by ngc.

This commit reduces the error into a warning
if the constructor parameters do not meet this condition.

DEPRECATION:
- Classes annotated with `@Injectable` but whose constructor’s parameter types
  are not statically analyzable by ngc will produce a warning.

Closes #15003
2017-03-14 19:52:53 -07:00
Tobias Bosch 50ab06e29d fix(compiler): generated code should pass `noUnusedLocals` check
Closes #14797
2017-03-14 19:52:53 -07:00
Tobias Bosch 06fc42bc44 fix(core): don’t throw if queries change during change detection.
Throwing on query changes would be a breaking change compared to v2.
Also discovers a bug with querying manually projected content, see #15117.

Related to #14748
Closes #14925
2017-03-14 19:52:53 -07:00
Victor Berchet 959a03a61f fix(compiler): fix utf8encode, move to sharted utils, add tests (#15076) 2017-03-14 17:13:39 -07:00
Victor Berchet 3b1956bbf2 fix(compiler): warning prints "WARNING" instead of "ERROR" (#15125) 2017-03-14 17:12:44 -07:00
Bowen Ni 3c15916e17 fix(compiler): Improve error message for missing annotations (#14724)
Currently, it says:
Unexpected value 'FuzzyTimePipe in
javascript/angular2/example/search/fuzzy_time.ts' declared by the module
'SearchModule in javascript/angular2/example/search/search_module.ts'

The new error message also suggests: 'Please add a @Pipe/@Directive/@Component annotation.'
2017-03-14 17:12:18 -07:00
vikerman ff60c041f6 test(platform-server): add initial e2e tests for platform-server (#15061) 2017-03-14 17:11:39 -07:00
Victor Berchet 13686bb518 fix: element injector vs module injector (#15044)
fixes #12869
fixes #12889
fixes #13885
fixes #13870

Before this change there was a single injector tree.
Now we have 2 injector trees, one for the modules and one for the components.
This fixes lazy loading modules.

See the design docs for details:
https://docs.google.com/document/d/1OEUIwc-s69l1o97K0wBd_-Lth5BBxir1KuCRWklTlI4

BREAKING CHANGES

`ComponentFactory.create()` takes an extra optional `NgModuleRef` parameter.
No change should be required in user code as the correct module will be used
when none is provided

DEPRECATIONS

The following methods were used internally and are no more required:
- `RouterOutlet.locationFactoryResolver`
- `RouterOutlet.locationInjector`
2017-03-14 16:26:17 -07:00
vikerman f093501501 fix(platform-server): support svg elements with namespaced attributes (#15101) 2017-03-14 15:40:55 -07:00
Jason Jean 80649ea03c fix(platform-server): correctly implement get href in parse5 adapter (#15022) 2017-03-14 15:38:24 -07:00
Kara 778f7d6f33 fix(forms): remove equalsTo validator (#15050)
This API was introduced only in a beta release, and is being removed because we found it to be incorrect prior to launch. For more information about why this is being removed, see https://github.com/angular/angular/pull/15050.
2017-03-14 15:37:51 -07:00
Tobias Bosch 2c5a671341 fix: don't instantiate providers with ngOnDestroy eagerly. (#15070)
BREAKING CHANGE:

Perviously, any provider that had an ngOnDestroy lifecycle hook would be created eagerly.

Now, only classes that are annotated with @Component, @Directive, @Pipe, @NgModule are eager. Providers only become eager if they are either directly or transitively injected into one of the above.

This also makes all `useValue` providers eager, which
should have no observable impact other than code size.

EXPECTED IMPACT:
Making providers eager was an incorrect behavior and never documented.
Also, providers that are used by a directive / pipe / ngModule stay eager.
So the impact should be rather small.

Fixes #14552
2017-03-14 14:32:26 -07:00
Matias Niemelä 0aad270267 refactor(platform-browser): move platform-browser/animations to animations/browser (#15130)
Closes: #15130
2017-03-14 11:55:49 -07:00
Tobias Bosch cdc882bd36 feat: introduce source maps for templates (#15011)
The main use case for the generated source maps is to give
errors a meaningful context in terms of the original source
that the user wrote.

Related changes that are included in this commit:

* renamed virtual folders used for jit:
  * ng://<module type>/module.ngfactory.js
  * ng://<module type>/<comp type>.ngfactory.js
  * ng://<module type>/<comp type>.html (for inline templates)
* error logging:
  * all errors that happen in templates are logged
    from the place of the nearest element.
  * instead of logging error messages and stacks separately,
    we log the actual error. This is needed so that browsers apply
    source maps to the stack correctly.
  * error type and error is logged as one log entry.

Note that long-stack-trace zone has a bug that 
disables source maps for stack traces,
see https://github.com/angular/zone.js/issues/661.

BREAKING CHANGE:

- DebugNode.source no more returns the source location of a node.  

Closes 14013
2017-03-14 09:16:15 -07:00
Pete Bacon Darwin 914797a8ff feat(upgrade): support multi-slot projection in upgrade/static (#14282)
Closes #14261
2017-03-13 17:34:53 -07:00
Chuck Jazdzewski e6c81d2a42 Revert "refactor(platform-browser): move platform-browser/animations to animations/browser (#15043)"
This reverts commit 195b863ea4.
2017-03-13 15:46:44 -07:00
Chuck Jazdzewski 498a95148b Revert "build(animations): adjust animations/browser source to new standard for automatic build (#15043)"
This reverts commit 21a18d6ceb.
2017-03-13 15:46:07 -07:00
Jason Aden 21a18d6ceb build(animations): adjust animations/browser source to new standard for automatic build (#15043) 2017-03-13 14:39:42 -07:00
Matias Niemelä 195b863ea4 refactor(platform-browser): move platform-browser/animations to animations/browser (#15043) 2017-03-13 14:39:19 -07:00
Jason Jean 018e5c979b fix(platform-server): fix get/set title in parse5 adapter (#14965) 2017-03-13 13:22:03 -07:00
Dzmitry Shylovich 6559425b07 fix(core): ErrorHandler should not rethrow an error by default (#15077) 2017-03-13 11:27:01 -07:00
Tobias Bosch df914ef4bf fix(core): don’t recreate `TemplateRef` when used as a reference. (#15066)
This was a regression introduced in v4 rc.0.

Fixes #14873
2017-03-13 10:44:12 -07:00
Tobias Bosch ff71eff157 refactor(core): use flags in `Renderer2.setStyle` instead of booleans (#15045)
BREAKING CHANGE: (since v4 rc.1)
- `Renderer2.setStyle` no longer takes booleans but rather a
  bit mask of flags.
2017-03-13 09:45:04 -07:00
Tobias Bosch 6c8638cf01 feat(core): allow to provide multiple default testing modules (#15054)
This can be used to e.g. add the NoopAnimationsModule by default:

```
TestBed.initTestEnvironment([
  BrowserDynamicTestingModule,
  NoopAnimationsModule
], platformBrowserDynamicTesting());
```
2017-03-10 16:55:32 -08:00
Dzmitry Shylovich 8b5c6b2732 fix(compiler): shouldn't throw when Symbol is used as DI token (#13701)
Closes #13314
2017-03-10 15:26:37 -08:00
Chuck Jazdzewski 601494734c Revert "fix(core): ErrorHandler should not rethrow an error by default (#13534)"
This reverts commit 1aebea52e1.
2017-03-10 15:05:48 -08:00
Dzmitry Shylovich 1aebea52e1 fix(core): ErrorHandler should not rethrow an error by default (#13534)
Closes #14949
Closes #13159
Closes #8993
2017-03-10 14:44:14 -08:00
Dzmitry Shylovich 5f9fb911f7 fix(compiler): improve error msg for unexpected closing tags (#14747)
Closes #6652
2017-03-10 13:05:17 -08:00
Jason Aden bebedfed24 build: build modules and examples for karma 2017-03-08 17:35:20 -08:00
Jason Aden 2b44854885 build: fix paths for examples tests 2017-03-08 16:29:28 -08:00
Jason Aden b74ab83d2c refactor: update paths from modules/@angular to packages 2017-03-08 16:29:28 -08:00
Jason Aden da8ea350b2 refactor: More generic build.sh file 2017-03-08 16:29:28 -08:00
Jason Aden 58dd4673cd refactor: remove babel config files 2017-03-08 16:29:28 -08:00
Jason Aden 72563b61fb build: fix rollup config file paths 2017-03-08 16:29:28 -08:00
Jason Aden 5aed1e36b8 refactor: move secondary entry point rollup configs. 2017-03-08 16:29:28 -08:00
Jason Aden 8573e36574 build: fix file paths after moving modules/@angular/* to packages/* 2017-03-08 16:29:28 -08:00
Jason Aden 3e51a19983 refactor: move angular source to /packages rather than modules/@angular 2017-03-08 16:29:27 -08:00