Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@ampproject/rollup-plugin-closure-compiler
Advanced tools
Leverage Closure Compiler to minify and optimize JavaScript with Rollup.
Generally Closure Compiler will produce superior minification than other projects, but historically has been more difficult to use. The goal of this plugin is to reduce this friction.
npm install @ampproject/rollup-plugin-closure-compiler --save-dev
Invoke Closure Compiler from your Rollup configuration.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
},
plugins: [
compiler(),
],
}
If you would like to provide additional flags and options to Closure Compiler, pass them via key-value pairs.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
},
plugins: [
compiler({
formatting: 'PRETTY_PRINT'
}),
],
}
This plugin supports code splitting with Rollup's experimentalCodeSplitting
feature. Enable code splitting in your Rollup configuration and each output bundle will be minified by Closure Compiler.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
dir: 'public/module',
format: 'es',
},
experimentalCodeSplitting: true,
plugins: [
compiler(),
],
}
This plugin will modify the enable the assume_function_wrapper
output option for Closure Compiler when es
format is specifed to Rollup. Note: This is overrideable via passed flags and options.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'es',
},
plugins: [
compiler(),
],
}
If your Rollup configuration outputs an IIFE format bundle with a specified name, this plugin will add an extern to ensure the name does not get mangled. Note: This is overrideable via passed flags and options.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'iife',
name: 'MyAwesomeThing'
},
plugins: [
compiler(),
],
}
If your source uses reserved words for identifiers or declarations, you can supply the list of words you would like to ensure are mangled before compilation, and renewed if they are used in an import or export statement.
// rollup.config.js
import compiler from '@ampproject/rollup-plugin-closure-compiler';
export default {
input: 'main.js',
output: {
file: 'bundle.js',
format: 'es',
},
plugins: [
compiler({}, {
mangleReservedWords: ['Plugin', 'Storage'],
}),
],
}
The AMP Project accepts responsible security disclosures through the Google Application Security program.
The AMP Project strives for a positive and growing project community that provides a safe environment for everyone. All members, committers and volunteers in the community are required to act according to the code of conduct.
rollup-plugin-closure-compiler is licensed under the Apache License, Version 2.0.
FAQs
Rollup + Google Closure Compiler
We found that @ampproject/rollup-plugin-closure-compiler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 16 open source maintainers 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.