Commit Graph

21577 Commits

Author SHA1 Message Date
Pete Bacon Darwin 3d3b69ff81 refactor(compiler): share `isQuote()` via `chars.ts` (#42062)
This function is general purpose and by moving it into the
`chars.ts` file along with similar helpers, it can be reused
in the lexer, for instance.

PR Close #42062
2021-08-02 09:53:13 -07:00
Pete Bacon Darwin c8a46bfdcd refactor(compiler): support interpolation tokens when lexing markup (#42062)
The lexer now splits interpolation tokens out from text tokens.

Previously the contents of `<div>Hello, {{ name}}<div>` would be a single
text token. Now it will be three tokens:

```
TEXT: "Hello, "
INTERPOLATION: "{{", " name", "}}"
TEXT: ""
```

- INTERPOLATION tokens have three parts, "start marker", "expression"
  and "end marker".
- INTERPOLATION tokens are always preceded and followed by TEXT tokens,
  even if they represent an empty string.

The HTML parser has been modified to recombine these tokens to allow this
refactoring to have limited effect in this commit. Further refactorings
to use these new tokens will follow in subsequent commits.

PR Close #42062
2021-08-02 09:53:13 -07:00
Pete Bacon Darwin 75855196e3 refactor(compiler): remove cyclic dependencies (#42062)
This commit removes 9 cycles in the dependency graph of the compiler code.

PR Close #42062
2021-08-02 09:53:12 -07:00
Pete Bacon Darwin 29f9888a98 test(compiler-cli): clarify source-map expectations in compliance tests (#42062)
The compliance tests can check source-map segments against expectations
encoded into the expectation files. Previously, the encoding of the expected
segment was only delimited by whitespace, but this made it difficult to identify
segments that started or ended with whitespace.

Now these segment expectations are wrapped in double-quotes which makes
it easier to read and understand the expectation files.

PR Close #42062
2021-08-02 09:53:12 -07:00
Pete Bacon Darwin 42265cca1c refactor(ngcc): remove unused import (#42062)
This import is not used in the file, so can be removed.

PR Close #42062
2021-08-02 09:53:12 -07:00
Alex Rickabaugh 0af354ce05 refactor(bazel): extract function to patch fileNameToModuleName on host (#42974)
This commit extracts the patching operation that adds `fileNameToModuleName`
to the Angular compiler's `ts.CompilerHost` into a separate function, so
that it can be invoked in other compilation flows besides the one outlined
in `ngc-wrapped`. This is primarily needed for the xi18n operation in g3.

PR Close #42974
2021-07-30 09:29:42 -07:00
Alex Rickabaugh d8183c94d4 refactor(compiler): remove unnecessary escapes (#42990)
This commit is part of a larger scale change to eliminate unnecessary
escapes in string literals, in advance of enabling stricter checks in
`ts_library` rules in g3.

PR Close #42990
2021-07-30 09:28:46 -07:00
Paul Gschwendtner bfd48391d7 fix(dev-infra): browser archive rule should handle `.dmg` files (#42992)
We recently reworked our browser archive extraction to happen
at analysis time for better caching. This resulted in us breaking
the extraction of macOS dmg files so that Firefox is currently
not usable for local testing on macOS. We implement a similar special
logic for `.dmg` files to what has been done within the Bazel
webtesting rules.

PR Close #42992
2021-07-30 09:28:06 -07:00
Renovate Bot f31436da3c build: lock file maintenance (#42890)
PR Close #42890
2021-07-30 09:27:01 -07:00
Nichola Alkhouri 9e30824ef8 docs: Fix wrongly provided/Injected AnimalService (#42988)
In the logical tree example which demonstrate the use of `@SkipSelf` and  `@Host`, the provided and injected `AnimalService` are reversed.
PR Close #42988
2021-07-29 15:05:52 -07:00
Joe Martin 8ce1ac603a docs: Add josmar-crwdstffng to contributors list. (#42972)
Add josmar-crwdstffng to list in contributors.json.  Add josephmmartin
image file.

PR Close #42972
2021-07-28 15:56:00 -07:00
Joey Perrott 2a0e28cf61 fix(dev-infra): ensure that building environment stamp fails silently (#42985)
Previously when a failure occurred in part of building the environment stamp, the entire
process errored.  This should instead fail silently providing no value for the stamp.

PR Close #42985
2021-07-28 13:00:07 -07:00
Joey Perrott 8116895ece docs: release notes for the v12.2.0-rc.0 release 2021-07-28 12:05:41 -07:00
Joey Perrott e8b3ed7ccc release: bump the next branch to v13.0.0-next.0 2021-07-28 12:03:49 -07:00
Joey Perrott b0739c21da docs: release notes for the v12.1.4 release 2021-07-28 11:45:37 -07:00
Renovate Bot a2c893309d build: update bazel to v4.0.0-beta.1 (#42967)
PR Close #42967
2021-07-28 10:54:05 -07:00
codebriefcase 63918d8642 docs: include interpolations in the "What is Angular" example (#42702)
Affected URL - https://angular.io/guide/what-is-angular#template

Fixes #42665

PR Close #42702
2021-07-28 10:53:32 -07:00
ivanwonder 7c35ca0e00 feat(language-service): support autocomplete string literal union types in templates (#42729)
The native TS language service has the ability to provide autocompletions for
string literal union types. This pr is for Angular to do the same in templates.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1096

PR Close #42729
2021-07-28 10:52:34 -07:00
Paul Gschwendtner 047994b048 feat(dev-infra): introduce release action for directly branching-off into RC (#42973)
Introduces a new release action for cutting a release-action by directly
moving the next release-train into the `release-candidate` phase.

This allows the Angular team to release minor versions without
needing to branch-off first into the feature-freeze phase. For
minors this phase can be skipped. Switching into the feature-freeze
phase beforehand as a workaround would have allowed for branching-off
but has the downside that `target: minor` would no longer point to the
branched-off release train (only `target: rc` would work then).

PR Close #42973
2021-07-28 10:50:22 -07:00
Steven Masala 0d81b007e4 fix(router): add missing outlet events to RouterOutletContract (#42431)
Exposes both activateEvents and deactivateEvents as the original outlet interface did.

PR Close #42431
2021-07-27 16:34:24 -07:00
George Kalpakas 85e93c3833 fix(docs-infra): notify `ErrorHandler` of `UnrecoverableState` errors (#42941)
With this commit, the `ErrorHandler` is notified of ServiceWorker
`UnrecoverableState` errors. The main purpose of this change is
gathering info about the occurrence (and frequency) of such errors in
Google analytics.

PR Close #42941
2021-07-27 09:23:14 -07:00
Andrew Scott b1082b7ad8 ci: add atscott to fw-compiler reviewers (#42963)
add atscott to fw-compiler reviewers

PR Close #42963
2021-07-27 09:22:49 -07:00
Vladyslav b93c42eff3 docs: updated input-output page documentation content (#42964)
PR Close #42964
2021-07-27 09:22:19 -07:00
Daniel Trevino 057e577403 refactor(compiler-cli): add makeTemplateDiagnostic wrapper (#42937)
Add a `makeTemplateDiagnostic` wrapper in the `TemplateTypeChecker`. This requiers less parameters to create template diagnostics, since the `TemplateTypeChecker` can get the templateId and mapping from it's scope with the `ts.ClassDeclartion`. The `TemplateTypeChecker` is often used to determine if a diagnostic should be produced, so it makes sense to have a function in it that helps create them.

Refs #42966

PR Close #42937
2021-07-26 18:00:44 -07:00
JoostK ed9cfb674f fix(compiler-cli): use correct module resolution context for absolute imports in .d.ts files (#42879)
The compiler keeps track of how a declaration has been referenced
using absolute module imports and from which path the absolute module
should be resolved from. There was a bug in how the .d.ts metadata
extraction would incorrectly use the .d.ts file itself as resolution
context for symbols that had been imported using a relative module
specifier. This could result in module resolution failures.

For example, when extracting NgModule metadata from
`/node_modules/lib/index.d.ts` that looks like

```
import {LibDirective} from './dir';

@NgModule({
  declarations: [LibDirective],
  exports: [LibDirective],
})
export class LibModule {}
```

and `/app.module.ts` that contains

```
import {LibModule} from 'lib';

@NgModule({
  imports: [LibModule],
})
export class AppModule {}
```

then `AppModule` would have recorded a reference to `LibModule` using
the `'lib'` module specifier. When extracting the NgModule metadata from
the `/node_modules/lib/index.d.ts` file the relative import into `./dir`
should also be assumed to be importable from `'lib'` (according to APF
where symbols need to be exported from a single entry-point)
so the reference to `LibDirective` should have `'lib'` as absolute
module specifier, but it would incorrectly have
`/node_modules/lib/index.d.ts` as resolution context path. The latter is
incorrect as `'lib'` needs to be resolved from `/app.module.ts` and not
from within the library itself.

Fixes #42810

PR Close #42879
2021-07-26 13:17:44 -07:00
Dmitrij Kuba dbae00195e feat(router): ability to provide custom route reuse strategy via DI for `RouterTestingModule` (#42434)
For now it's not possible to provide custom route reuse strategy via DI
for `RouterTestingModule`, only imperative instantiation. These changes
makes it possible to provide custom route reuse strategy via DI.

PR Close #42434
2021-07-26 12:02:42 -07:00
Paul Gschwendtner 72c03a0d4f build: remove ts-api-guardian from repository (#42735)
This commit removes `ts-api-guardian` from the repository. We introduced
a new tool for testing API signature that is part of the shared
dev-infra package. The TS API guardian package will be deprecated for
the public in favor of Microsoft's API extractor that has support for
more parts of the syntax, such as alias exports.

PR Close #42735
2021-07-26 12:02:14 -07:00
Yuvaraj 271700cbb6 docs: fix the selector in component interaction guide (#42891)
The selector for the `CountdownTimerComponent` is `app-countdown-timer`
not `countdown-timer`.

PR Close #42891
2021-07-26 11:47:55 -07:00
Renovate Bot 816ba07351 build: update dependency eslint-plugin-jsdoc to v36 (#42956)
PR Close #42956
2021-07-26 11:37:15 -07:00
Teri Glover 05d996d803 docs: Edits to remove jargon (#42861)
PR Close #42861
2021-07-23 17:12:50 -07:00
Andrew Scott 4b49824236 test(router): move computed state restoration tests to own file (#42933)
To reduce the enormouse size of the integration.spec.ts file, move tests related to the computed
state restoration to their own file.

PR Close #42933
2021-07-23 14:25:06 -07:00
Andrew Scott 9119e1f7bd refactor(router): Ensure computed state restoration works for thrown errors (#42933)
When `canceledNavigationResolution='computed'`, the `Router` needs to
handle the cases where errors are thrown. Previously, the logic was not
updated and would simply do a `replaceState` rather than determining
where in the history we should move to restore the page/url from before
the failed navigation.

PR Close #42933
2021-07-23 14:25:06 -07:00
Joey Perrott 8fc08c5ab1 ci: update pullapprove config to properly handle global approvals (#42929)
Update the config to properly identify a global approval as approved rather than
as no file matching based groups being matched.

PR Close #42929
2021-07-23 12:09:26 -07:00
Andrew Scott a6c256fcd6 docs: Add import line to router event example for clarification (#42935)
Without the `import {Event} from '@angular/router';`, the filter will
not work because the type is understood as the native `Event`.

Fixes #42920

PR Close #42935
2021-07-23 12:06:34 -07:00
George Kalpakas 1f6cc57812 build(docs-infra): upgrade cli command docs sources to a57976b98 (#42943)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](18bbd044d...a57976b98):

**Modified**
- help/generate.json

PR Close #42943
2021-07-23 12:05:56 -07:00
Renovate Bot 648da4f8b5 build: update dependency globby to v12 (#42921)
PR Close #42921
2021-07-23 10:37:35 -07:00
George Kalpakas 19da73741d build(docs-infra): switch the `example-e2e` script to ESM (#42921)
Switch the JS script used for running the docs examples tests from
CommonJS to ESM format. This is necessary for upgrading the `globby`
dependency to [version 12.0.0][1] in a subsequent commit.

[1]: https://github.com/sindresorhus/globby/releases/v12.0.0

PR Close #42921
2021-07-23 10:37:35 -07:00
George Kalpakas 662addb355 build(docs-infra): switch the `generate-stackblitz/zips` scripts to ESM (#42921)
Switch the JS scripts used for generating StackBlitz projects and zips
from CommonJS to ESM format. This is necessary for upgrading the
`globby` dependency to [version 12.0.0][1] in a subsequent commit.

[1]: https://github.com/sindresorhus/globby/releases/v12.0.0

PR Close #42921
2021-07-23 10:37:35 -07:00
Joey Perrott 99f833869d feat(dev-infra): include experimental version stamp in env stamps (#42934)
Include the determined experimental version for stamping in the env stamps
created for release and snapshot builds.

PR Close #42934
2021-07-23 10:37:08 -07:00
Joey Perrott e462743969 refactor(dev-infra): move semver utils into the utils directory (#42917)
Move semver into the utils directory rather than as a set of utils specifically
for release tooling.  While the utils are only currently used in the release
tooling, they are not providing a release specific utility and can be used by
any subtool of ng-dev.

PR Close #42917
2021-07-22 18:01:17 +00:00
Joey Perrott d2b1c3ec15 fix(dev-infra): fix creating experimental semver versions to include prerelease chunk (#42917)
SemVers created for experimental versions should also include the prerelease chunk (i.e. -next.3).

PR Close #42917
2021-07-22 18:01:17 +00:00
Joey Perrott 69d4ebffa9 Revert "fix(dev-infra): perform actual npm login verification for wombot proxy (#42871)" (#42917)
This reverts commit fd92a3e87f.

It turns out that wombot proxy will return who is logged in, but does so regardless of
if the users token is currently active.  Since we cannot rely on `npm whoami` to
determine the login state, we revert to our previous state of assuming new login is
needed.

PR Close #42917
2021-07-22 18:01:17 +00:00
Dylan Hunn 1d9d02696e feat(forms): add hasValidators, addValidators, and removeValidators methods (for both sync and async) (#42838)
Several new functionalities are possible with this change: the most requested is that callers can now check whether a control has a required validator. Other uses include incrementally changing the validators set without doing an expensive operation to reset all validators.

Closes #13461.

PR Close #42838
2021-07-22 16:31:00 +00:00
Pete Bacon Darwin 7e9673d14a ci: fix typo in docs-bug issue template (#42908)
"browser specific" should be replaced with "browser-specific" because it's a compound modifier (cf. https://en.wikipedia.org/wiki/Compound_modifier).

See #42906

PR Close #42908
2021-07-22 16:25:39 +00:00
Pete Bacon Darwin 5d222f39d3 docs: fix spacing in code style guide (#42908)
Fixes #42906

PR Close #42908
2021-07-22 16:25:39 +00:00
Teri Glover b5f177939f docs: Edits to remove jargon (#42907)
PR Close #42907
2021-07-22 16:24:15 +00:00
JoostK 5fb23eccea perf(compiler-cli): skip analysis in incremental builds for files without Angular behavior (#42562)
In an incremental rebuild, the compiler attempts to reuse as much
analysis data from a prior compilation as possible to avoid doing the
analysis work again. For source files without Angular behavior however,
no analysis data would be recorded such that the source file had to be
reanalyzed each rebuild, even if it has not changed.

This commit avoids the analysis of such source files by registering
these files as not containing any Angular behavior; allowing subsequent
rebuilds to avoid the analysis work.

PR Close #42562
2021-07-21 22:40:38 +00:00
iRealNirmal a502279592 feat(forms): allow minLength/maxLength validator to be bound to `null` (#42565)
If the validator is bound to be `null` then no validation occurs and
attribute is not added to DOM.

For every validator type different PR will be raised as discussed in
https://github.com/angular/angular/pull/42378.

Closes #42267.

PR Close #42565
2021-07-21 22:35:59 +00:00
George Kalpakas eefe1682e8 fix(core): correctly handle `null` or `undefined` in `ErrorHandler#handleError()` (#42881)
Since `ErrorHandler#handleError()` expects an argument of type `any` it
should be able to handle values such as `null` and `undefined`.
Previously, it failed to handle these values, because it was trying to
access properties on them.

This commit fixes it by ensuring no properties are accessed on `null` or
`undefined` values.

NOTE: This is part of fully addressing #28106.

Fixes #21252

PR Close #42881
2021-07-21 22:35:34 +00:00
Paul Gschwendtner 4d86ea6471 ci: no longer use deprecated `pullapprove_conditions` option (#42895)
PullApprove deprecated the `pullapprove_conditions` config
option and introduced the `overrides` option. This commit
migrates to the new option, while also eliminating the
`fallback` group with a simple override (as per recommendation
from the pull approve docs).

PR Close #42895
2021-07-21 22:34:24 +00:00