Commit Graph

1644 Commits

Author SHA1 Message Date
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