This project is mirrored from https://github.com/angular/angular.git.
Pull mirroring updated .
- Oct 15, 2020
-
-
Pete Bacon Darwin authored
Previously, inline exports of the form `exports.foo = <implementation>;` were being interpreted (by the ngtsc `PartialInterpeter`) as `Reference` objects. This is not what is desired since it prevents the value of the export from being unpacked, such as when analyzing `NgModule` declarations: ``` exports.directives = [Directive1, Directive2]; @NgImport({declarations: [exports.directives]}) class AppModule {} ``` In this example the interpreter would think that `exports.directives` was a reference rather than an array that needs to be unpacked. This bug was picked up by the ngcc-validation repository. See https://github.com/angular/ngcc-validation/pull/1990 and https://circleci.com/gh/angular/ngcc-validation/17130 PR Close #39272
-
Pete Bacon Darwin authored
Some inline declarations are of the form: ``` exports.<name> = <implementation>; ``` In this case the declaration `node` is `exports.<name>`. When interpreting such inline declarations we actually want to visit the `implementation` expression rather than visiting the declaration `node`. This commit adds `implementation?: ts.Expression` to the `InlineDeclaration` type and updates the interpreter to visit these expressions as described above. PR Close #39272
-
Pete Bacon Darwin authored
Previously the `node.name` property was only checked to ensure it was defined. But that meant that it was a `ts.BindingName`, which also includes `ts.BindingPattern`, which we do not support. But these helper methods were forcefully casting the value to `ts.Identifier. Now we also check that the `node.name` is actually an `ts.Identifier`. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
Previously directive "queries" that relied upon a namespaced type ```ts queries: { 'mcontent': new core.ContentChild('test2'), } ``` caused an error to be thrown. This is now supported. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
Previously, any declarations that were defined "inline" were not recognised by the `UmdReflectionHost`. For example, the following syntax was completely unrecognized: ```ts var Foo_1; exports.Foo = Foo_1 = (function() { function Foo() {} return Foo; })(); exports.Foo = Foo_1 = __decorate(SomeDecorator, Foo); ``` Such inline classes were ignored and not processed by ngcc. This lack of processing led to failures in Ivy applications that relied on UMD formats of libraries such as `syncfusion/ej2-angular-ui-components`. Now all known inline UMD exports are recognized and processed accordingly. Fixes #38947 PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
Previously these tests were checking multiple specific expression types. The new helper function is more general and will also support `PropertyAccessExpression` nodes for `InlineDeclaration` types. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
Previously the `ConcreteDeclaration` and `InlineDeclaration` had different properties for the underlying node type. And the `InlineDeclaration` did not store a value that represented its declaration. It turns out that a natural declaration node for an inline type is the expression. For example in UMD/CommonJS this would be the `exports.<name>` property access node. So this expression is now used for the `node` of `InlineDeclaration` types and the `expression` property is dropped. To support this the codebase has been refactored to use a new `DeclarationNode` type which is a union of `ts.Declaration|ts.Expression` instead of `ts.Declaration` throughout. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
This makes these tests more resilient to changes in the test code structure. For example switching from ``` var SomeClass = <implementation>; exports.SomeClass = SomeClass; ``` to ``` exports.SomeClass = <implementation>; ``` PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
test(compiler-cli): make the `getDeclaration()` utility more resilient to code format (#38959) (#39272) Previously `getDeclaration()` would only return the first node that matched the name passed in and then assert the predicate on this single node. It also only considered a subset of possible declaration types that we might care about. Now the function will parse the whole tree collecting an array of all the nodes that match the name. It then filters this array based on the predicate and only errors if the filtered array is empty. This makes this function much more resilient to more esoteric code formats such as UMD. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
The protected helper functions can then be overridden by subclasses of the Esm2015ReflectionHost. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
The new function does not try to restrict the kind of AST node that it finds, leaving that to the caller. This will make it more resuable in the UMD reflection host. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
Sometimes UMD exports appear in the following form: ``` exports.MyClass = alias1 = alias2 = <<declaration>> ``` Previously the declaration of the export would have been captured as `alias1 = alias2 = <<declaration>>`, which the `PartialInterpreter` would have failed on, since it cannot handle assignments. Now we skip over these aliases capturing only the `<<declaration>>` expression. Fixes #38947 PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
UMD files export values by assigning them to an `exports` variable. When evaluating expressions ngcc was failing to cope with expressions like `exports.MyComponent`. This commit fixes the `UmdReflectionHost.getDeclarationOfIdentifier()` method to map the `exports` variable to the current source file. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
The `SIMPLE_CLASS_FILE` contained a `ChildClass` that had an internal aliases implementation and extended a `SuperClass` base class. The call to `__extends` was using the wrong argument for the child class. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
If the `symbol` for the given `node` does not exist then there is no point in creating the `map`. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
This clarifies that this is specifically about statements of the form `exports.<name> = <declaration>`, rather than a general export statement such as `export class <ClassName> { ... }`. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
The `isAssignment` and `isAssignmentStatement` are not used in this file. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
refactor(compiler-cli): remove unnecessary constraint on `isDeclarationReference()` (#38959) (#39272) There is no need to check that the `ref.node` is of any particular type because immediately after this check the entry is tested to see if it passes `isClassDeclarationReference()`. The only difference is that the error that is reported is slightly different in the case that it is a `ref` but not one of the TS node types. Previously: ``` `Value at position ${idx} in the NgModule.${arrayName} of ${ className} is not a reference` ``` now ``` `Value at position ${idx} in the NgModule.${arrayName} of ${ className} is not a class` ``` Arguably the previous message was wrong, since this entry IS a reference but is not a class. PR Close #38959 PR Close #39272
-
Pete Bacon Darwin authored
The message now also reports the name of the predicate function that failed. PR Close #38959 PR Close #39272
-
Alex Okrushko authored
PR Close #39149
-
JoostK authored
When ngcc is configured to run with the `--use-program-dependencies` flag, as is the case in the CLI's asynchronous processing, it will scan all source files in the program, starting from the program's root files as configured in the tsconfig. Each individual root file could potentially rescan files that had already been scanned for an earlier root file, causing a severe performance penalty if the number of root files is large. This would be the case if glob patterns are used in the "include" specification of a tsconfig file. This commit avoids the performance penalty by keeping track of the files that have been scanned across all root files, such that no source file is scanned multiple times. Fixes #39240 PR Close #39254
-
atscott authored
- The current initial triage does not include PRs. This includes them by removing the issue filter - The merge assistance label is often applied to PRs that do not have status=success. Caretaker should handle these as well PR Close #39257
- Oct 14, 2020
-
-
sajeetharan authored
PR Close #39019
-
d0rian authored
PR Close #39245
-
- Oct 13, 2020
-
-
David Shevitz authored
PR Close #38984
-
George Kalpakas authored
Previously, the `isCommitClosingPullRequest()` method (used in `ng-dev release` to detect whether a commit is closing a PR based on keywords found in the commit message) was only able to detect a subset of the keywords supported by GitHub. This is fine currently, because the merge script adds `PR Close #XYZ` when merging a PR, but it might break in the future. This commit makes the code more robust by ensuring the method can detect all keywords supported by GitHub for automatically closing a PR based on a commit message. Original discussion: https://github.com/angular/angular/pull/39135#discussion_r503440973 PR Close #39229
-
George Kalpakas authored
In #39135, the commit message string was accidentally changed from a template literal to a regular string literal. This prevented the `npmDistTag` variable from being correctly displayed in the error message. This commit fixes it by switching it back to a template literal. NOTE: This was pointed out in https://github.com/angular/angular/pull/39135#discussion_r503361412, but the PR was accidentally merged before the review feedback had been addressed. PR Close #39229
-
George Kalpakas authored
The `ng-dev release publish` command needs to check whether a commit closed a pull request. This is implemented via checking the commit message for specific closing keywords referencing the pull request number. The regex used previously failed to correctly ensure that the specified pull request was referenced. For example, it would allow `#12345` to also match for `#1234`. This commit fixes the regex. PR Close #39135
-
George Kalpakas authored
This commit addresses comments from [my review][1] on PR #38656 (which was merged without comments addressed). The changes are mostly related to code style and typos. [1]: https://github.com/angular/angular/pull/38656#pullrequestreview-482129333 PR Close #39135
-
Taymon A. Beal authored
This should not change behavior, but it prevents false-positive warnings in various static analysis tools, including tools used internally at Google. PR Close #37397
-
- Oct 12, 2020
-
-
George Kalpakas authored
When working on the docs, it is helpful to run a local instance of the angular.io app and run scripts that watch both the docs contents and the app build artifacts to automatically update the running instance on changes. Typically, this is achieved via the `start` and `docs-watch` npm scripts. As a convenience, one can run the `serve-and-sync` script, which runs both in one terminal. Previously, it was not possible to pass arguments to `ng nerve` (which is what the `start` script runs under the hood) when running it via `serve-and-sync`. This commit adds support for passing any arguments passed to `serve-and-sync` through to the `start` script. This can be useful for things like specifying a custom host or port. PR Close #39201
-
George Kalpakas authored
A common review request is updating the commit message of a commit. Since this is something that is not straight forward for inexperienced contributors, it is useful to be able to point a contributor to some docs outlining the process. This commit adds such a section in `CONTRIBUTING.md` (as discussed in https://github.com/angular/angular/pull/39110#discussion_r499935502). PR Close #39215
-
- Oct 10, 2020
-
-
Adam Plumer authored
Although in SSR we patch the global prototypes with DOM globals like Element and Node, this patch does not occur before the matches function is called in Angular Elements. This is similar to the behavior in @angular/upgrade. Fixes #24551 PR Close #37799
-
Andrew Scott authored
This commit adds links to the PR/Issue for queries in the caretaker check. PR Close #39185
-
- Oct 09, 2020
-
-
crisbeto authored
At a high level, the current shadow DOM shim logic works by escaping the content of a CSS rule (e.g. `div {color: red;}` becomes `div {%BLOCK%}`), using a regex to parse out things like the selector and the rule body, and then re-adding the content after the selector has been modified. The problem is that the regex has to be very broad in order capture all of the different use cases, which can cause it to match strings suffixed with a semi-colon in some places where it shouldn't, like this URL from Google Fonts `https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap`. Most of the time this is fine, because the logic that escapes the rule content to `%BLOCK%` will have converted it to something that won't be matched by the regex. However, it breaks down for rules like `@import` which don't have a body, but can still have quoted content with characters that can match the regex. These changes resolve the issue by making a second pass over the escaped string and replacing all of the remaining quoted content with `%QUOTED%` before parsing it with the regex. Once everything has been processed, we make a final pass where we restore the quoted content. In a previous iteration of this PR, I went with a shorter approach which narrowed down the regex so that it doesn't capture rules without a body. It fixed the issue, but it also ended up breaking some of the more contrived unit test cases. I decided not to pursue it further, because we would've ended up with a very long and brittle regex that likely would've broken in even weirder ways. Fixes #38587. PR Close #38716
-
Bjarki authored
Bump Chrome to the next stable release (84.0.4147) by following the instructions in dev-infra/browsers/README.md. With Chrome 86 about to be released as stable, the current local version (Chrome 83) is starting to lag behind. It also contains a bug that blocks Angular unit and integration tests from using Trusted Types. PR Close #39179
-
Greg Magolan authored
build: upgrade angular build, integration/bazel and @angular/bazel package to rule_nodejs 2.2.0 (#39182) Updates to rules_nodejs 2.2.0. This is the first major release in 7 months and includes a number of features as well as breaking changes. Release notes: https://github.com/bazelbuild/rules_nodejs/releases/tag/2.0.0 Features of note for angular/angular: * stdout/stderr/exit code capture; this could be potentially be useful * TypeScript (ts_project); a simpler tsc rule that ts_library that can be used in the repo where ts_library is too heavy weight Breaking changes of note for angular/angular: * loading custom rules from npm packages: `ts_library` is no longer loaded from `@npm_bazel_typescript//:index.bzl` (which no longer exists) but is now loaded from `@npm//@bazel/typescript:index.bzl` * with the loading changes above, `load("@npm//:install_bazel_dependencies.bzl", "install_bazel_dependencies")` is no longer needed in the WORKSPACE which also means that yarn_install does not need to run unless building/testing a target that depends on @npm. In angular/angular this is a minor improvement as almost everything depends on @npm. * @angular/bazel package is also updated in this PR to support the new load location; Angular + Bazel users that require it for ng_package (ng_module is no longer needed in OSS with Angular 10) will need to load from `@npm//@angular/bazel:index.bzl`. I investigated if it was possible to maintain backward compatability for the old load location `@npm_angular_bazel` but it is not since the package itself needs to be updated to load from `@npm//@bazel/typescript:index.bzl` instead of `@npm_bazel_typescript//:index.bzl` as it depends on ts_library internals for ng_module. * runfiles.resolve will now throw instead of returning undefined to match behavior of node require Other changes in angular/angular: * integration/bazel has been updated to use both ng_module and ts_libary with use_angular_plugin=true. The latter is the recommended way for rules_nodejs users to compile Angular 10 with Ivy. Bazel + Angular ViewEngine is supported with @angular/bazel <= 9.0.5 and Angular <= 8. There is still Angular ViewEngine example on rules_nodejs https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_view_engine on these older versions but users that want to update to Angular 10 and are on Bazel must switch to Ivy and at that point ts_library with use_angular_plugin=true is more performant that ng_module. Angular example in rules_nodejs is configured this way as well: https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular. As an aside, we also have an example of building Angular 10 with architect() rule directly instead of using ts_library with angular plugin: https://github.com/bazelbuild/rules_nodejs/tree/stable/examples/angular_bazel_architect. NB: ng_module is still required for angular/angular repository as it still builds ViewEngine & @angular/bazel also provides the ng_package rule. ng_module can be removed in the future if ViewEngine is no longer needed in angular repo. * JSModuleInfo provider added to ng_module. this is for forward compat for future rules_nodejs versions. PR Close #39182
-
Chellappan authored
Fixes #39156 PR Close #39166
-
- Oct 08, 2020
-
-
Alan Agius authored
With this change we add a short url to strict mode guide (angular.io/strict -> angular.io/guide/strict-mode). This is important because of two reasons. 1) Reduce the clutter in the terminal when we include the strict mode guide url in a prompt. 2) Easiler to share in conferences, slides etc.. PR Close #39129
-