109 Commits

Author SHA1 Message Date
Pete Bacon Darwin
d59f2b0d0c refactor(core): remove unnecessary cast ()
The `as any` is no longer needed since `providedIn` can accept `'any'`.

PR Close 
2021-05-10 10:28:31 -04:00
Pete Bacon Darwin
71f37c9d9c build(docs-infra): add NgModules references to provided injectables ()
Parse the `providers` property of each NgModule doc and add this doc to
the `ngModules` property of each provided injectable.

PR Close 
2021-05-10 10:28:30 -04:00
Pete Bacon Darwin
85f5cb45d2 build(docs-infra): associate providedIn injectables with their NgModule ()
Such injectables were not appearing in the providers lists of their NgModule.
This commit updates the doc-gen to support associating these automatically.
Further, it also allows developers to mark other injectables that are provided
in an NgModule with a reference to the NgModule where they are provided.

The commit also does a refactoring of the `processNgModuleDocs` dgeni
processor code, to make it easier to maintain.

Fixes 

PR Close 
2021-05-10 10:28:30 -04:00
Pete Bacon Darwin
2ede980fea build(docs-infra): no duplicate docTypes in postProcessHtml processor ()
This processor was being initialized with the same docTypes twice.

PR Close 
2021-04-26 12:11:59 -07:00
Pete Bacon Darwin
fbdb19c263 docs(localize): expose documentation for the @angular/localize package ()
PR Close 
2021-03-19 12:36:10 -07:00
Pete Bacon Darwin
2893b925c3 build(docs-infra): capture all decorators in doc-gen ()
In 6cff877 we broke the decorator docs because the
doc-gen no longer knew how to identify them.

This commit updates the dgeni processor responsible
for identifying the decorators in the code and ensures
that the docs are now generated correctly.

Fixes 

PR Close 
2021-03-08 08:34:40 -08:00
George Kalpakas
43ecf8a77b feat(platform-server): allow shimming the global env sooner ()
`@angular/platform-server` provides the foundation for rendering an
Angular app on the server. In order to achieve that, it uses a
server-side DOM implementation (currently [domino][1]).

For rendering on the server to work as closely as possible to running
the app on the browser, we need to make DOM globals (such as `Element`,
`HTMLElement`, etc.), which are normally provided by the browser,
available as globals on the server as well.

Currently, `@angular/platform-server` achieves this by extending the
`global` object with the DOM implementation provided by `domino`. This
assignment happens in the [setDomTypes()][2] function, which is
[called in a `PLATFORM_INITIALIZER`][3]. While this works in most cases,
there are some scenarios where the DOM globals are needed sooner (i.e.
before initializing the platform). See, for example,  and 
for more details on such issues.

This commit provides a way to solve this problem by exposing a
side-effect-ful entry-point (`@angular/platform-server/init`), that
shims the `global` object with DOM globals. People will be able to
import this entry-point in their server-rendered apps before
bootstrapping the app (for example, in their `main.server.ts` file).
(See also [ (comment)][4].)

In a future update, the [`universal` schematics][5] will include such an
import by default in newly generated projects.

[1]: https://www.npmjs.com/package/domino
[2]: https://github.com/angular/angular/blob/0fc8466f1be392917e0c/packages/platform-server/src/domino_adapter.ts#L17-L21
[3]: https://github.com/angular/angular/blob/0fc8466f1be392917e0c/packages/platform-server/src/server.ts#L33
[4]: https://github.com/angular/angular/issues/39950#issuecomment-747598403
[5]: https://github.com/angular/angular-cli/blob/cc51432661eb4ab4b6a3/packages/schematics/angular/universal

PR Close 
2021-02-12 08:55:25 -08:00
George Kalpakas
4e4fcacb6d fix(docs-infra): correctly handle entry-points with no public exports ()
Previously, if an entry-point had no public exports (such as the
`@angular/platform-server/shims` introduced in , which is a
side-effect-ful entry-point), it was incorrectly marked as having all
its exports deprecated (which marks the entry-point as deprecated as
well).

This commit fixes this by ensuring that an entry-point is not marked as
having all its exports deprecated if it has no public exports.

PR Close 
2021-02-09 10:56:17 -08:00
Pete Bacon Darwin
c6a2267bb4 build(docs-infra): remove outdated comment ()
The comment referred to pre v9 Angular. The `http` package has
now been completely removed.

PR Close 
2021-01-20 16:12:15 -08:00
twerske
fbfd4889a9 build(docs-infra): error guides in docs ()
add /errors to docs
create formatting for error guides infra

