@kubb/parser-ts 3.0.0-alpha.9 → 3.0.0-beta.10

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.
@@ -29,7 +29,7 @@ declare function createArrayDeclaration({ nodes, }: {
29
29
  declare function createUnionDeclaration({ nodes, withParentheses, }: {
30
30
  nodes: Array<ts.TypeNode>;
31
31
  withParentheses?: boolean;
32
- }): ts.TypeNode | null;
32
+ }): ts.TypeNode;
33
33
  declare function createPropertySignature({ readOnly, modifiers, name, questionToken, type, }: {
34
34
  readOnly?: boolean;
35
35
  modifiers?: Array<ts.Modifier>;
@@ -130,12 +130,15 @@ declare const createLiteralTypeNode: (literal: ts.LiteralTypeNode["literal"]) =>
130
130
  declare const createNull: () => ts.NullLiteral;
131
131
  declare const createIdentifier: (text: string) => ts.Identifier;
132
132
  declare const createTupleTypeNode: (elements: readonly (ts.TypeNode | ts.NamedTupleMember)[]) => ts.TupleTypeNode;
133
+ declare const createTrue: () => ts.TrueLiteral;
134
+ declare const createFalse: () => ts.FalseLiteral;
133
135
 
134
136
  declare const factory_appendJSDocToNode: typeof appendJSDocToNode;
135
137
  declare const factory_createArrayDeclaration: typeof createArrayDeclaration;
136
138
  declare const factory_createArrayTypeNode: typeof createArrayTypeNode;
137
139
  declare const factory_createEnumDeclaration: typeof createEnumDeclaration;
138
140
  declare const factory_createExportDeclaration: typeof createExportDeclaration;
141
+ declare const factory_createFalse: typeof createFalse;
139
142
  declare const factory_createIdentifier: typeof createIdentifier;
140
143
  declare const factory_createImportDeclaration: typeof createImportDeclaration;
141
144
  declare const factory_createIndexSignature: typeof createIndexSignature;
@@ -150,6 +153,7 @@ declare const factory_createParameterSignature: typeof createParameterSignature;
150
153
  declare const factory_createPropertySignature: typeof createPropertySignature;
151
154
  declare const factory_createQuestionToken: typeof createQuestionToken;
152
155
  declare const factory_createStringLiteral: typeof createStringLiteral;
156
+ declare const factory_createTrue: typeof createTrue;
153
157
  declare const factory_createTupleDeclaration: typeof createTupleDeclaration;
154
158
  declare const factory_createTupleTypeNode: typeof createTupleTypeNode;
155
159
  declare const factory_createTypeAliasDeclaration: typeof createTypeAliasDeclaration;
@@ -159,7 +163,7 @@ declare const factory_createUnionDeclaration: typeof createUnionDeclaration;
159
163
  declare const factory_keywordTypeNodes: typeof keywordTypeNodes;
160
164
  declare const factory_modifiers: typeof modifiers;
161
165
  declare namespace factory {
162
- export { factory_appendJSDocToNode as appendJSDocToNode, factory_createArrayDeclaration as createArrayDeclaration, factory_createArrayTypeNode as createArrayTypeNode, factory_createEnumDeclaration as createEnumDeclaration, factory_createExportDeclaration as createExportDeclaration, factory_createIdentifier as createIdentifier, factory_createImportDeclaration as createImportDeclaration, factory_createIndexSignature as createIndexSignature, factory_createIntersectionDeclaration as createIntersectionDeclaration, factory_createJSDoc as createJSDoc, factory_createLiteralTypeNode as createLiteralTypeNode, factory_createNamespaceDeclaration as createNamespaceDeclaration, factory_createNull as createNull, factory_createNumericLiteral as createNumericLiteral, factory_createOmitDeclaration as createOmitDeclaration, factory_createParameterSignature as createParameterSignature, factory_createPropertySignature as createPropertySignature, factory_createQuestionToken as createQuestionToken, factory_createStringLiteral as createStringLiteral, factory_createTupleDeclaration as createTupleDeclaration, factory_createTupleTypeNode as createTupleTypeNode, factory_createTypeAliasDeclaration as createTypeAliasDeclaration, factory_createTypeLiteralNode as createTypeLiteralNode, factory_createTypeReferenceNode as createTypeReferenceNode, factory_createUnionDeclaration as createUnionDeclaration, factory_keywordTypeNodes as keywordTypeNodes, factory_modifiers as modifiers };
166
+ export { factory_appendJSDocToNode as appendJSDocToNode, factory_createArrayDeclaration as createArrayDeclaration, factory_createArrayTypeNode as createArrayTypeNode, factory_createEnumDeclaration as createEnumDeclaration, factory_createExportDeclaration as createExportDeclaration, factory_createFalse as createFalse, factory_createIdentifier as createIdentifier, factory_createImportDeclaration as createImportDeclaration, factory_createIndexSignature as createIndexSignature, factory_createIntersectionDeclaration as createIntersectionDeclaration, factory_createJSDoc as createJSDoc, factory_createLiteralTypeNode as createLiteralTypeNode, factory_createNamespaceDeclaration as createNamespaceDeclaration, factory_createNull as createNull, factory_createNumericLiteral as createNumericLiteral, factory_createOmitDeclaration as createOmitDeclaration, factory_createParameterSignature as createParameterSignature, factory_createPropertySignature as createPropertySignature, factory_createQuestionToken as createQuestionToken, factory_createStringLiteral as createStringLiteral, factory_createTrue as createTrue, factory_createTupleDeclaration as createTupleDeclaration, factory_createTupleTypeNode as createTupleTypeNode, factory_createTypeAliasDeclaration as createTypeAliasDeclaration, factory_createTypeLiteralNode as createTypeLiteralNode, factory_createTypeReferenceNode as createTypeReferenceNode, factory_createUnionDeclaration as createUnionDeclaration, factory_keywordTypeNodes as keywordTypeNodes, factory_modifiers as modifiers };
163
167
  }
164
168
 
165
- export { createIdentifier as A, createTupleTypeNode as B, createIntersectionDeclaration as a, createTupleDeclaration as b, createQuestionToken as c, createArrayDeclaration as d, createUnionDeclaration as e, factory as f, createPropertySignature as g, createParameterSignature as h, createJSDoc as i, appendJSDocToNode as j, createIndexSignature as k, createTypeAliasDeclaration as l, modifiers as m, createNamespaceDeclaration as n, createImportDeclaration as o, createExportDeclaration as p, createEnumDeclaration as q, createOmitDeclaration as r, keywordTypeNodes as s, createTypeLiteralNode as t, createTypeReferenceNode as u, createNumericLiteral as v, createStringLiteral as w, createArrayTypeNode as x, createLiteralTypeNode as y, createNull as z };
169
+ export { createIdentifier as A, createTupleTypeNode as B, createTrue as C, createFalse as D, createIntersectionDeclaration as a, createTupleDeclaration as b, createQuestionToken as c, createArrayDeclaration as d, createUnionDeclaration as e, factory as f, createPropertySignature as g, createParameterSignature as h, createJSDoc as i, appendJSDocToNode as j, createIndexSignature as k, createTypeAliasDeclaration as l, modifiers as m, createNamespaceDeclaration as n, createImportDeclaration as o, createExportDeclaration as p, createEnumDeclaration as q, createOmitDeclaration as r, keywordTypeNodes as s, createTypeLiteralNode as t, createTypeReferenceNode as u, createNumericLiteral as v, createStringLiteral as w, createArrayTypeNode as x, createLiteralTypeNode as y, createNull as z };
package/dist/factory.cjs CHANGED
@@ -1,59 +1,124 @@
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 chunkDVADLCYY_cjs = require('./chunk-DVADLCYY.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "appendJSDocToNode", {
8
+ enumerable: true,
9
+ get: function () { return chunkDVADLCYY_cjs.appendJSDocToNode; }
10
+ });
11
+ Object.defineProperty(exports, "createArrayDeclaration", {
12
+ enumerable: true,
13
+ get: function () { return chunkDVADLCYY_cjs.createArrayDeclaration; }
14
+ });
15
+ Object.defineProperty(exports, "createArrayTypeNode", {
16
+ enumerable: true,
17
+ get: function () { return chunkDVADLCYY_cjs.createArrayTypeNode; }
18
+ });
19
+ Object.defineProperty(exports, "createEnumDeclaration", {
20
+ enumerable: true,
21
+ get: function () { return chunkDVADLCYY_cjs.createEnumDeclaration; }
22
+ });
23
+ Object.defineProperty(exports, "createExportDeclaration", {
24
+ enumerable: true,
25
+ get: function () { return chunkDVADLCYY_cjs.createExportDeclaration; }
26
+ });
27
+ Object.defineProperty(exports, "createFalse", {
28
+ enumerable: true,
29
+ get: function () { return chunkDVADLCYY_cjs.createFalse; }
30
+ });
31
+ Object.defineProperty(exports, "createIdentifier", {
32
+ enumerable: true,
33
+ get: function () { return chunkDVADLCYY_cjs.createIdentifier; }
34
+ });
35
+ Object.defineProperty(exports, "createImportDeclaration", {
36
+ enumerable: true,
37
+ get: function () { return chunkDVADLCYY_cjs.createImportDeclaration; }
38
+ });
39
+ Object.defineProperty(exports, "createIndexSignature", {
40
+ enumerable: true,
41
+ get: function () { return chunkDVADLCYY_cjs.createIndexSignature; }
42
+ });
43
+ Object.defineProperty(exports, "createIntersectionDeclaration", {
44
+ enumerable: true,
45
+ get: function () { return chunkDVADLCYY_cjs.createIntersectionDeclaration; }
46
+ });
47
+ Object.defineProperty(exports, "createJSDoc", {
48
+ enumerable: true,
49
+ get: function () { return chunkDVADLCYY_cjs.createJSDoc; }
50
+ });
51
+ Object.defineProperty(exports, "createLiteralTypeNode", {
52
+ enumerable: true,
53
+ get: function () { return chunkDVADLCYY_cjs.createLiteralTypeNode; }
54
+ });
55
+ Object.defineProperty(exports, "createNamespaceDeclaration", {
56
+ enumerable: true,
57
+ get: function () { return chunkDVADLCYY_cjs.createNamespaceDeclaration; }
58
+ });
59
+ Object.defineProperty(exports, "createNull", {
60
+ enumerable: true,
61
+ get: function () { return chunkDVADLCYY_cjs.createNull; }
62
+ });
63
+ Object.defineProperty(exports, "createNumericLiteral", {
64
+ enumerable: true,
65
+ get: function () { return chunkDVADLCYY_cjs.createNumericLiteral; }
66
+ });
67
+ Object.defineProperty(exports, "createOmitDeclaration", {
68
+ enumerable: true,
69
+ get: function () { return chunkDVADLCYY_cjs.createOmitDeclaration; }
70
+ });
71
+ Object.defineProperty(exports, "createParameterSignature", {
72
+ enumerable: true,
73
+ get: function () { return chunkDVADLCYY_cjs.createParameterSignature; }
74
+ });
75
+ Object.defineProperty(exports, "createPropertySignature", {
76
+ enumerable: true,
77
+ get: function () { return chunkDVADLCYY_cjs.createPropertySignature; }
78
+ });
79
+ Object.defineProperty(exports, "createQuestionToken", {
80
+ enumerable: true,
81
+ get: function () { return chunkDVADLCYY_cjs.createQuestionToken; }
82
+ });
83
+ Object.defineProperty(exports, "createStringLiteral", {
84
+ enumerable: true,
85
+ get: function () { return chunkDVADLCYY_cjs.createStringLiteral; }
86
+ });
87
+ Object.defineProperty(exports, "createTrue", {
88
+ enumerable: true,
89
+ get: function () { return chunkDVADLCYY_cjs.createTrue; }
90
+ });
91
+ Object.defineProperty(exports, "createTupleDeclaration", {
92
+ enumerable: true,
93
+ get: function () { return chunkDVADLCYY_cjs.createTupleDeclaration; }
94
+ });
95
+ Object.defineProperty(exports, "createTupleTypeNode", {
96
+ enumerable: true,
97
+ get: function () { return chunkDVADLCYY_cjs.createTupleTypeNode; }
98
+ });
99
+ Object.defineProperty(exports, "createTypeAliasDeclaration", {
100
+ enumerable: true,
101
+ get: function () { return chunkDVADLCYY_cjs.createTypeAliasDeclaration; }
102
+ });
103
+ Object.defineProperty(exports, "createTypeLiteralNode", {
104
+ enumerable: true,
105
+ get: function () { return chunkDVADLCYY_cjs.createTypeLiteralNode; }
106
+ });
107
+ Object.defineProperty(exports, "createTypeReferenceNode", {
108
+ enumerable: true,
109
+ get: function () { return chunkDVADLCYY_cjs.createTypeReferenceNode; }
110
+ });
111
+ Object.defineProperty(exports, "createUnionDeclaration", {
112
+ enumerable: true,
113
+ get: function () { return chunkDVADLCYY_cjs.createUnionDeclaration; }
114
+ });
115
+ Object.defineProperty(exports, "keywordTypeNodes", {
116
+ enumerable: true,
117
+ get: function () { return chunkDVADLCYY_cjs.keywordTypeNodes; }
118
+ });
119
+ Object.defineProperty(exports, "modifiers", {
120
+ enumerable: true,
121
+ get: function () { return chunkDVADLCYY_cjs.modifiers; }
122
+ });
123
+ //# sourceMappingURL=factory.cjs.map
59
124
  //# 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"}
@@ -1,2 +1,2 @@
1
1
  import 'typescript';
2
- export { j as appendJSDocToNode, d as createArrayDeclaration, x as createArrayTypeNode, q as createEnumDeclaration, p as createExportDeclaration, A as createIdentifier, o as createImportDeclaration, k as createIndexSignature, a as createIntersectionDeclaration, i as createJSDoc, y as createLiteralTypeNode, n as createNamespaceDeclaration, z as createNull, v as createNumericLiteral, r as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, w as createStringLiteral, b as createTupleDeclaration, B as createTupleTypeNode, l as createTypeAliasDeclaration, t as createTypeLiteralNode, u as createTypeReferenceNode, e as createUnionDeclaration, s as keywordTypeNodes, m as modifiers } from './factory-CFXA_d49.cjs';
2
+ export { j as appendJSDocToNode, d as createArrayDeclaration, x as createArrayTypeNode, q as createEnumDeclaration, p as createExportDeclaration, D as createFalse, A as createIdentifier, o as createImportDeclaration, k as createIndexSignature, a as createIntersectionDeclaration, i as createJSDoc, y as createLiteralTypeNode, n as createNamespaceDeclaration, z as createNull, v as createNumericLiteral, r as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, w as createStringLiteral, C as createTrue, b as createTupleDeclaration, B as createTupleTypeNode, l as createTypeAliasDeclaration, t as createTypeLiteralNode, u as createTypeReferenceNode, e as createUnionDeclaration, s as keywordTypeNodes, m as modifiers } from './factory-1NIBrzkm.cjs';
package/dist/factory.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import 'typescript';
2
- export { j as appendJSDocToNode, d as createArrayDeclaration, x as createArrayTypeNode, q as createEnumDeclaration, p as createExportDeclaration, A as createIdentifier, o as createImportDeclaration, k as createIndexSignature, a as createIntersectionDeclaration, i as createJSDoc, y as createLiteralTypeNode, n as createNamespaceDeclaration, z as createNull, v as createNumericLiteral, r as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, w as createStringLiteral, b as createTupleDeclaration, B as createTupleTypeNode, l as createTypeAliasDeclaration, t as createTypeLiteralNode, u as createTypeReferenceNode, e as createUnionDeclaration, s as keywordTypeNodes, m as modifiers } from './factory-CFXA_d49.js';
2
+ export { j as appendJSDocToNode, d as createArrayDeclaration, x as createArrayTypeNode, q as createEnumDeclaration, p as createExportDeclaration, D as createFalse, A as createIdentifier, o as createImportDeclaration, k as createIndexSignature, a as createIntersectionDeclaration, i as createJSDoc, y as createLiteralTypeNode, n as createNamespaceDeclaration, z as createNull, v as createNumericLiteral, r as createOmitDeclaration, h as createParameterSignature, g as createPropertySignature, c as createQuestionToken, w as createStringLiteral, C as createTrue, b as createTupleDeclaration, B as createTupleTypeNode, l as createTypeAliasDeclaration, t as createTypeLiteralNode, u as createTypeReferenceNode, e as createUnionDeclaration, s as keywordTypeNodes, m as modifiers } from './factory-1NIBrzkm.js';
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, createFalse, createIdentifier, createImportDeclaration, createIndexSignature, createIntersectionDeclaration, createJSDoc, createLiteralTypeNode, createNamespaceDeclaration, createNull, createNumericLiteral, createOmitDeclaration, createParameterSignature, createPropertySignature, createQuestionToken, createStringLiteral, createTrue, createTupleDeclaration, createTupleTypeNode, createTypeAliasDeclaration, createTypeLiteralNode, createTypeReferenceNode, createUnionDeclaration, keywordTypeNodes, modifiers } from './chunk-RWXGFVS2.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 chunkDVADLCYY_cjs = require('./chunk-DVADLCYY.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,21 @@ 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
 
