285 Commits

Author SHA1 Message Date
Tobias Bosch
33910ddfc9 refactor(compiler): store metadata of top level symbols also in summaries ()
This allows a build using summaries to not need .metadata.json files at all
any more.

Part of 
2016-12-15 09:12:40 -08:00
Chuck Jazdzewski
b6078f5887 fix(compiler): update to metadata version 3 ()
This change retracts support for metadata version 2.

The collector used to produce version 2 metadata was incomplete
and can cause the AOT compiler to fail to resolve symbols or
produce other spurious errors.

All libraries compiled and published with 2.3.0 ngc will need
to be recompiled and updated with this change.
2016-12-14 15:28:51 -08:00
Victor Berchet
c65b4fa9dc refactor: format & lint 2016-12-14 15:10:43 -08:00
Victor Berchet
aa40366a92 fix(compiler): fix simplify a reference without a name
closes 
2016-12-14 14:33:10 -08:00
Alex Rickabaugh
aa3769ba69 fix(compiler): resolver should merge host bindings and listeners ()
fixes 
2016-12-14 14:31:57 -08:00
Chuck Jazdzewski
dd0519abad fix(compiler): emit quoted object literal keys if the source is quoted
feat(tsc-wrapped): recored when to quote a object literal key

Collecting quoted literals is off by default as it introduces
a breaking change in the .metadata.json file. A follow-up commit
will address this.

Fixes 
Closes 
2016-12-14 12:58:41 -08:00
Victor Berchet
f238c8ac7a Revert "fix(compiler): xmb <ph> tags should not self close ()"
This reverts commit 4b3d13519399f8db5ead50ab24ee6e5a64acbe43.
closes 
2016-12-14 12:54:58 -08:00
Victor Berchet
8c27c62fab Revert "test(i18n): fix a typo in the reference xmb ()"
This reverts commit a8d237581d4df742bb1e36be56518f383bf3d19f.
2016-12-14 12:54:50 -08:00
Victor Berchet
a8d237581d test(i18n): fix a typo in the reference xmb () 2016-12-13 12:35:09 -08:00
Chuck Jazdzewski
2b90cd532f fix(compiler): narrow the span reported for invalid pipes
fixes 
closes 
2016-12-13 11:23:47 -08:00
Victor Berchet
4b3d135193 fix(compiler): xmb <ph> tags should not self close () 2016-12-12 19:10:20 -08:00
Victor Berchet
3bee521aa4 fix(compiler): support dotted property binding
fixes 
2016-12-09 15:37:41 -08:00
Victor Berchet
95f48292b1 test(Selector): add a test for dotted attribute names 2016-12-09 15:37:41 -08:00
Misko Hevery
213c713409 fix: Better error when directive not listed in NgModule.declarations 2016-12-09 11:16:28 -08:00
Dzmitry Shylovich
9a8423da36 fix(selector): SelectorMatcher match elements with :not selector () 2016-12-09 10:45:48 -08:00
maxime-allex
56c361ff6a test(compiler): test i18n explicit id
closes 
2016-12-09 10:43:57 -08:00
Tobias Bosch
5614c4ff0f fix(compiler): serialize any StaticSymbol correctly, not matter in which context. 2016-12-05 14:20:01 -08:00
Tobias Bosch
75d1617b63 fix(compiler): include the summaries of reexported modules / directives / pipes ()
Only if these are not part of the sources.
2016-12-02 10:08:46 -08:00
Tobias Bosch
614a35d539 feat(compiler): read and write .ngsummary.json files
When compiling libraries, this feature extracts the minimal information
from the directives/pipes/modules of the library into `.ngsummary.json` files,
so that applications that use this library only need to be recompiled
if one of the summary files change, but not on every change
of the libraries (e.g. one of the templates).

Only works if individual codegen for libraries is enabled,
see the `generateCodeForLibraries: false` option.

Closes 
2016-12-01 14:49:52 -08:00
Tobias Bosch
9ab401f4d3 refactor(compiler): simplify NgModuleSymmaryMetadata
- merge `NgModuleInjectorSummary` and `NgModuleDirectiveSummary`
- remove `directiveLoaders` from the summary
2016-12-01 14:49:52 -08:00
Tobias Bosch
3e73bea3e7 refactor(compiler): convert metadata classes used in summaries into interfaces ()
Part of 
2016-11-30 10:52:51 -08:00
Tobias Bosch
627282d2c8 fix(compiler): correctly evaluate references to static functions () 2016-11-29 12:02:50 -08:00
Tobias Bosch
2f7492c986 refactor(compiler): remove unneeded fields from metadata
Removes `CompileIdentifierMetadata.name` / `.moduleUrl`,
as well as `CompileTypeMetadata.name / moduleUrl` and
`CompileFactoryMetadata.name / moduleUrl`.
2016-11-28 15:19:23 -08:00
Tobias Bosch
2452cd14e0 refactor(compiler): drop old codegen tests that run inside of test.sh
These tests were hard to maintain and only yielded little value,
now that we have the full integration with TypeScript.
2016-11-28 15:19:23 -08:00
Tobias Bosch
f5c8e0989d feat(core): properly support inheritance
## Inheritance Semantics:

Decorators:
1) list the decorators of the class and its parents in the ancestor first order
2) only use the last decorator of each kind (e.g. @Component / ...)

Constructor parameters:
If a class inherits from a parent class and does not declare
a constructor, it inherits the parent class constructor,
and with it the parameter metadata of that parent class.

