@kubb/parser-ts 3.0.0-alpha.2 → 3.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,10 +13,6 @@
13
13
  [![Coverage][coverage-src]][coverage-href]
14
14
  [![License][license-src]][license-href]
15
15
 
16
- <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
17
- <!-- ALL-CONTRIBUTORS-BADGE:END -->
18
- </p>
19
-
20
16
  <h4>
21
17
  <a href="https://codesandbox.io/s/github/kubb-labs/kubb/tree/alpha/examples/typescript" target="_blank">View Demo</a>
22
18
  <span> · </span>
@@ -27,6 +23,19 @@
27
23
  <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
28
24
  </h4>
29
25
  </div>
26
+ ## Supporting Kubb
27
+
28
+ Kubb uses an MIT-licensed open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
29
+
30
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
31
+
32
+ <p align="center">
33
+ <a href="https://github.com/sponsors/stijnvanhulle">
34
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
35
+ </a>
36
+ </p>
37
+
38
+
30
39
  <!-- Badges -->
31
40
 
32
41
  [npm-version-src]: https://img.shields.io/npm/v/@kubb/parser-ts?flat&colorA=18181B&colorB=f58517
@@ -1,3 +1,6 @@
1
+ import { isNumber } from 'remeda';
2
+ import ts from 'typescript';
3
+
1
4
  var __defProp = Object.defineProperty;
