Socket
Socket
Sign inDemoInstall

stylable

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylable - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

1

dist/src/parser.d.ts

@@ -5,2 +5,1 @@ import { CSSObject } from "./types";

export declare function objectifyCSS(css: string): CSSObject;
export declare function parse(css: string): CSSObject;

9

dist/src/parser.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var stylable_value_parsers_1 = require("./stylable-value-parsers");
var postcss = require("postcss");
var objectify = require("../modules/post-css-objectify");

@@ -9,3 +10,3 @@ var stylis = require("stylis");

var postcssNested = require("postcss-nested");
var postcss = require("postcss");
var safeParser = require("postcss-safe-parser");
var stylableObjectifyConfig = {

@@ -30,9 +31,5 @@ noCamel: [stylable_value_parsers_1.STYLABLE_VALUE_MATCHER],

// return stylis('', css);
return objectify(postcss.parse(css), stylableObjectifyConfig);
return objectify(safeParser(css), stylableObjectifyConfig);
}
exports.objectifyCSS = objectifyCSS;
function parse(css) {
return processor.parse(css);
}
exports.parse = parse;
//# sourceMappingURL=parser.js.map

@@ -6,7 +6,4 @@ "use strict";

if (throwCondition === void 0) { throwCondition = 0; }
if (throwCondition > 10 || value === undefined) {
throw new Error('Unresolvable variable: ' + name);
}
return value.replace(/value\((.*?)\)/g, function (match, name) {
var translatedValue = data[name];
var translatedValue;
if (~name.indexOf(',')) {

@@ -19,4 +16,10 @@ var nameParts = name.split(',');

}
else {
translatedValue = data[name];
}
if (throwCondition > 10 || translatedValue === undefined) {
throw new Error('Unresolvable variable: ' + name);
}
var res = valueTemplate(translatedValue, data, debug, throwCondition + 1);
return res !== undefined ? res + (debug ? "/*" + match + "*/" : '') : match;
return res !== undefined ? res + (debug ? "/*" + name + "*/" : '') : match;
});

@@ -23,0 +26,0 @@ }

{
"name": "stylable",
"version": "1.0.4",
"version": "1.0.5",
"description": "",

@@ -41,2 +41,3 @@ "main": "./dist/src/index.js",

"postcss-nested": "^2.0.2",
"postcss-safe-parser": "^3.0.1",
"stylis": "^3.2.3"

@@ -43,0 +44,0 @@ },

import { CSSObject } from "./types";
import { STYLABLE_VALUE_MATCHER } from "./stylable-value-parsers";
import * as postcss from "postcss";

@@ -9,3 +10,3 @@ const objectify = require("../modules/post-css-objectify");

const postcssNested = require("postcss-nested");
const postcss = require("postcss");
const safeParser = require("postcss-safe-parser");

@@ -35,7 +36,3 @@

// return stylis('', css);
return objectify(postcss.parse(css), stylableObjectifyConfig);
return objectify(safeParser(css), stylableObjectifyConfig);
}
export function parse(css: string): CSSObject {
return processor.parse(css);
}
import { Pojo } from "./types";
export function valueTemplate(value: string, data: Pojo, debug: boolean = false, throwCondition = 0): string {
if (throwCondition > 10 || value === undefined) { throw new Error('Unresolvable variable: ' + name) }
return value.replace(/value\((.*?)\)/g, function (match: string, name: string) {
let translatedValue = data[name];
let translatedValue;
if (~name.indexOf(',')) {

@@ -13,6 +12,9 @@ const nameParts = name.split(',');

translatedValue = data[variableName] || defaultValue;
} else {
translatedValue = data[name];
}
if (throwCondition > 10 || translatedValue === undefined) { throw new Error('Unresolvable variable: ' + name) }
const res = valueTemplate(translatedValue, data, debug, throwCondition + 1);
return res !== undefined ? res + (debug ? `/*${match}*/` : '') : match;
return res !== undefined ? res + (debug ? `/*${name}*/` : '') : match;
});
}
}

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