Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

windicss-webpack-plugin

Package Overview
Dependencies
Maintainers
4
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

windicss-webpack-plugin - npm Package Compare versions

Comparing version 1.5.1 to 1.5.2

8

CHANGELOG.md

@@ -7,4 +7,12 @@ ### Changelog

#### [1.5.2](https://github.com/windicss/windicss-webpack-plugin/compare/1.5.1...1.5.2)
- fix(css): safer transformCSS logic [`aa6df30`](https://github.com/windicss/windicss-webpack-plugin/commit/aa6df30d355d9d6abe841e8783999f2f6e1f99f9)
- chore(pkg): rename main branch [`c8ec0be`](https://github.com/windicss/windicss-webpack-plugin/commit/c8ec0beef106f778e9ed8a1ac3e82261ccec6481)
#### [1.5.1](https://github.com/windicss/windicss-webpack-plugin/compare/1.5.0...1.5.1)
> 26 October 2021
- Release 1.5.1 [`d8a9688`](https://github.com/windicss/windicss-webpack-plugin/commit/d8a9688d05dd5adbddafaef5c5b3ae0a3aecb835)
- fix(types): use correct main types [`c773948`](https://github.com/windicss/windicss-webpack-plugin/commit/c773948d4f20dc79557bf00932b55f7ffd89f752)

@@ -11,0 +19,0 @@

34

dist/core/utils.js

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

});
exports.isJsx = exports.cssRequiresTransform = void 0;
exports.transformCSS = exports.isJsx = exports.cssRequiresTransform = void 0;
var _constants = require("./constants");
var _debug = _interopRequireDefault(require("./debug"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const cssRequiresTransform = source => {

@@ -21,2 +25,28 @@ return _constants.HAS_DIRECTIVE_TEST.test(source) || _constants.HAS_THEME_FUNCTION_TEST.test(source);

exports.isJsx = isJsx;
exports.isJsx = isJsx;
const transformCSS = (service, source, resource) => {
if (!source || source.length <= 0) return source;
if (!cssRequiresTransform(source)) return source;
let output = source;
try {
output = service.transformCSS(source, resource, {
globaliseKeyframes: true
});
if (!output || output.length <= 0) {
console.warn(`[WindiCSS] Failed to transform CSS for resource: ${resource}.`);
return source;
}
_debug.default.loader("Transformed CSS", resource);
} catch (e) {
console.warn(`[WindiCSS] Failed to transform CSS for resource: ${resource}.`);
return source;
}
return output;
};
exports.transformCSS = transformCSS;

17

dist/loaders/transform-css.js

@@ -8,8 +8,4 @@ "use strict";

var _debug = _interopRequireDefault(require("../core/debug"));
var _utils = require("../core/utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function TransformCss(source) {

@@ -20,14 +16,3 @@ if (!this._compiler) return source;

if (!service) return source;
if (!(0, _utils.cssRequiresTransform)(source)) return source;
let output = source;
try {
output = service.transformCSS(source, this.resource);
_debug.default.loader("Transformed CSS", this.resource);
} catch (e) {
this.emitWarning(`[Windi CSS] Failed to css for resource: ${this.resource}.`);
}
return output || source;
return (0, _utils.transformCSS)(service, source, this.resource);
}

@@ -34,0 +19,0 @@

@@ -25,8 +25,3 @@ "use strict";

if (!service) return source;
if (this.resource.indexOf("type=style") > 0) {
if (!(0, _utils.cssRequiresTransform)(source)) return source;
return service.transformCSS(source, this.resource);
}
if (this.resource.indexOf("type=style") > 0) return (0, _utils.transformCSS)(service, source, this.resource);
const hasHtmlWebpackPlugin = this.loaders.filter(loader => {

@@ -54,6 +49,4 @@ return loader.loader && loader.loader.indexOf("html-webpack-plugin") > 0 || loader.path && loader.path.indexOf("html-webpack-plugin") > 0;

if (!(0, _utils.cssRequiresTransform)(match)) return match;
if ((0, _utils.isJsx)(css)) {
let m, transformedCSS;
let m, transformedCSS2;
const jsxMatcher = /{`(.*)`}/gms;

@@ -65,7 +58,8 @@

if (groupIndex === 1) {
transformedCSS = `<style${meta}>
{\`${service.transformCSS(match2, this.resource)}
const transformedJSXCSS = (0, _utils.transformCSS)(service, match2, this.resource);
transformedCSS2 = `<style${meta}>
{\`${transformedJSXCSS}
\`}</style>`;
_debug.default.loader("jsx transformed", transformedCSS);
_debug.default.loader("jsx transformed", transformedCSS2);
}

@@ -75,7 +69,8 @@ });

return transformedCSS ?? match;
return transformedCSS2 ?? match;
}
const transformedCSS = (0, _utils.transformCSS)(service, css, this.resource);
return `<style${meta}>
${service.transformCSS(css, this.resource)}
${transformedCSS}
</style>`;

@@ -89,3 +84,3 @@ });

} catch (e) {
this.emitWarning(`[Windi CSS] Failed to transform groups and css for template: ${this.resource}.`);
this.emitWarning(`[WindiCSS] Failed to transform groups and css for template: ${this.resource}.`);
}

@@ -92,0 +87,0 @@

{
"name": "windicss-webpack-plugin",
"version": "1.5.1",
"version": "1.5.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "author": {

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