Commit Graph

21128 Commits

Author SHA1 Message Date
Alex Rickabaugh e039075a28 fix(compiler-cli): better detect classes that are indirectly exported (#42207)
The compiler flag `compileNonExportedClasses` allows the Angular compiler to
process classes which are not exported at the top level of a source file.
This is often used to allow for AOT compilation of test classes inside
`it()` test blocks, for example.

Previously, the compiler would identify exported classes by looking for an
`export` modifier on the class declaration itself. This works for the
trivial case, but fails for indirectly exported classes:

```typescript
// Component is declared unexported.
@Component({...})
class FooCmp {...}

// Indirect export of FooCmp
export {FooCmp};
```

This is not an immediate problem for most application builds, since the
default value for `compileNonExportedClasses` is `true` and therefore such
classes get compiled regardless.

However, in the Angular Language Service now, `compileNonExportedClasses` is
forcibly overridden to `false`. That's because the tsconfig used by the IDE
and Language Service is often far broader than the application build's
configuration, and pulls in test files that can contain unexported classes
not designed with AOT compilation in mind.

Therefore, the Language Service has trouble working with such structures.

In this commit, the `ReflectionHost` gains a new API for detecting whether a
class is exported. The implementation of this method now not only considers
the `export` modifier, but also scans the `ts.SourceFile` for indirect
exports like the example above. This ensures the above case will be
processed directly in the Language Service.

This new operation is cached using an expando symbol on the `ts.SourceFile`,
ensuring good performance even when scanning large source files with lots of
exports (e.g. a FESM file under `ngcc`).

Fixes #42184.

PR Close #42207
2021-06-01 12:16:46 -07:00
JoostK 44b737ecb4 docs: clarify how declaration files can be installed (#42417)
The documentation suggested that `@types/*` scoped packages would
automatically be recognized, however the CLI configures a project such
that the package has to be explicitly added to the TypeScript
configuration files.

Closes #37572

PR Close #42417
2021-06-01 10:17:32 -07:00
Kristiyan Kostadinov 3e192bfa4d build: fix linting against jasmine focus functions (#42415)
We were linting against usages of `fdescribe` and `fit` by referencing the `no-jasmine-focus` rule which isn't installed, causing tslint to log the following:

```
Could not find implementations for the following rules specified in the configuration:
    no-jasmine-focus
Try upgrading TSLint and/or ensuring that you have all necessary custom rules installed.
If TSLint was recently upgraded, you may have old rules configured which need to be cleaned
```

These changes switch to using the built-in `ban` rule.

PR Close #42415
2021-06-01 10:16:55 -07:00
George Kalpakas 1d9c6bb31d docs(docs-infra): document the implementation of styles (incl. theming) in angular.io (#42396)
PR Close #42396
2021-06-01 10:16:21 -07:00
George Kalpakas 4a5af60dc5 fix(docs-infra): improve homepage layout in print mode (#42396)
In #41129, the `.hero-logo` image was changed from an `<img>` element to
a `<div>` with an image background. As a result, in print mode (where
browsers often omit backgrounds to save ink) the logo was not present.

This commit fixes this by ensuring the word `Angular` is displayed as a
title instead of the logo in print mode. It also hides the `Get started`
button in print mode, since it doesn't add any value.

Before: ![homepage-print before][1]
After: ![homepage-print after][2]

[1]: https://user-images.githubusercontent.com/8604205/120068867-889e6080-c08b-11eb-9bd5-233d8592f7ec.png
[2]: https://user-images.githubusercontent.com/8604205/120068869-89cf8d80-c08b-11eb-8740-a68a5ef68c34.png

PR Close #42396
2021-06-01 10:16:20 -07:00
George Kalpakas 58160742b1 refactor(docs-infra): remove unused `_typography-theme.scss` file (#42396)
This commit removes the `_typography-theme.scss` file that is currently
not used. The file contains a single Sass mixin
(`docs-site-typography-theme()`), which is never called.

PR Close #42396
2021-06-01 10:16:20 -07:00
George Kalpakas 3b97287758 refactor(docs-infra): minor refactorings/style changes (#42396)
This commit includes some minor refactorings and style changes as a
follow-up to PR #41129. (The changes were minor enough that didn't
warrant blocking the PR.)

PR Close #42396
2021-06-01 10:16:20 -07:00
Joey Perrott aeb407296b refactor(dev-infra): update to later version of @octokit/rest and remove class extenstion of Octokit (#42395)
Update @octokit/rest and remove the usage of a class extension of Octokit as the
class does not have a class define constructor.

PR Close #42395
2021-06-01 10:14:48 -07:00
George Kalpakas af762fa917 build: allow Node.js v15 and above for local development (#42387)
This commit changes the `engines` rules in the root `package.json` as
well as the `package.json` used when working on docs example to also
accept Node.js versions greater than v14. This aligns them with
`aio/package.json` and allows using Node.js v15 and v16 (current) for
local development in the `angular/angular` repo.

Related to #42367.

PR Close #42387
2021-06-01 10:14:08 -07:00
Dylan Hunn c54643f00e docs(forms): make the forms validation guide specify more clearly what happens when mixing HTML5 native validators with Angular forms. (#42377)
Previously, the docs didn't say anything about the fact that the `novalidate` attribute is added to the enclosing form, or how to override that behavior. I have added a couple lines in the appropriate spot clarifying this issue.

PR Close #42377
2021-06-01 10:13:36 -07:00
Doug Parker e0381a87c9 docs: update CLI builder to be platform agnostic (#42371)
Fixes #35373.

This changes the example from "run an arbitrary process" to "copy a file". This should make it a bit easier to follow, require less background knowledge to understand, and not use any platform-specific commands that won't work for Windows users.

The most glaring issue with this change is that this doc does not explictly specify how to build and run a builder. I've updated some of the files to hint at this a bit more (such as the `"implementation": "./dist/my-builder.js"`), but another pass is required to figure out the best way to compile a builder and how we want to structure this example to best communicate that.

PR Close #42371
2021-06-01 10:13:02 -07:00
Doug Parker 2a311c51e6 docs: minor cleanup (#42371)
Mainly just fixing some spacing and adding `.prototype` for non-static properties.

PR Close #42371
2021-06-01 10:13:02 -07:00
Andrew Scott 1b8bbddff5 docs: list supported values for `read` in decorator metadata (#42370)
fixes #20927

PR Close #42370
2021-06-01 10:12:23 -07:00
George Kalpakas e798bfabb0 build(docs-infra): fix linting warnings (#42359)
This commit fixes some linting warning that were printed when running
`ng lint`. The warnings can be seen in the `lint` step of
[this CI job][1].

Most of the warnings were related to the deprecation of passing context
to Jasmine matchers in favor of using the [withContext()][2] matcher
(introduced in Jasmine v3.3.0).

[1]: https://circleci.com/gh/angular/angular/995543
[2]: https://jasmine.github.io/api/3.3/matchers.html#withContext

PR Close #42359
2021-06-01 10:11:47 -07:00
Andrew Scott 62b5a6cb07 docs: add docs for DebugElement (#42352)
fixes #36048

PR Close #42352
2021-05-27 17:02:24 -07:00
Igor Minar 184de5048a docs: expand documentation for ROUTES (#42398)
Previously the docs were very minimalistic. The most important thing missing from the docs
was that people should primarily use higher level APIs instead of using ROUTES directly.

It would be nice to holistically overhaul more of the router API docs, but that's out of
scope of this change.

Fixes #39350

PR Close #42398
2021-05-27 16:47:39 -07:00
Teri Glover 4cd2cc439d docs: Edits to remove jargon in Reference section (#42033)
PR Close #42033
2021-05-27 16:47:05 -07:00
Teri Glover ee0e3fbf89 docs: edits to remove jargon (#42025)
PR Close #42025
2021-05-27 16:46:11 -07:00
Teri Glover 3a959152f9 docs: Edited to remove jargon, fixed issue (#42026)
PR Close #42026
2021-05-27 15:37:14 -07:00
Teri Glover 1710fa861c docs: Edits to remove jargon (#42026)
PR Close #42026
2021-05-27 15:37:13 -07:00
Teri Glover 635aaaa27d docs: Edited to remove jargon. (#41978)
PR Close #41978
2021-05-27 15:36:38 -07:00
Andrew Scott d33fdea1e3 docs: clarify behavior of strict templates flags (#42392)
fixes #39355

PR Close #42392
2021-05-27 14:08:50 -07:00
Andrew Scott 8572fef491 docs: change markdown table to HTML table in template typecheck doc (#42392)
PR Close #42392
2021-05-27 14:08:49 -07:00
Joey Perrott fa0144fde6 docs: clarify the shortcomings of local variable technique for parent-child component interactions (#42331)
Closes #38302

PR Close #42331
2021-05-27 14:04:43 -07:00
AleksanderBodurri cdb8f556fb feat(docs-infra): implement dark mode (#41129)
defines styles for a first iteration of an aio darkmode

PR Close #41129
2021-05-27 11:24:53 -07:00
AleksanderBodurri 8d9d1c293d feat(docs-infra): create module theme files (#41129)
creates theming files for the module styles in aio; done as part of the effor to make aio themeable

PR Close #41129
2021-05-27 11:24:53 -07:00
AleksanderBodurri ab7e8dc99d feat(docs-infra): create typography and layout theme files (#41129)
creates theming files for the aio typography styles; done as part of the effort to make aio themeable

PR Close #41129
2021-05-27 11:24:53 -07:00
AleksanderBodurri d429029074 refactor(docs-infra): grab scss mixins with scss use syntax instead of global imports (#41129)
move away from global mixins because @import is going to be deprecated

PR Close #41129
2021-05-27 11:24:53 -07:00
AleksanderBodurri 21e35ece79 refactor(docs-infra): grab scss constants using scss use syntax instead of the global imports (#41129)
move away from using global constants in scss files because @import will be deprecated soon

PR Close #41129
2021-05-27 11:24:53 -07:00
AleksanderBodurri eff26e1be8 refactor(docs-infra): rename namespaced scss to index files (#41129)
scss files were forwarded from files that were named without convention, changes these file names to follow conventions

PR Close #41129
2021-05-27 11:24:52 -07:00
AleksanderBodurri 85a627f741 feat(docs-infra): port over material io theming logic to angular io (#41129)
brings in theming tools from material io into angular io in preparation of implementing darkmode

PR Close #41129
2021-05-27 11:24:52 -07:00
Igor Minar e73fef4d0b docs: add a note about <select> and nested <option>s in Ivy compat guide (#42338)
An internal change in Ivy has surfaced issues in previosly broken code. This change adds a note to the
Ivy compatibility guide as well as the TrackByFunction api docs.

Fixes #35896

PR Close #42338
2021-05-27 11:12:25 -07:00
Andrew Scott 306f7ac543 docs: cherry pick release notes for 12.0.2 to main (#42390)
PR Close #42390
2021-05-27 09:31:53 -07:00
George Kalpakas deb893095f build(docs-infra): remove unused `spy-directive.gif` image (#42388)
The only reference to the `spy-directive.gif` image was removed
in #42369, so the image is no longer used. This commit removes the file
from the repository.

PR Close #42388
2021-05-27 08:57:59 -07:00
George Kalpakas b57a1275b2 docs: fix typos in the `cli-builder` guide (#42386)
PR Close #42386
2021-05-27 08:57:20 -07:00
Sam Severance 17d0dd3593 docs: update links to Testing Component Scenarios page (#42385)
PR Close #42385
2021-05-27 08:56:05 -07:00
不肖・高橋 e87dbafba1 docs: fix a typo (#42384)
The 'B' in 'StackBlitz' is lowercased.
PR Close #42384
2021-05-27 08:55:28 -07:00
Wagner Maciel 38378ce50a docs: explain what a deploy url is and how it differs from a base href (#42363)
fixes #34931

PR Close #42363
2021-05-27 08:54:48 -07:00
Andrew Kushnir d74d1306e2 docs: improve preloading component data chapter (#42340)
This commit updates the `Lazy-loading feature modules` guide (guide/lazy-loading-ngmodules) to fix example code that illustrates the process of preloading component data.

Closes #37113.

PR Close #42340
2021-05-27 08:54:03 -07:00
Andrew Scott 7a6358b4a8 docs: add note to clarify that ngOnChanges is only called if inputs are bound (#42374)
fixes #23017

PR Close #42374
2021-05-26 17:17:25 -07:00
Igor Minar 141791e070 docs: add a note about the ngc command and command line options (#42373)
It turns out that we don't document anywhere how ngc works and what options we support.
I added a brief section, without going too much into details because most users should not need to use ngc directly.

I also came across some bug in `ngc` and filed #42372.

Fixes #29623

PR Close #42373
2021-05-26 17:16:39 -07:00
David Shevitz 74186c36de docs: remove lightbox gif from Use Directives to Watch the DOM section. (#42369)
This gif is out of date and causing reader confusion.

Fixes #40193

PR Close #42369
2021-05-26 15:49:05 -07:00
Andrew Kushnir e917d57dbb docs: use `json` pipe in Forms guide instead of a temporary diagnostic field (#42364)
Closes #37283.

PR Close #42364
2021-05-26 15:47:05 -07:00
Zach Arend 44027c4e0e build: allow node v15 and above for aio (#42367)
Changes the engines rule in aio to accept any node version greater than
or equal to v14. This allows node v15 to work with aio.

addresses #42076

PR Close #42367
2021-05-26 14:24:17 -07:00
Andrew Kushnir 516923e3dc docs: clarify when the `ngDoBootstrap` hook is invoked (#42362)
Closes #35242.

PR Close #42362
2021-05-26 14:23:45 -07:00
Andrew Scott bcfe4afda9 docs: clarify that `forRoot` can be called in other modules (#42361)
The faq on `forRoot` implies that you cannot and should not call `forRoot` for an import
outside the AppModule. This is technically incorrect. This commit clarifies
the statement and refers the reader to the hierarchical injectors guide.

fixes #29002

PR Close #42361
2021-05-26 14:23:08 -07:00
mgechev 15726594a9 ci: update the github feature request process action and run on cron (#42337)
- Update to the latest hash
- Set the limit to 100 feature requests
- Run daily at 2pm

PR Close #42337
2021-05-26 14:22:36 -07:00
Andrew Scott 4cb11cc4e7 docs: add note about why module import order is important (#42323)
Fixes #30223

PR Close #42323
2021-05-26 14:21:53 -07:00
Joey Perrott 4e9b61aaf9 docs: remove/update broken links in resources appearing on aio (#42232)
Remove or update broken links to resources from the resources and
contributors pages on aio.

Closes #39719

PR Close #42232
2021-05-26 14:21:12 -07:00
Andrew Scott 9193ea20e4 docs: clarify providedIn options (#42355)
The list for the possible options of providedIn was not totally clear. This commit ensures each possible value is included explicitly in the docs.

fixes #29330

PR Close #42355
2021-05-26 20:10:31 +00:00