rollup-plugin-svelte-types
v1.0.6
Published
A rollup plugin for generating typescript definitions at build time
Downloads
26
Maintainers
Readme
rollup-plugin-svelte-types
🍣 A Rollup plugin which generates type definitions for Svelte Components, including Props and Events.
Requirements
This plugin requires an LTS Node version (v8.0.0+) and Rollup v1.20.0+.
Install
Using npm:
npm install rollup-plugin-svelte-types --save-dev
Usage
Create a rollup.config.js
configuration file and import the plugin:
import svelteDts from 'rollup-plugin-svelte-types';
export default {
input: 'src/entry.js',
// ...
plugins: [
svelteDts()
]
};
Then call rollup
either via the CLI or the API.
Options
It's possible to use configure a few settings:
import svelteDts from 'rollup-plugin-svelte-types';
export default {
input: 'src/entry.js',
// ...
plugins: [
svelteDts({
libRoot: './src', // The root directory to generate the type definitions for. Defaults to './'
declarationDir: './dist/types' // The directory to place the generated definitions in. Defaults to './types'
})
]
};