A utility library for decorating Vite plugins by enhancing their hook functions without modifying the original plugin code. Version 0.1.0 supports Vite >= v3. Ships TypeScript types. Key differentiator: provides a non-invasive way to wrap Vite plugin hooks (e.g., transform, resolveId) with custom logic, useful for logging, caching, or modifying behavior. Lightweight with minimal bundle size. Community-maintained with MIT license.
npm install decorate-vite-pluginVerified import paths — ran on the pinned version, not inferred.
Decorates the transform hook of @vitejs/plugin-vue with logging.
Always call original hook with plugin context: `originalHook.call(plugin, ...args)`.
Do not rely on reference equality of plugins after decoration.
Ensure Vite version is 3 or higher.
Use named imports: `import { decoratePlugin } from 'decorate-vite-plugin'`.Check plugin's available hooks; only existing hooks can be decorated.
Pass a function as the decorator: `(original, plugin) => { ... }`.Ensure the hook exists on the plugin; if optional, check for undefined before calling.
No dependency data recorded yet.