19057 Commits

Author SHA1 Message Date
Paul Gschwendtner f2dbf8663e build: update bazel nodejs fetch urls to fix 404 error (#42646)
It seems that the Bazel mirror of NodeJS is no longer available.
We override the `node_urls` to omit the Bazel mirror, so that
the LTS branch does not have any failing CI jobs.

PR Close #42646
2021-06-24 08:38:37 -07:00
Paul Gschwendtner f7610d5a19 ci: replace RBE instance name for components-repo-unit-tests job (#42646)
Temporarily replaces the RBE instance name for the
`components-repo-unit-tests` job until
https://github.com/angular/components/pull/23056 is available.

PR Close #42646
2021-06-24 08:38:37 -07:00
Joey Perrott 472eec0243 build: update to new remote instance name for RBE (#42646)
Update to use remote instance name, primary_instance, for RBE

PR Close #42646
2021-06-24 08:38:36 -07:00
Pete Bacon Darwin a7ff02f014 build(docs-infra): show a dist-tag when installing the CLI on non-stable versions (#42040)
It is important to use the correct major version of the Angular CLI when
following the examples in the tutorials. This commit provides a custom
element that renders an appropriate dist-tag in the setup step of
the tutorial when the docs are not in "stable" mode.

Fixes #39821

PR Close #42040
2021-05-13 13:56:19 -04:00
Zach Arend 318e7b8ce4 build: add script to publish v10-lts releases (#41631)
Adds a `/scripts/release/publish` script for releasing 10.2.x. Also
removes scripts for publishing `latest` and `next`. We are no longer
releasing `latest` and `next` off of this branch. This branch is only
for `v10-lts` releases.

PR Close #41631
2021-04-15 11:35:14 -07:00
Zach Arend 74eed46477 release: cut the v10.2.5 release 10.2.5 2021-04-14 14:23:38 -07:00
Alex Rickabaugh f630f331de fix(compiler-cli): show a more specific error for Ivy NgModules (#41534) (#41598)
When an Ivy NgModule is imported into a View Engine build, it doesn't have
metadata.json files that describe it as an NgModule, so it appears to VE
builds as a plain, undecorated class. The error message shown in this
situation generic and confusing, since it recommends adding an @NgModule
annotation to a class from a library.

This commit adds special detection into the View Engine compiler to give a
more specific error message when an Ivy NgModule is imported.

PR Close #41534

PR Close #41598
2021-04-14 09:38:40 -07:00
Misko Hevery ba8da742e3 fix(core): fix possible XSS attack in development through SSR (#40525)
This is a follow up fix for
https://github.com/angular/angular/pull/40136/commits/894286dd0c92b5af223364237e63798e18b14f58.

It turns out that comments can be closed in several ways:
- `<!-->`
- `<!-- -->`
- `<!-- --!>`

All of the above are valid ways to close comment per:
https://html.spec.whatwg.org/multipage/syntax.html#comments

The new fix surrounds `<` and `>` with zero width space so that it
renders in the same way, but it prevents the comment to be closed eagerly.

PR Close #40525
2021-03-18 10:06:02 -07:00
Joey Perrott 4a11226be7 release: cut the v10.2.4 release 10.2.4 2020-12-16 16:08:57 -08:00
Alan Agius 90570c030c fix(core): set ngDevMode to false when calling enableProdMode() (#40160)
The `ngDevMode` description also mentions that calling `enableProdMode` will set this the value to `false`.
https://github.com/angular/angular/blob/4610093c87975b6355f31a9c849351129908783a/packages/core/src/util/ng_dev_mode.ts#L22 which is currently not the case.

PR Close #40160
2020-12-16 14:30:41 -08:00
Misko Hevery 0b8e3d53ab fix(core): fix possible XSS attack in development through SSR. (#40152)
Escape the content of the strings so that it can be safely inserted into a comment node.
The issue is that HTML does not specify any way to escape comment end text inside the comment.
`<!-- The way you close a comment is with "-->". -->`. Above the `"-->"` is meant to be text
not an end to the comment. This can be created programmatically through DOM APIs.

```
div.innerHTML = div.innerHTML
```
One would expect that the above code would be safe to do, but it turns out that because comment
text is not escaped, the comment may contain text which will prematurely close the comment
opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
may contain such text and expect them to be safe.)
This function escapes the comment text by looking for the closing char sequence `-->` and replace
it with `-_-_>` where the `_` is a zero width space `\u200B`. The result is that if a comment
contains `-->` text it will render normally but it will not cause the HTML parser to close the
comment.

PR Close #40152
2020-12-16 14:16:10 -08:00
Pete Bacon Darwin 1806d6e0c5 build: update to latest "yargs" package
The 15.x versions of `yargs` relied upon a version of `y18n` that
has a SNYK vulnerability.
This commit updates the overall project, and therefore also the
`localize` and `compiler-cli` packages to use the latest version
of `yargs` that does not depend upon the vulnerable `y18n`
version.
The AIO project was already on the latest `yargs` version and so
does not need upgrading.

Fixes #39743
2020-11-18 19:43:52 +00:00
Misko Hevery 0786c59835 release: cut the v10.2.3 release 10.2.3 2020-11-09 12:46:39 -08:00
George Kalpakas ae71b76089 ci: log commands output when deploying angular.io to Firebase (#39596)
In #39470, the `deploy-to-firebase.sh` script (used to deploy AIO to
Firebase when building an upstream branch), was replaced by an
equivalent JS script. In this new `deploy-to-firebase.js` script, we
were overly aggressive with suppressing command output, which made it
hard to investigate failures ([example failing CI job][1]).

This commit updates the `deploy-to-firebase.js` script to capture
command output as usual in the CI job logs. This makes the output
similar to the one generated by the old [deploy-to-firebase.sh][2]
script ([example CI logs][3]).

One concern with capturing command output is having the value of a
secret environment variables leaked in the logs. This is not the case
here, since:
1. The secret env vars are not printed from the commands that use them.
2. CircleCI will [mask the values of secret env vars][4] in the output.

As an extra precaution (although not strictly necessary), we run `yarn`
with the `--silent` option, which avoid echoing the executed yarn
commands.

[1]: https://circleci.com/gh/angular/angular/849310
[2]: https://github.com/angular/angular/blob/3b0b7d22109c79b4dceb/aio/scripts/deploy-to-firebase.sh
[3]: https://circleci.com/gh/angular/angular/848109
[4]: https://circleci.com/docs/2.0/env-vars/#secrets-masking

PR Close #39596
2020-11-09 07:41:00 -08:00
George Kalpakas 1357d84ca9 build(docs-infra): print the git commit when deploying to Firebase (#39596)
The commit updates the AIO deployment script to also print the commit
SHA. This makes it easier to check whether a version has been
successfully deployed, by comparing the commit SHA from the CI job with
the SHA in the version string in the footer of the AIO app.

PR Close #39596
2020-11-09 07:40:59 -08:00
Alex Rickabaugh 861e4fa627 fix(compiler-cli): avoid duplicate diagnostics about unknown pipes (#39517)
TCB generation occasionally transforms binding expressions twice, which can
result in a `BindingPipe` operation being `resolve()`'d multiple times. When
the pipe does not exist, this caused multiple OOB diagnostics to be recorded
about the missing pipe.

This commit fixes the problem by making the OOB recorder track which pipe
expressions have had diagnostics produced already, and only producing them
once per expression.

PR Close #39517
2020-11-06 15:27:39 -08:00
Pete Bacon Darwin 1c6cf8a8c2 fix(compiler-cli): do not drop non-Angular decorators when downleveling (#39577)
There is a compiler transform that downlevels Angular class decorators
to static properties so that metadata is available for JIT compilation.
The transform was supposed to ignore non-Angular decorators but it was
actually completely dropping decorators that did not conform to a very
specific syntactic shape (i.e. the decorator was a simple identifier, or
a namespaced identifier).

This commit ensures that all non-Angular decorators are kepts as-is
even if they are built using a syntax that the Angular compiler does not
understand.

Fixes #39574

PR Close #39577
2020-11-06 09:21:53 -08:00
Athur Ming 7bd0133422 docs: typo fix for 'Intall' (#39585)
'Intall' should be 'Install'
PR Close #39585
2020-11-06 09:16:05 -08:00
Pete Bacon Darwin 2b684b7e5b fix(compiler): skipping leading whitespace should not break placeholder source-spans (#39589)
Tokenized text node may have leading whitespace skipped from their
source-span. But the source-span is used to compute where there are
interpolated blocks, resulting in placeholder nodes whose source-spans
are offset by the amount of skipped characters.

This fix uses the `fullStart` location of text source-spans for computing
the source-span of placeholders, so that they are accurate.

Fixes #39195

PR Close #39589
2020-11-06 09:09:48 -08:00
Pete Bacon Darwin ff31b431b8 refactor(compiler): capture fullStart locations when tokenizing (#39589)
This commit ensures that when leading whitespace is skipped by
the tokenizer, the original start location (before skipping) is captured
in the `fullStart` property of the token's source-span.

PR Close #39589
2020-11-06 09:09:48 -08:00
Pete Bacon Darwin 1aee8b345a refactor(compiler): store the fullStart location on ParseSourceSpans (#39589)
The lexer is able to skip leading trivia in the `start` location of tokens.
This makes the source-span more friendly since things like elements
appear to begin at the start of the opening tag, rather than at the
start of any leading whitespace, which could include newlines.

But some tooling requires the full source-span to be available, such
as when tokenizing a text span into an Angular expression.

This commit simply adds the `fullStart` location to the `ParseSourceSpan`
class, and ensures that places where such spans are cloned, this
property flows through too.

PR Close #39589
2020-11-06 09:09:48 -08:00
Pete Bacon Darwin e67a331b12 fix(compiler): ensure that i18n message-parts have the correct source-span (#39589)
In an i18n message, two placeholders next to each other must have
an "empty" message-part to separate them. Previously, the source-span
for this message-part was pointing to the wrong original location.
This caused problems in the generated source-maps and lead to extracted
i18n messages from being rendered incorrectly.

PR Close #39589
2020-11-06 09:09:48 -08:00
George Vrettos 08e077c0e0 docs: fix typo in the "Property Binding" guide (#39569)
PR Close #39569
2020-11-04 12:51:35 -08:00
Joey Perrott 16bc0fc3ec release: cut the v10.2.2 release 10.2.2 2020-11-04 12:32:09 -08:00
Aristeidis Bampakos 8929355a9d docs: fix typos in the "Attribute Binding" guide (#39562)
PR Close #39562
2020-11-04 11:42:45 -08:00
Joey Perrott 7ed0f0f7d0 fix(dev-infra): run caretaker checks asyncronously (#39086)
Run each check in the caretaker check process asyncronously.

PR Close #39086
2020-11-03 16:33:00 -08:00
GeopJr a644aae23d docs: fix Android 10 codename (#39399)
Change Android 10's codename from "X" to "Q"
PR Close #39399
2020-11-03 16:10:57 -08:00
Joey Perrott 250858a48e feat(dev-infra): provide tooling to check what branches a pr targets (#39504)
Create a command in the `ng-dev` toolset that allows user's to check
what branches a PR will merge into based on its targeting.

PR Close #39504
2020-11-03 14:55:25 -08:00
Joey Perrott aa3bd27cbf build: update dev dependency on @angular/cli to 10.2.0 (#39553)
Updating the @angular/cli dependency to match the @angular-devkit/*
versions.

PR Close #39553
2020-11-03 13:45:03 -08:00
Joey Perrott 90b4be182d fix(dev-infra): run fetches in the git client in quiet mode (#39503)
When fetch is run in normal mode, the `git-fetch-pack` plumbing command
outputs progress to stderr.  Since this is unnecessary progress
information for ng-dev usages, it should be suppressed instead.

PR Close #39503
2020-11-02 16:41:47 -08:00
Joey Perrott 1ff68ab794 ci: only check testing directories within packages/ for fw-testing (#39536)
The fw-testing group should only match on testing directories within the
framework packages, previously it was also matching in other areas of
the codebase.

PR Close #39536
2020-11-02 16:39:45 -08:00
Pete Bacon Darwin 5a210211e4 build(docs-infra): ensure that deployment works on CI (#39535)
The actual "main" part of the script that is executed was using
an uninitialized variable. This is fixed and a test is added to
check.

PR Close #39535
2020-11-02 12:24:35 -08:00
Eduard Bondarenko f76385950e docs: update forwardRef example (#39519)
Replace the deprecated api ReflectiveInjector.resolveAndCreat with Injector.create

PR Close #39519
2020-11-02 11:40:17 -08:00
George Kalpakas 4ca9ac04a6 build(docs-infra): upgrade firebase-tools to v8.14.1 (#39470)
This commit upgrades `firebase-tools` (used to deploy angular.io to
Firebase hosting) to the latest version. This gives us access to the
latest fixes/improvements and also new features, such as
[version cloning][1].

[1]:
https://firebase.google.com/docs/hosting/manage-hosting-resources#cli-commands-cloning

PR Close #39470
2020-11-02 07:57:53 -08:00
George Kalpakas 4a2e1d60b3 build(docs-infra): deploy angular.io to new Firebase sites (#39470)
Previously, the documentation for each major Angular version was hosted
on each own Firebase project. This required creating a new project for
each major release and increased the administrative/maintenance cost.

Now that Firebase supports hosting [multiple websites][1] as part of the
same project, we are switching to deploying all major versions to sites
created on `angular-io` project.

This is part of the work needed to prepare angular.io for our
[new versioning/branching process][2] (also tracked in #39366).

[1]: https://firebase.google.com/docs/hosting/multisites
[2]: https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU

PR Close #39470
2020-11-02 07:57:53 -08:00
George Kalpakas 29ca517b91 refactor(docs-infra): break up deploy-to-firebase.js script into functions (#39470)
This commit breaks up the code in `deploy-to-firebase.js` script, that
we use for deploying angular.io to production, to smaller functions
(instead of a monolithic block). This makes the script easier to
maintain and also makes testing individual operations easier.

The commit also updates the `deploy-to-firebase.spec.js` spec file to
take advantage of the standalone functions to speed up testing by
calling the corresponding function instead of having to spawn a new
process and run the `deploy-to-firebase.js` script with the `--dry-run`
flag.

NOTE: Before updating the tests, I verified that the updated
      `deploy-to-firebase.js` script passed the old tests.

PR Close #39470
2020-11-02 07:57:53 -08:00
George Kalpakas c601a089f2 build(docs-infra): add support for RC deployments to deployment script (#39470)
This commit updates the angular.io deployment script
(`deploy-to-firebase.js`) to support deploying release-candidate
versions.

This is part of the work needed to prepare angular.io for our
[new versioning/branching process][1] (also tracked in #39366).

[1]: https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU

PR Close #39470
2020-11-02 07:57:53 -08:00
George Kalpakas 20dd343ff4 build(docs-infra): add new angular.io build configuration for release-candidates (#39470)
This commit adds a new build configuration/deployment mode (`rc`) for
deploying release-candidate versions to angular.io.

This is part of the work needed to prepare angular.io for our
[new versioning/branching process][1] (also tracked in #39366).

[1]: https://docs.google.com/document/d/197kVillDwx-RZtSVOBtPb4BBIAw0E9RT3q3v6DZkykU

PR Close #39470
2020-11-02 07:57:52 -08:00
George Kalpakas 019b631675 refactor(docs-infra): use Sass mixin to simplify the creation of deployment mode themes (#39470)
Different deployment modes (such as `archive` and `next`) are identified
by the different colors used in prominent elements of the page, such as
the topbar and the footer.

Previously, the necessary styles for creating such a deployment mode
"theme" were duplicated for each mode.

This commit simplifies the creation/modification of a deployment mode
theme by introducing a Sass mixin that generates the necessary styles
(when provided with necessary theme colors).

PR Close #39470
2020-11-02 07:57:52 -08:00
George Kalpakas e6deefd64e test(docs-infra): ensure deploy-to-firebase tests pass locally (#39470)
Previously, the `deploy-to-firebase.js` script and the accompanying
`deploy-to-firebase.spec.js` spec file were using the `origin` remote
alias in certain commands. This works fine on CI, where `origin` points
to the `angular/angular` GitHub repo, but might not work locally.

This commit ensures that the correct remote is used by explicitly
specifying it by the URL, thus ensuring that the tests will behave
identically on CI and locally.

PR Close #39470
2020-11-02 07:57:52 -08:00
George Kalpakas 2d9b404e7a build(docs-infra): switch deploy-to-firebase.sh script to JS (#39470)
This commit switches the `deploy-to-firebase.sh` script, that we use for
deploying angular.io to production, from Bash to JavaScript. This makes
the script easier to maintain.

For the same reasons, it also switches the `deploy-to-firebase.test.sh`
script, that we use for testing the `deploy-to-firebase` script, from
Bash to JavaScript (using jasmine as the test runner).

Finally, this commit also updates ShellJS to the latest version to get
better error messages (including the actual error) when `exec()` fails.

NOTE: Before switching the test script to JS, I verified that the new
      `deploy-to-firebase.js` script passed the tests with the old
      `deploy-to-firebase.test.sh` script.

PR Close #39470
2020-11-02 07:57:52 -08:00
JoostK 812355cc3f perf(core): do not recurse into modules that have already been registered (#39514)
When registering an NgModule based on its id, all transitively imported
NgModules are also registered. This commit introduces a visited set to
avoid traversing into NgModules that are reachable from multiple import
paths multiple times.

Fixes #39487

PR Close #39514
2020-11-02 07:51:19 -08:00
JoostK 71d0063285 fix(compiler-cli): report missing pipes when fullTemplateTypeCheck is disabled (#39320)
Even if `fullTemplateTypeCheck` is disabled should missing pipes still
be reported, as was the case in View Engine.

Fixes #38195

PR Close #39320
2020-10-30 18:01:51 -07:00
Andrew Scott 85d5242630 fix(router): Ensure all outlets are used when commands have a prefix (#39456)
When there is a primary outlet present in the outlets map and the object is also prefixed
with some other commands, the current logic only uses the primary outlet and ignores
the others. This change ensures that all outlets are respected at the
segment level when prefixed with other commands.

PR Close #39456
2020-10-30 16:23:04 -07:00
Andrew Scott 8f36c21bdc refactor(router): Small refactor of createUrlTree and extra tests (#39456)
This commit has a small refactor of some methods in create_url_tree.ts
and adds some test cases, including two that will fail at the moment but
should pass. A follow-up commit will make use of the refactorings to fix
the test with minimal changes.

PR Close #39456
2020-10-30 16:23:04 -07:00
Andrew Kushnir 90acb9171e docs: tView.preOrderHooks and tView.preOrderCheckHooks docs update (#39497)
This commit updates the docs for the `tView.preOrderHooks` and `tView.preOrderCheckHooks` TView
fields. Current docs are not up-to-date as it was pointed out in #39439.

Closes #39439.

PR Close #39497
2020-10-29 16:25:39 -07:00
JiaLiPassion 8c82106cae fix(core): markDirty() should only mark flags when really scheduling tick. (#39316)
Close #39296

Fix an issue that `markDirty()` will not trigger change detection.

The case is for example we have the following component.

```
export class AppComponent implements OnInit {
  constructor(private router: Router) {}

  ngOnInit() {
    this.router.events
      .pipe(filter((e) => e instanceof NavigationEnd))
      .subscribe(() => ɵmarkDirty(this));
  }
}

export class CounterComponent implements OnInit, OnDestroy {
  ngOnInit() {
    this.countSubject.pipe(takeUntil(this.destroy)).subscribe((count) => {
      this.count = count;
      ɵmarkDirty(this);
    });
  }
```

Then the app navigate from `AppComponent` to `CounterComponent`,
so there are 2 `markDirty()` call at in a row.

The `1st` call is from `AppComponent` when router changed, the
`2nd` call is from `CounterComponent.ngOnInit()`.

And the `markDirty()->scheduleTick()` code look like this

```
function scheduleTick(rootContext, flags) {
    const nothingScheduled = rootContext.flags === 0 /* Empty */;
    rootContext.flags |= flags;
    if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
      rootContext.schedule(() => {
	...
        if (rootContext.flags & RootContextFlags.DetectChanges)
          rootContext.flags &= ~RootContextFlags.DetectChanges;
          tickContext();

        rootContext.clean = _CLEAN_PROMISE;
        ...
      });
```

So in this case, the `1st` markDirty() will
1. set rootContext.flags = 1
2. before `tickContext()`, reset rootContext.flags = 0
3. inside `tickContext()`, it will call `CounterComponent.ngOnint()`,
   so the `2nd` markDirty() is called.
4. and the `2nd` scheduleTick is called, `nothingScheduled` is true,
   but rootContext.clean is not `_CLEAN_PROMISE` yet, since the `1st` markDirty tick
   is still running.
5. So nowhere will reset the `rootContext.flags`.
6. then in the future, any other `markDirty()` call will not trigger the tick, since
   `nothingScheduled` is always false.

So `nothingScheduled` means no tick is scheduled, `rootContext.clean === _CLEAN_PROMISE`
means no tick is running.
So we should set the flags to `rootContext` only when `no tick is scheudled or running`.

PR Close #39316
2020-10-29 16:07:10 -07:00
Andrew Kushnir fb96c3d624 ci: update NgBot config to include more labels that indicate that ticket is triaged (#39494)
This commit updates the config of NgBot to treat tickets that have "needs clarification" or
"needs reproduction" labels on them as triaged.

PR Close #39494
2020-10-29 12:25:47 -07:00
Michael Ziluck f9d35884a3 docs(forms): update ngModel documentation (#39481)
This commit improves the ngModel docs, specifically:
- clarifies purpose of the name attribute in ngModelOptions
- clarifies on the interaction with a parent form or lack thereof
- fix inconsistency with analogy for two-way binding
- cleans up some typos and extra wordiness
- clarifies language around common properties
- adds missing preposition to commit message format origins
PR Close #39481
2020-10-29 11:18:55 -07:00
Joey Perrott cff61b2abe fix(dev-infra): update generated ng-dev compiled output (#39474)
Update to the new ng-dev generated script.

PR Close #39474
2020-10-29 09:55:27 -07:00