Commit Graph

560 Commits

Author SHA1 Message Date
Bowen Ni 44bb337acc fix(compiler): disable non-components as an entry component (#14335)
PR Close #14335
2017-02-09 14:45:49 -08:00
Alex Eagle b9d293af03 build: first pass of de-duplicating tsconfig.json content (#14369)
PR Close #14369
2017-02-09 14:32:40 -08:00
Dzmitry Shylovich 6b9aa2ca3d fix(compiler): allow absolute style urls (#14365)
Closes #4974

PR Close #14365
2017-02-09 14:32:39 -08:00
Bowen Ni a696f4aade fix(compiler): improve error messages in aot compiler (#14333)
Do not print the stack trace when the component is not declared in the module.

PR Close #14333
2017-02-09 14:32:39 -08:00
Victor Berchet bb4db2d8f3 feat(compiler): add target locale to the translation bundles (#14290)
PR Close #14290
2017-02-09 14:32:39 -08:00
Victor Berchet 881dce841f refactor(compiler): Load the translation bundle only once in the i18n html parser (#14362)
fixes #14322
2017-02-09 12:08:23 -06:00
Alex Eagle ef32e6b0d0 fix: build and test fixes for TS 2.1 (#13294) 2017-02-08 11:32:40 -06:00
Alex Eagle 5c431cee02 build: remove post-processing of .d.ts files (#13294)
Note that the duplication in tsconfig.json files will be fixed in a followup CL now that we have tsconfig inheritance

BREAKING CHANGE: Angular 4 will support only TypeScript 2.1, so we no longer provide backwards compatibility to TS 1.8.
2017-02-08 11:32:34 -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
Misko Hevery 3c2842be96 refactor: remove unneeded output_emitter_utils (#14160) 2017-02-07 19:17:58 -06:00
mgechev a378aab9aa docs(compiler): incorrect method reference (#14314)
PR Close #14314
2017-02-07 12:45:15 -06:00
Chuck Jazdzewski 388afa414e test(compiler): add integration like tests to compiler unit tests (#14157)
Closes PR #14157

PR Close #14157
2017-02-03 15:06:51 -06:00
Chuck Jazdzewski 69e14b500b feat(compiler): generate type parameters for generic type references (#14104) 2017-02-01 09:29:51 -06:00
Alex Eagle b4214d60a6 fix(compiler): allow expressions or functions in extends (#14158)
Fixes #14154

PR Close #14158
2017-01-31 18:35:10 -06:00
Victor Berchet 5921c872b6 fix(compiler): only lex messages that are needed by angular (#14208)
To avoid the lexer erroring on syntax not supported by Angular.

PR Close #14208
2017-01-31 16:21:55 -06:00
Chuck Jazdzewski 49fb8143e8 fix(language-service): do not crash when Angular cannot be located (#14123)
Fixes #14122

PR Close #14123
2017-01-31 15:45:52 -06:00
Igor Minar da41a954b5 docs: branding fixes (#14132)
Angular 1.x -> AngularJS
Angular 1 -> AngularJS
Angular1 -> AngularJS
Angular 2+ -> Angular
Angular 2.0 -> Angular
Angular2 -> Angular

I have deliberately not touched any of the symbol names as that would cause big merge collisions with Tobias's work.

All the renames are in .md, .json, and inline comments and jsdocs.

PR Close #14132
2017-01-27 15:03:11 -06:00
Misko Hevery d339d8b81d refactor(abstract): Use abstract keyword where possible to decrease file size. (#14112)
PR Close: #14112
2017-01-27 12:32:22 -08:00
Victor Berchet 827c3fe199 fix(compiler): fix missing translations handling (#14113)
PR Close #14113
2017-01-27 12:12:06 -06:00
Gion Kunz 8775ab9495 feat(compiler): allow missing translations (#14113)
closes #13861
2017-01-27 12:10:59 -06:00
Victor Berchet 5885c52c1f refactor(compiler): add ability to get the context around a `ParseLocation` (#14113) 2017-01-27 12:10:47 -06:00
Victor Berchet f7fba74c58 feat(compiler): do not parse xtb messages not needed by angular (#14111)
fixes #14046

PR Close #14111
2017-01-27 11:52:57 -06:00
Bowen Ni 665dde2e5c refactor(compiler): improve error messages in aot compiler (#14017)
Previously aot compiler prints stack traces when it fails to resolve.
New behavior: aot compiler outputs the error message.
Example: https://gist.github.com/bowenni/a7fe81d916e8cd4a06b0e133436f40fb

PR Close #14017
2017-01-27 11:49:38 -06:00
Victor Berchet 05b2b49711 fix(compiler): allow empty translations for attributes (#14085)
fixes #13897
2017-01-25 17:43:19 -08:00
Alex Rickabaugh d2859cdd71 style(compiler): run format 2017-01-25 13:17:18 -08:00
Victor Berchet a733444d0e docs(compiler): add comment to warn about regexp changes (#14106)
ref #14082
2017-01-25 10:27:18 -08:00
Victor Berchet b2f9d56577 fix(compiler): fix regexp to support firefox 31 (#14082)
fixes #14029
closes #13900
2017-01-24 14:47:51 -08:00
Victor Berchet 1c24271daf refactor(compiler): [i18n] integrate review feedback 2017-01-24 14:47:04 -08:00
Victor Berchet c3e5ddbe20 refactor(compiler): [i18n] move dedup and placeholder mapping to the `MessageBundle`
It makes implementing a `Serializer` simpler as implementations do not have to
care any more about message dedup and placeholder mapping.
2017-01-24 14:47:04 -08:00
Victor Berchet d02eab498f fix(compiler): [i18n] XMB/XTB placeholder names can contain only A-Z, 0-9, _n
There are restrictions on the character set that can be used for xmb and xtb
placeholder names.

However because changing the placeholder names would change the message IDs it
is not possible to add those restrictions to the names used internally. Then we
have to map internal name to public names when generating an xmb file and back
when translating using an xtb file.

Note for implementors of `Serializer`:
- When writing a file, the implementor should take care of converting the
internal names to public names while visiting the message nodes - this is
required because the original nodes are needed to compute the message ID.
- When reading a file, the implementor does not need to take care of the mapping
back to internal names as this is handled in the `I18nToHtmlVisitor` used by the
`TranslationBundle`.

fixes b/34339636
2017-01-24 14:47:04 -08:00
Miško Hevery d169c2434e feat(core): Add type information to injector.get() (#13785)
- Introduce `InjectionToken<T>` which is a parameterized and type-safe
  version of `OpaqueToken`.

DEPRECATION:
- `OpaqueToken` is now deprecated, use `InjectionToken<T>` instead.
- `Injector.get(token: any, notFoundValue?: any): any` is now deprecated
  use the same method which is now overloaded as
  `Injector.get<T>(token: Type<T>|InjectionToken<T>, notFoundValue?: T): T;`.

Migration
- Replace `OpaqueToken` with `InjectionToken<?>` and parameterize it.
- Migrate your code to only use `Type<?>` or `InjectionToken<?>` as
  injection tokens. Using other tokens will not be supported in the
  future.

BREAKING CHANGE:
- Because `injector.get()` is now parameterize it is possible that code
  which used to work no longer type checks. Example would be if one
  injects `Foo` but configures it as `{provide: Foo, useClass: MockFoo}`.
  The injection instance will be that of `MockFoo` but the type will be
  `Foo` instead of `any` as in the past. This means that it was possible
  to call a method on `MockFoo` in the past which now will fail type
  check. See this example:

```
class Foo {}
class MockFoo extends Foo {
  setupMock();
}

var PROVIDERS = [
  {provide: Foo, useClass: MockFoo}
];

...

function myTest(injector: Injector) {
  var foo = injector.get(Foo);
  // This line used to work since `foo` used to be `any` before this
  // change, it will now be `Foo`, and `Foo` does not have `setUpMock()`.
  // The fix is to downcast: `injector.get(Foo) as MockFoo`.
  foo.setUpMock();
}
```

PR Close #13785
2017-01-17 15:34:54 -06:00
Matias Niemelä c2aa981dd6 fix(animations): fix internal jscompiler issue and AOT quoting (#13798)
CL #143630929
PR Close #13798
2017-01-13 13:52:00 -06:00
Victor Berchet 424e6c4cb9 fix(i18n): translate attributes inside elements marked for translation
fixes #13796
fixes #13814
2017-01-09 19:33:03 -05:00
Victor Berchet 78f42c7aa1 refactor(Compiler): misc cleanup 2017-01-09 19:32:01 -05:00
Chuck Jazdzewski d061adc02d fix(compiler): avoid evaluating arguments to unknown decorators
Fixes #13605
2017-01-09 16:30:31 -05:00
Ryan Cavanaugh 99aa49ab6c feat(language-service): support TS2.2 plugin model 2017-01-09 15:00:40 -05:00
Victor Berchet e5c6bb4286 fix(Compiler): fix template binding parsing (`*directive="-..."`)
fixes #13800
2017-01-09 15:00:40 -05:00
Matias Niemelä 9211a22039 feat(animations): support function types in transitions
Closes #13538
Closes #13537
2017-01-06 19:29:46 -05:00
Matias Niemelä 3f67ab074a feat(animations): expose the `triggerName` within the transition event
Closes #13600
2017-01-06 19:29:45 -05:00
Matias Niemelä 4bae4b3bb5 feat(animations): expose the `element` value within transition events 2017-01-06 19:29:45 -05:00
Victor Berchet 1bd04e95de refactor: remove unused imports 2017-01-05 11:18:34 -08:00
Tobias Bosch db49d422f2 refactor(compiler): generate less code for bindings to DOM elements
Detailed changes:
- remove `UNINITIALIZED`, initialize change detection fields with `undefined`.
  * we use `view.numberOfChecks === 0` now everywhere
    as indicator whether we are in the first change detection cycle
    (previously we used this only in a couple of places).
  * we keep the initialization itself as change detection get slower without it.
- remove passing around `throwOnChange` in various generated calls,
  and store it on the view as property instead.
- change generated code for bindings to DOM elements as follows:
  Before:
  ```
  var currVal_10 = self.context.bgColor;
  if (jit_checkBinding15(self.throwOnChange,self._expr_10,currVal_10)) {
    self.renderer.setElementStyle(self._el_0,'backgroundColor',((self.viewUtils.sanitizer.sanitize(jit_21,currVal_10) == null)? null: self.viewUtils.sanitizer.sanitize(jit_21,currVal_10).toString()));
    self._expr_10 = currVal_10;
  }
  var currVal_11 = jit_inlineInterpolate16(1,' ',self.context.data.value,' ');
  if (jit_checkBinding15(self.throwOnChange,self._expr_11,currVal_11)) {
    self.renderer.setText(self._text_1,currVal_11);
    self._expr_11 = currVal_11;
  }
  ```,
  After:
  ```
  var currVal_10 = self.context.bgColor;
  jit_checkRenderStyle14(self,self._el_0,'backgroundColor',null,self._expr_10,self._expr_10=currVal_10,false,jit_21);
  var currVal_11 = jit_inlineInterpolate15(1,' ',self.context.data.value,' ');
  jit_checkRenderText16(self,self._text_1,self._expr_11,self._expr_11=currVal_11,false);
  ```

Performance impact:
- None seen (checked against internal latency lab)

Part of #13651
2017-01-03 13:05:05 -08:00
Dzmitry Shylovich 6b02b80a03 fix(compiler): improve error message for undefined providers (#13546)
Closes #10835
2016-12-27 17:05:14 -08:00
Dzmitry Shylovich 2c0c86e3ce
fix(compiler): improve the error when template is not a string
Closes #8708
Closes #13377
2016-12-27 17:04:16 -08:00
Dzmitry Shylovich 5b4bea24de
refactor(compiler): clean up directive normalizer 2016-12-27 17:03:58 -08:00
Tobias Bosch 7c210645a3 fix(compiler): query `<template>` elements before their children. (#13677)
Fixes #13118
Closes #13167
2016-12-27 16:28:54 -08:00
Victor Berchet 0ac8e102de
test(i18n): add extraction to integration specs
Closes #13648.
2016-12-27 15:32:54 -08:00
Victor Berchet e74d8aaf92
fix(i18n): parse ICU messages while normalizing templates
Fixes:
- Inject the i18n specific HtmlParser into the directive normalizer,
- Parse ICU messages while normalizing templates,
- Normalize (visit) the content of ICU messages.

🎄🎁🎅
2016-12-27 15:32:43 -08:00
Victor Berchet 881eb894bc fix(Compiler): allow "." in attribute selectors (#13653)
fixes #13645
2016-12-27 15:23:49 -08:00
Victor Berchet eed83443b8 chore(tslint): update tslint to 4.x (#13603) 2016-12-27 14:55:58 -08:00