
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
decorate-vite-plugin
Advanced tools
A utility library for decorating Vite plugins by enhancing their hook functions.
npm install decorate-vite-plugin --save-dev
This library allows you to decorate Vite plugins by adding additional functionality to their hook functions without modifying the original plugin code.
Support vite >= v3
.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { decorateVitePluginOption } from 'decorate-vite-plugin'
export default defineConfig({
plugins: [
decorateVitePluginOption(
vue(),
'transform',
(originalTransform, plugin) => {
return function (code, id) {
console.log(`Transforming ${id}`)
return originalTransform?.call(plugin, code, id)
}
},
),
],
})
decoratePlugin
Decorates a specific hook of a single Vite plugin.
function decoratePlugin<T extends keyof Plugin>(
plugin: Plugin,
hookName: T,
decorator: (original: Plugin[T], plugin: Plugin) => Plugin[T],
): Plugin
decorateVitePluginOption
Decorates a hook across any valid Vite plugin option (single plugin, array of plugins, function, promise, etc.).
function decorateVitePluginOption<T extends keyof Plugin>(
pluginOption: PluginOption,
hookName: T,
decorator: (original: Plugin[T], plugin: Plugin) => Plugin[T],
): PluginOption
FAQs
Decorate Vite plugin
The npm package decorate-vite-plugin receives a total of 2,864 weekly downloads. As such, decorate-vite-plugin popularity was classified as popular.
We found that decorate-vite-plugin demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.