Commit Graph

1735 Commits

Author SHA1 Message Date
Vikram Subramanian 08f943a1f3 test(platform-server): add a test for 'hidden' property (#24239)
Add a test to verify that the hidden property is reflected properly to the hidden attribute.

PR Close #24239
2018-06-01 10:04:44 -07:00
Alan Agius f69ac670ee feat(compiler-cli): update `tsickle` to `0.29.x` (#24233)
PR Close #24233
2018-06-01 08:35:14 -07:00
Vikram Subramanian 60aa943e2d fix(platform-server): avoid dependency cycle when using http interceptor (#24229)
Fixes #23023.

When a HTTP Interceptor injects HttpClient it causes a DI cycle. This fix is to use Injector to lazily inject HTTP_INTERCEPTORS while setting up the HttpHandler on the server so as to break the cycle.

PR Close #24229
2018-06-01 08:33:45 -07:00
Greg Magolan 68a799e950 build(bazel): re-enable packages/upgrade/test:test_web test with static_files in ts_web_test_suite (#24214)
PR Close #24214
2018-05-31 16:13:06 -07:00
Victor Berchet 5f178f3a5a fix(ivy): do not eagerly JIT compile modules (#24234)
PR Close #24234
2018-05-31 16:03:49 -07:00
Victor Berchet 81c13e2f86 refactor(ivy): remove references to Ivy (#24234)
PR Close #24234
2018-05-31 16:03:49 -07:00
JoostK 2d9111bfb6 fix(ivy): account for multiple changes between change detection runs (#24152)
PR Close #24152
2018-05-31 14:08:23 -07:00
JoostK a5c47d0045 fix(ivy): determine value of SimpleChange.firstChange per property (#24152)
PR Close #24152
2018-05-31 14:08:23 -07:00
Kara Erickson 7e3f8f77a9 refactor(ivy): replace LView.child with TView.childIndex lookup (#24211)
PR Close #24211
2018-05-31 12:10:49 -07:00
Vikram Subramanian 6a663a4073 fix(platform-server): don't reflect innerHTML property to attibute (#24213)
Fixes #19278.

innerHTML is conservatively marked as an attribute for security purpose so that it's sanitized when set. However this same mapping is used by the server renderer to decide whether the `innerHTML` property needs to be reflected to the `innerhtml` attribute. The fix is to just skip the property to attribute reflection for `innerHTML`.

PR Close #24213
2018-05-31 10:08:28 -07:00
Greg Magolan ec57133b61 build: update to rules_nodejs 0.9.1 and rules_typescript 0.15.0 (#24212)
PR Close #24212
2018-05-31 10:08:07 -07:00
Alan Agius 4ab70fb93d style(compiler-cli): fix typo error (#23897)
PR Close #23897
2018-05-30 17:29:04 -07:00
Johnson Lin b86d4dee4d docs(forms): fix API doc (#24210)
closes #24090

PR Close #24210
2018-05-30 17:06:12 -07:00
Adam 9d364203a6 refactor(animations): fix typo (#24210)
closes #22459

PR Close #24210
2018-05-30 17:06:12 -07:00
Alec e79b845a45
docs(ivy): fix typo in STATUS.md 2018-05-30 16:48:40 -07:00
Vikram Subramanian b492b9e12b fix(animations): Fix browser detection logic (#24188)
Element type is being polyfilled on the server now and cannot be used to detect browser environment.

PR Close #24188
2018-05-30 16:39:09 -07:00
JoostK b99ef2b80a refactor(ivy): simplify bind instruction to reuse bindingUpdated logic (#23881)
Added runtime and compiler testcases for interpolated bindings, which verify
that NO_CHANGE is properly handled in `bind`.

PR Close #23881
2018-05-30 16:38:46 -07:00
Victor Berchet accda00190 test(platform-server): update the symbol lists (#24209)
PR Close #24209
2018-05-30 15:51:17 -07:00
Vikram Subramanian b96a3c8def fix(platform-server): avoid clash between server and client style encapsulation attributes (#24158)
Previously the style encapsulation attributes(_nghost-* and _ngcontent-*) created on the server could overlap with the attributes and styles created by the client side app when it botstraps. In case the client is bootstrapping a lazy route, the client side styles are added before the server-side styles are removed. If the components on the client are bootstrapped in a different order than on the server, the styles generated by the client will cause the elements on the server to have the wrong styles.

The fix puts the styles and attributes generated on the server in a completely differemt space so that they are not affected by the client generated styles. The client generated styles will only affect elements bootstrapped on the client.

PR Close #24158
2018-05-30 14:28:14 -07:00
Victor Berchet c917e5b5bb test(ivy): update TNode counts to reflect changes in #24113 (#24208)
After #24113 there is 2 `TNode` in those tests:
- 1 for the host,
- 1 for the text node.

The PR #23924 status was green because it branched off master before #24113 was
merged in.

PR Close #24208
2018-05-30 14:27:22 -07:00
Martin Probst 2a78d5e6fe refactor(core): clean up dupe'd imports in reflector (#24203)
Closure Compiler in some configurations complains about duplicate
imports. This change replaces the export-with-import with an export of
the imported symbol.

closes #23993

PR Close #24203
2018-05-30 11:45:00 -07:00
JoostK 95074ca303 fix(ivy): fix performance counter for textBinding instruction (#23924)
PR Close #23924
2018-05-30 11:44:22 -07:00
Pawel Kozlowski 1cd9e6c2eb feat(ivy): support queries with views inserted through ViewContainerRef (#24179)
This PR tackles a simple case where ViewRef definition point (<ng-template>) is the
same as the insertion point (ViewContainerRef requested on the said <ng-template>).
For this particular case we can assume that we know a container into which a given
view will be inserted when a view is created. This is not true fall all the possible
cases so follow-up PR will be needed to extend this basic implementation.

PR Close #24179
2018-05-30 11:43:57 -07:00
Alex Rickabaugh 646b42a113 feat(ivy): JIT renders the TODO app (#24138)
This commit builds out enough of the JIT compiler to render
//packages/core/test/bundling/todo, and allows the tests to run in
JIT mode.

To play with the app, run:

bazel run --define=compile=jit //packages/core/test/bundling/todo:prodserver

PR Close #24138
2018-05-30 11:25:57 -07:00
Jeremy Elbourn 24e5c5b425 refactor(platform-browser): make HAMMER_LOADER non-nullable (#24077)
PR Close #24077
2018-05-30 11:25:32 -07:00
Marc Laval 42a7295203 refactor(ivy): remove dynamicViewCount from LContainer (#23963)
PR Close #23963
2018-05-30 11:24:53 -07:00
John Papa aafb46a8fe style(compiler): fix up grammar in error message (#24201)
closes #22746

PR Close #24201
2018-05-30 11:24:11 -07:00
Vikram Subramanian c73196eb59 fix(platform-server): provide Domino DOM types globally (#24116)
Fixes #23280, #23133.

This fix lets code access DOM types like Node, HTMLElement in the code. These are invariant across requests and the corresponding classes from Domino can be safely provided during platform initialization.

This is needed for the current sanitizer to work properly on platform-server. Also allows HTML types in injection - Ex. `@inject(DOCUMENT) doc: Document`.

PR Close #24116
2018-05-30 10:18:29 -07:00
Vikram Subramanian d6595ebd39 feat(platform-server): use EventManagerPlugin on the server (#24132)
Previously event handlers on the server were setup directly. This change makes it so that the event registration on the server go through EventManagerPlugin just like on client. This allows us to add custom event registration handlers on the server which allows us to hook up preboot event handlers cleanly.

PR Close #24132
2018-05-30 10:17:31 -07:00
Fabian 5b25c07795 docs(bazel): improve error message for ng_package with no metadata (#22964)
PR Close #22964
2018-05-30 10:04:35 -07:00
Marc Laval 2e21690c66 feat(ivy): support renderer.destroy and renderer.destroyNode hooks (#24049)
PR Close #24049
2018-05-30 09:57:51 -07:00
Olivier Combe f6f44edcc0 docs: update ivy perf notes (#24035)
PR Close #24035
2018-05-30 09:57:08 -07:00
Pawel Kozlowski 90bf5d8961 feat(ivy): separate attributes for directive matching purposes (#23991)
In ngIvy directives matching (determining which directives are active based
on a CSS seletor) happens at runtime. This means that runtime needs to have
enough context to match directives. This PR takes care of cases where a directive's
selector should match bindings (ex. [foo]="exp") and event handlers (ex. (out)="do()").
In the mentioned cases we need to have binding / output "attributes" for directive's
CSS selector matching purposes. At the same time those are not regular attributes and
as such should not  be reflected in the DOM.

Closes #23706

PR Close #23991
2018-05-30 09:56:34 -07:00
JoostK b87d650da2 refactor(ivy): rename `PipeDef.n` to `PipeDef.factory` (#23883)
The original reason for this property to be short no longer holds true,
as pipes always need to be defined using `definePipe`.

PR Close #23883
2018-05-30 09:55:54 -07:00
Kara Erickson e53179ef8c refactor(ivy): move parent from LNode to TNode (#24189)
PR Close #24189
2018-05-30 01:42:20 -04:00
Alan Agius 31795b620f style(compiler): fix typo and formatting (#23729)
PR Close #23729
2018-05-29 18:48:54 -04:00
cexbrayat 41cd8f3efb refactor(core): use Partial<T> for MetadataOverride (#24103)
Allows to write:

const fixture = TestBed
      .overridePipe(DisplayNamePipe, { set: { pure: false } })
      .createComponent(MenuComponent);

when you only want to set the `pure` metadata,
instead of currently:

const fixture = TestBed
      .overridePipe(DisplayNamePipe, { set: { name: 'displayName', pure: false } })
      .createComponent(MenuComponent);

which forces you to redefine the name of the pipe even if it is useless.

Fixes #24102

PR Close #24103
2018-05-29 18:40:05 -04:00
Vikram Subramanian 3fd3c2ac4c test(animations): fix Node.js detection in animation tests (#24139)
PR Close #24139
2018-05-29 18:21:20 -04:00
Alex Rickabaugh 1eafd04eb3 build(ivy): support alternate compilation modes to enable Ivy testing (#24056)
Bazel has a restriction that a single output (eg. a compiled version of
//packages/common) can only be produced by a single rule. This precludes
the Angular repo from having multiple rules that build the same code. And
the complexity of having a single rule produce multiple outputs (eg. an
ngc-compiled version of //packages/common and an Ivy-enabled version) is
too high.

Additionally, the Angular repo has lots of existing tests which could be
executed as-is under Ivy. Such testing is very valuable, and it would be
nice to share not only the code, but the dependency graph / build config
as well.

Thus, this change introduces a --define flag 'compile' with three potential
values. When --define=compile=X is set, the entire build system runs in a
particular mode - the behavior of all existing targets is controlled by
the flag. This allows us to reuse our entire build structure for testing
in a variety of different manners. The flag has three possible settings:

* legacy (the default): the traditional View Engine (ngc) build
* local: runs the prototype ngtsc compiler, which does not rely on global
  analysis
* jit: runs ngtsc in a mode which executes tsickle, but excludes the
  Angular related transforms, which approximates the behavior of plain
  tsc. This allows the main packages such as common to be tested with
  the JIT compiler.

Additionally, the ivy_ng_module() rule still exists and runs ngc in a mode
where Ivy-compiled output is produced from global analysis information, as
a stopgap while ngtsc is being developed.

PR Close #24056
2018-05-29 18:02:29 -04:00
Victor Berchet 729c797890 fix(ivy): `pipeBindV` takes an array of values (#24039)
PR Close #24039
2018-05-25 13:46:50 -04:00
Victor Berchet 188ff848d2 fix(ivy): `pureFunctionV` takes an array of values (#24039)
PR Close #24039
2018-05-25 13:46:50 -04:00
Victor Berchet 280a784fe3 refactor(ivy): remove insignificant '...' in the compiler tests (#24039)
PR Close #24039
2018-05-25 13:46:50 -04:00
Victor Berchet 4f36340de7 feat(ivy): add support for short-circuiting (#24039)
Short-circuitable expressions (using ternary & binary operators) could not use
the regular binding mechanism as it relies on the bindings being checked every
single time - the index is incremented as part of checking the bindings.

Then for pure function kind of bindings we use a different mechanism with a
fixed index. As such short circuiting a binding check does not mess with the
expected binding index.

Note that all pure function bindings are handled the same wether or not they
actually are short-circuitable. This allows to keep the compiler and compiled
code simple - and there is no runtime perf cost anyway.

PR Close #24039
2018-05-25 13:46:50 -04:00
alexzuza 01b5acd7cf fix(compiler): generate core-compliant hostBindings property (#24087)
This makes `hostBindings` code, generated by compiler and used in core package, identical.

Fix #24013

PR Close #24087
2018-05-25 13:42:53 -04:00
Kara Erickson 609e6b9787 refactor(ivy): move child from LNode to TNode (#24113)
PR Close #24113
2018-05-25 13:41:00 -04:00
Kara Erickson 68bf8c36c6 refactor(ivy): move type from LNode to TNode (#24113)
PR Close #24113
2018-05-25 13:40:59 -04:00
Kara Erickson 8216657681 refactor(ivy): add tNodes for view nodes and hosts (#24113)
PR Close #24113
2018-05-25 13:40:59 -04:00
Judy Bogart 23a98b9e51 docs: add doc to event-management api (#23656)
PR Close #23656
2018-05-22 17:33:49 -04:00
JoostK bd149e5d67 fix(ivy): compile interpolated bindings without superfluous bind instruction (#23923)
This fixes the case where the compiler would generate a bind(interpolation#())
instruction.

PR Close #23923
2018-05-22 17:05:41 -04:00
Heo Sangmin 0bdd30e34f fix(service-worker): check platformBrowser before accessing navigator.serviceWorker (#21231)
PR Close #21231
2018-05-22 15:09:31 -04:00
Miško Hevery 373fa78d7f fix: merge collision (#24054)
PR Close #24054
2018-05-22 14:49:38 -04:00
Jeremy Elbourn 26fbf1d13c feat(platform-browser): add HammerJS lazy-loader symbols to public API (#23943)
PR Close #23943
2018-05-22 13:41:16 -04:00
Alex Rickabaugh 919f42fea1 feat(ivy): first steps towards JIT compilation (#23833)
This commit adds a mechanism by which the @angular/core annotations
for @Component, @Injectable, and @NgModule become decorators which,
when executed at runtime, trigger just-in-time compilation of their
associated types. The activation of these decorators is configured
by the ivy_switch mechanism, ensuring that the Ivy JIT engine does
not get included in Angular bundles unless specifically requested.

PR Close #23833
2018-05-21 19:13:50 -04:00
Miško Hevery 1b6b936ef4 test(ivy): Add bazel flag to control building ViewEngine or Ivy (#23833)
PR Close #23833
2018-05-21 19:13:50 -04:00
Kara Erickson 6e7d071c6b fix(ivy): move next property to TNode (#23869)
PR Close #23869
2018-05-21 16:09:12 -04:00
Jeremy Elbourn 313bdce590 feat(platform-browser): allow lazy-loading HammerJS (#23906)
PR Close #23906
2018-05-15 15:33:00 -07:00
Lucas Sloan 5cf82f8f3f build: upgrade to TypeScript 2.8 (#23782)
PR Close #23782
2018-05-15 15:31:12 -07:00
George Kalpakas 1d378e2987 fix(service-worker): deprecate `versionedFiles` in asset-group resources (#23584)
Since `versionedFiles` behaves in the exact same way as `files`, there
is no reaason to have both. Users should use `files` instead.

This commit deprecates the property and prints a warning when coming
across an asset-group that uses it. It should be completely removed in
a future version.

Note, it has also been removed from the default `ngsw-config.json`
template in angular/devkit#754.

PR Close #23584
2018-05-15 12:19:08 -07:00
Alex Eagle 017d67cdf8 test: switch to ts_web_test_suite (#23859)
Unit tests now run on Firefox too

PR Close #23859
2018-05-15 11:40:56 -07:00
JoostK 83631b28cb perf(ivy): avoid creating bound function in pipeBind3 (#23882)
PR Close #23882
2018-05-15 11:40:33 -07:00
Omar Griffin d4b6c41a5f fix(benchpress): Fix promise chain in chrome_driver_extension. (#23458)
Occasionally the promise to clear the chrome buffer resolves after the subsequent call to start the
timer. This problem causes flakiness in our tests that rely on benchpress, usually manifesting
itself as a "Tried too often to get the ending mark: 21" error thrown by this line:

https://github.com/angular/angular/blob/master/packages/benchpress/src/metric/perflog_metric.ts#L162

PR Close #23458
2018-05-14 15:32:44 -07:00
Vikram Subramanian d4b8b24406 fix(elements): prevent closure renaming of platform properties (#23843)
Closure compiler with type based optimizations has a bug where externs for inherited static fields are not being honored. For Angular Elements this meant that 'observedAttributes' static field which is marked as an extern for the base HTMLElement class was getting renamed.

This commit works around the bug by using quoted access of 'observedAttributes' that explicitly prevents the renaming.

PR Close #23843
2018-05-11 18:11:48 -04:00
Victor Berchet cfde36da84 fix(compiler): generate constant array for i18n attributes (#23837)
PR Close #23837
2018-05-11 17:35:54 -04:00
Matias Niemelä 816bc8af17 feat(ivy): support injectable sanitization service (#23809)
PR Close #23809
2018-05-11 16:43:43 -04:00
Matias Niemelä d2a86872a9 fix(animations): do not throw errors when a destroyed component is animated (#23836)
PR Close #23836
2018-05-11 16:08:14 -04:00
Andrew Seguin b1cda3639f fix(elements): always check to create strategy (#23825)
PR Close #23825
2018-05-10 16:07:11 -07:00
swseverance fe3679a356 style: remove empty comments (#23404)
PR Close #23404
2018-05-10 15:48:13 -07:00
Zaven Muradyan 89f64e58c3 fix(router): avoid freezing queryParams in-place (#22663)
The recognizer code used to call Object.freeze() on queryParams before
using them to construct ActivatedRoutes, with the intent being to help
avoid common invalid usage. Unfortunately, Object.freeze() works
in-place, so this was also freezing the queryParams on the actual
UrlTree object, making it more difficult to manipulate UrlTrees in
things like UrlHandlingStrategy.

This change simply shallow-copies the queryParams before freezing them.

Fixes #22617

PR Close #22663
2018-05-10 07:54:11 -07:00
Jason Aden 553a680817 fix(router): correct the segment parsing so it won't break on ampersand (#23684)
PR Close #23684
2018-05-10 07:53:53 -07:00
George Kalpakas f1e4a153f0 refactor(service-worker): sort manifest `url`/`hashTable` entries (#23586)
This makes it easier to quickly check whether a specific file ended up
in the manifest, for example when debugging.

PR Close #23586
2018-05-09 11:51:22 -07:00
George Kalpakas e0ed59e55f fix(service-worker): correctly handle requests with empty `clientId` (#23625)
Requests from clients that are not assigned a client ID by the browser
will produce `fetch` events with `null` or empty (`''`) `clientId`s.

Previously, the ServiceWorker only handled `null` values correctly. Yet
empty strings are also valid (see for example [here][1] and [there][2]).
With this commit, the SW will interpret _all_ falsy `clientId` values
the same (i.e. "no client ID assigned") and handle them appropriately.

Related Chromium issue/discussion: [#832105][3]

[1]: 4cc72bd0f1/docs/index.bs (L1392)
[2]: https://w3c.github.io/ServiceWorker/#fetchevent-interface
[3]: https://bugs.chromium.org/p/chromium/issues/detail?id=832105

Fixes #23526

PR Close #23625
2018-05-09 11:50:02 -07:00
George Kalpakas d6b1466c81 test(service-worker): support mock requests with null/empty client ID (#23625)
PR Close #23625
2018-05-09 11:50:02 -07:00
George Kalpakas d1abf4e897 test(service-worker): improve adding clients in `SwTestHarness` (#23625)
This commits changes how clients are added in `SwTestHarness`, so that
the behavior in tests closer mimics what would happen in an actual
ServiceWorker.
It also removes auto-adding clients when calling `clients.get()`, which
could hide bugs related to non-existing clients.

PR Close #23625
2018-05-09 11:50:02 -07:00
Victor Berchet 08e7efc69e feat(ivy): add error reporting to the html to ivy transformer (#23546)
PR Close #23546
2018-05-09 11:49:18 -07:00
Victor Berchet 46674d5fac test(ivy): add html to ivy ast transformer tests (#23546)
PR Close #23546
2018-05-09 11:49:18 -07:00
Alex Rickabaugh b0eca85e51 refactor(compiler): compile{Component,Directive} take only local information (#23545)
Previously, the compileComponent() and compileDirective() APIs still required
the output of global analysis, even though they only read local information
from that output.

With this refactor, compileComponent() and compileDirective() now define
their inputs explicitly, with the new interfaces R3ComponentMetadata and
R3DirectiveMetadata. compileComponentGlobal() and compileDirectiveGlobal()
are introduced and convert from global analysis output into the new metadata
format.

This refactor also splits out the view compiler into separate files as
r3_view_compiler_local.ts was getting unwieldy.

Finally, this refactor also splits out generation of DI factory functions
into a separate r3_factory utility as the logic is utilized between different
compilers.

PR Close #23545
2018-05-08 13:57:20 -07:00
Alex Rickabaugh fc034270ce fix(core): call ngOnDestroy on all services that have it (#23755)
Previously, ngOnDestroy was only called on services which were statically
determined to have ngOnDestroy methods. In some cases, such as with services
instantiated via factory functions, it's not statically known that the service
has an ngOnDestroy method.

This commit changes the runtime to look for ngOnDestroy when instantiating
all DI tokens, and to call the method if it's present.

Fixes #22466
Fixes #22240
Fixes #14818

PR Close #23755
2018-05-08 13:55:29 -07:00
Igor Minar 77ff72f93b Revert "style(animations): fix short param names (#23668)"
This reverts commit e3518967ad.

This PR accidentaly introduces a breaking change:
https://github.com/angular/angular/pull/23668#discussion_r186265055
2018-05-05 08:36:49 -07:00
Igor Minar 44095d95c9 Revert "docs(animations): fix content errors (#23668)"
This reverts commit 005dc8f68b.

The PR accidently introduced a breaking change
https://github.com/angular/angular/pull/23668#discussion_r186265055
2018-05-05 08:34:25 -07:00
Pete Bacon Darwin e3518967ad style(animations): fix short param names (#23668)
PR Close #23668
2018-05-05 08:17:02 -07:00
Pete Bacon Darwin 005dc8f68b docs(animations): fix content errors (#23668)
PR Close #23668
2018-05-05 08:17:02 -07:00
Igor Minar 6601d0f7ba build: update to rxjs@6.0.0 (#23679)
PR Close #23679
2018-05-03 10:53:39 -07:00
Matias Niemelä 65211f46cf fix(animations): retain state styling for nodes that are moved around (#23534)
PR Close #23534
2018-05-02 16:58:46 -07:00
Matias Niemelä da9ff255dd fix(animations): properly clean up queried element styles in safari/edge (#23633)
Prior to this patch, if an element is queried and animated for 0 seconds
(just a style() call and nothing else) then the styles applied would not
be properly cleaned up due to their camelCased nature.

PR Close #23633
2018-05-02 16:58:24 -07:00
Kara Erickson c5cfc3a1b6 fix(ivy): only generate TViews once per embedded template (#23385)
PR Close #23385
2018-05-01 10:27:40 -07:00
Misko Hevery b76f5a6a7d perf(ivy): add performance counters in ngDevMode (#23385)
PR Close #23385
2018-05-01 10:27:40 -07:00
Victor Berchet 7ef9d4a582 docs(ivy): upddate the status (#23562)
PR Close #23562
2018-04-27 07:21:16 -07:00
Vikram Subramanian 0c6dc45c85 fix(core): avoid eager providers re-initialization (#23559)
Fix a corner case where eager providers were getting constructed twice if the provider was requested before the initialization of the NgModule is complete.

PR Close #23559
2018-04-27 07:16:12 -07:00
Igor Minar 5b96078624 Revert "refactor(core): tree-shake application_module providers (#23477)"
This reverts commit eb031c6ff1.

The change is breaking targets in g3 see cl/194336387.
2018-04-26 14:08:13 -07:00
Marc Laval 1a44a0b4a8 feat(ivy): support lifecycle hooks of ViewContainerRef (#23396)
PR Close #23396
2018-04-25 19:02:00 -07:00
Alex Rickabaugh b1f040f5a2 fix(compiler-cli): don't rely on incompatible TS method (#23550)
g3 and the Angular repo have different versions of TypeScript, and
ts.updateIdentifier() has a different signature in the different versions.
There is no way to write a call to the function that will compile in both
versions simultaneously.

Instead, use ts.getMutableClone() as that has the same effect of cloning
the identifier.

PR Close #23550
2018-04-25 19:00:55 -07:00
Matias Niemelä eb031c6ff1 refactor(core): tree-shake application_module providers (#23477)
PR Close #23477
2018-04-25 15:51:51 -07:00
Alex Eagle b4c252bcc5 build: serve ivy todo app with real http-server (#23446)
PR Close #23446
2018-04-25 15:51:18 -07:00
Kara Erickson db77d8dc92 feat(ivy): support injection flags at runtime (#23518)
PR Close #23518
2018-04-25 13:26:58 -07:00
Alex Rickabaugh ab5bc42da0 feat(ivy): first steps towards ngtsc mode (#23455)
This commit adds a new compiler pipeline that isn't dependent on global
analysis, referred to as 'ngtsc'. This new compiler is accessed by
running ngc with "enableIvy" set to "ngtsc". It reuses the same initialization
logic but creates a new implementation of Program which does not perform the
global-level analysis that AngularCompilerProgram does. It will be the
foundation for the production Ivy compiler.

PR Close #23455
2018-04-25 13:25:33 -07:00
Paul Freedman 811a7f2863 docs(benchpress): fix typo in README (#23471) (#23488)
PR Close #23488
2018-04-24 14:37:03 -07:00
Victor Berchet 9ed5fb6d2c
style: format code 2018-04-24 14:32:57 -07:00
Martin Probst e1c4930a1a fix(compiler): avoid a crash in ngc-wrapped. (#23468)
`ng.performCompilation` can return an `undefined` program, which is not handled by ngc-wrapped.

Avoid crashing by checking for the error return and returning the diagnostics.
PR Close #23468
2018-04-24 13:57:03 -07:00
Pawel Kozlowski b1d03fe70b fix(ivy): properly destroy view trees where root is an embedded view without children (#23482)
The bug fixed here steams from the fact that we are traversing too far up
in the views tree hierarchy in the destroyViewTree function.

The logic in destroyViewTree is off if we start removal at an embedded view
without any child views. For such a case we should just clean up (cleanUpView)
this one view without paying attention to next / parent views.

PR Close #23482
2018-04-24 11:15:16 -07:00
Olivier Combe 06c0d9666f build(common): mark locales files as side-effect-full (#23509)
Fixes https://github.com/angular/angular-cli/issues/10322
PR Close #23509
2018-04-24 11:14:52 -07:00
Steven Liekens 4cfa571258 fix(router): cache route handle if found (#22475)
When asking the route reuse strategy to retrieve a detached route handle, store the
return value in a local variable for further processing instead of asking again later.

resolves #22474

PR Close #22475
2018-04-23 13:35:59 -07:00
Victor Berchet ba47997715 style(compiler): fix lint issues (#23480)
PR Close #23480
2018-04-22 11:49:49 -07:00
Victor Berchet 6761a64522 refactor(compiler): remove a dependency from the IVY AST to the template AST (#23476)
PR Close #23476
2018-04-20 17:23:02 -07:00
Victor Berchet 0b47902ad7 refactor(ivy): move core code to core.ts (#23476)
PR Close #23476
2018-04-20 17:23:02 -07:00
Victor Berchet 4662878a1f refactor(compiler): refactor template binding parsing (#23460)
A long time ago Angular used to support both those attribute notations:
- `*attr='binding'`
- `template=`attr: binding`

Because the last notation has been dropped we can refactor the binding parsing.
Source maps will benefit from that as no `attr:` prefix is added artificialy any
more.

PR Close #23460
2018-04-20 16:07:55 -07:00
Alex Rickabaugh ca776c59dd fix(compiler): handle undefined annotation metadata (#23349)
In certain cases seen in production, simplify() can returned
undefined when simplifying decorator metadata. This has proven tricky
to reproduce in an isolated test, but the fix is simple and low-risk:
don't attempt to spread an undefined set of annotations in the first
place.

PR Close #23349
2018-04-19 18:57:22 -07:00
Victor Berchet 9757347e71 feat(ivy): add an IVY local the compiler which avoids analyzeModule (#23441)
closes #23289

Based on a spike by @chukjaz

PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet a19e018439 refactor(ivy): remove the backpatch compiler (#23441)
PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet 6ff164be0e refactor(compiler): misc minor (#23441)
PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet 84f024309a refactor(ivy): misc cleanup (#23441)
PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet c6b206ee4b feat(compiler): support `// ...` and `// TODO` in mock compiler expectations (#23441)
PR Close #23441
2018-04-19 16:32:09 -07:00
Victor Berchet 1d1e75ee2b Revert "fix(compiler): Pretty print object instead of [Object object] (#22689)" (#23442)
This reverts commit 8555a3a3cd.

Reverted because of https://github.com/angular/angular/issues/23440

PR Close #23442
2018-04-19 14:51:58 -07:00
Matias Niemelä acf6781ccc test(core): add a symbols test for renderer2 code (#23436)
PR Close #23436
2018-04-18 14:49:29 -07:00
Matias Niemelä 7be7abdebd refactor(animations): use a const enum to avoid compilation side effects (#23402)
This patch is in response to #23401 where a non-const enum was being
compiled as an empty object when used in an animation player when
`ng build --prod` was being processed. This patch is a immediate fix
for the issue and #23400 tracks it.

Closes #23401

PR Close #23402
2018-04-17 14:03:01 -07:00
Kara Erickson 5a1ddee88c refactor(ivy): speed up bound text nodes (#23386)
PR Close #23386
2018-04-17 13:49:19 -07:00
Kara Erickson 7f612fc828 fix(ivy): generate bind calls for property bindings (#23403)
PR Close #23403
2018-04-17 13:44:48 -07:00
HiveSolution fb59b2dd97 fix(service-worker): add badge to NOTIFICATION_OPTION_NAMES (#23241)
Add badge to NOTIFICATION_OPTION_NAMES to support custom notification badge/icon.
Fixes #23196
PR Close #23241
2018-04-15 23:23:37 -07:00
Misko Hevery b64a276d4b refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371) (#23383)
Ivy definition looks something like this:

```
class MyService {
  static ngInjectableDef = defineInjectable({
    …
  });
}
```

Here the argument to `defineInjectable` is well known public contract which needs
to be honored in backward compatible way between versions. The type of the
return value of `defineInjectable` on the other hand is private and can change
shape drastically between versions without effecting backwards compatibility of
libraries publish to NPM. To our users it is effectively an opaque token.
For this reson why declare the return value of `defineInjectable` as `never`.

PR Close #23383
2018-04-14 20:40:14 -07:00
Igor Minar 674c3def31 revert: refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
This reverts commit 2c09b707ce.
2018-04-13 23:02:29 -07:00
Victor Berchet 80e483ceac fix(ivy): add unparsed selectors to the `projectionDef` instruction (#23375)
PR Close #23375
2018-04-13 21:46:19 -07:00
Victor Berchet ac683d7abb refactor(ivy): cleanup of the view compiler (#23375)
PR Close #23375
2018-04-13 21:46:19 -07:00
Misko Hevery 33630dd3ed fix(ivy): workaround for tsickle bug (#23379)
The issue is with tsickle type inference and the bug should be assigned to them.

The offending code is:
```
function cacheMatchingDirectivesForNode(
    tNode: TNode, tView: TView, localRefs: string[] | null): void {
  const exportsMap = localRefs ? {'': -1} : null;     // <<<<< ===== OFFENDING LINE
  const matches = tView.currentMatches = findDirectiveMatches(tNode);
  if (matches) {
    for (let i = 0; i < matches.length; i += 2) {
      const def = matches[i] as DirectiveDef<any>;
      const valueIndex = i + 1;
      resolveDirective(def, valueIndex, matches, tView);
      saveNameToExportMap(matches[valueIndex] as number, def, exportsMap);
    }
  }
  if (exportsMap) cacheMatchingLocalNames(tNode, localRefs, exportsMap);
}

```

because it generates invalid js closure code:
```
function cacheMatchingDirectivesForNode(tNode, tView, localRefs) {
    const /** @type {(null|{: number})} */ exportsMap = localRefs ? { '': -1 } : null;      // <<<<< ===== OFFENDING LINE
    const /** @type {(null|!Array<?>)} */ matches = tView.currentMatches = findDirectiveMatches(tNode);
    if (matches) {
        for (let /** @type {number} */ i = 0; i < matches.length; i += 2) {
            const /** @type {!tsickle_forward_declare_11.DirectiveDef<?>} */ def = /** @type {!tsickle_forward_declare_11.DirectiveDef<?>} */ (matches[i]);
            const /** @type {number} */ valueIndex = i + 1;
            resolveDirective(def, valueIndex, matches, tView);
            saveNameToExportMap(/** @type {number} */ (matches[valueIndex]), def, exportsMap);
        }
    }
    if (exportsMap)
        cacheMatchingLocalNames(tNode, localRefs, exportsMap);
}
```

The workaround is to declare the type explicitly such as:

```
const exportsMap: ({[key:string]:number}|null) = localRefs ? {'': -1} : null;
```

which than generates valid closure code:

```
const /** @type {(null|!Object<string,number>)} */ exportsMap = localRefs ? { '': -1 } : null;
```

PR Close #23379
2018-04-13 21:29:39 -07:00
Alex Eagle 102ed3b03c test: move platform-server integration test (#22810)
Now it lives in our standard location for tests against npm packages

PR Close #22810
2018-04-13 16:30:50 -07:00
Alex Eagle 328b48b697 test: integration tests now against bazel built packages (#22810)
PR Close #22810
2018-04-13 16:30:50 -07:00
Olivier Combe d1177c75f8 refactor: update CLDR data for closure locale & use a const for undefined (#23372)
PR Close #23372
2018-04-13 16:30:23 -07:00
Miško Hevery 2c09b707ce refactor(ivy): make return value of define(Component|Directive|Pipe|Injector|Injectable) private (#23371)
Ivy definition looks something like this:

```
class MyService {
  static ngInjectableDef = defineInjectable({
    …
  });
}
```

Here the argument to `defineInjectable` is well known public contract which needs
to be honored in backward compatible way between versions. The type of the
return value of `defineInjectable` on the other hand is private and can change
shape drastically between versions without effecting backwards compatibility of
libraries publish to NPM. To our users it is effectively an `OpaqueToken`.

By prefixing the type with `ɵ` we are communicating the the outside world that
the value is not public API and is subject to change without backward compatibility.

PR Close #23371
2018-04-13 16:20:25 -07:00
Misko Hevery f4017ce5e3 fix(ivy): Update Todo app to take advantage of optional injector (#23345)
PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery 4384a92271 docs(ivy): Clean up incorrect comments (#23345)
PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery da31db757b feat(ivy): support injection even if no injector present (#23345)
- Remove default injection value from `inject` / `directiveInject` since
  it is not possible to set using annotations.
- Module `Injector` is stored on `LView` instead of `LInjector` data
  structure because it can change only at `LView` level. (More efficient)
- Add `ngInjectableDef` to `IterableDiffers` so that existing tests can
  pass as well as enable `IterableDiffers` to be injectable without
  `Injector`

PR Close #23345
2018-04-13 14:29:52 -07:00
Misko Hevery 6f213a74f2 feat(ivy): support generation of flags for directive injection (#23345)
This change changes:
- compiler uses `directiveInject` instead of `inject` for `Directive`s
- unifies the flags in `di` as well as `render3`
- changes the signature of `directiveInject` to match `inject` In prep for #23330
- compiler now generates flags for injection.

Compiler portion of #23342
Prep for #23330

PR Close #23345
2018-04-13 14:29:52 -07:00
Marc Laval e7ef02722d fix(ivy): local directives and pipes should be applied to TemplateRef (#23312)
PR Close #23312
2018-04-13 13:31:19 -07:00
Victor Berchet d5e7f60f04 refactor(ivy): misc (#23351)
PR Close #23351
2018-04-13 13:19:17 -07:00
Victor Berchet 6e73300ff1 refactor(ivy): cleanup directives & pipes import (#23369)
PR Close #23369
2018-04-13 13:15:26 -07:00
George Kalpakas 6c2c95851a fix(service-worker): let `*` match 0 characters in globs (#23339)
In [glob patterns][1], the `*` wildcard is supposed to match 0 or more
characters.

For reference:
- This is also how `*` works in other implementations, such as
  `.gitignore` files or Firebase hosting config.
- Some popular JS implementations (e.g. [minimatch][2], [micromatch][3])
  work differently, matching 1 or more character (but not 0).

This commit "fixes" the minimal glob support in
`@angular/service-worker` to allow `*` to also match 0 characters.

[1]: https://en.wikipedia.org/wiki/Glob_%28programming%29
[2]: https://www.npmjs.com/package/minimatch
[3]: https://www.npmjs.com/package/micromatch

PR Close #23339
2018-04-13 13:13:36 -07:00
George Kalpakas 08325aaffc feat(service-worker): add support for configuring navigations URLs (#23339)
The ServiceWorker will redirect navigation requests that don't match any
`asset` or `data` group to the specified index file. The rules for a
request to be classified as a navigation request are as follows:
1. Its `mode` must be `navigation`.
2. It must accept a `text/html` response.
3. Its URL must match certain criteria (see below).

By default, a navigation request can have any URL except for:
1. URLs containing `__`.
2. URLs to files (i.e. containing a file extension in the last path
   segment).

While these rules are fine in many cases, sometimes it is desirable to
configure different rules for the URLs of navigation requests (e.g.
ignore specific URLs and pass them through to the server).

This commit adds support for specifying an optional `navigationUrls`
list in `ngsw-config.json`, which contains URLs or simple globs
(currently only recognizing `!`, `*` and `**`).
Only requests whose URLs match any of the positive URLs/patterns and
none of the negative ones (i.e. URLs/patterns starting with `!`) will be
considered navigation requests (and handled accordingly by the SW).

(This is an alternative implementation to #23025.)

Fixes #20404

PR Close #23339
2018-04-13 13:13:36 -07:00
George Kalpakas 1e1c7fd408 refactor(service-worker): move common code into method (#23339)
PR Close #23339
2018-04-13 13:13:36 -07:00
Rafael 639d52fe71 refactor: ensure all 'TODO's are consistent (#23252)
PR Close #23252
2018-04-13 13:11:01 -07:00
Igor Minar aa27155618 build(common): mark locales files as side-effect-full (#23366)
These files are in the UMD format for greater portablity, and as such
can't be marked as side-effect-free by webpack/build-optimizer/uglify.

PR Close #23366
2018-04-13 13:09:13 -07:00
Rob Wormald 9fabe2f5fa fix(elements): include schematics in npm distro (#23350)
PR Close #23350
2018-04-13 00:50:04 -07:00
Marc Laval 2bb783824e fix(ivy): support ViewContainerRef on nodes projected into an embedded view (#23333)
PR Close #23333
2018-04-13 00:20:32 -07:00
Greg Magolan 6199ea5d4a fix(compiler-cli): shorten resolved module name in fileNameToModuleName to npm package name for typings (#23231)
PR Close #23231
2018-04-13 00:19:19 -07:00
Alex Eagle 2e270bb96a build: include tslib in umd bundles (#23354)
Fixes #22971

PR Close #23354
2018-04-13 00:13:54 -07:00
Alex Eagle b76dd3b979 fix(compiler): use correct global name in compiler.umd.js (#23354)
Fixes #23343

PR Close #23354
2018-04-13 00:13:54 -07:00
Camilo Giraldo a025f7e2a6 refactor(language-service): fix typo on type.ts language-service 2018-04-13 00:06:26 -07:00
Joey Perrott b551f844e4 feat(platform-browser): add token marking which the type of animation module nearest in the injector tree (#23075)
PR Close #23075
2018-04-12 23:17:38 -07:00
Nathan Friend 75febe7511 docs(upgrade): fix detail regarding bootstrapping order (#23225) (#23270)
Clarify that Angular should be bootstrapped before AngularJS.

Closes angular/angular#23225

PR Close #23270
2018-04-12 23:16:18 -07:00
Igor Minar 1fc72e53f5 build(core): update zone.js peer dep to ~0.8.26 2018-04-12 00:19:08 -07:00
Igor Minar bbfa1d31a4 fix(platform-server): require node v8+ (#23331)
PR Close #23331
2018-04-12 00:08:50 -07:00
Vikram Subramanian af46d097ff fix(elements): avoid exception when window is undefined (#23324)
Detect server environment by checking `typeof window` and schedule render immediately instead of waiting for RAF.

This does not make Angular Elements work on platform-server. This is just the first step.

PR Close #23324
2018-04-11 23:17:04 -07:00
Andrew Seguin 37d2cb4553 feat(elements): add schematics (#23298)
PR Close #23298
2018-04-11 18:13:30 -07:00