@kubb/parser-ts 3.16.1 → 3.16.3
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/dist/chunk-Cl8Af3a2.js +11 -0
- package/dist/factory-CTKjALU5.js +254 -0
- package/dist/factory-CTKjALU5.js.map +1 -0
- package/dist/factory-CUjjpSgy.d.ts +230 -0
- package/dist/factory-DeJMlphM.cjs +497 -0
- package/dist/factory-DeJMlphM.cjs.map +1 -0
- package/dist/factory-_F-JTqnG.d.cts +230 -0
- package/dist/factory.cjs +35 -143
- package/dist/factory.d.cts +2 -2
- package/dist/factory.d.ts +2 -2
- package/dist/factory.js +3 -3
- package/dist/index.cjs +55 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -9
- package/dist/index.d.ts +19 -9
- package/dist/index.js +51 -32
- package/dist/index.js.map +1 -1
- package/package.json +13 -17
- package/src/factory.ts +3 -3
- package/dist/chunk-BEHWCDCH.js +0 -461
- package/dist/chunk-BEHWCDCH.js.map +0 -1
- package/dist/chunk-FIHRQE7D.cjs +0 -501
- package/dist/chunk-FIHRQE7D.cjs.map +0 -1
- package/dist/factory-Cn6Avpxk.d.cts +0 -193
- package/dist/factory-Cn6Avpxk.d.ts +0 -193
- package/dist/factory.cjs.map +0 -1
- package/dist/factory.js.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { isNumber } from "remeda";
|
|
4
|
+
|
|
5
|
+
//#region src/factory.ts
|
|
6
|
+
var factory_exports = {};
|
|
7
|
+
__export(factory_exports, {
|
|
8
|
+
appendJSDocToNode: () => appendJSDocToNode,
|
|
9
|
+
createArrayDeclaration: () => createArrayDeclaration,
|
|
10
|
+
createArrayTypeNode: () => createArrayTypeNode,
|
|
11
|
+
createEnumDeclaration: () => createEnumDeclaration,
|
|
12
|
+
createExportDeclaration: () => createExportDeclaration,
|
|
13
|
+
createFalse: () => createFalse,
|
|
14
|
+
createIdentifier: () => createIdentifier,
|
|
15
|
+
createImportDeclaration: () => createImportDeclaration,
|
|
16
|
+
createIndexSignature: () => createIndexSignature,
|
|
17
|
+
createInterfaceDeclaration: () => createInterfaceDeclaration,
|
|
18
|
+
createIntersectionDeclaration: () => createIntersectionDeclaration,
|
|
19
|
+
createJSDoc: () => createJSDoc,
|
|
20
|
+
createLiteralTypeNode: () => createLiteralTypeNode,
|
|
21
|
+
createNamespaceDeclaration: () => createNamespaceDeclaration,
|
|
22
|
+
createNull: () => createNull,
|
|
23
|
+
createNumericLiteral: () => createNumericLiteral,
|
|
24
|
+
createOmitDeclaration: () => createOmitDeclaration,
|
|
25
|
+
createOptionalTypeNode: () => createOptionalTypeNode,
|
|
26
|
+
createParameterSignature: () => createParameterSignature,
|
|
27
|
+
createPropertySignature: () => createPropertySignature,
|
|
28
|
+
createQuestionToken: () => createQuestionToken,
|
|
29
|
+
createRestTypeNode: () => createRestTypeNode,
|
|
30
|
+
createStringLiteral: () => createStringLiteral,
|
|
31
|
+
createTrue: () => createTrue,
|
|
32
|
+
createTupleDeclaration: () => createTupleDeclaration,
|
|
33
|
+
createTupleTypeNode: () => createTupleTypeNode,
|
|
34
|
+
createTypeAliasDeclaration: () => createTypeAliasDeclaration,
|
|
35
|
+
createTypeDeclaration: () => createTypeDeclaration,
|
|
36
|
+
createTypeLiteralNode: () => createTypeLiteralNode,
|
|
37
|
+
createTypeReferenceNode: () => createTypeReferenceNode,
|
|
38
|
+
createUnionDeclaration: () => createUnionDeclaration,
|
|
39
|
+
keywordTypeNodes: () => keywordTypeNodes,
|
|
40
|
+
modifiers: () => modifiers,
|
|
41
|
+
syntaxKind: () => syntaxKind
|
|
42
|
+
});
|
|
43
|
+
const { SyntaxKind, factory } = ts;
|
|
44
|
+
const modifiers = {
|
|
45
|
+
async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),
|
|
46
|
+
export: factory.createModifier(ts.SyntaxKind.ExportKeyword),
|
|
47
|
+
const: factory.createModifier(ts.SyntaxKind.ConstKeyword),
|
|
48
|
+
static: factory.createModifier(ts.SyntaxKind.StaticKeyword)
|
|
49
|
+
};
|
|
50
|
+
const syntaxKind = { union: SyntaxKind.UnionType };
|
|
51
|
+
function isValidIdentifier(str) {
|
|
52
|
+
if (!str.length || str.trim() !== str) return false;
|
|
53
|
+
const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest);
|
|
54
|
+
return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind) === void 0;
|
|
55
|
+
}
|
|
56
|
+
function propertyName(name) {
|
|
57
|
+
if (typeof name === "string") return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name);
|
|
58
|
+
return name;
|
|
59
|
+
}
|
|
60
|
+
const questionToken = factory.createToken(ts.SyntaxKind.QuestionToken);
|
|
61
|
+
function createQuestionToken(token) {
|
|
62
|
+
if (!token) return void 0;
|
|
63
|
+
if (token === true) return questionToken;
|
|
64
|
+
return token;
|
|
65
|
+
}
|
|
66
|
+
function createIntersectionDeclaration({ nodes, withParentheses }) {
|
|
67
|
+
if (!nodes.length) return null;
|
|
68
|
+
if (nodes.length === 1) return nodes[0] || null;
|
|
69
|
+
const node = factory.createIntersectionTypeNode(nodes);
|
|
70
|
+
if (withParentheses) return factory.createParenthesizedType(node);
|
|
71
|
+
return node;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Minimum nodes length of 2
|
|
75
|
+
* @example `string & number`
|
|
76
|
+
*/
|
|
77
|
+
function createTupleDeclaration({ nodes, withParentheses }) {
|
|
78
|
+
if (!nodes.length) return null;
|
|
79
|
+
if (nodes.length === 1) return nodes[0] || null;
|
|
80
|
+
const node = factory.createTupleTypeNode(nodes);
|
|
81
|
+
if (withParentheses) return factory.createParenthesizedType(node);
|
|
82
|
+
return node;
|
|
83
|
+
}
|
|
84
|
+
function createArrayDeclaration({ nodes }) {
|
|
85
|
+
if (!nodes.length) return factory.createTupleTypeNode([]);
|
|
86
|
+
if (nodes.length === 1) return factory.createArrayTypeNode(nodes.at(0));
|
|
87
|
+
return factory.createExpressionWithTypeArguments(factory.createIdentifier("Array"), [factory.createUnionTypeNode(nodes)]);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Minimum nodes length of 2
|
|
91
|
+
* @example `string | number`
|
|
92
|
+
*/
|
|
93
|
+
function createUnionDeclaration({ nodes, withParentheses }) {
|
|
94
|
+
if (!nodes.length) return keywordTypeNodes.any;
|
|
95
|
+
if (nodes.length === 1) return nodes[0];
|
|
96
|
+
const node = factory.createUnionTypeNode(nodes);
|
|
97
|
+
if (withParentheses) return factory.createParenthesizedType(node);
|
|
98
|
+
return node;
|
|
99
|
+
}
|
|
100
|
+
function createPropertySignature({ readOnly, modifiers: modifiers$1 = [], name, questionToken: questionToken$1, type }) {
|
|
101
|
+
return factory.createPropertySignature([...modifiers$1, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean), propertyName(name), createQuestionToken(questionToken$1), type);
|
|
102
|
+
}
|
|
103
|
+
function createParameterSignature(name, { modifiers: modifiers$1, dotDotDotToken, questionToken: questionToken$1, type, initializer }) {
|
|
104
|
+
return factory.createParameterDeclaration(modifiers$1, dotDotDotToken, name, createQuestionToken(questionToken$1), type, initializer);
|
|
105
|
+
}
|
|
106
|
+
function createJSDoc({ comments }) {
|
|
107
|
+
if (!comments.length) return null;
|
|
108
|
+
return factory.createJSDocComment(factory.createNodeArray(comments.map((comment, i) => {
|
|
109
|
+
if (i === comments.length - 1) return factory.createJSDocText(comment);
|
|
110
|
+
return factory.createJSDocText(`${comment}\n`);
|
|
111
|
+
})));
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* @link https://github.com/microsoft/TypeScript/issues/44151
|
|
115
|
+
*/
|
|
116
|
+
function appendJSDocToNode({ node, comments }) {
|
|
117
|
+
const filteredComments = comments.filter(Boolean);
|
|
118
|
+
if (!filteredComments.length) return node;
|
|
119
|
+
const text = filteredComments.reduce((acc = "", comment = "") => {
|
|
120
|
+
return `${acc}\n * ${comment.replaceAll("*/", "*\\/")}`;
|
|
121
|
+
}, "*");
|
|
122
|
+
return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || "*"}\n`, true);
|
|
123
|
+
}
|
|
124
|
+
function createIndexSignature(type, { modifiers: modifiers$1, indexName = "key", indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword) } = {}) {
|
|
125
|
+
return factory.createIndexSignature(modifiers$1, [createParameterSignature(indexName, { type: indexType })], type);
|
|
126
|
+
}
|
|
127
|
+
function createTypeAliasDeclaration({ modifiers: modifiers$1, name, typeParameters, type }) {
|
|
128
|
+
return factory.createTypeAliasDeclaration(modifiers$1, name, typeParameters, type);
|
|
129
|
+
}
|
|
130
|
+
function createInterfaceDeclaration({ modifiers: modifiers$1, name, typeParameters, members }) {
|
|
131
|
+
return factory.createInterfaceDeclaration(modifiers$1, name, typeParameters, void 0, members);
|
|
132
|
+
}
|
|
133
|
+
function createTypeDeclaration({ syntax, isExportable, comments, name, type }) {
|
|
134
|
+
if (syntax === "interface" && "members" in type) {
|
|
135
|
+
const node$1 = createInterfaceDeclaration({
|
|
136
|
+
members: type.members,
|
|
137
|
+
modifiers: isExportable ? [modifiers.export] : [],
|
|
138
|
+
name,
|
|
139
|
+
typeParameters: void 0
|
|
140
|
+
});
|
|
141
|
+
return appendJSDocToNode({
|
|
142
|
+
node: node$1,
|
|
143
|
+
comments
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
const node = createTypeAliasDeclaration({
|
|
147
|
+
type,
|
|
148
|
+
modifiers: isExportable ? [modifiers.export] : [],
|
|
149
|
+
name,
|
|
150
|
+
typeParameters: void 0
|
|
151
|
+
});
|
|
152
|
+
return appendJSDocToNode({
|
|
153
|
+
node,
|
|
154
|
+
comments
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function createNamespaceDeclaration({ statements, name }) {
|
|
158
|
+
return factory.createModuleDeclaration([factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(name), factory.createModuleBlock(statements), ts.NodeFlags.Namespace);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.
|
|
162
|
+
* @example `import { Pet as Cat } from './Pet'`
|
|
163
|
+
*/
|
|
164
|
+
function createImportDeclaration({ name, path, isTypeOnly = false, isNameSpace = false }) {
|
|
165
|
+
if (!Array.isArray(name)) {
|
|
166
|
+
let importPropertyName = factory.createIdentifier(name);
|
|
167
|
+
let importName;
|
|
168
|
+
if (isNameSpace) {
|
|
169
|
+
importPropertyName = void 0;
|
|
170
|
+
importName = factory.createNamespaceImport(factory.createIdentifier(name));
|
|
171
|
+
}
|
|
172
|
+
return factory.createImportDeclaration(void 0, factory.createImportClause(isTypeOnly, importPropertyName, importName), factory.createStringLiteral(path), void 0);
|
|
173
|
+
}
|
|
174
|
+
return factory.createImportDeclaration(void 0, factory.createImportClause(isTypeOnly, void 0, factory.createNamedImports(name.map((item) => {
|
|
175
|
+
if (typeof item === "object") {
|
|
176
|
+
const obj = item;
|
|
177
|
+
if (obj.name) return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name));
|
|
178
|
+
return factory.createImportSpecifier(false, void 0, factory.createIdentifier(obj.propertyName));
|
|
179
|
+
}
|
|
180
|
+
return factory.createImportSpecifier(false, void 0, factory.createIdentifier(item));
|
|
181
|
+
}))), factory.createStringLiteral(path), void 0);
|
|
182
|
+
}
|
|
183
|
+
function createExportDeclaration({ path, asAlias, isTypeOnly = false, name }) {
|
|
184
|
+
if (name && !Array.isArray(name) && !asAlias) console.warn(`When using name as string, asAlias should be true ${name}`);
|
|
185
|
+
if (!Array.isArray(name)) {
|
|
186
|
+
const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
|
|
187
|
+
return factory.createExportDeclaration(void 0, isTypeOnly, asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : void 0, factory.createStringLiteral(path), void 0);
|
|
188
|
+
}
|
|
189
|
+
return factory.createExportDeclaration(void 0, isTypeOnly, factory.createNamedExports(name.map((propertyName$1) => {
|
|
190
|
+
return factory.createExportSpecifier(false, void 0, typeof propertyName$1 === "string" ? factory.createIdentifier(propertyName$1) : propertyName$1);
|
|
191
|
+
})), factory.createStringLiteral(path), void 0);
|
|
192
|
+
}
|
|
193
|
+
function createEnumDeclaration({ type = "enum", name, typeName, enums }) {
|
|
194
|
+
if (type === "literal") return [void 0, factory.createTypeAliasDeclaration([factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(typeName), void 0, factory.createUnionTypeNode(enums.map(([_key, value]) => {
|
|
195
|
+
if (isNumber(value)) return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()));
|
|
196
|
+
if (typeof value === "boolean") return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse());
|
|
197
|
+
if (value) return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()));
|
|
198
|
+
return void 0;
|
|
199
|
+
}).filter(Boolean)))];
|
|
200
|
+
if (type === "enum" || type === "constEnum") return [void 0, factory.createEnumDeclaration([factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0].filter(Boolean), factory.createIdentifier(typeName), enums.map(([key, value]) => {
|
|
201
|
+
let initializer = factory.createStringLiteral(value?.toString());
|
|
202
|
+
const isExactNumber = Number.parseInt(value.toString(), 10) === value;
|
|
203
|
+
if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) initializer = factory.createNumericLiteral(value);
|
|
204
|
+
if (typeof value === "boolean") initializer = value ? factory.createTrue() : factory.createFalse();
|
|
205
|
+
if (isNumber(Number.parseInt(key.toString(), 10))) return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer);
|
|
206
|
+
if (key) return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer);
|
|
207
|
+
return void 0;
|
|
208
|
+
}).filter(Boolean))];
|
|
209
|
+
const identifierName = type === "asPascalConst" ? typeName : name;
|
|
210
|
+
return [factory.createVariableStatement([factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createVariableDeclarationList([factory.createVariableDeclaration(factory.createIdentifier(identifierName), void 0, void 0, factory.createAsExpression(factory.createObjectLiteralExpression(enums.map(([key, value]) => {
|
|
211
|
+
let initializer = factory.createStringLiteral(value?.toString());
|
|
212
|
+
if (isNumber(value)) if (value < 0) initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)));
|
|
213
|
+
else initializer = factory.createNumericLiteral(value);
|
|
214
|
+
if (typeof value === "boolean") initializer = value ? factory.createTrue() : factory.createFalse();
|
|
215
|
+
if (key) return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer);
|
|
216
|
+
return void 0;
|
|
217
|
+
}).filter(Boolean), true), factory.createTypeReferenceNode(factory.createIdentifier("const"), void 0)))], ts.NodeFlags.Const)), factory.createTypeAliasDeclaration(type === "asPascalConst" ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)], factory.createIdentifier(typeName), void 0, factory.createIndexedAccessTypeNode(factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)), factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))))];
|
|
218
|
+
}
|
|
219
|
+
function createOmitDeclaration({ keys, type, nonNullable }) {
|
|
220
|
+
const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier("NonNullable"), [type]) : type;
|
|
221
|
+
if (Array.isArray(keys)) return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createUnionTypeNode(keys.map((key) => {
|
|
222
|
+
return factory.createLiteralTypeNode(factory.createStringLiteral(key));
|
|
223
|
+
}))]);
|
|
224
|
+
return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]);
|
|
225
|
+
}
|
|
226
|
+
const keywordTypeNodes = {
|
|
227
|
+
any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
|
|
228
|
+
unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),
|
|
229
|
+
void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),
|
|
230
|
+
number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
|
|
231
|
+
integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
|
|
232
|
+
object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),
|
|
233
|
+
string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
|
|
234
|
+
boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),
|
|
235
|
+
undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
|
|
236
|
+
null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword))
|
|
237
|
+
};
|
|
238
|
+
const createTypeLiteralNode = factory.createTypeLiteralNode;
|
|
239
|
+
const createTypeReferenceNode = factory.createTypeReferenceNode;
|
|
240
|
+
const createNumericLiteral = factory.createNumericLiteral;
|
|
241
|
+
const createStringLiteral = factory.createStringLiteral;
|
|
242
|
+
const createArrayTypeNode = factory.createArrayTypeNode;
|
|
243
|
+
const createLiteralTypeNode = factory.createLiteralTypeNode;
|
|
244
|
+
const createNull = factory.createNull;
|
|
245
|
+
const createIdentifier = factory.createIdentifier;
|
|
246
|
+
const createOptionalTypeNode = factory.createOptionalTypeNode;
|
|
247
|
+
const createTupleTypeNode = factory.createTupleTypeNode;
|
|
248
|
+
const createRestTypeNode = factory.createRestTypeNode;
|
|
249
|
+
const createTrue = factory.createTrue;
|
|
250
|
+
const createFalse = factory.createFalse;
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
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_exports, keywordTypeNodes, modifiers, syntaxKind };
|
|
254
|
+
//# sourceMappingURL=factory-CTKjALU5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-CTKjALU5.js","names":["str: string","name: string | ts.PropertyName","token?: boolean | ts.QuestionToken","modifiers","questionToken","name: string | ts.BindingName","type: ts.TypeNode","node","importPropertyName: ts.Identifier | undefined","importName: ts.NamedImportBindings | undefined","propertyName","initializer: ts.Expression"],"sources":["../src/factory.ts"],"sourcesContent":["import { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { SyntaxKind, factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nexport const syntaxKind = {\n union: SyntaxKind.UnionType as 192,\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({ nodes }: { nodes: Array<ts.TypeNode> }): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({ nodes, withParentheses }: { nodes: Array<ts.TypeNode>; withParentheses?: boolean }): ts.TypeNode {\n if (!nodes.length) {\n return keywordTypeNodes.any\n }\n\n if (nodes.length === 1) {\n return nodes[0] as ts.TypeNode\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({ node, comments }: { node: TNode; comments: Array<string | undefined> }) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment.replaceAll('*/', '*\\\\/')}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createInterfaceDeclaration({\n modifiers,\n name,\n typeParameters,\n members,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n members: Array<ts.TypeElement>\n}) {\n return factory.createInterfaceDeclaration(modifiers, name, typeParameters, undefined, members)\n}\n\nexport function createTypeDeclaration({\n syntax,\n isExportable,\n comments,\n name,\n type,\n}: {\n syntax: 'type' | 'interface'\n comments: Array<string | undefined>\n isExportable?: boolean\n name: string | ts.Identifier\n type: ts.TypeNode\n}) {\n if (syntax === 'interface' && 'members' in type) {\n const node = createInterfaceDeclaration({\n members: type.members as Array<ts.TypeElement>,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n }\n\n const node = createTypeAliasDeclaration({\n type,\n modifiers: isExportable ? [modifiers.export] : [],\n name,\n typeParameters: undefined,\n })\n\n return appendJSDocToNode({\n node,\n comments,\n })\n}\n\nexport function createNamespaceDeclaration({ statements, name }: { name: string; statements: ts.Statement[] }) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n name.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n name.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n const isExactNumber = Number.parseInt(value.toString(), 10) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString(), 10))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString(), 10))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({ keys, type, nonNullable }: { keys: Array<string> | string; type: ts.TypeNode; nonNullable?: boolean }) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createOptionalTypeNode = factory.createOptionalTypeNode\nexport const createTupleTypeNode = factory.createTupleTypeNode\nexport const createRestTypeNode = factory.createRestTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,EAAE,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SAAS,QAAQ,sBAAsB,GAAG,WAAW,eAAe;CACpE,MAAM,QAAQ,sBAAsB,GAAG,WAAW,YAAY;CAC9D,QAAQ,QAAQ,sBAAsB,GAAG,WAAW,cAAc;CAClE,SAAS,QAAQ,sBAAsB,GAAG,WAAW,cAAc;CACnE,QAAQ,QAAQ,sBAAsB,GAAG,WAAW,cAAc;CAClE,QAAQ,QAAQ,sBAAsB,GAAG,WAAW,cAAc;CAClE,SAAS,QAAQ,sBAAsB,GAAG,WAAW,eAAe;CACpE,WAAW,QAAQ,sBAAsB,GAAG,WAAW,iBAAiB;CACxE,MAAM,QAAQ,sBAAsB,QAAQ,YAAY,GAAG,WAAW,YAAY,CAAC;AACpF;AAED,MAAa,wBAAwB,QAAQ;AAE7C,MAAa,0BAA0B,QAAQ;AAC/C,MAAa,uBAAuB,QAAQ;AAC5C,MAAa,sBAAsB,QAAQ;AAE3C,MAAa,sBAAsB,QAAQ;AAE3C,MAAa,wBAAwB,QAAQ;AAC7C,MAAa,aAAa,QAAQ;AAClC,MAAa,mBAAmB,QAAQ;AAExC,MAAa,yBAAyB,QAAQ;AAC9C,MAAa,sBAAsB,QAAQ;AAC3C,MAAa,qBAAqB,QAAQ;AAC1C,MAAa,aAAa,QAAQ;AAClC,MAAa,cAAc,QAAQ"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
|
|
3
|
+
//#region src/factory.d.ts
|
|
4
|
+
declare namespace factory_d_exports {
|
|
5
|
+
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, keywordTypeNodes, modifiers, syntaxKind };
|
|
6
|
+
}
|
|
7
|
+
declare const modifiers: {
|
|
8
|
+
readonly async: ts.ModifierToken<ts.SyntaxKind.AsyncKeyword>;
|
|
9
|
+
readonly export: ts.ModifierToken<ts.SyntaxKind.ExportKeyword>;
|
|
10
|
+
readonly const: ts.ModifierToken<ts.SyntaxKind.ConstKeyword>;
|
|
11
|
+
readonly static: ts.ModifierToken<ts.SyntaxKind.StaticKeyword>;
|
|
12
|
+
};
|
|
13
|
+
declare const syntaxKind: {
|
|
14
|
+
readonly union: 192;
|
|
15
|
+
};
|
|
16
|
+
declare function createQuestionToken(token?: boolean | ts.QuestionToken): ts.PunctuationToken<ts.SyntaxKind.QuestionToken> | undefined;
|
|
17
|
+
declare function createIntersectionDeclaration({
|
|
18
|
+
nodes,
|
|
19
|
+
withParentheses
|
|
20
|
+
}: {
|
|
21
|
+
nodes: Array<ts.TypeNode>;
|
|
22
|
+
withParentheses?: boolean;
|
|
23
|
+
}): ts.TypeNode | null;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum nodes length of 2
|
|
26
|
+
* @example `string & number`
|
|
27
|
+
*/
|
|
28
|
+
declare function createTupleDeclaration({
|
|
29
|
+
nodes,
|
|
30
|
+
withParentheses
|
|
31
|
+
}: {
|
|
32
|
+
nodes: Array<ts.TypeNode>;
|
|
33
|
+
withParentheses?: boolean;
|
|
34
|
+
}): ts.TypeNode | null;
|
|
35
|
+
declare function createArrayDeclaration({
|
|
36
|
+
nodes
|
|
37
|
+
}: {
|
|
38
|
+
nodes: Array<ts.TypeNode>;
|
|
39
|
+
}): ts.TypeNode | null;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum nodes length of 2
|
|
42
|
+
* @example `string | number`
|
|
43
|
+
*/
|
|
44
|
+
declare function createUnionDeclaration({
|
|
45
|
+
nodes,
|
|
46
|
+
withParentheses
|
|
47
|
+
}: {
|
|
48
|
+
nodes: Array<ts.TypeNode>;
|
|
49
|
+
withParentheses?: boolean;
|
|
50
|
+
}): ts.TypeNode;
|
|
51
|
+
declare function createPropertySignature({
|
|
52
|
+
readOnly,
|
|
53
|
+
modifiers,
|
|
54
|
+
name,
|
|
55
|
+
questionToken,
|
|
56
|
+
type
|
|
57
|
+
}: {
|
|
58
|
+
readOnly?: boolean;
|
|
59
|
+
modifiers?: Array<ts.Modifier>;
|
|
60
|
+
name: ts.PropertyName | string;
|
|
61
|
+
questionToken?: ts.QuestionToken | boolean;
|
|
62
|
+
type?: ts.TypeNode;
|
|
63
|
+
}): ts.PropertySignature;
|
|
64
|
+
declare function createParameterSignature(name: string | ts.BindingName, {
|
|
65
|
+
modifiers,
|
|
66
|
+
dotDotDotToken,
|
|
67
|
+
questionToken,
|
|
68
|
+
type,
|
|
69
|
+
initializer
|
|
70
|
+
}: {
|
|
71
|
+
decorators?: Array<ts.Decorator>;
|
|
72
|
+
modifiers?: Array<ts.Modifier>;
|
|
73
|
+
dotDotDotToken?: ts.DotDotDotToken;
|
|
74
|
+
questionToken?: ts.QuestionToken | boolean;
|
|
75
|
+
type?: ts.TypeNode;
|
|
76
|
+
initializer?: ts.Expression;
|
|
77
|
+
}): ts.ParameterDeclaration;
|
|
78
|
+
declare function createJSDoc({
|
|
79
|
+
comments
|
|
80
|
+
}: {
|
|
81
|
+
comments: string[];
|
|
82
|
+
}): ts.JSDoc | null;
|
|
83
|
+
/**
|
|
84
|
+
* @link https://github.com/microsoft/TypeScript/issues/44151
|
|
85
|
+
*/
|
|
86
|
+
declare function appendJSDocToNode<TNode extends ts.Node>({
|
|
87
|
+
node,
|
|
88
|
+
comments
|
|
89
|
+
}: {
|
|
90
|
+
node: TNode;
|
|
91
|
+
comments: Array<string | undefined>;
|
|
92
|
+
}): TNode;
|
|
93
|
+
declare function createIndexSignature(type: ts.TypeNode, {
|
|
94
|
+
modifiers,
|
|
95
|
+
indexName,
|
|
96
|
+
indexType
|
|
97
|
+
}?: {
|
|
98
|
+
indexName?: string;
|
|
99
|
+
indexType?: ts.TypeNode;
|
|
100
|
+
decorators?: Array<ts.Decorator>;
|
|
101
|
+
modifiers?: Array<ts.Modifier>;
|
|
102
|
+
}): ts.IndexSignatureDeclaration;
|
|
103
|
+
declare function createTypeAliasDeclaration({
|
|
104
|
+
modifiers,
|
|
105
|
+
name,
|
|
106
|
+
typeParameters,
|
|
107
|
+
type
|
|
108
|
+
}: {
|
|
109
|
+
modifiers?: Array<ts.Modifier>;
|
|
110
|
+
name: string | ts.Identifier;
|
|
111
|
+
typeParameters?: Array<ts.TypeParameterDeclaration>;
|
|
112
|
+
type: ts.TypeNode;
|
|
113
|
+
}): ts.TypeAliasDeclaration;
|
|
114
|
+
declare function createInterfaceDeclaration({
|
|
115
|
+
modifiers,
|
|
116
|
+
name,
|
|
117
|
+
typeParameters,
|
|
118
|
+
members
|
|
119
|
+
}: {
|
|
120
|
+
modifiers?: Array<ts.Modifier>;
|
|
121
|
+
name: string | ts.Identifier;
|
|
122
|
+
typeParameters?: Array<ts.TypeParameterDeclaration>;
|
|
123
|
+
members: Array<ts.TypeElement>;
|
|
124
|
+
}): ts.InterfaceDeclaration;
|
|
125
|
+
declare function createTypeDeclaration({
|
|
126
|
+
syntax,
|
|
127
|
+
isExportable,
|
|
128
|
+
comments,
|
|
129
|
+
name,
|
|
130
|
+
type
|
|
131
|
+
}: {
|
|
132
|
+
syntax: 'type' | 'interface';
|
|
133
|
+
comments: Array<string | undefined>;
|
|
134
|
+
isExportable?: boolean;
|
|
135
|
+
name: string | ts.Identifier;
|
|
136
|
+
type: ts.TypeNode;
|
|
137
|
+
}): ts.TypeAliasDeclaration | ts.InterfaceDeclaration;
|
|
138
|
+
declare function createNamespaceDeclaration({
|
|
139
|
+
statements,
|
|
140
|
+
name
|
|
141
|
+
}: {
|
|
142
|
+
name: string;
|
|
143
|
+
statements: ts.Statement[];
|
|
144
|
+
}): ts.ModuleDeclaration;
|
|
145
|
+
/**
|
|
146
|
+
* In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.
|
|
147
|
+
* @example `import { Pet as Cat } from './Pet'`
|
|
148
|
+
*/
|
|
149
|
+
declare function createImportDeclaration({
|
|
150
|
+
name,
|
|
151
|
+
path,
|
|
152
|
+
isTypeOnly,
|
|
153
|
+
isNameSpace
|
|
154
|
+
}: {
|
|
155
|
+
name: string | Array<string | {
|
|
156
|
+
propertyName: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
}>;
|
|
159
|
+
path: string;
|
|
160
|
+
isTypeOnly?: boolean;
|
|
161
|
+
isNameSpace?: boolean;
|
|
162
|
+
}): ts.ImportDeclaration;
|
|
163
|
+
declare function createExportDeclaration({
|
|
164
|
+
path,
|
|
165
|
+
asAlias,
|
|
166
|
+
isTypeOnly,
|
|
167
|
+
name
|
|
168
|
+
}: {
|
|
169
|
+
path: string;
|
|
170
|
+
asAlias?: boolean;
|
|
171
|
+
isTypeOnly?: boolean;
|
|
172
|
+
name?: string | Array<ts.Identifier | string>;
|
|
173
|
+
}): ts.ExportDeclaration;
|
|
174
|
+
declare function createEnumDeclaration({
|
|
175
|
+
type,
|
|
176
|
+
name,
|
|
177
|
+
typeName,
|
|
178
|
+
enums
|
|
179
|
+
}: {
|
|
180
|
+
/**
|
|
181
|
+
* @default `'enum'`
|
|
182
|
+
*/
|
|
183
|
+
type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal';
|
|
184
|
+
/**
|
|
185
|
+
* Enum name in camelCase.
|
|
186
|
+
*/
|
|
187
|
+
name: string;
|
|
188
|
+
/**
|
|
189
|
+
* Enum name in PascalCase.
|
|
190
|
+
*/
|
|
191
|
+
typeName: string;
|
|
192
|
+
enums: [key: string | number, value: string | number | boolean][];
|
|
193
|
+
}): [name: ts.Node | undefined, type: ts.Node];
|
|
194
|
+
declare function createOmitDeclaration({
|
|
195
|
+
keys,
|
|
196
|
+
type,
|
|
197
|
+
nonNullable
|
|
198
|
+
}: {
|
|
199
|
+
keys: Array<string> | string;
|
|
200
|
+
type: ts.TypeNode;
|
|
201
|
+
nonNullable?: boolean;
|
|
202
|
+
}): ts.TypeReferenceNode;
|
|
203
|
+
declare const keywordTypeNodes: {
|
|
204
|
+
readonly any: ts.KeywordTypeNode<ts.SyntaxKind.AnyKeyword>;
|
|
205
|
+
readonly unknown: ts.KeywordTypeNode<ts.SyntaxKind.UnknownKeyword>;
|
|
206
|
+
readonly void: ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword>;
|
|
207
|
+
readonly number: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
|
|
208
|
+
readonly integer: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
|
|
209
|
+
readonly object: ts.KeywordTypeNode<ts.SyntaxKind.ObjectKeyword>;
|
|
210
|
+
readonly string: ts.KeywordTypeNode<ts.SyntaxKind.StringKeyword>;
|
|
211
|
+
readonly boolean: ts.KeywordTypeNode<ts.SyntaxKind.BooleanKeyword>;
|
|
212
|
+
readonly undefined: ts.KeywordTypeNode<ts.SyntaxKind.UndefinedKeyword>;
|
|
213
|
+
readonly null: ts.LiteralTypeNode;
|
|
214
|
+
};
|
|
215
|
+
declare const createTypeLiteralNode: (members: readonly ts.TypeElement[] | undefined) => ts.TypeLiteralNode;
|
|
216
|
+
declare const createTypeReferenceNode: (typeName: string | ts.EntityName, typeArguments?: readonly ts.TypeNode[]) => ts.TypeReferenceNode;
|
|
217
|
+
declare const createNumericLiteral: (value: string | number, numericLiteralFlags?: ts.TokenFlags) => ts.NumericLiteral;
|
|
218
|
+
declare const createStringLiteral: (text: string, isSingleQuote?: boolean) => ts.StringLiteral;
|
|
219
|
+
declare const createArrayTypeNode: (elementType: ts.TypeNode) => ts.ArrayTypeNode;
|
|
220
|
+
declare const createLiteralTypeNode: (literal: ts.LiteralTypeNode["literal"]) => ts.LiteralTypeNode;
|
|
221
|
+
declare const createNull: () => ts.NullLiteral;
|
|
222
|
+
declare const createIdentifier: (text: string) => ts.Identifier;
|
|
223
|
+
declare const createOptionalTypeNode: (type: ts.TypeNode) => ts.OptionalTypeNode;
|
|
224
|
+
declare const createTupleTypeNode: (elements: readonly (ts.TypeNode | ts.NamedTupleMember)[]) => ts.TupleTypeNode;
|
|
225
|
+
declare const createRestTypeNode: (type: ts.TypeNode) => ts.RestTypeNode;
|
|
226
|
+
declare const createTrue: () => ts.TrueLiteral;
|
|
227
|
+
declare const createFalse: () => ts.FalseLiteral;
|
|
228
|
+
//#endregion
|
|
229
|
+
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 };
|
|
230
|
+
//# sourceMappingURL=factory-CUjjpSgy.d.ts.map
|