PR Close 
2021-01-14 11:28:52 -08:00
Pete Bacon Darwin
7a7dc89332 build(docs-infra): add @default tag-def support ()
This tag-def is being used in the `platform-server` source code,
and was causing warnings in the doc-gen. Adding support
prevents the warning from being shown.
Other than that this change has no effect on the generated
documentation, since the `@default` tag is not used in any
templates.

PR Close 
2021-01-13 14:03:04 -08:00
Joey Perrott
d1ea1f4c7f build: update license headers to reference Google LLC ()
Update the license headers throughout the repository to reference Google LLC
rather than Google Inc, for the required license headers.

PR Close 
2020-05-26 14:26:58 -04:00
Sonu Kapoor
89995075e6 refactor(docs-infra): refactors extractDecoratedClasses ()
This commit removes the dependency on the `lodash` module and refactors
the `extractDecoratedClasses` method.

PR Close 
2020-05-18 10:25:30 -07:00
Pete Bacon Darwin
f16ca1ce46 build(docs-infra): correctly handle "pseudo" classes ()
In the code base there are cases where there is, conceptually, a class
that is represented by a combination of an `interface`
(type declaration) and a `const` (value declaration).

For example:

```
export interface SomeClass {
  count(a?: string): number;
}
export const: SomeClass = class {
  someMethod(a: string = ''): number { ... }
};
```

These were being rendered as interfaces and also not
correctly showing the descriptions and default parameter
values.

In this commit such concepts are now rendered as classes.
The classes that are affected by this are:

* `DebugElement`
* `DebugNode`
* `Type`
* `EventEmitter`
* `TestBed`

Note that while decorators are also defined in this form
they have their own rendering type (`decorator`) and so
are not affecte by this.

PR Close 
2020-05-14 10:50:30 -07:00
Paul Gschwendtner
854bd7d0c8 build(docs-infra): do not require abstract directives to declare a @ngModule ()
Abstract directives cannot be part of a `@NgModule`, but the AIO dgeni
setup currently enforces this. This commit updates the logic so that
abstract directives are skipped.

PR Close 
2020-05-06 15:06:10 -07:00
crisbeto
471375adbe docs(ivy): document global debugging utilities and clean up API ()
Cleans up the public API of the global debugging utilities, documents them and exposes them in the API docs.

PR Close 
2020-01-30 11:30:32 -08:00
Kristiyan Kostadinov
e7cf1e0580 feat(docs-infra): add the ability to expose globals ()
Adds the ability to expose global symbols in the API docs via the `@globalApi` tag. Also supports optionally setting a namespace which will be added to the name automatically (e.g. `foo` will be renamed to `ng.foo`). Relevant APIs should also be exported through the `global.ts` file which will show up under `core/global`.

PR Close 
2019-12-06 10:58:09 -08:00
Kara Erickson
86104b82b8 refactor(core): rename ngInjectableDef to ɵprov ()
Injectable defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectableDef to "prov" (for "provider", since injector defs
are known as "inj"). This is because property names cannot
be minified by Uglify without turning on property mangling
(which most apps have turned off) and are thus size-sensitive.

PR Close 
2019-10-16 16:36:19 -04:00
Kara Erickson
cda9248b33 refactor(core): rename ngInjectorDef to ɵinj ()
Injector defs are not considered public API, so the property
that contains them should be prefixed with Angular's marker
for "private" ('ɵ') to discourage apps from relying on def
APIs directly.

This commit adds the prefix and shortens the name from
ngInjectorDef to inj. This is because property names
cannot be minified by Uglify without turning on property
mangling (which most apps have turned off) and are thus
size-sensitive.

PR Close 
2019-10-16 16:36:19 -04:00
George Kalpakas
9364a14d36 fix(docs-infra): ignore ng*Def members in API docs ()
`ng*Def` properties (such as `ngInjectorDef`) are not considered part of
the public API and should not appear in the API docs. This commit adds a
filter to remove these properties from the docs metadata.

PR Close 
2019-10-03 10:24:34 -07:00
George Kalpakas
3e52e32dce build(docs-infra): add empty codeGenApi JSDoc tag definition ()
This avoids warning such as the following ([example][1]):

```
warn: Invalid tags found -
  doc "platform-browser/ɵBROWSER_SANITIZATION_PROVIDERS__POST_R3__" (const)
  from file "platform-browser/src/browser.ts"
```

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

PR Close 
2019-08-28 09:41:21 -07:00
Pete Bacon Darwin
3fb78aaacc feat(upgrade): provide unit test helpers for wiring up injectors ()
Adds two new helper functions that can be used when unit testing Angular services
that depend upon upgraded AngularJS services, or vice versa.
The functions return a module (AngularJS or NgModule) that is configured to wire up
the Angular and AngularJS injectors without the need to actually bootstrap a full
hybrid application.