35
+ // src/format.ts
36
+ function format(source) {
37
+ return print([], { source, noEmitHelpers: false });
38
+ }
32
39
 
33
-
34
- exports.factory = _chunkTNIGP6OUcjs.factory_exports; exports.print = print;
40
+ Object.defineProperty(exports, "factory", {
41
+ enumerable: true,
42
+ get: function () { return chunkDVADLCYY_cjs.factory_exports; }
43
+ });
44
+ exports.format = format;
45
+ exports.print = print;
46
+ //# sourceMappingURL=index.cjs.map
35
47
  //# 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","../src/format.ts"],"names":["ts"],"mappings":";;;;;;;;;AAIA,IAAM,EAAE,SAAY,GAAAA,mBAAA;AAYpB,IAAM,iBAAiB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,SAAS,mBAAmB,CAAA;AAOlF,IAAM,kBAAkB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,wBAAwB,IAAI,CAAA;AAK5E,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;AACxH,EAAM,MAAA,OAAA,GAAUA,oBAAG,aAAc,CAAA;AAAA,IAC/B,qBAAuB,EAAA,IAAA;AAAA,IACvB,OAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,IAAI,QAAwB,EAAC;AAE7B,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,EAAA;AAAA;AAGT,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,QAAQ,CAAG,EAAA;AAC3B,IAAQ,KAAA,GAAA,QAAA,CAAS,OAAO,OAAO,CAAA;AAAA,GAC1B,MAAA;AACL,IAAA,KAAA,GAAQ,CAAC,QAAQ,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA;AAGnC,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,SAAA,CAAUA,mBAAG,CAAA,UAAA,CAAW,WAAW,OAAQ,CAAA,eAAA,CAAgB,KAAK,CAAA,EAAG,UAAU,CAAA;AACxG,EAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,SAAA,CAAU,UAAU,CAAA;AAEjD,EAAO,OAAA,CAAC,UAAY,EAAA,eAAA,CAAgB,YAAY,CAAC,EAAE,MAAO,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAAA;AAC9E;;;ACnDO,SAAS,OAAO,MAAgB,EAAA;AAErC,EAAA,OAAO,MAAM,EAAC,EAAG,EAAE,MAAQ,EAAA,aAAA,EAAe,OAAO,CAAA;AACnD","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\n/**\n * Convert AST TypeScript nodes to a string based on the TypeScript printer.\n */\nexport function print(\n elements: Array<ts.Node>,\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","import { print } from './print.ts'\n\n/**\n * Format the generated code based on the TypeScript printer.\n */\nexport function format(source: string) {\n // do some basic linting with the ts compiler\n return print([], { source, noEmitHelpers: false })\n}\n"]}
