From 92bcf4fdcacf8d9a780a6356d07b3c99d2fb5a85 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 23 Aug 2020 15:19:22 +0200 Subject: [PATCH] Automatically re-export imports --- src/postcss/postcss-icss-parser.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/postcss/postcss-icss-parser.js b/src/postcss/postcss-icss-parser.js index 45c6aa4..5aad5ec 100644 --- a/src/postcss/postcss-icss-parser.js +++ b/src/postcss/postcss-icss-parser.js @@ -14,13 +14,14 @@ Licensed under: const postcss = require("postcss"); const icssUtils = require("icss-utils"); const loaderUtils = require("loader-utils"); -const { validateOptions, required, isFunction } = require("validatem"); +const { validateOptions, required, isFunction, isBoolean } = require("validatem"); const pluginName = 'postcss-icss-parser'; module.exports = postcss.plugin(pluginName, (options = {}) => { validateOptions([options], { - keyReplacer: [ required, isFunction ] + keyReplacer: [ required, isFunction ], + autoExportImports: [ isBoolean ] }); return function process(css, result) { @@ -43,6 +44,17 @@ module.exports = postcss.plugin(pluginName, (options = {}) => { type: 'icss-import', item: { url, localKey, remoteKey, newKey, index }, }); + + if (options.autoExportImports !== false) { + result.messages.push({ + pluginName: pluginName, + type: "icss-export", + item: { + name: localKey, + value: newKey + } + }); + } } }