Commit Graph

16825 Commits

Author SHA1 Message Date
Paul Gschwendtner 6b468f9b2e fix(ngcc): libraries using spread in object literals cannot be processed (#34661)
Consider a library that uses a shared constant for host bindings. e.g.

```ts
export const BASE_BINDINGS= {
  '[class.mat-themed]': '_isThemed',
}

----

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir1 {}

@Directive({
  host: {...BASE_BINDINGS, '(click)': '...'}
})
export class Dir2 {}
```

Previously when these components were shipped as part of the
library to NPM, consumers were able to consume `Dir1` and `Dir2`.
No errors showed up.

Now with Ivy, when ngcc tries to process the library, an error
will be thrown. The error is stating that the host bindings should
be an object (which they obviously are). This happens because
TypeScript transforms the object spread to individual
`Object.assign` calls (for compatibility).

The partial evaluator used by the `@Directive` annotation handler
is unable to process this expression because there is no
integrated support for `Object.assign`. In View Engine, this was
not a problem because the `metadata.json` files from the library
were used to compute the host bindings.

Fixes #34659

PR Close #34661
2020-01-23 10:29:57 -08:00
George Kalpakas 93ffc67bfb fix(ngcc): update `package.json` deterministically (#34870)
Ngcc adds properties to the `package.json` files of the entry-points it
processes to mark them as processed for a format and point to the
created Ivy entry-points (in case of `--create-ivy-entry-points`). When
running ngcc in parallel mode (which is the default for the standalone
ngcc command), multiple formats can be processed simultaneously for the
same entry-point and the order of completion is not deterministic.

Previously, ngcc would append new properties at the end of the target
object in `package.json` as soon as the format processing was completed.
As a result, the order of properties in the resulting `package.json`
(when processing multiple formats for an entry-point in parallel) was
not deterministic. For tools that use file hashes for caching purposes
(such as Bazel), this lead to a high probability of cache misses.

This commit fixes the problem by ensuring that the position of
properties added to `package.json` files is deterministic and
independent of the order in which each format is processed.

Jira issue: [FW-1801](https://angular-team.atlassian.net/browse/FW-1801)

Fixes #34635

PR Close #34870
2020-01-23 10:16:35 -08:00
George Kalpakas 43db4ffcd6 test(ngcc): verify that `PackageJsonUpdater` does not write to files from worker processes (#34870)
PR Close #34870
2020-01-23 10:16:35 -08:00
ayazhafiz 68025ce09a test(language-service): recognize inputs/ouputs declared in decorator (#34875)
This commit adds a regression test to check that the language service
recognizes inputs and outputs declared in a directive decorator.

See #34874.

PR Close #34875
2020-01-23 10:15:12 -08:00
Ayaz Hafiz 1ea04ffc05 feat(language-service): support multiple symbol definitions (#34782)
In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.

PR Close #34782
2020-01-23 10:14:19 -08:00
Greg Magolan 48f8ca5483 build: upgrade to bazel 2.0.0 (#34877)
PR Close #34877
2020-01-23 10:05:05 -08:00
Andrew Scott 32b72f39f0 fix(ivy): ensure eventListeners added outside angular context are not called... (#34514)
by DebugElement.triggerEventHandler. ZoneJS tracks the eventListeners on
a node but we need to be able to differentiate between those added by
Angular and those that were added outside the Angular context. This fix
aligns with the behavior that was present in View Engine (not calling
those listeners). If we decide later that we want to call those
listeners, we still need a way to differentiate between those that
we have wrapped in dom_renderer and those that were not (because they
were added outside the Angular context).

PR Close #34514
2020-01-22 15:38:13 -08:00
Pete Bacon Darwin d15cf60c49 feat(compiler-cli): require node 10 as runtime engine (#34722)
Similar to c602563 this commit aligns the node.js version
requirements of the Angular compiler with Angular CLI.

PR Close #34722
2020-01-22 15:35:34 -08:00
Pete Bacon Darwin 03465b621b fix(ngcc): only lock ngcc after targeted entry-point check (#34722)
The Angular CLI will continue to call ngcc on all possible packages, even if they
have already been processed by ngcc in a postinstall script.

In a parallel build environment, this was causing ngcc to complain that it was
being run in more than one process at the same time.

This commit moves the check for whether the targeted package has been
processed outside the locked code section, since there is no issue with
multiple ngcc processes from doing this check.

PR Close #34722
2020-01-22 15:35:34 -08:00
Pete Bacon Darwin a107e9edc6 feat(ngcc): lock ngcc when processing (#34722)
Previously, it was possible for multiple instance of ngcc to be running
at the same time, but this is not supported and can cause confusing and
flakey errors at build time.

Now, only one instance of ngcc can run at a time. If a second instance
tries to execute it fails with an appropriate error message.

See https://github.com/angular/angular/issues/32431#issuecomment-571825781

PR Close #34722
2020-01-22 15:35:34 -08:00
Pete Bacon Darwin 3a6cb6a5d2 refactor(ivy): add exclusive mode to `writeFile()` (#34722)
This commit adds an `exclusive` parameter to the
`FileSystem.writeFile()` method. When this parameter is
true, the method will fail with an `EEXIST` error if the
file already exists on disk.

PR Close #34722
2020-01-22 15:35:34 -08:00
Pete Bacon Darwin ecbc25044c refactor(ivy): add `removeFile` to ngtsc `FileSystem` (#34722)
PR Close #34722
2020-01-22 15:35:34 -08:00
Andrew Kushnir 92c411f86d docs: update payload size limits for angular.io application (#34913)
This commit increases payload size limits for angular.io application that triggered an error after merging another commit (00f13cc074). The goal of this commit is to bring master back to a "green" state and separate investigation is required to identify the root cause for size increase.

PR Close #34913
2020-01-22 15:01:01 -08:00
Aravind 1be5b69174 docs: fix typo on router guide (#34911)
closes #34907
PR Close #34911
2020-01-22 14:32:56 -08:00
Sonu Kapoor f49b45832c build(docs-infra): always specify a landing file for StackBlitz projects (#34553)
The StackBlitz API (which we use to generate StackBlitz projects on the
fly, when a user clicks on a live example link in the docs) allows
specifying the file to open in the editor by passing a query param. If
no file is specified, StackBlitz opens a default one. In the past, it
used to be `main.ts` and nowadays it seems to be `app.component.ts`.

StackBlitz builder, the tool that we use to generate the StackBlitz
projects, allows specifying the primary file by setting the `file`
property in the corresponding `stackblitz.json`.

Previously, if the `file` property was not set, StackBlitz builder would
not specify a file, thus falling back on StackBlitz's default behavior.
This was not great, because the default behavior may change unexpectedly
is the future to something that is less useful for our users.

This commit change StackBlitz builder to always specify a primary file.
If no file is specified in `stackblitz.json`, the builder will look
for the first file that exists in the example from a list of predefined
files.

Partially addresses #22357.

PR Close #34553
2020-01-22 13:45:23 -08:00
Sonu Kapoor 77c53559d0 build(docs-infra): specify more relevant landing files for StackBlitz projects (#34553)
The StackBlitz API (which we use to generate StackBlitz projects on the
fly, when a user clicks on a live example link in the docs) allows
specifying the file to open in the editor by passing a query param. If
no file is specified, StackBlitz opens a default one.

This commit specifies relevant landing files for some of the examples to
make it easier to engage with the examples more quickly, and to see what
the example is attempting to demonstrate.

Fixes #22357.

PR Close #34553
2020-01-22 13:45:23 -08:00
Kristiyan Kostadinov 00f13cc074 fix(ivy): DebugNode.classes not working on SVG elements (#34872)
Fixes Ivy throwing an error when trying to access the `DebugNode.classes` of an SVG element. The problem is that the `className` of an SVG element is an `SVGAnimatedString`, rather than a plain string.

Fixes #34868.

PR Close #34872
2020-01-22 13:40:22 -08:00
Adam e1fc44f5d6 build: remove @angular/http from modules (#34892)
PR Close #34892
2020-01-22 13:39:16 -08:00
Judy Bogart 13ce3756c2 docs: add differential loading term to glossary (#34884)
PR Close #34884
2020-01-22 13:37:35 -08:00
Matias Niemelä 32489c7426 revert: refactor(ivy): remove styleSanitizer instruction in favor of an inline param (#34480) (#34910)
This reverts commit 84d24c08e1.

PR Close #34910
2020-01-22 15:59:33 -05:00
ajitsinghkaler 61ad50d40a docs: add message on click of hero in toh-4 (#34496)
First we used a messages array to display messages toh-4 but it dsplayed only one message added additional messages on click of a hero

Fixes #28739

PR Close #34496
2020-01-22 14:42:55 -05:00
Sonu Kapoor e7cf37d99f docs: clarify where the `async` utility function is coming from (#34876)
inside the `beforeEach` for out testing guide.

Fixes #34833

PR Close #34876
2020-01-22 14:40:17 -05:00
George Kalpakas 2954a14c3d ci(docs-infra): do not output build progress for e2e tests on CI (#34840)
When running the e2e tests on CI, it is desirable that the build
progress is not logged, because that clutters the logs and makes it
difficult to get to the useful info in case of failures.

The previous config to achieve that doesn't work any more.

This commit update the `ci` configuration for e2e tests to suppress
build progress logging.

PR Close #34840
2020-01-22 14:37:32 -05:00
Joey Perrott cc956744d7 ci: move setup of bazel configurations into the env init scripts (#34834)
Since we always set up bazel on both our windows and linux CI
runs, we should consider this configuration part of the environment
setup.

PR Close #34834
2020-01-22 14:37:02 -05:00
Joey Perrott ef665889a1 ci: always set up RBE for bazel executions on CI (#34834)
Since we always execute our bazel commands using RBE on CI
we should not have separete tasks of configuring bazel
and setting up RBE for bazel.  Enabling RBE for bazel should
be part of our bazel configuration process on CI.

PR Close #34834
2020-01-22 14:37:02 -05:00
Keen Yee Liau f723a27a71 refactor(language-service): Consistent naming between ts and ng LanguageService (#34888)
This commit makes the Angular Language Service interface a strict subset
of TypeScript's Language Service by renaming all methods to be
consistent with TypeScript's.

The custom Angular `LanguageService` interface was needed before the
inception of TypeScript tsserver plugin, but is now obsolete since
Angular LS is a proper tsserver plugin.

This allows us to easily adapt to upstream TS changes in the future, and
also allows us to reuse all data types defined in TypeScript.

PR Close #34888
2020-01-22 14:36:04 -05:00
Matias Niemelä 84d24c08e1 refactor(ivy): remove styleSanitizer instruction in favor of an inline param (#34480)
This patch removes the need for the styleSanitizer() instruction in
favor of passing the sanitizer into directly into the styleProp
instruction.

This patch also increases the binding index size for all style/class bindings in preparation for #34418

PR Close #34480
2020-01-22 14:35:00 -05:00
Matias Niemelä 0d8309509b release: cut the v9.0.0-rc.10 release 2020-01-22 11:23:21 -08:00
Joey Perrott b5e9264579 build: add --stamp flag to the release config (#34890)
In a recent upgrade of rules_nodejs an update was made the
stamping logic in npm_package.  Triggering stamping for npm_package
now require the --stamp flag.

PR Close #34890
2020-01-22 12:34:12 -05:00
Martin Probst 11a4370e15 refactor(http): fix a strictBindCallApply issue. (#34817)
`String.fromCharCode`'s type signature requires a regular `number[]`.

PR Close #34817
2020-01-21 16:44:40 -05:00
Kapunahele Wong a3b2d6735a build(docs-infra): add auto-link-filter for generic words (#34835)
Fixes #34794

PR Close #34835
2020-01-21 15:08:01 -05:00
Judy Bogart 5b77e67dff docs: edit golden file error description (#34871)
PR Close #34871
2020-01-21 14:25:38 -05:00
Andrew Kushnir 39ec188003 fix(ivy): more accurate detection of pipes in host bindings (#34655)
Pipes in host binding expressions are not supported in View Engine and Ivy, but in some more complex cases (like `(value | pipe) === true`) compiler was not reporting errors. This commit extends Ivy logic to detect pipes in host binding expressions and throw in cases bindings are present. View Engine behavior remains the same.

PR Close #34655
2020-01-21 13:22:00 -05:00
Sonu Kapoor def4127bf1 fix(docs-infra): convert hard-coded `comparing-observables` examples into a proper mini-app (#34327)
Previously, the examples in the `comparing-observables` guide were hard-coded.
This made it impossible to test them and verify they are correct.

This commit fixes this by converting them into a proper mini-app. In a
subsequent commit, tests will be added to verify that the source code
works as expected (and guard against regressions).

Fixes #31024

PR Close #34327
2020-01-21 13:14:46 -05:00
Paul Gschwendtner 7342d4b6f0 ci: remove typescript 3.7 patches in material-unit-tests job (#34863)
Previously, we added patches to the `angular/components` repository in
the `material-unit-tests` job in order to be able to run their tests
with TypeScript 3.7. This is no longer needed since the components
repository updated to Ts 3.7 already. Hence we can remove the patches.

PR Close #34863
2020-01-21 13:13:51 -05:00
Paul Gschwendtner 20419d3d49 ci: update material-unit-tests job commit to latest (#34863)
Updates the `material-unit-tests` job commit to the latest
available commit. We need to update since the `angular/components`
repository updated to TypeScript 3.7, which means that we can remove
the TS 3.7 workarounds we applied to get the job green when framework
updated to TS 3.7.

PR Close #34863
2020-01-21 13:13:51 -05:00
crisbeto 697f6a55a5 fix(animations): not waiting for child animations to finish when removing parent in Ivy (#34702)
In #28162 we introduced an extra `removeNode` call for host elements which can cause the parent element to be removed before all child animations have finished. The issue is only in Ivy, because that the only place where we pass in the `isHostElement` flag. These changes fix the issue by not re-triggering the removal logic if the element has in-progress animations.

Fixes #33597.

PR Close #34702
2020-01-21 13:13:20 -05:00
Sonu Kapoor 15ae924035 fix(docs-infra): convert hard-coded `cli-builder` examples into a proper mini-app (#34362)
Previously, the examples in the `cli-builder` guide were hard-coded.
This made it impossible to test them and verify they are correct.

This commit fixes this by converting them into a proper mini-app. In a
subsequent commit, tests will be added to verify that the source code
works as expected (and guard against regressions).

Fixes #34314

PR Close #34362
2020-01-21 13:12:18 -05:00
ayazhafiz 6c8e322fa1 refactor(language-service): cleanup of low-hanging TODOs (#34784)
Cleans up some simple TODOs. Also removes
`typescript_symbols#getTypeWrapper`, which I thought I had but failed to
remove in #34571.

PR Close #34784
2020-01-21 13:09:30 -05:00
Alan Agius 17e98e1678 build: disable link to PUBLIC_API docs when running ts-api-guardian in angular repo (#34786)
Currently we are showing the following link https://github.com/angular/angular/blob/master/docs/PUBLIC_API.md#golden-files whenever there are updates to the golden files. However this is not correct as this document only applies to the Angular repo as other consumers of ts-api-guardian have different commands, and they store they golden files in different locations.

PR Close #34786
2020-01-21 13:08:47 -05:00
Alan Agius 47f233a4a7 docs: fix public api tool name (#34786)
PR Close #34786
2020-01-21 13:08:47 -05:00
Kristina Gocheva b04c3cce09 docs: fix logging upon search in example tutorial (#34806)
When no errors are thrown but empty array is returned we should log different message.

PR Close #34806
2020-01-21 13:08:15 -05:00
Igor Minar 2f7857f0fb ci: update link for g3sync (#34842)
the link has changed in g3.

PR Close #34842
2020-01-21 13:03:55 -05:00
ajitsinghkaler fae5c521d8 docs: change docs for get request return object type checking (#34845)
earlier in the docs it was told that adding typescript's type checking make json response typed so changed docs to say that it adds all typescipt capabilities during compile time

Fixes #34746

PR Close #34845
2020-01-21 13:03:31 -05:00
ajitsinghkaler 4dbc871169 docs(core): fix typo in dependency injection guide (interactive --> interacting) (#34853)
Fixes #34852

PR Close #34853
2020-01-21 13:03:04 -05:00
ajitsinghkaler 2694a3b734 docs(core): add missing quote in dependency injection provider guide (#34854)
Add closing double quote in HTML `class` attribute in dependency
injection provider guide.

Fixes #34851

PR Close #34854
2020-01-21 13:02:29 -05:00
Pete Bacon Darwin e0ad9ecda0 fix(ivy): ensure that `LOCALE_ID` is set after app initializers (#34830)
Before ivy it was possible to configure a mutable service value
in an application initializer (by providing an `APP_INITIALIZER`)
that could be read in the provider of `LOCALE_ID`. This is a common
scenario if you wanted to load the locale id asynchronously from
an HTTP request for instance.

When using the ivy, the runtime needs to be told what the current
locale is, which is done by calling the `setLocaleId()` function with
the value injected by the `LOCALE_ID` token. Previously this was
being done before the application initializers were run, which meant
that the `LOCALE_ID` provider was being executed before the
app initializers had a chance to get a new value for it.

Now this initalization of the locale for the ivy runtime is done after the
application initializers have been run.

Closes #34701

PR Close #34830
2020-01-17 16:23:49 -05:00
Igor Minar 0b1e34de40 fix(common): cleanup the StylingDiffer and related code (#34307)
Since I was learning the codebase and had a hard time understanding what was going on I've done a
bunch of changes in one commit that under normal circumstances should have been split into several
commits. Because this code is likely going to be overwritten with Misko's changes I'm not going to
spend the time with trying to split this up.

Overall I've done the following:
- I processed review feedback from #34307
- I did a bunch of renaming to make the code easier to understand
- I refactored some internal functions that were either inefficient or hard to read
- I also updated lots of type signatures to correct them and to remove many casts in the code

PR Close #34307
2020-01-17 14:07:27 -05:00
Matias Niemelä abd4628587 fix(common): ensure diffing in ngStyle/ngClass correctly emits value changes (#34307)
Prior to this change, in Ivy mode ngStyle/ngClass would accidentally emit value changes for static
(string-based) values even if the value itself had not changed. This patch ensures that
the style/class diffing code is more strict and when it signals ngClass/ngStyle that there has been
a value change.

Fixes #34336, #34444

PR Close #34307
2020-01-17 14:07:27 -05:00
Filipe Silva 27b9eb5e38 build: use CLI rc.8 (#34788)
PR Close #34788
2020-01-17 13:42:41 -05:00