A reflector for TypeScript files. It's can extract class declarations
、interface declarations
and function declarations
from .ts(x)
files (currently only support .ts(x)
files, .vue
files will be supported in the future, welcome to contribute).
Base on unplugin, it can be used in Vite, Rollup, Webpack, Nuxt, Vue CLI, and more.
Currently it's not stable, welcome to contribute.
npm i unplugin-naily-reflector
Vite
// vite.config.ts
import Reflector from 'unplugin-naily-reflector/vite'
export default defineConfig({
plugins: [
Reflector({ /* options */ }),
],
})
Example: playground/
Rollup
// rollup.config.js
import Reflector from 'unplugin-naily-reflector/rollup'
export default {
plugins: [
Reflector({ /* options */ }),
],
}
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-naily-reflector/webpack')({ /* options */ })
]
}
Nuxt
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-naily-reflector/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
Vue CLI
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-naily-reflector/webpack')({ /* options */ }),
],
},
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
import Reflector from 'unplugin-naily-reflector/esbuild'
build({
plugins: [Reflector()],
})