This makes it simpler and faster to unit test services.

PR Close 
2019-06-20 17:04:01 -07:00
Ben Lesh
d7eaae6f22 refactor(ivy): Move instructions back to ɵɵ ()
There is an encoding issue with using delta `Δ`, where the browser will attempt to detect the file encoding if the character set is not explicitly declared on a `<script/>` tag, and Chrome will find the `Δ` character and decide it is window-1252 encoding, which misinterprets the `Δ` character to be some other character that is not a valid JS identifier character

So back to the frog eyes we go.

```
    __
   /ɵɵ\
  ( -- ) - I am ineffable. I am forever.
 _/    \_
/  \  /  \
==  ==  ==
```

PR Close 
2019-05-20 16:37:47 -07:00
Brandon
6cb3b50a03 docs(docs-infra): add common/upgrade to API package sources ()
Closes 

PR Close 
2019-05-16 11:47:16 -07:00
Ben Lesh
cf86ed7b29 refactor(ivy): migrate ɵɵ prefix back to Δ ()
Now that issues are resolved with Closure compiler, we can move back to our desired prefix of `Δ`.

PR Close 
2019-05-14 16:52:15 -07:00
Alex Rickabaugh
b0578061ce refactor(ivy): use ɵɵ instead of Δ for now ()
The `Δ` caused issue with other infrastructure, and we are temporarily
changing it to `ɵɵ`.

This commit also patches ts_api_guardian_test and AIO to understand `ɵɵ`.

PR Close 
2019-04-11 16:27:56 -07:00
Ben Lesh
138ca5a246 refactor(ivy): prefix all generated instructions ()
- Updates all instructions to be prefixed with the Greek delta symbol

PR Close 
2019-04-10 12:11:40 -07:00
Pete Bacon Darwin
a4f3f3f81d build(docs-infra): support doc aliases via @alias dgeni tag ()
Now, one can add an `@alias` tag to API docs, which tells dgeni that this
API element (usually a `const`) is really just an alias for some API element
defined elsewhere.

Dgeni will then look up this API element and copy over the properties from
the alias to the current doc.

For example, we would like to privately export an Enum from `@angular/core`
but then publicly export this from `@angular/common`:

**packages/core/private_exports.ts**

```ts
/**
 * Description of this document.
 */
export enum ɵSomeEnum { ... }
```

**packages/common/public_api.ts**

```ts
import {ɵSomeEnum} from '@angular/core';

 /**
 * @alias core/ɵSomeEnum
 */
export const SomeEnum = ɵSomeEnum;
```

In the generated docs there will be a page for `common/SomeEnum`, which
will be rendered as an enum, rather than a const, showing the description
extracted from the `core/ɵSomeEnum`.

---

The implementation of this feature required some refactoring of the other
processing:

1. Previously `ɵ` prefixed exports were not even considered.
2. Due to 1. some processors needed to have guards added to ignore such
   private exports (`addMetadataAliases` and `checkContentRules`).
3. The processing of package pages had to be reworked (and split) so that
   it picked up the aliased export docs after their alias proeprties had
   been copied.

See FW-1207, FW-632, 

PR Close 
2019-04-04 10:52:36 -07:00
Pete Bacon Darwin
6233cd55f7 style(docs-infra): fix typo ()
PR Close 
2019-04-04 10:52:36 -07:00
Alex Eagle
03d914a6c2 build: hide @angular/http for Angular v8 ()
Currently our plan is to skip the publish, docgen, and update steps for this package.
During RC, we'll determine if the breaking change is too difficult for users, in which case we might restore the package for another major.

PR Close 
2019-04-02 10:55:31 -07:00
Adam Plumer
6b6fdffc12 fixup! docs: update Universal guide ()
PR Close 
2019-03-11 10:52:18 -07:00
Adam Plumer
a29ce57732 docs: migrate examples from @angular/http to @angular/common/http ()
PR Close 
2019-03-11 10:52:17 -07:00
Pete Bacon Darwin
4bd9f53e8f feat(docs-infra): rename tagdef: @experimental to @publicApi ()
PR Close 
2018-10-19 14:35:52 -07:00
Pete Bacon Darwin
4c0ad5238e build(docs-infra): display github links in CLI API docs ()
This commit includes the following changes:

* CLI version information is read from the CLI package from which
  we read the help files.
* CLI API pages now contain GH links
* line numbers are not shown in GH links, if the doc does not
  have a truthy `startingLine` value. This allows us to remove
  hard coded checks for `guide` pages
