Skip to content

Commit 535ff08

Browse files
committed
docs: config
1 parent 8f007d7 commit 535ff08

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,41 @@ export const app = treaty<App>('https://<remote-url>')
5252

5353
## Configuration
5454

55-
To be documented
55+
The `dts` plugin accepts the following configuration options:
56+
57+
```ts
58+
dts(entryPoint, options)
59+
```
60+
61+
| Option | Type | Default | Description |
62+
|--------|------|---------|-------------|
63+
| `cwd` | `string` | Current directory | The directory where the plugin will look for the `tsconfig.json` file. |
64+
| `dtsInput` | `boolean` | `false` | When entries are `.d.ts` files (instead of `.ts` files), this option should be set to `true`. If enabled, the plugin will skip generating a `.d.ts` file for the entry point. |
65+
| `emitDtsOnly` | `boolean` | `false` | When `true`, the plugin will only emit `.d.ts` files and remove all other chunks. Useful when generating `d.ts` files for CommonJS format as part of a separate build process. |
66+
| `tsconfig` | `string \| boolean` | `"tsconfig.json"` | The path to the `tsconfig.json` file. When set to `false`, any `tsconfig.json` file will be ignored. |
67+
| `compilerOptions` | `object` | `{}` | The `compilerOptions` for the TypeScript compiler. See [TypeScript compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html). |
68+
| `isolatedDeclarations` | `boolean \| object` | `false` | When `true`, the plugin will generate `.d.ts` files using `oxc-transform`, which is much faster than the TypeScript compiler. This option is enabled automatically when `isolatedDeclarations` in `compilerOptions` is set to `true`. |
69+
| `sourcemap` | `boolean` | `false` | When `true`, the plugin will generate declaration maps (`.d.ts.map` files) for `.d.ts` files. |
70+
| `resolve` | `boolean \| (string \| RegExp)[]` | `false` | Resolve external types used in `.d.ts` files from `node_modules`. Can be a boolean or an array of strings/RegExp patterns. |
71+
| `resolvePaths` | `boolean` | `false` | When `true`, the plugin will resolve `paths` in `tsconfig.json`. This option is enabled automatically when `paths` is set in `compilerOptions`. |
72+
73+
### Example with Options
74+
75+
```ts
76+
import { Elysia } from 'elysia'
77+
import { dts } from 'elysia-remote-dts'
78+
79+
const app = new Elysia().use(
80+
dts('./src/index.ts', {
81+
tsconfig: './tsconfig.json',
82+
compilerOptions: {
83+
strict: true
84+
}
85+
})
86+
).listen(3000)
87+
88+
export type App = typeof app;
89+
```
5690

5791
## Known Limitations
5892

0 commit comments

Comments
 (0)