{"library":"oxc-minify","title":"Oxc Minify","description":"Oxc Minify is a JavaScript minifier built in Rust, providing a Node.js API for synchronous and asynchronous code minification. Currently at version 0.126.0, it is under active and rapid development, with frequent releases often introducing breaking changes as the project matures. It is designed for high performance, already outperforming `esbuild` in some benchmarks, and aims to eventually include advanced minification techniques like constant inlining and dead code removal. A key differentiator is its Rust-based architecture, offering potential speed advantages over JavaScript-based minifiers like Terser or UglifyJS. However, it is explicitly alpha software, making assumptions about semantically correct input and using a fast parsing mode that skips some semantic error checks to maximize performance.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install oxc-minify"],"cli":{"name":"oxc-minify","version":null}},"imports":["import { minifySync } from 'oxc-minify';","import { minify } from 'oxc-minify';","import type { MinifyOptions } from 'oxc-minify';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { minifySync } from \"oxc-minify\";\n\nconst filename = \"test.js\";\nconst code = \"const x = 'a' + 'b'; console.log(x); function sum(a, b) { return a + b; } console.log(sum(1,2));\";\nconst options = {\n  compress: {\n    target: \"esnext\",\n    // Example of a common compression option\n    inline: 2 // Inline small functions where possible\n  },\n  mangle: {\n    toplevel: false,\n    // Example of a common mangling option\n    properties: false // Do not mangle properties for now\n  },\n  codegen: {\n    removeWhitespace: true,\n    // Example of a common code generation option\n    quote: 'single' // Use single quotes for strings\n  },\n  sourcemap: true,\n};\n\n// Synchronous minification\nconst resultSync = minifySync(filename, code, options);\nconsole.log('Synchronous result:');\nconsole.log(resultSync.code);\n// console.log(resultSync.map); // Source map can be logged if needed\n\n// Asynchronous minification (uncomment to use)\n// (async () => {\n//   const resultAsync = await minify(filename, code, options);\n//   console.log('\\nAsynchronous result:');\n//   console.log(resultAsync.code);\n//   // console.log(resultAsync.map);\n// })();","lang":"typescript","description":"This example demonstrates both synchronous and asynchronous minification of a JavaScript code string, showcasing common options for compression, mangling, and code generation, along with sourcemap generation.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}