* content pages and CLI api docs no longer have a `startingLine`
* the hard-coded `packages` path segment has been removed from
  the templates; instead we now only use the `realProjectRelativePath`.
* the `realProjectRelativePath` has been updated accordingly for API
  and CLI API docs.

PR Close 
2018-10-19 11:12:54 -07:00
Pete Bacon Darwin
9889276b15 build(docs-infra): directive inputs and outputs ()
PR Close 
2018-10-01 09:36:33 -07:00
Pete Bacon Darwin
46729c76a0 build(docs-infra): improve directive selector rendering ()
If the documentation contains a `@selectors` tag then the content of that
is used to describe the selectors of a directive.

Otherwise the selector string is split and each selector is listed as
a list item in an unordered list.

PR Close 
2018-10-01 09:36:33 -07:00
Pete Bacon Darwin
f22deb2e2d build(docs-infra): improve directive API doc templates ()
Closes 
Closes 

PR Close 
2018-10-01 09:36:32 -07:00
Pete Bacon Darwin
b8422b41bb build(docs-infra): fail doc-gen if a content rule fails ()
PR Close 
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin
8ac4dd6447 build(docs-infra): allow usage notes on decorator option properties ()
PR Close 
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin
3808416479 build(docs-infra): remove legacy jsdoc tag processing ()
PR Close 
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin
cee7448efc build(docs-infra): add @nocollapse tag-def to prevent warning ()
See https://github.com/angular/angular/blob/master/packages/compiler-cli/src/transformers/nocollapse_hack.ts

PR Close 
2018-09-24 09:11:02 -07:00
Pete Bacon Darwin
7f1cace2a2 build(docs-infra): sort NgModule exports by id ()
PR Close 
2018-09-21 17:00:03 -07:00
Pete Bacon Darwin
56c86c7e79 build(docs-infra): sort package exports by id ()
Closes 

PR Close 
2018-09-21 17:00:03 -07:00
Pete Bacon Darwin
026b60cd70 build(docs-infra): expose deprecated status on items more clearly ()
PR Close 
2018-09-21 10:26:48 -07:00
Pete Bacon Darwin
9931bd7576 build(docs-infra): do not include license comment in first API doc ()
The default dgeni config is to concatenate leading comments in front of API items.

In the case that you have an API item that starts a file with no import statements,
the license comment at the top of the file was being added to the front of the
API item's comment. SInce the license comment includes the `@license` tag
and the API item's comment did not start with `@description` the content of
the API item's comment was being put inside the `@license` tag, and no
description was being extracted from the API item's comment.

This commit updates to a version of dgeni-packages that has a switch to turn off
this concatenation, and then also configures this switch.

Closes 

PR Close 
2018-09-21 10:25:41 -07:00
Pete Bacon Darwin
b94436d86c build(docs-infra): process and render ngmodule exports ()
All directives and pipes must now be tagged with one ore more
public NgModule, from which they are exported.

If an item is exported transitively via a re-exported internal NgModule
then it may be that the item appears to be exported from more than
one public NgModule. For example, there are shared directives that
are exported in this way from `FormsModule` and `ReactiveFormsModule`.

The doc-gen will error and fail if a directive or pipe is not tagged correctly.

NgModule pages now list all the directives and pipes that are exported from it.
Directive and Pipe pages now list any NgModule from which they are exported.
Packages also now list any NgModules that are contained - previously they were
missed.

PR Close 
2018-09-19 16:18:24 -07:00
Pete Bacon Darwin
bc5cb8153e build(docs-infra): separate NgModules from Classes in API docs ()
PR Close 
2018-09-19 16:18:24 -07:00
Pete Bacon Darwin
4e45f2c481 build(docs-infra): include packages in API template breadcrumbs ()
PR Close 
2018-08-14 13:17:15 -07:00
Pete Bacon Darwin
d8c828c9b1 build(docs-infra): implement the 'package' API template ()
PR Close 
2018-07-13 19:45:54 -04:00
Pete Bacon Darwin
cf0968f98e build(docs-infra): support hiding constructors of injectable classes ()
Classes that are injectable often have constructors that should not be
called by the application developer. It is the responsibility of the
injector to instantiate the class and the constructor often contains
private implementation details that may need to change.

This commit removes constructors from the docs for API items that are
both:

a) Marked with an injectable decorator (e.g. Injectable, Directive,
Component, Pipe), and
b) Have no constructor description

This second rule allows the developer to override the removal if there
is something useful to say about the constructor.

Note that "normal" classes such as `angimations/HttpHeaders` do not have
their constructor removed, despite (at this time) having no description.

PR Close 
2018-06-26 10:58:11 -07:00