@kubb/parser-ts 3.0.0-alpha.10 → 3.0.0-alpha.11

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.
@@ -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),
@@ -422,34 +423,6 @@ var createNull = factory.createNull;
422
423
  var createIdentifier = factory.createIdentifier;
423
424
  var createTupleTypeNode = factory.createTupleTypeNode;
424
425
 
425
- export {
426
- modifiers,
427
- createQuestionToken,
428
- createIntersectionDeclaration,
429
- createTupleDeclaration,
430
- createArrayDeclaration,
431
- createUnionDeclaration,
432
- createPropertySignature,
433
- createParameterSignature,
434
- createJSDoc,
435
- appendJSDocToNode,
436
- createIndexSignature,
437
- createTypeAliasDeclaration,
438
- createNamespaceDeclaration,
439
- createImportDeclaration,
440
- createExportDeclaration,
441
- createEnumDeclaration,
442
- createOmitDeclaration,
443
- keywordTypeNodes,
444
- createTypeLiteralNode,
445
- createTypeReferenceNode,
446
- createNumericLiteral,
447
- createStringLiteral,
448
- createArrayTypeNode,
449
- createLiteralTypeNode,
450
- createNull,
451
- createIdentifier,
452
- createTupleTypeNode,
453
- factory_exports
454
- };
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
455
428
  //# sourceMappingURL=chunk-2BN5RQSZ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/factory.ts"],"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"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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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({
