@kubb/parser-ts 3.0.0-alpha.3 → 3.0.0-alpha.31
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/README.md +13 -4
- package/dist/{chunk-UQLRYRTM.cjs → chunk-RRINEX3S.cjs} +86 -72
- package/dist/chunk-RRINEX3S.cjs.map +1 -0
- package/dist/{chunk-QHLKNPYD.js → chunk-VCQMYAU6.js} +14 -35
- package/dist/chunk-VCQMYAU6.js.map +1 -0
- package/dist/{factory-Cd7U4lxv.d.cts → factory-CicFXqtM.d.cts} +7 -3
- package/dist/{factory-Cd7U4lxv.d.ts → factory-CicFXqtM.d.ts} +7 -3
- package/dist/factory.cjs +123 -58
- package/dist/factory.cjs.map +1 -1
- package/dist/factory.d.cts +1 -1
- package/dist/factory.d.ts +1 -1
- package/dist/factory.js +2 -58
- package/dist/factory.js.map +1 -1
- package/dist/index.cjs +20 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -19
- package/dist/index.d.ts +11 -19
- package/dist/index.js +13 -54
- package/dist/index.js.map +1 -1
- package/package.json +6 -9
- package/src/factory.ts +7 -3
- package/src/format.ts +9 -0
- package/src/index.ts +1 -3
- package/src/print.ts +4 -1
- package/dist/chunk-QHLKNPYD.js.map +0 -1
- package/dist/chunk-UQLRYRTM.cjs.map +0 -1
- package/src/api.ts +0 -49
- package/src/parse.ts +0 -15
package/README.md
CHANGED
|
@@ -13,10 +13,6 @@
|
|
|
13
13
|
[![Coverage][coverage-src]][coverage-href]
|
|
14
14
|
[![License][license-src]][license-href]
|
|
15
15
|
|
|
16
|
-
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
17
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
18
|
-
</p>
|
|
19
|
-
|
|
20
16
|
<h4>
|
|
21
17
|
<a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
|
|
22
18
|
<span> · </span>
|
|
@@ -27,6 +23,19 @@
|
|
|
27
23
|
<a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
|
|
28
24
|
</h4>
|
|
29
25
|
</div>
|
|
26
|
+
## Supporting Kubb
|
|
27
|
+
|
|
28
|
+
Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
|
|
29
|
+
|
|
30
|
+
- [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://github.com/sponsors/stijnvanhulle">
|
|
34
|
+
<img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
|
|
35
|
+
</a>
|
|
36
|
+
</p>
|
|
37
|
+
|
|
38
|
+
|
|
30
39
|
<!-- Badges -->
|
|
31
40
|
|
|
32
41
|
[npm-version-src]: https://img.shields.io/npm/v/@kubb/parser-ts?flat&colorA=18181B&colorB=f58517
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var remeda = require('remeda');
|
|
4
|
+
var ts = require('typescript');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
2
11
|
var __export = (target, all) => {
|
|
3
12
|
for (var name in all)
|
|
4
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -12,6 +21,7 @@ __export(factory_exports, {
|
|
|
12
21
|
createArrayTypeNode: () => createArrayTypeNode,
|
|
13
22
|
createEnumDeclaration: () => createEnumDeclaration,
|
|
14
23
|
createExportDeclaration: () => createExportDeclaration,
|
|
24
|
+
createFalse: () => createFalse,
|
|
15
25
|
createIdentifier: () => createIdentifier,
|
|
16
26
|
createImportDeclaration: () => createImportDeclaration,
|
|
17
27
|
createIndexSignature: () => createIndexSignature,
|
|
@@ -26,6 +36,7 @@ __export(factory_exports, {
|
|
|
26
36
|
createPropertySignature: () => createPropertySignature,
|
|
27
37
|
createQuestionToken: () => createQuestionToken,
|
|
28
38
|
createStringLiteral: () => createStringLiteral,
|
|
39
|
+
createTrue: () => createTrue,
|
|
29
40
|
createTupleDeclaration: () => createTupleDeclaration,
|
|
30
41
|
createTupleTypeNode: () => createTupleTypeNode,
|
|
31
42
|
createTypeAliasDeclaration: () => createTypeAliasDeclaration,
|
|
@@ -35,21 +46,19 @@ __export(factory_exports, {
|
|
|
35
46
|
keywordTypeNodes: () => keywordTypeNodes,
|
|
36
47
|
modifiers: () => modifiers
|
|
37
48
|
});
|
|
38
|
-
var
|
|
39
|
-
var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
|
|
40
|
-
var { factory } = _typescript2.default;
|
|
49
|
+
var { factory } = ts__default.default;
|
|
41
50
|
var modifiers = {
|
|
42
|
-
async: factory.createModifier(
|
|
43
|
-
export: factory.createModifier(
|
|
44
|
-
const: factory.createModifier(
|
|
45
|
-
static: factory.createModifier(
|
|
51
|
+
async: factory.createModifier(ts__default.default.SyntaxKind.AsyncKeyword),
|
|
52
|
+
export: factory.createModifier(ts__default.default.SyntaxKind.ExportKeyword),
|
|
53
|
+
const: factory.createModifier(ts__default.default.SyntaxKind.ConstKeyword),
|
|
54
|
+
static: factory.createModifier(ts__default.default.SyntaxKind.StaticKeyword)
|
|
46
55
|
};
|
|
47
56
|
function isValidIdentifier(str) {
|
|
48
57
|
if (!str.length || str.trim() !== str) {
|
|
49
58
|
return false;
|
|
50
59
|
}
|
|
51
|
-
const node =
|
|
52
|
-
return !!node && node.kind ===
|
|
60
|
+
const node = ts__default.default.parseIsolatedEntityName(str, ts__default.default.ScriptTarget.Latest);
|
|
61
|
+
return !!node && node.kind === ts__default.default.SyntaxKind.Identifier && ts__default.default.identifierToKeywordKind(node.kind) === void 0;
|
|
53
62
|
}
|
|
54
63
|
function propertyName(name) {
|
|
55
64
|
if (typeof name === "string") {
|
|
@@ -57,7 +66,7 @@ function propertyName(name) {
|
|
|
57
66
|
}
|
|
58
67
|
return name;
|
|
59
68
|
}
|
|
60
|
-
var questionToken = factory.createToken(
|
|
69
|
+
var questionToken = factory.createToken(ts__default.default.SyntaxKind.QuestionToken);
|
|
61
70
|
function createQuestionToken(token) {
|
|
62
71
|
if (!token) {
|
|
63
72
|
return void 0;
|
|
@@ -134,7 +143,7 @@ function createPropertySignature({
|
|
|
134
143
|
type
|
|
135
144
|
}) {
|
|
136
145
|
return factory.createPropertySignature(
|
|
137
|
-
[...modifiers2, readOnly ? factory.createToken(
|
|
146
|
+
[...modifiers2, readOnly ? factory.createToken(ts__default.default.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean),
|
|
138
147
|
propertyName(name),
|
|
139
148
|
createQuestionToken(questionToken2),
|
|
140
149
|
type
|
|
@@ -177,13 +186,13 @@ function appendJSDocToNode({
|
|
|
177
186
|
return `${acc}
|
|
178
187
|
* ${comment}`;
|
|
179
188
|
}, "*");
|
|
180
|
-
return
|
|
189
|
+
return ts__default.default.addSyntheticLeadingComment({ ...node }, ts__default.default.SyntaxKind.MultiLineCommentTrivia, `${text || "*"}
|
|
181
190
|
`, true);
|
|
182
191
|
}
|
|
183
192
|
function createIndexSignature(type, {
|
|
184
193
|
modifiers: modifiers2,
|
|
185
194
|
indexName = "key",
|
|
186
|
-
indexType = factory.createKeywordTypeNode(
|
|
195
|
+
indexType = factory.createKeywordTypeNode(ts__default.default.SyntaxKind.StringKeyword)
|
|
187
196
|
} = {}) {
|
|
188
197
|
return factory.createIndexSignature(modifiers2, [createParameterSignature(indexName, { type: indexType })], type);
|
|
189
198
|
}
|
|
@@ -200,10 +209,10 @@ function createNamespaceDeclaration({
|
|
|
200
209
|
name
|
|
201
210
|
}) {
|
|
202
211
|
return factory.createModuleDeclaration(
|
|
203
|
-
[factory.createToken(
|
|
212
|
+
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
|
|
204
213
|
factory.createIdentifier(name),
|
|
205
214
|
factory.createModuleBlock(statements),
|
|
206
|
-
|
|
215
|
+
ts__default.default.NodeFlags.Namespace
|
|
207
216
|
);
|
|
208
217
|
}
|
|
209
218
|
function createImportDeclaration({
|
|
@@ -255,10 +264,10 @@ function createExportDeclaration({
|
|
|
255
264
|
name
|
|
256
265
|
}) {
|
|
257
266
|
if (name && !Array.isArray(name) && !asAlias) {
|
|
258
|
-
|
|
267
|
+
console.warn(`When using name as string, asAlias should be true ${name}`);
|
|
259
268
|
}
|
|
260
269
|
if (!Array.isArray(name)) {
|
|
261
|
-
const parsedName =
|
|
270
|
+
const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
|
|
262
271
|
return factory.createExportDeclaration(
|
|
263
272
|
void 0,
|
|
264
273
|
isTypeOnly,
|
|
@@ -287,14 +296,15 @@ function createEnumDeclaration({
|
|
|
287
296
|
}) {
|
|
288
297
|
if (type === "literal") {
|
|
289
298
|
return [
|
|
299
|
+
void 0,
|
|
290
300
|
factory.createTypeAliasDeclaration(
|
|
291
|
-
[factory.createToken(
|
|
301
|
+
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
|
|
292
302
|
factory.createIdentifier(typeName),
|
|
293
303
|
void 0,
|
|
294
304
|
factory.createUnionTypeNode(
|
|
295
305
|
enums.map(([_key, value]) => {
|
|
296
|
-
if (
|
|
297
|
-
return factory.createLiteralTypeNode(factory.createNumericLiteral(
|
|
306
|
+
if (remeda.isNumber(value)) {
|
|
307
|
+
return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()));
|
|
298
308
|
}
|
|
299
309
|
if (typeof value === "boolean") {
|
|
300
310
|
return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse());
|
|
@@ -310,18 +320,19 @@ function createEnumDeclaration({
|
|
|
310
320
|
}
|
|
311
321
|
if (type === "enum" || type === "constEnum") {
|
|
312
322
|
return [
|
|
323
|
+
void 0,
|
|
313
324
|
factory.createEnumDeclaration(
|
|
314
|
-
[factory.createToken(
|
|
325
|
+
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts__default.default.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
|
|
315
326
|
factory.createIdentifier(typeName),
|
|
316
327
|
enums.map(([key, value]) => {
|
|
317
|
-
let initializer = factory.createStringLiteral(
|
|
318
|
-
if (
|
|
328
|
+
let initializer = factory.createStringLiteral(value?.toString());
|
|
329
|
+
if (remeda.isNumber(Number.parseInt(value.toString()))) {
|
|
319
330
|
initializer = factory.createNumericLiteral(value);
|
|
320
331
|
}
|
|
321
332
|
if (typeof value === "boolean") {
|
|
322
333
|
initializer = value ? factory.createTrue() : factory.createFalse();
|
|
323
334
|
}
|
|
324
|
-
if (
|
|
335
|
+
if (remeda.isNumber(Number.parseInt(key.toString()))) {
|
|
325
336
|
return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer);
|
|
326
337
|
}
|
|
327
338
|
if (key) {
|
|
@@ -335,7 +346,7 @@ function createEnumDeclaration({
|
|
|
335
346
|
const identifierName = type === "asPascalConst" ? typeName : name;
|
|
336
347
|
return [
|
|
337
348
|
factory.createVariableStatement(
|
|
338
|
-
[factory.createToken(
|
|
349
|
+
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
|
|
339
350
|
factory.createVariableDeclarationList(
|
|
340
351
|
[
|
|
341
352
|
factory.createVariableDeclaration(
|
|
@@ -345,10 +356,10 @@ function createEnumDeclaration({
|
|
|
345
356
|
factory.createAsExpression(
|
|
346
357
|
factory.createObjectLiteralExpression(
|
|
347
358
|
enums.map(([key, value]) => {
|
|
348
|
-
let initializer = factory.createStringLiteral(`${
|
|
349
|
-
if (
|
|
359
|
+
let initializer = factory.createStringLiteral(`${value?.toString()}`);
|
|
360
|
+
if (remeda.isNumber(value)) {
|
|
350
361
|
if (value < 0) {
|
|
351
|
-
initializer = factory.createPrefixUnaryExpression(
|
|
362
|
+
initializer = factory.createPrefixUnaryExpression(ts__default.default.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)));
|
|
352
363
|
} else {
|
|
353
364
|
initializer = factory.createNumericLiteral(value);
|
|
354
365
|
}
|
|
@@ -367,16 +378,16 @@ function createEnumDeclaration({
|
|
|
367
378
|
)
|
|
368
379
|
)
|
|
369
380
|
],
|
|
370
|
-
|
|
381
|
+
ts__default.default.NodeFlags.Const
|
|
371
382
|
)
|
|
372
383
|
),
|
|
373
384
|
factory.createTypeAliasDeclaration(
|
|
374
|
-
[factory.createToken(
|
|
385
|
+
type === "asPascalConst" ? [] : [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
|
|
375
386
|
factory.createIdentifier(typeName),
|
|
376
387
|
void 0,
|
|
377
388
|
factory.createIndexedAccessTypeNode(
|
|
378
389
|
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
|
|
379
|
-
factory.createTypeOperatorNode(
|
|
390
|
+
factory.createTypeOperatorNode(ts__default.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
|
|
380
391
|
)
|
|
381
392
|
)
|
|
382
393
|
];
|
|
@@ -400,15 +411,15 @@ function createOmitDeclaration({
|
|
|
400
411
|
return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]);
|
|
401
412
|
}
|
|
402
413
|
var keywordTypeNodes = {
|
|
403
|
-
any: factory.createKeywordTypeNode(
|
|
404
|
-
unknown: factory.createKeywordTypeNode(
|
|
405
|
-
number: factory.createKeywordTypeNode(
|
|
406
|
-
integer: factory.createKeywordTypeNode(
|
|
407
|
-
object: factory.createKeywordTypeNode(
|
|
408
|
-
string: factory.createKeywordTypeNode(
|
|
409
|
-
boolean: factory.createKeywordTypeNode(
|
|
410
|
-
undefined: factory.createKeywordTypeNode(
|
|
411
|
-
null: factory.createLiteralTypeNode(factory.createToken(
|
|
414
|
+
any: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.AnyKeyword),
|
|
415
|
+
unknown: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.UnknownKeyword),
|
|
416
|
+
number: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
|
|
417
|
+
integer: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
|
|
418
|
+
object: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.ObjectKeyword),
|
|
419
|
+
string: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.StringKeyword),
|
|
420
|
+
boolean: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.BooleanKeyword),
|
|
421
|
+
undefined: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.UndefinedKeyword),
|
|
422
|
+
null: factory.createLiteralTypeNode(factory.createToken(ts__default.default.SyntaxKind.NullKeyword))
|
|
412
423
|
};
|
|
413
424
|
var createTypeLiteralNode = factory.createTypeLiteralNode;
|
|
414
425
|
var createTypeReferenceNode = factory.createTypeReferenceNode;
|
|
@@ -419,35 +430,38 @@ var createLiteralTypeNode = factory.createLiteralTypeNode;
|
|
|
419
430
|
var createNull = factory.createNull;
|
|
420
431
|
var createIdentifier = factory.createIdentifier;
|
|
421
432
|
var createTupleTypeNode = factory.createTupleTypeNode;
|
|
433
|
+
var createTrue = factory.createTrue;
|
|
434
|
+
var createFalse = factory.createFalse;
|
|
422
435
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
exports.modifiers = modifiers;
|
|
453
|
-
//# sourceMappingURL=chunk-
|
|
436
|
+
exports.appendJSDocToNode = appendJSDocToNode;
|
|
437
|
+
exports.createArrayDeclaration = createArrayDeclaration;
|
|
438
|
+
exports.createArrayTypeNode = createArrayTypeNode;
|
|
439
|
+
exports.createEnumDeclaration = createEnumDeclaration;
|
|
440
|
+
exports.createExportDeclaration = createExportDeclaration;
|
|
441
|
+
exports.createFalse = createFalse;
|
|
442
|
+
exports.createIdentifier = createIdentifier;
|
|
443
|
+
exports.createImportDeclaration = createImportDeclaration;
|
|
444
|
+
exports.createIndexSignature = createIndexSignature;
|
|
445
|
+
exports.createIntersectionDeclaration = createIntersectionDeclaration;
|
|
446
|
+
exports.createJSDoc = createJSDoc;
|
|
447
|
+
exports.createLiteralTypeNode = createLiteralTypeNode;
|
|
448
|
+
exports.createNamespaceDeclaration = createNamespaceDeclaration;
|
|
449
|
+
exports.createNull = createNull;
|
|
450
|
+
exports.createNumericLiteral = createNumericLiteral;
|
|
451
|
+
exports.createOmitDeclaration = createOmitDeclaration;
|
|
452
|
+
exports.createParameterSignature = createParameterSignature;
|
|
453
|
+
exports.createPropertySignature = createPropertySignature;
|
|
454
|
+
exports.createQuestionToken = createQuestionToken;
|
|
455
|
+
exports.createStringLiteral = createStringLiteral;
|
|
456
|
+
exports.createTrue = createTrue;
|
|
457
|
+
exports.createTupleDeclaration = createTupleDeclaration;
|
|
458
|
+
exports.createTupleTypeNode = createTupleTypeNode;
|
|
459
|
+
exports.createTypeAliasDeclaration = createTypeAliasDeclaration;
|
|
460
|
+
exports.createTypeLiteralNode = createTypeLiteralNode;
|
|
461
|
+
exports.createTypeReferenceNode = createTypeReferenceNode;
|
|
462
|
+
exports.createUnionDeclaration = createUnionDeclaration;
|
|
463
|
+
exports.factory_exports = factory_exports;
|
|
464
|
+
exports.keywordTypeNodes = keywordTypeNodes;
|
|
465
|
+
exports.modifiers = modifiers;
|
|
466
|
+
//# sourceMappingURL=chunk-RRINEX3S.cjs.map
|
|
467
|
+
//# sourceMappingURL=chunk-RRINEX3S.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/factory.ts"],"names":["ts","modifiers","questionToken","propertyName","isNumber"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,GAAA,GAAA;AAAA,QAAA,CAAA,eAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,WAAA,EAAA,MAAA,WAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,6BAAA,EAAA,MAAA,6BAAA;AAAA,EAAA,WAAA,EAAA,MAAA,WAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,UAAA,EAAA,MAAA,UAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,wBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,UAAA,EAAA,MAAA,UAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,0BAAA,EAAA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CAAA;AACpF,EAAA;AAEO,IAAM,wBAAwB,OAAQ,CAAA,sBAAA;AAEtC,IAAM,0BAA0B,OAAQ,CAAA,wBAAA;AACxC,IAAM,uBAAuB,OAAQ,CAAA,qBAAA;AACrC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AAEpC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AAEpC,IAAM,wBAAwB,OAAQ,CAAA,sBAAA;AACtC,IAAM,aAAa,OAAQ,CAAA,WAAA;AAC3B,IAAM,mBAAmB,OAAQ,CAAA,iBAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AACpC,IAAM,aAAa,OAAQ,CAAA,WAAA;AAC3B,IAAM,cAAc,OAAQ,CAAA","file":"chunk-RRINEX3S.cjs","sourcesContent":["import { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { 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\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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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({\n nodes,\n}: {\n nodes: Array<ts.TypeNode>\n}): 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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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.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>({\n node,\n comments,\n}: {\n node: TNode\n comments: Array<string | undefined>\n}) {\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}`\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 createNamespaceDeclaration({\n statements,\n name,\n}: {\n name: string\n statements: ts.Statement[]\n}) {\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 = 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\n if (isNumber(Number.parseInt(value.toString()))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString()))) {\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({\n keys,\n type,\n nonNullable,\n}: {\n keys: Array<string> | string\n type: ts.TypeNode\n nonNullable?: boolean\n}) {\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 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 createTupleTypeNode = factory.createTupleTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n"]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { isNumber } from 'remeda';
|
|
2
|
+
import ts from 'typescript';
|
|
3
|
+
|
|
1
4
|
var __defProp = Object.defineProperty;
|
|
2
5
|
var __export = (target, all) => {
|
|
3
6
|
for (var name in all)
|
|
@@ -12,6 +15,7 @@ __export(factory_exports, {
|
|
|
12
15
|
createArrayTypeNode: () => createArrayTypeNode,
|
|
13
16
|
createEnumDeclaration: () => createEnumDeclaration,
|
|
14
17
|
createExportDeclaration: () => createExportDeclaration,
|
|
18
|
+
createFalse: () => createFalse,
|
|
15
19
|
createIdentifier: () => createIdentifier,
|
|
16
20
|
createImportDeclaration: () => createImportDeclaration,
|
|
17
21
|
createIndexSignature: () => createIndexSignature,
|
|
@@ -26,6 +30,7 @@ __export(factory_exports, {
|
|
|
26
30
|
createPropertySignature: () => createPropertySignature,
|
|
27
31
|
createQuestionToken: () => createQuestionToken,
|
|
28
32
|
createStringLiteral: () => createStringLiteral,
|
|
33
|
+
createTrue: () => createTrue,
|
|
29
34
|
createTupleDeclaration: () => createTupleDeclaration,
|
|
30
35
|
createTupleTypeNode: () => createTupleTypeNode,
|
|
31
36
|
createTypeAliasDeclaration: () => createTypeAliasDeclaration,
|
|
@@ -35,8 +40,6 @@ __export(factory_exports, {
|
|
|
35
40
|
keywordTypeNodes: () => keywordTypeNodes,
|
|
36
41
|
modifiers: () => modifiers
|
|
37
42
|
});
|
|
38
|
-
import { isNumber } from "remeda";
|
|
39
|
-
import ts from "typescript";
|
|
40
43
|
var { factory } = ts;
|
|
41
44
|
var modifiers = {
|
|
42
45
|
async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),
|
|
@@ -255,7 +258,7 @@ function createExportDeclaration({
|
|
|
255
258
|
name
|
|
256
259
|
}) {
|
|
257
260
|
if (name && !Array.isArray(name) && !asAlias) {
|
|
258
|
-
|
|
261
|
+
console.warn(`When using name as string, asAlias should be true ${name}`);
|
|
259
262
|
}
|
|
260
263
|
if (!Array.isArray(name)) {
|
|
261
264
|
const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
|
|
@@ -287,6 +290,7 @@ function createEnumDeclaration({
|
|
|
287
290
|
}) {
|
|
288
291
|
if (type === "literal") {
|
|
289
292
|
return [
|
|
293
|
+
void 0,
|
|
290
294
|
factory.createTypeAliasDeclaration(
|
|
291
295
|
[factory.createToken(ts.SyntaxKind.ExportKeyword)],
|
|
292
296
|
factory.createIdentifier(typeName),
|
|
@@ -310,6 +314,7 @@ function createEnumDeclaration({
|
|
|
310
314
|
}
|
|
311
315
|
if (type === "enum" || type === "constEnum") {
|
|
312
316
|
return [
|
|
317
|
+
void 0,
|
|
313
318
|
factory.createEnumDeclaration(
|
|
314
319
|
[factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
|
|
315
320
|
factory.createIdentifier(typeName),
|
|
@@ -371,7 +376,7 @@ function createEnumDeclaration({
|
|
|
371
376
|
)
|
|
372
377
|
),
|
|
373
378
|
factory.createTypeAliasDeclaration(
|
|
374
|
-
[factory.createToken(ts.SyntaxKind.ExportKeyword)],
|
|
379
|
+
type === "asPascalConst" ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],
|
|
375
380
|
factory.createIdentifier(typeName),
|
|
376
381
|
void 0,
|
|
377
382
|
factory.createIndexedAccessTypeNode(
|
|
@@ -419,35 +424,9 @@ var createLiteralTypeNode = factory.createLiteralTypeNode;
|
|
|
419
424
|
var createNull = factory.createNull;
|
|
420
425
|
var createIdentifier = factory.createIdentifier;
|
|
421
426
|
var createTupleTypeNode = factory.createTupleTypeNode;
|
|
427
|
+
var createTrue = factory.createTrue;
|
|
428
|
+
var createFalse = factory.createFalse;
|
|
422
429
|
|
|
423
|
-
export {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
createIntersectionDeclaration,
|
|
427
|
-
createTupleDeclaration,
|
|
428
|
-
createArrayDeclaration,
|
|
429
|
-
createUnionDeclaration,
|
|
430
|
-
createPropertySignature,
|
|
431
|
-
createParameterSignature,
|
|
432
|
-
createJSDoc,
|
|
433
|
-
appendJSDocToNode,
|
|
434
|
-
createIndexSignature,
|
|
435
|
-
createTypeAliasDeclaration,
|
|
436
|
-
createNamespaceDeclaration,
|
|
437
|
-
createImportDeclaration,
|
|
438
|
-
createExportDeclaration,
|
|
439
|
-
createEnumDeclaration,
|
|
440
|
-
createOmitDeclaration,
|
|
441
|
-
keywordTypeNodes,
|
|
442
|
-
createTypeLiteralNode,
|
|
443
|
-
createTypeReferenceNode,
|
|
444
|
-
createNumericLiteral,
|
|
445
|
-
createStringLiteral,
|
|
446
|
-
createArrayTypeNode,
|
|
447
|
-
createLiteralTypeNode,
|
|
448
|
-
createNull,
|
|
449
|
-
createIdentifier,
|
|
450
|
-
createTupleTypeNode,
|
|
451
|
-
factory_exports
|
|
452
|
-
};
|
|
453
|
-
//# sourceMappingURL=chunk-QHLKNPYD.js.map
|
|
430
|
+
export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, factory_exports, keywordTypeNodes, modifiers };
|
|
431
|
+
//# sourceMappingURL=chunk-VCQMYAU6.js.map
|
|
432
|
+
//# sourceMappingURL=chunk-VCQMYAU6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/factory.ts"],"names":["modif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OAAQ,CAAA,iBAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AACpC,IAAM,aAAa,OAAQ,CAAA,WAAA;AAC3B,IAAM,cAAc,OAAQ,CAAA","file":"chunk-VCQMYAU6.js","sourcesContent":["import { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { 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\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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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({\n nodes,\n}: {\n nodes: Array<ts.TypeNode>\n}): 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({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): 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.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>({\n node,\n comments,\n}: {\n node: TNode\n comments: Array<string | undefined>\n}) {\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}`\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 createNamespaceDeclaration({\n statements,\n name,\n}: {\n name: string\n statements: ts.Statement[]\n}) {\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 = 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\n if (isNumber(Number.parseInt(value.toString()))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString()))) {\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({\n keys,\n type,\n nonNullable,\n}: {\n keys: Array<string> | string\n type: ts.TypeNode\n nonNullable?: boolean\n}) {\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 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 createTupleTypeNode = factory.createTupleTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n"]}
|
|
@@ -104,7 +104,7 @@ declare function createEnumDeclaration({ type, name, typeName, enums, }: {
|
|
|
104
104
|
*/
|
|
105
105
|
typeName: string;
|
|
106
106
|
enums: [key: string | number, value: string | number | boolean][];
|
|
107
|
-
}):
|
|
107
|
+
}): [name: ts.Node | undefined, type: ts.Node];
|
|
108
108
|
declare function createOmitDeclaration({ keys, type, nonNullable, }: {
|
|
109
109
|
keys: Array<string> | string;
|
|
110
110
|
type: ts.TypeNode;
|
|
@@ -130,12 +130,15 @@ declare const createLiteralTypeNode: (literal: ts.LiteralTypeNode["literal"]) =>
|
|
|
130
130
|
declare const createNull: () => ts.NullLiteral;
|
|
131
131
|
declare const createIdentifier: (text: string) => ts.Identifier;
|
|
132
132
|
declare const createTupleTypeNode: (elements: readonly (ts.TypeNode | ts.NamedTupleMember)[]) => ts.TupleTypeNode;
|
|
133
|
+
declare const createTrue: () => ts.TrueLiteral;
|
|
134
|
+
declare const createFalse: () => ts.FalseLiteral;
|
|
133
135
|
|
|
134
136
|
declare const factory_appendJSDocToNode: typeof appendJSDocToNode;
|
|
135
137
|
declare const factory_createArrayDeclaration: typeof createArrayDeclaration;
|
|
136
138
|
declare const factory_createArrayTypeNode: typeof createArrayTypeNode;
|
|
137
139
|
declare const factory_createEnumDeclaration: typeof createEnumDeclaration;
|
|
138
140
|
declare const factory_createExportDeclaration: typeof createExportDeclaration;
|
|
141
|
+
declare const factory_createFalse: typeof createFalse;
|
|
139
142
|
declare const factory_createIdentifier: typeof createIdentifier;
|
|
140
143
|
declare const factory_createImportDeclaration: typeof createImportDeclaration;
|
|
141
144
|
declare const factory_createIndexSignature: typeof createIndexSignature;
|
|
@@ -150,6 +153,7 @@ declare const factory_createParameterSignature: typeof createParameterSignature;
|
|
|
150
153
|
declare const factory_createPropertySignature: typeof createPropertySignature;
|
|
151
154
|
declare const factory_createQuestionToken: typeof createQuestionToken;
|
|
152
155
|
declare const factory_createStringLiteral: typeof createStringLiteral;
|
|
156
|
+
declare const factory_createTrue: typeof createTrue;
|
|
153
157
|
declare const factory_createTupleDeclaration: typeof createTupleDeclaration;
|
|
154
158
|
declare const factory_createTupleTypeNode: typeof createTupleTypeNode;
|
|
155
159
|
declare const factory_createTypeAliasDeclaration: typeof createTypeAliasDeclaration;
|
|
@@ -159,7 +163,7 @@ declare const factory_createUnionDeclaration: typeof createUnionDeclaration;
|
|
|
159
163
|
declare const factory_keywordTypeNodes: typeof keywordTypeNodes;
|
|
160
164
|
declare const factory_modifiers: typeof modifiers;
|
|
161
165
|
declare namespace factory {
|
|
162
|
-
export { factory_appendJSDocToNode as appendJSDocToNode, factory_createArrayDeclaration as createArrayDeclaration, factory_createArrayTypeNode as createArrayTypeNode, factory_createEnumDeclaration as createEnumDeclaration, factory_createExportDeclaration as createExportDeclaration, factory_createIdentifier as createIdentifier, factory_createImportDeclaration as createImportDeclaration, factory_createIndexSignature as createIndexSignature, factory_createIntersectionDeclaration as createIntersectionDeclaration, factory_createJSDoc as createJSDoc, factory_createLiteralTypeNode as createLiteralTypeNode, factory_createNamespaceDeclaration as createNamespaceDeclaration, factory_createNull as createNull, factory_createNumericLiteral as createNumericLiteral, factory_createOmitDeclaration as createOmitDeclaration, factory_createParameterSignature as createParameterSignature, factory_createPropertySignature as createPropertySignature, factory_createQuestionToken as createQuestionToken, factory_createStringLiteral as createStringLiteral, factory_createTupleDeclaration as createTupleDeclaration, factory_createTupleTypeNode as createTupleTypeNode, factory_createTypeAliasDeclaration as createTypeAliasDeclaration, factory_createTypeLiteralNode as createTypeLiteralNode, factory_createTypeReferenceNode as createTypeReferenceNode, factory_createUnionDeclaration as createUnionDeclaration, factory_keywordTypeNodes as keywordTypeNodes, factory_modifiers as modifiers };
|
|
166
|
+
export { factory_appendJSDocToNode as appendJSDocToNode, factory_createArrayDeclaration as createArrayDeclaration, factory_createArrayTypeNode as createArrayTypeNode, factory_createEnumDeclaration as createEnumDeclaration, factory_createExportDeclaration as createExportDeclaration, factory_createFalse as createFalse, factory_createIdentifier as createIdentifier, factory_createImportDeclaration as createImportDeclaration, factory_createIndexSignature as createIndexSignature, factory_createIntersectionDeclaration as createIntersectionDeclaration, factory_createJSDoc as createJSDoc, factory_createLiteralTypeNode as createLiteralTypeNode, factory_createNamespaceDeclaration as createNamespaceDeclaration, factory_createNull as createNull, factory_createNumericLiteral as createNumericLiteral, factory_createOmitDeclaration as createOmitDeclaration, factory_createParameterSignature as createParameterSignature, factory_createPropertySignature as createPropertySignature, factory_createQuestionToken as createQuestionToken, factory_createStringLiteral as createStringLiteral, factory_createTrue as createTrue, factory_createTupleDeclaration as createTupleDeclaration, factory_createTupleTypeNode as createTupleTypeNode, factory_createTypeAliasDeclaration as createTypeAliasDeclaration, factory_createTypeLiteralNode as createTypeLiteralNode, factory_createTypeReferenceNode as createTypeReferenceNode, factory_createUnionDeclaration as createUnionDeclaration, factory_keywordTypeNodes as keywordTypeNodes, factory_modifiers as modifiers };
|
|
163
167
|
}
|
|
164
168
|
|
|
165
|
-
export { createIdentifier as A, createTupleTypeNode as B, createIntersectionDeclaration as a, createTupleDeclaration as b, createQuestionToken as c, createArrayDeclaration as d, createUnionDeclaration as e, factory as f, createPropertySignature as g, createParameterSignature as h, createJSDoc as i, appendJSDocToNode as j, createIndexSignature as k, createTypeAliasDeclaration as l, modifiers as m, createNamespaceDeclaration as n, createImportDeclaration as o, createExportDeclaration as p, createEnumDeclaration as q, createOmitDeclaration as r, keywordTypeNodes as s, createTypeLiteralNode as t, createTypeReferenceNode as u, createNumericLiteral as v, createStringLiteral as w, createArrayTypeNode as x, createLiteralTypeNode as y, createNull as z };
|
|
169
|
+
export { createIdentifier as A, createTupleTypeNode as B, createTrue as C, createFalse as D, createIntersectionDeclaration as a, createTupleDeclaration as b, createQuestionToken as c, createArrayDeclaration as d, createUnionDeclaration as e, factory as f, createPropertySignature as g, createParameterSignature as h, createJSDoc as i, appendJSDocToNode as j, createIndexSignature as k, createTypeAliasDeclaration as l, modifiers as m, createNamespaceDeclaration as n, createImportDeclaration as o, createExportDeclaration as p, createEnumDeclaration as q, createOmitDeclaration as r, keywordTypeNodes as s, createTypeLiteralNode as t, createTypeReferenceNode as u, createNumericLiteral as v, createStringLiteral as w, createArrayTypeNode as x, createLiteralTypeNode as y, createNull as z };
|