@kubb/parser-ts
Advanced tools
+5
-7
@@ -32,10 +32,8 @@ $schema: https://kubb.dev/schemas/extension.json | ||
| intro: |- | ||
| `@kubb/parser-ts` is the default file parser used by Kubb when no `parsers` option is provided in `defineConfig`. It takes the universal AST produced by your adapter and prints `.ts`/`.tsx` source code using the official [TypeScript compiler](https://www.typescriptlang.org/). | ||
| `@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`. | ||
| Two parser instances are exported: | ||
| Two parsers are exported: | ||
| - `parserTs` — handles `.ts` and `.js` files. | ||
| - `parserTsx` — handles `.tsx` and `.jsx` files. Use this for React projects so JSX in generated components is preserved. | ||
| Configure once on `defineConfig`. The choice applies to every file every plugin produces. | ||
| options: | ||
@@ -47,5 +45,5 @@ - name: extname | ||
| description: |- | ||
| File extension the parser writes when emitting code. Pick `.js` for an ESM-friendly emit you can publish to npm, `.tsx` for React projects, or leave unset for the standard TypeScript default. | ||
| 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. | ||
| For rewriting relative import specifiers (`./foo` → `./foo.js`), set `output.extension` on `defineConfig` — not on the parser itself. | ||
| To rewrite extensions in the generated source (e.g. `./foo` → `./foo.js`), use `output.extension` in `defineConfig`, not this option. | ||
| codeBlock: | ||
@@ -105,2 +103,2 @@ lang: typescript | ||
| body: |- | ||
| `parser-ts` is bundled with Kubb and used automatically when no `parsers` option is set. Install it explicitly only when you need to combine it with other parsers or provide a fully custom parser list. | ||
| `@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. |
+3
-3
| { | ||
| "name": "@kubb/parser-ts", | ||
| "version": "5.0.0-beta.26", | ||
| "version": "5.0.0-beta.27", | ||
| "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.", | ||
@@ -45,7 +45,7 @@ "keywords": [ | ||
| "typescript": "^6.0.3", | ||
| "@kubb/core": "5.0.0-beta.26" | ||
| "@kubb/core": "5.0.0-beta.27" | ||
| }, | ||
| "devDependencies": { | ||
| "@internals/utils": "0.0.0", | ||
| "@kubb/ast": "5.0.0-beta.26" | ||
| "@kubb/ast": "5.0.0-beta.27" | ||
| }, | ||
@@ -52,0 +52,0 @@ "engines": { |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
120965
-0.09%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated