@kubb/parser-ts 3.6.0 → 3.6.2

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.
@@ -64,7 +64,7 @@ function isValidIdentifier(str) {
64
64
  return false;
65
65
  }
66
66
  const node = ts__default.default.parseIsolatedEntityName(str, ts__default.default.ScriptTarget.Latest);
67
- return !!node && node.kind === ts__default.default.SyntaxKind.Identifier && ts__default.default.identifierToKeywordKind(node.kind) === undefined;
67
+ return !!node && node.kind === ts__default.default.SyntaxKind.Identifier && ts__default.default.identifierToKeywordKind(node.kind) === void 0;
68
68
  }
69
69
  function propertyName(name) {
70
70
  if (typeof name === "string") {
@@ -75,7 +75,7 @@ function propertyName(name) {
75
75
  var questionToken = factory.createToken(ts__default.default.SyntaxKind.QuestionToken);
76
76
  function createQuestionToken(token) {
77
77
  if (!token) {
78
- return undefined;
78
+ return void 0;
79
79
  }
80
80
  if (token === true) {
81
81
  return questionToken;
@@ -149,7 +149,7 @@ function createPropertySignature({
149
149
  type
150
150
  }) {
151
151
  return factory.createPropertySignature(
152
- [...modifiers2, readOnly ? factory.createToken(ts__default.default.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),
152
+ [...modifiers2, readOnly ? factory.createToken(ts__default.default.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean),
153
153
  propertyName(name),
154
154
  createQuestionToken(questionToken2),
155
155
  type
@@ -216,7 +216,7 @@ function createInterfaceDeclaration({
216
216
  typeParameters,
217
217
  members
218
218
  }) {
219
- return factory.createInterfaceDeclaration(modifiers2, name, typeParameters, undefined, members);
219
+ return factory.createInterfaceDeclaration(modifiers2, name, typeParameters, void 0, members);
220
220
  }
221
221
  function createTypeDeclaration({
222
222
  syntax,
@@ -230,7 +230,7 @@ function createTypeDeclaration({
230
230
  members: type.members,
231
231
  modifiers: isExportable ? [modifiers.export] : [],
232
232
  name,
233
- typeParameters: undefined
233
+ typeParameters: void 0
234
234
  });
235
235
  return appendJSDocToNode({
236
236
  node: node2,
@@ -241,7 +241,7 @@ function createTypeDeclaration({
241
241
  type,
242
242
  modifiers: isExportable ? [modifiers.export] : [],
243
243
  name,
244
- typeParameters: undefined
244
+ typeParameters: void 0
245
245
  });
246
246
  return appendJSDocToNode({
247
247
  node,
@@ -267,23 +267,23 @@ function createImportDeclaration({
267
267
  }) {
268
268
  if (!Array.isArray(name)) {
269
269
  let importPropertyName = factory.createIdentifier(name);
270
- let importName = undefined;
270
+ let importName = void 0;
271
271
  if (isNameSpace) {
272
- importPropertyName = undefined;
272
+ importPropertyName = void 0;
273
273
  importName = factory.createNamespaceImport(factory.createIdentifier(name));
274
274
  }
275
275
  return factory.createImportDeclaration(
276
- undefined,
276
+ void 0,
277
277
  factory.createImportClause(isTypeOnly, importPropertyName, importName),
278
278
  factory.createStringLiteral(path),
279
- undefined
279
+ void 0
280
280
  );
281
281
  }
282
282
  return factory.createImportDeclaration(
283
- undefined,
283
+ void 0,
284
284
  factory.createImportClause(
285
285
  isTypeOnly,
286
- undefined,
286
+ void 0,
287
287
  factory.createNamedImports(
288
288
  name.map((item) => {
289
289
  if (typeof item === "object") {
@@ -291,14 +291,14 @@ function createImportDeclaration({
291
291
  if (obj.name) {
292
292
  return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name));
293
293
  }
294
- return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName));
294
+ return factory.createImportSpecifier(false, void 0, factory.createIdentifier(obj.propertyName));
295
295
  }
296
- return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item));
296
+ return factory.createImportSpecifier(false, void 0, factory.createIdentifier(item));
297
297
  })
298
298
  )
299
299
  ),
300
300
  factory.createStringLiteral(path),
301
- undefined
301
+ void 0
302
302
  );
303
303
  }
304
304
  function createExportDeclaration({
@@ -313,23 +313,23 @@ function createExportDeclaration({
313
313
  if (!Array.isArray(name)) {
314
314
  const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
315
315
  return factory.createExportDeclaration(
316
- undefined,
316
+ void 0,
317
317
  isTypeOnly,
318
- asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,
318
+ asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : void 0,
319
319
  factory.createStringLiteral(path),
320
- undefined
320
+ void 0
321
321
  );
322
322
  }
323
323
  return factory.createExportDeclaration(
324
- undefined,
324
+ void 0,
325
325
  isTypeOnly,
326
326
  factory.createNamedExports(
327
327
  name.map((propertyName2) => {
328
- return factory.createExportSpecifier(false, undefined, typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2);
328
+ return factory.createExportSpecifier(false, void 0, typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2);
329
329
  })
330
330
  ),
331
331
  factory.createStringLiteral(path),
332
- undefined
332
+ void 0
333
333
  );
334
334
  }
335
335
  function createEnumDeclaration({
@@ -340,11 +340,11 @@ function createEnumDeclaration({
340
340
  }) {
341
341
  if (type === "literal") {
342
342
  return [
343
- undefined,
343
+ void 0,
344
344
  factory.createTypeAliasDeclaration(
345
345
  [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
346
346
  factory.createIdentifier(typeName),
347
- undefined,
347
+ void 0,
348
348
  factory.createUnionTypeNode(
349
349
  enums.map(([_key, value]) => {
350
350
  if (remeda.isNumber(value)) {
@@ -356,7 +356,7 @@ function createEnumDeclaration({
356
356
  if (value) {
357
357
  return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()));
358
358
  }
359
- return undefined;
359
+ return void 0;
360
360
  }).filter(Boolean)
361
361
  )
362
362
  )
@@ -364,9 +364,9 @@ function createEnumDeclaration({
364
364
  }
365
365
  if (type === "enum" || type === "constEnum") {
366
366
  return [
367
- undefined,
367
+ void 0,
368
368
  factory.createEnumDeclaration(
369
- [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts__default.default.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),
369
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts__default.default.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
370
370
  factory.createIdentifier(typeName),
371
371
  enums.map(([key, value]) => {
372
372
  let initializer = factory.createStringLiteral(value?.toString());
@@ -383,7 +383,7 @@ function createEnumDeclaration({
383
383
  if (key) {
384
384
  return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer);
385
385
  }
386
- return undefined;
386
+ return void 0;
387
387
  }).filter(Boolean)
388
388
  )
389
389
  ];
@@ -396,8 +396,8 @@ function createEnumDeclaration({
396
396
  [
397
397
  factory.createVariableDeclaration(
398
398
  factory.createIdentifier(identifierName),
399
- undefined,
400
- undefined,
399
+ void 0,
400
+ void 0,
401
401
  factory.createAsExpression(
402
402
  factory.createObjectLiteralExpression(
403
403
  enums.map(([key, value]) => {
@@ -415,11 +415,11 @@ function createEnumDeclaration({
415
415
  if (key) {
416
416
  return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer);
417
417
  }
418
- return undefined;
418
+ return void 0;
419
419
  }).filter(Boolean),
420
420
  true
421
421
  ),
422
- factory.createTypeReferenceNode(factory.createIdentifier("const"), undefined)
422
+ factory.createTypeReferenceNode(factory.createIdentifier("const"), void 0)
423
423
  )
424
424
  )
425
425
  ],
@@ -429,10 +429,10 @@ function createEnumDeclaration({
429
429
  factory.createTypeAliasDeclaration(
430
430
  type === "asPascalConst" ? [] : [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
431
431
  factory.createIdentifier(typeName),
432
- undefined,
432
+ void 0,
433
433
  factory.createIndexedAccessTypeNode(
434
- factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),
435
- factory.createTypeOperatorNode(ts__default.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined))
434
+ factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
435
+ factory.createTypeOperatorNode(ts__default.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
436
436
  )
437
437
  )
438
438
  ];
@@ -458,6 +458,7 @@ function createOmitDeclaration({
458
458
  var keywordTypeNodes = {
459
459
  any: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.AnyKeyword),
460
460
  unknown: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.UnknownKeyword),
461
+ void: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.VoidKeyword),
461
462
  number: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
462
463
  integer: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
463
464
  object: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.ObjectKeyword),
@@ -511,5 +512,5 @@ exports.factory_exports = factory_exports;
511
512
  exports.keywordTypeNodes = keywordTypeNodes;
512
513
  exports.modifiers = modifiers;
513
514
  exports.syntaxKind = syntaxKind;
514
- //# sourceMappingURL=chunk-JJWEVMSA.cjs.map
515
- //# sourceMappingURL=chunk-JJWEVMSA.cjs.map
515
+ //# sourceMappingURL=chunk-2F22AUDA.cjs.map
516
+ //# sourceMappingURL=chunk-2F22AUDA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory.ts"],"names":["ts","SyntaxKind","modifiers","questionToken","node","propertyName","isNumber"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,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,MA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er.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({\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 {\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>({\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.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({\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 const isExactNumber = Number.parseInt(value.toString()) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString()))) {\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()))) {\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 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 createTupleTypeNode = factory.createTupleTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n"]}
@@ -58,7 +58,7 @@ function isValidIdentifier(str) {
58
58
  return false;
59
59
  }
60
60
  const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest);
61
- return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind) === undefined;
61
+ return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind) === void 0;
62
62
  }
63
63
  function propertyName(name) {
64
64
  if (typeof name === "string") {
@@ -69,7 +69,7 @@ function propertyName(name) {
69
69
  var questionToken = factory.createToken(ts.SyntaxKind.QuestionToken);
70
70
  function createQuestionToken(token) {
71
71
  if (!token) {
72
- return undefined;
72
+ return void 0;
73
73
  }
74
74
  if (token === true) {
75
75
  return questionToken;
@@ -143,7 +143,7 @@ function createPropertySignature({
143
143
  type
144
144
  }) {
145
145
  return factory.createPropertySignature(
146
- [...modifiers2, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),
146
+ [...modifiers2, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean),
147
147
  propertyName(name),
148
148
  createQuestionToken(questionToken2),
149
149
  type
@@ -210,7 +210,7 @@ function createInterfaceDeclaration({
210
210
  typeParameters,
211
211
  members
212
212
  }) {
213
- return factory.createInterfaceDeclaration(modifiers2, name, typeParameters, undefined, members);
213
+ return factory.createInterfaceDeclaration(modifiers2, name, typeParameters, void 0, members);
214
214
  }
215
215
  function createTypeDeclaration({
216
216
  syntax,
@@ -224,7 +224,7 @@ function createTypeDeclaration({
224
224
  members: type.members,
225
225
  modifiers: isExportable ? [modifiers.export] : [],
226
226
  name,
227
- typeParameters: undefined
227
+ typeParameters: void 0
228
228
  });
229
229
  return appendJSDocToNode({
230
230
  node: node2,
@@ -235,7 +235,7 @@ function createTypeDeclaration({
235
235
  type,
236
236
  modifiers: isExportable ? [modifiers.export] : [],
237
237
  name,
238
- typeParameters: undefined
238
+ typeParameters: void 0
239
239
  });
240
240
  return appendJSDocToNode({
241
241
  node,
@@ -261,23 +261,23 @@ function createImportDeclaration({
261
261
  }) {
262
262
  if (!Array.isArray(name)) {
263
263
  let importPropertyName = factory.createIdentifier(name);
264
- let importName = undefined;
264
+ let importName = void 0;
265
265
  if (isNameSpace) {
266
- importPropertyName = undefined;
266
+ importPropertyName = void 0;
267
267
  importName = factory.createNamespaceImport(factory.createIdentifier(name));
268
268
  }
269
269
  return factory.createImportDeclaration(
270
- undefined,
270
+ void 0,
271
271
  factory.createImportClause(isTypeOnly, importPropertyName, importName),
272
272
  factory.createStringLiteral(path),
273
- undefined
273
+ void 0
274
274
  );
275
275
  }
276
276
  return factory.createImportDeclaration(
277
- undefined,
277
+ void 0,
278
278
  factory.createImportClause(
279
279
  isTypeOnly,
280
- undefined,
280
+ void 0,
281
281
  factory.createNamedImports(
282
282
  name.map((item) => {
283
283
  if (typeof item === "object") {
@@ -285,14 +285,14 @@ function createImportDeclaration({
285
285
  if (obj.name) {
286
286
  return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name));
287
287
  }
288
- return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName));
288
+ return factory.createImportSpecifier(false, void 0, factory.createIdentifier(obj.propertyName));
289
289
  }
290
- return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item));
290
+ return factory.createImportSpecifier(false, void 0, factory.createIdentifier(item));
291
291
  })
292
292
  )
293
293
  ),
294
294
  factory.createStringLiteral(path),
295
- undefined
295
+ void 0
296
296
  );
297
297
  }
298
298
  function createExportDeclaration({
@@ -307,23 +307,23 @@ function createExportDeclaration({
307
307
  if (!Array.isArray(name)) {
308
308
  const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
309
309
  return factory.createExportDeclaration(
310
- undefined,
310
+ void 0,
311
311
  isTypeOnly,
312
- asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,
312
+ asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : void 0,
313
313
  factory.createStringLiteral(path),
314
- undefined
314
+ void 0
315
315
  );
316
316
  }
317
317
  return factory.createExportDeclaration(
318
- undefined,
318
+ void 0,
319
319
  isTypeOnly,
320
320
  factory.createNamedExports(
321
321
  name.map((propertyName2) => {
322
- return factory.createExportSpecifier(false, undefined, typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2);
322
+ return factory.createExportSpecifier(false, void 0, typeof propertyName2 === "string" ? factory.createIdentifier(propertyName2) : propertyName2);
323
323
  })
324
324
  ),
325
325
  factory.createStringLiteral(path),
326
- undefined
326
+ void 0
327
327
  );
328
328
  }
329
329
  function createEnumDeclaration({
@@ -334,11 +334,11 @@ function createEnumDeclaration({
334
334
  }) {
335
335
  if (type === "literal") {
336
336
  return [
337
- undefined,
337
+ void 0,
338
338
  factory.createTypeAliasDeclaration(
339
339
  [factory.createToken(ts.SyntaxKind.ExportKeyword)],
340
340
  factory.createIdentifier(typeName),
341
- undefined,
341
+ void 0,
342
342
  factory.createUnionTypeNode(
343
343
  enums.map(([_key, value]) => {
344
344
  if (isNumber(value)) {
@@ -350,7 +350,7 @@ function createEnumDeclaration({
350
350
  if (value) {
351
351
  return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()));
352
352
  }
353
- return undefined;
353
+ return void 0;
354
354
  }).filter(Boolean)
355
355
  )
356
356
  )
@@ -358,9 +358,9 @@ function createEnumDeclaration({
358
358
  }
359
359
  if (type === "enum" || type === "constEnum") {
360
360
  return [
361
- undefined,
361
+ void 0,
362
362
  factory.createEnumDeclaration(
363
- [factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),
363
+ [factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
364
364
  factory.createIdentifier(typeName),
365
365
  enums.map(([key, value]) => {
366
366
  let initializer = factory.createStringLiteral(value?.toString());
@@ -377,7 +377,7 @@ function createEnumDeclaration({
377
377
  if (key) {
378
378
  return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer);
379
379
  }
380
- return undefined;
380
+ return void 0;
381
381
  }).filter(Boolean)
382
382
  )
383
383
  ];
@@ -390,8 +390,8 @@ function createEnumDeclaration({
390
390
  [
391
391
  factory.createVariableDeclaration(
392
392
  factory.createIdentifier(identifierName),
393
- undefined,
394
- undefined,
393
+ void 0,
394
+ void 0,
395
395
  factory.createAsExpression(
396
396
  factory.createObjectLiteralExpression(
397
397
  enums.map(([key, value]) => {
@@ -409,11 +409,11 @@ function createEnumDeclaration({
409
409
  if (key) {
410
410
  return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer);
411
411
  }
412
- return undefined;
412
+ return void 0;
413
413
  }).filter(Boolean),
414
414
  true
415
415
  ),
416
- factory.createTypeReferenceNode(factory.createIdentifier("const"), undefined)
416
+ factory.createTypeReferenceNode(factory.createIdentifier("const"), void 0)
417
417
  )
418
418
  )
419
419
  ],
@@ -423,10 +423,10 @@ function createEnumDeclaration({
423
423
  factory.createTypeAliasDeclaration(
424
424
  type === "asPascalConst" ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],
425
425
  factory.createIdentifier(typeName),
426
- undefined,
426
+ void 0,
427
427
  factory.createIndexedAccessTypeNode(
428
- factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),
429
- factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined))
428
+ factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
429
+ factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
430
430
  )
431
431
  )
432
432
  ];
@@ -452,6 +452,7 @@ function createOmitDeclaration({
452
452
  var keywordTypeNodes = {
453
453
  any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
454
454
  unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),
455
+ void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),
455
456
  number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
456
457
  integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
457
458
  object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),
@@ -473,5 +474,5 @@ var createTrue = factory.createTrue;
473
474
  var createFalse = factory.createFalse;
474
475
 
475
476
  export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createInterfaceDeclaration, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, factory_exports, keywordTypeNodes, modifiers, syntaxKind };
476
- //# sourceMappingURL=chunk-C3NK2LB5.js.map
477
- //# sourceMappingURL=chunk-C3NK2LB5.js.map
477
+ //# sourceMappingURL=chunk-ZJUIZ5AU.js.map
478
+ //# sourceMappingURL=chunk-ZJUIZ5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,CAAA;AAEpC,IAAM,wBAAwB,OAAQ,CAAA;AACtC,IAAM,aAAa,OAAQ,CAAA;AAC3B,IAAM,mBAAmB,OAAQ,CAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA;AACpC,IAAM,aAAa,OAAQ,CAAA;AAC3B,IAAM,cAAc,OAAQ,CAAA","file":"chunk-ZJUIZ5AU.js","sourcesContent":["import { isNumber } from 'remeda'\nimport ts, { SyntaxKind } 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\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({\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 {\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>({\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.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({\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 const isExactNumber = Number.parseInt(value.toString()) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString()))) {\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()))) {\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 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 createTupleTypeNode = factory.createTupleTypeNode\nexport const createTrue = factory.createTrue\nexport const createFalse = factory.createFalse\n"]}
@@ -129,6 +129,7 @@ declare function createOmitDeclaration({ keys, type, nonNullable, }: {
129
129
  declare const keywordTypeNodes: {
130
130
  readonly any: ts.KeywordTypeNode<ts.SyntaxKind.AnyKeyword>;
131
131
  readonly unknown: ts.KeywordTypeNode<ts.SyntaxKind.UnknownKeyword>;
132
+ readonly void: ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword>;
132
133
  readonly number: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
133
134
  readonly integer: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
134
135
  readonly object: ts.KeywordTypeNode<ts.SyntaxKind.ObjectKeyword>;
@@ -129,6 +129,7 @@ declare function createOmitDeclaration({ keys, type, nonNullable, }: {
129
129
  declare const keywordTypeNodes: {
130
130
  readonly any: ts.KeywordTypeNode<ts.SyntaxKind.AnyKeyword>;
131
131
  readonly unknown: ts.KeywordTypeNode<ts.SyntaxKind.UnknownKeyword>;
132
+ readonly void: ts.KeywordTypeNode<ts.SyntaxKind.VoidKeyword>;
132
133
  readonly number: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
133
134
  readonly integer: ts.KeywordTypeNode<ts.SyntaxKind.NumberKeyword>;
134
135
  readonly object: ts.KeywordTypeNode<ts.SyntaxKind.ObjectKeyword>;
package/dist/factory.cjs CHANGED
@@ -1,136 +1,136 @@
1
1
  'use strict';
2
2
 
3
- var chunkJJWEVMSA_cjs = require('./chunk-JJWEVMSA.cjs');
3
+ var chunk2F22AUDA_cjs = require('./chunk-2F22AUDA.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "appendJSDocToNode", {
8
8
  enumerable: true,
9
- get: function () { return chunkJJWEVMSA_cjs.appendJSDocToNode; }
9
+ get: function () { return chunk2F22AUDA_cjs.appendJSDocToNode; }
10
10
  });
11
11
  Object.defineProperty(exports, "createArrayDeclaration", {
12
12
  enumerable: true,
13
- get: function () { return chunkJJWEVMSA_cjs.createArrayDeclaration; }
13
+ get: function () { return chunk2F22AUDA_cjs.createArrayDeclaration; }
14
14
  });
15
15
  Object.defineProperty(exports, "createArrayTypeNode", {
16
16
  enumerable: true,
17
- get: function () { return chunkJJWEVMSA_cjs.createArrayTypeNode; }
17
+ get: function () { return chunk2F22AUDA_cjs.createArrayTypeNode; }
18
18
  });
19
19
  Object.defineProperty(exports, "createEnumDeclaration", {
20
20
  enumerable: true,
21
- get: function () { return chunkJJWEVMSA_cjs.createEnumDeclaration; }
21
+ get: function () { return chunk2F22AUDA_cjs.createEnumDeclaration; }
22
22
  });
23
23
  Object.defineProperty(exports, "createExportDeclaration", {
24
24
  enumerable: true,
25
- get: function () { return chunkJJWEVMSA_cjs.createExportDeclaration; }
25
+ get: function () { return chunk2F22AUDA_cjs.createExportDeclaration; }
26
26
  });
27
27
  Object.defineProperty(exports, "createFalse", {
28
28
  enumerable: true,
29
- get: function () { return chunkJJWEVMSA_cjs.createFalse; }
29
+ get: function () { return chunk2F22AUDA_cjs.createFalse; }
30
30
  });
31
31
  Object.defineProperty(exports, "createIdentifier", {
32
32
  enumerable: true,
33
- get: function () { return chunkJJWEVMSA_cjs.createIdentifier; }
33
+ get: function () { return chunk2F22AUDA_cjs.createIdentifier; }
34
34
  });
35
35
  Object.defineProperty(exports, "createImportDeclaration", {
36
36
  enumerable: true,
37
- get: function () { return chunkJJWEVMSA_cjs.createImportDeclaration; }
37
+ get: function () { return chunk2F22AUDA_cjs.createImportDeclaration; }
38
38
  });
39
39
  Object.defineProperty(exports, "createIndexSignature", {
40
40
  enumerable: true,
41
- get: function () { return chunkJJWEVMSA_cjs.createIndexSignature; }
41
+ get: function () { return chunk2F22AUDA_cjs.createIndexSignature; }
42
42
  });
43
43
  Object.defineProperty(exports, "createInterfaceDeclaration", {
44
44
  enumerable: true,
45
- get: function () { return chunkJJWEVMSA_cjs.createInterfaceDeclaration; }
45
+ get: function () { return chunk2F22AUDA_cjs.createInterfaceDeclaration; }
46
46
  });
47
47
  Object.defineProperty(exports, "createIntersectionDeclaration", {
48
48
  enumerable: true,
49
- get: function () { return chunkJJWEVMSA_cjs.createIntersectionDeclaration; }
49
+ get: function () { return chunk2F22AUDA_cjs.createIntersectionDeclaration; }
50
50
  });
51
51
  Object.defineProperty(exports, "createJSDoc", {
52
52
  enumerable: true,
53
- get: function () { return chunkJJWEVMSA_cjs.createJSDoc; }
53
+ get: function () { return chunk2F22AUDA_cjs.createJSDoc; }
54
54
  });
55
55
  Object.defineProperty(exports, "createLiteralTypeNode", {
56
56
  enumerable: true,
57
- get: function () { return chunkJJWEVMSA_cjs.createLiteralTypeNode; }
57
+ get: function () { return chunk2F22AUDA_cjs.createLiteralTypeNode; }
58
58
  });
59
59
  Object.defineProperty(exports, "createNamespaceDeclaration", {
60
60
  enumerable: true,
61
- get: function () { return chunkJJWEVMSA_cjs.createNamespaceDeclaration; }
61
+ get: function () { return chunk2F22AUDA_cjs.createNamespaceDeclaration; }
62
62
  });
63
63
  Object.defineProperty(exports, "createNull", {
64
64
  enumerable: true,
65
- get: function () { return chunkJJWEVMSA_cjs.createNull; }
65
+ get: function () { return chunk2F22AUDA_cjs.createNull; }
66
66
  });
67
67
  Object.defineProperty(exports, "createNumericLiteral", {
68
68
  enumerable: true,
69
- get: function () { return chunkJJWEVMSA_cjs.createNumericLiteral; }
69
+ get: function () { return chunk2F22AUDA_cjs.createNumericLiteral; }
70
70
  });
71
71
  Object.defineProperty(exports, "createOmitDeclaration", {
72
72
  enumerable: true,
73
- get: function () { return chunkJJWEVMSA_cjs.createOmitDeclaration; }
73
+ get: function () { return chunk2F22AUDA_cjs.createOmitDeclaration; }
74
74
  });
75
75
  Object.defineProperty(exports, "createParameterSignature", {
76
76
  enumerable: true,
77
- get: function () { return chunkJJWEVMSA_cjs.createParameterSignature; }
77
+ get: function () { return chunk2F22AUDA_cjs.createParameterSignature; }
78
78
  });
79
79
  Object.defineProperty(exports, "createPropertySignature", {
80
80
  enumerable: true,
81
- get: function () { return chunkJJWEVMSA_cjs.createPropertySignature; }
81
+ get: function () { return chunk2F22AUDA_cjs.createPropertySignature; }
82
82
  });
83
83
  Object.defineProperty(exports, "createQuestionToken", {
84
84
  enumerable: true,
85
- get: function () { return chunkJJWEVMSA_cjs.createQuestionToken; }
85
+ get: function () { return chunk2F22AUDA_cjs.createQuestionToken; }
86
86
  });
87
87
  Object.defineProperty(exports, "createStringLiteral", {
88
88
  enumerable: true,
89
- get: function () { return chunkJJWEVMSA_cjs.createStringLiteral; }
89
+ get: function () { return chunk2F22AUDA_cjs.createStringLiteral; }
90
90
  });
91
91
  Object.defineProperty(exports, "createTrue", {
92
92
  enumerable: true,
93
- get: function () { return chunkJJWEVMSA_cjs.createTrue; }
93
+ get: function () { return chunk2F22AUDA_cjs.createTrue; }
94
94
  });
95
95
  Object.defineProperty(exports, "createTupleDeclaration", {
96
96
  enumerable: true,
97
- get: function () { return chunkJJWEVMSA_cjs.createTupleDeclaration; }
97
+ get: function () { return chunk2F22AUDA_cjs.createTupleDeclaration; }
98
98
  });
99
99
  Object.defineProperty(exports, "createTupleTypeNode", {
100
100
  enumerable: true,
101
- get: function () { return chunkJJWEVMSA_cjs.createTupleTypeNode; }
101
+ get: function () { return chunk2F22AUDA_cjs.createTupleTypeNode; }
102
102
  });
103
103
  Object.defineProperty(exports, "createTypeAliasDeclaration", {
104
104
  enumerable: true,
105
- get: function () { return chunkJJWEVMSA_cjs.createTypeAliasDeclaration; }
105
+ get: function () { return chunk2F22AUDA_cjs.createTypeAliasDeclaration; }
106
106
  });
107
107
  Object.defineProperty(exports, "createTypeDeclaration", {
108
108
  enumerable: true,
109
- get: function () { return chunkJJWEVMSA_cjs.createTypeDeclaration; }
109
+ get: function () { return chunk2F22AUDA_cjs.createTypeDeclaration; }
110
110
  });
111
111
  Object.defineProperty(exports, "createTypeLiteralNode", {
112
112
  enumerable: true,
113
- get: function () { return chunkJJWEVMSA_cjs.createTypeLiteralNode; }
113
+ get: function () { return chunk2F22AUDA_cjs.createTypeLiteralNode; }
114
114
  });
115
115
  Object.defineProperty(exports, "createTypeReferenceNode", {
116
116
  enumerable: true,
117
- get: function () { return chunkJJWEVMSA_cjs.createTypeReferenceNode; }
117
+ get: function () { return chunk2F22AUDA_cjs.createTypeReferenceNode; }
118
118
  });
119
119
  Object.defineProperty(exports, "createUnionDeclaration", {
120
120
  enumerable: true,
121
- get: function () { return chunkJJWEVMSA_cjs.createUnionDeclaration; }
121
+ get: function () { return chunk2F22AUDA_cjs.createUnionDeclaration; }
122
122
  });
123
123
  Object.defineProperty(exports, "keywordTypeNodes", {
124
124
  enumerable: true,
125
- get: function () { return chunkJJWEVMSA_cjs.keywordTypeNodes; }
125
+ get: function () { return chunk2F22AUDA_cjs.keywordTypeNodes; }
126
126
  });
127
127
  Object.defineProperty(exports, "modifiers", {
128
128
  enumerable: true,
129
- get: function () { return chunkJJWEVMSA_cjs.modifiers; }
129
+ get: function () { return chunk2F22AUDA_cjs.modifiers; }
130
130
  });
131
131
  Object.defineProperty(exports, "syntaxKind", {
132
132
  enumerable: true,
133
- get: function () { return chunkJJWEVMSA_cjs.syntaxKind; }
133
+ get: function () { return chunk2F22AUDA_cjs.syntaxKind; }
134
134
  });
135
135
  //# sourceMappingURL=factory.cjs.map
136
136
  //# sourceMappingURL=factory.cjs.map
@@ -1,2 +1,2 @@
1
1
  import 'typescript';
2
- export { j as appendJSDocToNode, d as createArrayDeclaration, A as createArrayTypeNode, t as createEnumDeclaration, r as createExportDeclaration, G as createFalse, D as createIdentifier, q as createImportDeclaration, k as createIndexSignature, n as createInterfaceDeclaration, a as createIntersectionDeclaration, i as createJSDoc, B as createLiteralTypeNode, p as createNamespaceDeclaration, C as createNull, y as createNumericLiteral, u as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, z as createStringLiteral, F as createTrue, b as createTupleDeclaration, E as createTupleTypeNode, l as createTypeAliasDeclaration, o as createTypeDeclaration, w as createTypeLiteralNode, x as createTypeReferenceNode, e as createUnionDeclaration, v as keywordTypeNodes, m as modifiers, s as syntaxKind } from './factory-B1vVu2Ii.cjs';
2
+ export { j as appendJSDocToNode, d as createArrayDeclaration, A as createArrayTypeNode, t as createEnumDeclaration, r as createExportDeclaration, G as createFalse, D as createIdentifier, q as createImportDeclaration, k as createIndexSignature, n as createInterfaceDeclaration, a as createIntersectionDeclaration, i as createJSDoc, B as createLiteralTypeNode, p as createNamespaceDeclaration, C as createNull, y as createNumericLiteral, u as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, z as createStringLiteral, F as createTrue, b as createTupleDeclaration, E as createTupleTypeNode, l as createTypeAliasDeclaration, o as createTypeDeclaration, w as createTypeLiteralNode, x as createTypeReferenceNode, e as createUnionDeclaration, v as keywordTypeNodes, m as modifiers, s as syntaxKind } from './factory-CYUWOQtD.cjs';
package/dist/factory.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'typescript';
2
- export { j as appendJSDocToNode, d as createArrayDeclaration, A as createArrayTypeNode, t as createEnumDeclaration, r as createExportDeclaration, G as createFalse, D as createIdentifier, q as createImportDeclaration, k as createIndexSignature, n as createInterfaceDeclaration, a as createIntersectionDeclaration, i as createJSDoc, B as createLiteralTypeNode, p as createNamespaceDeclaration, C as createNull, y as createNumericLiteral, u as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, z as createStringLiteral, F as createTrue, b as createTupleDeclaration, E as createTupleTypeNode, l as createTypeAliasDeclaration, o as createTypeDeclaration, w as createTypeLiteralNode, x as createTypeReferenceNode, e as createUnionDeclaration, v as keywordTypeNodes, m as modifiers, s as syntaxKind } from './factory-B1vVu2Ii.js';
2
+ export { j as appendJSDocToNode, d as createArrayDeclaration, A as createArrayTypeNode, t as createEnumDeclaration, r as createExportDeclaration, G as createFalse, D as createIdentifier, q as createImportDeclaration, k as createIndexSignature, n as createInterfaceDeclaration, a as createIntersectionDeclaration, i as createJSDoc, B as createLiteralTypeNode, p as createNamespaceDeclaration, C as createNull, y as createNumericLiteral, u as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, z as createStringLiteral, F as createTrue, b as createTupleDeclaration, E as createTupleTypeNode, l as createTypeAliasDeclaration, o as createTypeDeclaration, w as createTypeLiteralNode, x as createTypeReferenceNode, e as createUnionDeclaration, v as keywordTypeNodes, m as modifiers, s as syntaxKind } from './factory-CYUWOQtD.js';
package/dist/factory.js CHANGED
@@ -1,3 +1,3 @@
1
- export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createInterfaceDeclaration, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, keywordTypeNodes, modifiers, syntaxKind } from './chunk-C3NK2LB5.js';
1
+ export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createInterfaceDeclaration, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, keywordTypeNodes, modifiers, syntaxKind } from './chunk-ZJUIZ5AU.js';
2
2
  //# sourceMappingURL=factory.js.map
3
3
  //# sourceMappingURL=factory.js.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJJWEVMSA_cjs = require('./chunk-JJWEVMSA.cjs');
3
+ var chunk2F22AUDA_cjs = require('./chunk-2F22AUDA.cjs');
4
4
  var ts = require('typescript');
5
5
  var prettier = require('prettier');
6
6
  var pluginTypescript = require('prettier/plugins/typescript');
@@ -53,7 +53,7 @@ async function format(source) {
53
53
 
54
54
  Object.defineProperty(exports, "factory", {
55
55
  enumerable: true,
56
- get: function () { return chunkJJWEVMSA_cjs.factory_exports; }
56
+ get: function () { return chunk2F22AUDA_cjs.factory_exports; }
57
57
  });
58
58
  exports.format = format;
59
59
  exports.print = print;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import ts, { PrinterOptions } from 'typescript';
2
- export { f as factory } from './factory-B1vVu2Ii.cjs';
2
+ export { f as factory } from './factory-CYUWOQtD.cjs';
3
3
 
4
4
  type PrintOptions = {
5
5
  source?: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import ts, { PrinterOptions } from 'typescript';
2
- export { f as factory } from './factory-B1vVu2Ii.js';
2
+ export { f as factory } from './factory-CYUWOQtD.js';
3
3
 
4
4
  type PrintOptions = {
5
5
  source?: string;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { factory_exports as factory } from './chunk-C3NK2LB5.js';
1
+ export { factory_exports as factory } from './chunk-ZJUIZ5AU.js';
2
2
  import ts from 'typescript';
3
3
  import { format as format$1 } from 'prettier';
4
4
  import pluginTypescript from 'prettier/plugins/typescript';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/parser-ts",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "TypeScript parser",
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,14 +48,14 @@
48
48
  "!/**/__tests__/**"
49
49
  ],
50
50
  "dependencies": {
51
- "prettier": "^3.5.2",
52
- "remeda": "^2.20.2",
53
- "typescript": "^5.7.3"
51
+ "prettier": "^3.5.3",
52
+ "remeda": "^2.21.1",
53
+ "typescript": "^5.8.2"
54
54
  },
55
55
  "devDependencies": {
56
- "tsup": "^8.3.6",
57
- "@kubb/config-ts": "3.6.0",
58
- "@kubb/config-tsup": "3.6.0"
56
+ "tsup": "^8.4.0",
57
+ "@kubb/config-ts": "3.6.2",
58
+ "@kubb/config-tsup": "3.6.2"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=20"
package/src/factory.ts CHANGED
@@ -591,6 +591,7 @@ export function createOmitDeclaration({
591
591
  export const keywordTypeNodes = {
592
592
  any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
593
593
  unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),
594
+ void: factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword),
594
595
  number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
595
596
  integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),
596
597
  object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),
@@ -1 +0,0 @@
1
- {"version":3,"sources":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AAsB,OAAQ,CAAA;AACpC,IAAM,aAAa,OAAQ,CAAA;AAC3B,IAAM,cAAc,OAAQ,CAAA","file":"chunk-C3NK2LB5.js","sourcesContent":["import { isNumber } from 'remeda'\nimport ts, { SyntaxKind } 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\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({\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 {\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>({\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.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({\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 const isExactNumber = Number.parseInt(value.toString()) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString()))) {\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()))) {\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 +0,0 @@
1
- {"version":3,"sources":["../src/factory.ts"],"names":["ts","SyntaxKind","modifiers","questionToken","node","propertyName","isNumber"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,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,0BAAA,EAAA,MAAA,0BAAA;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,EA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;AAAA,EACjE,MAAQ,EAAA,OAAA,CAAQ,qBAAsB,CAAAA,mBAAA,CAAG,WAAW,aAAa,CAAA;AAAA,EACjE,OAAS,EAAA,OAAA,CAAQ,qBAAsB,CAAAA,mBAAA,CAAG,WAAW,cAAc,CAAA;AAAA,EACnE,SAAW,EAAA,OAAA,CAAQ,qBAAsB,CAAAA,mBAAA,CAAG,WAAW,gBAAgB,CAAA;AAAA,EACvE,IAAA,EAAM,QAAQ,qBAAsB,CAAA,OAAA,CAAQ,YAAYA,mBAAG,CAAA,UAAA,CAAW,WAAW,CAAC;AACpF;AAEO,IAAM,wBAAwB,OAAQ,CAAA;AAEtC,IAAM,0BAA0B,OAAQ,CAAA;AACxC,IAAM,uBAAuB,OAAQ,CAAA;AACrC,IAAM,sBAAsB,OAAQ,CAAA;AAEpC,IAAM,sBAAsB,OAAQ,CAAA;AAEpC,IAAM,wBAAwB,OAAQ,CAAA;AACtC,IAAM,aAAa,OAAQ,CAAA;AAC3B,IAAM,mBAAmB,OAAQ,CAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA;AACpC,IAAM,aAAa,OAAQ,CAAA;AAC3B,IAAM,cAAc,OAAQ,CAAA","file":"chunk-JJWEVMSA.cjs","sourcesContent":["import { isNumber } from 'remeda'\nimport ts, { SyntaxKind } 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\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({\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 {\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>({\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.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({\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 const isExactNumber = Number.parseInt(value.toString()) === value\n\n if (isExactNumber && isNumber(Number.parseInt(value.toString()))) {\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()))) {\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"]}