Commit Graph

52 Commits

Author SHA1 Message Date
Tobias Bosch 126fda2613 perf: delete pre-view-engine core, compiler, platform-browser, etc code (#14788)
After the introduction of the view engine, we can drop a lot of code that is not used any more.

This should reduce the size of the app bundles because a lot of this code was not being properly tree-shaken by today's tools even though it was dead code.
2017-02-27 23:08:19 -08:00
Victor Berchet e99d721612 feat(compiler): Add a `enableLegacyTemplate` option to support `<template>`
When the `enableLegacyTemplate` is set to `false`, `<template>` tags and the
`template` attribute are no more used to define angular templates but are
treated as regular tag and attribute.

The default value is `true`.

In order to define a template, you have to use the `<ng-template>` tag.

This option applies to your application and all the libraries it uses. That is
you should make sure none of them rely on the legacy way to defined templates
when this option is turned off (`false`).
2017-02-23 20:03:16 -08:00
Victor Berchet bf8eb41248 feat(compiler): introduce `<ng-template>`, deprecate `<template>` and `template` attribute
The rationale of this change is to improve the inter-operability with web
components that might make use of the `<template>` tag.

DEPRECATION

The template tags and template attribute are deprecated:

    <template ngFor [ngFor]=items let-item><li>...</li></template>
    <li template="ngFor: let item of items">...</li>

should be rewritten as:

    <ng-template ngFor [ngFor]=items let-item><li>...</li></ng-template>

Note that they still be supported in 4.x with a deprecartion warning in
development mode.

MIGRATION

- `template` tags (or elements with a `template` attribute) should be rewritten
as a `ng-template` tag,
- `ng-content` selectors should be updated to referto a `ng-template` where they
use to refer to a template: `<ng-content selector="template[attr]">` should be
rewritten as `<ng-content selector="ng-template[attr]">`
- if you consume a component relying on your templates being actual `template`
elements (that is they include a `<ng-content selector="template[attr]">`). You
should  still migrate to `ng-template` and make use of `ngProjectAs` to override
the way `ng-content` sees the template:
`<ng-template projectAs="template[attr]">`
- while `template` elements are deprecated in 4.x they continue to work.
2017-02-23 20:03:16 -08:00
Victor Berchet 3f519207a4 refactor(compiler): misc + add a test for directives on inline templates 2017-02-23 20:03:16 -08:00
Victor Berchet d6a58f9f70 feat(core): make `new Inject()` optional for deps specified as `InjectionToken` (#14486)
fixes #10625
2017-02-20 16:20:45 -08:00
Tobias Bosch 4e7752a12a feat(compiler): integrate compiler with view engine (#14487)
Aspects: di, query, content projection

Included refactoring:
- use a number as query id
- use a bloom filter for aggregating matched queries of nested elements
- separate static vs dynamic queries

Part of #14013
2017-02-15 08:36:49 -08:00
Tobias Bosch e4e9dbe33d feat(compiler): integrate compiler with view engine - change detection tests work (#14412)
Included refactoring:
- make ViewData.parentIndex point to component provider index
- split NodeType.Provider into Provider / Directive / Pipe
- make purePipe take the real pipe as argument to detect changes
- order change detection:
  1) directive props
  2) renderer props

Part of #14013

PR Close #14412
2017-02-13 17:02:00 -06:00
Dzmitry Shylovich e5a144d902 fix(compiler): improve error msg for unknown properties on (#14373)
ng-container/ng-content

Closes #14070

PR Close #14373
2017-02-10 15:03:05 -06:00
Dzmitry Shylovich 2c6dab970b fix(compiler): improve error message for unknown elements (#14373) 2017-02-10 15:03:05 -06:00
Tobias Bosch baa654a234 feat(compiler): integrate compiler with view engine - main integration tests work (#14284)
Part of #14013

PR Close #14284
2017-02-10 14:10:03 -06:00
Miško Hevery c33fda2607 perf: Don’t subclass Error; resulting in smaller binary (#14160)
Subclassing errors is problematic since Error returns a
new instance. All of the patching which we do than prevent
proper application of source maps.

PR Close #14160
2017-02-07 19:18:26 -06:00
Victor Berchet e5c6bb4286 fix(Compiler): fix template binding parsing (`*directive="-..."`)
fixes #13800
2017-01-09 15:00:40 -05:00
Victor Berchet 881eb894bc fix(Compiler): allow "." in attribute selectors (#13653)
fixes #13645
2016-12-27 15:23:49 -08:00
Bowen Ni f0e092515c refactor(compiler): don't print stack trace on template parse errors (#13390) 2016-12-15 13:07:12 -08:00
Chuck Jazdzewski 2b90cd532f fix(compiler): narrow the span reported for invalid pipes
fixes #13326
closes #13411
2016-12-13 11:23:47 -08:00
Victor Berchet 3bee521aa4 fix(compiler): support dotted property binding
fixes angular/flex-layout#34
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
Tobias Bosch 3e73bea3e7 refactor(compiler): convert metadata classes used in summaries into interfaces (#13123)
Part of #12787
2016-11-30 10:52:51 -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
Joao Dias 77ee27c59e refactor(): use const and let instead of var 2016-11-12 16:40:17 -08:00
Tobias Bosch fcb4e66493 refactor(compiler): introduce summaries for metadata (#12799)
This does not yet introduce loading / serialization of summaries.

Part of #12787
2016-11-10 16:27:53 -08:00
Chuck Jazdzewski c3c0e2e2a2 refactor(compiler): add `span` to `TemplateBinding` (#12792)
fix(compiler): corrected error location for implicit templates expressions
2016-11-10 13:15:09 -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
Zaven Muradyan e9fd8645ed fix(core): improve error when multiple components match the same element
Closes #7067
2016-10-31 11:28:03 -07:00
Tobias Bosch 178fb79b5c refactor(compiler): move host properties into DirectiveWrapper
Part of #11683
2016-10-26 14:32:24 -07:00
Victor Berchet df1718d624 fix(compiler): allow WS as `<ng-content>` content (#12225) 2016-10-12 07:58:06 -07:00
Chuck Jazdzewski 7275e1beb3 refactor(compiler): add optional `visit()` to `TemplateAstVisitor` (#12209) 2016-10-11 15:46:11 -07:00
Victor Berchet bdcf46f82e refactor(compiler): improve types, misc 2016-10-10 09:20:58 -07:00
Chuck Jazdzewski e1faca6386 refactor(compiler): template element ast has endSourceSpan (#12138) 2016-10-10 09:12:05 -07:00
Alex Eagle 41c8c30973 chore(lint): remove unused imports (#11923)
This was done automatically by tslint, which can now fix issues it finds.
The fixer is still pending in PR https://github.com/palantir/tslint/pull/1568
Also I have a local bugfix for https://github.com/palantir/tslint/issues/1569
which causes too many imports to be deleted.
2016-09-27 17:12:25 -07:00
Marc Laval 61129fa12d fix(compiler): move detection of unsafe properties for binding to ElementSchemaRegistry (#11378) 2016-09-27 17:10:02 -07:00
Matias Niemelä f1b6c6efa1 refactor(animations): ensure animation input/outputs are managed within the template parser (#11782)
Closes #11782
Closes #11601
Related #11707
2016-09-24 05:37:04 +09:00
Brandon 2300c23332 fix(docs): Fixed wording for NgModule schemas (#11620) 2016-09-18 16:03:43 -07:00
Victor Berchet 1df69cb4d2 fix(DomSchemaRegistry): detect invalid elements 2016-08-30 21:32:03 -07:00
Miško Hevery 979657989b fix(packages): use ES modules for primary build (#11120) 2016-08-30 18:07:40 -07:00
Tobias Bosch d7de5c4f8e refactor(compiler): replace `CompileIdentifierMap` with regular `Map`
closes #11145

Also rename `CompileIdentifierMetadata.runtime` into `CompileIdentifierMetadata.reference`.

Also remove `CompileIdentifierMetadata.equalsTo` as
now it is enough to just check the `reference` fields for equality.
2016-08-29 12:45:27 -07:00
Chuck Jazdzewski 51877ef4ed fix(compiler): no longer uses assetCacheKey for token identity.
Fixes #10545, Fixes #10538
2016-08-29 12:45:02 -07:00
Pawel Kozlowski f25c97671a fix(compiler): handle invalid host bindings and events (#11101) 2016-08-26 10:29:53 -07:00
Igor Minar 4d7d2a2daa refactor: remove various leftover unused or deprecated code (#11091) 2016-08-26 09:12:27 -07:00
Marc Laval 0cf5ece7f8 build: workaround to run presubmit.sh on Windows (#11096) 2016-08-26 09:12:10 -07:00
Victor Berchet b867764b0d refactor(template): remove supporter deprecated `var` / `#` (#11084)
BREAKING CHANGES:

- `#` and `var` are not supported any more in expressions, use `let`,
- `var-<name>` could not be used any more on templates, use `let-<name>`,
- `var-<name>` could not be used any more to create a reference, use `ref-<name>`.
2016-08-25 15:21:33 -07:00
Jason Choi c48021ab97 refactor(compiler): move test/test_bindings to testing/test_bindings (#10081)
`test_bindings` is used in core test cases too, but `test` should be
private to the package, so it should live in `testing`.
2016-08-17 16:37:31 -07:00
Matias Niemelä 9adf80385b fix(animations): remove deprecated trigger APIs (#10825)
BREAKING CHANGE: Animations defined using an at-symbol prefix that are
not property bound are now invalid.

```html
<!-- this is now invalid -->
<div @flip="flipState"></div>

<!-- change that to -->
<div [@flip]="flipState"></div>
```

BREAKING CHANGE: Animations that are not bound using the at-symbol
prefix using `animate-` must now be preixed using `bind-animate-`.

```html
<!-- this is now invalid -->
<div animate-flip="flipState"></div>

<!-- is valid now -->
<div bind-animate-flip="flipState"></div>
```

Closes #10825
2016-08-16 14:09:21 -07:00
Matias Niemelä 0b08dd8674 chore(animations): make sure host-prop animation deprecation is correctly emitted
Closes #10581
2016-08-08 23:39:22 -07:00
Victor Berchet cdb1a237e5 refactor(compiler): html_parser -> ml_parser 2016-08-05 13:39:54 -07:00
Misko Hevery a55d796c4b fix: Better error message in case of unknown property binding 2016-08-02 09:28:04 -07:00
Misko Hevery 73f02c7861 fix: throw useful error on missing platform module. 2016-08-02 09:28:04 -07:00
Victor Berchet e73d0511cf fix(TemplateParser): report empty expression (#10391)
fixes #3754
2016-08-01 11:24:49 -07:00
Victor Berchet 11fd2eccec refactor: fix merge glitches 2016-07-29 13:40:58 -07:00