package/dist/index.d.cts CHANGED
@@ -1,11 +1,18 @@
1
1
  import ts, { PrinterOptions } from 'typescript';
2
- export { default as ts } from 'typescript';
3
- export { f as factory } from './factory-CFXA_d49.cjs';
2
+ export { f as factory } from './factory-1NIBrzkm.cjs';
4
3
 
5
4
  type Options = {
6
5
  source?: string;
7
6
  baseName?: string;
8
7
  } & PrinterOptions;
9
- declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, { source, baseName, removeComments, noEmitHelpers, newLine }?: Options): string;
8
+ /**
9
+ * Convert AST TypeScript nodes to a string based on the TypeScript printer.
10
+ */
11
+ declare function print(elements: Array<ts.Node>, { source, baseName, removeComments, noEmitHelpers, newLine }?: Options): string;
10
12
 
11
- export { print };
13
+ /**
14
+ * Format the generated code based on the TypeScript printer.
15
+ */
16
+ declare function format(source: string): string;
17
+
18
+ export { format, print };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  import ts, { PrinterOptions } from 'typescript';
2
- export { default as ts } from 'typescript';
3
- export { f as factory } from './factory-CFXA_d49.js';
2
+ export { f as factory } from './factory-1NIBrzkm.js';
4
3
 
