New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mangle-css-class-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mangle-css-class-webpack-plugin - npm Package Compare versions

Comparing version 4.0.12 to 5.0.5

8

CHANGELOG.md

@@ -5,2 +5,8 @@ # Changelog

### [5.0.5](https://github.com/sndyuk/mangle-css-class-webpack-plugin/compare/v4.0.12...v5.0.5) (2021-12-18)
* adapt to webpack 5 ([5f76d5b](https://github.com/sndyuk/mangle-css-class-webpack-plugin/commit/5f76d5b86abbc667f8b1a04b628cff0dee461e61))
* use right methods ([ca40bf2](https://github.com/sndyuk/mangle-css-class-webpack-plugin/commit/ca40bf25c75cdc197d57e7031b8f99ac0b012a91))
* **plugin:** use webpack 5 processAssets hook ([cf16845](https://github.com/sndyuk/mangle-css-class-webpack-plugin/commit/cf16845d7915ea9ba77d412dc9df63ac8f424c88))
### [4.0.12](https://github.com/sndyuk/mangle-css-class-webpack-plugin/compare/v4.0.11...v4.0.12) (2021-03-29)

@@ -31,2 +37,2 @@

<a name="4.0.1"></a>
## 4.0.1 (2018-06-13)
## 4.0.1 (2018-06-13)

15

lib/optimizer.js

@@ -1,2 +0,1 @@

const { ReplaceSource } = require('webpack-sources');
const chalk = require('./chalk');

@@ -20,3 +19,3 @@ const ClassGenerator = require('./classGenerator');

const optimize = (chunk, compilation, opts, classGenerator) => chunk.files.forEach((file) => {
const optimize = (compiler, [file, originalSource], compilation, opts, classGenerator) => {
let classnameRegex;

@@ -39,5 +38,7 @@ if (file.match(/.+\.css.*$/)) {

const originalSource = compilation.assets[file];
const rawSource = originalSource.source();
let source;
const { ReplaceSource } = compiler.webpack.sources;
while (match = classnameRegex.exec(rawSource)) {

@@ -83,9 +84,9 @@ const originalName = match[1];

}
compilation.assets[file] = source;
});
compilation.updateAsset(file, source, { minimized: true });
};
const optimizer = (compiler, compilation, opts) => (chunks) => {
const optimizer = (compiler, compilation, opts) => (assets) => {
if (!opts.classNameRegExp) throw new Error("'classNameRegExp' option is required. e.g. '[c]-[a-z][a-zA-Z0-9_]*'");
const classGenerator = new ClassGenerator();
chunks.forEach((chunk) => optimize(chunk, compilation, opts, classGenerator));
Object.entries(assets).forEach((asset) => optimize(compiler, asset, compilation, opts, classGenerator));
validate(opts, classGenerator);

@@ -92,0 +93,0 @@ }

@@ -17,13 +17,8 @@ const optimizer = require('./optimizer');

apply(compiler) {
if (compiler.hooks) {
// setup hooks for webpack >= 4
compiler.hooks.compilation.tap('MangleCssClassPluginHooks', compilation => {
compilation.hooks.optimizeChunkAssets.tapAsync('MangleCssClassPluginOptimizeChunkAssetsHooks', runner(compiler, compilation, this.opts));
});
} else {
// setup hooks for webpack <= 3
compiler.plugin('compilation', (compilation) => {
compilation.plugin('optimize-chunk-assets', runner(compiler, compilation, this.opts));
});
}
compiler.hooks.compilation.tap(
'MangleCssClassPluginHooks',
(compilation) => {
compilation.hooks.processAssets.tapAsync('MangleCssClassPluginOptimizeChunkAssetsHooks', runner(compiler, compilation, this.opts));
}
);
}

@@ -30,0 +25,0 @@ }

{
"name": "mangle-css-class-webpack-plugin",
"version": "4.0.12",
"version": "5.0.5",
"license": "MIT",

@@ -20,3 +20,3 @@ "description": "Minifies and obfuscates the class names in your existing JavaScript, CSS, and HTML without any modern css modules.",

"style-loader": "^2.0.0",
"webpack": "^4.46.0"
"webpack": "^5.64.0"
},

@@ -23,0 +23,0 @@ "dependencies": {},

@@ -9,3 +9,3 @@ [![Build Status](https://travis-ci.org/sndyuk/mangle-css-class-webpack-plugin.svg?branch=master)](https://travis-ci.org/sndyuk/mangle-css-class-webpack-plugin)

<h1>mangle-css-class-webpack-plugin</h1>
<p>Minifies and obfuscates the class names in JavaScript, CSS, and HTML</p>
<p>Minifies and obfuscates the class names in JavaScript, CSS, and HTML.</p>
</div>

@@ -23,2 +23,5 @@

The latest version WORKS ONLY with Webpack 5. For Webpack v4 & v3 support, install version 4.x(mangle-css-class-webpack-plugin@4.0.12).
<h2 align="center">Usage</h2>

@@ -25,0 +28,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc