@kubb/parser
Advanced tools
Comparing version 1.15.0-canary.20231024T104143 to 1.15.0-canary.20231025T103336
@@ -117,4 +117,4 @@ import ts from 'typescript'; | ||
declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, source?: string, baseName?: string): string; | ||
declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, baseName?: string): string; | ||
export { ArrayTwoOrMore, appendJSDocToNode, createEnumDeclaration, createExportDeclaration, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createTupleDeclaration, createTypeAliasDeclaration, createUnionDeclaration, modifiers, parse, print }; |
@@ -290,5 +290,3 @@ import { createRequire } from 'module'; | ||
var { factory: factory2 } = ts; | ||
function print(elements, source = "", baseName = "print.ts") { | ||
const printer = ts.createPrinter({ omitTrailingSemicolon: false, newLine: ts.NewLineKind.LineFeed }); | ||
const sourceFile = ts.createSourceFile(baseName, source, ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS); | ||
function print(elements, baseName = "print.ts") { | ||
let nodes = []; | ||
@@ -299,9 +297,11 @@ if (!elements) { | ||
if (Array.isArray(elements)) { | ||
nodes = elements.filter(Boolean); | ||
nodes = elements; | ||
} else { | ||
nodes = [elements].filter(Boolean); | ||
nodes = [elements]; | ||
} | ||
const outputFile = printer.printList(ts.ListFormat.MultiLine, factory2.createNodeArray(nodes), sourceFile); | ||
const outputSource = printer.printFile(sourceFile); | ||
return [outputFile, outputSource].filter(Boolean).join("\n"); | ||
const nodesArray = factory2.createNodeArray(nodes.filter(Boolean)); | ||
const sourceFile = ts.createSourceFile(baseName, "", ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS); | ||
const printer = ts.createPrinter({ omitTrailingSemicolon: false, newLine: ts.NewLineKind.LineFeed }); | ||
const outputFile = printer.printList(ts.ListFormat.MultiLine, nodesArray, sourceFile); | ||
return outputFile; | ||
} | ||
@@ -308,0 +308,0 @@ |
{ | ||
"name": "@kubb/parser", | ||
"version": "1.15.0-canary.20231024T104143", | ||
"version": "1.15.0-canary.20231025T103336", | ||
"description": "Generator parser", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76523