feat(api-extractor): support multiple entrypoints (#10829)

* feat(api-extractor): support multiple entrypoints

* chore: initial support in generateSplitDocumentation

* chore: bring in line with upstream

* refactor: multiple entrypoints in scripts

* fix: split docs

* feat: website

* fix: docs failing on next

* fix: don't include dtypes for now

* refactor: don't fetch entrypoint if there is none

---------

Co-authored-by: iCrawl <buechler.noel@outlook.com>
This commit is contained in:
Qjuh
2025-05-12 23:48:41 +02:00
committed by GitHub
parent 4f5e5c7c14
commit b3db92edfb
93 changed files with 2330 additions and 1956 deletions

View File

@@ -1,11 +0,0 @@
{
"extends": "@rushstack/heft-node-rig/profiles/default/config/jest.config.json",
// Enable code coverage for Jest
"collectCoverage": true,
"coverageDirectory": "<rootDir>/coverage",
"coverageReporters": ["cobertura", "html"],
// Use v8 coverage provider to avoid Babel
"coverageProvider": "v8"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@discordjs/api-extractor-model",
"version": "7.28.2",
"version": "7.30.6",
"description": "A helper library for loading and saving the .api.json files created by API Extractor",
"private": true,
"repository": {
@@ -31,19 +31,17 @@
}
},
"dependencies": {
"@microsoft/tsdoc": "0.14.2",
"@microsoft/tsdoc-config": "0.16.2",
"@rushstack/node-core-library": "4.1.0"
"@microsoft/tsdoc": "~0.15.1",
"@microsoft/tsdoc-config": "~0.17.1",
"@rushstack/node-core-library": "5.13.1"
},
"devDependencies": {
"@types/jest": "^29.5.14",
"@types/node": "^22.15.2",
"cross-env": "^7.0.3",
"eslint": "^9.25.1",
"eslint-config-neon": "^0.2.7",
"eslint-formatter-compact": "^8.40.0",
"eslint-formatter-pretty": "^6.0.1",
"jest": "^29.7.0",
"prettier": "^3.5.3",
"terser": "^5.39.0",
"tsup": "^8.4.0",

View File

@@ -6,6 +6,7 @@ import { InternalError } from '@rushstack/node-core-library';
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin.js';
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin.js';
import type { Constructor, PropertiesOf } from '../mixins/Mixin.js';
import type { ApiEntryPoint } from '../model/ApiEntryPoint.js';
import type { ApiModel } from '../model/ApiModel.js';
import type { ApiPackage } from '../model/ApiPackage.js';
import type { DocgenJson } from '../model/Deserializer';
@@ -301,6 +302,20 @@ export class ApiItem {
return reversedParts.reverse().join('');
}
/**
* If this item is an ApiEntryPoint or has an ApiEntryPoint as one of its parents, then that object is returned.
* Otherwise undefined is returned.
*/
public getAssociatedEntryPoint(): ApiEntryPoint | undefined {
for (let current: ApiItem | undefined = this; current !== undefined; current = current.parent) {
if (current.kind === ApiItemKind.EntryPoint) {
return current as ApiEntryPoint;
}
}
return undefined;
}
/**
* If this item is an ApiPackage or has an ApiPackage as one of its parents, then that object is returned.
* Otherwise undefined is returned.

View File

@@ -73,7 +73,8 @@ export class ModelReferenceResolver {
}
}
const importPath: string = declarationReference.importPath ?? '';
// Remove the leading / in the import path
const importPath: string = (declarationReference.importPath || '').replace(/^\//, '');
const foundEntryPoints: readonly ApiEntryPoint[] = apiPackage.findEntryPointsByPath(importPath);
if (foundEntryPoints.length < 1) {

View File

@@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["jest", "node"],
"types": ["node"],
"isolatedModules": false
},
"include": ["src/**/*.ts"],