🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

postcss-custom-properties

Package Overview
Dependencies
Maintainers
3
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-custom-properties - npm Package Compare versions

Comparing version

to
11.0.0

4

CHANGELOG.md
# Changes to PostCSS Custom Properties
### 11.0.0 (January 12, 2021)
- Added: Support for PostCSS v8.
### 10.0.0 (September 18, 2020)

@@ -4,0 +8,0 @@

62

index.cjs.js
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var postcssValuesParser = require('postcss-values-parser');
var fs = require('fs');
var path = require('path');
var postcss = require('postcss');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) { return e; } else {
var n = {};
if (e) {
Object.keys(e).forEach(function (k) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);

@@ -17,13 +23,11 @@ Object.defineProperty(n, k, d.get ? d : {

});
});
}
n['default'] = e;
return n;
}
});
}
n['default'] = e;
return Object.freeze(n);
}
var postcss = _interopDefault(require('postcss'));
var postcssValuesParser = require('postcss-values-parser');
var fs = _interopDefault(require('fs'));
var path = _interopDefault(require('path'));
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);

@@ -69,3 +73,5 @@ function isBlockIgnored(ruleOrDeclaration) {

return Object.assign({}, customPropertiesFromHtmlElement, customPropertiesFromRootPseudo);
return { ...customPropertiesFromHtmlElement,
...customPropertiesFromRootPseudo
};
} // match html and :root rules

@@ -125,3 +131,3 @@

async function getCustomPropertiesFromJSFile(from) {
const object = await new Promise(function (resolve) { resolve(_interopNamespace(require(from))); });
const object = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(from)); });
return getCustomPropertiesFromObject(object);

@@ -151,5 +157,5 @@ }

const from = path.resolve(String(opts.from || '')); // type of file being read from
const from = path__default['default'].resolve(String(opts.from || '')); // type of file being read from
const type = (opts.type || path.extname(from).slice(1)).toLowerCase();
const type = (opts.type || path__default['default'].extname(from).slice(1)).toLowerCase();
return {

@@ -184,3 +190,3 @@ type,

const readFile = from => new Promise((resolve, reject) => {
fs.readFile(from, 'utf8', (error, result) => {
fs__default['default'].readFile(from, 'utf8', (error, result) => {
if (error) {

@@ -216,3 +222,4 @@ reject(error);

const raws = nodes.map(node => Object.assign({}, node.raws));
const raws = nodes.map(node => ({ ...node.raws
}));
child.replaceWith(...nodes);

@@ -413,3 +420,3 @@ nodes.forEach((node, index) => {

const type = (opts.type || path.extname(opts.to).slice(1)).toLowerCase(); // transformed Custom Properties
const type = (opts.type || path__default['default'].extname(opts.to).slice(1)).toLowerCase(); // transformed Custom Properties

@@ -455,3 +462,3 @@ const customPropertiesJSON = toJSON(customProperties);

const writeFile = (to, text) => new Promise((resolve, reject) => {
fs.writeFile(to, text, error => {
fs__default['default'].writeFile(to, text, error => {
if (error) {

@@ -467,3 +474,3 @@ reject(error);

var index = postcss.plugin('postcss-custom-properties', opts => {
const creator = opts => {
// whether to preserve custom selectors and rules using them

@@ -500,6 +507,11 @@ const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true; // sources to import custom selectors from

const canReturnSyncFunction = importFrom.length === 0 && exportTo.length === 0;
return canReturnSyncFunction ? syncTransform : asyncTransform;
});
return {
postcssPlugin: 'postcss-custom-properties',
Once: canReturnSyncFunction ? syncTransform : asyncTransform
};
};
module.exports = index;
creator.postcss = true;
module.exports = creator;
//# sourceMappingURL=index.cjs.js.map
{
"name": "postcss-custom-properties",
"version": "10.0.0",
"version": "11.0.0",
"description": "Use Custom Properties Queries in CSS",

@@ -32,15 +32,18 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>",

"dependencies": {
"postcss": "^7.0.17",
"postcss-values-parser": "^4.0.0"
},
"peerDependencies": {
"postcss": "^8.1.0"
},
"devDependencies": {
"@babel/core": "^7.5.4",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.5.4",
"babel-eslint": "^10.0.2",
"eslint": "^6.0.1",
"postcss-tape": "^5.0.0",
"@babel/core": "^7.11.6",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.11.5",
"@rollup/plugin-babel": "^5.2.1",
"babel-eslint": "^10.1.0",
"eslint": "^7.9.0",
"postcss": "^8.1.0",
"postcss-tape": "^6.0.0",
"pre-commit": "^1.2.2",
"rollup": "^1.17.0",
"rollup-plugin-babel": "^4.3.3"
"rollup": "^2.27.1"
},

@@ -47,0 +50,0 @@ "eslintConfig": {

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