postcss-local-constants
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -0,1 +1,4 @@ | ||
## 0.0.6 | ||
* Referencing module paths is now the same as a `require` - it's relative to the current directory. | ||
## 0.0.5 | ||
@@ -2,0 +5,0 @@ * `lodash` is used directly rather than `lodash-node` |
var postcss = require('postcss'); | ||
var nodepath = require('path'); | ||
var assign = require('lodash/object/assign'); | ||
var resolve = require('resolve'); | ||
@@ -11,5 +12,7 @@ module.exports = postcss.plugin('postcss-local-constants', function (opts) { | ||
var getConstants = function(name, path) { | ||
var getConstants = function(name, path, directory) { | ||
var res = resolve.sync(JSON.parse(path), { basedir: nodepath.dirname(directory) }); | ||
var requiredSet = name.replace(/~/g, ''); | ||
var constantSets = require(nodepath.resolve('./', JSON.parse(path))); | ||
var constantSets = require(res); | ||
if (constantSets[requiredSet]) { | ||
@@ -64,3 +67,3 @@ if (sets[requiredSet]) { | ||
if (node.prop && node.prop.indexOf('~') > -1) { | ||
getConstants(node.prop, node.value); | ||
getConstants(node.prop, node.value, node.source.input.from); | ||
node.removeSelf(); | ||
@@ -67,0 +70,0 @@ } |
{ | ||
"name": "postcss-local-constants", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "PostCSS plugin to process imported constants from a file, removing them from a global scope.", | ||
@@ -25,3 +25,4 @@ "keywords": [ | ||
"lodash": "^3.10.0", | ||
"postcss": "^4.1.13" | ||
"postcss": "^4.1.13", | ||
"resolve": "^1.1.6" | ||
}, | ||
@@ -28,0 +29,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7215
63
3
+ Addedresolve@^1.1.6
+ Addedfunction-bind@1.1.2(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)