clean-css-loader
Advanced tools
Comparing version
@@ -17,5 +17,21 @@ "use strict"; | ||
} | ||
function getLoaderOptions(_that) { | ||
if (typeof loader_utils_1.getOptions === "function") { | ||
return (0, loader_utils_1.getOptions)(_that) || {}; | ||
} | ||
if (typeof _that.getOptions === "function") { | ||
const rawOptions = _that.getOptions() || {}; | ||
Object.keys(rawOptions).forEach((key) => { | ||
const value = rawOptions[key]; | ||
if (["false", "true", "null"].includes(value)) { | ||
rawOptions[key] = JSON.parse(value); | ||
} | ||
}); | ||
return rawOptions; | ||
} | ||
return {}; | ||
} | ||
function cleanCssLoader(content, prevSourceMap, additionalData) { | ||
const callback = this.async(); | ||
const loaderOptions = (typeof this.getOptions === "function" ? this.getOptions() : loader_utils_1.getOptions === null || loader_utils_1.getOptions === void 0 ? void 0 : (0, loader_utils_1.getOptions)(this)) || {}; | ||
const loaderOptions = getLoaderOptions(this); | ||
(0, schema_utils_1.validate)(schema_json_1.default, loaderOptions, { | ||
@@ -22,0 +38,0 @@ name: "clean-css-loader", |
{ | ||
"name": "clean-css-loader", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"dependencies": { | ||
"clean-css": "^5.0.0" | ||
"clean-css": "^5.0.0" | ||
}, | ||
"peerDependencies": { | ||
"schema-utils": "^3.0.0 || ^4.0.0", | ||
"loader-utils": "^1.0.0 || ^2.0.0 || ^3.0.0", | ||
@@ -17,5 +18,8 @@ "webpack": ">=2.0.0" | ||
}, | ||
"loader-utils": { | ||
"optional": true | ||
} | ||
"loader-utils": { | ||
"optional": true | ||
}, | ||
"schema-utils": { | ||
"optional": true | ||
} | ||
}, | ||
@@ -22,0 +26,0 @@ "scripts": { |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
17374
2.5%317
5.32%4
33.33%