css-mqpacker-webpack-plugin
Advanced tools
Comparing version 0.15.0 to 0.16.1
{ | ||
"name": "@hail2u/css-mqpacker", | ||
"version": "9.0.0", | ||
"main": "index.js", | ||
"version": "9.0.1", | ||
"author": "Kyo Nagashima <hail2u@gmail.com> (https://hail2u.net/)", | ||
@@ -5,0 +6,0 @@ "homepage": "https://github.com/hail2u/node-css-mqpacker", |
{ | ||
"name": "css-mqpacker-webpack-plugin", | ||
"version": "0.15.0", | ||
"version": "0.16.1", | ||
"description": "The Webpack plugin for pack same CSS media query rules into one using PostCSS", | ||
@@ -17,8 +17,7 @@ "main": "src/index.js", | ||
"hoist": "node hoist.mjs", | ||
"test": "uvu test" | ||
"test": "node test/options.spec.js" | ||
}, | ||
"devDependencies": { | ||
"@hail2u/css-mqpacker": "github:hail2u/node-css-mqpacker#2349fdd", | ||
"schema-utils": "^4.2.0", | ||
"uvu": "^0.5.6" | ||
"@hail2u/css-mqpacker": "github:hail2u/node-css-mqpacker#1f9a1cf", | ||
"schema-utils": "^4.2.0" | ||
}, | ||
@@ -25,0 +24,0 @@ "peerDependencies": { |
@@ -24,3 +24,3 @@ interface Options { | ||
declare class CssMqpackerPlugin { | ||
static pluginName: "CssMqpackerPlugin" | ||
static readonly name: "CssMqpackerPlugin" | ||
@@ -27,0 +27,0 @@ constructor(options?: Options) |
@@ -7,7 +7,10 @@ const postcss = require("postcss"); | ||
class CssMqpackerPlugin { | ||
static pluginName = "CssMqpackerPlugin"; | ||
static name = "CssMqpackerPlugin"; | ||
#match; | ||
#mqpacker; | ||
constructor(options = {}) { | ||
validate(schema, options, { | ||
name: CssMqpackerPlugin.pluginName, | ||
name: CssMqpackerPlugin.name, | ||
baseDataPath: "options", | ||
@@ -23,3 +26,3 @@ }); | ||
this.options = { | ||
this.#match = { | ||
test, | ||
@@ -30,3 +33,3 @@ include, | ||
this.mqp = postcss([ | ||
this.#mqpacker = postcss([ | ||
mqpacker({ sort }), | ||
@@ -40,3 +43,3 @@ ]); | ||
undefined, | ||
this.options, | ||
this.#match, | ||
); | ||
@@ -47,3 +50,3 @@ | ||
const { css } = await this.mqp.process(data, { | ||
const { css } = await this.#mqpacker.process(data, { | ||
from: name, | ||
@@ -72,3 +75,3 @@ }); | ||
const processOptions = { | ||
name: CssMqpackerPlugin.pluginName, | ||
name: CssMqpackerPlugin.name, | ||
stage: compiler.webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE, | ||
@@ -78,3 +81,3 @@ additionalAssets: true, | ||
compiler.hooks.compilation.tap(CssMqpackerPlugin.pluginName, (compilation) => { | ||
compiler.hooks.compilation.tap(CssMqpackerPlugin.name, (compilation) => { | ||
compilation.hooks.processAssets.tapPromise(processOptions, (assets) => { | ||
@@ -81,0 +84,0 @@ return this.#optimize(compiler, compilation, assets); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13553
2
328