5
4
  type Options = {
6
5
  source?: string;
7
6
  baseName?: string;
8
7
  } & PrinterOptions;
9
- declare function print(elements: ts.Node | Array<ts.Node | undefined> | null, { source, baseName, removeComments, noEmitHelpers, newLine }?: Options): string;
8
+ /**
9
+ * Convert AST TypeScript nodes to a string based on the TypeScript printer.
10
+ */
11
+ declare function print(elements: Array<ts.Node>, { source, baseName, removeComments, noEmitHelpers, newLine }?: Options): string;
10
12
 
11
- export { print };
13
+ /**
14
+ * Format the generated code based on the TypeScript printer.
15
+ */
16
+ declare function format(source: string): string;
17
+
18
+ export { format, print };
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-RWXGFVS2.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,12 @@ 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
+ // src/format.ts
30
+ function format(source) {
31
+ return print([], { source, noEmitHelpers: false });
32
+ }
33
+
34
+ export { format, print };
35
+ //# sourceMappingURL=index.js.map
35
36
  //# 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;AAAA,EACF,CAAC;AAED,MAAI,QAAwB,CAAC;AAE7B,MAAI,CAAC,UAAU;AACb,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,YAAQ,SAAS,OAAO,OAAO;AAAA,EACjC,OAAO;AACL,YAAQ,CAAC,QAAQ,EAAE,OAAO,OAAO;AAAA,EACnC;AAEA,QAAM,aAAa,QAAQ,UAAU,GAAG,WAAW,WAAW,QAAQ,gBAAgB,KAAK,GAAG,UAAU;AACxG,QAAM,eAAe,QAAQ,UAAU,UAAU;AAEjD,SAAO,CAAC,YAAY,gBAAgB,YAAY,CAAC,EAAE,OAAO,OAAO,EAAE,KAAK,IAAI;AAC9E;","names":[]}
