Skip to content

(🚧Still collecting proposals)Simple reflection library based on TypeScript written using unplugin, so you can use it in vite, rspack, nuxt, webpack, etc.

Notifications You must be signed in to change notification settings

nailyjs/unplugin-reflector

Repository files navigation

unplugin-naily-reflector

unplugin-naily-reflector

Simple reflector for TypeScript files.

NPM version Commit Activity Last Commit

English | 简体中文

A reflector for TypeScript files. It's can extract class declarationsinterface 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.

Install

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()],
})


About

(🚧Still collecting proposals)Simple reflection library based on TypeScript written using unplugin, so you can use it in vite, rspack, nuxt, webpack, etc.

Resources

Stars

Watchers

Forks

Packages

No packages published