feat: docgen package (#8029)

This commit is contained in:
Noel
2022-06-07 10:51:33 +02:00
committed by GitHub
parent 5475767c2c
commit 8b979c0245
71 changed files with 1411 additions and 756 deletions

View File

@@ -0,0 +1 @@
export type Access = 'public' | 'private' | 'protected';

View File

@@ -0,0 +1,3 @@
import type { Constructor, Event, Member, Method } from './index.js';
export type ChildTypes = Constructor | Member | Method | Event;

View File

@@ -0,0 +1,13 @@
import type { Access, Item, Meta, Scope } from './index.js';
export interface Class extends Item {
kind: 'class';
scope: Scope;
implements?: string[];
augments?: string[];
see?: string[];
access?: Access;
virtual?: boolean;
deprecated?: boolean | string;
meta: Meta;
}

View File

@@ -0,0 +1,3 @@
export interface Config {
root: string;
}

View File

@@ -0,0 +1,9 @@
import type { Access, Item, Param } from './index.js';
export interface Constructor extends Item {
kind: 'constructor';
memberof: string;
see?: string[];
access?: Access;
params?: Param[];
}

View File

@@ -0,0 +1,12 @@
export interface CustomDocs {
name?: string;
files: Record<
string,
{
name?: string;
type?: string;
content?: string;
path?: string;
}
>;
}

View File

@@ -0,0 +1,11 @@
import type { Item, Meta, Param, Scope } from './index.js';
export interface Event extends Item {
kind: 'event';
scope: Scope;
memberof: string;
see?: string[];
deprecated?: boolean | string;
params?: Param[];
meta: Meta;
}

View File

@@ -0,0 +1,7 @@
import type { Type } from './index.js';
export interface Exception {
type: Type;
nullable?: boolean;
description?: string;
}

View File

@@ -0,0 +1,7 @@
import type { Item, Meta } from './index.js';
export interface External extends Item {
kind: 'external';
see?: string[];
meta: Meta;
}

View File

@@ -0,0 +1,21 @@
export * from './access.type.js';
export * from './childTypes.type';
export * from './class.interface.js';
export * from './config.interface.js';
export * from './constructor.interface.js';
export * from './customDocs.interface.js';
export * from './event.interface.js';
export * from './exception.interface.js';
export * from './external.interface.js';
export * from './interface.interface.js';
export * from './item.interface.js';
export * from './member.interface.js';
export * from './meta.interface.js';
export * from './method.interface.js';
export * from './param.interface.js';
export * from './return.interface.js';
export * from './rootTypes.type.js';
export * from './scope.type.js';
export * from './type.interface.js';
export * from './typedef.interface.js';
export * from './var-type.interface';

View File

@@ -0,0 +1,7 @@
import type { Class } from './index.js';
// @ts-expect-error
export interface Interface extends Class {
kind: 'interface';
classdesc: string;
}

View File

@@ -0,0 +1,8 @@
export interface Item {
id: string;
longname: string;
name: string;
kind: string;
description: string;
order: number;
}

View File

@@ -0,0 +1,17 @@
import type { Access, Item, Meta, Param, Scope, Type } from './index.js';
export interface Member extends Item {
kind: 'member';
see?: string[];
scope: Scope;
memberof: string;
type: Type;
access?: Access;
readonly?: boolean;
nullable?: boolean;
virtual?: boolean;
deprecated?: boolean | string;
default?: string;
properties?: Param[];
meta: Meta;
}

View File

@@ -0,0 +1,5 @@
export interface Meta {
lineno: number;
filename: string;
path: string;
}

View File

@@ -0,0 +1,22 @@
import type { Access, Exception, Item, Meta, Param, Return, Scope } from './index.js';
export interface Method extends Item {
kind: 'function';
see?: string[];
scope: Scope;
access?: Access;
inherits?: string;
inherited?: boolean;
implements?: string[];
examples?: string[];
virtual?: boolean;
deprecated?: boolean | string;
memberof?: string;
params?: Param[];
async?: boolean;
generator?: boolean;
fires?: string[];
returns?: Return[];
exceptions?: Exception[];
meta: Meta;
}

View File

@@ -0,0 +1,11 @@
import type { Type } from './index.js';
export interface Param {
type: Type;
description: string;
name: string;
optional?: boolean;
defaultvalue?: string;
variable?: string;
nullable?: boolean;
}

View File

@@ -0,0 +1,7 @@
import type { Type } from './index.js';
export interface Return {
type: Type;
nullable?: boolean;
description?: string;
}

View File

@@ -0,0 +1,3 @@
import type { Class, External, Interface, Method, Typedef } from './index.js';
export type RootTypes = Class | Method | Interface | Typedef | External;

View File

@@ -0,0 +1 @@
export type Scope = 'global' | 'instance' | 'static';

View File

@@ -0,0 +1,3 @@
export interface Type {
names?: string[];
}

View File

@@ -0,0 +1,14 @@
import type { Access, Item, Meta, Param, Return, Scope, Type } from './index.js';
export interface Typedef extends Item {
kind: 'typedef';
scope: Scope;
see?: string[];
access?: Access;
deprecated?: boolean | string;
type: Type;
properties?: Param[];
params?: Param[];
returns?: Return[];
meta: Meta;
}

View File

@@ -0,0 +1,6 @@
import type { Type } from './index.js';
export interface VarType extends Type {
description?: string;
nullable?: boolean;
}