Commit Graph

16126 Commits

Author SHA1 Message Date
Pete Bacon Darwin 85298e345d fix(ngcc): render new definitions using the inner name of the class (#33533)
When decorating classes with ivy definitions (e.g. `ɵfac` or `ɵdir`)
the inner name of the class declaration must be used.

This is because in ES5 the definitions are inside the class's IIFE
where the outer declaration has not yet been initialized.

PR Close #33533
2019-11-05 17:25:02 +00:00
Pete Bacon Darwin 93a23b9ae0 fix(ngcc): override `getInternalNameOfClass()` and `getAdjacentNameOfClass()` for ES5 (#33533)
In ES5 the class consists of an outer variable declaration that is
initialised by an IIFE. Inside the IIFE the class is implemented by
an inner function declaration that is returned from the IIFE.
This inner declaration may have a different name to the outer
declaration.

This commit overrides `getInternalNameOfClass()` and
`getAdjacentNameOfClass()` in `Esm5ReflectionHost` with methods that
can find the correct inner declaration name identifier.

PR Close #33533
2019-11-05 17:25:01 +00:00
Pete Bacon Darwin 90f33dd11d refactor(ngcc): remove unnecessary ! operator (#33533)
PR Close #33533
2019-11-05 17:25:01 +00:00
Alex Rickabaugh 8d0de89ece refactor(ivy): split `type` into `type`, `internalType` and `adjacentType` (#33533)
When compiling an Angular decorator (e.g. Directive), @angular/compiler
generates an 'expression' to be added as a static definition field
on the class, a 'type' which will be added for that field to the .d.ts
file, and a statement adjacent to the class that calls `setClassMetadata()`.

Previously, the same WrappedNodeExpr of the class' ts.Identifier was used
within each of this situations.

In the ngtsc case, this is proper. In the ngcc case, if the class being
compiled is within an ES5 IIFE, the outer name of the class may have
changed. Thus, the class has both an inner and outer name. The outer name
should continue to be used elsewhere in the compiler and in 'type'.

The 'expression' will live within the IIFE, the `internalType` should be used.
The adjacent statement will also live within the IIFE, the `adjacentType` should be used.

This commit introduces `ReflectionHost.getInternalNameOfClass()` and
`ReflectionHost.getAdjacentNameOfClass()`, which the compiler can use to
query for the correct name to use.

PR Close #33533
2019-11-05 17:25:01 +00:00
Andrew Kushnir d9a38928f5 fix(ivy): more descriptive errors for nested i18n sections (#33583)
This commit moves nested i18n section detection to an earlier stage where we convert HTML AST to Ivy AST. This also gives a chance to produce better diagnistic message for nested i18n sections, that also includes a file name and location.

PR Close #33583
2019-11-05 17:20:47 +00:00
Doug Parker 25aaff2ee1 docs: Adding Doug Parker to contributors list. (#33516)
PR Close #33516
2019-11-05 00:55:17 +00:00
Geoff Bass 5bc1b6f9ac docs: remove redundant word from template syntax guide (#33534)
PR Close #33534
2019-11-05 00:54:47 +00:00
Andrew Kushnir 4abf15c50c build: decrease payload size limit (#33587)
Several commits merged into master recently resulted in minor payload size improvement. This commit updates the payload size limit to make corresponding CI checks pass.

PR Close #33587
2019-11-05 00:15:45 +00:00
Matias Niemelä 9c13d6e8e6 refactor(ivy): rename `tView.firstTemplatePass` to `tView.firstCreatePass` (#31270)
PR Close #31270
2019-11-04 21:39:23 +00:00
Matias Niemelä 91147ade2e refactor(ivy): introduce a `firstUpdatePass` flag for `TView` instances (#31270)
This patch introduces a `firstUpdatePass` flag which can be used inside
of instruction code to determine if this is the first time each
instruction is running inside of the update block of a template or
a hostBindings function.

PR Close #31270
2019-11-04 21:39:22 +00:00
Brian Michalski e3189f97ff docs: Update link to angular + bazel example app (#33409)
http://github.com/angular/angular-bazel-example has been moved to rules_nodejs monorepo.
PR Close #33409
2019-11-04 20:07:37 +00:00
Pawel Kozlowski 4ff43e1324 refactor(ivy): remove the getHostNative utility function (#33554)
We already store a reference to a native host of a component
view so we can drop the getHostNative utility function (that
was getting the same reference from another data structure).

PR Close #33554
2019-11-04 20:07:06 +00:00
crisbeto 66725b7b37 perf(ivy): move local references into consts array (#33129)
Follow-up from #32798. Moves the local references array into the component def's `consts` in order to make it compress better.

Before:
```
const _c0 = ['foo', ''];

SomeComp.ngComponentDef = defineComponent({
  template: function() {
    element(0, 'div', null, _c0);
  }
});
```

After:
```
SomeComp.ngComponentDef = defineComponent({
  consts: [['foo', '']],
  template: function() {
    element(0, 'div', null, 0);
  }
});
```

PR Close #33129
2019-11-04 16:30:53 +00:00
Michael Prentice 5437e2da29 refactor(core): typo in undecorated-classes-with-di AOT failure message (#33018)
PR Close #33018
2019-11-04 16:07:26 +00:00
crisbeto c83f5013bf feat(ivy): implement unknown element detection in jit mode (#33419)
In ViewEngine we used to throw an error if we encountered an unknown element while rendering. We have this already for Ivy in AoT, but we didn't in JiT. These changes implement the error for JiT mode.

PR Close #33419
2019-11-04 15:59:10 +00:00
FabianGosebrink ac9d044cad docs: add GDE profile of Fabian Gosebrink (#33438)
PR Close #33438
2019-11-02 00:53:05 +00:00
Rick Katka 9e83814e61 docs: remove erroneous brack in animations guide (#33525)
Fixes #33459

PR Close #33525
2019-11-01 22:27:40 +00:00
Dave f185fabc11 docs: add GDE profile of David Muellerchen (#33455)
PR Close #33455
2019-11-01 22:23:06 +00:00
Filipe Silva 4857c53a49 test: add cli-hello-world-ivy-i18n integration test (#33510)
PR Close #33510
2019-11-01 17:50:56 +00:00
Filipe Silva 4e7ffbfbac test: rename cli-hello-world-ivy-i18n to just ivy-i18n (#33510)
It's not testing CLI i18n integration, it's instead testing localize itself over CLI bundles.

PR Close #33510
2019-11-01 17:50:56 +00:00
Filipe Silva 02308c4f71 test: update CLI to rc version (#33510)
PR Close #33510
2019-11-01 17:50:56 +00:00
Joey Perrott a8f4f14bdc ci: always run the publish_packages_as_artifacts jobs (#33519)
PR Close #33519
2019-11-01 17:49:58 +00:00
Matias Niemelä f02213a661 build: restore functionality of the micro benchmarks `profile_all.js` script (#33494)
The 4b81bb5c97 patch seemingly broke the
`profile_all.js` file due to the file renaming. This patch restores the
functionality of said script.

PR Close #33494
2019-11-01 17:47:49 +00:00
Martin Probst 09536423e8 fix(zone.js): work around TS3.7 issue (#33294)
In TypeScript 3.7, circularity detection misfires on the declaration of `value` here.
https://github.com/microsoft/TypeScript/issues/32950

Declaring an explicit type avoids the problem.

PR Close #33294
2019-11-01 17:46:03 +00:00
Charles Lyding fc8eecad3f fix(compiler-cli): remove unused CLI private exports (#33242)
These exports are no longer used by the CLI since 7.1.0.  Since major versions of the CLI are now locked to major versions of the framework, a CLI user will not be able to use FW 9.0+ on an outdated version (<7.1.0) of the CLI that uses these old APIs.

PR Close #33242
2019-11-01 17:43:47 +00:00
Mike Brocchi feb5f27d09 docs: Add Mike Brocchi to the list of GDEs (#33466)
PR Close #33466
2019-11-01 17:40:16 +00:00
Paul Gschwendtner 31116f0ced ci: re-enable material unit tests job (#33530)
The Material units tests job has been disabled with the
typescript upgrade PR since the components repository was
still on an old TypeScript version (due to cyclic dependencies
between the framework and components repository).

Since the components repository has been updated to `9.0.0-next.15`
and now uses the compatible TypeScript version, we can re-enable
ds

Related to this change, we need to ignore the `package.json`
engines when installing the dependencies of the components repo. This
is because the components repo already updated to NodeJS v12 and Yarn
v1.19.1. This is not the case for the CI setup of framework. For now,
since we don't want to change the dev setup (as it slows down
development), we temporarily disable the engines.

Additionally, the material unit tests job now depends on the actual
release packages (not on the ngtsc compiled ones). This is because
the components repo setup relies on NGCC being run. This is also
helpful for validating ngcc against the framework packages.

PR Close #33530
2019-11-01 17:38:39 +00:00
Keen Yee Liau 9ebac71521 fix(language-service): Should not crash if expr ends unexpectedly (#33524)
If there is any parser errors when parsing template, we should stop
immediately and not proceed with template expression diagnostics.

This regression is caused by 6d11154652
and affected v9.0.0-next.4 onwards.

PR closes https://github.com/angular/vscode-ng-language-service/issues/436

PR Close #33524
2019-11-01 17:37:48 +00:00
JoostK ce30888a26 feat(ivy): graceful evaluation of unknown or invalid expressions (#33453)
During static evaluation of expressions within ngtsc, it may occur that
certain expressions or just parts thereof cannot be statically
interpreted for some reason. The static interpreter keeps track of the
failure reason and the code path that was evaluated by means of
`DynamicValue`, which will allow descriptive errors. In some situations
however, the static interpreter would throw an exception instead,
resulting in a crash of the compilation. Not only does this cause
non-descriptive errors, more importantly does it prevent the evaluated
result from being partial, i.e. parts of the result can be dynamic if
their value does not have to be statically available to the compiler.

This commit refactors the static interpreter to never throw errors for
certain expressions that it cannot evaluate.

Resolves FW-1582

PR Close #33453
2019-11-01 00:04:02 +00:00
Alain Chautard 4d4b527474 docs(common): Remove async pipe from ngFor example (#33378)
Using the async pipe as the very first example makes it very confusing for beginners. Most people believe that | async is required for ngFor. I would remove that part to make the example solely focused on NgFor.
PR Close #33378
2019-10-31 23:47:28 +00:00
Robin Dupret 602eeee7d6 docs(forms): Add a missing space (#33352)
PR Close #33352
2019-10-31 23:46:54 +00:00
Alex Rickabaugh 38758d856a fix(ivy): don't crash on unknown pipe (#33454)
Previously the compiler would crash if a pipe was encountered which did not
match any pipe in the scope of a template.

This commit introduces a new diagnostic error for unknown pipes instead.

PR Close #33454
2019-10-31 23:43:32 +00:00
Alex Rickabaugh 9db59d010d fix(ivy): don't crash on an unknown localref target (#33454)
Previously the template binder would crash when encountering an unknown
localref (# reference) such as `<div #ref="foo">` when no directive has
`exportAs: "foo"`.

With this commit, the compiler instead generates a template diagnostic error
informing the user about the invalid reference.

PR Close #33454
2019-10-31 23:43:32 +00:00
Michael Prentice 72eba7745f fix(service-worker): ensure initialization before handling messages (#32525)
- resolves "Invariant violated (initialize): latest hash null has no known manifest"
- Thanks to @gkalpak and @hsta for helping test and investigate this fix

Fixes #25611

PR Close #32525
2019-10-31 22:55:35 +00:00
Pawel Kozlowski 083d48e072 perf(ivy): avoid native node retrieval from LView (#33511)
PR Close #33511
2019-10-31 22:53:29 +00:00
Pawel Kozlowski df1bef31a4 perf(ivy): add new benchmark focused on template creation (#33511)
PR Close #33511
2019-10-31 22:53:29 +00:00
Pawel Kozlowski 4452d6d848 perf(ivy): avoid repeated tNode.initialInputs reads (#33322)
PR Close #33322
2019-10-31 22:46:50 +00:00
Pawel Kozlowski 41caafcaf2 perf(ivy): avoid repeated native node retrieval and patching (#33322)
Before this change instantiating multiple directives on the same
host node would result in repeated RNode retrieval and patching.
This commint re-organises code around directive instance creation
so the host node processing (common to all directives) happens
once and only once.

As the additional benefit the directive instantiation logic gets
centralised in one function (at the expense of patching logic
duplication for root node).

PR Close #33322
2019-10-31 22:46:50 +00:00
Pawel Kozlowski 2c208f98a9 refactor(ivy): in-line postProcessDirective to avoid repeated isComponentDef checks (#33322)
PR Close #33322
2019-10-31 22:46:50 +00:00
Pawel Kozlowski 3ff712a0f5 refactor(ivy): correct typings in instantiateAllDirectives (#33322)
PR Close #33322
2019-10-31 22:46:49 +00:00
Pete Bacon Darwin 1d141a8ab1 fix(compiler-cli): attach the correct `viaModule` to namespace imports (#33495)
Previously declarations that were imported via a namespace import
were given the same `bestGuessOwningModule` as the context
where they were imported to. This causes problems with resolving
`ModuleWithProviders` that have a type that has been imported in
this way, causing errors like:

```
ERROR in Symbol UIRouterModule declared in
.../@uirouter/angular/uiRouterNgModule.d.ts
is not exported from
.../@uirouter/angular/uirouter-angular.d.ts
(import into .../src/app/child.module.ts)
```

This commit modifies the `TypescriptReflectionHost.getDirectImportOfIdentifier()`
method so that it also understands how to attach the correct `viaModule` to
the identifier of the namespace import.

Resolves #32166

PR Close #33495
2019-10-31 22:25:48 +00:00
NothingEverHappens d5ae854b5b refactor(upgrade): Drop unused imports (#33496)
PR Close #33496
2019-10-31 22:24:37 +00:00
Geoff Bass d863839ecc docs: fix selector in getting started guide (#33333)
PR Close #33333
2019-10-31 22:22:25 +00:00
TheMushr00m 66ab701606 docs: add example of a server in ruby for deployment (#33418)
PR Close #33418
2019-10-31 22:22:01 +00:00
Geoff Bass 64ac106248 docs: fix typo in Observables in Angular guide (#33509)
change `ActivateRoute` to `ActivatedRoute`
PR Close #33509
2019-10-31 22:21:00 +00:00
Michael Prentice 4099822ba2 docs: fix and refine COMMITTER.md (#33276)
mention correct merge label
remove the non inclusive "**just** read the instructions" content
link to CODEOWNERS file

PR Close #33276
2019-10-31 22:19:42 +00:00
Kara Erickson 7355906a95 docs: add detailed example to ContentChildren change (#33499)
PR Close #33499
2019-10-31 13:54:47 -07:00
Andrew Kushnir 2b1ba1835e release: cut the v9.0.0-rc.0 release 2019-10-31 13:26:18 -07:00
vikerman 12703d5601 docs: update to use latest 8.3.x CLI (#33518)
Change the "Updating to v9" docs to reflect that we want to use the latest 8.3.x CLI build for updating and not just 8.3.15.

PR Close #33518
2019-10-31 11:55:58 -07:00
Judy Bogart e4ebffab8d docs: fix format in ivy page (#33513)
PR Close #33513
2019-10-31 10:32:22 -07:00