
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@macropygia/vite-plugin-imagemin-cache
Advanced tools
Vite plugin to compress bundle and public images using imagemin. With persistent cache.
English | 日本語
Vite plugin to compress static assets and public images using imagemin. With persistent cache.
"type": "module"
is required in the package.json of the project using this plugin.$ npm install @macropygia/vite-plugin-imagemin-cache
import { defineConfig } from 'vite'
import imageminPlugin from '@macropygia/vite-plugin-imagemin-cache'
export default defineConfig({
plugins: [
imageminPlugin({
cacheDir: '.cache',
concurrency: 4,
plugins: {
pngquant: { quality: [0.65, 1] },
mozjpeg: { quality: 85 },
}
}),
],
})
Parameter | Type | Default | Required |
---|---|---|---|
cacheDir | string | node_modules/.imagemin | No |
expireDuration | number | 864000 (10 Days) | No |
countToExpire | number | 10 | No |
concurrency | number | os.cpus().length | No |
exclude | string | string[] | No | |
plugins | object | {} | No |
asset.cachbuster | boolean | string | false | No |
asset.useCrc | boolean | (Auto) | No |
asset.preventOverwrite | boolean | false | No |
public.preventDefault | boolean | false | No |
Set the cache directory.
Cache files will delete when the following conditions are satisfied.
countToExpire
times of the build.expireDuration
seconds have passed since last used.The maximum concurrency of compressing.
Glob patterns to exclude from compression.
Imagemin plugin settings.
.png
).png
).jpg
and .jpeg
).svg
)false
, it will be disabled.plugins: {
pngquant: { speed: 1, quality: [0.6, 1.0] },
optipng: false, // Turn off
mozjpeg: { quality: 85 },
svgo: { plugins: [ ... ] },
},
Add hash as a query string to attributes that references an image in HTML.
true
, join with ?
.
/foo/bar.png
-> /foo/bar.png?<hash>
/foo/baz.svg?q=123#id
-> /foo/baz.svg?<hash>&q=123#id
string
, join with the string.
/foo/bar.png
-> /foo/bar.png<string><hash>
/foo/baz.svg?q=123#id
-> /foo/baz.svg<string><hash>&q=123#id
If set true
, the plugin process static assets in the same way as the public directory.
rollupOptions.output.assetFileNames
.
true
if [hash]
is not included in assetFileNames
.If the file with the same name exists in the output directory, skip copying from the cache.
[hash]
.emptyOutDir
is true
.Stop Vite's default copy process for the public directory and copy compressed images and the others separately.
FAQs
Vite plugin to compress bundle and public images using imagemin. With persistent cache.
The npm package @macropygia/vite-plugin-imagemin-cache receives a total of 2 weekly downloads. As such, @macropygia/vite-plugin-imagemin-cache popularity was classified as not popular.
We found that @macropygia/vite-plugin-imagemin-cache 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.