@@ -258,7 +265,7 @@ function createExportDeclaration({
258
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,
@@ -289,13 +296,13 @@ function createEnumDeclaration({
289
296
  return [
290
297
  void 0,
291
298
  factory.createTypeAliasDeclaration(
292
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
299
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
293
300
  factory.createIdentifier(typeName),
294
301
  void 0,
295
302
  factory.createUnionTypeNode(
296
303
  enums.map(([_key, value]) => {
297
- if (_remeda.isNumber.call(void 0, value)) {
298
- 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()));
299
306
  }
300
307
  if (typeof value === "boolean") {
301
308
  return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse());
@@ -313,17 +320,17 @@ function createEnumDeclaration({
313
320
  return [
314
321
  void 0,
315
322
  factory.createEnumDeclaration(
316
- [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),
317
324
  factory.createIdentifier(typeName),
318
325
  enums.map(([key, value]) => {
319
- let initializer = factory.createStringLiteral(_optionalChain([value, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]));
320
- 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()))) {
321
328
  initializer = factory.createNumericLiteral(value);
322
329
  }
323
330
  if (typeof value === "boolean") {
324
331
  initializer = value ? factory.createTrue() : factory.createFalse();
325
332
  }
326
- if (_remeda.isNumber.call(void 0, Number.parseInt(key.toString()))) {
333
+ if (remeda.isNumber(Number.parseInt(key.toString()))) {
327
334
  return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer);
328
335
  }
329
336
  if (key) {
@@ -337,7 +344,7 @@ function createEnumDeclaration({
337
344
  const identifierName = type === "asPascalConst" ? typeName : name;
338
345
  return [
339
346
  factory.createVariableStatement(
340
- [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
347
+ [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
341
348
  factory.createVariableDeclarationList(
342
349
  [
343
350
  factory.createVariableDeclaration(
@@ -347,10 +354,10 @@ function createEnumDeclaration({
347
354
  factory.createAsExpression(
348
355
  factory.createObjectLiteralExpression(
349
356
  enums.map(([key, value]) => {
350
- let initializer = factory.createStringLiteral(`${_optionalChain([value, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()])}`);
351
- if (_remeda.isNumber.call(void 0, value)) {
357
+ let initializer = factory.createStringLiteral(`${value?.toString()}`);
358
+ if (remeda.isNumber(value)) {
352
359
  if (value < 0) {
353
- 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)));
354
361
  } else {
355
362
  initializer = factory.createNumericLiteral(value);
356
363
  }
@@ -369,16 +376,16 @@ function createEnumDeclaration({
369
376
  )
370
377
  )
371
378
  ],
372
- _typescript2.default.NodeFlags.Const
379
+ ts__default.default.NodeFlags.Const
373
380
  )
374
381
  ),
375
382
  factory.createTypeAliasDeclaration(
376
- type === "asPascalConst" ? [] : [factory.createToken(_typescript2.default.SyntaxKind.ExportKeyword)],
383
+ type === "asPascalConst" ? [] : [factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)],
377
384
  factory.createIdentifier(typeName),
378
385
  void 0,
379
386
  factory.createIndexedAccessTypeNode(
380
387
  factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), void 0)),
381
- 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))
382
389
  )
383
390
  )
384
391
  ];
@@ -402,15 +409,15 @@ function createOmitDeclaration({
402
409
  return factory.createTypeReferenceNode(factory.createIdentifier("Omit"), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))]);
403
410
  }
404
411
  var keywordTypeNodes = {
405
- any: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.AnyKeyword),
406
- unknown: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.UnknownKeyword),
407
- number: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.NumberKeyword),
408
- integer: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.NumberKeyword),
409
- object: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.ObjectKeyword),
410
- string: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.StringKeyword),
411
- boolean: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.BooleanKeyword),
412
- undefined: factory.createKeywordTypeNode(_typescript2.default.SyntaxKind.UndefinedKeyword),
413
- 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))
414
421
  };
415
422
  var createTypeLiteralNode = factory.createTypeLiteralNode;
416
423
  var createTypeReferenceNode = factory.createTypeReferenceNode;
@@ -422,34 +429,33 @@ var createNull = factory.createNull;
422
429
  var createIdentifier = factory.createIdentifier;
423
430
  var createTupleTypeNode = factory.createTupleTypeNode;
424
431
 
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
-
453
-
454
- 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;
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
455
461
  //# sourceMappingURL=chunk-TNIGP6OU.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/parser-ts/dist/chunk-TNIGP6OU.cjs","../src/factory.ts"],"names":["modifiers","questionToken"],"mappings":"AAAA,irBAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,SAAS,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG;AAChC,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG,GAAG;AACtB,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC;AACD;AACA;ACNA,IAAA,gBAAA,EAAA,CAAA,CAAA;AAAA,QAAA,CAAA,eAAA,EAAA;AAAA,EAAA,iBAAA,EAAA,CAAA,EAAA,GAAA,iBAAA;AAAA,EAAA,sBAAA,EAAA,CAAA,EAAA,GAAA,sBAAA;AAAA,EAAA,mBAAA,EAAA,CAAA,EAAA,GAAA,mBAAA;AAAA,EAAA,qBAAA,EAAA,CAAA,EAAA,GAAA,qBAAA;AAAA,EAAA,uBAAA,EAAA,CAA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B,EAAA;AACrB,EAAA;AACqB,EAAA;AACA,EAAA;AACrB,EAAA;AACE,EAAA;AACiB,EAAA;AACtC;AAE6C;AAEE;AACH;AACD;AAEA;AAEE;AACX;AACM;AAEG;ADnIH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/kubb/kubb/packages/parser-ts/dist/chunk-TNIGP6OU.cjs","sourcesContent":[null,"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
+ {"version":3,"sources":["../src/factory.ts"],"names":["ts","modifiers","questionTo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;AAC3B,IAAM,mBAAmB,OAAQ,CAAA,iBAAA;AAEjC,IAAM,sBAAsB,OAAQ,CAAA","file":"chunk-TNIGP6OU.cjs","sourcesContent":["import { isNumber } from 'remeda'\nimport ts from 'typescript'\n\nconst { factory } = ts\n\n// https://ts-ast-viewer.com/\n\nexport const modifiers = {\n async: factory.createModifier(ts.SyntaxKind.AsyncKeyword),\n export: factory.createModifier(ts.SyntaxKind.ExportKeyword),\n const: factory.createModifier(ts.SyntaxKind.ConstKeyword),\n static: factory.createModifier(ts.SyntaxKind.StaticKeyword),\n} as const\n\nfunction isValidIdentifier(str: string): boolean {\n if (!str.length || str.trim() !== str) {\n return false\n }\n const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest)\n\n return !!node && node.kind === ts.SyntaxKind.Identifier && ts.identifierToKeywordKind(node.kind as unknown as ts.Identifier) === undefined\n}\n\nfunction propertyName(name: string | ts.PropertyName): ts.PropertyName {\n if (typeof name === 'string') {\n return isValidIdentifier(name) ? factory.createIdentifier(name) : factory.createStringLiteral(name)\n }\n return name\n}\n\nconst questionToken = factory.createToken(ts.SyntaxKind.QuestionToken)\n\nexport function createQuestionToken(token?: boolean | ts.QuestionToken) {\n if (!token) {\n return undefined\n }\n if (token === true) {\n return questionToken\n }\n return token\n}\n\nexport function createIntersectionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createIntersectionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string & number`\n */\nexport function createTupleDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createTupleTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createArrayDeclaration({\n nodes,\n}: {\n nodes: Array<ts.TypeNode>\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return factory.createTupleTypeNode([])\n }\n\n if (nodes.length === 1) {\n return factory.createArrayTypeNode(nodes.at(0)!)\n }\n\n return factory.createExpressionWithTypeArguments(factory.createIdentifier('Array'), [factory.createUnionTypeNode(nodes)])\n}\n\n/**\n * Minimum nodes length of 2\n * @example `string | number`\n */\nexport function createUnionDeclaration({\n nodes,\n withParentheses,\n}: {\n nodes: Array<ts.TypeNode>\n withParentheses?: boolean\n}): ts.TypeNode | null {\n if (!nodes.length) {\n return null\n }\n\n if (nodes.length === 1) {\n return nodes[0] || null\n }\n\n const node = factory.createUnionTypeNode(nodes)\n\n if (withParentheses) {\n return factory.createParenthesizedType(node)\n }\n\n return node\n}\n\nexport function createPropertySignature({\n readOnly,\n modifiers = [],\n name,\n questionToken,\n type,\n}: {\n readOnly?: boolean\n modifiers?: Array<ts.Modifier>\n name: ts.PropertyName | string\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n}) {\n return factory.createPropertySignature(\n [...modifiers, readOnly ? factory.createToken(ts.SyntaxKind.ReadonlyKeyword) : undefined].filter(Boolean),\n propertyName(name),\n createQuestionToken(questionToken),\n type,\n )\n}\n\nexport function createParameterSignature(\n name: string | ts.BindingName,\n {\n modifiers,\n dotDotDotToken,\n questionToken,\n type,\n initializer,\n }: {\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n dotDotDotToken?: ts.DotDotDotToken\n questionToken?: ts.QuestionToken | boolean\n type?: ts.TypeNode\n initializer?: ts.Expression\n },\n): ts.ParameterDeclaration {\n return factory.createParameterDeclaration(modifiers, dotDotDotToken, name, createQuestionToken(questionToken), type, initializer)\n}\n\nexport function createJSDoc({ comments }: { comments: string[] }) {\n if (!comments.length) {\n return null\n }\n return factory.createJSDocComment(\n factory.createNodeArray(\n comments.map((comment, i) => {\n if (i === comments.length - 1) {\n return factory.createJSDocText(comment)\n }\n\n return factory.createJSDocText(`${comment}\\n`)\n }),\n ),\n )\n}\n\n/**\n * @link https://github.com/microsoft/TypeScript/issues/44151\n */\nexport function appendJSDocToNode<TNode extends ts.Node>({\n node,\n comments,\n}: {\n node: TNode\n comments: Array<string | undefined>\n}) {\n const filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return node\n }\n\n const text = filteredComments.reduce((acc = '', comment = '') => {\n return `${acc}\\n * ${comment}`\n }, '*')\n\n // node: {...node}, with that ts.addSyntheticLeadingComment is appending\n return ts.addSyntheticLeadingComment({ ...node }, ts.SyntaxKind.MultiLineCommentTrivia, `${text || '*'}\\n`, true)\n}\n\nexport function createIndexSignature(\n type: ts.TypeNode,\n {\n modifiers,\n indexName = 'key',\n indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n }: {\n indexName?: string\n indexType?: ts.TypeNode\n decorators?: Array<ts.Decorator>\n modifiers?: Array<ts.Modifier>\n } = {},\n) {\n return factory.createIndexSignature(modifiers, [createParameterSignature(indexName, { type: indexType })], type)\n}\n\nexport function createTypeAliasDeclaration({\n modifiers,\n name,\n typeParameters,\n type,\n}: {\n modifiers?: Array<ts.Modifier>\n name: string | ts.Identifier\n typeParameters?: Array<ts.TypeParameterDeclaration>\n type: ts.TypeNode\n}) {\n return factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type)\n}\n\nexport function createNamespaceDeclaration({\n statements,\n name,\n}: {\n name: string\n statements: ts.Statement[]\n}) {\n return factory.createModuleDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(name),\n factory.createModuleBlock(statements),\n ts.NodeFlags.Namespace,\n )\n}\n\n/**\n * In { propertyName: string; name?: string } is `name` being used to make the type more unique when multiple same names are used.\n * @example `import { Pet as Cat } from './Pet'`\n */\nexport function createImportDeclaration({\n name,\n path,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n if (!Array.isArray(name)) {\n let importPropertyName: ts.Identifier | undefined = factory.createIdentifier(name)\n let importName: ts.NamedImportBindings | undefined = undefined\n\n if (isNameSpace) {\n importPropertyName = undefined\n importName = factory.createNamespaceImport(factory.createIdentifier(name))\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, importPropertyName, importName),\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(\n isTypeOnly,\n undefined,\n factory.createNamedImports(\n name.map((item) => {\n if (typeof item === 'object') {\n const obj = item as { propertyName: string; name?: string }\n if (obj.name) {\n return factory.createImportSpecifier(false, factory.createIdentifier(obj.propertyName), factory.createIdentifier(obj.name))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(obj.propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n }),\n ),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createExportDeclaration({\n path,\n asAlias,\n isTypeOnly = false,\n name,\n}: {\n path: string\n asAlias?: boolean\n isTypeOnly?: boolean\n name?: string | Array<ts.Identifier | string>\n}) {\n if (name && !Array.isArray(name) && !asAlias) {\n console.warn(`When using name as string, asAlias should be true ${name}`)\n }\n\n if (!Array.isArray(name)) {\n const parsedName = name?.match(/^\\d/) ? `_${name?.slice(1)}` : name\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n asAlias && parsedName ? factory.createNamespaceExport(factory.createIdentifier(parsedName)) : undefined,\n factory.createStringLiteral(path),\n undefined,\n )\n }\n\n return factory.createExportDeclaration(\n undefined,\n isTypeOnly,\n factory.createNamedExports(\n name.map((propertyName) => {\n return factory.createExportSpecifier(false, undefined, typeof propertyName === 'string' ? factory.createIdentifier(propertyName) : propertyName)\n }),\n ),\n factory.createStringLiteral(path),\n undefined,\n )\n}\n\nexport function createEnumDeclaration({\n type = 'enum',\n name,\n typeName,\n enums,\n}: {\n /**\n * @default `'enum'`\n */\n type?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal'\n /**\n * Enum name in camelCase.\n */\n name: string\n /**\n * Enum name in PascalCase.\n */\n typeName: string\n enums: [key: string | number, value: string | number | boolean][]\n}): [name: ts.Node | undefined, type: ts.Node] {\n if (type === 'literal') {\n return [\n undefined,\n factory.createTypeAliasDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createUnionTypeNode(\n enums\n .map(([_key, value]) => {\n if (isNumber(value)) {\n return factory.createLiteralTypeNode(factory.createNumericLiteral(value?.toString()))\n }\n\n if (typeof value === 'boolean') {\n return factory.createLiteralTypeNode(value ? factory.createTrue() : factory.createFalse())\n }\n if (value) {\n return factory.createLiteralTypeNode(factory.createStringLiteral(value.toString()))\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ),\n ]\n }\n\n if (type === 'enum' || type === 'constEnum') {\n return [\n undefined,\n factory.createEnumDeclaration(\n [factory.createToken(ts.SyntaxKind.ExportKeyword), type === 'constEnum' ? factory.createToken(ts.SyntaxKind.ConstKeyword) : undefined].filter(Boolean),\n factory.createIdentifier(typeName),\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(value?.toString())\n\n if (isNumber(Number.parseInt(value.toString()))) {\n initializer = factory.createNumericLiteral(value as number)\n }\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (isNumber(Number.parseInt(key.toString()))) {\n return factory.createEnumMember(factory.createStringLiteral(`${typeName}_${key}`), initializer)\n }\n\n if (key) {\n return factory.createEnumMember(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n ),\n ]\n }\n\n // used when using `as const` instead of an TypeScript enum.\n const identifierName = type === 'asPascalConst' ? typeName : name\n\n return [\n factory.createVariableStatement(\n [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createVariableDeclarationList(\n [\n factory.createVariableDeclaration(\n factory.createIdentifier(identifierName),\n undefined,\n undefined,\n factory.createAsExpression(\n factory.createObjectLiteralExpression(\n enums\n .map(([key, value]) => {\n let initializer: ts.Expression = factory.createStringLiteral(`${value?.toString()}`)\n\n if (isNumber(value)) {\n // Error: Negative numbers should be created in combination with createPrefixUnaryExpression factory.\n // The method createNumericLiteral only accepts positive numbers\n // or those combined with createPrefixUnaryExpression.\n // Therefore, we need to ensure that the number is not negative.\n if (value < 0) {\n initializer = factory.createPrefixUnaryExpression(ts.SyntaxKind.MinusToken, factory.createNumericLiteral(Math.abs(value)))\n } else {\n initializer = factory.createNumericLiteral(value)\n }\n }\n\n if (typeof value === 'boolean') {\n initializer = value ? factory.createTrue() : factory.createFalse()\n }\n\n if (key) {\n return factory.createPropertyAssignment(factory.createStringLiteral(`${key}`), initializer)\n }\n\n return undefined\n })\n .filter(Boolean),\n true,\n ),\n factory.createTypeReferenceNode(factory.createIdentifier('const'), undefined),\n ),\n ),\n ],\n ts.NodeFlags.Const,\n ),\n ),\n factory.createTypeAliasDeclaration(\n type === 'asPascalConst' ? [] : [factory.createToken(ts.SyntaxKind.ExportKeyword)],\n factory.createIdentifier(typeName),\n undefined,\n factory.createIndexedAccessTypeNode(\n factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(identifierName), undefined)),\n ),\n ),\n ]\n}\n\nexport function createOmitDeclaration({\n keys,\n type,\n nonNullable,\n}: {\n keys: Array<string> | string\n type: ts.TypeNode\n nonNullable?: boolean\n}) {\n const node = nonNullable ? factory.createTypeReferenceNode(factory.createIdentifier('NonNullable'), [type]) : type\n\n if (Array.isArray(keys)) {\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [\n node,\n factory.createUnionTypeNode(\n keys.map((key) => {\n return factory.createLiteralTypeNode(factory.createStringLiteral(key))\n }),\n ),\n ])\n }\n\n return factory.createTypeReferenceNode(factory.createIdentifier('Omit'), [node, factory.createLiteralTypeNode(factory.createStringLiteral(keys))])\n}\n\nexport const keywordTypeNodes = {\n any: factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),\n unknown: factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword),\n number: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n integer: factory.createKeywordTypeNode(ts.SyntaxKind.NumberKeyword),\n object: factory.createKeywordTypeNode(ts.SyntaxKind.ObjectKeyword),\n string: factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),\n boolean: factory.createKeywordTypeNode(ts.SyntaxKind.BooleanKeyword),\n undefined: factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),\n null: factory.createLiteralTypeNode(factory.createToken(ts.SyntaxKind.NullKeyword)),\n} as const\n\nexport const createTypeLiteralNode = factory.createTypeLiteralNode\n\nexport const createTypeReferenceNode = factory.createTypeReferenceNode\nexport const createNumericLiteral = factory.createNumericLiteral\nexport const createStringLiteral = factory.createStringLiteral\n\nexport const createArrayTypeNode = factory.createArrayTypeNode\n\nexport const createLiteralTypeNode = factory.createLiteralTypeNode\nexport const createNull = factory.createNull\nexport const createIdentifier = factory.createIdentifier\n\nexport const createTupleTypeNode = factory.createTupleTypeNode\n"]}
package/dist/factory.cjs CHANGED
@@ -1,59 +1,116 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- var _chunkTNIGP6OUcjs = require('./chunk-TNIGP6OU.cjs');
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
- exports.appendJSDocToNode = _chunkTNIGP6OUcjs.appendJSDocToNode; exports.createArrayDeclaration = _chunkTNIGP6OUcjs.createArrayDeclaration; exports.createArrayTypeNode = _chunkTNIGP6OUcjs.createArrayTypeNode; exports.createEnumDeclaration = _chunkTNIGP6OUcjs.createEnumDeclaration; exports.createExportDeclaration = _chunkTNIGP6OUcjs.createExportDeclaration; exports.createIdentifier = _chunkTNIGP6OUcjs.createIdentifier; exports.createImportDeclaration = _chunkTNIGP6OUcjs.createImportDeclaration; exports.createIndexSignature = _chunkTNIGP6OUcjs.createIndexSignature; exports.createIntersectionDeclaration = _chunkTNIGP6OUcjs.createIntersectionDeclaration; exports.createJSDoc = _chunkTNIGP6OUcjs.createJSDoc; exports.createLiteralTypeNode = _chunkTNIGP6OUcjs.createLiteralTypeNode; exports.createNamespaceDeclaration = _chunkTNIGP6OUcjs.createNamespaceDeclaration; exports.createNull = _chunkTNIGP6OUcjs.createNull; exports.createNumericLiteral = _chunkTNIGP6OUcjs.createNumericLiteral; exports.createOmitDeclaration = _chunkTNIGP6OUcjs.createOmitDeclaration; exports.createParameterSignature = _chunkTNIGP6OUcjs.createParameterSignature; exports.createPropertySignature = _chunkTNIGP6OUcjs.createPropertySignature; exports.createQuestionToken = _chunkTNIGP6OUcjs.createQuestionToken; exports.createStringLiteral = _chunkTNIGP6OUcjs.createStringLiteral; exports.createTupleDeclaration = _chunkTNIGP6OUcjs.createTupleDeclaration; exports.createTupleTypeNode = _chunkTNIGP6OUcjs.createTupleTypeNode; exports.createTypeAliasDeclaration = _chunkTNIGP6OUcjs.createTypeAliasDeclaration; exports.createTypeLiteralNode = _chunkTNIGP6OUcjs.createTypeLiteralNode; exports.createTypeReferenceNode = _chunkTNIGP6OUcjs.createTypeReferenceNode; exports.createUnionDeclaration = _chunkTNIGP6OUcjs.createUnionDeclaration; exports.keywordTypeNodes = _chunkTNIGP6OUcjs.keywordTypeNodes; exports.modifiers = _chunkTNIGP6OUcjs.modifiers;
1
+ 'use strict';
2
+
3
+ var chunkTNIGP6OU_cjs = require('./chunk-TNIGP6OU.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "appendJSDocToNode", {
8
+ enumerable: true,
9
+ get: function () { return chunkTNIGP6OU_cjs.appendJSDocToNode; }
10
+ });
11
+ Object.defineProperty(exports, "createArrayDeclaration", {
12
+ enumerable: true,
13
+ get: function () { return chunkTNIGP6OU_cjs.createArrayDeclaration; }
14
+ });
15
+ Object.defineProperty(exports, "createArrayTypeNode", {
16
+ enumerable: true,
17
+ get: function () { return chunkTNIGP6OU_cjs.createArrayTypeNode; }
18
+ });
19
+ Object.defineProperty(exports, "createEnumDeclaration", {
20
+ enumerable: true,
21
+ get: function () { return chunkTNIGP6OU_cjs.createEnumDeclaration; }
22
+ });
23
+ Object.defineProperty(exports, "createExportDeclaration", {
24
+ enumerable: true,
25
+ get: function () { return chunkTNIGP6OU_cjs.createExportDeclaration; }
26
+ });
27
+ Object.defineProperty(exports, "createIdentifier", {
28
+ enumerable: true,
29
+ get: function () { return chunkTNIGP6OU_cjs.createIdentifier; }
30
+ });
31
+ Object.defineProperty(exports, "createImportDeclaration", {
32
+ enumerable: true,
33
+ get: function () { return chunkTNIGP6OU_cjs.createImportDeclaration; }
34
+ });
35
+ Object.defineProperty(exports, "createIndexSignature", {
36
+ enumerable: true,
37
+ get: function () { return chunkTNIGP6OU_cjs.createIndexSignature; }
38
+ });
39
+ Object.defineProperty(exports, "createIntersectionDeclaration", {
40
+ enumerable: true,
41
+ get: function () { return chunkTNIGP6OU_cjs.createIntersectionDeclaration; }
42
+ });
43
+ Object.defineProperty(exports, "createJSDoc", {
44
+ enumerable: true,
45
+ get: function () { return chunkTNIGP6OU_cjs.createJSDoc; }
46
+ });
47
+ Object.defineProperty(exports, "createLiteralTypeNode", {
48
+ enumerable: true,
49
+ get: function () { return chunkTNIGP6OU_cjs.createLiteralTypeNode; }
50
+ });
51
+ Object.defineProperty(exports, "createNamespaceDeclaration", {
52
+ enumerable: true,
53
+ get: function () { return chunkTNIGP6OU_cjs.createNamespaceDeclaration; }
54
+ });
55
+ Object.defineProperty(exports, "createNull", {
56
+ enumerable: true,
57
+ get: function () { return chunkTNIGP6OU_cjs.createNull; }
58
+ });
59
+ Object.defineProperty(exports, "createNumericLiteral", {
60
+ enumerable: true,
61
+ get: function () { return chunkTNIGP6OU_cjs.createNumericLiteral; }
62
+ });
63
+ Object.defineProperty(exports, "createOmitDeclaration", {
64
+ enumerable: true,
65
+ get: function () { return chunkTNIGP6OU_cjs.createOmitDeclaration; }
66
+ });
67
+ Object.defineProperty(exports, "createParameterSignature", {
68
+ enumerable: true,
69
+ get: function () { return chunkTNIGP6OU_cjs.createParameterSignature; }
70
+ });
71
+ Object.defineProperty(exports, "createPropertySignature", {
72
+ enumerable: true,
73
+ get: function () { return chunkTNIGP6OU_cjs.createPropertySignature; }
74
+ });
75
+ Object.defineProperty(exports, "createQuestionToken", {
76
+ enumerable: true,
77
+ get: function () { return chunkTNIGP6OU_cjs.createQuestionToken; }
78
+ });
79
+ Object.defineProperty(exports, "createStringLiteral", {
80
+ enumerable: true,
81
+ get: function () { return chunkTNIGP6OU_cjs.createStringLiteral; }
82
+ });
83
+ Object.defineProperty(exports, "createTupleDeclaration", {
84
+ enumerable: true,
85
+ get: function () { return chunkTNIGP6OU_cjs.createTupleDeclaration; }
86
+ });
87
+ Object.defineProperty(exports, "createTupleTypeNode", {
88
+ enumerable: true,
89
+ get: function () { return chunkTNIGP6OU_cjs.createTupleTypeNode; }
90
+ });
91
+ Object.defineProperty(exports, "createTypeAliasDeclaration", {
92
+ enumerable: true,
93
+ get: function () { return chunkTNIGP6OU_cjs.createTypeAliasDeclaration; }
94
+ });
95
+ Object.defineProperty(exports, "createTypeLiteralNode", {
96
+ enumerable: true,
97
+ get: function () { return chunkTNIGP6OU_cjs.createTypeLiteralNode; }
98
+ });
99
+ Object.defineProperty(exports, "createTypeReferenceNode", {
100
+ enumerable: true,
101
+ get: function () { return chunkTNIGP6OU_cjs.createTypeReferenceNode; }
102
+ });
103
+ Object.defineProperty(exports, "createUnionDeclaration", {
104
+ enumerable: true,
105
+ get: function () { return chunkTNIGP6OU_cjs.createUnionDeclaration; }
106
+ });
107
+ Object.defineProperty(exports, "keywordTypeNodes", {
108
+ enumerable: true,
109
+ get: function () { return chunkTNIGP6OU_cjs.keywordTypeNodes; }
110
+ });
111
+ Object.defineProperty(exports, "modifiers", {
112
+ enumerable: true,
113
+ get: function () { return chunkTNIGP6OU_cjs.modifiers; }
114
+ });
115
+ //# sourceMappingURL=factory.cjs.map
59
116
  //# sourceMappingURL=factory.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/parser-ts/dist/factory.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,g4DAAC","file":"/home/runner/work/kubb/kubb/packages/parser-ts/dist/factory.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"factory.cjs"}
package/dist/factory.js CHANGED
@@ -1,59 +1,3 @@
1
- import {
2
- appendJSDocToNode,
3
- createArrayDeclaration,
4
- createArrayTypeNode,
5
- createEnumDeclaration,
6
- createExportDeclaration,
7
- createIdentifier,
8
- createImportDeclaration,
9
- createIndexSignature,
10
- createIntersectionDeclaration,
11
- createJSDoc,
12
- createLiteralTypeNode,
13
- createNamespaceDeclaration,
14
- createNull,
15
- createNumericLiteral,
16
- createOmitDeclaration,
17
- createParameterSignature,
18
- createPropertySignature,
19
- createQuestionToken,
20
- createStringLiteral,
21
- createTupleDeclaration,
22
- createTupleTypeNode,
23
- createTypeAliasDeclaration,
24
- createTypeLiteralNode,
25
- createTypeReferenceNode,
26
- createUnionDeclaration,
27
- keywordTypeNodes,
28
- modifiers
29
- } from "./chunk-2BN5RQSZ.js";
30
- export {
31
- appendJSDocToNode,
32
- createArrayDeclaration,
33
- createArrayTypeNode,
34
- createEnumDeclaration,
35
- createExportDeclaration,
36
- createIdentifier,
37
- createImportDeclaration,
38
- createIndexSignature,
39
- createIntersectionDeclaration,
40
- createJSDoc,
41
- createLiteralTypeNode,
42
- createNamespaceDeclaration,
43
- createNull,
44
- createNumericLiteral,
45
- createOmitDeclaration,
46
- createParameterSignature,
47
- createPropertySignature,
48
- createQuestionToken,
49
- createStringLiteral,
50
- createTupleDeclaration,
51
- createTupleTypeNode,
52
- createTypeAliasDeclaration,
53
- createTypeLiteralNode,
54
- createTypeReferenceNode,
55
- createUnionDeclaration,
56
- keywordTypeNodes,
57
- modifiers
58
- };
1
+ 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, keywordTypeNodes, modifiers } from './chunk-2BN5RQSZ.js';
2
+ //# sourceMappingURL=factory.js.map
59
3
  //# sourceMappingURL=factory.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"factory.js"}
package/dist/index.cjs CHANGED
@@ -1,15 +1,18 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ 'use strict';
2
2
 
3
- var _chunkTNIGP6OUcjs = require('./chunk-TNIGP6OU.cjs');
3
+ var chunkTNIGP6OU_cjs = require('./chunk-TNIGP6OU.cjs');
4
+ var ts = require('typescript');
4
5
 
5
- // src/print.ts
6
- var _typescript = require('typescript'); var _typescript2 = _interopRequireDefault(_typescript);
7
- var { factory } = _typescript2.default;
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var ts__default = /*#__PURE__*/_interopDefault(ts);
9
+
10
+ var { factory } = ts__default.default;
8
11
  var escapeNewLines = (code) => code.replace(/\n\n/g, "\n/* :newline: */");
9
12
  var restoreNewLines = (code) => code.replace(/\/\* :newline: \*\//g, "\n");
10
- function print(elements, { source = "", baseName = "print.ts", removeComments, noEmitHelpers, newLine = _typescript2.default.NewLineKind.LineFeed } = {}) {
11
- const sourceFile = _typescript2.default.createSourceFile(baseName, escapeNewLines(source), _typescript2.default.ScriptTarget.ES2022, false, _typescript2.default.ScriptKind.TS);
12
- const printer = _typescript2.default.createPrinter({
13
+ function print(elements, { source = "", baseName = "print.ts", removeComments, noEmitHelpers, newLine = ts__default.default.NewLineKind.LineFeed } = {}) {
14
+ const sourceFile = ts__default.default.createSourceFile(baseName, escapeNewLines(source), ts__default.default.ScriptTarget.ES2022, false, ts__default.default.ScriptKind.TS);
15
+ const printer = ts__default.default.createPrinter({
13
16
  omitTrailingSemicolon: true,
14
17
  newLine,
15
18
  removeComments,
@@ -24,12 +27,15 @@ function print(elements, { source = "", baseName = "print.ts", removeComments, n
24
27
  } else {
25
28
  nodes = [elements].filter(Boolean);
26
29
  }
27
- const outputFile = printer.printList(_typescript2.default.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile);
30
+ const outputFile = printer.printList(ts__default.default.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile);
28
31
  const outputSource = printer.printFile(sourceFile);
29
32
  return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join("\n");
30
33
  }
31
34
 
32
-
33
-
34
- exports.factory = _chunkTNIGP6OUcjs.factory_exports; exports.print = print;
35
+ Object.defineProperty(exports, "factory", {
36
+ enumerable: true,
37
+ get: function () { return chunkTNIGP6OU_cjs.factory_exports; }
38
+ });
39
+ exports.print = print;
40
+ //# sourceMappingURL=index.cjs.map
35
41
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/parser-ts/dist/index.cjs","../src/print.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,gGAAe;AAIf,IAAM,EAAE,QAAQ,EAAA,EAAI,oBAAA;AAYpB,IAAM,eAAA,EAAiB,CAAC,IAAA,EAAA,GAAiB,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,mBAAmB,CAAA;AAOlF,IAAM,gBAAA,EAAkB,CAAC,IAAA,EAAA,GAAiB,IAAA,CAAK,OAAA,CAAQ,sBAAA,EAAwB,IAAI,CAAA;AAE5E,SAAS,KAAA,CACd,QAAA,EACA,EAAE,OAAA,EAAS,EAAA,EAAI,SAAA,EAAW,UAAA,EAAY,cAAA,EAAgB,aAAA,EAAe,QAAA,EAAU,oBAAA,CAAG,WAAA,CAAY,SAAS,EAAA,EAAa,CAAC,CAAA,EAC7G;AACR,EAAA,MAAM,WAAA,EAAa,oBAAA,CAAG,gBAAA,CAAiB,QAAA,EAAU,cAAA,CAAe,MAAM,CAAA,EAAG,oBAAA,CAAG,YAAA,CAAa,MAAA,EAAQ,KAAA,EAAO,oBAAA,CAAG,UAAA,CAAW,EAAE,CAAA;AACxH,EAAA,MAAM,QAAA,EAAU,oBAAA,CAAG,aAAA,CAAc;AAAA,IAC/B,qBAAA,EAAuB,IAAA;AAAA,IACvB,OAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,EACF,CAAC,CAAA;AAED,EAAA,IAAI,MAAA,EAAwB,CAAC,CAAA;AAE7B,EAAA,GAAA,CAAI,CAAC,QAAA,EAAU;AACb,IAAA,OAAO,EAAA;AAAA,EACT;AAEA,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,QAAQ,CAAA,EAAG;AAC3B,IAAA,MAAA,EAAQ,QAAA,CAAS,MAAA,CAAO,OAAO,CAAA;AAAA,EACjC,EAAA,KAAO;AACL,IAAA,MAAA,EAAQ,CAAC,QAAQ,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA;AAAA,EACnC;AAEA,EAAA,MAAM,WAAA,EAAa,OAAA,CAAQ,SAAA,CAAU,oBAAA,CAAG,UAAA,CAAW,SAAA,EAAW,OAAA,CAAQ,eAAA,CAAgB,KAAK,CAAA,EAAG,UAAU,CAAA;AACxG,EAAA,MAAM,aAAA,EAAe,OAAA,CAAQ,SAAA,CAAU,UAAU,CAAA;AAEjD,EAAA,OAAO,CAAC,UAAA,EAAY,eAAA,CAAgB,YAAY,CAAC,CAAA,CAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,IAAI,CAAA;AAC9E;ADvBA;AACE;AACA;AACF,2EAAC","file":"/home/runner/work/kubb/kubb/packages/parser-ts/dist/index.cjs","sourcesContent":[null,"import ts from 'typescript'\n\nimport type { PrinterOptions } from 'typescript'\n\nconst { factory } = ts\n\ntype Options = {\n source?: string\n baseName?: string\n} & PrinterOptions\n\n/**\n * Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}\n * @param {string} code The code to escape new lines in\n * @returns The same code but with new lines escaped using block comments\n */\nconst escapeNewLines = (code: string) => code.replace(/\\n\\n/g, '\\n/* :newline: */')\n\n/**\n * Reverses {@link escapeNewLines} and restores new lines\n * @param {string} code The code with escaped new lines\n * @returns The same code with new lines restored\n */\nconst restoreNewLines = (code: string) => code.replace(/\\/\\* :newline: \\*\\//g, '\\n')\n\nexport function print(\n elements: ts.Node | Array<ts.Node | undefined> | null,\n { source = '', baseName = 'print.ts', removeComments, noEmitHelpers, newLine = ts.NewLineKind.LineFeed }: Options = {},\n): string {\n const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS)\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine,\n removeComments,\n noEmitHelpers,\n })\n\n let nodes: Array<ts.Node> = []\n\n if (!elements) {\n return ''\n }\n\n if (Array.isArray(elements)) {\n nodes = elements.filter(Boolean)\n } else {\n nodes = [elements].filter(Boolean)\n }\n\n const outputFile = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile)\n const outputSource = printer.printFile(sourceFile)\n\n return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join('\\n')\n}\n"]}
1
+ {"version":3,"sources":["../src/print.ts"],"names":["ts"],"mappings":";;;;;;;;;AAIA,IAAM,EAAE,SAAY,GAAAA,mBAAA,CAAA;AAYpB,IAAM,iBAAiB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,SAAS,mBAAmB,CAAA,CAAA;AAOlF,IAAM,kBAAkB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,wBAAwB,IAAI,CAAA,CAAA;AAE5E,SAAS,KACd,CAAA,QAAA,EACA,EAAE,MAAA,GAAS,IAAI,QAAW,GAAA,UAAA,EAAY,cAAgB,EAAA,aAAA,EAAe,UAAUA,mBAAG,CAAA,WAAA,CAAY,QAAS,EAAA,GAAa,EAC5G,EAAA;AACR,EAAA,MAAM,UAAa,GAAAA,mBAAA,CAAG,gBAAiB,CAAA,QAAA,EAAU,cAAe,CAAA,MAAM,CAAG,EAAAA,mBAAA,CAAG,YAAa,CAAA,MAAA,EAAQ,KAAO,EAAAA,mBAAA,CAAG,WAAW,EAAE,CAAA,CAAA;AACxH,EAAM,MAAA,OAAA,GAAUA,oBAAG,aAAc,CAAA;AAAA,IAC/B,qBAAuB,EAAA,IAAA;AAAA,IACvB,OAAA;AAAA,IACA,cAAA;AAAA,IACA,aAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAA,IAAI,QAAwB,EAAC,CAAA;AAE7B,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,QAAQ,CAAG,EAAA;AAC3B,IAAQ,KAAA,GAAA,QAAA,CAAS,OAAO,OAAO,CAAA,CAAA;AAAA,GAC1B,MAAA;AACL,IAAA,KAAA,GAAQ,CAAC,QAAQ,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,GACnC;AAEA,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,SAAA,CAAUA,mBAAG,CAAA,UAAA,CAAW,WAAW,OAAQ,CAAA,eAAA,CAAgB,KAAK,CAAA,EAAG,UAAU,CAAA,CAAA;AACxG,EAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,SAAA,CAAU,UAAU,CAAA,CAAA;AAEjD,EAAO,OAAA,CAAC,UAAY,EAAA,eAAA,CAAgB,YAAY,CAAC,EAAE,MAAO,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC9E","file":"index.cjs","sourcesContent":["import ts from 'typescript'\n\nimport type { PrinterOptions } from 'typescript'\n\nconst { factory } = ts\n\ntype Options = {\n source?: string\n baseName?: string\n} & PrinterOptions\n\n/**\n * Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}\n * @param {string} code The code to escape new lines in\n * @returns The same code but with new lines escaped using block comments\n */\nconst escapeNewLines = (code: string) => code.replace(/\\n\\n/g, '\\n/* :newline: */')\n\n/**\n * Reverses {@link escapeNewLines} and restores new lines\n * @param {string} code The code with escaped new lines\n * @returns The same code with new lines restored\n */\nconst restoreNewLines = (code: string) => code.replace(/\\/\\* :newline: \\*\\//g, '\\n')\n\nexport function print(\n elements: ts.Node | Array<ts.Node | undefined> | null,\n { source = '', baseName = 'print.ts', removeComments, noEmitHelpers, newLine = ts.NewLineKind.LineFeed }: Options = {},\n): string {\n const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS)\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine,\n removeComments,\n noEmitHelpers,\n })\n\n let nodes: Array<ts.Node> = []\n\n if (!elements) {\n return ''\n }\n\n if (Array.isArray(elements)) {\n nodes = elements.filter(Boolean)\n } else {\n nodes = [elements].filter(Boolean)\n }\n\n const outputFile = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile)\n const outputSource = printer.printFile(sourceFile)\n\n return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join('\\n')\n}\n"]}
package/dist/index.js CHANGED
@@ -1,9 +1,6 @@
1
- import {
2
- factory_exports
3
- } from "./chunk-2BN5RQSZ.js";
1
+ export { factory_exports as factory } from './chunk-2BN5RQSZ.js';
2
+ import ts from 'typescript';
4
3
 
5
- // src/print.ts
6
- import ts from "typescript";
7
4
  var { factory } = ts;
8
5
  var escapeNewLines = (code) => code.replace(/\n\n/g, "\n/* :newline: */");
9
6
  var restoreNewLines = (code) => code.replace(/\/\* :newline: \*\//g, "\n");
@@ -28,8 +25,7 @@ function print(elements, { source = "", baseName = "print.ts", removeComments, n
28
25
  const outputSource = printer.printFile(sourceFile);
29
26
  return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join("\n");
30
27
  }
31
- export {
32
- factory_exports as factory,
33
- print
34
- };
28
+
29
+ export { print };
30
+ //# sourceMappingURL=index.js.map
35
31
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/print.ts"],"sourcesContent":["import ts from 'typescript'\n\nimport type { PrinterOptions } from 'typescript'\n\nconst { factory } = ts\n\ntype Options = {\n source?: string\n baseName?: string\n} & PrinterOptions\n\n/**\n * Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}\n * @param {string} code The code to escape new lines in\n * @returns The same code but with new lines escaped using block comments\n */\nconst escapeNewLines = (code: string) => code.replace(/\\n\\n/g, '\\n/* :newline: */')\n\n/**\n * Reverses {@link escapeNewLines} and restores new lines\n * @param {string} code The code with escaped new lines\n * @returns The same code with new lines restored\n */\nconst restoreNewLines = (code: string) => code.replace(/\\/\\* :newline: \\*\\//g, '\\n')\n\nexport function print(\n elements: ts.Node | Array<ts.Node | undefined> | null,\n { source = '', baseName = 'print.ts', removeComments, noEmitHelpers, newLine = ts.NewLineKind.LineFeed }: Options = {},\n): string {\n const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS)\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine,\n removeComments,\n noEmitHelpers,\n })\n\n let nodes: Array<ts.Node> = []\n\n if (!elements) {\n return ''\n }\n\n if (Array.isArray(elements)) {\n nodes = elements.filter(Boolean)\n } else {\n nodes = [elements].filter(Boolean)\n }\n\n const outputFile = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile)\n const outputSource = printer.printFile(sourceFile)\n\n return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join('\\n')\n}\n"],"mappings":";;;;;AAAA,OAAO,QAAQ;AAIf,IAAM,EAAE,QAAQ,IAAI;AAYpB,IAAM,iBAAiB,CAAC,SAAiB,KAAK,QAAQ,SAAS,mBAAmB;AAOlF,IAAM,kBAAkB,CAAC,SAAiB,KAAK,QAAQ,wBAAwB,IAAI;AAE5E,SAAS,MACd,UACA,EAAE,SAAS,IAAI,WAAW,YAAY,gBAAgB,eAAe,UAAU,GAAG,YAAY,SAAS,IAAa,CAAC,GAC7G;AACR,QAAM,aAAa,GAAG,iBAAiB,UAAU,eAAe,MAAM,GAAG,GAAG,aAAa,QAAQ,OAAO,GAAG,WAAW,EAAE;AACxH,QAAM,UAAU,GAAG,cAAc;AAAA,IAC/B,uBAAuB;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAA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EAAA,IAAI,QAAwB,EAAC,CAAA;AAE7B,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,EAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,QAAQ,CAAG,EAAA;AAC3B,IAAQ,KAAA,GAAA,QAAA,CAAS,OAAO,OAAO,CAAA,CAAA;AAAA,GAC1B,MAAA;AACL,IAAA,KAAA,GAAQ,CAAC,QAAQ,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,GACnC;AAEA,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,SAAA,CAAU,EAAG,CAAA,UAAA,CAAW,WAAW,OAAQ,CAAA,eAAA,CAAgB,KAAK,CAAA,EAAG,UAAU,CAAA,CAAA;AACxG,EAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,SAAA,CAAU,UAAU,CAAA,CAAA;AAEjD,EAAO,OAAA,CAAC,UAAY,EAAA,eAAA,CAAgB,YAAY,CAAC,EAAE,MAAO,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAAA,CAAA;AAC9E","file":"index.js","sourcesContent":["import ts from 'typescript'\n\nimport type { PrinterOptions } from 'typescript'\n\nconst { factory } = ts\n\ntype Options = {\n source?: string\n baseName?: string\n} & PrinterOptions\n\n/**\n * Escaped new lines in code with block comments so they can be restored by {@link restoreNewLines}\n * @param {string} code The code to escape new lines in\n * @returns The same code but with new lines escaped using block comments\n */\nconst escapeNewLines = (code: string) => code.replace(/\\n\\n/g, '\\n/* :newline: */')\n\n/**\n * Reverses {@link escapeNewLines} and restores new lines\n * @param {string} code The code with escaped new lines\n * @returns The same code with new lines restored\n */\nconst restoreNewLines = (code: string) => code.replace(/\\/\\* :newline: \\*\\//g, '\\n')\n\nexport function print(\n elements: ts.Node | Array<ts.Node | undefined> | null,\n { source = '', baseName = 'print.ts', removeComments, noEmitHelpers, newLine = ts.NewLineKind.LineFeed }: Options = {},\n): string {\n const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS)\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine,\n removeComments,\n noEmitHelpers,\n })\n\n let nodes: Array<ts.Node> = []\n\n if (!elements) {\n return ''\n }\n\n if (Array.isArray(elements)) {\n nodes = elements.filter(Boolean)\n } else {\n nodes = [elements].filter(Boolean)\n }\n\n const outputFile = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(nodes), sourceFile)\n const outputSource = printer.printFile(sourceFile)\n\n return [outputFile, restoreNewLines(outputSource)].filter(Boolean).join('\\n')\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/parser-ts",
3
- "version": "3.0.0-alpha.10",
3
+ "version": "3.0.0-alpha.11",
4
4
  "description": "TypeScript parser",
5
5
  "keywords": [
6
6
  "typescript",
@@ -55,9 +55,9 @@
55
55
  "devDependencies": {
56
56
  "prettier": "^3.3.3",
57
57
  "tsup": "^8.2.4",
58
- "@kubb/config-biome": "3.0.0-alpha.10",
59
- "@kubb/config-ts": "3.0.0-alpha.10",
60
- "@kubb/config-tsup": "3.0.0-alpha.10"
58
+ "@kubb/config-biome": "3.0.0-alpha.11",
59
+ "@kubb/config-ts": "3.0.0-alpha.11",
60
+ "@kubb/config-tsup": "3.0.0-alpha.11"
61
61
  },
62
62
  "engines": {
63
63
  "node": ">=20"