@kubb/parser
Advanced tools
Comparing version 1.15.0-canary.20231025T103336 to 1.15.0-canary.20231025T123540
@@ -117,4 +117,4 @@ import ts from 'typescript'; | ||
declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, baseName?: string): string; | ||
declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, source?: string, baseName?: string): string; | ||
export { ArrayTwoOrMore, appendJSDocToNode, createEnumDeclaration, createExportDeclaration, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createTupleDeclaration, createTypeAliasDeclaration, createUnionDeclaration, modifiers, parse, print }; |
@@ -290,3 +290,5 @@ import { createRequire } from 'module'; | ||
var { factory: factory2 } = ts; | ||
function print(elements, baseName = "print.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); | ||
let nodes = []; | ||
@@ -297,11 +299,9 @@ if (!elements) { | ||
if (Array.isArray(elements)) { | ||
nodes = elements; | ||
nodes = elements.filter(Boolean); | ||
} else { | ||
nodes = [elements]; | ||
nodes = [elements].filter(Boolean); | ||
} | ||
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; | ||
const outputFile = printer.printList(ts.ListFormat.MultiLine, factory2.createNodeArray(nodes), sourceFile); | ||
const outputSource = printer.printFile(sourceFile); | ||
return [outputFile, outputSource].filter(Boolean).join("\n"); | ||
} | ||
@@ -308,0 +308,0 @@ |
{ | ||
"name": "@kubb/parser", | ||
"version": "1.15.0-canary.20231025T103336", | ||
"version": "1.15.0-canary.20231025T123540", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77101