Skip to content

Commit a3abe16

Browse files
jelbournalxhub
authored andcommitted
build: add target to generate api manifest (angular#52472)
This adds a target to generate a manifest of all public api symbols. The majority of inputs are generated from the extraction rules, but API entries that don't have a TypeScript source symbol (elements and blocks) are defined in hand-written json collections. PR Close angular#52472
1 parent 91ee269 commit a3abe16

File tree

10 files changed

+180
-148
lines changed

10 files changed

+180
-148
lines changed

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ yarn_install(
8080
"//:.yarnrc",
8181
"//:tools/npm-patches/@bazel+jasmine+5.8.1.patch",
8282
"//tools:postinstall-patches.js",
83-
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-680aab4562e5bb684518ca496cb449a6c447601d.patch",
83+
"//tools/esm-interop:patches/npm/@angular+build-tooling+0.0.0-b2cec2dcba358f9dc7111800a3d65738f57abe8f.patch",
8484
"//tools/esm-interop:patches/npm/@bazel+concatjs+5.8.1.patch",
8585
"//tools/esm-interop:patches/npm/@bazel+esbuild+5.7.1.patch",
8686
"//tools/esm-interop:patches/npm/@bazel+protractor+5.7.1.patch",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
"// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.",
160160
"devDependencies": {
161161
"@actions/core": "^1.10.0",
162-
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#8fa10a4dc43b9780f09c99f11d805e733107ed70",
162+
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#cf8da67c048dde33354eb64e18b60eced1f62ea6",
163163
"@angular/ng-dev": "https://github.com/angular/dev-infra-private-ng-dev-builds.git#c773500c56bada879d4a5a4169a04bdb039262d1",
164164
"@babel/helper-remap-async-to-generator": "^7.18.9",
165165
"@babel/plugin-proposal-async-generator-functions": "^7.20.7",

packages/BUILD.bazel

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
load("//tools:defaults.bzl", "ts_config", "ts_library")
22
load("//:packages.bzl", "DOCS_ENTRYPOINTS")
3+
load("@npm//@angular/build-tooling/bazel/api-gen/manifest:generate_api_manifest.bzl", "generate_api_manifest")
34

45
package(default_visibility = ["//visibility:public"])
56

@@ -43,3 +44,37 @@ filegroup(
4344
name = "files_for_docgen",
4445
srcs = ["//packages/%s:files_for_docgen" % entrypoint for entrypoint in DOCS_ENTRYPOINTS],
4546
)
47+
48+
generate_api_manifest(
49+
name = "docs_api_manifest",
50+
srcs = [
51+
"//packages/animations:animations_docs_extraction",
52+
"//packages/animations/browser:animations_browser_docs_extraction",
53+
"//packages/animations/browser/testing:animations_browser_testing_docs_extraction",
54+
"//packages/common:common_docs_extraction",
55+
"//packages/common/http:http_docs_extraction",
56+
"//packages/common/testing:common_testing_docs_extraction",
57+
"//packages/common/upgrade:common_upgrade_docs_extraction",
58+
"//packages/core:core_docs_extraction",
59+
"//packages/core/reference-manifests",
60+
"//packages/core/rxjs-interop:core_rxjs-interop_docs_extraction",
61+
"//packages/core/testing:core_testing_docs_extraction",
62+
"//packages/elements:elements_docs_extraction",
63+
"//packages/forms:forms_docs_extraction",
64+
"//packages/localize:localize_docs_extraction",
65+
"//packages/platform-browser:platform-browser_docs_extraction",
66+
"//packages/platform-browser-dynamic:platform-browser_dynamic_docs_extraction",
67+
"//packages/platform-browser-dynamic/testing:platform-browser_dynamic_testing_docs_extraction",
68+
"//packages/platform-browser/animations:platform-browser_animations_docs_extraction",
69+
"//packages/platform-browser/testing:platform-browser_testing_docs_extraction",
70+
"//packages/platform-server:platform-server_docs_extraction",
71+
"//packages/platform-server/testing:platform-server_testing_docs_extraction",
72+
"//packages/router:router_docs_extraction",
73+
"//packages/router/testing:router_testing_docs_extraction",
74+
"//packages/router/upgrade:router_upgrade_docs_extraction",
75+
"//packages/service-worker:service-worker_docs_extraction",
76+
"//packages/upgrade:upgrade_docs_extraction",
77+
"//packages/upgrade/static:upgrade_static_docs_extraction",
78+
"//packages/upgrade/static/testing:upgrade_static_testing_docs_extraction",
79+
],
80+
)

packages/compiler-cli/src/ngtsc/docs/src/entities.ts

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

99
/** Type of top-level documentation entry. */
1010
export enum EntryType {
11-
Block = 'Block',
11+
Block = 'block',
1212
Component = 'component',
1313
Constant = 'constant',
1414
Decorator = 'decorator',
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
filegroup(
2+
name = "reference-manifests",
3+
srcs = glob(["*.json"]),
4+
visibility = ["//visibility:public"],
5+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Manual API manifests
2+
3+
This directory contains handwritten JSON entries that are aggregated into Angular's
4+
API documentation manifest.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"moduleName": "@angular/core",
3+
"entries": [
4+
{
5+
"name": "@if",
6+
"entryType": "block",
7+
"jsdocTags": []
8+
},
9+
{
10+
"name": "@for",
11+
"entryType": "block",
12+
"jsdocTags": []
13+
},
14+
{
15+
"name": "@switch",
16+
"entryType": "block",
17+
"jsdocTags": []
18+
},
19+
{
20+
"name": "@defer",
21+
"entryType": "block",
22+
"jsdocTags": []
23+
}
24+
]
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"moduleName": "@angular/core",
3+
"entries": [
4+
{
5+
"name": "ng-content",
6+
"entryType": "element",
7+
"jsdocTags": []
8+
},
9+
{
10+
"name": "ng-template",
11+
"entryType": "element",
12+
"jsdocTags": []
13+
},
14+
{
15+
"name": "ng-container",
16+
"entryType": "element",
17+
"jsdocTags": []
18+
}
19+
]
20+
}

tools/esm-interop/patches/npm/@angular+build-tooling+0.0.0-680aab4562e5bb684518ca496cb449a6c447601d.patch renamed to tools/esm-interop/patches/npm/@angular+build-tooling+0.0.0-b2cec2dcba358f9dc7111800a3d65738f57abe8f.patch

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,37 @@ index afe4e5c..095a8f0 100755
3636
- "@npm//@angular/compiler",
3737
- "@npm//@angular/compiler-cli",
3838
+ "@angular//packages/compiler",
39+
+ "@angular//packages/compiler-cli",
40+
],
41+
entry_point = "bin.mjs",
42+
# Note: Using the linker here as we need it for ESM. The linker is not
43+
diff --git a/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel b/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
44+
index 26563a7..f7bc080 100755
45+
--- a/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
46+
+++ b/node_modules/@angular/build-tooling/bazel/api-gen/manifest/BUILD.bazel
47+
@@ -15,7 +15,7 @@ esbuild_esm_bundle(
48+
target = "es2022",
49+
deps = [
50+
":generate_api_manifest_lib",
51+
- "@npm//@angular/compiler-cli",
52+
+ "@angular//packages/compiler-cli",
53+
],
54+
)
55+
56+
@@ -25,7 +25,7 @@ ts_library(
57+
devmode_module = "commonjs",
58+
tsconfig = "@npm//@angular/build-tooling:tsconfig.json",
59+
deps = [
60+
- "@npm//@angular/compiler-cli",
61+
+ "@angular//packages/compiler-cli",
62+
"@npm//@bazel/runfiles",
63+
"@npm//@types/node",
64+
],
65+
@@ -36,7 +36,7 @@ nodejs_binary(
66+
name = "generate_api_manifest",
67+
data = [
68+
":bin",
69+
- "@npm//@angular/compiler-cli",
3970
+ "@angular//packages/compiler-cli",
4071
],
4172
entry_point = "bin.mjs",

0 commit comments

Comments
 (0)