2
5
  var __export = (target, all) => {
3
6
  for (var name in all)
@@ -35,8 +38,6 @@ __export(factory_exports, {
35
38
  keywordTypeNodes: () => keywordTypeNodes,
36
39
  modifiers: () => modifiers
37
40
  });
38
- import { isNumber } from "remeda";
39
- import ts from "typescript";
40
41
  var { factory } = ts;
41
42
  var modifiers = {
42
43
  async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),
@@ -255,7 +256,7 @@ function createExportDeclaration({
255
256
  name
256
257
  }) {
257
258
  if (name && !Array.isArray(name) && !asAlias) {
258
- throw new Error("When using `name` as string, `asAlias` should be true");
259
+ console.warn(`When using name as string, asAlias should be true ${name}`);
259
260
  }
260
261
  if (!Array.isArray(name)) {
261
262
  const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
@@ -287,6 +288,7 @@ function createEnumDeclaration({
287
288
  }) {
288
289
  if (type === "literal") {
289
290
  return [
291
+ void 0,
290
292
  factory.createTypeAliasDeclaration(
291
293
  [factory.createToken(ts.SyntaxKind.ExportKeyword)],
292
294
  factory.createIdentifier(typeName),
@@ -310,6 +312,7 @@ function createEnumDeclaration({
310
312
  }
311
313
  if (type === "enum" || type === "constEnum") {
312
314
  return [
315
+ void 0,
313
316
  factory.createEnumDeclaration(
314
317
  [factory.createToken(ts.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
315
318
  factory.createIdentifier(typeName),
@@ -371,7 +374,7 @@ function createEnumDeclaration({
371
374
  )
372
375
  ),
373
376
  factory.createTypeAliasDeclaration(
374
- [factory.createToken(ts.SyntaxKind.ExportKeyword)],
377
+ type === "asPascalConst" ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],
375
378
  factory.createIdentifier(typeName),
376
379
  void 0,
377
380
  factory.createIndexedAccessTypeNode(
@@ -420,34 +423,6 @@ var createNull = factory.createNull;
420
423
  var createIdentifier = factory.createIdentifier;
421
424
  var createTupleTypeNode = factory.createTupleTypeNode;
422
425
 
423
- export {
424
- modifiers,
425
- createQuestionToken,
426
- createIntersectionDeclaration,
427
- createTupleDeclaration,
428
- createArrayDeclaration,
429
- createUnionDeclaration,
430
- createPropertySignature,
431
- createParameterSignature,
432
- createJSDoc,
433
- appendJSDocToNode,
434
- createIndexSignature,
435
- createTypeAliasDeclaration,
436
- createNamespaceDeclaration,
437
- createImportDeclaration,
438
- createExportDeclaration,
439
- createEnumDeclaration,
440
- createOmitDeclaration,
441
- keywordTypeNodes,
442
- createTypeLiteralNode,
443
- createTypeReferenceNode,
444
- createNumericLiteral,
445
- createStringLiteral,
446
- createArrayTypeNode,
447
- createLiteralTypeNode,
448
- createNull,
449
- createIdentifier,
450
- createTupleTypeNode,
451
- factory_exports
452
- };
453
- //# sourceMappingURL=chunk-QHLKNPYD.js.map
426
+ export { appendJSDocToNode, createArrayDeclaration, createArrayTypeNode, createEnumDeclaration, createExportDeclaration, createIdentifier, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, factory_exports, keywordTypeNodes, modifiers };
427
+ //# sourceMappingURL=chunk-2BN5RQSZ.js.map
428
+ //# sourceMappingURL=chunk-2BN5RQSZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory.ts"],"names":["modifiers","questionToken","propertyName"],"mappings":";;;;;;;;;;AAAA,IAAA,eAAA,GAAA,GAAA;AAAA,QAAA,CAAA,eAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,mBAAA,EAAA,MAAA,mBAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,qBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,uBAAA,EAAA,MAAA,uBAAA;AAAA,EAAA,oBAAA,EAAA,MAAA,oBAAA;AAAA,EAAA,6BAAA,EAAA,MAAA,6BAAA;AAAA,EAAA,WAAA,EAAA,MAAA,WAAA;AAAA,EAAA,qBAAA,EAAA,MAAA,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OAAA,CAAQ,qBAAsB,CAAA,EAAA,CAAG,WAAW,aAAa,CAAA;AAAA,EACjE,OAAS,EAAA,OAAA,CAAQ,qBAAsB,CAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AAAA,EACnE,SAAW,EAAA,OAAA,CAAQ,qBAAsB,CAAA,EAAA,CAAG,WAAW,gBAAgB,CAAA;AAAA,EACvE,IAAA,EAAM,QAAQ,qBAAsB,CAAA,OAAA,CAAQ,YAAY,EAAG,CAAA,UAAA,CAAW,WAAW,CAAC,CAAA;AACpF,EAAA;AAEO,IAAM,wBAAwB,OAAQ,CAAA,sBAAA;AAEtC,IAAM,0BAA0B,OAAQ,CAAA,wBAAA;AACxC,IAAM,uBAAuB,OAAQ,CAAA,qBAAA;AACrC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AAEpC,IAAM,sBAAsB,OAAQ,CAAA,oBAAA;AAEpC,IAAM,wBAAwB,OAAQ,CAAA,sBAAA;AACtC,IAAM,aAAa,OAAQ,CAAA,WAAA;AAC3B,IAAM,mBAAmB,OAAQ,CAAA,iBAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA","file":"chunk-2BN5RQSZ.js","sourcesContent":["import { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({\n nodes,\n}: {\n nodes: Array<ts.TypeNode>\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({\n node,\n comments,\n}: {\n node: TNode\n comments: Array<string | undefined>\n}) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createNamespaceDeclaration({\n statements,\n name,\n}: {\n name: string\n statements: ts.Statement[]\n}) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined = undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n name.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n name.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(Number.parseInt(value.toString()))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString()))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(`${value?.toString()}`)\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({\n keys,\n type,\n nonNullable,\n}: {\n keys: Array<string> | string\n type: ts.TypeNode\n nonNullable?: boolean\n}) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createTupleTypeNode = factory.createTupleTypeNode\n"]}
@@ -1,4 +1,13 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var __defProp = Object.defineProperty;
1
+ 'use strict';
2
+
3
+ var remeda = require('remeda');
4
+ var ts = require('typescript');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var ts__default = /*#__PURE__*/_interopDefault(ts);
9
+
10
+ var __defProp = Object.defineProperty;
2
11
  var __export = (target, all) => {
3
12
  for (var name in all)
4
13
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -35,21 +44,19 @@ __export(factory_exports, {
35
44
  keywordTypeNodes: () => keywordTypeNodes,
36
45
  modifiers: () => modifiers
37
46
  });
38
- var _remeda = require('remeda');
39
- var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
40
- var { factory } = _typescript2.default;
47
+ var { factory } = ts__default.default;
41
48
  var modifiers = {
42
- async: factory.createModifier(_typescript2.default.SyntaxKind.AsyncKeyword),
43
- export: factory.createModifier(_typescript2.default.SyntaxKind.ExportKeyword),
44
- const: factory.createModifier(_typescript2.default.SyntaxKind.ConstKeyword),
45
- static: factory.createModifier(_typescript2.default.SyntaxKind.StaticKeyword)
49
+ async: factory.createModifier(ts__default.default.SyntaxKind.AsyncKeyword),
50
+ export: factory.createModifier(ts__default.default.SyntaxKind.ExportKeyword),
51
+ const: factory.createModifier(ts__default.default.SyntaxKind.ConstKeyword),
52
+ static: factory.createModifier(ts__default.default.SyntaxKind.StaticKeyword)
46
53
  };
47
54
  function isValidIdentifier(str) {
48
55
  if (!str.length || str.trim() !== str) {
49
56
  return false;
50
57
  }
51
- const node = _typescript2.default.parseIsolatedEntityName(str, _typescript2.default.ScriptTarget.Latest);
52
- return !!node && node.kind === _typescript2.default.SyntaxKind.Identifier && _typescript2.default.identifierToKeywordKind(node.kind) === void 0;
58
+ const node = ts__default.default.parseIsolatedEntityName(str, ts__default.default.ScriptTarget.Latest);
59
+ return !!node && node.kind === ts__default.default.SyntaxKind.Identifier && ts__default.default.identifierToKeywordKind(node.kind) === void 0;
53
60
  }
54
61
  function propertyName(name) {
55
62
  if (typeof name === "string") {
@@ -57,7 +64,7 @@ function propertyName(name) {
57
64
  }
58
65
  return name;
59
66
  }
60
- var questionToken = factory.createToken(_typescript2.default.SyntaxKind.QuestionToken);
67
+ var questionToken = factory.createToken(ts__default.default.SyntaxKind.QuestionToken);
61
68
  function createQuestionToken(token) {
62
69
  if (!token) {
63
70
  return void 0;
@@ -134,7 +141,7 @@ function createPropertySignature({
134
141
  type
135
142
  }) {
136
143
  return factory.createPropertySignature(
137
- [...modifiers2, readOnly ? factory.createToken(_typescript2.default.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean),
144
+ [...modifiers2, readOnly ? factory.createToken(ts__default.default.SyntaxKind.ReadonlyKeyword) : void 0].filter(Boolean),
138
145
  propertyName(name),
139
146
  createQuestionToken(questionToken2),
140
147
  type
@@ -177,13 +184,13 @@ function appendJSDocToNode({
177
184
  return `${acc}
178
185
  * ${comment}`;
179
186
  }, "*");
180
- return _typescript2.default.addSyntheticLeadingComment({ ...node }, _typescript2.default.SyntaxKind.MultiLineCommentTrivia, `${text || "*"}
187
+ return ts__default.default.addSyntheticLeadingComment({ ...node }, ts__default.default.SyntaxKind.MultiLineCommentTrivia, `${text || "*"}
181
188
  `, true);
182
189
  }
183
190
  function createIndexSignature(type, {
184
191
  modifiers: modifiers2,
185
192
  indexName = "key",
186
- indexType = factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.StringKeyword)
193
+ indexType = factory.createKeywordTypeNode(ts__default.default.SyntaxKind.StringKeyword)
187
194
  } = {}) {
188
195
  return factory.createIndexSignature(modifiers2, [createParameterSignature(indexName, { type: indexType })], type);
189
196
  }
@@ -200,10 +207,10 @@ function createNamespaceDeclaration({
200
207
  name
201
208
  }) {
202
209
  return factory.createModuleDeclaration(
203
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
210
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
204
211
  factory.createIdentifier(name),
205
212
  factory.createModuleBlock(statements),
206
- _typescript2.default.NodeFlags.Namespace
213
+ ts__default.default.NodeFlags.Namespace
207
214
  );
208
215
  }
209
216
  function createImportDeclaration({
@@ -255,10 +262,10 @@ function createExportDeclaration({
255
262
  name
256
263
  }) {
257
264
  if (name && !Array.isArray(name) && !asAlias) {
258
- throw new Error("When using `name` as string, `asAlias` should be true");
265
+ console.warn(`When using name as string, asAlias should be true ${name}`);
259
266
  }
260
267
  if (!Array.isArray(name)) {
261
- const parsedName = _optionalChain([name, 'optionalAccess', _ => _.match, 'call', _2 => _2(/^\d/)]) ? `_${_optionalChain([name, 'optionalAccess', _3 => _3.slice, 'call', _4 => _4(1)])}` : name;
268
+ const parsedName = name?.match(/^\d/) ? `_${name?.slice(1)}` : name;
262
269
  return factory.createExportDeclaration(
263
270
  void 0,
264
271
  isTypeOnly,
@@ -287,14 +294,15 @@ function createEnumDeclaration({
287
294
  }) {
288
295
  if (type === "literal") {
289
296
  return [
297
+ void 0,
290
298
  factory.createTypeAliasDeclaration(
291
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
299
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
292
300
  factory.createIdentifier(typeName),
293
301
  void 0,
294
302
  factory.createUnionTypeNode(
295
303
  enums.map(([_key, value]) => {
296
- if (_remeda.isNumber.call(void 0, value)) {
297
- return factory.createLiteralTypeNode(factory.createNumericLiteral(_optionalChain([value, 'optionalAccess', _5 => _5.toString, 'call', _6 => _6()])));
304
+ if (remeda.isNumber(value)) {
305
+ return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()));
298
306
  }
299
307
  if (typeof value === "boolean") {
300
308
  return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse());
@@ -310,18 +318,19 @@ function createEnumDeclaration({
310
318
  }
311
319
  if (type === "enum" || type === "constEnum") {
312
320
  return [
321
+ void 0,
313
322
  factory.createEnumDeclaration(
314
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(_typescript2.default.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
323
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword), type === "constEnum" ? factory.createToken(ts__default.default.SyntaxKind.ConstKeyword) : void 0].filter(Boolean),
315
324
  factory.createIdentifier(typeName),
316
325
  enums.map(([key, value]) => {
317
- let initializer = factory.createStringLiteral(_optionalChain([value, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]));
318
- if (_remeda.isNumber.call(void 0, Number.parseInt(value.toString()))) {
326
+ let initializer = factory.createStringLiteral(value?.toString());
327
+ if (remeda.isNumber(Number.parseInt(value.toString()))) {
319
328
  initializer = factory.createNumericLiteral(value);
320
329
  }
321
330
  if (typeof value === "boolean") {
322
331
  initializer = value ? factory.createTrue() : factory.createFalse();
323
332
  }
324
- if (_remeda.isNumber.call(void 0, Number.parseInt(key.toString()))) {
333
+ if (remeda.isNumber(Number.parseInt(key.toString()))) {
325
334
  return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer);
326
335
  }
327
336
  if (key) {
@@ -335,7 +344,7 @@ function createEnumDeclaration({
335
344
  const identifierName = type === "asPascalConst" ? typeName : name;
336
345
  return [
337
346
  factory.createVariableStatement(
338
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
347
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
339
348
  factory.createVariableDeclarationList(
340
349
  [
341
350
  factory.createVariableDeclaration(
@@ -345,10 +354,10 @@ function createEnumDeclaration({
345
354
  factory.createAsExpression(
346
355
  factory.createObjectLiteralExpression(
347
356
  enums.map(([key, value]) => {
348
- let initializer = factory.createStringLiteral(`${_optionalChain([value, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()])}`);
349
- if (_remeda.isNumber.call(void 0, value)) {
357
+ let initializer = factory.createStringLiteral(`${value?.toString()}`);
358
+ if (remeda.isNumber(value)) {
350
359
  if (value < 0) {
351
- initializer = factory.createPrefixUnaryExpression(_typescript2.default.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)));
360
+ initializer = factory.createPrefixUnaryExpression(ts__default.default.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)));
352
361
  } else {
353
362
  initializer = factory.createNumericLiteral(value);
354
363
  }
@@ -367,16 +376,16 @@ function createEnumDeclaration({
367
376
  )
368
377
  )
369
378
  ],
370
- _typescript2.default.NodeFlags.Const
379
+ ts__default.default.NodeFlags.Const
371
380
  )
372
381
  ),
373
382
  factory.createTypeAliasDeclaration(
374
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
383
+ type === "asPascalConst" ? [] : [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
375
384
  factory.createIdentifier(typeName),
376
385
  void 0,
377
386
  factory.createIndexedAccessTypeNode(
378
387
  factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
379
- factory.createTypeOperatorNode(_typescript2.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
388
+ factory.createTypeOperatorNode(ts__default.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0))
380
389
  )
381
390
  )
382
391
  ];
@@ -400,15 +409,15 @@ function createOmitDeclaration({
400
409
  return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]);
401
410
  }
402
411
  var keywordTypeNodes = {
403
- any: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.AnyKeyword),
404
- unknown: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.UnknownKeyword),
405
- number: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.NumberKeyword),
406
- integer: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.NumberKeyword),
407
- object: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.ObjectKeyword),
408
- string: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.StringKeyword),
409
- boolean: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.BooleanKeyword),
410
- undefined: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.UndefinedKeyword),
411
- null: factory.createLiteralTypeNode(factory.createToken(_typescript2.default.SyntaxKind.NullKeyword))
412
+ any: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.AnyKeyword),
413
+ unknown: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.UnknownKeyword),
414
+ number: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
415
+ integer: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.NumberKeyword),
416
+ object: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.ObjectKeyword),
417
+ string: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.StringKeyword),
418
+ boolean: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.BooleanKeyword),
419
+ undefined: factory.createKeywordTypeNode(ts__default.default.SyntaxKind.UndefinedKeyword),
420
+ null: factory.createLiteralTypeNode(factory.createToken(ts__default.default.SyntaxKind.NullKeyword))
412
421
  };
413
422
  var createTypeLiteralNode = factory.createTypeLiteralNode;
414
423
  var createTypeReferenceNode = factory.createTypeReferenceNode;
@@ -420,34 +429,33 @@ var createNull = factory.createNull;
420
429
  var createIdentifier = factory.createIdentifier;
421
430
  var createTupleTypeNode = factory.createTupleTypeNode;
422
431
 
423
-
424
-
425
-
426
-
427
-
428
-
429
-
430
-
431
-
432
-
433
-
434
-
435
-
436
-
437
-
438
-
439
-
440
-
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
- exports.modifiers = modifiers; exports.createQuestionToken = createQuestionToken; exports.createIntersectionDeclaration = createIntersectionDeclaration; exports.createTupleDeclaration = createTupleDeclaration; exports.createArrayDeclaration = createArrayDeclaration; exports.createUnionDeclaration = createUnionDeclaration; exports.createPropertySignature = createPropertySignature; exports.createParameterSignature = createParameterSignature; exports.createJSDoc = createJSDoc; exports.appendJSDocToNode = appendJSDocToNode; exports.createIndexSignature = createIndexSignature; exports.createTypeAliasDeclaration = createTypeAliasDeclaration; exports.createNamespaceDeclaration = createNamespaceDeclaration; exports.createImportDeclaration = createImportDeclaration; exports.createExportDeclaration = createExportDeclaration; exports.createEnumDeclaration = createEnumDeclaration; exports.createOmitDeclaration = createOmitDeclaration; exports.keywordTypeNodes = keywordTypeNodes; exports.createTypeLiteralNode = createTypeLiteralNode; exports.createTypeReferenceNode = createTypeReferenceNode; exports.createNumericLiteral = createNumericLiteral; exports.createStringLiteral = createStringLiteral; exports.createArrayTypeNode = createArrayTypeNode; exports.createLiteralTypeNode = createLiteralTypeNode; exports.createNull = createNull; exports.createIdentifier = createIdentifier; exports.createTupleTypeNode = createTupleTypeNode; exports.factory_exports = factory_exports;
453
- //# sourceMappingURL=chunk-UQLRYRTM.cjs.map
432
+ exports.appendJSDocToNode = appendJSDocToNode;
433
+ exports.createArrayDeclaration = createArrayDeclaration;
434
+ exports.createArrayTypeNode = createArrayTypeNode;
435
+ exports.createEnumDeclaration = createEnumDeclaration;
436
+ exports.createExportDeclaration = createExportDeclaration;
437
+ exports.createIdentifier = createIdentifier;
438
+ exports.createImportDeclaration = createImportDeclaration;
439
+ exports.createIndexSignature = createIndexSignature;
440
+ exports.createIntersectionDeclaration = createIntersectionDeclaration;
441
+ exports.createJSDoc = createJSDoc;
442
+ exports.createLiteralTypeNode = createLiteralTypeNode;
443
+ exports.createNamespaceDeclaration = createNamespaceDeclaration;
444
+ exports.createNull = createNull;
445
+ exports.createNumericLiteral = createNumericLiteral;
446
+ exports.createOmitDeclaration = createOmitDeclaration;
447
+ exports.createParameterSignature = createParameterSignature;
448
+ exports.createPropertySignature = createPropertySignature;
449
+ exports.createQuestionToken = createQuestionToken;
450
+ exports.createStringLiteral = createStringLiteral;
451
+ exports.createTupleDeclaration = createTupleDeclaration;
452
+ exports.createTupleTypeNode = createTupleTypeNode;
453
+ exports.createTypeAliasDeclaration = createTypeAliasDeclaration;
454
+ exports.createTypeLiteralNode = createTypeLiteralNode;
455
+ exports.createTypeReferenceNode = createTypeReferenceNode;
456
+ exports.createUnionDeclaration = createUnionDeclaration;
457
+ exports.factory_exports = factory_exports;
458
+ exports.keywordTypeNodes = keywordTypeNodes;
459
+ exports.modifiers = modifiers;
460
+ //# sourceMappingURL=chunk-TNIGP6OU.cjs.map
461
+ //# sourceMappingURL=chunk-TNIGP6OU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/factory.ts"],"names":["ts","modifiers","questionToken","propertyName","isNumber"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAA,eAAA,GAAA,GAAA;AAAA,QAAA,CAAA,eAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,MAAA,iBAAA;AAAA,EAAA,sBAAA,EAAA,MAAA,sBAAA;AAAA,EAAA,mBAAA,EAAA,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factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({\n nodes,\n}: {\n nodes: Array<ts.TypeNode>\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({\n node,\n comments,\n}: {\n node: TNode\n comments: Array<string | undefined>\n}) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createNamespaceDeclaration({\n statements,\n name,\n}: {\n name: string\n statements: ts.Statement[]\n}) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined = undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n name.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n name.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(Number.parseInt(value.toString()))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString()))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(`${value?.toString()}`)\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({\n keys,\n type,\n nonNullable,\n}: {\n keys: Array<string> | string\n type: ts.TypeNode\n nonNullable?: boolean\n}) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createTupleTypeNode = factory.createTupleTypeNode\n"]}
@@ -104,7 +104,7 @@ declare function createEnumDeclaration({ type, name, typeName, enums, }: {
104
104
  */
105
105
  typeName: string;
106
106
  enums: [key: string | number, value: string | number | boolean][];
107
- }): ts.EnumDeclaration[] | (ts.TypeAliasDeclaration | ts.VariableStatement)[];
107
+ }): [name: ts.Node | undefined, type: ts.Node];
108
108
  declare function createOmitDeclaration({ keys, type, nonNullable, }: {
109
109
  keys: Array<string> | string;
110
110
  type: ts.TypeNode;
@@ -104,7 +104,7 @@ declare function createEnumDeclaration({ type, name, typeName, enums, }: {
104
104
  */
105
105
  typeName: string;
106
106
  enums: [key: string | number, value: string | number | boolean][];
107
- }): ts.EnumDeclaration[] | (ts.TypeAliasDeclaration | ts.VariableStatement)[];
107
+ }): [name: ts.Node | undefined, type: ts.Node];
108
108
  declare function createOmitDeclaration({ keys, type, nonNullable, }: {
109
109
  keys: Array<string> | string;
110
110
  type: ts.TypeNode;