1 | import * as bt from '@babel/types';
|
2 | import type Map from 'ts-map';
|
3 | import type { NodePath } from 'ast-types/lib/node-path';
|
4 | import type { TemplateChildNode } from '@vue/compiler-dom';
|
5 | import type { Options as PugOptions } from 'pug';
|
6 | import type { Descriptor, Documentation } from './Documentation';
|
7 | export type ParseFileFunction = (opt: ParseOptions, documentation?: Documentation) => Promise<Documentation[]>;
|
8 | export type HandlerExecutorsFunction = (componentDefinitions: Map<string, NodePath>, ast: bt.File, options: ParseOptions, deps: {
|
9 | parseFile: ParseFileFunction;
|
10 | }, documentation?: Documentation, forceSingleExport?: boolean) => Promise<Documentation[] | undefined>;
|
11 | export type ScriptHandler = (doc: Documentation, componentDefinition: NodePath, ast: bt.File, opt: ParseOptions, deps: {
|
12 | parseFile: ParseFileFunction;
|
13 | addDefaultAndExecuteHandlers: HandlerExecutorsFunction;
|
14 | }) => Promise<void>;
|
15 | export interface TemplateParserOptions {
|
16 | functional: boolean;
|
17 | }
|
18 | export type TemplateHandler = (documentation: Documentation, templateAst: TemplateChildNode, siblings: TemplateChildNode[], options: TemplateParserOptions) => void;
|
19 | export interface ParseOptions extends DocGenOptions, Descriptor {
|
20 | validExtends: (fullFilePath: string) => boolean;
|
21 | filePath: string;
|
22 | |
23 |
|
24 |
|
25 |
|
26 | lang?: 'ts' | 'js';
|
27 | }
|
28 | export interface DocGenOptions {
|
29 | |
30 |
|
31 |
|
32 |
|
33 | nameFilter?: string[];
|
34 | |
35 |
|
36 |
|
37 | alias?: {
|
38 | [alias: string]: string | string[];
|
39 | };
|
40 | |
41 |
|
42 |
|
43 | modules?: string[];
|
44 | |
45 |
|
46 |
|
47 | addScriptHandlers?: ScriptHandler[];
|
48 | |
49 |
|
50 |
|
51 | addTemplateHandlers?: TemplateHandler[];
|
52 | |
53 |
|
54 |
|
55 |
|
56 | scriptPreHandlers?: ScriptHandler[];
|
57 | |
58 |
|
59 |
|
60 | scriptHandlers?: ScriptHandler[];
|
61 | |
62 |
|
63 |
|
64 | templateHandlers?: TemplateHandler[];
|
65 | |
66 |
|
67 |
|
68 |
|
69 | jsx?: boolean;
|
70 | |
71 |
|
72 |
|
73 |
|
74 | validExtends?: (fullFilePath: string) => boolean;
|
75 | |
76 |
|
77 |
|
78 | pugOptions?: PugOptions;
|
79 | }
|