Socket
Socket
Sign inDemoInstall

mini-css-extract-plugin

Package Overview
Dependencies
Maintainers
5
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-css-extract-plugin - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

54

dist/index.js

@@ -56,2 +56,4 @@ "use strict";

content,
layer,
supports,
media,

@@ -68,2 +70,4 @@ sourceMap,

this.content = content;
this.layer = layer;
this.supports = supports;
this.media = media;

@@ -112,5 +116,7 @@ this.sourceMap = sourceMap;

updateCacheModule(module) {
if (this.content !== module.content || this.media !== module.media || this.sourceMap !== module.sourceMap || this.assets !== module.assets || this.assetsInfo !== module.assetsInfo) {
if (this.content !== module.content || this.layer !== module.layer || this.supports !== module.supports || this.media !== module.media || this.sourceMap !== module.sourceMap || this.assets !== module.assets || this.assetsInfo !== module.assetsInfo) {
this._needBuild = true;
this.content = module.content;
this.layer = module.layer;
this.supports = module.supports;
this.media = module.media;

@@ -148,2 +154,8 @@ this.sourceMap = module.sourceMap;

hash.update(this.content);
if (this.layer) {
hash.update(this.layer);
}
hash.update(this.supports || "");
hash.update(this.media || "");

@@ -167,2 +179,4 @@ hash.update(this.sourceMap || "");

write(this.content);
write(this.layer);
write(this.supports);
write(this.media);

@@ -197,2 +211,4 @@ write(this.sourceMap);

const content = read();
const layer = read();
const supports = read();
const media = read();

@@ -207,2 +223,4 @@ const sourceMap = read();

content,
layer,
supports,
media,

@@ -234,2 +252,4 @@ sourceMap,

content,
layer,
supports,
media,

@@ -242,2 +262,4 @@ sourceMap

this.content = content;
this.layer = layer;
this.supports = supports;
this.media = media;

@@ -267,2 +289,4 @@ this.sourceMap = sourceMap;

write(this.content);
write(this.layer);
write(this.supports);
write(this.media);

@@ -296,2 +320,4 @@ write(this.sourceMap);

content: read(),
layer: read(),
supports: read(),
media: read(),

@@ -320,3 +346,5 @@ sourceMap: read()

ignoreOrder: false,
experimentalUseImportModule: false,
// TODO remove in the next major release
// eslint-disable-next-line no-undefined
experimentalUseImportModule: undefined,
runtime: true

@@ -362,6 +390,2 @@ }, options);

if (this.options.experimentalUseImportModule) {
if (!compiler.options.experiments) {
throw new Error("experimentalUseImportModule is only support for webpack >= 5.33.2");
}
if (typeof compiler.options.experiments.executeModule === "undefined") {

@@ -731,2 +755,6 @@ // eslint-disable-next-line no-param-reassign

if (module.supports) {
source.add(`@supports (${module.supports}) {\n`);
}
if (module.media) {

@@ -736,2 +764,8 @@ source.add(`@media ${module.media} {\n`);

const needLayer = typeof module.layer !== "undefined";
if (needLayer) {
source.add(`@layer${module.layer.length > 0 ? ` ${module.layer}` : ""} {\n`);
}
const {

@@ -753,5 +787,13 @@ path: filename

if (needLayer) {
source.add("}\n");
}
if (module.media) {
source.add("}\n");
}
if (module.supports) {
source.add("}\n");
}
}

@@ -758,0 +800,0 @@ }

10

dist/loader.js

@@ -90,3 +90,3 @@ "use strict";

namedExport = // eslint-disable-next-line no-underscore-dangle
originalExports.__esModule && !("locals" in originalExports.default);
originalExports.__esModule && (!originalExports.default || !("locals" in originalExports.default));

@@ -112,3 +112,3 @@ if (namedExport) {

} else {
dependencies = exports.map(([id, content, media, sourceMap]) => {
dependencies = exports.map(([id, content, media, sourceMap, supports, layer]) => {
let identifier = id;

@@ -133,2 +133,4 @@ let context;

media,
supports,
layer,
sourceMap: sourceMap ? Buffer.from(JSON.stringify(sourceMap)) : // eslint-disable-next-line no-undefined

@@ -170,5 +172,5 @@ undefined

if (optionsFromPlugin.experimentalUseImportModule) {
if (typeof optionsFromPlugin.experimentalUseImportModule === "undefined" && typeof this.importModule === "function" || optionsFromPlugin.experimentalUseImportModule) {
if (!this.importModule) {
callback(new Error("You are using experimentalUseImportModule but 'this.importModule' is not available in loader context. You need to have at least webpack 5.33.2."));
callback(new Error("You are using 'experimentalUseImportModule' but 'this.importModule' is not available in loader context. You need to have at least webpack 5.33.2."));
return;

@@ -175,0 +177,0 @@ }

{
"name": "mini-css-extract-plugin",
"version": "2.3.0",
"version": "2.4.0",
"description": "extracts CSS into separate files",

@@ -77,3 +77,3 @@ "license": "MIT",

"standard-version": "^9.3.0",
"webpack": "^5.48.0",
"webpack": "^5.57.0",
"webpack-cli": "^4.7.2",

@@ -80,0 +80,0 @@ "webpack-dev-server": "^4.0.0"

@@ -91,3 +91,3 @@ <div align="center">

| **[`runtime`](#runtime)** | `{Boolean}` | `true` | Allows to enable/disable the runtime generation |
| **[`experimentalUseImportModule`](#experimentalUseImportModule)** | `{Boolean}` | `false` | Use an experimental webpack API to execute modules instead of child compilers |
| **[`experimentalUseImportModule`](#experimentalUseImportModule)** | `{Boolean}` | `undefined` | Use an experimental webpack API to execute modules instead of child compilers |

@@ -305,10 +305,13 @@ #### `filename`

Use an experimental webpack API to execute modules instead of child compilers.
Type: `Boolean`
Default: `undefined`
This improves performance and memory usage a lot, but isn't as stable as the normal approach.
Enabled by default if not explicitly enabled (i.e. `true` and `false` allow you to explicitly control this option) and new API is available (at least webpack `5.52.0` is required).
Boolean values are available since version `5.33.2`, but you need to enable `experiments.executeModule` (not required from webpack `5.52.0`).
Use a new webpack API to execute modules instead of child compilers.
This improves performance and memory usage a lot.
When combined with `experiments.layers`, this adds a `layer` option to the loader options to specify the layer of the css execution.
You need to have at least webpack 5.33.2.
**webpack.config.js**

@@ -322,2 +325,5 @@

new MiniCssExtractPlugin({
// You don't need this for `>= 5.52.0` due to the fact that this is enabled by default
// Required only for `>= 5.33.2 & <= 5.52.0`
// Not avaliable/unsafe for `<= 5.33.2`
experimentalUseImportModule: true,

@@ -324,0 +330,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