1
+ {"version":3,"sources":["../src/print.ts","../src/format.ts"],"names":[],"mappings":";;;AAIA,IAAM,EAAE,SAAY,GAAA,EAAA;AAYpB,IAAM,iBAAiB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,SAAS,mBAAmB,CAAA;AAOlF,IAAM,kBAAkB,CAAC,IAAA,KAAiB,IAAK,CAAA,OAAA,CAAQ,wBAAwB,IAAI,CAAA;AAK5E,SAAS,KACd,CAAA,QAAA,EACA,EAAE,MAAA,GAAS,IAAI,QAAW,GAAA,UAAA,EAAY,cAAgB,EAAA,aAAA,EAAe,UAAU,EAAG,CAAA,WAAA,CAAY,QAAS,EAAA,GAAa,EAC5G,EAAA;AACR,EAAA,MAAM,UAAa,GAAA,EAAA,CAAG,gBAAiB,CAAA,QAAA,EAAU,cAAe,CAAA,MAAM,CAAG,EAAA,EAAA,CAAG,YAAa,CAAA,MAAA,EAAQ,KAAO,EAAA,EAAA,CAAG,WAAW,EAAE,CAAA;AACxH,EAAM,MAAA,OAAA,GAAU,GAAG,aAAc,CAAA;AAAA,IAC/B,qBAAuB,EAAA,IAAA;AAAA,IACvB,OAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,IAAI,QAAwB,EAAC;AAE7B,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAO,OAAA,EAAA;AAAA;AAGT,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,QAAQ,CAAG,EAAA;AAC3B,IAAQ,KAAA,GAAA,QAAA,CAAS,OAAO,OAAO,CAAA;AAAA,GAC1B,MAAA;AACL,IAAA,KAAA,GAAQ,CAAC,QAAQ,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA;AAGnC,EAAM,MAAA,UAAA,GAAa,OAAQ,CAAA,SAAA,CAAU,EAAG,CAAA,UAAA,CAAW,WAAW,OAAQ,CAAA,eAAA,CAAgB,KAAK,CAAA,EAAG,UAAU,CAAA;AACxG,EAAM,MAAA,YAAA,GAAe,OAAQ,CAAA,SAAA,CAAU,UAAU,CAAA;AAEjD,EAAO,OAAA,CAAC,UAAY,EAAA,eAAA,CAAgB,YAAY,CAAC,EAAE,MAAO,CAAA,OAAO,CAAE,CAAA,IAAA,CAAK,IAAI,CAAA;AAC9E;;;ACnDO,SAAS,OAAO,MAAgB,EAAA;AAErC,EAAA,OAAO,MAAM,EAAC,EAAG,EAAE,MAAQ,EAAA,aAAA,EAAe,OAAO,CAAA;AACnD","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\n/**\n * Convert AST TypeScript nodes to a string based on the TypeScript printer.\n */\nexport function print(\n elements: Array<ts.Node>,\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","import { print } from './print.ts'\n\n/**\n * Format the generated code based on the TypeScript printer.\n */\nexport function format(source: string) {\n // do some basic linting with the ts compiler\n return print([], { source, noEmitHelpers: false })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/parser-ts",
3
- "version": "3.0.0-alpha.9",
3
+ "version": "3.0.0-beta.10",
4
4
  "description": "TypeScript parser",
5
5
  "keywords": [
6
6
  "typescript",
@@ -48,16 +48,13 @@
48
48
  "!/**/__tests__/**"
49
49
  ],
50
50
  "dependencies": {
51
- "remeda": "^2.11.0",
52
- "ts-morph": "^23.0.0",
53
- "typescript": "^5.5.4"
51
+ "remeda": "^2.16.0",
52
+ "typescript": "^5.6.3"
54
53
  },
55
54
  "devDependencies": {
56
- "prettier": "^3.3.3",
57
- "tsup": "^8.2.4",
58
- "@kubb/config-biome": "3.0.0-alpha.9",
59
- "@kubb/config-ts": "3.0.0-alpha.9",
60
- "@kubb/config-tsup": "3.0.0-alpha.9"
55
+ "tsup": "^8.3.5",
56
+ "@kubb/config-ts": "3.0.0-beta.10",
57
+ "@kubb/config-tsup": "3.0.0-beta.10"
61
58
  },
62
59
  "engines": {
63
60
  "node": ">=20"
package/src/factory.ts CHANGED
@@ -118,13 +118,13 @@ export function createUnionDeclaration({
118
118
  }: {
119
119
  nodes: Array<ts.TypeNode>
120
120
  withParentheses?: boolean
121
- }): ts.TypeNode | null {
121
+ }): ts.TypeNode {
122
122
  if (!nodes.length) {
123
- return null
123
+ return keywordTypeNodes.any
124
124
  }
125
125
 
126
126
  if (nodes.length === 1) {
127
- return nodes[0] || null
127
+ return nodes[0] as ts.TypeNode
128
128
  }
129
129
 
130
130
  const node = factory.createUnionTypeNode(nodes)
@@ -211,7 +211,7 @@ export function appendJSDocToNode<TNode extends ts.Node>({
211
211
  }
212
212
 
213
213
  const text = filteredComments.reduce((acc = '', comment = '') => {
214
- return `${acc}\n * ${comment}`
214
+ return `${acc}\n * ${comment.replaceAll('*/', '*\\/')}`
215
215
  }, '*')
216
216
 
217
217
  // node: {...node}, with that ts.addSyntheticLeadingComment is appending
@@ -553,3 +553,5 @@ export const createNull = factory.createNull
553
553
  export const createIdentifier = factory.createIdentifier
554
554
 
555
555
  export const createTupleTypeNode = factory.createTupleTypeNode
556
+ export const createTrue = factory.createTrue
557
+ export const createFalse = factory.createFalse
package/src/format.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { print } from './print.ts'
2
+
3
+ /**
4
+ * Format the generated code based on the TypeScript printer.
5
+ */
6
+ export function format(source: string) {
7
+ // do some basic linting with the ts compiler
8
+ return print([], { source, noEmitHelpers: false })
9
+ }
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { print } from './print.ts'
2
- export type { default as ts } from 'typescript'
2
+ export { format } from './format.ts'
3
3
  export * as factory from './factory.ts'
package/src/print.ts CHANGED
@@ -23,8 +23,11 @@ const escapeNewLines = (code: string) => code.replace(/\n\n/g, '\n/* :newline: *
23
23
  */
24
24
  const restoreNewLines = (code: string) => code.replace(/\/\* :newline: \*\//g, '\n')
25
25
 
26
+ /**
27
+ * Convert AST TypeScript nodes to a string based on the TypeScript printer.
28
+ */
26
29
  export function print(
27
- elements: ts.Node | Array<ts.Node | undefined> | null,
30
+ elements: Array<ts.Node>,
28
31
  { source = '', baseName = 'print.ts', removeComments, noEmitHelpers, newLine = ts.NewLineKind.LineFeed }: Options = {},
29
32
  ): string {
30
33
  const sourceFile = ts.createSourceFile(baseName, escapeNewLines(source), ts.ScriptTarget.ES2022, false, ts.ScriptKind.TS)