Commit graph

436 commits

Author SHA1 Message Date
Marc Wrobel
eca3db5692 docs(docs-infra): fix minor typos in angular.io (#47295) (#47295)
PR Close #47295

PR Close #47295
2022-09-07 10:47:21 -07:00
Angular Robot
bea953a5cf build: update dependency typescript to ~4.8.0 (#47293)
See associated pull request for more information.

PR Close #47293
2022-09-06 13:10:36 -07:00
George Kalpakas
14f505abd4 fix(docs-infra): prevent unnecessary warning in mergeOverridenImplementation Dgeni processor (#47201)
The `mergeOverridenImplementation` processor tries to ensure that any
doc used with the `@overrideImplementation` annotation is not itself
public (and explicitly marks is as internal if it is).

Previously, it determined the public/private status of a doc by only
checking the value of the doc's `internal` property (which is mainly set
via the `@internal` annotation). This failed to account for docs marked
as "private exports" (such as those prefixed with `ɵ`), which are
essentially also treated as internal.

This would result in incorrect warnings. [Example warning][1]:

> Constructor doc forms/ɵFormControlCtor was not marked '@internal';
> adding this annotation.

This commit prevents the incorrect warning by also checking the value of
the doc's `privateExport` property to determine its public/private
status.

[1]: https://circleci.com/gh/angular/angular/1215057#step-104-164

PR Close #47201
2022-08-22 10:51:02 -07:00
George Kalpakas
35171a8681 build(docs-infra): improve error message in mergeOverridenImplementation Dgeni processor (#47201)
Previously, error messages related to an overriden constructor doc would
stringify the doc as `[object Object]`, which is not helpful for
debugging the issue. For example:

> Constructor doc [object Object] was not marked '@internal'

This commit improves the error message by including the doc's ID
instead. For example, the above error message would become:

> Constructor doc forms/ɵFormControlCtor was not marked '@internal'

PR Close #47201
2022-08-22 10:51:02 -07:00
Andrew Kushnir
7e491cfab3 fix(docs-infra): do not require @ngModule tag on standalone types (#47024)
This commit updates docs extraction logic to avoid requiring the `@ngModule` tag on standalone types, since they don't have to be present in any NgModule.

PR Close #47024
2022-08-03 11:04:55 -07:00
Alan Agius
fc66f56c12 fix(docs-infra): wrap enum values in CLI commands (#46658)
This commit changes the enum seperator in the CLI command overview pages so that wrapping is allowed.

PR Close #46658
2022-07-06 07:29:50 -07:00
George Kalpakas
09ceb4ea64 fix(docs-infra): correctly populate "Description" column in CLI command overview (#46502)
Previously, the "Description" column of the CLI command overview section
was populated based on the CLI command docs' `description` property.
Since #45225, the short description of CLI commands is stored in the
`shortDescription` property.

This commit restores the content of the "Description" column by using
the correct property to populate it.

Fixes #46489

PR Close #46502
2022-06-27 10:50:32 -07:00
dario-piotrowicz
ba4f3aabee docs: add standalone details to NG0302 (#46090)
improve the error information of NG0302 by including details about
standalone pipes (and components)

PR Close #46090
2022-06-15 14:04:14 -07:00
Alex Rickabaugh
2444f36cbf fix(docs-infra): correct developer preview link (#46225)
The developer preview link was previously prefixed with the Github URL for
Angular's repo. However, it's meant to go to a guide page on AIO itself.
This commit removes the link prefix.

PR Close #46225
2022-06-02 12:35:13 -07:00
Alex Rickabaugh
85f485f676 feat(docs-infra): add @developerPreview tag for APIs in developer preview (#46050)
This commit adds a tag processor for `@developerPreview`. Adding this tag to
an exported symbol or to a decorator parameter causes an API status tag to
be shown for the API which links to the Developer Preview documentation.

PR Close #46050
2022-06-01 16:01:59 -07:00
George Kalpakas
3fdcf991c7 build(docs-infra): be able to resolve root-relative image URLs in getImageDimensions() (#46138)
Previously, `getImageDimensions()` would try to resolve image URLs
relative to the base path using `path.resolve()`. This resulted in
root-relative URLs (i.e. URLs starting with `/`) being treated as
absolute filesystem paths and thus resolving incorrectly
([example failure][1]).

This commit fixes it by using `.join()` instead, which is more
appropriate in this case. (Originally discussed [here][2].)

[1]: https://circleci.com/gh/angular/angular/1173150
[2]: https://github.com/angular/angular/pull/46134#issuecomment-1137191996

PR Close #46138
2022-05-26 11:25:07 -07:00
Thomas Mair
863c32e8c9 fix(docs-infra): add member name to search index without ignore list (#46060)
Previously classs, interface and enum members where filtered with the default word ignore list. This lead to  poor search results if a search for a member on the ignore list was performed.

PR Close #46060
2022-05-23 09:56:08 -07:00
Paul Gschwendtner
68a6a075f4 build: clean up references to old master branch (#45856)
Cleans up all references to the `master` branch we renamed to
`main` across Angular.

PR Close #45856
2022-05-04 16:23:33 -07:00
Paul Gschwendtner
3a60063a54 build: updates to account for github primary branch rename
This is the commit accounting for the Github primary branch
rename when we actually perform the update.

We have three change phases: Prepare, Direct, Cleanup. This commit
is for the `direct` phase.
2022-04-28 11:17:01 -06:00
George Kalpakas
3dee3d107b fix(docs-infra): fix placement of "Edit source" button on errors and diagnostics pages (#45634)
This commit aligns the layout of errors and extended diagnostics pages
more closely with other docs pages to ensure that the "Edit source"
button is displayed correctly even when the heading is too long to fit
on a single line. For error pages, in particular, this ensures that the
button is not obscured by the error video.

**Before:**
![error-pages before][1]

**After:**
![error-pages after][2]

[1]: https://user-images.githubusercontent.com/8604205/163408291-7aebd029-891c-4045-8fa2-a8e2b2b06dab.png
[2]: https://user-images.githubusercontent.com/8604205/163408296-40e6df8e-aadc-4a82-978a-ab4d902b6f6e.png

PR Close #45634
2022-04-21 11:07:27 -07:00
Andrew Kushnir
788f587367 fix(docs-infra): avoid internal symbols from being referenced during auto-linking (#45689)
This commit adds extra logic to avoid internal and privately exported symbols from being referenced during auto-linking. Currently such symbols can be used for linking, thus resulting in a non-existing link and causing the linking process to fail.

PR Close #45689
2022-04-20 09:11:22 -07:00
Tobias Speicher
4ddcf81e61 refactor: replace deprecated String.prototype.substr() (#45397)
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

PR Close #45397
2022-03-24 11:48:09 -07:00
Alan Agius
aec9abd374 fix(docs-infra): don't wrap subcommands in code element (#45343)
With this change we no longer wrap subcommands titles and sub navigation items in code element for nicer UI

PR Close #45343
2022-03-21 14:49:27 -07:00
Alan Agius
34218ecdb4 feat(docs-infra): remove hidden commands processor (#45225)
Hidden commands are no longer included in help JSON output.

PR Close #45225
2022-03-10 15:51:18 -08:00
Alan Agius
8f06fa3b20 feat(docs-infra): update CLI templates to match changes with new parser and folder structure (#45225)
The underlying parser that the CLI uses changed which caused minor changes in the generated JSON helps especially for subcommands.

The folder structure of the Angular CLI repo also changed slightly.

More context: https://github.com/angular/angular-cli/pull/22778

PR Close #45225
2022-03-10 15:51:18 -08:00
Mladen Jakovljević
9e56e400c5 fix(docs-infra): remove anchor tags from heritage docs (#45287)
Remove anchor tags from heritage docs and let `autoLinkCode` insert them properly.

PR Close #45287
2022-03-08 10:26:49 -08:00
Dylan Hunn
f0cfa00a34 refactor(forms): Move FormControl to an overridden exported constructor. (#44316) (#44806)
This implementation change was originally proposed as part of Typed Forms, and will have major consequences for that project as described in the design doc. Submitting it separately will greatly simplify the risk of landing Typed Forms. This change should have no visible impact on normal users of FormControl.

See the Typed Forms design doc here: https://docs.google.com/document/d/1cWuBE-oo5WLtwkLFxbNTiaVQGNk8ipgbekZcKBeyxxo.

PR Close #44316

PR Close #44806
2022-01-31 22:48:23 +00:00
George Kalpakas
c577a1dc93 fix(docs-infra): fix links to CLI commands source code (#44835)
Recently, the [CLI repository][1] switched to not prefixing tag names
with a `v`. Update the `versionInfo` generated for CLI commands docs, so
that the links to the source code (which include the tag name) are
correct.

Fixes #44822

[1]: https://github.com/angular/angular-cli

PR Close #44835
2022-01-28 16:07:47 +00:00
George Kalpakas
7480660a95 fix(docs-infra): track error docs during serve-and-sync (#44704)
Refs #42966.

Look for changes in error docs (i.e. docs under `aio/content/error/`) in
`authors-package`, so that such docs are tracked when running the
`serve-and-sync` script.

PR Close #44704
2022-01-24 10:41:13 -08:00
George Kalpakas
b19c3f7e71 fix(docs-infra): track error docs during serve-and-sync (#44704)
Refs #42966.

Look for changes in error docs (i.e. docs under `aio/content/error/`) in
`authors-package`, so that such docs are tracked when running the
`serve-and-sync` script.

PR Close #44704
2022-01-24 10:41:13 -08:00
Dylan Hunn
c2da290659 feat(docs-infra): Add a new processor for @overriddenImplementation. (#44689)
This new processor, named `mergeOverriddenImplementation`, allows Dgeni to produce correct documentation for symbols with overridden exported constructors. For example, in the following example, the implementation documentation will be used, including the constructor signature:

```
export const Foo: FooCtor = FooImpl as FooCtor;
```

This is a major improvement over the current situation, in which no constructor signature is documented whatsoever.

PR Close #44689
2022-01-13 12:02:22 -08:00
Borja Paz Rodríguez
9d2401d99a docs: fix several typos (#44508)
PR Close #44508
2022-01-04 12:13:46 -08:00
dario-piotrowicz
f3898f8d84 fix(docs-infra): prevent automatic linking of 'json' (#44294)
add 'json' to the ignoreGenericWords set so that it doesn't get
wrongly linked to the jsonPipe during the aio docs generation
as it is a generic javarscript term

PR Close #44294
2021-12-01 15:22:00 -08:00
Pete Bacon Darwin
e0c736066c build(docs-infra): ensure overloaded functions render correctly (#44090)
If there were 1 or 2 additional overloads on a free-standing function in the API the overloads were not being shown.

Also the type of overload parameters were not being escaped correctly.

PR Close #44090
2021-11-17 10:33:10 -08:00
dario-piotrowicz
c3b583864e fix(docs-infra): prevent automatic linking of 'number' (#44000)
add 'number' to the ignoreGenericWords set so that it doesn't get
wrongly linked to the decimalPipe during the aio docs generation
as it is a generic typescript term

PR Close #44000
2021-11-09 18:03:39 +00:00
dario-piotrowicz
0ae4187566 refactor(docs-infra): remove eslint directive comments from examples (#43831)
Linting has recently been removed from the examples provided in angular.io
(see PRs #43592 and #43746) such removal effects the downloadable and
stackblitz examples but linting is still generally used in the examples
in the aio project itself (they are being migrated from tslint to eslint in
PR #43218) thus eslint directive comments are still necessary in the code itself.

So the comments need to be present but need not to be exposed to the users
(not in the zips, stackblitzes nor docs themselves), these changes are
removing such comments during the examples' parsing phase (effectively
removing them from all three sources mentioned above).

Original discussion: https://github.com/angular/angular/pull/43218#discussion_r697305494

resolves #43788

PR Close #43831
2021-11-09 18:02:33 +00:00
Alan Agius
36388b3ab2 build(docs-infra): configure region parser to allow .mjs (#44027)
This commit updates the necessary config settings to allow `.mjs` files to be able to be parsed by the region parser. We configure the parser to use `inline-c-only` so that comments are generated in like the below

```
// #docregion
```

rather than

```
/* #docregion */
```

PR Close #44027
2021-11-04 18:55:52 +00:00
Mladen Jakovljević
b393188899 fix(docs-infra): fix heritage links (#43956)
Fix incorrect escape of special characters when rendering member heritage docs. Example: DefaultIterableDiffer docs incorrectly renders what this class implements - it does not fully display generic types of implemented interfaces.

PR Close #43956
2021-10-27 16:13:34 +00:00
Pete Bacon Darwin
9a6bd264ab build(docs-infra): add a box around CLI command line reference syntax (#43850)
This commit helps to make the section that describes an overview of the syntax of a CLI command stand out from the surrounding text.

Closes #26574

PR Close #43850
2021-10-15 11:35:44 -07:00
Pete Bacon Darwin
fa6aa1be55 build(docs-infra): ensure all overloads are shown in interfaces (#43734)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.

We recently fixed the rendering of interfaces to display all the overloads, since there is no "implementation" overload.

This commit also fixes the rendering of "pseudo-classes", which are a combination of an interface
and a constant.

Fixes #43001

PR Close #43734
2021-10-06 09:21:08 -07:00
Pete Bacon Darwin
d1589604a8 build(docs-infra): ensure all overloads are shown in interfaces (#43614)
In the API docs, concrete classes do not list the "implementation" overload on a method, since this is not strictly part of its API.
There is already a special case for abstract methods that do not have such an implementation overload.

But we were missing the case where the method was part of an interface. In interfaces none of the methods have implementation overloads.

Fixes #43001

PR Close #43614
2021-09-29 09:58:48 -07:00
George Kalpakas
d02c8da7bd fix(docs-infra): display deprecation notes for properties (#43566)
Previously, deprecation notes for deprecated class/interface properties
were not shown in the API docs. This commit fixes it by ensuring that
deprecation notes are shown for properites (similar to how it works for
methods).

PR Close #43566
2021-09-24 10:56:05 -07:00
dario-piotrowicz
66c6dbdc79 refactor(docs-infra): introduce max-len 120 eslint rule (#43439)
add the max-len rule to the aio eslintrc and fix what code
breaks such rule

PR Close #43439
2021-09-15 10:47:35 -07:00
Pete Bacon Darwin
758ba0f0f9 build(docs-infra): indent docplaster markers to the level of the docregion (#43216)
This change makes docplaster markers fit better with the surrounding code
that is being rendered.  Instead of:

```
{
  "a": 100,
// ...
  "b": 200,
// ...
}
```

you can now get

```
{
  "a": 100,
  // ...
  "b": 200,
  // ...
}
```

PR Close #43216
2021-09-15 10:46:45 -07:00
Pete Bacon Darwin
a73aaa9396 build(docs-infra): switch JSON examples to use inline docregion comments (#43216)
Now JSON files should be commented using

```
// #docregion
```

rather than

```
/* #docregion */
```

There are currently no JSON files with either kind of comments so this change
has no impact yet.

But when we add some examples with such comments, they will also benefit
from `// ... ` style docplasters to join docregion fragments.

PR Close #43216
2021-09-15 10:46:45 -07:00
Pete Bacon Darwin
ad04c1bc62 build(docs-infra): support docregions in .conf files (#43216)
This commit tells the docregion parser how to process files that end in `.conf`.

PR Close #43216
2021-09-15 10:46:45 -07:00
Pete Bacon Darwin
c77c8b7913 build(docs-infra): support docregions in .sh example files (#43216)
This commit tells the docregion parser how to process `.sh` files.

PR Close #43216
2021-09-15 10:46:45 -07:00
George Kalpakas
bdefeb1f11 perf(docs-infra): reduce unnecessary whitespace in API docs (#43435)
The HTML for the docs pages is generated by Dgeni based on some
[Nunjucks][1] templates.

Previously, these templates were set up in a way that introduced a lot
excess whitespace in the generated HTML, unnecessarily bloating the
corresponding JSON files that need to be downloaded in order to view a
certain docs page. This has been discussed in #28105 and was again
observed while investigating #43285.

This commit refactors some of the templates related to API docs (which
seem to be the most affected ones) to drastically reduce the amount of
excess whitespace. More specifically, the total size of all files in
`generated/docs/api/` was reduced from ~13MB to ~7MB.

Besides the reduced payload size for each API page, this change will
also reduce the amount of memory needed by the ServiceWorker to cache
the API pages that have been visited by a user.

NOTE:
The affected files are not eagerly downloaded when navigating to
angular.io. Instead, each file is downloaded individually, as soon as a
user visits the corresponding API docs page. Therefore, the impact of
this change will be relatively small for most users.

[1]: https://mozilla.github.io/nunjucks/

PR Close #43435
2021-09-14 08:29:50 -07:00
George Kalpakas
39800c1768 build(docs-infra): update remark-html to 13.0.2 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit b0b1ba5c5][2]), which
turns sanitization on by default. Since, we don't need sanitization (the
HTML is authored by docs authors and tooling and should be safe), this
commit restores the old behavior by setting the [sanitize][3] option to
`false`.

[1]: https://github.com/remarkjs/remark-html/releases/tag/13.0.2
[2]: b0b1ba5c55
[3]: https://github.com/remarkjs/remark-html#optionssanitize

PR Close #43435
2021-09-14 08:29:50 -07:00
George Kalpakas
549b372458 build(docs-infra): update github-slugger to 1.4.0 (#43435)
NOTE:
This [version][1] includes a breaking fix ([commit af59f343d][2]). More
specifically `github-slugger` will no longer trim the text of a heading
before generating an ID and (with whitespace converted to `-`) this
results in different heading IDs:
**Before:** `<h3>  foo bar  </h3>` --> `<h3 id="foo-bar">...`
**After:** `<h3>  foo bar  </h3>` --> `<h3 id="--foo-bar--">...`

The different IDs now break some of our anchor-links, becuase
`github-slugger` is used by [rehype-slug][3], which is in turn used by
our [autolinkHeadings][4] dgeni post-processor.

To avoid the issue with broken anchor links, we update the
`renderMethodDetail()` nunjucks macro to omit excess whitespace in
headings.

[1]: https://github.com/Flet/github-slugger/releases/tag/v1.4.0
[2]: af59f343dc
[3]: https://github.com/rehypejs/rehype-slug
[4]: 75a3c778b1/aio/tools/transforms/angular-base-package/post-processors/autolink-headings.js (L3)

PR Close #43435
2021-09-14 08:29:49 -07:00
Pete Bacon Darwin
e4e98edf20 build(docs-infra): add sealed markers to classes in API pages (#42807)
This change will mark classes as `sealed` unless they have been annotated
with an `@extensible` jsdoc tag.

Fixes #42802

PR Close #42807
2021-08-17 09:23:09 -07:00
dario-piotrowicz
ca7d4c3403 refactor(docs-infra): migrate aio from tslint to eslint (#42820)
migrate aio to eslint as tslint has been deprecated, the migration is restricted to the aio app and
its e2e tests and does not include the other tools, for such reason both tslint and codelyzer have not
been removed (to be done in a next PR)

some minor tweaks needed to be applied to the code so that it would adhere to the new ESLinting behaviour

most TSLint rules have been substituted with their ESLint equivalent, with some exceptions:
  * [whitespace] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [import-spacing] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [ban] replaced with [no-restricted-syntax] as there is no (official/included) ESLint equivalent

some rules have minor different behaviours compared to their TSLint counterparts:
  * @typescript-eslint/naming-convention:
    - typescript-eslint does not enforce uppercase for const only.
  * @typescript-eslint/no-unused-expressions:
    - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored.
  * arrow-body-style:
    - ESLint will throw an error if the function body is multiline yet has a one-line return on it.
  * eqeqeq:
    - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.
  * no-console:
    - Custom console methods, if they exist, will no longer be allowed.
  * no-invalid-this:
    - Functions in methods will no longer be ignored.
  * no-underscore-dangle:
    - Leading and trailing underscores (_) on identifiers will now be ignored.
  * prefer-arrow/prefer-arrow-functions:
    - ESLint does not support allowing standalone function declarations.
    - ESLint does not support allowing named functions defined with the function keyword.
  * space-before-function-paren:
    - Option "constructor" is not supported by ESLint.
    - Option "method" is not supported by ESLint.

additional notes:
  * the current typescript version used by the aio app is 4.3.5, which is not supported by typescript-eslint (the supported
    versions are >=3.3.1 and <4.3.0). this causes a warning message to appear during linting, this issue should
    likely/hopefully disappear in the future as typescript-eslint catches up
  * The new "no-console" rule is not completely equivalent to what we had prior the migration, this is because TSLint's "no-console"
    rule let you specify the methods you did not want to allow, whilst ESLint's "no-console" lets you specify the methods that you do
    want to allow, so and in order not to have a very long list of methods in the ESLint rule it's been decided for the time being
    to simply only allow the "log", "warn" and "error" methods
  * 4 dependencies have been added as they have been considered necessary (see: https://github.com/angular/angular/pull/42820#discussion_r669978232)

extra:
  * the migration has been performed by following: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslin
  * more on typescript-eslint at: https://github.com/typescript-eslint/typescript-eslint

PR Close #42820
2021-07-20 11:55:28 -07:00
dario-piotrowicz
52dc65dd1b build(docs-infra): improve @usageNotes message (#42888)
improve the @usageNotes message by adding the word "is"
(outcome: "Further information is available in...", compared to
"Further information available in...")

PR Close #42888
2021-07-19 17:37:56 -07:00
dario-piotrowicz
bfa1b5d9eb fix(docs-infra): move dots inside Usage Notes anchor tag (#42725)
in the html generated aio docs the dots of "Usage Notes..."
should be part of the anchor tag, same as it is for "See More..."

PR Close #42725
2021-07-01 09:34:04 -07:00
George Kalpakas
fd78678284 refactor(docs-infra): make <details> styles more re-usable (#42620)
This commit makes the styling for `<details>` elements (including
expand/collapse actions in their `<summary>`) more re-usable.

PR Close #42620
2021-06-28 09:33:17 -07:00