Commit graph

29561 commits

Author SHA1 Message Date
Payam Valadkhan
3d06a8133c refactor(core): flatten and resolve ng-module bootstrap info in local compilation mode (#51767)
This change contains runtime logic needed to flatten the NgModule bootstrap field in local compilation mode. While it is quite odd to pass a "nested" array as NgModule bootstrap, it is still required to support this case in local compilation mode since it is supported in full compilation mode.

PR Close #51767
2023-09-18 16:59:55 +02:00
Payam Valadkhan
fbf3ac247b refactor(compiler-cli): move NgModule bootstrap definition to runtime in local compilation mode (#51767)
Today in local compilation mode the NgModule bootstrap definition is moved as it is into the runtime `ɵɵdefineNgModule`. This runtime was initially made for AoT full compilation mode and assumes that the bootstrap info is already flattened and resolved. This is not the case in local compilation where the bootstrap is the raw expression coming from the NgModule decorator and can be a nested array. To get around this problem we move the bootstrap along with other scope info (e.g., declarations, imports, exports) to the runtime`ɵɵsetNgModuleScope` to be further analyzed and flattened in runtime.

PR Close #51767
2023-09-18 16:59:55 +02:00
Payam Valadkhan
1d0fc42fc7 refactor(core): allow nested array for standalone component imports in local compilation mode (#51767)
This change flattens the imports info on standalone component decorators in runtime dev mode by adding flattening logic to the deps tracker. Such flattening has no effect in AoT full compilation mode since these arrays are already resolved  and flattened by AoT static analysis, but in local compilation mode it is needed since the raw array as appears on the component decorator will be passed to the deps tracker, and so it needs to be flattened.

This change does not affect prod runtime since deps tracker is only used in dev mode.

PR Close #51767
2023-09-18 16:59:55 +02:00
Payam Valadkhan
3d2f9451c0 refactor(core): allow nested array for ng-module scope info in local compilation mode (#51767)
This change flattens the imports/exports/declarations info on ngModule decorators in runtime dev mode by adding flattening logic to the runtime `ɵɵsetNgModuleScope`. Such flattening has no effect in AoT full compilation mode since these arrays are already resolved  and flattened by AoT static analysis, but in local compilation mode it is needed since the raw array as appears on the NgModule decorator will be passed to the runtime `ɵɵsetNgModuleScope`, and so it needs to be flattened.

This change has to effect on prod runtime as `ɵɵsetNgModuleScope` is not used in prod.

PR Close #51767
2023-09-18 16:59:55 +02:00
Paul Gschwendtner
fb3e6d6015 refactor(core): ensure reactive node constants are considered pure (#51809)
Currently when ESBuild bundles an application importing from
`@angular/core`, the signals library will be discovered during
export analysis. ESBuild will come across the constants for the reactive
signal graph- and end up considering some of these as side-effects given
the pattern of using a spread assignment for extending from e.g.
`REACTIVE_NODE` (a similar issue may occur if we e.g. extend from the
computed reactive node).

See more details on the issue: https://github.com/evanw/esbuild/issues/3392

Even though, ESBuild preserves these constants now, and all of its
dependencies— Terser will consider these as side-effect free and
eliminate these constants. This may require multiple passes though, and
might not be sufficient, depending on the chain of reactive node
extensions. E.g. in the signals branch we noticed some constants
unnecessarily being preserved.

PR Close #51809
2023-09-18 14:42:15 +02:00
Pawel Kozlowski
8486fa1594 Revert "feat(common): make the warning for lazy-loaded lcp image an error (#51748)" (#51810)
This reverts commit fe2fd7e1a8.

PR Close #51810
2023-09-18 13:35:55 +02:00
Jeremy Elbourn
2e41488296 feat(compiler): extract docs info for enums, pipes, and NgModules (#51733)
Based on top of #51717

This commit adds extraction for enums, pipes, and NgModules. It also adds a couple of tests for JsDoc extraction that weren't covered in the previous commit.

PR Close #51733
2023-09-18 12:29:30 +02:00
Jeremy Elbourn
e0b1bb33d7 feat(compiler): extract doc info for JsDoc (#51733)
Based on top of #51713

This commit adds docs extraction for information provided in JsDoc comments, including descriptions and Jsdoc tags.

PR Close #51733
2023-09-18 12:29:28 +02:00
Jeremy Elbourn
a24ae994a0 feat(compiler): extract docs for top level functions and consts (#51733)
Based on top of ##51700

Also updates extraction to ignore un-exported statements.

PR Close #51733
2023-09-18 12:29:26 +02:00
Jeremy Elbourn
b9c70158ab feat(compiler): extract docs for accessors, rest params, and types (#51733)
Based on top of #51697

Adds extraction for accessors (getters/setters), rest params, and resolved type info for everything so far. This also refactors function extraction into a new class and splits tests for common class info and directive info into separate files.

PR Close #51733
2023-09-18 12:29:24 +02:00
Jeremy Elbourn
c7daf7ea16 feat(compiler): extract directive docs info (#51733)
Based on top of #51685

This expands on the extraction with information for directives, including inputs and outputs. As part of this change, I've refactored the extraction code related to class and to directives into their own extractor classes to more cleanly separate extraction logic based on type of statement.

PR Close #51733
2023-09-18 12:29:22 +02:00
Jeremy Elbourn
7f6d9a73ab feat(compiler): expand class api doc extraction (#51733)
Based on top of #51682

This expands on the skeleton previously added to extract docs info for classes, including properties, methods, and method parameters. Type information and Angular-specific info (e.g. inputs) will come in future PRs.

PR Close #51733
2023-09-18 12:29:20 +02:00
Jeremy Elbourn
7e82df45c5 feat(compiler): initial skeleton for API doc extraction (#51733)
This commit adds a barebones skeleton for extracting information to be used for extracting info that can be used for API reference generation. Subsequent PRs will expand on this with increasingly real extraction. I started with @alxhub's #51615 and very slightly polished to get to this minimal commit.

PR Close #51733
2023-09-18 12:29:19 +02:00
Alan Agius
9bd1551c3f release: cut the zone.js-0.14.0 release (#51774)
PR Close #51774
2023-09-18 11:56:17 +02:00
Alan Agius
81b67aa987 feat(core): add support for zone.js 0.14.0 (#51774)
This commit adds support for zone.js 0.14.0 and drops support for older versions

BREAKING CHANGE: Angular now required `zone.js` version `~0.14.0`

PR Close #51774
2023-09-18 11:56:17 +02:00
Kristiyan Kostadinov
75380bf220 test(compiler): attempt to deflake windows tests (#51804)
Another try at deflaking the tests on Windows. I'm trying a couple of fixes here:
1. I noticed that it's usually the indexer tests that fail during flaky runs. These tests also happen to be the only ones that don't pass in the `files` argument of `NgtscTestEnvironment.setup`. When `files` isn't passed in, we don't hit the file path that sets up the `MockFileSystem`. With these changes I make it so that we always initialize the mock file system.
2. The missing file system error usually comes from the `absoluteFrom` call that initializes the optional `workingDir` argument. My theory is that because it's a default value for an argument, it gets called too early before everything is initialized. These changes move the `absoluteFrom` call further down until it's needed.

PR Close #51804
2023-09-18 10:46:37 +02:00
Alex Castle
fe2fd7e1a8 feat(common): make the warning for lazy-loaded lcp image an error (#51748)
upgrade the warning for lazy-loaded lcp images when using NgOptimizedImage to an error

BREAKING CHANGE:

Previously when NgOptimizedImage directive detected that an LCP image is lazy-loaded, a console warning was produced. Now the directive throws an error to make it more discoverable in a console. If you receive this error, refer to this guide for additional information: https://angular.io/guide/image-directive#step-4-mark-images-as-priority

PR Close #51748
2023-09-18 10:42:15 +02:00
Gerald Monaco
545db6d22d refactor(core): support phases in afterRender and afterNextRender (#51559)
Support for scheduling after*Render callbacks into various phases to minimize reflows

PR Close #51559
2023-09-18 10:40:18 +02:00
Andrew Scott
e2416a284f feat(language-service): Enable go to definition of styleUrl (#51746)
This commit enables 'go to definition' action for the new 'styleUrl' property

PR Close #51746
2023-09-18 10:37:19 +02:00
Paul Gschwendtner
0c5b34b446 refactor: ensure top-level symbols are marked as side-effect free (#51776)
Terser does not treat `Symbol` as side-effect free- so if we end up with
a symbol export being loaded, it will result in the symbol being
retained.

We noticed this in the signals prototyping where symbols exported
from `computed` ended up appearing in symbol bundling tests.

PR Close #51776
2023-09-15 15:53:50 +02:00
Pawel Kozlowski
a62e62c1c2 refactor(core): make sure that destroyed watch nodes dont run again (#51757)
This commit moves the destroy logic from 'effect' in the lower-level
'watch' so this implementation is shared among varius watch implementations.

PR Close #51757
2023-09-15 14:00:32 +02:00
Angular Robot
cb7acdf84d build: update actions/cache digest to 704facf (#51787)
See associated pull request for more information.

PR Close #51787
2023-09-15 11:42:49 +02:00
Payam Valadkhan
c6b9a3ea6c refactor(core): forbid rendering orphan components in local compilation mode (#51726)
Certain code patterns and tools in Google (and possibly 3P world) lead to the situation that a component is bootstrapped/rendered without its ng-module being loaded in the browser. Technically speaking this should be an anti-pattern since the ng-module could contain some runtime logic (e.g., providing something, calling some services, etc) and its not being loaded leads to unexpected behaviour. However, in many cases ng-module is an empty class and its only usage is for providing scope, and since in AoT full compilation mode we already hard-code dependencies into components so we can get away with not loading the ng-module. But in AoT local compilation mode it is not possible to get away since the component's dependencies are computed in runtime and the presence of the corresponding ng-module in the browser is needed. For this reason in this change it is forbidden to attempt to render a component without first loading its ng-module in local compilation mode and an explicit error message is created to make this situation clear. This error message can help with catching such cases when running TGP in Google.

It would be an interesting question as to whether to ban this situation in full compilation mode as well, as it is error prone and these errors are sometimes very hard to debug.

PR Close #51726
2023-09-15 10:45:38 +02:00
cexbrayat
5a20a44c64 fix(localize): ng-add schematics for application builder (#51777)
The schematics now supports the `application` builder, which is the new default builder in an application built with the CLI v17

PR Close #51777
2023-09-15 09:07:51 +02:00
Angular Robot
88ac76fb34 build: update dependency conventional-changelog to v5 (#51606)
See associated pull request for more information.

PR Close #51606
2023-09-15 09:07:04 +02:00
Angular Robot
d79db4a9e1 build: update io_bazel_rules_sass digest to 63d77ff (#51243)
See associated pull request for more information.

PR Close #51243
2023-09-15 09:04:09 +02:00
Angular Robot
25b9b86373 build: update babel dependencies (#50932)
See associated pull request for more information.

PR Close #50932
2023-09-15 09:03:24 +02:00
Joey Perrott
06bf80dd04 ci: use head_ref for concurrency group (#51784)
Use the head_ref value for the conncurency group on ci-priviledged rather than the ref, so that the
main ref is not used and cancelling across pull requests and the main branch

PR Close #51784
2023-09-15 09:02:02 +02:00
Angular Robot
a2681c7c9d build: update cross-repo angular dependencies (#51780)
See associated pull request for more information.

PR Close #51780
2023-09-14 19:35:45 +02:00
Rafael Leal
4b3d1c82e3 docs: fix broken image links in tutorial (#51744)
This is to fix broken image links in the first-app tutorial documentation with functional links that match the working examples.

PR Close #51744
2023-09-14 16:02:41 +02:00
Alan Agius
70e88f8a13 refactor(compiler): address missing override modifier tslint failure (#51752)
This commits add missing `override` modifier to `HostBindingCompilationJob` class members.

PR Close #51752
2023-09-14 12:11:05 +02:00
Alan Agius
aa74ea3b86 build: update @angular/build-tooling to 17a3a88dc637f365a0bc3168de839c18c7f6db81 (#51752)
This is needed to consume a zone.js related import fix. https://github.com/angular/dev-infra/pull/1383

PR Close #51752
2023-09-14 12:11:05 +02:00
Alan Agius
a8efc605ea feat(zone.js): remove legacy files and access to deep imports (#51752)
This commit removes access to deep imports and `zone-testing-bundle` and `zone-testing-node-bundle`

This commit removed access to deep and legacy `dist` imports. `zone-testing-bundle` and `zone-testing-node-bundle` are also no longer generated.

BREAKING CHANGE:
Deep and legacy `dist/` imports like `zone.js/bundles/zone-testing.js` and `zone.js/dist/zone` are no longer allowed. `zone-testing-bundle` and `zone-testing-node-bundle` are also no longer part of the package.

The proper way to import `zone.js` and `zone.js/testing` is:
```js
import 'zone.js';
import 'zone.js/testing';
```

PR Close #51752
2023-09-14 12:11:05 +02:00
JoostK
3a1c57dfb5 refactor(core): let reactive node prototypes conform to their type (#51722)
This commit adds explicit type annotations to the reactive node prototype objects,
such that the prototypes are type-checked against the interface they are supposed
to (partially) implement. This also allows IDEs to better track usages of reactive
node properties, improving code navigation.

PR Close #51722
2023-09-14 11:51:38 +02:00
JoostK
5ead7d412d fix(core): ensure a consumer drops all its stale producers (#51722)
When a producer is no longer used, the consumer has to update its internal data structure
that keeps track of all producers. There used to be an issue where only half of the stale
producers would actually be removed from this data structure, as the intended upper bound
of the number of producers to remove would decrease with each removed producer, therefore
not reaching all producers that should be removed from the data structure.

This commit fixes the issue by truncating the arrays directly, without going through
individual `pop` operations. An assertion that would catch the inconsistent state in
the internal data structures of the signal graph has been introduced.

PR Close #51722
2023-09-14 11:51:38 +02:00
Mark Thompson
63b8108f66 docs: add revamped guide for dependency injection focused on standalone (#51572)
* Updates two of the md files to prioritize standalone components/architecture
* Updates three examples referenced in the guides
* Updates the svg diagram to reference the EnvironmentInjector instead of the ModuleInjector

PR Close #51572
2023-09-14 11:23:48 +02:00
Angular Robot
c09015af08 docs: update Angular CLI help [main] (#51761)
Updated Angular CLI help contents.

PR Close #51761
2023-09-14 11:19:03 +02:00
Joey Perrott
d91618f2d8 ci: migrate legacy saucelabs job to Github Actions (#51695)
Migrate the legacy saucelabs job

PR Close #51695
2023-09-13 10:49:47 -07:00
Alan Agius
59aa0634f4 build: remove support for Node.js v16 (#51755)
BREAKING CHANGE: Node.js v16 support has been removed and the minimum support version has been bumped to 18.13.0.

Node.js v16 is planned to be End-of-Life on 2023-09-11. Angular will stop supporting Node.js v16 in Angular v17. For Node.js release schedule details, please see: https://github.com/nodejs/release#release-schedule

PR Close #51755
2023-09-13 10:49:06 -07:00
Kristiyan Kostadinov
2a1723c945 test(compiler): fix broken integrity check (#51751)
The `verifyPlaceholdersIntegrity` check in the compliance tests was basically a noop, because it was returning false inside a `forEach` callback. Fixing it revealed that it had fallen out of date, because one of the regexes it uses was incorrect. The problem is that it assumed the placeholder keys would always be string literals, however it's possible that they're identifiers. These changes resolve the issue by not looking at the keys at all since we don't do anything with them.

PR Close #51751
2023-09-13 10:48:32 -07:00
Andrew Kushnir
aedfc75e05 refactor(docs-infra): increase timeout for flaky tests (#51747)
This commit updates the `jasmine.DEFAULT_TIMEOUT_INTERVAL` value for some AIO tests from 10 -> 20 seconds to give more time to complete processing. This commit also refactors tests to use async/await pattern.

PR Close #51747
2023-09-13 10:47:53 -07:00
Jessica Janiuk
06bbc2fc4e refactor(core): Add defer block testing fixture (#51698)
This adds a fixture for being able to access and test defer blocks.

PR Close #51698
2023-09-13 10:47:04 -07:00
Andrew Kushnir
5a0d6aac74 release: cut the v17.0.0-next.4 release 2023-09-13 10:44:14 -07:00
Andrew Kushnir
a8ccc6f3b4 docs: release notes for the v16.2.5 release 2023-09-13 10:35:57 -07:00
Kristiyan Kostadinov
59387ee476 feat(core): support styles and styleUrl as strings (#51715)
Adds support for passing in `@Component.styles` as a string. Also introduces a new `styleUrl` property on `@Component` for providing a single stylesheet. This is more convenient for the most common case where a component only has one stylesheet associated with it.

PR Close #51715
2023-09-12 13:57:07 -07:00
Kristiyan Kostadinov
f9939757d3 build: skip simulated file system tests on Windows (#51738)
The code for detecting a Windows CI run from #51701 didn't work, because Bazel isolates the environment variables. These changes work around the issue by passing in a custom variable with the `--test_env` flag.

PR Close #51738
2023-09-12 12:56:27 -07:00
Jeremy Mowery
635318fd61 refactor: add readonly to public InjectionToken types (#51407)
This fixes warnings caused by an internal lint rule

refactor: add readonly to public InjectionToken types

PR Close #51407
2023-09-12 12:55:14 -07:00
Chinmay Chandak
92113d73dd docs: Fix misspelling in note of git commit --all (#51735)
In note of `git commit --all` command optional `-a` changed to `--all`
PR Close #51735
2023-09-12 12:25:42 -07:00
Shuaib hasan akib
3a09ee79b5 docs(docs-infra): replace twitter logo by new one (#51716)
PR Close #51716
2023-09-12 12:24:44 -07:00
Ben Hong
cbeef95c29 docs: migrate form-validation to standalone (#51709)
PR Close #51709
2023-09-12 12:24:03 -07:00