mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
build: package api-extractor and -model (#9920)
* fix(ExceptText): don't display import("d..-types/v10"). in return type
* Squashed 'packages/api-extractor-model/' content from commit 39ecb196c
git-subtree-dir: packages/api-extractor-model
git-subtree-split: 39ecb196ca210bdf84ba6c9cadb1bb93571849d7
* Squashed 'packages/api-extractor/' content from commit 341ad6c51
git-subtree-dir: packages/api-extractor
git-subtree-split: 341ad6c51b01656d4f73b74ad4bdb3095f9262c4
* feat(api-extractor): add api-extractor and -model
* fix: package.json docs script
* fix(SourcLink): use <> instead of function syntax
* fix: make packages private
* fix: rest params showing in docs, added labels
* fix: missed two files
* fix: cpy-cli & pnpm-lock
* fix: increase icon size
* fix: icon size again
This commit is contained in:
68
packages/api-extractor-model/src/aedoc/AedocDefinitions.ts
Normal file
68
packages/api-extractor-model/src/aedoc/AedocDefinitions.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
import { TSDocConfiguration, TSDocTagDefinition, TSDocTagSyntaxKind, StandardTags } from '@microsoft/tsdoc';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @deprecated - tsdoc configuration is now constructed from tsdoc.json files associated with each package.
|
||||
*/
|
||||
export class AedocDefinitions {
|
||||
public static readonly betaDocumentation: TSDocTagDefinition = new TSDocTagDefinition({
|
||||
tagName: '@betaDocumentation',
|
||||
syntaxKind: TSDocTagSyntaxKind.ModifierTag,
|
||||
});
|
||||
|
||||
public static readonly internalRemarks: TSDocTagDefinition = new TSDocTagDefinition({
|
||||
tagName: '@internalRemarks',
|
||||
syntaxKind: TSDocTagSyntaxKind.BlockTag,
|
||||
});
|
||||
|
||||
public static readonly preapprovedTag: TSDocTagDefinition = new TSDocTagDefinition({
|
||||
tagName: '@preapproved',
|
||||
syntaxKind: TSDocTagSyntaxKind.ModifierTag,
|
||||
});
|
||||
|
||||
public static get tsdocConfiguration(): TSDocConfiguration {
|
||||
if (!AedocDefinitions._tsdocConfiguration) {
|
||||
const configuration: TSDocConfiguration = new TSDocConfiguration();
|
||||
configuration.addTagDefinitions(
|
||||
[AedocDefinitions.betaDocumentation, AedocDefinitions.internalRemarks, AedocDefinitions.preapprovedTag],
|
||||
true,
|
||||
);
|
||||
|
||||
configuration.setSupportForTags(
|
||||
[
|
||||
StandardTags.alpha,
|
||||
StandardTags.beta,
|
||||
StandardTags.decorator,
|
||||
StandardTags.defaultValue,
|
||||
StandardTags.deprecated,
|
||||
StandardTags.eventProperty,
|
||||
StandardTags.example,
|
||||
StandardTags.inheritDoc,
|
||||
StandardTags.internal,
|
||||
StandardTags.link,
|
||||
StandardTags.override,
|
||||
StandardTags.packageDocumentation,
|
||||
StandardTags.param,
|
||||
StandardTags.privateRemarks,
|
||||
StandardTags.public,
|
||||
StandardTags.readonly,
|
||||
StandardTags.remarks,
|
||||
StandardTags.returns,
|
||||
StandardTags.sealed,
|
||||
StandardTags.throws,
|
||||
StandardTags.virtual,
|
||||
],
|
||||
true,
|
||||
);
|
||||
|
||||
AedocDefinitions._tsdocConfiguration = configuration;
|
||||
}
|
||||
|
||||
return AedocDefinitions._tsdocConfiguration;
|
||||
}
|
||||
|
||||
private static _tsdocConfiguration: TSDocConfiguration | undefined;
|
||||
}
|
||||
88
packages/api-extractor-model/src/aedoc/ReleaseTag.ts
Normal file
88
packages/api-extractor-model/src/aedoc/ReleaseTag.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
/**
|
||||
* A "release tag" is a custom TSDoc tag that is applied to an API to communicate the level of support
|
||||
* provided for third-party developers.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* The four release tags are: `@internal`, `@alpha`, `@beta`, and `@public`. They are applied to API items such
|
||||
* as classes, member functions, enums, etc. The release tag applies recursively to members of a container
|
||||
* (e.g. class or interface). For example, if a class is marked as `@beta`, then all of its members automatically
|
||||
* have this status; you DON'T need add the `@beta` tag to each member function. However, you could add
|
||||
* `@internal` to a member function to give it a different release status.
|
||||
* @public
|
||||
*/
|
||||
export enum ReleaseTag {
|
||||
/**
|
||||
* No release tag was specified in the AEDoc summary.
|
||||
*/
|
||||
None = 0,
|
||||
/**
|
||||
* Indicates that an API item is meant only for usage by other NPM packages from the same
|
||||
* maintainer. Third parties should never use "internal" APIs. (To emphasize this, their
|
||||
* names are prefixed by underscores.)
|
||||
*/
|
||||
Internal = 1,
|
||||
/**
|
||||
* Indicates that an API item is eventually intended to be public, but currently is in an
|
||||
* early stage of development. Third parties should not use "alpha" APIs.
|
||||
*/
|
||||
Alpha = 2,
|
||||
/**
|
||||
* Indicates that an API item has been released in an experimental state. Third parties are
|
||||
* encouraged to try it and provide feedback. However, a "beta" API should NOT be used
|
||||
* in production.
|
||||
*/
|
||||
Beta = 3,
|
||||
/**
|
||||
* Indicates that an API item has been officially released. It is part of the supported
|
||||
* contract (e.g. SemVer) for a package.
|
||||
*/
|
||||
Public = 4,
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper functions for working with the `ReleaseTag` enum.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
// export namespace ReleaseTag {
|
||||
/**
|
||||
* Returns the TSDoc tag name for a `ReleaseTag` value.
|
||||
*
|
||||
* @remarks
|
||||
* For example, `getTagName(ReleaseTag.Internal)` would return the string `@internal`.
|
||||
*/
|
||||
export function getTagName(releaseTag: ReleaseTag): string {
|
||||
switch (releaseTag) {
|
||||
case ReleaseTag.None:
|
||||
return '(none)';
|
||||
case ReleaseTag.Internal:
|
||||
return '@internal';
|
||||
case ReleaseTag.Alpha:
|
||||
return '@alpha';
|
||||
case ReleaseTag.Beta:
|
||||
return '@beta';
|
||||
case ReleaseTag.Public:
|
||||
return '@public';
|
||||
default:
|
||||
throw new Error('Unsupported release tag');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two `ReleaseTag` values. Their values must not be `ReleaseTag.None`.
|
||||
*
|
||||
* @returns 0 if `a` and `b` are equal, a positive number if `a` is more public than `b`,
|
||||
* and a negative number if `a` is less public than `b`.
|
||||
* @remarks
|
||||
* For example, `compareReleaseTag(ReleaseTag.Beta, ReleaseTag.Alpha)` will return a positive
|
||||
* number because beta is more public than alpha.
|
||||
*/
|
||||
export function compare(a: ReleaseTag, b: ReleaseTag): number {
|
||||
return a - b;
|
||||
}
|
||||
// }
|
||||
Reference in New Issue
Block a user