@modular-css/processor
Advanced tools
Comparing version 16.1.0 to 16.2.0
@@ -6,2 +6,14 @@ # Change Log | ||
# [16.2.0](https://github.com/tivac/modular-css/compare/v16.1.0...v16.2.0) (2018-10-12) | ||
### Features | ||
* Add verbose option to rollup & svelte ([#521](https://github.com/tivac/modular-css/issues/521)) ([0706e3d](https://github.com/tivac/modular-css/commit/0706e3d)), closes [#520](https://github.com/tivac/modular-css/issues/520) | ||
<a name="16.1.0"></a> | ||
@@ -8,0 +20,0 @@ # [16.1.0](https://github.com/tivac/modular-css/compare/v16.0.0...v16.1.0) (2018-09-21) |
{ | ||
"name": "@modular-css/processor", | ||
"version": "16.1.0", | ||
"version": "16.2.0", | ||
"description": "A streamlined reinterpretation of CSS Modules", | ||
@@ -38,3 +38,3 @@ "main": "./processor.js", | ||
}, | ||
"gitHead": "64e8e1574930c873aec9e08fa9872e8e2d918661" | ||
"gitHead": "bbb201257db79e979a3c9441694f9b7e2e69cadd" | ||
} |
@@ -36,10 +36,11 @@ "use strict"; | ||
constructor(opts) { | ||
/* eslint max-statements: [ "warn", 20 ] */ | ||
this._options = Object.assign( | ||
/* eslint max-statements: [ "warn", 25 ] */ | ||
const options = Object.assign( | ||
Object.create(null), | ||
{ | ||
cwd : process.cwd(), | ||
map : false, | ||
rewrite : true, | ||
verbose : false, | ||
cwd : process.cwd(), | ||
map : false, | ||
rewrite : true, | ||
verbose : false, | ||
resolvers : [], | ||
}, | ||
@@ -49,20 +50,18 @@ opts | ||
if(!path.isAbsolute(this._options.cwd)) { | ||
this._options.cwd = path.resolve(this._options.cwd); | ||
} | ||
this._options = options; | ||
if(typeof this._options.namer === "string") { | ||
this._options.namer = require(this._options.namer)(); | ||
if(!path.isAbsolute(options.cwd)) { | ||
options.cwd = path.resolve(options.cwd); | ||
} | ||
if(typeof this._options.namer !== "function") { | ||
this._options.namer = (file, selector) => | ||
`mc${slug(relative(this._options.cwd, file))}_${selector}`; | ||
if(typeof options.namer === "string") { | ||
options.namer = require(options.namer)(); | ||
} | ||
if(!Array.isArray(this._options.resolvers)) { | ||
this._options.resolvers = []; | ||
if(typeof options.namer !== "function") { | ||
options.namer = (file, selector) => | ||
`mc${slug(relative(options.cwd, file))}_${selector}`; | ||
} | ||
this._log = this._options.verbose ? | ||
this._log = options.verbose ? | ||
// eslint-disable-next-line no-console | ||
@@ -73,5 +72,5 @@ console.log.bind(console, "[processor]") : | ||
this._resolve = resolve.resolvers(this._options.resolvers); | ||
this._resolve = resolve.resolvers(options.resolvers); | ||
this._absolute = (file) => (path.isAbsolute(file) ? file : path.join(this._options.cwd, file)); | ||
this._absolute = (file) => (path.isAbsolute(file) ? file : path.join(options.cwd, file)); | ||
@@ -82,3 +81,3 @@ this._files = Object.create(null); | ||
this._before = postcss([ | ||
...(this._options.before || []), | ||
...(options.before || []), | ||
require("./plugins/values-local.js"), | ||
@@ -100,13 +99,13 @@ require("./plugins/values-export.js"), | ||
require("./plugins/keyframes.js"), | ||
...(this._options.processing || []), | ||
...(options.processing || []), | ||
]); | ||
this._after = postcss(this._options.after || [ noop ]); | ||
this._after = postcss(options.after || [ noop ]); | ||
// Add postcss-url to the afters if requested | ||
if(this._options.rewrite) { | ||
this._after.use(require("postcss-url")(this._options.rewrite)); | ||
if(options.rewrite) { | ||
this._after.use(require("postcss-url")(options.rewrite)); | ||
} | ||
this._done = postcss(this._options.done || [ noop ]); | ||
this._done = postcss(options.done || [ noop ]); | ||
} | ||
@@ -113,0 +112,0 @@ |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
76769
1916