Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@rsbuild/plugin-image-compress

Package Overview
Dependencies
Maintainers
2
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rsbuild/plugin-image-compress - npm Package Compare versions

Comparing version
1.3.1
to
1.3.2
+9
-10
dist/index.cjs

@@ -36,6 +36,6 @@ "use strict";

__webpack_require__.d(__webpack_exports__, {
pluginImageCompress: ()=>pluginImageCompress,
DEFAULT_OPTIONS: ()=>DEFAULT_OPTIONS,
ImageMinimizerPlugin: ()=>ImageMinimizerPlugin,
PLUGIN_IMAGE_COMPRESS_NAME: ()=>PLUGIN_IMAGE_COMPRESS_NAME,
DEFAULT_OPTIONS: ()=>DEFAULT_OPTIONS,
ImageMinimizerPlugin: ()=>ImageMinimizerPlugin
pluginImageCompress: ()=>pluginImageCompress
});

@@ -105,3 +105,3 @@ const external_node_assert_namespaceObject = require("node:assert");

};
const codecs_codecs = {
const codecs = {
jpeg: jpegCodec,

@@ -115,3 +115,3 @@ png: pngCodec,

};
const codecs = codecs_codecs;
const src_codecs = codecs;
function _define_property(obj, key, value) {

@@ -140,3 +140,3 @@ if (key in obj) Object.defineProperty(obj, key, {

};
const codec = codecs[this.options.use];
const codec = src_codecs[this.options.use];
if (!codec) compilation.errors.push(buildError(new Error(`Codec ${this.options.use} is not supported`)));

@@ -148,6 +148,5 @@ const opts = {

const handleAsset = async (name)=>{
var _compilation_getAsset;
const info = null == (_compilation_getAsset = compilation.getAsset(name)) ? void 0 : _compilation_getAsset.info;
const info = compilation.getAsset(name)?.info;
const fileName = name.split('?')[0];
if ((null == info ? void 0 : info.minimized) || !matchObject(opts, fileName)) return;
if (info?.minimized || !matchObject(opts, fileName)) return;
const asset = compilation.getAsset(name);

@@ -201,3 +200,3 @@ if (!asset) return;

} : opt;
const { defaultOptions } = codecs[options.use];
const { defaultOptions } = src_codecs[options.use];
const ret = {

@@ -204,0 +203,0 @@ ...defaultOptions,

@@ -62,3 +62,3 @@ import node_assert from "node:assert";

};
const codecs_codecs = {
const codecs = {
jpeg: jpegCodec,

@@ -72,3 +72,3 @@ png: pngCodec,

};
const codecs = codecs_codecs;
const src_codecs = codecs;
function _define_property(obj, key, value) {

@@ -97,3 +97,3 @@ if (key in obj) Object.defineProperty(obj, key, {

};
const codec = codecs[this.options.use];
const codec = src_codecs[this.options.use];
if (!codec) compilation.errors.push(buildError(new Error(`Codec ${this.options.use} is not supported`)));

@@ -105,6 +105,5 @@ const opts = {

const handleAsset = async (name)=>{
var _compilation_getAsset;
const info = null == (_compilation_getAsset = compilation.getAsset(name)) ? void 0 : _compilation_getAsset.info;
const info = compilation.getAsset(name)?.info;
const fileName = name.split('?')[0];
if ((null == info ? void 0 : info.minimized) || !matchObject(opts, fileName)) return;
if (info?.minimized || !matchObject(opts, fileName)) return;
const asset = compilation.getAsset(name);

@@ -158,3 +157,3 @@ if (!asset) return;

} : opt;
const { defaultOptions } = codecs[options.use];
const { defaultOptions } = src_codecs[options.use];
const ret = {

@@ -161,0 +160,0 @@ ...defaultOptions,

{
"name": "@rsbuild/plugin-image-compress",
"version": "1.3.1",
"repository": "https://github.com/rspack-contrib/rsbuild-plugin-image-compress",
"version": "1.3.2",
"repository": "https://github.com/rstackjs/rsbuild-plugin-image-compress",
"license": "MIT",

@@ -36,3 +36,3 @@ "type": "module",

"dependencies": {
"@napi-rs/image": "^1.11.1",
"@napi-rs/image": "^1.11.2",
"svgo": "^3.3.2"

@@ -42,13 +42,13 @@ },

"@biomejs/biome": "^1.9.4",
"@playwright/test": "^1.54.1",
"@rsbuild/core": "1.4.12",
"@rslib/core": "^0.11.0",
"@types/node": "^22.17.0",
"nano-staged": "^0.8.0",
"playwright": "^1.54.1",
"@playwright/test": "^1.57.0",
"@rsbuild/core": "1.6.10",
"@rslib/core": "^0.18.2",
"@types/node": "^24.10.1",
"nano-staged": "^0.9.0",
"playwright": "^1.57.0",
"simple-git-hooks": "^2.13.1",
"typescript": "^5.9.2"
"typescript": "^5.9.3"
},
"peerDependencies": {
"@rsbuild/core": "1.x"
"@rsbuild/core": "^1.0.0 || ^2.0.0-0"
},

@@ -60,3 +60,3 @@ "peerDependenciesMeta": {

},
"packageManager": "pnpm@10.14.0",
"packageManager": "pnpm@10.24.0",
"publishConfig": {

@@ -63,0 +63,0 @@ "access": "public",

@@ -82,3 +82,3 @@ # @rsbuild/plugin-image-compress

// Options for svgo
{ use: 'svg', floatPrecision: 2 }
{ use: "svg", floatPrecision: 2 },
// No options yet

@@ -111,3 +111,3 @@ { use: "ico" },

If you are using Rspack instead of Rsbuild, you can import the `ImageMinimizerPlugin` from the package, use it in the [optimization.minimizer](https://rspack.dev/config/optimization#optimizationminimizer) array.
If you are using Rspack instead of Rsbuild, you can import the `ImageMinimizerPlugin` from the package, use it in the [optimization.minimizer](https://rspack.rs/config/optimization#optimizationminimizer) array.

@@ -124,3 +124,3 @@ ```ts

// Use `...` to preserve the default JS and CSS minimizers of Rspack
'...',
"...",
// Add the image minimizer plugins

@@ -127,0 +127,0 @@ new ImageMinimizerPlugin({