@kubb/parser-ts 5.0.0-beta.52 → 5.0.0-beta.54
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/package.json +4 -5
- package/extension.yaml +0 -101
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/parser-ts",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.54",
|
|
4
4
|
"description": "TypeScript and TSX source file parser for Kubb. Converts AST nodes and raw TypeScript code into formatted source strings using the TypeScript compiler API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"src",
|
|
21
21
|
"dist",
|
|
22
|
-
"extension.yaml",
|
|
23
22
|
"!/**/**.test.**",
|
|
24
23
|
"!/**/__tests__/**",
|
|
25
24
|
"!/**/__snapshots__/**"
|
|
@@ -42,11 +41,11 @@
|
|
|
42
41
|
},
|
|
43
42
|
"dependencies": {
|
|
44
43
|
"typescript": "^6.0.3",
|
|
45
|
-
"@kubb/core": "5.0.0-beta.
|
|
44
|
+
"@kubb/core": "5.0.0-beta.54"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
47
|
+
"@kubb/ast": "5.0.0-beta.54",
|
|
48
|
+
"@internals/utils": "0.0.0"
|
|
50
49
|
},
|
|
51
50
|
"engines": {
|
|
52
51
|
"node": ">=22"
|
package/extension.yaml
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
$schema: https://kubb.dev/schemas/extension.json
|
|
2
|
-
kind: parser
|
|
3
|
-
id: parser-ts
|
|
4
|
-
name: TypeScript
|
|
5
|
-
description: Default file parser for Kubb. Converts the universal AST to `.ts`/`.tsx` source using the official TypeScript compiler.
|
|
6
|
-
category: typescript
|
|
7
|
-
type: official
|
|
8
|
-
npmPackage: '@kubb/parser-ts'
|
|
9
|
-
docsPath: /parsers/parser-ts
|
|
10
|
-
repo: https://github.com/kubb-labs/kubb
|
|
11
|
-
maintainers:
|
|
12
|
-
- name: Stijn Van Hulle
|
|
13
|
-
github: stijnvanhulle
|
|
14
|
-
compatibility:
|
|
15
|
-
kubb: '>=5.0.0'
|
|
16
|
-
node: '>=22'
|
|
17
|
-
tags:
|
|
18
|
-
- typescript
|
|
19
|
-
- tsx
|
|
20
|
-
- parser
|
|
21
|
-
- printer
|
|
22
|
-
- ast
|
|
23
|
-
resources:
|
|
24
|
-
documentation: https://kubb.dev/parsers/parser-ts
|
|
25
|
-
repository: https://github.com/kubb-labs/kubb
|
|
26
|
-
issues: https://github.com/kubb-labs/kubb/issues
|
|
27
|
-
changelog: https://github.com/kubb-labs/kubb/blob/main/packages/parser-ts/CHANGELOG.md
|
|
28
|
-
featured: true
|
|
29
|
-
icon:
|
|
30
|
-
light: https://kubb.dev/feature/typescript.svg
|
|
31
|
-
intro: |-
|
|
32
|
-
`@kubb/parser-ts` takes the `FileNode` staged by your plugins and prints it as TypeScript source using the official [TypeScript compiler](https://www.typescriptlang.org/). It resolves import paths, deduplicates declarations, prints JSDoc, and rewrites extensions based on `output.extension`.
|
|
33
|
-
|
|
34
|
-
Two parsers are exported:
|
|
35
|
-
|
|
36
|
-
- `parserTs` — handles `.ts` and `.js` files.
|
|
37
|
-
- `parserTsx` — handles `.tsx` and `.jsx` files. Use this for React projects so JSX in generated components is preserved.
|
|
38
|
-
options:
|
|
39
|
-
- name: extname
|
|
40
|
-
type: "'.ts' | '.js' | '.tsx' | '.jsx' | string"
|
|
41
|
-
required: false
|
|
42
|
-
default: "'.ts'"
|
|
43
|
-
description: |-
|
|
44
|
-
Controls which extension is written into the generated import specifiers. Set `.js` for ESM-compatible output, `.tsx` for React projects. Leave unset for the TypeScript default.
|
|
45
|
-
|
|
46
|
-
To rewrite extensions in the generated source (e.g. `./foo` → `./foo.js`), use `output.extension` in `defineConfig`, not this option.
|
|
47
|
-
codeBlock:
|
|
48
|
-
lang: typescript
|
|
49
|
-
title: kubb.config.ts
|
|
50
|
-
twoslash: false
|
|
51
|
-
code: |-
|
|
52
|
-
import { defineConfig } from 'kubb'
|
|
53
|
-
import { adapterOas } from '@kubb/adapter-oas'
|
|
54
|
-
import { parserTs } from '@kubb/parser-ts'
|
|
55
|
-
|
|
56
|
-
export default defineConfig({
|
|
57
|
-
input: { path: './petStore.yaml' },
|
|
58
|
-
output: { path: './src/gen', extension: { '.ts': '.js' } },
|
|
59
|
-
adapter: adapterOas(),
|
|
60
|
-
parsers: [parserTs],
|
|
61
|
-
plugins: [],
|
|
62
|
-
})
|
|
63
|
-
examples:
|
|
64
|
-
- name: TypeScript (default)
|
|
65
|
-
files:
|
|
66
|
-
- name: kubb.config.ts
|
|
67
|
-
lang: typescript
|
|
68
|
-
twoslash: false
|
|
69
|
-
code: |-
|
|
70
|
-
import { defineConfig } from 'kubb'
|
|
71
|
-
import { adapterOas } from '@kubb/adapter-oas'
|
|
72
|
-
import { parserTs } from '@kubb/parser-ts'
|
|
73
|
-
|
|
74
|
-
export default defineConfig({
|
|
75
|
-
input: { path: './petStore.yaml' },
|
|
76
|
-
output: { path: './src/gen' },
|
|
77
|
-
adapter: adapterOas(),
|
|
78
|
-
parsers: [parserTs],
|
|
79
|
-
plugins: [],
|
|
80
|
-
})
|
|
81
|
-
- name: TSX (React)
|
|
82
|
-
files:
|
|
83
|
-
- name: kubb.config.ts
|
|
84
|
-
lang: typescript
|
|
85
|
-
twoslash: false
|
|
86
|
-
code: |-
|
|
87
|
-
import { defineConfig } from 'kubb'
|
|
88
|
-
import { adapterOas } from '@kubb/adapter-oas'
|
|
89
|
-
import { parserTsx } from '@kubb/parser-ts'
|
|
90
|
-
|
|
91
|
-
export default defineConfig({
|
|
92
|
-
input: { path: './petStore.yaml' },
|
|
93
|
-
output: { path: './src/gen' },
|
|
94
|
-
adapter: adapterOas(),
|
|
95
|
-
parsers: [parserTsx],
|
|
96
|
-
plugins: [],
|
|
97
|
-
})
|
|
98
|
-
notes:
|
|
99
|
-
- type: tip
|
|
100
|
-
body: |-
|
|
101
|
-
`@kubb/parser-ts` is bundled with Kubb and used automatically when no `parsers` option is set. Install it explicitly only when combining it with other parsers or providing a fully custom parser list.
|