Socket
Socket
Sign inDemoInstall

wix-style-processor

Package Overview
Dependencies
Maintainers
1
Versions
188
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wix-style-processor - npm Package Compare versions

Comparing version 3.1.4 to 3.1.5

2

dist/es/src/domService.js

@@ -18,3 +18,3 @@ function isIE() {

isCssVarsSupported: function () {
return !!(window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 0));
return !!(window && window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 0));
},

@@ -21,0 +21,0 @@ updateCssVars: function (varMap) {

@@ -17,4 +17,3 @@ export declare class Plugins {

private updateRegex;
private extractParams;
private isLegalExpression;
private extractArguments;
}

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

import { parenthesisAreBalanced } from './utils';
var paramsRegex = /,(?![^(]*(?:\)|}))/g;

@@ -26,3 +27,3 @@ var Plugins = /** @class */ (function () {

funcName: groups[1],
args: this.extractParams(groups[2])
args: this.extractArguments(groups[2])
};

@@ -35,18 +36,18 @@ }

};
Plugins.prototype.extractParams = function (params) {
var _this = this;
var result = [];
var args = params.split(paramsRegex);
args.reduce(function (acc, arg) {
if (_this.isLegalExpression(acc + arg)) {
result.push(acc ? acc + "," + arg : arg);
return '';
Plugins.prototype.extractArguments = function (argsString) {
var result = argsString.split(paramsRegex)
.reduce(function (acc, currentPart) {
acc.tmpParts = acc.tmpParts.concat(currentPart);
var tmpStr = acc.tmpParts.join(',');
if (parenthesisAreBalanced(tmpStr)) {
acc.args.push(tmpStr);
acc.tmpParts.length = 0;
}
return acc ? acc + "," + arg : arg;
}, '');
return result;
return acc;
}, { args: [], tmpParts: [] });
if (result.tmpParts.length > 0) {
throw new Error("'" + argsString + "' contains unbalanced parenthesis.");
}
return result.args;
};
Plugins.prototype.isLegalExpression = function (expression) {
return expression.split(/\(/g).length === expression.split(/\)/g).length;
};
return Plugins;

@@ -53,0 +54,0 @@ }());

@@ -17,1 +17,2 @@ export declare function isCssVar(key: string): boolean;

export declare function pickBy(obj: Object, predicate: (value: any) => boolean): Object;
export declare function parenthesisAreBalanced(str: string): boolean;

@@ -37,2 +37,20 @@ export function isCssVar(key) {

}
export function parenthesisAreBalanced(str) {
var parentheses = '(){}';
var stack = [];
var character;
for (var i = 0; (character = str[i]); i++) {
var bracePosition = parentheses.indexOf(character);
if (bracePosition === -1) {
continue;
}
if (bracePosition % 2 === 0) {
stack.push(bracePosition + 1); // push next expected brace position
}
else if (stack.length === 0 || stack.pop() !== bracePosition) {
return false;
}
}
return stack.length === 0;
}
//# sourceMappingURL=utils.js.map

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

isCssVarsSupported: function () {
return !!(window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 0));
return !!(window && window.CSS && window.CSS.supports && window.CSS.supports('--fake-var', 0));
},

@@ -23,0 +23,0 @@ updateCssVars: function (varMap) {

@@ -17,4 +17,3 @@ export declare class Plugins {

private updateRegex;
private extractParams;
private isLegalExpression;
private extractArguments;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
var paramsRegex = /,(?![^(]*(?:\)|}))/g;

@@ -28,3 +29,3 @@ var Plugins = /** @class */ (function () {

funcName: groups[1],
args: this.extractParams(groups[2])
args: this.extractArguments(groups[2])
};

@@ -37,18 +38,18 @@ }

};
Plugins.prototype.extractParams = function (params) {
var _this = this;
var result = [];
var args = params.split(paramsRegex);
args.reduce(function (acc, arg) {
if (_this.isLegalExpression(acc + arg)) {
result.push(acc ? acc + "," + arg : arg);
return '';
Plugins.prototype.extractArguments = function (argsString) {
var result = argsString.split(paramsRegex)
.reduce(function (acc, currentPart) {
acc.tmpParts = acc.tmpParts.concat(currentPart);
var tmpStr = acc.tmpParts.join(',');
if (utils_1.parenthesisAreBalanced(tmpStr)) {
acc.args.push(tmpStr);
acc.tmpParts.length = 0;
}
return acc ? acc + "," + arg : arg;
}, '');
return result;
return acc;
}, { args: [], tmpParts: [] });
if (result.tmpParts.length > 0) {
throw new Error("'" + argsString + "' contains unbalanced parenthesis.");
}
return result.args;
};
Plugins.prototype.isLegalExpression = function (expression) {
return expression.split(/\(/g).length === expression.split(/\)/g).length;
};
return Plugins;

@@ -55,0 +56,0 @@ }());

@@ -17,1 +17,2 @@ export declare function isCssVar(key: string): boolean;

export declare function pickBy(obj: Object, predicate: (value: any) => boolean): Object;
export declare function parenthesisAreBalanced(str: string): boolean;

@@ -46,2 +46,21 @@ "use strict";

exports.pickBy = pickBy;
function parenthesisAreBalanced(str) {
var parentheses = '(){}';
var stack = [];
var character;
for (var i = 0; (character = str[i]); i++) {
var bracePosition = parentheses.indexOf(character);
if (bracePosition === -1) {
continue;
}
if (bracePosition % 2 === 0) {
stack.push(bracePosition + 1); // push next expected brace position
}
else if (stack.length === 0 || stack.pop() !== bracePosition) {
return false;
}
}
return stack.length === 0;
}
exports.parenthesisAreBalanced = parenthesisAreBalanced;
//# sourceMappingURL=utils.js.map

@@ -5,3 +5,3 @@ {

"description": "An alternative Wix Styles TPA processor",
"version": "3.1.4",
"version": "3.1.5",
"author": {

@@ -8,0 +8,0 @@ "name": "Eran Shabi",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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