@ -11,20 +11,24 @@ Licensed under:
MIT ( https : //opensource.org/licenses/MIT)
* /
const postcss = require ( "postcss" ) ;
const icssUtils = require ( "icss-utils" ) ;
const loaderUtils = require ( "loader-utils" ) ;
const { validateOptions , required , isFunction , isBoolean } = require ( "validatem" ) ;
const { validateOptions } = require ( "@validatem/core" ) ;
const required = require ( "@validatem/required" ) ;
const isBoolean = require ( "@validatem/is-boolean" ) ;
const isFunction = require ( "@validatem/is-function" ) ;
const pluginName = 'postcss-icss-parser' ;
module . exports = postcss . plugin ( pluginName , ( options = { } ) => {
validateOptions ( [ options ] , {
module . exports = function ( options = { } ) {
validateOptions ( arguments , {
keyReplacer : [ required , isFunction ] ,
autoExportImports : [ isBoolean ]
} ) ;
return function process ( css , result ) {
return {
postcssPlugin : pluginName ,
Once ( css , { result } ) {
const importReplacements = Object . create ( null ) ;
const { icssImports , icssExports } = icssUtils . extractICSS ( css ) ;
@ -73,5 +77,8 @@ module.exports = postcss.plugin(pluginName, (options = {}) => {
item : { name , value : parsedValue }
} ) ;
}
} ,
} ;
} ) ;
} ;
module . exports . postcss = true ;