Commit Graph

17266 Commits

Author SHA1 Message Date
Pawel Kozlowski 19cfaf7f4c fix(core): don't re-invoke pure pipes that throw and arguments are the same (#35827)
Pure pipes are not invoked again until their arguments are modified. The same
rule should apply to pure pipes that throw an exception. This fix ensures that
a pure pipe is not re-invoked if it throws an exception and arguments are not
changed.

PR Close #35827
2020-03-10 20:58:07 -04:00
Greg Magolan 6f95bc915d build: update to rules_nodejs 1.4.1 (#35999)
Minor bug fixes for Windows

PR Close #35999
2020-03-10 20:57:40 -04:00
Matias Niemelä e74738db8c build: fix `CHANGELOG.md` date for `v9.0.6` 2020-03-10 17:46:31 -07:00
Matias Niemelä 3aa5ae98ab docs: release notes for the v9.0.6 release 2020-03-10 17:44:48 -07:00
Matias Niemelä 5cb082ed53 release: cut the v9.1.0-next.4 release 2020-03-10 17:07:33 -07:00
Alex Rickabaugh 95c729f5d1 build: typescript 3.8 support (#35864)
This commit adds support in the Angular monorepo and in the Angular
compiler(s) for TypeScript 3.8. All packages can now compile with
TS 3.8.

For most of the repo, only a handful few typings adjustments were needed:

* TS 3.8 has a new `CustomElementConstructor` DOM type, which enforces a
  zero-argument constructor. The `NgElementConstructor` type previously
  declared a required `injector` argument despite the fact that its
  implementation allowed `injector` to be optional. The interface type was
  updated to reflect the optionality of the argument.
* Certain error messages were changed, and expectations in tests were
  updated as a result.
* tsserver (part of language server) now returns performance information in
  responses, so test expectations were changed to only assert on the actual
  body content of responses.

For compiler-cli and schematics (which use the TypeScript AST) a major
breaking change was the introduction of the export form:

```typescript
export * as foo from 'bar';
```

This is a `ts.NamespaceExport`, and the `exportClause` of a
`ts.ExportDeclaration` can now take this type as well as `ts.NamedExports`.
This broke a lot of places where `exportClause` was assumed to be
`ts.NamedExports`.

For the most part these breakages were in cases where it is not necessary
to handle the new `ts.NamedExports` anyway. ngtsc's design uses the
`ts.TypeChecker` APIs to understand syntax and so automatically supports the
new form of exports.

The View Engine compiler on the other hand extracts TS structures into
metadata.json files, and that format was not designed for namespaced
exports. As a result it will take a nontrivial amount of work if we want to
support such exports in View Engine. For now, these new exports are not
accounted for in metadata.json, and so using them in "folded" Angular
expressions will result in errors (probably claiming that the referenced
exported namespace doesn't exist).

Care was taken to only use TS APIs which are present in 3.7/3.6, as Angular
needs to remain compatible with these for the time being.

This commit does not update angular.io.

PR Close #35864
2020-03-10 17:51:20 -04:00
Andrew Kushnir c98c6e80c8 build: adding a script to compare commits in master and stable branches (#35130)
Adding a script that compares commits in master and patch branches and finds a delta between them. This is useful for release reviews, to make sure all the necessary commits are included into the patch branch and there is no discrepancy.

PR Close #35130
2020-03-10 17:40:56 -04:00
Joey Perrott e4b1e6c622 build: Add pullapprove verification tool to dev-infra-private package (#35911)
Migrates pullapprove verification tool to be available in the dev-infra-private
package

PR Close #35911
2020-03-10 14:17:56 -04:00
Joey Perrott 65a6848ed7 build: creates a script to get contributor stats from across the angular org (#35834)
This script gets all of the current users for the organization and retrieves
information about PR/Issue contributions/authorship since a provided date.
Returning this information as a CSV.

PR Close #35834
2020-03-10 14:17:24 -04:00
Andrew Kushnir 0bf6e58db2 fix(compiler): process `imports` first and `declarations` second while calculating scopes (#35850)
Prior to this commit, while calculating the scope for a module, Ivy compiler processed `declarations` field first and `imports` after that. That results in a couple issues:

* for Pipes with the same `name` and present in `declarations` and in an imported module, Pipe from imported module was selected. In View Engine the logic is opposite: Pipes from `declarations` field receive higher priority.
* for Directives with the same selector and present in `declarations` and in an imported module, we first invoked the logic of a Directive from `declarations` field and after that - imported Directive logic. In View Engine, it was the opposite and the logic of a Directive from the `declarations` field was invoked last.

In order to align Ivy and View Engine behavior, this commit updates the logic in which we populate module scope: we first process all imports and after that handle `declarations` field. As a result, in Ivy both use-cases listed above work similar to View Engine.

Resolves #35502.

PR Close #35850
2020-03-10 14:16:59 -04:00
crisbeto 191e4d15b5 build: fix elements test failures on IE (#35940)
Fixes the following issues which caused the `elements` unit tests to break on IE:
1. `core.js` wasn't included which caused an error about `Promise` and `Symbol` to be thrown.
2. We were using a version of `@webcomponents/custom-elements` which was shipping ES6 code to npm. As a result, IE was throwing a syntax error.

PR Close #35940
2020-03-10 14:16:34 -04:00
Joey Perrott 9368053be5 build: set dev-infra package to be private (#35910)
Setting the dev-infra package to private will prevent us
from accidentally publishing the package to npm.

PR Close #35910
2020-03-10 14:15:58 -04:00
Alex Rickabaugh 983f48136a test(compiler): add a public API guard for the public compiler options (#35885)
This commit adds a public API test which guards against unintentional
changes to the accepted keys in `angularCompilerOptions`.

PR Close #35885
2020-03-10 14:15:28 -04:00
Alex Rickabaugh edf881dbf1 refactor(compiler): split core/api.ts into multiple files (#35885)
This commit splits the ngtsc `core` package's api entrypoint, which
previously was a single `api.ts` file, into an api/ directory with multiple
files. This is done to isolate the parts of the API definitions pertaining
to the public-facing `angularCompilerOptions` field in tsconfig.json into a
single file, which will enable a public API guard test to be added in a
future commit.

PR Close #35885
2020-03-10 14:15:28 -04:00
Paul Gschwendtner 287bfefade ci: update components-repo-unit-tests job commit (#35961)
Updates the commit that the `components-repo-unit-tests` job runs
against to the latest available commit at time of writing.

The motivation for updating is that a lot of changes have been made, and
that a upcoming framework PR that fixes check no changes for OnPush
components exposed a test failure in `angular/components`.

See: eae5cf886d

PR Close #35961
2020-03-10 13:29:02 -04:00
Alan Agius 64d6f13b87 fix(platform-browser): add missing peerDependency on `@angular/animations` (#35949)
`@angular/platform-browser/animations` has a dependency on `@angular/animations` however, this is not listed in `peerDependencies`

With this change we add this package as an optional peerDependency as it's only required when using the `@angular/platform-browser/animations` entrypoint.

Fixes #35888

PR Close #35949
2020-03-10 13:28:32 -04:00
Andrew Scott fc71032dc4 test(router): use pageYOffset in testing when scrollY is not available (#35976)
IE 9, 10, and 11 use the non-standard name `pageYOffset` instead of
`scrollY`.

PR Close #35976
2020-03-10 13:28:04 -04:00
Keen Yee Liau 81cb54fc15 refactor(compiler): optionalOperator -> consumeOptionalOperator (#35980)
PR Close #35980
2020-03-10 13:27:37 -04:00
ivanwonder 3d46a45fa8 fix(language-service): resolve the variable from the template context first (#35982)
PR Close #35982
2020-03-10 13:27:04 -04:00
ayazhafiz 406419bc0f fix(language-service): fix calculation of pipe spans (#35986)
This commit accomplishes two tasks:

- Fixes the span of queried pipes to only be applied on pipe names
- By consequence, fixes how pipes are located in arguments (previously,
  pipes with arguments could not be found because the span of a pipe
  uses a relative span, while the template position is absolute)

The screenshots attached to the PR for this commit demonstrate the
change.

Closes https://github.com/angular/vscode-ng-language-service/issues/677

PR Close #35986
2020-03-10 13:26:40 -04:00
Joey Perrott a73e125c04 feat(dev-infra): add dev-infra to the commit message scopes (#35992)
Adds dev-infra to the commit message scopes.  Also, sets the scope to be ignored
in changelogs.

PR Close #35992
2020-03-10 13:26:12 -04:00
Andrew Kushnir 71309d223d Revert "feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)" (#35973)
This reverts commit 1882451ec0.

Reason: breaks some g3 targets.

PR Close #35973
2020-03-09 17:31:28 -04:00
Matias Niemelä 15482e7367 Revert "feat(bazel): transform generated shims (in Ivy) with tsickle (#35848)" (#35970)
This reverts commit 9ff9a072e6.

PR Close #35970
2020-03-09 17:00:14 -04:00
Alex Rickabaugh 9ff9a072e6 feat(bazel): transform generated shims (in Ivy) with tsickle (#35848)
Currently, when Angular code is built with Bazel and with Ivy, generated
factory shims (.ngfactory files) are not processed via the majority of
tsickle's transforms. This is a subtle effect of the build infrastructure,
but it boils down to a TsickleHost method `shouldSkipTsickleProcessing`.

For ngc_wrapped builds (Bazel + Angular), this method is defined in the
`@bazel/typescript` (aka bazel rules_typescript) implementation of
`CompilerHost`. The default behavior is to skip tsickle processing for files
which are not present in the original `srcs[]` of the build rule. In
Angular's case, this includes all generated shim files.

For View Engine factories this is probably desirable as they're quite
complex and they've never been tested with tsickle. Ivy factories however
are smaller and very straightforward, and it makes sense to treat them like
any other output.

This commit adjusts two independent implementations of
`shouldSkipTsickleProcessing` to enable transformation of Ivy shims:

* in `@angular/bazel` aka ngc_wrapped, the upstream `@bazel/typescript`
  `CompilerHost` is patched to treat .ngfactory files the same as their
  original source file, with respect to tsickle processing.

  It is currently not possible to test this change as we don't have any test
  that inspects tsickle output with bazel. It will be extensively tested in
  g3.

* in `ngc`, Angular's own implementation is adjusted to allow for the
  processing of shims when compiling with Ivy. This enables a unit test to
  be written to validate the correct behavior of tsickle when given a host
  that's appropriately configured to process factory shims.

For ngtsc-as-a-plugin, a similar fix will need to be submitted upstream in
tsc_wrapped.

PR Close #35848
2020-03-09 13:06:33 -04:00
Pete Bacon Darwin fc4c3c3eb5 fix(localize): merge translation from all XLIFF `<file>` elements (#35936)
XLIFF translation files can contain multiple `<file>` elements,
each of which contains translations. In ViewEngine all these
translations are merged into a single translation bundle.

Previously in Ivy only the translations from the last `<file>`
element were being loaded. Now all the translations from each
`<file>` are merged into a single translation bundle.

Fixes #35839

PR Close #35936
2020-03-09 13:06:05 -04:00
JiaLiPassion 1882451ec0 feat: Monkey patches MessagePort onproperties (onmessage/onmessageerror) (#34610)
Close #34581

PR Close #34610
2020-03-09 12:20:46 -04:00
Wagner Maciel 2b8edbbb1d refactor(benchpress): remove benchmarks_external from ..pullapprove.yml (#35670)
PR Close #35670
2020-03-09 12:19:25 -04:00
Wagner Maciel 446b51e164 refactor(benchpress): delete unused code (#35670)
PR Close #35670
2020-03-09 12:19:25 -04:00
Ayaz Hafiz 11f7e275e6 feat(compiler): type TemplateAst values as ASTWithSource (#35892)
TemplateAst values are currently typed as the base class AST, but they
are actually constructed with ASTWithSource. Type them as such, because
ASTWithSource gives more information about the consumed expression AST
to downstream customers (namely, the expression AST source).

Unblocks #35271

PR Close #35892
2020-03-09 12:14:09 -04:00
Pete Bacon Darwin 0e2a577b42 fix(localize): improve matching and parsing of XTB translation files (#35793)
This commit improves the `canParse()` method to check that the file is
valid XML and has the expected root node. Previously it was relying upon
a regular expression to do this.

PR Close #35793
2020-03-09 12:11:58 -04:00
Pete Bacon Darwin 08071e5634 fix(localize): improve matching and parsing of XLIFF 2.0 translation files (#35793)
Previously, the `Xliff2TranslationParser` only matched files that had a narrow
choice of extensions (e.g. `xlf`) and also relied upon a regular expression
match of an optional XML namespace directive.

This commit relaxes the requirement on both of these and, instead, relies
upon parsing the file into XML and identifying an element of the form
`<xliff version="2.0">` which is the minimal requirement for such files.

PR Close #35793
2020-03-09 12:11:58 -04:00
Pete Bacon Darwin 350ac11554 fix(localize): improve matching and parsing of XLIFF 1.2 translation files (#35793)
Previously, the `Xliff1TranslationParser` only matched files that had a narrow
choice of extensions (e.g. `xlf`) and also relied upon a regular expression
match of an optional XML namespace directive.

This commit relaxes the requirement on both of these and, instead, relies
upon parsing the file into XML and identifying an element of the form
`<xliff version="1.2">` which is the minimal requirement for such files.

PR Close #35793
2020-03-09 12:11:58 -04:00
Pete Bacon Darwin cd32085a75 refactor(localize): allow hints from `canParse()` to `parse()` (#35793)
This enables complex work to be done in `TranslationParser.canParse()`
without duplicating the work in `TranslationParser.parse()`.

PR Close #35793
2020-03-09 12:11:58 -04:00
Pete Bacon Darwin d88b237f1e refactor(localize): add support for TranslationParser diagnostics (#35793)
This modifies the internal (but shared with CLI) API for loading/parsing
translation files. Now the parsers will return a new `Diagnostics` object
along with any translations and locale extracted from the file.

It is up to the caller to decide what to do about this, if there are errors
it is suggested that an error is thrown, which is what the `TranslationLoader`
class does.

PR Close #35793
2020-03-09 12:11:58 -04:00
tresor616 99ce015f42 refactor: export silentLogger not SilentLoggerFn (#34079)
Export SilentLogger object instead of the SilentLoggerFn and capitalise silentLoggerFn instead of the SilentLoggerFn
PR Close #34079
2020-03-06 17:37:12 -05:00
JiaLiPassion 55b3f97be0 fix(zone.js): `tickOptions`'s `processNewMacroTasksSynchronously` should default to true when flag omitted (#35814)
Calling `tick(0, null)` defaults `processNewMacroTasksSynchronously` flag to `true`, however calling  `tick(0, null, {})` defaults `processNewMacroTasksSynchronously` to `undefined`. This is undesirable behavior since unless the flag is set explicitly it should still default to `true`.

PR Close #35814
2020-03-06 17:33:57 -05:00
Paul Gschwendtner 958165888c fix(bazel): do not use manifest paths for generated imports within compilation unit (#35841)
Currently, the `ng_module` rule incorrectly uses manifest paths for
generated imports from the Angular compiler.

This breaks packaging as prodmode output (i.e. `esnext`) is copied in
various targets (`es5` and `es2015`) to the npm package output.

e.g. imports are generated like:

_node_modules/my-pkg/es2015/imports/public-api.js_
```ts
import * as i1 from "angular/packages/bazel/test/ng_package/example/imports/second";
```

while it should be actually:

```ts
import * as i1 from "./second";
```

The imports can, and should be relative so that the files are
self-contained and do not rely on custom module resolution.

PR Close #35841
2020-03-06 17:31:10 -05:00
Paul Gschwendtner 68bebd67f7 test: add entry-point with generated imports to ng_package test (#35841)
PR Close #35841
2020-03-06 17:31:10 -05:00
George Kalpakas 82a6fc5ef9 build(docs-infra): use local version of Zone.js when testing against local packages (#35858)
In some cases, we want to test the AIO app or docs examples against the
locally built Angular packages (for example to ensure that the changes
in a commit do not introduce a breaking change). In order to achieve
this, we have the `ng-packages-installer` script that handles updating
a project's `package.json` file to use the locally built Angular
packages (and appropriate versions for their (dev-/peer-)dependencies).

Previously, `ng-packages-installer` would only consider the locally
built Angular packages (from `dist/packages-dist/`). However, given that
Zone.js is now part of the `angular/angular` repo, it makes sense to
also use the locally built Zone.js package (from `dist/zone.js-dist/`).
Otherwise, the tests might fail for commits that update both the Angular
packages (and related docs examples) and the Zone.js package. An example
of such a simultaneous change (that would have broken tests) is #33838.

This commit updates the script to install the locally built Zone.js
package (in addition to the Angular ones). The commit ensures that the
Zone.js package will always be available alongside the Angular packages
(i.e. that the Zone.js package will be built by the same script that
builds the Angular packages and that the `dist/zone.js-dist/` directory
will be cached on CI).

Note: This problem was discovered while enabling docs examples unit
tests in #34374.

PR Close #35858
2020-03-06 17:30:20 -05:00
JiaLiPassion 86a45ff561 docs(zone.js): update coments of zone configuration API definition (#35849)
PR Close #35849
2020-03-06 16:55:32 -05:00
JiaLiPassion 84c2458ea7 refactor: cleanup zone.js test instruction (#34860)
PR Close #34860
2020-03-06 16:53:21 -05:00
JiaLiPassion c06f9a1ce3 docs(zone.js): update comment and chapter format of ngzone doc. (#35738)
PR Close #35738
2020-03-06 16:51:43 -05:00
Daniil Gorbunov d912d4f34c docs: markup mini fix (#35883)
PR Close #35883
2020-03-06 16:50:10 -05:00
Paul Gschwendtner 59607dc495 fix(core): undecorated-classes-with-di migration should handle libraries generated with CLI versions past v6.2.0 (#35824)
The options for `flatModuleId` and `flatModuleOutFile` had been removed in the CLI
from generated libraries with 718ee15b9a.

This has been done because `ng-packagr` (which is used to build the
libraries) automatically set these options in-memory when it compiles the library.
No migration has been created for this because there was no actual need to get rid of
this. Keeping the options in the library `tsconfig` does not cause any problems unless
the `tsconfig` is used outside of `ng-packagr`. This was not anticipated, but is now
commonly done in `ng update` migrations.

The `ng update` migrations try to create an instance of the `AngularCompilerProgram` by
simply parsing the `tsconfig`. The migrations make the valid assumption that `tsconfig` files
are not incomplete/invalid. They _definitely_ are in the file system though. It just works for
libraries because `ng-packagr` in-memory completes the invalid `tsconfig` files, so that they
can be passed to the `@angular/compiler-cli`.

We can't have this logic in the `ng update` migrations because it's
out-of-scope for individual migrations to distinguish between libraries
and applications. Also it would be out-of-scope to parse the
`ng-packagr` configuration and handle the tsconfig in-memory completion.

As a workaround though, we can remove the flat-module bundle options
in-memory when creating the compiler program. This is acceptable since
we don't emit the program and the flat module bundles are not needed.

Fixes #34985.

PR Close #35824
2020-03-06 12:40:18 -05:00
Keen Yee Liau bef14cf424 refactor(compiler): rename _ParseAST.optionalCharacter TemplateBinding.expression (#35886)
This commit renames
1. _ParseAST.optionalCharacter -> consumeOptionalCharacter
2. TemplateBinding.expression -> value

PR Close #35886
2020-03-06 12:39:49 -05:00
Ajit Singh 59078c444c docs: move ngIndia 2020 to past events on events page (#35901)
ng india was an outdated event removed it from upcoming events on the events page and added to already presented events

PR Close #35901
2020-03-06 12:39:24 -05:00
ivanwonder 4e1d780554 fix(language-service): resolve the real path for symlink (#35895)
when AOT resolves the module name, it will preserve the path of the symlink, but the ts-server will return the real path for symlink.

PR Close #35895
2020-03-06 12:38:55 -05:00
Sonu Kapoor 44f9fa6ce5 docs: add missing closing bracket (#35890)
Closes #35887
PR Close #35890
2020-03-06 12:38:30 -05:00
Joey Perrott a1b90619ba test(zone.js): sets rollup_bundle to use the --silent flag in karma tests (#35881)
PR Close #35881
2020-03-06 12:37:55 -05:00
Joey Perrott b42e2e0dff build: create dev-infra-private npm package (#35862)
Creates the scaffolding for an @angular/dev-infra-private package
which will not be published to npm but will be pushed to
https://github.com/angular/dev-infra-private-builds repo for each
commit to master.

The contents of this npm package will then be depended on via
package.json dependency for angular/angular angular/angular-cli and
angular/components.

PR Close #35862
2020-03-05 18:55:40 -05:00