Lifecycle hooks:
Follow the normal class inheritance model,
i.e. lifecycle hooks of parent classes will be called
even if the method is not overwritten in the child class.

## Example

E.g. the following is a valid use of inheritance and it will
also inherit all metadata:

```
@Directive({selector: 'someDir'})
class ParentDirective {
  constructor(someDep: SomeDep) {}

  ngOnInit() {}
}

class ChildDirective extends ParentDirective {}
```

Closes 
Closes 
2016-11-28 14:12:12 -08:00
Tobias Bosch
2a5bd2f345 refactor(compiler): Reintroduce ReflectorHost and move Extractor into @angular/compiler 2016-11-18 10:04:14 -08:00
Tobias Bosch
3c06a5dc25 refactor(comiler): various cleanups 2016-11-18 10:04:14 -08:00
Tobias Bosch
adeea5d86a refactor(compiler): renames
- `NgHost` to `CompilerHost`
- `AotCompilerHost.resolveFileToImport` to `AotCompilerHost.fileNameToModuleName`
- `AotCompilerHoset.resolveImportToFile` to `AotCompilerHost.moduleNameToFileName`
2016-11-18 10:04:14 -08:00
Tobias Bosch
dddbb1c1cb refactor(tsc-wrapped): collect all exported functions and classes and bump metadata version from 1 to 2
This is needed to resolve symbols without `.d.ts` files.
This bumps the version of the metadata from 1 to 2.
This adds logic into `ng_host.ts` to automatically upgrade
version 1 to version 2 metadata by adding the exported symbols
from the `.d.ts` file.
2016-11-18 10:04:14 -08:00
Tobias Bosch
2235048432 refactor(compiler): add createAotCompiler factory
Also adds 2 more methods to the `AotCompilerHost`:
- `loadResource`
- `resolveFileToImport`
2016-11-18 10:04:14 -08:00
Tobias Bosch
484119e59f refactor(compiler): remove asset: urls
These urls were just relicts from Dart.
2016-11-18 10:04:14 -08:00
Tobias Bosch
24099bdbd2 refactor(compiler): move findDeclaration into the StaticReflector
Previously, this was part of the `AotCompilerHost`.
The `AotCompilerHost` is now also greatly simplified.
2016-11-18 10:04:14 -08:00
Tobias Bosch
912ca44979 refactor(compiler): move static_reflector into @angular/compiler and rename files
- `src/runtime_compiler.ts` -> `src/jit/compiler.ts`
- `src/compiler.ts` -> `src/jit/compiler_factory.ts`
- `src/offline_compiler` -> `src/aot/compiler.ts`

Part of 
2016-11-18 10:04:14 -08:00
Victor Berchet
7908679c4b fix(compiler): assert xliff messages have translations
fixes 
closes 
2016-11-14 12:55:56 -08:00
Victor Berchet
9ed9ff40b3 test(compiler): improve xliff tests 2016-11-14 12:55:48 -08:00
Victor Berchet
2f14415836 fix(compiler): updates hash algo for xmb/xtb files 2016-11-14 12:55:48 -08:00
Victor Berchet
76e4911e8b fix(core): fix placeholders handling in i18n.
Prior to this commit, translations were built in the serializers. This
could not work as a single translation can be used for different source
messages having different placeholder content.

Serializers do not try to replace the placeholders any more.
Placeholders are replaced by the translation bundle and the source
message is given as parameter so that the content of the placeholders is
taken into account.

Also XMB ids are now independent of the expression which is replaced by
a placeholder in the extracted file.
fixes 
2016-11-14 12:55:48 -08:00
Victor Berchet
05beffe0d0 test(core): fix a typo in the i18n integration spec 2016-11-14 12:55:48 -08:00
Victor Berchet
08c038ebd9 fix(core): xmb serializer uses decimal messaged IDs
fixes 
2016-11-14 12:55:48 -08:00
Victor Berchet
582550a90d feat(core): implements a decimal fingerprint for i18n 2016-11-14 12:55:48 -08:00
Joao Dias
77ee27c59e refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
Chuck Jazdzewski
a965d11cce fix(compiler): generate safe access strictNullChecks compatible code ()
fixes 
2016-11-11 17:12:17 -08:00
Tobias Bosch
fcb4e66493 refactor(compiler): introduce summaries for metadata ()
This does not yet introduce loading / serialization of summaries.

Part of 
2016-11-10 16:27:53 -08:00
Tobias Bosch
79383ce150 refactor(compiler): never create CompileDirectiveMetadata with not loaded resources ()
Part of 
2016-11-10 14:07:30 -08:00
Chuck Jazdzewski
c3c0e2e2a2 refactor(compiler): add span to TemplateBinding ()
fix(compiler): corrected error location for implicit templates expressions
2016-11-10 13:15:09 -08:00
Matias Niemelä
a0e9fde653 fix(animations): always normalize style properties and values during compilation ()
Closes 
Closes 
Closes 
2016-11-08 15:45:30 -08:00
Victor Berchet
778e6ad3b4 refactor: cleanup ICU message syntax 2016-11-08 15:44:18 -08:00
Victor Berchet
55dc0e4a5f fix(compiler): use the other case by default in ICU messages 2016-11-08 15:44:18 -08:00
Victor Berchet
acbf1d859c fix(core): fix pseudo-selector shimming ()
fixes 
fixes 
2016-11-07 13:56:04 -08:00
Victor Berchet
ec92f4b198 refactor: remove keys() and values() from MapWrapper 2016-11-04 13:27:38 -07:00