@kubb/fabric-core 0.12.7 → 0.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/parsers/typescript.cjs +1 -1
- package/dist/parsers/typescript.js +1 -1
- package/dist/parsers.cjs +1 -1
- package/dist/parsers.js +1 -1
- package/dist/{typescriptParser-DgNVqRUG.js → typescriptParser-Beo_bu1C.js} +3 -2
- package/dist/{typescriptParser-DgNVqRUG.js.map → typescriptParser-Beo_bu1C.js.map} +1 -1
- package/dist/{typescriptParser-qas7awdJ.cjs → typescriptParser-BpLeQZg4.cjs} +3 -2
- package/dist/{typescriptParser-qas7awdJ.cjs.map → typescriptParser-BpLeQZg4.cjs.map} +1 -1
- package/package.json +10 -6
- package/src/parsers/typescriptParser.ts +1 -0
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_getRelativePath = require('./getRelativePath-d_IC-HuZ.cjs');
|
|
2
2
|
const require_Root = require('./Root-x_Ojfys2.cjs');
|
|
3
|
-
const require_typescriptParser = require('./typescriptParser-
|
|
3
|
+
const require_typescriptParser = require('./typescriptParser-BpLeQZg4.cjs');
|
|
4
4
|
let remeda = require("remeda");
|
|
5
5
|
|
|
6
6
|
//#region src/composables/useContext.ts
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Cq_TCZj9.js";
|
|
2
2
|
import { _ as NodeTreeContext, a as renderIntrinsic, b as provide, c as TreeNode, f as AsyncEventEmitter, g as createFile, i as renderIndent, l as FileManager, n as createComponent, o as RenderContext, r as createIntrinsic, s as RootContext, t as Root, u as FileProcessor, v as createContext, x as unprovide, y as inject } from "./Root-Dtrt_UDQ.js";
|
|
3
3
|
import { t as getRelativePath } from "./getRelativePath-B46cm-1j.js";
|
|
4
|
-
import { n as createImport, r as print, t as createExport } from "./typescriptParser-
|
|
4
|
+
import { n as createImport, r as print, t as createExport } from "./typescriptParser-Beo_bu1C.js";
|
|
5
5
|
import { isFunction } from "remeda";
|
|
6
6
|
|
|
7
7
|
//#region src/composables/useContext.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_typescriptParser = require('../typescriptParser-
|
|
1
|
+
const require_typescriptParser = require('../typescriptParser-BpLeQZg4.cjs');
|
|
2
2
|
|
|
3
3
|
exports.createExport = require_typescriptParser.createExport;
|
|
4
4
|
exports.createImport = require_typescriptParser.createImport;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as typescriptParser, i as safePrint, n as createImport, o as validateNodes, r as print, t as createExport } from "../typescriptParser-
|
|
1
|
+
import { a as typescriptParser, i as safePrint, n as createImport, o as validateNodes, r as print, t as createExport } from "../typescriptParser-Beo_bu1C.js";
|
|
2
2
|
|
|
3
3
|
export { createExport, createImport, print, safePrint, typescriptParser, validateNodes };
|
package/dist/parsers.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_getRelativePath = require('./getRelativePath-d_IC-HuZ.cjs');
|
|
2
2
|
const require_defaultParser = require('./defaultParser-BLkEJRCl.cjs');
|
|
3
|
-
const require_typescriptParser = require('./typescriptParser-
|
|
3
|
+
const require_typescriptParser = require('./typescriptParser-BpLeQZg4.cjs');
|
|
4
4
|
|
|
5
5
|
//#region src/parsers/tsxParser.ts
|
|
6
6
|
const tsxParser = require_getRelativePath.defineParser({
|
package/dist/parsers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-Cq_TCZj9.js";
|
|
2
2
|
import { n as defineParser } from "./getRelativePath-B46cm-1j.js";
|
|
3
3
|
import { t as defaultParser } from "./defaultParser-BGDkOZaO.js";
|
|
4
|
-
import { a as typescriptParser } from "./typescriptParser-
|
|
4
|
+
import { a as typescriptParser } from "./typescriptParser-Beo_bu1C.js";
|
|
5
5
|
|
|
6
6
|
//#region src/parsers/tsxParser.ts
|
|
7
7
|
const tsxParser = defineParser({
|
|
@@ -73,7 +73,8 @@ const typescriptParser = defineParser({
|
|
|
73
73
|
importNodes.push(createImport({
|
|
74
74
|
name: item.name,
|
|
75
75
|
path: options.extname && hasExtname ? `${trimExtName(importPath)}${options.extname}` : item.root ? trimExtName(importPath) : importPath,
|
|
76
|
-
isTypeOnly: item.isTypeOnly
|
|
76
|
+
isTypeOnly: item.isTypeOnly,
|
|
77
|
+
isNameSpace: item.isNameSpace
|
|
77
78
|
}));
|
|
78
79
|
}
|
|
79
80
|
const exportNodes = [];
|
|
@@ -98,4 +99,4 @@ const typescriptParser = defineParser({
|
|
|
98
99
|
|
|
99
100
|
//#endregion
|
|
100
101
|
export { typescriptParser as a, safePrint as i, createImport as n, validateNodes as o, print as r, createExport as t };
|
|
101
|
-
//# sourceMappingURL=typescriptParser-
|
|
102
|
+
//# sourceMappingURL=typescriptParser-Beo_bu1C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescriptParser-
|
|
1
|
+
{"version":3,"file":"typescriptParser-Beo_bu1C.js","names":[],"sources":["../src/parsers/typescriptParser.ts"],"sourcesContent":["import path from 'node:path'\nimport ts from 'typescript'\nimport { getRelativePath } from '../utils/getRelativePath.ts'\nimport { trimExtName } from '../utils/trimExtName.ts'\nimport { defineParser } from './defineParser.ts'\n\nconst { factory } = ts\n\n/**\n * Validates TypeScript AST nodes before printing to catch invalid nodes early.\n * Throws an error if any node has SyntaxKind.Unknown which would cause the TypeScript printer to crash.\n */\nexport function validateNodes(...nodes: ts.Node[]): void {\n for (const node of nodes) {\n if (!node) {\n throw new Error('Attempted to print undefined or null TypeScript node')\n }\n if (node.kind === ts.SyntaxKind.Unknown) {\n throw new Error(\n 'Invalid TypeScript AST node detected with SyntaxKind.Unknown. ' +\n `This typically indicates a schema pattern that couldn't be properly converted to TypeScript. ` +\n `Node: ${JSON.stringify(node, null, 2)}`,\n )\n }\n }\n}\n\n/**\n * Convert AST TypeScript/TSX nodes to a string based on the TypeScript printer.\n */\nexport function print(...elements: Array<ts.Node>): string {\n const sourceFile = ts.createSourceFile('print.tsx', '', ts.ScriptTarget.ES2022, true, ts.ScriptKind.TSX)\n\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n noEmitHelpers: true,\n })\n\n for (const node of elements) {\n if (node.kind === ts.SyntaxKind.Unknown) {\n console.error('⚠️ Unknown node found:', node)\n }\n }\n\n const output = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(elements.filter(Boolean)), sourceFile)\n\n return output.replace(/\\r\\n/g, '\\n')\n}\n\nexport function safePrint(...elements: Array<ts.Node>): string {\n validateNodes(...elements)\n\n return print(...elements)\n}\n\nexport function createImport({\n name,\n path,\n root,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n root?: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n const resolvePath = root ? getRelativePath(root, path) : path\n\n // Namespace or default import\n if (!Array.isArray(name)) {\n if (isNameSpace) {\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, undefined, factory.createNamespaceImport(factory.createIdentifier(name))),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, factory.createIdentifier(name), undefined),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n }\n\n // Named imports\n const specifiers = name.map((item) => {\n if (typeof item === 'object') {\n const { propertyName, name: alias } = item\n return factory.createImportSpecifier(false, alias ? factory.createIdentifier(propertyName) : undefined, factory.createIdentifier(alias ?? propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n })\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, undefined, factory.createNamedImports(specifiers)),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n}\n\nexport function createExport({\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 const typescriptParser = defineParser({\n name: 'typescript',\n extNames: ['.ts', '.js'],\n install() {},\n async parse(file, options = { extname: '.ts' }) {\n const sourceParts: Array<string> = []\n for (const item of file.sources) {\n if (item.value) {\n sourceParts.push(item.value)\n }\n }\n const source = sourceParts.join('\\n\\n')\n\n const importNodes: Array<ts.ImportDeclaration> = []\n for (const item of file.imports) {\n const importPath = item.root ? getRelativePath(item.root, item.path) : item.path\n const hasExtname = !!path.extname(importPath)\n\n importNodes.push(\n createImport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(importPath)}${options.extname}` : item.root ? trimExtName(importPath) : importPath,\n isTypeOnly: item.isTypeOnly,\n isNameSpace: item.isNameSpace,\n }),\n )\n }\n\n const exportNodes: Array<ts.ExportDeclaration> = []\n for (const item of file.exports) {\n const exportPath = item.path\n const hasExtname = !!path.extname(exportPath)\n\n exportNodes.push(\n createExport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(item.path)}${options.extname}` : trimExtName(item.path),\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n }),\n )\n }\n\n const parts = [file.banner, print(...importNodes, ...exportNodes), source, file.footer].filter((segment): segment is string => segment != null)\n return parts.join('\\n')\n },\n})\n"],"mappings":";;;;;;AAMA,MAAM,EAAE,YAAY;;;;;AAMpB,SAAgB,cAAc,GAAG,OAAwB;AACvD,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,uDAAuD;AAEzE,MAAI,KAAK,SAAS,GAAG,WAAW,QAC9B,OAAM,IAAI,MACR,oKAEW,KAAK,UAAU,MAAM,MAAM,EAAE,GACzC;;;;;;AAQP,SAAgB,MAAM,GAAG,UAAkC;CACzD,MAAM,aAAa,GAAG,iBAAiB,aAAa,IAAI,GAAG,aAAa,QAAQ,MAAM,GAAG,WAAW,IAAI;CAExG,MAAM,UAAU,GAAG,cAAc;EAC/B,uBAAuB;EACvB,SAAS,GAAG,YAAY;EACxB,gBAAgB;EAChB,eAAe;EAChB,CAAC;AAEF,MAAK,MAAM,QAAQ,SACjB,KAAI,KAAK,SAAS,GAAG,WAAW,QAC9B,SAAQ,MAAM,0BAA0B,KAAK;AAMjD,QAFe,QAAQ,UAAU,GAAG,WAAW,WAAW,QAAQ,gBAAgB,SAAS,OAAO,QAAQ,CAAC,EAAE,WAAW,CAE1G,QAAQ,SAAS,KAAK;;AAGtC,SAAgB,UAAU,GAAG,UAAkC;AAC7D,eAAc,GAAG,SAAS;AAE1B,QAAO,MAAM,GAAG,SAAS;;AAG3B,SAAgB,aAAa,EAC3B,MACA,MACA,MACA,aAAa,OACb,cAAc,SAOb;CACD,MAAM,cAAc,OAAO,gBAAgB,MAAM,KAAK,GAAG;AAGzD,KAAI,CAAC,MAAM,QAAQ,KAAK,EAAE;AACxB,MAAI,YACF,QAAO,QAAQ,wBACb,QACA,QAAQ,mBAAmB,YAAY,QAAW,QAAQ,sBAAsB,QAAQ,iBAAiB,KAAK,CAAC,CAAC,EAChH,QAAQ,oBAAoB,YAAY,EACxC,OACD;AAGH,SAAO,QAAQ,wBACb,Q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U,EAAE,SAAS,OAAO,EAAE;EAC9C,MAAM,cAA6B,EAAE;AACrC,OAAK,MAAM,QAAQ,KAAK,QACtB,KAAI,KAAK,MACP,aAAY,KAAK,KAAK,MAAM;EAGhC,MAAM,SAAS,YAAY,KAAK,OAAO;EAEvC,MAAM,cAA2C,EAAE;AACnD,OAAK,MAAM,QAAQ,KAAK,SAAS;GAC/B,MAAM,aAAa,KAAK,OAAO,gBAAgB,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK;GAC5E,MAAM,aAAa,CAAC,CAAC,KAAK,QAAQ,WAAW;AAE7C,eAAY,KACV,aAAa;IACX,MAAM,KAAK;IACX,MAAM,QAAQ,WAAW,aAAa,GAAG,YAAY,WAAW,GAAG,QAAQ,YAAY,KAAK,OAAO,YAAY,WAAW,GAAG;IAC7H,YAAY,KAAK;IACjB,aAAa,KAAK;IACnB,CAAC,CACH;;EAGH,MAAM,cAA2C,EAAE;AACnD,OAAK,MAAM,QAAQ,KAAK,SAAS;GAC/B,MAAM,aAAa,KAAK;GACxB,MAAM,aAAa,CAAC,CAAC,KAAK,QAAQ,WAAW;AAE7C,eAAY,KACV,aAAa;IACX,MAAM,KAAK;IACX,MAAM,QAAQ,WAAW,aAAa,GAAG,YAAY,KAAK,KAAK,GAAG,QAAQ,YAAY,YAAY,KAAK,KAAK;IAC5G,YAAY,KAAK;IACjB,SAAS,KAAK;IACf,CAAC,CACH;;AAIH,SADc;GAAC,KAAK;GAAQ,MAAM,GAAG,aAAa,GAAG,YAAY;GAAE;GAAQ,KAAK;GAAO,CAAC,QAAQ,YAA+B,WAAW,KAAK,CAClI,KAAK,KAAK;;CAE1B,CAAC"}
|
|
@@ -74,7 +74,8 @@ const typescriptParser = require_getRelativePath.defineParser({
|
|
|
74
74
|
importNodes.push(createImport({
|
|
75
75
|
name: item.name,
|
|
76
76
|
path: options.extname && hasExtname ? `${require_getRelativePath.trimExtName(importPath)}${options.extname}` : item.root ? require_getRelativePath.trimExtName(importPath) : importPath,
|
|
77
|
-
isTypeOnly: item.isTypeOnly
|
|
77
|
+
isTypeOnly: item.isTypeOnly,
|
|
78
|
+
isNameSpace: item.isNameSpace
|
|
78
79
|
}));
|
|
79
80
|
}
|
|
80
81
|
const exportNodes = [];
|
|
@@ -134,4 +135,4 @@ Object.defineProperty(exports, 'validateNodes', {
|
|
|
134
135
|
return validateNodes;
|
|
135
136
|
}
|
|
136
137
|
});
|
|
137
|
-
//# sourceMappingURL=typescriptParser-
|
|
138
|
+
//# sourceMappingURL=typescriptParser-BpLeQZg4.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescriptParser-
|
|
1
|
+
{"version":3,"file":"typescriptParser-BpLeQZg4.cjs","names":["ts","getRelativePath","defineParser","path","trimExtName"],"sources":["../src/parsers/typescriptParser.ts"],"sourcesContent":["import path from 'node:path'\nimport ts from 'typescript'\nimport { getRelativePath } from '../utils/getRelativePath.ts'\nimport { trimExtName } from '../utils/trimExtName.ts'\nimport { defineParser } from './defineParser.ts'\n\nconst { factory } = ts\n\n/**\n * Validates TypeScript AST nodes before printing to catch invalid nodes early.\n * Throws an error if any node has SyntaxKind.Unknown which would cause the TypeScript printer to crash.\n */\nexport function validateNodes(...nodes: ts.Node[]): void {\n for (const node of nodes) {\n if (!node) {\n throw new Error('Attempted to print undefined or null TypeScript node')\n }\n if (node.kind === ts.SyntaxKind.Unknown) {\n throw new Error(\n 'Invalid TypeScript AST node detected with SyntaxKind.Unknown. ' +\n `This typically indicates a schema pattern that couldn't be properly converted to TypeScript. ` +\n `Node: ${JSON.stringify(node, null, 2)}`,\n )\n }\n }\n}\n\n/**\n * Convert AST TypeScript/TSX nodes to a string based on the TypeScript printer.\n */\nexport function print(...elements: Array<ts.Node>): string {\n const sourceFile = ts.createSourceFile('print.tsx', '', ts.ScriptTarget.ES2022, true, ts.ScriptKind.TSX)\n\n const printer = ts.createPrinter({\n omitTrailingSemicolon: true,\n newLine: ts.NewLineKind.LineFeed,\n removeComments: false,\n noEmitHelpers: true,\n })\n\n for (const node of elements) {\n if (node.kind === ts.SyntaxKind.Unknown) {\n console.error('⚠️ Unknown node found:', node)\n }\n }\n\n const output = printer.printList(ts.ListFormat.MultiLine, factory.createNodeArray(elements.filter(Boolean)), sourceFile)\n\n return output.replace(/\\r\\n/g, '\\n')\n}\n\nexport function safePrint(...elements: Array<ts.Node>): string {\n validateNodes(...elements)\n\n return print(...elements)\n}\n\nexport function createImport({\n name,\n path,\n root,\n isTypeOnly = false,\n isNameSpace = false,\n}: {\n name: string | Array<string | { propertyName: string; name?: string }>\n path: string\n root?: string\n isTypeOnly?: boolean\n isNameSpace?: boolean\n}) {\n const resolvePath = root ? getRelativePath(root, path) : path\n\n // Namespace or default import\n if (!Array.isArray(name)) {\n if (isNameSpace) {\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, undefined, factory.createNamespaceImport(factory.createIdentifier(name))),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n }\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, factory.createIdentifier(name), undefined),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n }\n\n // Named imports\n const specifiers = name.map((item) => {\n if (typeof item === 'object') {\n const { propertyName, name: alias } = item\n return factory.createImportSpecifier(false, alias ? factory.createIdentifier(propertyName) : undefined, factory.createIdentifier(alias ?? propertyName))\n }\n\n return factory.createImportSpecifier(false, undefined, factory.createIdentifier(item))\n })\n\n return factory.createImportDeclaration(\n undefined,\n factory.createImportClause(isTypeOnly, undefined, factory.createNamedImports(specifiers)),\n factory.createStringLiteral(resolvePath),\n undefined,\n )\n}\n\nexport function createExport({\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 const typescriptParser = defineParser({\n name: 'typescript',\n extNames: ['.ts', '.js'],\n install() {},\n async parse(file, options = { extname: '.ts' }) {\n const sourceParts: Array<string> = []\n for (const item of file.sources) {\n if (item.value) {\n sourceParts.push(item.value)\n }\n }\n const source = sourceParts.join('\\n\\n')\n\n const importNodes: Array<ts.ImportDeclaration> = []\n for (const item of file.imports) {\n const importPath = item.root ? getRelativePath(item.root, item.path) : item.path\n const hasExtname = !!path.extname(importPath)\n\n importNodes.push(\n createImport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(importPath)}${options.extname}` : item.root ? trimExtName(importPath) : importPath,\n isTypeOnly: item.isTypeOnly,\n isNameSpace: item.isNameSpace,\n }),\n )\n }\n\n const exportNodes: Array<ts.ExportDeclaration> = []\n for (const item of file.exports) {\n const exportPath = item.path\n const hasExtname = !!path.extname(exportPath)\n\n exportNodes.push(\n createExport({\n name: item.name,\n path: options.extname && hasExtname ? `${trimExtName(item.path)}${options.extname}` : trimExtName(item.path),\n isTypeOnly: item.isTypeOnly,\n asAlias: item.asAlias,\n }),\n )\n }\n\n const parts = [file.banner, print(...importNodes, ...exportNodes), source, file.footer].filter((segment): segment is string => segment != null)\n return parts.join('\\n')\n },\n})\n"],"mappings":";;;;;;;AAMA,MAAM,EAAE,YAAYA;;;;;AAMpB,SAAgB,cAAc,GAAG,OAAwB;AACvD,MAAK,MAAM,QAAQ,OAAO;AACxB,MAAI,CAAC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C,EAAE;AACnD,OAAK,MAAM,QAAQ,KAAK,SAAS;GAC/B,MAAM,aAAa,KAAK,OAAOD,wCAAgB,KAAK,MAAM,KAAK,KAAK,GAAG,KAAK;GAC5E,MAAM,aAAa,CAAC,CAACE,kBAAK,QAAQ,WAAW;AAE7C,eAAY,KACV,aAAa;IACX,MAAM,KAAK;IACX,MAAM,QAAQ,WAAW,aAAa,GAAGC,oCAAY,WAAW,GAAG,QAAQ,YAAY,KAAK,OAAOA,oCAAY,WAAW,GAAG;IAC7H,YAAY,KAAK;IACjB,aAAa,KAAK;IACnB,CAAC,CACH;;EAGH,MAAM,cAA2C,EAAE;AACnD,OAAK,MAAM,QAAQ,KAAK,SAAS;GAC/B,MAAM,aAAa,KAAK;GACxB,MAAM,aAAa,CAAC,CAACD,kBAAK,QAAQ,WAAW;AAE7C,eAAY,KACV,aAAa;IACX,MAAM,KAAK;IACX,MAAM,QAAQ,WAAW,aAAa,GAAGC,oCAAY,KAAK,KAAK,GAAG,QAAQ,YAAYA,oCAAY,KAAK,KAAK;IAC5G,YAAY,KAAK;IACjB,SAAS,KAAK;IACf,CAAC,CACH;;AAIH,SADc;GAAC,KAAK;GAAQ,MAAM,GAAG,aAAa,GAAG,YAAY;GAAE;GAAQ,KAAK;GAAO,CAAC,QAAQ,YAA+B,WAAW,KAAK,CAClI,KAAK,KAAK;;CAE1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/fabric-core",
|
|
3
|
-
"version": "0.12.
|
|
4
|
-
"description": "Core functionality for Kubb's
|
|
3
|
+
"version": "0.12.9",
|
|
4
|
+
"description": "Core functionality for Kubb's fabric - A language-agnostic toolkit providing the foundation for plugin-based code generation with TypeScript support",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"codegen",
|
|
7
|
+
"code-generator",
|
|
6
8
|
"typescript",
|
|
7
|
-
"
|
|
9
|
+
"file-system",
|
|
10
|
+
"ast",
|
|
11
|
+
"parser",
|
|
8
12
|
"plugin-system",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
13
|
+
"plugins",
|
|
14
|
+
"fabric",
|
|
11
15
|
"openapi",
|
|
12
16
|
"swagger",
|
|
13
17
|
"kubb"
|
|
@@ -82,7 +86,7 @@
|
|
|
82
86
|
"@clack/prompts": "^1.0.0",
|
|
83
87
|
"fs-extra": "^11.3.3",
|
|
84
88
|
"natural-orderby": "^5.0.0",
|
|
85
|
-
"p-limit": "^7.
|
|
89
|
+
"p-limit": "^7.3.0",
|
|
86
90
|
"picocolors": "^1.1.1",
|
|
87
91
|
"remeda": "^2.33.4",
|
|
88
92
|
"serve-handler": "^6.1.6",
|
|
@@ -170,6 +170,7 @@ export const typescriptParser = defineParser({
|
|
|
170
170
|
name: item.name,
|
|
171
171
|
path: options.extname && hasExtname ? `${trimExtName(importPath)}${options.extname}` : item.root ? trimExtName(importPath) : importPath,
|
|
172
172
|
isTypeOnly: item.isTypeOnly,
|
|
173
|
+
isNameSpace: item.isNameSpace,
|
|
173
174
|
}),
|
|
174
175
|
)
|
|
175
176
|
}
|