UNPKG

vite-plugin-v8-bytecode

Version:

A Vite plugin for compiling JavaScript to V8 bytecode for Node.js and Electron applications

43 lines (40 loc) 1.09 kB
import { Plugin } from 'vite'; export { Plugin } from 'vite'; interface BytecodeOptions { /** * Specify which chunks to compile to bytecode. * If not specified or empty array, all chunks will be compiled. */ chunkAlias?: string | string[]; /** * Whether to remove the original .js files after compilation. * @default true */ removeBundleJS?: boolean; /** * Array of strings to protect by obfuscating them with String.fromCharCode. * Useful for sensitive strings like API keys. * @default [] */ protectedStrings?: string[]; } /** * Vite plugin to compile JavaScript to V8 bytecode for Node.js and Electron * * @example * ```ts * import { bytecodePlugin } from 'vite-plugin-v8-bytecode' * * export default { * plugins: [ * bytecodePlugin({ * chunkAlias: ['index'], * protectedStrings: ['MY_API_KEY'], * removeBundleJS: true * }) * ] * } * ``` */ declare function bytecodePlugin(options?: BytecodeOptions): Plugin | null; export { type BytecodeOptions, bytecodePlugin };