Skip to content

Commit 9a40cad

Browse files
authored
build: fix API docs extraction of directives and imported types (#33953)
* build: use the own entry point of import map targets in API extraction The rule picked the shortest `index.d.ts` among a target and its dependencies, which mapped `@angular/aria/private` to `src/cdk/platform`. Use the target's own one, and fail if it's missing. * build: resolve relative imports outside of srcs during API extraction Imports like `../private` didn't resolve, so directives whose host directives come from them were documented as plain classes. Resolve them through `rootDirs` to the type declarations among the inputs, and add a `deps` attribute to provide such declarations. * build: use the import map in all API docs targets The cdk/drag-drop and cdk/testing targets didn't use the wrapper in `tools/defaults.bzl`, so imports like `@angular/core` didn't resolve there. * build: ignore missing compiled stylesheets during API extraction They aren't inputs of the action, like the `resets.css` of cdk/drag-drop, and don't affect the docs. * refactor(aria/combobox): import private APIs through a relative path Use `../private`, like the other aria entry points. * build: add deps to the API docs targets Provides the declarations of their relative imports of other packages, which were missing (e.g. `../scrolling` in cdk/drag-drop) or came from unrelated import map entries. * build: map @angular/cdk/a11y and rxjs in API docs extraction Types from them, like the aria `id` inputs and the `DragRef` events, were documented as `any`. * build: fix wildcard path mappings of directories in API extraction For a directory entry like `rxjs`, the wildcard pointed to its parent, so `rxjs/operators` didn't resolve. * build: fail API extraction on Angular compilation errors Such errors made the extractor silently document directives as plain classes. * refactor(aria/combobox): update API golden The declarations no longer import from `@angular/aria/private`, like the other aria entry points.
1 parent 7360f0b commit 9a40cad

19 files changed

Lines changed: 95 additions & 32 deletions

File tree

‎goldens/aria/combobox/index.api.md‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
```ts
66

77
import * as _angular_core from '@angular/core';
8-
import { ComboboxPattern } from '@angular/aria/private';
9-
import { ComboboxPopupPattern } from '@angular/aria/private';
10-
import { DeferredContentAware } from '@angular/aria/private';
11-
import * as i1 from '@angular/aria/private';
128
import { InjectionToken } from '@angular/core';
139
import { OnDestroy } from '@angular/core';
1410
import { OnInit } from '@angular/core';
@@ -56,7 +52,7 @@ export class ComboboxPopup implements OnInit, OnDestroy {
5652
_unregisterWidget(): void;
5753
readonly _widget: _angular_core.WritableSignal<ComboboxWidget | undefined>;
5854
// (undocumented)
59-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopup, "ng-template[ngComboboxPopup]", ["ngComboboxPopup"], { "combobox": { "alias": "combobox"; "required": true; "isSignal": true; }; "popupType": { "alias": "popupType"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof i1.DeferredContent; inputs: {}; outputs: {}; }]>;
55+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ComboboxPopup, "ng-template[ngComboboxPopup]", ["ngComboboxPopup"], { "combobox": { "alias": "combobox"; "required": true; "isSignal": true; }; "popupType": { "alias": "popupType"; "required": false; "isSignal": true; }; }, {}, never, never, true, [{ directive: typeof DeferredContent; inputs: {}; outputs: {}; }]>;
6056
// (undocumented)
6157
static ɵfac: _angular_core.ɵɵFactoryDeclaration<ComboboxPopup, never>;
6258
}

‎src/aria/accordion/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ extract_api_to_json(
5858
output_name = "aria-accordion.json",
5959
private_modules = [""],
6060
repo = "angular/components",
61+
deps = [":accordion"],
6162
)

‎src/aria/combobox/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ extract_api_to_json(
5858
output_name = "aria-combobox.json",
5959
private_modules = [""],
6060
repo = "angular/components",
61+
deps = [":combobox"],
6162
)

‎src/aria/combobox/combobox-popup.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {computed, Directive, inject, input, OnDestroy, OnInit, signal} from '@angular/core';
10-
import {DeferredContent, ComboboxPopupPattern} from '@angular/aria/private';
10+
import {DeferredContent, ComboboxPopupPattern} from '../private';
1111
import type {Combobox} from './combobox';
1212
import type {ComboboxWidget} from './combobox-widget';
1313
import {COMBOBOX_POPUP} from './combobox-tokens';

‎src/aria/combobox/combobox.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
signal,
2020
Renderer2,
2121
} from '@angular/core';
22-
import {DeferredContentAware, ComboboxPattern, tabIndexTransform} from '@angular/aria/private';
22+
import {DeferredContentAware, ComboboxPattern, tabIndexTransform} from '../private';
2323
import type {ComboboxPopup} from './combobox-popup';
2424

2525
/**

‎src/aria/grid/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ extract_api_to_json(
5656
output_name = "aria-grid.json",
5757
private_modules = [""],
5858
repo = "angular/components",
59+
deps = [":grid"],
5960
)

‎src/aria/listbox/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ extract_api_to_json(
6060
output_name = "aria-listbox.json",
6161
private_modules = [""],
6262
repo = "angular/components",
63+
deps = [":listbox"],
6364
)

‎src/aria/menu/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ extract_api_to_json(
5858
output_name = "aria-menu.json",
5959
private_modules = [""],
6060
repo = "angular/components",
61+
deps = [":menu"],
6162
)

‎src/aria/tabs/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,5 @@ extract_api_to_json(
5555
output_name = "aria-tabs.json",
5656
private_modules = [""],
5757
repo = "angular/components",
58+
deps = [":tabs"],
5859
)

‎src/aria/toolbar/BUILD.bazel‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ extract_api_to_json(
5454
output_name = "aria-toolbar.json",
5555
private_modules = [""],
5656
repo = "angular/components",
57+
deps = [":toolbar"],
5758
)

0 commit comments

Comments
 (0)