Commit graph

29561 commits

Author SHA1 Message Date
George Kalpakas
cd0096df2c docs: fix inline JSDoc tags (@see --> @link) (#46040)
In some places, the [@see][1] JSDoc tag was incorrectly used instead of
the [@link][2] inline tag, leading to warnings during doc generation and
the `@see` tags being ignored (and thus shown in the docs as is).
Replace the `@see` tags with the intended `@link` tags.

[1]: https://jsdoc.app/tags-see.html
[2]: https://jsdoc.app/tags-inline-link.html

PR Close #46040
2022-05-19 13:32:20 -07:00
Jessica Janiuk
0ff4eda3d4
docs: release notes for the v14.0.0-rc.1 release (#46045) 2022-05-18 12:11:42 -07:00
Jessica Janiuk
711ca0c714
docs: release notes for the v13.3.9 release (#46043) 2022-05-18 12:00:07 -07:00
Andrew Scott
e92799c97e test(router): Add tests for initialNavigation: enabledBlocking (#45733)
Adds additional tests to verify `enabledBlocking` functionality. The
initial attempt to fix #44355 would have broken the scenario where a new
navigation cancels the initial navigation. We also cannot rely on
`NavigationError` like the example workaround in that issue report is
doing because there won't be one if a guard simply rejects
the initial nav (#16211).

PR Close #45733
2022-05-18 08:57:30 -07:00
Alex Rickabaugh
1e07a112b0 fix(compiler-cli): use existing imports for standalone dependencies (#46029)
This commit fixes a small issue in the logic around the calculation of
template scopes for standalone components. These scopes include a
`Reference` for each dependency of a standalone component, which is used to
generate references to that dependency in various contexts.

Previously, the `Reference` used for a dependency was the one generated from
its own metadata. For example, a referenced directive used the `Reference`
that was created when analyzing the directive declaration itself. This still
works, as the compiler is always able to emit a reference to any valid
`Reference`. However, it's not optimal.

The `Reference` which should be used instead is the one generated from
analyzing the standalone component's `imports` array, which has knowledge of
how the dependency is referenced from within the standalone component's file
itself. This allows the compiler to skip creating a new import for the
dependency when emitting the standalone component, and use the existing,
user-authored import instead. This saves on code size and avoids taxing the
bundler with unnecessary imports.

PR Close #46029
2022-05-18 08:55:31 -07:00
Alex Rickabaugh
91ce543ef4 fix(compiler-cli): handle standalone components with cycles (#46029)
The Angular compiler performs cycle detection when generating imports within
component files. This was previously necessary as reifying dependencies
discovered via NgModules into the component output could add imports that
weren't present in the original component and potentially create cycles.
Doing this could cause order-of-execution issues with existing user imports,
so the compiler detects this case and falls back to an alternative way of
specifying component dependencies that doesn't risk creating cycles.

For standalone components, Angular does not need to add new imports to the
component file as the user has already explicitly referenced dependencies
in the `@Component.imports`. As a result, the cycle detection can be
skipped.

Correctly authoring a program with import cycles is always challenging. One
side of a cyclic import will always initially evaluate to `undefined`, and
this can result in errors in the component definition when this happens
within component `imports`.

Our compiler _could_ detect the cycle and choose to wrap the component
dependencies in an automatic closure instead, avoiding any issues with
`undefined` during an eager evaluation. However, this commit makes an active
choice not to do that as it only serves to mask the problems with cyclic
imports. Future refactorings may cause the "other half" of the cycle to
break. Users should instead be aware of the potential problems with cycles
and explicitly defer evaluations with `forwardRef` where needed. This
ensures that future implementations of Angular compilation which may not be
able to automatically detect import cycles and correct accordingly can still
compile such components.

PR Close #46029
2022-05-18 08:55:31 -07:00
Dylan Hunn
038ba8adea revert "fix(forms): Value and RawValue should be part of the public API." (#46023)
As per discussion on #fw-forms, this reverts #45978 (although the more in-depth comments were kept).

PR Close #46023
2022-05-17 22:48:03 +00:00
Dylan Hunn
a4b7a3cf4a docs(forms): Make some fixes to typed forms docs: (#46023)
* `FormRecord` jsdocs should now appear on a.io
* The `{@see foo#bar}` syntax previously did not work, and has been replace with backticks

PR Close #46023
2022-05-17 22:48:03 +00:00
George Kalpakas
5a94855e1a docs: explicitly specify a version in the CLI install command (#46020)
Update the CLI install command in the CLI overview page to explicitly
specify a version. This ensures that the version installed is
appropriate for the version of the docs (e.g. installing CLI v12.x when
following the v12 docs) and it consistent with the `setup-local` guide.

PR Close #46020
2022-05-17 18:28:30 +00:00
George Kalpakas
737e08094c fix(docs-infra): correctly style the CLI version in code snippet (#46020)
Some CLI versions (such as `@next`) are not parsed (and thus not
formatted) correctly in code snippets. Fix this by explicitly adding an
appropriate CSS class to the `<aio-angular-dist-tag>` elements to let
PrettyPrint know how to style this token.

PR Close #46020
2022-05-17 18:28:30 +00:00
Bob Watson
274c6fa643 docs: remove Narco from hero list in code, text, and images (#46008)
Fixes issue #45769

Removes the malevolent comic book character, "Narco," from the list of heroes. This change removes the reference from the code, text and screenshots used in the documentation and makes other minor edits as necessary.

PR Close #46008
2022-05-17 17:47:03 +00:00
Renovate Bot
35af7c133f build: update angular (#46016)
PR Close #46016
2022-05-17 08:58:58 -07:00
Virginia Dooley
6952a0a3e6 docs: add template overview doc (#45897)
Organize bottom list into cards.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
a9b537ca46 docs: update links and TOC (#45897)
Update links and TOC for updated content.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
6276bed4ab docs: updated Property binding doc (#45897)
Refined and edited as a task-based document with the assistance
of the SME
Add missing prerequisites and what's next sections

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
429ebd2558 docs: updated Event binding doc (#45897)
Document updated with the assistance of the SME.
Add missing prerequisites and what's next sections
Make suggested changes to Event binding doc.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
4eb529e601 docs: new binding overview doc (#45897)
New binding overview doc. Content derived from existing docs.
Make changes suggested in PR for binding overview doc.
Deleted bottom paragraph from Binding overview per comments made by
atscott and alxhub.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
571a01e099 docs: Text interpolation doc amended to be task-based (#45897)
Rewrite document as task-based
Add prerequisites and What's next sections.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
41715431fb docs: new Pipes in templates doc (#45897)
New using a Pipe in a template document.
Content taken from the original Pipes document.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:34 -07:00
Virginia Dooley
3cfc260282 docs: Pipes transform data new doc (#45897)
New Transforming data with pipes document.
Content taken from the original Pipes document.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:33 -07:00
Virginia Dooley
e0a9a41066 docs: Understanding pipes new doc (#45897)
New overview file using the Understanding… format.
The original Pipes document was considered too long and
was broken down into several separate topics.
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:33 -07:00
Virginia Dooley
96e23383ad docs: new Template expressions overview doc (#45897)
Create a new Template expressions overview doc in the Understanding...
format.

PR Close #45897
2022-05-16 16:07:33 -07:00
Virginia Dooley
c825560617 docs: class-binding created as a separate task-based doc (#45897)
Class and style binding was pulled out of Attribute, class, and style
binding doc and put in its own doc.
Content edited with the assistance of the SME.
Prerequisites and What's next sections were added.

PR Close #45897
2022-05-16 16:07:33 -07:00
Virginia Dooley
711b979be2 docs: Attribute binding changed to include attribute binding only (#45897)
Attribute document broken down into two separate documents:
1) Attribute binding
2) Class and style binding
Content edited with the assistance of the SME.

PR Close #45897
2022-05-16 16:07:33 -07:00
Virginia Dooley
446ca6b537 docs: Understanding template variables updated (#45897)
This converts the "Template variables" doc to the new "Understanding"
format and remove some irrelevant content.

PR Close #45897
2022-05-16 16:07:33 -07:00
Joey Perrott
a7897ee8a2 build: use updated commit sha for github actions (#46010)
Update the commit sha for the dev-infra github actions.

PR Close #46010
2022-05-16 14:12:21 -07:00
Dylan Hunn
dba6a60861 fix(forms): Value and RawValue should be part of the public API. (#45978)
Consider a typed group for storing contact information:

```
declare interface ContactControls {
	name: FormControl<string|null>;
}

contactForm: FormGroup<ContactControls> = ...;

saveForm(form: FormGroup<ContactControls>) {
	service.newContact(contactForm.value);
}
```

What should be the type of `newContact`? The answer, of course, is the value type:

```
declare interface Contact {
	name: string|null;
}

class ContactService {
	newContact(c: Contact) {}
}
```

This is quite redundant, and therefore, we should allow the value type to be generated automatically. We already have the helper types to do this -- we just need to document and export them. Then, this becomes possible:

```
class ContactService {
	newContact(c: RawValue<FormGroup<ContactControls>>) {}
}
```

PR Close #45978
2022-05-16 18:36:53 +00:00
4javier
4070049d8a docs(devtools): add firefox extension references (#45985)
add a link to recent deployed firefox extension and use less specific terminology
PR Close #45985
2022-05-16 18:04:51 +00:00
SyedAhm3r
db841d02c9 fix(devtools): Variables initialized to undefined appearing as [setter] in property inspector (#45921)
Fixed the condition and added a test case to catch the fix

PR Close #45921
2022-05-16 10:28:04 -07:00
Andrew Kushnir
ca04ecedec refactor(core): avoid code duplication in standalone-related logic (#45949)
This commit updates the standalone-related logic to address the feedback from previous code reviews (specifically: https://github.com/angular/angular/pull/45687#discussion_r854499586).

PR Close #45949
2022-05-16 10:05:23 -07:00
Andrew Kushnir
cd04588643 refactor(core): tree-shake away a DI error message string in prod bundles (#45994)
This commit adds the `ngDevMode` check to tree-shake away an error message string (which also retains a reference to an extra function).

PR Close #45994
2022-05-16 10:04:57 -07:00
ivanwonder
db1b6fe657 fix(language-service): Fix detection of Angular for v14+ projects (#45998)
In v14, the .d.ts file for angular core is now "index.d.ts" rather than "core.d.ts".

This change happened in c6f6e4d701

PR Close #45998
2022-05-16 10:03:53 -07:00
mariu
3242f75efe docs: add transparency to Ecosystem image (#45993)
PR Close #45993
2022-05-16 09:37:33 -07:00
George Kalpakas
89b5248e85 test(docs-infra): ensure examples are split correctly across shards (#46005)
Previously, the examples were split across shards based on the order in
which `globby()` returned them. This was based on the assumption that
`globby()`/the OS would list files in a deterministic order. However, it
turns out that examples can be listed in different orders between
executions, leading in them not being split correctly across shards on
CI (which further means that some examples may be tested multiple times
and others may not be tested at all).
You can see an example [here][1], where the `getting-started` example is
tested in both the 4th and 5th shards.

This commit fixes this by explicitly sorting the examples based on their
path.

[1]: https://circleci.com/gh/angular/angular/1165448

PR Close #46005
2022-05-16 09:35:42 -07:00
Joey Perrott
bb07582d76 build: set up post approval changes commit action (#46006)
This action will enforce that all pull requests receive an approval from
at least one googler on the final commit for the pull request. Historically,
we have allowed all post approval changes regardless of authorship. Moving
forward, with this change, we will only allow known googlers to perform
post approval changes.

When a post approval change occurs by a non-googler, the action will
automatically rerequest a review from the latest googler who provided
an approval on the change.

PR Close #46006
2022-05-16 09:33:35 -07:00
celinetunc
3e873b5516 docs: add selin tunc to contributors (#45989)
PR Close #45989
2022-05-13 15:04:58 -07:00
AleksanderBodurri
3a468813ca fix(devtools): stop relying on getAllAngularRootElements in Angular DevTools' backend code. (#45983)
With the introduction of standalone components, it is no longer guaranteed that getAllAngularRootElements will be available on the global object. This PR removes the dependency on this function so that DevTools can continue to work for Angular applications that use `bootstrapApplication`.

PR Close #45983
2022-05-13 20:08:49 +00:00
Pavan Kumar Jadda
a4deac3fda docs: adds ngx-cookie-service library to resources list (#45955)
PR Close #45955
2022-05-13 20:08:10 +00:00
Andrew Scott
4d2e006372 refactor(router): Only create the Route injector when the path matches (#45990)
Currently, the `Router` will create the `EnvironmentInjector` for a
`Route` with `providers` as soon as it _attempts_ to match segments to
the `Route`. Instead, this change updates the logic to only create the
injector once we have confirmed that the `Route` matches. Note that this
will include partial matches where the final navigation still fails with
a "cannot match any routes to segment" error. We need to maintain the
injector hierarchy so we still need to create parent injectors before
descending into the child routes and determining if there is a full
match or just a partial one.

resolves #45988

PR Close #45990
2022-05-13 12:19:16 -07:00
Alex Rickabaugh
9c1735bdde fix(core): set correct context for inject() for component ctors (#45991)
The `inject()` function was introduced with Ivy to support imperative
injection in factory/constructor contexts, such as directive or service
constructors as well as factory functions defined in `@Injectable` or
`InjectionToken`. However, `inject()` in a component/directive constructor
did not work due to a flaw in the logic for creating the internal factory
for components/directives.

The original intention of this logic was to keep `ɵɵdirectiveInject` tree-
shakable for applications which don't use any component-level DI. However,
this breaks the `inject()` functionality for component/directive
constructors.

This commit fixes that issue and adds tests for all the various cases in
which `inject()` should function. As a result `ɵɵdirectiveInject` is no
longer tree-shakable, but that's totally acceptable as any application that
uses `*ngIf` or `*ngFor` already contains this function. It's possible to
change how `inject()` works to restore this tree-shakability if needed.

PR Close #45991
2022-05-13 11:57:43 -07:00
Evan Lee
e6f435a934 docs: remove Angular 11 from support table (#45980)
PR Close #45980
2022-05-13 11:18:48 -07:00
Kristiyan Kostadinov
4f309fed02 build: update to TypeScript 4.7 RC (#45966)
Bumps up the repo to the RC version of TypeScript 4.7.

PR Close #45966
2022-05-13 09:36:46 -07:00
Joey Perrott
e1a93e4d7c build: manually unshallow the repo for builds publishing, use absolute paths (#45979)
Use the absolute path for the artifacts directory, as well as encapsulate the clone
vs init logic to prevent it from changing directories.

Manually remove the shallow marker so that git does not recognize this as a shallow repo.

PR Close #45979
2022-05-13 09:07:47 -07:00
Jessica Janiuk
ec4104ee28
docs: release notes for the v13.3.8 release (#45977) 2022-05-12 15:17:57 -07:00
Joey Perrott
0db2841ea2 build: use clone instead of init for creating the builds commit changes (#45975)
Rather than using git init to create an empty repo and then shallow fetch the
repo for a specific branch, we shallow clone the repository itself for the branch.
This prevents us from running into the issue of Github denying the push because it
comes from a shallow branch which does not map back to the repository.

PR Close #45975
2022-05-12 20:31:45 +00:00
Joey Perrott
3dcf25b83d build: set the default branch of the ephemeral repo for publishing build artifacts to main (#45974)
It looks like because the primary branch for our ephemeral repos doesn't match the build repos
we are pushing to it causes errors around shallow clones.  This attempts to prevent this.

PR Close #45974
2022-05-12 19:39:36 +00:00
Andrew Scott
fa754cd9db fix(language-service): Prevent TSServer from removing templates from project (#45965)
As part of the `updateProjectIfDirty` process and inside `updateNonInferredProjectFiles`
TS Server will remove the template files that we added as roots in
`readResource`.
https://sourcegraph.com/github.com/microsoft/TypeScript@c300fea3250abd7f75920d95a58d9e742ac730ee/-/blob/src/server/editorServices.ts?L2363

The external files are added to the list here so ensuring that the
templates are included in the `getExternalFiles` will prevent this from
happening
https://sourcegraph.com/github.com/microsoft/TypeScript@c300fea3250abd7f75920d95a58d9e742ac730ee/-/blob/src/server/editorServices.ts?L2395:18

PR Close #45965
2022-05-12 09:25:18 -07:00
Keith Li
5e404d3114 feat(devtools): support icons in offline mode (#45430) (#45743)
Add support to material design icons in offline mode for Angular Devtools. Self hosting the web font so icons are loaded regardless of network connection.

Bring the font file as well as its corresponding css file from third_party repo through bazel into shell-browser directory while building.

PR Close #45743
2022-05-12 09:17:05 -07:00
George Kalpakas
aea7b98a56 fix(docs-infra): do not detect a running job as failed (#45948)
Previously, the preview server would incorrectly identify a running
`aio_preview` CI job as failed and therefore skip creating a preview.
This happened because it only checked whether the job's status is
`success`, failing to account for the fact that the job would have a
`running` status.
(This bug was accidentally introduced in #45934.)

This commit avoids the problem by getting rid of the job status check
altogether. This check does not offer any benefit, since the CI job will
always be in a `running` state (i.e. neither successfully completed nor
failed).

PR Close #45948
2022-05-12 09:02:03 -07:00
Roy Dorombozi
6375fa7987 refactor(bazel): add support for starlark's unused_inputs_list (#45946)
This change adds the capability of ngc_wrapped to emit an
unused_inputs_list file that could be used by starlark.

We are making this change because in situations where angular modules
depend on angular modules, it becomes very easy for a single change to
trigger a long cascading set of angular builds since each angular rule
depends on the transitive closure of input files.

With this change in place, and once it is properly configured, bazel
will update the set of inputs to a build rule after it is built once
removing any of the inputs specified in this list, making incremental
builds quicker by skipping any rebuilds that only had changes to unused
inputs.

This logic should be, and is likely duplicated in tsc_wrapped to solve
the same problem in pure TypeScript situations, ideally we could use the
same implementation one day.

In addition, its possible that tree artifacts are not as supported as
we'd like, and where this change should mark entire directories as
unused, we may get better performance gains by enumerating the directory
and being more explicit about specific inputs which are unused.

PR Close #45946
2022-05-11 11:21:56 -07:00