@kubb/ts-codegen
Advanced tools
Comparing version 0.56.0 to 0.56.1
@@ -1,18 +0,11 @@ | ||
'use strict'; | ||
import { createRequire } from 'module'; | ||
import ts from 'typescript'; | ||
import pathParser from 'path'; | ||
import { TreeNode, write } from '@kubb/core'; | ||
var module$1 = require('module'); | ||
var ts = require('typescript'); | ||
var pathParser = require('path'); | ||
var core = require('@kubb/core'); | ||
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } | ||
var ts__default = /*#__PURE__*/_interopDefault(ts); | ||
var pathParser__default = /*#__PURE__*/_interopDefault(pathParser); | ||
module$1.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('out.js', document.baseURI).href))); | ||
var { factory } = ts__default.default; | ||
createRequire(import.meta.url); | ||
var { factory } = ts; | ||
var modifier = { | ||
async: factory.createModifier(ts__default.default.SyntaxKind.AsyncKeyword), | ||
export: factory.createModifier(ts__default.default.SyntaxKind.ExportKeyword) | ||
async: factory.createModifier(ts.SyntaxKind.AsyncKeyword), | ||
export: factory.createModifier(ts.SyntaxKind.ExportKeyword) | ||
}; | ||
@@ -22,4 +15,4 @@ function isValidIdentifier(str) { | ||
return false; | ||
const node = ts__default.default.parseIsolatedEntityName(str, ts__default.default.ScriptTarget.Latest); | ||
return !!node && node.kind === ts__default.default.SyntaxKind.Identifier && node.originalKeywordKind === void 0; | ||
const node = ts.parseIsolatedEntityName(str, ts.ScriptTarget.Latest); | ||
return !!node && node.kind === ts.SyntaxKind.Identifier && node.originalKeywordKind === void 0; | ||
} | ||
@@ -32,3 +25,3 @@ function propertyName(name) { | ||
} | ||
var questionToken = factory.createToken(ts__default.default.SyntaxKind.QuestionToken); | ||
var questionToken = factory.createToken(ts.SyntaxKind.QuestionToken); | ||
function createQuestionToken(token) { | ||
@@ -66,3 +59,3 @@ if (!token) | ||
}, "*"); | ||
return ts__default.default.addSyntheticLeadingComment(node, ts__default.default.SyntaxKind.MultiLineCommentTrivia, `${text} | ||
return ts.addSyntheticLeadingComment(node, ts.SyntaxKind.MultiLineCommentTrivia, `${text} | ||
`, true); | ||
@@ -82,3 +75,3 @@ } | ||
indexName = "key", | ||
indexType = factory.createKeywordTypeNode(ts__default.default.SyntaxKind.StringKeyword) | ||
indexType = factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword) | ||
} = {}) { | ||
@@ -125,3 +118,3 @@ return factory.createIndexSignature(modifiers, [createParameter(indexName, { type: indexType })], type); | ||
factory.createVariableStatement( | ||
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)], | ||
[factory.createToken(ts.SyntaxKind.ExportKeyword)], | ||
factory.createVariableDeclarationList( | ||
@@ -144,7 +137,7 @@ [ | ||
], | ||
ts__default.default.NodeFlags.Const | ||
ts.NodeFlags.Const | ||
) | ||
), | ||
factory.createTypeAliasDeclaration( | ||
[factory.createToken(ts__default.default.SyntaxKind.ExportKeyword)], | ||
[factory.createToken(ts.SyntaxKind.ExportKeyword)], | ||
factory.createIdentifier(typeName), | ||
@@ -154,3 +147,3 @@ void 0, | ||
factory.createParenthesizedType(factory.createTypeQueryNode(factory.createIdentifier(name), void 0)), | ||
factory.createTypeOperatorNode(ts__default.default.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(name), void 0)) | ||
factory.createTypeOperatorNode(ts.SyntaxKind.KeyOfKeyword, factory.createTypeQueryNode(factory.createIdentifier(name), void 0)) | ||
) | ||
@@ -163,3 +156,3 @@ ) | ||
} | ||
var { factory: factory2 } = ts__default.default; | ||
var { factory: factory2 } = ts; | ||
var print = (elements, fileName = "print.ts") => { | ||
@@ -173,9 +166,9 @@ let nodes = []; | ||
const nodesArray = factory2.createNodeArray(nodes.filter(Boolean)); | ||
const sourceFile = ts__default.default.createSourceFile(fileName, "", ts__default.default.ScriptTarget.ESNext, true, ts__default.default.ScriptKind.TS); | ||
const printer = ts__default.default.createPrinter(); | ||
const outputFile = printer.printList(ts__default.default.ListFormat.MultiLine, nodesArray, sourceFile); | ||
const sourceFile = ts.createSourceFile(fileName, "", ts.ScriptTarget.ESNext, true, ts.ScriptKind.TS); | ||
const printer = ts.createPrinter(); | ||
const outputFile = printer.printList(ts.ListFormat.MultiLine, nodesArray, sourceFile); | ||
return outputFile; | ||
}; | ||
var writeIndexes = (root, output, options) => { | ||
const tree = core.TreeNode.build(output, { extensions: /\.ts/, ...options }); | ||
const tree = TreeNode.build(output, { extensions: /\.ts/, ...options }); | ||
if (!tree) { | ||
@@ -189,3 +182,3 @@ return void 0; | ||
if (item.children?.length > 1) { | ||
const path = pathParser__default.default.resolve(root, item.data.path, "index.ts"); | ||
const path = pathParser.resolve(root, item.data.path, "index.ts"); | ||
const nodes = item.children.map((file) => { | ||
@@ -211,3 +204,3 @@ if (!file) { | ||
item.children?.forEach((child) => { | ||
const path = pathParser__default.default.resolve(root, item.data.path, "index.ts"); | ||
const path = pathParser.resolve(root, item.data.path, "index.ts"); | ||
const importPath = child.data.type === "directory" ? `./${child.data.name}` : `./${child.data.name.replace(/\.[^.]*$/, "")}`; | ||
@@ -231,22 +224,7 @@ const node = createExportDeclaration({ | ||
const files = fileReducer([], tree); | ||
return files.map((file) => core.write(file.source, file.path)); | ||
return files.map((file) => write(file.source, file.path)); | ||
}; | ||
exports.appendJSDocToNode = appendJSDocToNode; | ||
exports.createEnumDeclaration = createEnumDeclaration; | ||
exports.createExportDeclaration = createExportDeclaration; | ||
exports.createImportDeclaration = createImportDeclaration; | ||
exports.createIndexSignature = createIndexSignature; | ||
exports.createIntersectionDeclaration = createIntersectionDeclaration; | ||
exports.createJSDoc = createJSDoc; | ||
exports.createParameter = createParameter; | ||
exports.createPropertySignature = createPropertySignature; | ||
exports.createQuestionToken = createQuestionToken; | ||
exports.createTypeAliasDeclaration = createTypeAliasDeclaration; | ||
exports.isValidIdentifier = isValidIdentifier; | ||
exports.modifier = modifier; | ||
exports.print = print; | ||
exports.questionToken = questionToken; | ||
exports.writeIndexes = writeIndexes; | ||
export { appendJSDocToNode, createEnumDeclaration, createExportDeclaration, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createParameter, createPropertySignature, createQuestionToken, createTypeAliasDeclaration, isValidIdentifier, modifier, print, questionToken, writeIndexes }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@kubb/ts-codegen", | ||
"version": "0.56.0", | ||
"version": "0.56.1", | ||
"description": "Generator ts-codegen", | ||
@@ -19,5 +19,6 @@ "repository": { | ||
"sideEffects": false, | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"unpkg": "dist/index.global.js", | ||
"module": "dist/index.mjs", | ||
"module": "dist/index.js", | ||
"browser": "build/index.global.js", | ||
@@ -28,5 +29,5 @@ "types": "./dist/index.d.ts", | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.mjs", | ||
"module": "./dist/index.mjs", | ||
"default": "./dist/index.js" | ||
"import": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"default": "./dist/index.cjs" | ||
}, | ||
@@ -45,3 +46,3 @@ "./package.json": "./package.json" | ||
"dependencies": { | ||
"@kubb/core": "0.56.0", | ||
"@kubb/core": "0.56.1", | ||
"typescript": "^4.9.5" | ||
@@ -56,2 +57,5 @@ }, | ||
}, | ||
"engines": { | ||
"node": "^12.17.0 || ^14.13 || >=16.0.0" | ||
}, | ||
"scripts": { | ||
@@ -63,5 +67,5 @@ "build": "tsup", | ||
"pre-push": "pnpm typecheck", | ||
"test": "jest --config ../../jest.config.js --passWithNoTests --runInBand --testPathPattern=packages/ts-codegen/src", | ||
"test:local": "jest --config ../../jest.config.js --testPathPattern=packages/ts-codegen/src --maxWorkers=50%", | ||
"test:watch": "jest --config ../../jest.config.js --testPathPattern=packages/ts-codegen/src --maxWorkers=25% --watch", | ||
"test": "jest --config ../../jest.config.ts --passWithNoTests --runInBand --testPathPattern=packages/ts-codegen/src", | ||
"test:local": "jest --config ../../jest.config.ts --testPathPattern=packages/ts-codegen/src --maxWorkers=50%", | ||
"test:watch": "jest --config ../../jest.config.ts --testPathPattern=packages/ts-codegen/src --maxWorkers=25% --watch", | ||
"upgrade": "ncu -u", | ||
@@ -68,0 +72,0 @@ "upgrade:local": "ncu --interactive --doctor", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51659
Yes
1
+ Added@kubb/core@0.56.1(transitive)
- Removed@kubb/core@0.56.0(transitive)
Updated@kubb/core@0.56.1