@kubb/parser-ts 4.1.4 → 5.0.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -17
- package/dist/chunk--u3MIqq1.js +8 -0
- package/dist/index.cjs +362 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +61 -19
- package/dist/index.js +336 -46
- package/dist/index.js.map +1 -1
- package/package.json +15 -27
- package/src/index.ts +2 -3
- package/src/parserTs.ts +474 -0
- package/src/parserTsx.ts +20 -0
- package/README.md +0 -54
- package/dist/chunk-CTAAG5j7.js +0 -13
- package/dist/factory-BJCGLhSr.d.ts +0 -227
- package/dist/factory-BNDICAoK.cjs +0 -496
- package/dist/factory-BNDICAoK.cjs.map +0 -1
- package/dist/factory-CroRqsMR.js +0 -249
- package/dist/factory-CroRqsMR.js.map +0 -1
- package/dist/factory-DqBZ_C7_.d.cts +0 -227
- package/dist/factory.cjs +0 -36
- package/dist/factory.d.cts +0 -2
- package/dist/factory.d.ts +0 -2
- package/dist/factory.js +0 -3
- package/dist/index.d.cts +0 -25
- package/src/factory.ts +0 -578
- package/src/format.ts +0 -25
- package/src/print.ts +0 -48
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import ts from "typescript";
|
|
2
|
-
|
|
3
|
-
//#region src/factory.d.ts
|
|
4
|
-
declare const modifiers: {
|
|
5
|
-
readonly async: ts.ModifierToken<ts.SyntaxKind.AsyncKeyword>;
|
|
6
|
-
readonly export: ts.ModifierToken<ts.SyntaxKind.ExportKeyword>;
|
|
7
|
-
readonly const: ts.ModifierToken<ts.SyntaxKind.ConstKeyword>;
|
|
8
|
-
readonly static: ts.ModifierToken<ts.SyntaxKind.StaticKeyword>;
|
|
9
|
-
};
|
|
10
|
-
declare const syntaxKind: {
|
|
11
|
-
readonly union: 192;
|
|
12
|
-
};
|
|
13
|
-
declare function createQuestionToken(token?: boolean | ts.QuestionToken): ts.PunctuationToken<ts.SyntaxKind.QuestionToken> | undefined;
|
|
14
|
-
declare function createIntersectionDeclaration({
|
|
15
|
-
nodes,
|
|
16
|
-
withParentheses
|
|
17
|
-
}: {
|
|
18
|
-
nodes: Array<ts.TypeNode>;
|
|
19
|
-
withParentheses?: boolean;
|
|
20
|
-
}): ts.TypeNode | null;
|
|
21
|
-
/**
|
|
22
|
-
* Minimum nodes length of 2
|
|
23
|
-
* @example `string & number`
|
|
24
|
-
*/
|
|
25
|
-
declare function createTupleDeclaration({
|
|
26
|
-
nodes,
|
|
27
|
-
withParentheses
|
|
28
|
-
}: {
|
|
29
|
-
nodes: Array<ts.TypeNode>;
|
|
30
|
-
withParentheses?: boolean;
|
|
31
|
-
}): ts.TypeNode | null;
|
|
32
|
-
declare function createArrayDeclaration({
|
|
33
|
-
nodes
|
|
34
|
-
}: {
|
|
35
|
-
nodes: Array<ts.TypeNode>;
|
|
36
|
-
}): ts.TypeNode | null;
|
|
37
|
-
/**
|
|
38
|
-
* Minimum nodes length of 2
|
|
39
|
-
* @example `string | number`
|
|
40
|
-
*/
|
|
41
|
-
declare function createUnionDeclaration({
|
|
42
|
-
nodes,
|
|
43
|
-
withParentheses
|
|
44
|
-
}: {
|
|
45
|
-
nodes: Array<ts.TypeNode>;
|
|
46
|
-
withParentheses?: boolean;
|
|
47
|
-
}): ts.TypeNode;
|
|
48
|
-
declare function createPropertySignature({
|
|
49
|
-
readOnly,
|
|
50
|
-
modifiers,
|
|
51
|
-
name,
|
|
52
|
-
questionToken,
|
|
53
|
-
type
|
|
54
|
-
}: {
|
|
55
|
-
readOnly?: boolean;
|
|
56
|
-
modifiers?: Array<ts.Modifier>;
|
|
57
|
-
name: ts.PropertyName | string;
|
|
58
|
-
questionToken?: ts.QuestionToken | boolean;
|
|
59
|
-
type?: ts.TypeNode;
|
|
60
|
-
}): ts.PropertySignature;
|
|
61
|
-
declare function createParameterSignature(name: string | ts.BindingName, {
|
|
62
|
-
modifiers,
|
|
63
|
-
dotDotDotToken,
|
|
64
|
-
questionToken,
|
|
65
|
-
type,
|
|
66
|
-
initializer
|
|
67
|
-
}: {
|
|
68
|
-
decorators?: Array<ts.Decorator>;
|
|
69
|
-
modifiers?: Array<ts.Modifier>;
|
|
70
|
-
dotDotDotToken?: ts.DotDotDotToken;
|
|
71
|
-
questionToken?: ts.QuestionToken | boolean;
|
|
72
|
-
type?: ts.TypeNode;
|
|
73
|
-
initializer?: ts.Expression;
|
|
74
|
-
}): ts.ParameterDeclaration;
|
|
75
|
-
declare function createJSDoc({
|
|
76
|
-
comments
|
|
77
|
-
}: {
|
|
78
|
-
comments: string[];
|
|
79
|
-
}): ts.JSDoc | null;
|
|
80
|
-
/**
|
|
81
|
-
* @link https://github.com/microsoft/TypeScript/issues/44151
|
|
82
|
-
*/
|
|
83
|
-
declare function appendJSDocToNode<TNode extends ts.Node>({
|
|
84
|
-
node,
|
|
85
|
-
comments
|
|
86
|
-
}: {
|
|
87
|
-
node: TNode;
|
|
88
|
-
comments: Array<string | undefined>;
|
|
89
|
-
}): TNode;
|
|
90
|
-
declare function createIndexSignature(type: ts.TypeNode, {
|
|
91
|
-
modifiers,
|
|
92
|
-
indexName,
|
|
93
|
-
indexType
|
|
94
|
-
}?: {
|
|
95
|
-
indexName?: string;
|
|
96
|
-
indexType?: ts.TypeNode;
|
|
97
|
-
decorators?: Array<ts.Decorator>;
|
|
98
|
-
modifiers?: Array<ts.Modifier>;
|
|
99
|
-
}): ts.IndexSignatureDeclaration;
|
|
100
|
-
declare function createTypeAliasDeclaration({
|
|
101
|
-
modifiers,
|
|
102
|
-
name,
|
|
103
|
-
typeParameters,
|
|
104
|
-
type
|
|
105
|
-
}: {
|
|
106
|
-
modifiers?: Array<ts.Modifier>;
|
|
107
|
-
name: string | ts.Identifier;
|
|
108
|
-
typeParameters?: Array<ts.TypeParameterDeclaration>;
|
|
109
|
-
type: ts.TypeNode;
|
|
110
|
-
}): ts.TypeAliasDeclaration;
|
|
111
|
-
declare function createInterfaceDeclaration({
|
|
112
|
-
modifiers,
|
|
113
|
-
name,
|
|
114
|
-
typeParameters,
|
|
115
|
-
members
|
|
116
|
-
}: {
|
|
117
|
-
modifiers?: Array<ts.Modifier>;
|
|
118
|
-
name: string | ts.Identifier;
|
|
119
|
-
typeParameters?: Array<ts.TypeParameterDeclaration>;
|
|
120
|
-
members: Array<ts.TypeElement>;
|
|
121
|
-
}): ts.InterfaceDeclaration;
|
|
122
|
-
declare function createTypeDeclaration({
|
|
123
|
-
syntax,
|
|
124
|
-
isExportable,
|
|
125
|
-
comments,
|
|
126
|
-
name,
|
|
127
|
-
type
|
|
128
|
-
}: {
|
|
129
|
-
syntax: 'type' | 'interface';
|
|
130
|
-
comments: Array<string | undefined>;
|
|
131
|
-
isExportable?: boolean;
|
|
132
|
-
name: string | ts.Identifier;
|
|
133
|
-
type: ts.TypeNode;
|
|
134
|
-
}): ts.TypeAliasDeclaration | ts.InterfaceDeclaration;
|
|
135
|
-
declare function createNamespaceDeclaration({
|
|
136
|
-
statements,
|
|
137
|
-
name
|
|
138
|
-
}: {
|
|
139
|
-
name: string;
|
|
140
|
-
statements: ts.Statement[];
|
|
141
|
-
}): ts.ModuleDeclaration;
|
|
142
|
-
/**
|
|
143
|
-
* In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.
|
|
144
|
-
* @example `import { Pet as Cat } from './Pet'`
|
|
145
|
-
*/
|
|
146
|
-
declare function createImportDeclaration({
|
|
147
|
-
name,
|
|
148
|
-
path,
|
|
149
|
-
isTypeOnly,
|
|
150
|
-
isNameSpace
|
|
151
|
-
}: {
|
|
152
|
-
name: string | Array<string | {
|
|
153
|
-
propertyName: string;
|
|
154
|
-
name?: string;
|
|
155
|
-
}>;
|
|
156
|
-
path: string;
|
|
157
|
-
isTypeOnly?: boolean;
|
|
158
|
-
isNameSpace?: boolean;
|
|
159
|
-
}): ts.ImportDeclaration;
|
|
160
|
-
declare function createExportDeclaration({
|
|
161
|
-
path,
|
|
162
|
-
asAlias,
|
|
163
|
-
isTypeOnly,
|
|
164
|
-
name
|
|
165
|
-
}: {
|
|
166
|
-
path: string;
|
|
167
|
-
asAlias?: boolean;
|
|
168
|
-
isTypeOnly?: boolean;
|
|
169
|
-
name?: string | Array<ts.Identifier | string>;
|
|
170
|
-
}): ts.ExportDeclaration;
|
|
171
|
-
declare function createEnumDeclaration({
|
|
172
|
-
type,
|
|
173
|
-
name,
|
|
174
|
-
typeName,
|
|
175
|
-
enums
|
|
176
|
-
}: {
|
|
177
|
-
/**
|
|
178
|
-
* @default `'enum'`
|
|
179
|
-
*/
|
|
180
|
-
type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
181
|
-
/**
|
|
182
|
-
* Enum name in camelCase.
|
|
183
|
-
*/
|
|
184
|
-
name: string;
|
|
185
|
-
/**
|
|
186
|
-
* Enum name in PascalCase.
|
|
187
|
-
*/
|
|
188
|
-
typeName: string;
|
|
189
|
-
enums: [key: string | number, value: string | number | boolean][];
|
|
190
|
-
}): [name: ts.Node | undefined, type: ts.Node];
|
|
191
|
-
declare function createOmitDeclaration({
|
|
192
|
-
keys,
|
|
193
|
-
type,
|
|
194
|
-
nonNullable
|
|
195
|
-
}: {
|
|
196
|
-
keys: Array<string> | string;
|
|
197
|
-
type: ts.TypeNode;
|
|
198
|
-
nonNullable?: boolean;
|
|
199
|
-
}): ts.TypeReferenceNode;
|
|
200
|
-
declare const keywordTypeNodes: {
|
|
201
|
-
readonly any: ts.KeywordTypeNode<ts.SyntaxKind.AnyKeyword>;
|
|
202
|
-
readonly unknown: ts.KeywordTypeNode<ts.SyntaxKind.UnknownKeyword>;
|
|
203
|
-
readonly void: ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword>;
|
|
204
|
-
readonly number: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
|
|
205
|
-
readonly integer: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
|
|
206
|
-
readonly object: ts.KeywordTypeNode<ts.SyntaxKind.ObjectKeyword>;
|
|
207
|
-
readonly string: ts.KeywordTypeNode<ts.SyntaxKind.StringKeyword>;
|
|
208
|
-
readonly boolean: ts.KeywordTypeNode<ts.SyntaxKind.BooleanKeyword>;
|
|
209
|
-
readonly undefined: ts.KeywordTypeNode<ts.SyntaxKind.UndefinedKeyword>;
|
|
210
|
-
readonly null: ts.LiteralTypeNode;
|
|
211
|
-
};
|
|
212
|
-
declare const createTypeLiteralNode: (members: readonly ts.TypeElement[] | undefined) => ts.TypeLiteralNode;
|
|
213
|
-
declare const createTypeReferenceNode: (typeName: string | ts.EntityName, typeArguments?: readonly ts.TypeNode[]) => ts.TypeReferenceNode;
|
|
214
|
-
declare const createNumericLiteral: (value: string | number, numericLiteralFlags?: ts.TokenFlags) => ts.NumericLiteral;
|
|
215
|
-
declare const createStringLiteral: (text: string, isSingleQuote?: boolean) => ts.StringLiteral;
|
|
216
|
-
declare const createArrayTypeNode: (elementType: ts.TypeNode) => ts.ArrayTypeNode;
|
|
217
|
-
declare const createLiteralTypeNode: (literal: ts.LiteralTypeNode["literal"]) => ts.LiteralTypeNode;
|
|
218
|
-
declare const createNull: () => ts.NullLiteral;
|
|
219
|
-
declare const createIdentifier: (text: string) => ts.Identifier;
|
|
220
|
-
declare const createOptionalTypeNode: (type: ts.TypeNode) => ts.OptionalTypeNode;
|
|
221
|
-
declare const createTupleTypeNode: (elements: readonly (ts.TypeNode | ts.NamedTupleMember)[]) => ts.TupleTypeNode;
|
|
222
|
-
declare const createRestTypeNode: (type: ts.TypeNode) => ts.RestTypeNode;
|
|
223
|
-
declare const createTrue: () => ts.TrueLiteral;
|
|
224
|
-
declare const createFalse: () => ts.FalseLiteral;
|
|
225
|
-
//#endregion
|
|
226
|
-
export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createInterfaceDeclaration, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createOptionalTypeNode, createParameterSignature, createPropertySignature, createQuestionToken, createRestTypeNode, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, factory_d_exports, keywordTypeNodes, modifiers, syntaxKind };
|
|
227
|
-
//# sourceMappingURL=factory-BJCGLhSr.d.ts.map
|