1 | {"version":3,"file":"index.cjs.js","sources":["src/lib/postcss-values-parser.js","src/lib/is-ignored.js","src/lib/get-custom-properties-from-root.js","src/lib/get-custom-properties-from-imports.js","src/lib/transform-value-ast.js","src/lib/transform-properties.js","src/lib/write-custom-properties-to-exports.js","src/index.js"],"sourcesContent":["import valueParser from 'postcss-values-parser';\n\nexport function parse (string) {\n\treturn valueParser(string).parse();\n}\n","function isBlockIgnored(ruleOrDeclaration) {\n\tvar rule = ruleOrDeclaration.selector ?\n\t\truleOrDeclaration : ruleOrDeclaration.parent;\n\n\treturn /(!\\s*)?postcss-custom-properties:\\s*off\\b/i.test(rule.toString())\n}\n\nfunction isRuleIgnored(rule) {\n\tvar previous = rule.prev();\n\n\treturn Boolean(isBlockIgnored(rule) ||\n\t\tprevious &&\n\t\tprevious.type === 'comment' &&\n\t\t/(!\\s*)?postcss-custom-properties:\\s*ignore\\s+next\\b/i.test(previous.text));\n}\n\nexport {\n\tisBlockIgnored,\n\tisRuleIgnored\n}\n","import { parse } from './postcss-values-parser';\nimport { isBlockIgnored } from './is-ignored';\n\n// return custom selectors from the css root, conditionally removing them\nexport default function getCustomPropertiesFromRoot(root, opts) {\n\t// initialize custom selectors\n\tconst customPropertiesFromHtmlElement = {};\n\tconst customPropertiesFromRootPseudo = {};\n\n\t// for each html or :root rule\n\troot.nodes.slice().forEach(rule => {\n\t\tconst customPropertiesObject = isHtmlRule(rule)\n\t\t\t? customPropertiesFromHtmlElement\n\t\t: isRootRule(rule)\n\t\t\t? customPropertiesFromRootPseudo\n\t\t: null;\n\n\t\t// for each custom property\n\t\tif (customPropertiesObject) {\n\t\t\trule.nodes.slice().forEach(decl => {\n\t\t\t\tif (isCustomDecl(decl) && !isBlockIgnored(decl)) {\n\t\t\t\t\tconst { prop } = decl;\n\n\t\t\t\t\t// write the parsed value to the custom property\n\t\t\t\t\tcustomPropertiesObject[prop] = parse(decl.value).nodes;\n\n\t\t\t\t\t// conditionally remove the custom property declaration\n\t\t\t\t\tif (!opts.preserve) {\n\t\t\t\t\t\tdecl.remove();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// conditionally remove the empty html or :root rule\n\t\t\tif (!opts.preserve && isEmptyParent(rule) && !isBlockIgnored(rule)) {\n\t\t\t\trule.remove();\n\t\t\t}\n\t\t}\n\t});\n\n\t// return all custom properties, preferring :root properties over html properties\n\treturn { ...customPropertiesFromHtmlElement, ...customPropertiesFromRootPseudo };\n}\n\n// match html and :root rules\nconst htmlSelectorRegExp = /^html$/i;\nconst rootSelectorRegExp = /^:root$/i;\nconst customPropertyRegExp = /^--[A-z][\\w-]*$/;\n\n// whether the node is an html or :root rule\nconst isHtmlRule = node => node.type === 'rule' && htmlSelectorRegExp.test(node.selector) && Object(node.nodes).length;\nconst isRootRule = node => node.type === 'rule' && rootSelectorRegExp.test(node.selector) && Object(node.nodes).length;\n\n// whether the node is an custom property\nconst isCustomDecl = node => node.type === 'decl' && customPropertyRegExp.test(node.prop);\n\n// whether the node is a parent without children\nconst isEmptyParent = node => Object(node.nodes).length === 0;\n","import fs from 'fs';\nimport path from 'path';\nimport postcss from 'postcss';\nimport { parse } from './postcss-values-parser';\nimport getCustomPropertiesFromRoot from './get-custom-properties-from-root';\n\n/* Get Custom Properties from CSS File\n/* ========================================================================== */\n\nasync function getCustomPropertiesFromCSSFile(from) {\n\tconst css = await readFile(from);\n\tconst root = postcss.parse(css, { from });\n\n\treturn getCustomPropertiesFromRoot(root, { preserve: true });\n}\n\n/* Get Custom Properties from Object\n/* ========================================================================== */\n\nfunction getCustomPropertiesFromObject(object) {\n\tconst customProperties = Object.assign(\n\t\t{},\n\t\tObject(object).customProperties,\n\t\tObject(object)['custom-properties']\n\t);\n\n\tfor (const key in customProperties) {\n\t\tcustomProperties[key] = parse(String(customProperties[key])).nodes;\n\t}\n\n\treturn customProperties;\n}\n\n/* Get Custom Properties from JSON file\n/* ========================================================================== */\n\nasync function getCustomPropertiesFromJSONFile(from) {\n\tconst object = await readJSON(from);\n\n\treturn getCustomPropertiesFromObject(object);\n}\n\n/* Get Custom Properties from JS file\n/* ========================================================================== */\n\nasync function getCustomPropertiesFromJSFile(from) {\n\tconst object = await import(from);\n\n\treturn getCustomPropertiesFromObject(object);\n}\n\n/* Get Custom Properties from Imports\n/* ========================================================================== */\n\nexport default function getCustomPropertiesFromImports(sources) {\n\treturn sources.map(source => {\n\t\tif (source instanceof Promise) {\n\t\t\treturn source;\n\t\t} else if (source instanceof Function) {\n\t\t\treturn source();\n\t\t}\n\n\t\t// read the source as an object\n\t\tconst opts = source === Object(source) ? source : { from: String(source) };\n\n\t\t// skip objects with Custom Properties\n\t\tif (opts.customProperties || opts['custom-properties']) {\n\t\t\treturn opts\n\t\t}\n\n\t\t// source pathname\n\t\tconst from = path.resolve(String(opts.from || ''));\n\n\t\t// type of file being read from\n\t\tconst type = (opts.type || path.extname(from).slice(1)).toLowerCase();\n\n\t\treturn { type, from };\n\t}).reduce(async (customProperties, source) => {\n\t\tconst { type, from } = await source;\n\n\t\tif (type === 'css') {\n\t\t\treturn Object.assign(await customProperties, await getCustomPropertiesFromCSSFile(from));\n\t\t}\n\n\t\tif (type === 'js') {\n\t\t\treturn Object.assign(await customProperties, await getCustomPropertiesFromJSFile(from));\n\t\t}\n\n\t\tif (type === 'json') {\n\t\t\treturn Object.assign(await customProperties, await getCustomPropertiesFromJSONFile(from));\n\t\t}\n\n\t\treturn Object.assign(await customProperties, await getCustomPropertiesFromObject(await source));\n\t}, {});\n}\n\n/* Helper utilities\n/* ========================================================================== */\n\nconst readFile = from => new Promise((resolve, reject) => {\n\tfs.readFile(from, 'utf8', (error, result) => {\n\t\tif (error) {\n\t\t\treject(error);\n\t\t} else {\n\t\t\tresolve(result);\n\t\t}\n\t});\n});\n\nconst readJSON = async from => JSON.parse(await readFile(from));\n","export default function transformValueAST(root, customProperties) {\n\tif (root.nodes && root.nodes.length) {\n\t\troot.nodes.slice().forEach(child => {\n\t\t\tif (isVarFunction(child)) {\n\t\t\t\t// eslint-disable-next-line no-unused-vars\n\t\t\t\tconst [propertyNode, comma, ...fallbacks] = child.nodes.slice(1, -1);\n\t\t\t\tconst { value: name } = propertyNode;\n\n\t\t\t\tif (name in Object(customProperties)) {\n\t\t\t\t\t// conditionally replace a known custom property\n\t\t\t\t\tconst nodes = asClonedArrayWithBeforeSpacing(customProperties[name], child.raws.before);\n\n\t\t\t\t\tchild.replaceWith(...nodes);\n\n\t\t\t\t\tretransformValueAST({ nodes }, customProperties, name);\n\t\t\t\t} else if (fallbacks.length) {\n\t\t\t\t\t// conditionally replace a custom property with a fallback\n\t\t\t\t\tconst index = root.nodes.indexOf(child);\n\n\t\t\t\t\tif (index !== -1) {\n\t\t\t\t\t\troot.nodes.splice(index, 1, ...asClonedArrayWithBeforeSpacing(fallbacks, child.raws.before));\n\t\t\t\t\t}\n\n\t\t\t\t\ttransformValueAST(root, customProperties);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttransformValueAST(child, customProperties);\n\t\t\t}\n\t\t});\n\t}\n\n\treturn root;\n}\n\n// retransform the current ast without a custom property (to prevent recursion)\nfunction retransformValueAST(root, customProperties, withoutProperty) {\n\tconst nextCustomProperties = Object.assign({}, customProperties);\n\n\tdelete nextCustomProperties[withoutProperty];\n\n\treturn transformValueAST(root, nextCustomProperties);\n}\n\n// match var() functions\nconst varRegExp = /^var$/i;\n\n// whether the node is a var() function\nconst isVarFunction = node => node.type === 'func' && varRegExp.test(node.value) && Object(node.nodes).length > 0;\n\n// return an array with its nodes cloned, preserving the raw\nconst asClonedArrayWithBeforeSpacing = (array, beforeSpacing) => {\n\tconst clonedArray = asClonedArray(array, null);\n\n\tif (clonedArray[0]) {\n\t\tclonedArray[0].raws.before = beforeSpacing;\n\t}\n\n\treturn clonedArray;\n};\n\n// return an array with its nodes cloned\nconst asClonedArray = (array, parent) => array.map(node => asClonedNode(node, parent));\n\n// return a cloned node\nconst asClonedNode = (node, parent) => {\n\tconst cloneNode = new node.constructor(node);\n\n\tfor (const key in node) {\n\t\tif (key === 'parent') {\n\t\t\tcloneNode.parent = parent;\n\t\t} else if (Object(node[key]).constructor === Array) {\n\t\t\tcloneNode[key] = asClonedArray(node.nodes, cloneNode);\n\t\t} else if (Object(node[key]).constructor === Object) {\n\t\t\tcloneNode[key] = Object.assign({}, node[key]);\n\t\t}\n\t}\n\n\treturn cloneNode;\n};\n","import { parse } from './postcss-values-parser';\nimport transformValueAST from './transform-value-ast';\nimport { isRuleIgnored } from './is-ignored';\n\n// transform custom pseudo selectors with custom selectors\nexport default (root, customProperties, opts) => {\n\t// walk decls that can be transformed\n\troot.walkDecls(decl => {\n\t\tif (isTransformableDecl(decl) && !isRuleIgnored(decl)) {\n\t\t\tconst originalValue = decl.value;\n\t\t\tconst valueAST = parse(originalValue);\n\t\t\tconst value = String(transformValueAST(valueAST, customProperties));\n\n\t\t\t// conditionally transform values that have changed\n\t\t\tif (value !== originalValue) {\n\t\t\t\tif (opts.preserve) {\n\t\t\t\t\tdecl.cloneBefore({ value });\n\t\t\t\t} else {\n\t\t\t\t\tdecl.value = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n};\n\n// match custom properties\nconst customPropertyRegExp = /^--[A-z][\\w-]*$/;\n\n// match custom property inclusions\nconst customPropertiesRegExp = /(^|[^\\w-])var\\([\\W\\w]+\\)/;\n\n// whether the declaration should be potentially transformed\nconst isTransformableDecl = decl => !customPropertyRegExp.test(decl.prop) && customPropertiesRegExp.test(decl.value);\n","import fs from 'fs';\nimport path from 'path';\n\n/* Write Custom Properties to CSS File\n/* ========================================================================== */\n\nasync function writeCustomPropertiesToCssFile(to, customProperties) {\n\tconst cssContent = Object.keys(customProperties).reduce((cssLines, name) => {\n\t\tcssLines.push(`\\t${name}: ${customProperties[name]};`);\n\n\t\treturn cssLines;\n\t}, []).join('\\n');\n\tconst css = `:root {\\n${cssContent}\\n}\\n`;\n\n\tawait writeFile(to, css);\n}\n\n/* Write Custom Properties to JSON file\n/* ========================================================================== */\n\nasync function writeCustomPropertiesToJsonFile(to, customProperties) {\n\tconst jsonContent = JSON.stringify({\n\t\t'custom-properties': customProperties\n\t}, null, ' ');\n\tconst json = `${jsonContent}\\n`;\n\n\tawait writeFile(to, json);\n}\n\n/* Write Custom Properties to Common JS file\n/* ========================================================================== */\n\nasync function writeCustomPropertiesToCjsFile(to, customProperties) {\n\tconst jsContents = Object.keys(customProperties).reduce((jsLines, name) => {\n\t\tjsLines.push(`\\t\\t'${escapeForJS(name)}': '${escapeForJS(customProperties[name])}'`);\n\n\t\treturn jsLines;\n\t}, []).join(',\\n');\n\tconst js = `module.exports = {\\n\\tcustomProperties: {\\n${jsContents}\\n\\t}\\n};\\n`;\n\n\tawait writeFile(to, js);\n}\n\n/* Write Custom Properties to Module JS file\n/* ========================================================================== */\n\nasync function writeCustomPropertiesToMjsFile(to, customProperties) {\n\tconst mjsContents = Object.keys(customProperties).reduce((mjsLines, name) => {\n\t\tmjsLines.push(`\\t'${escapeForJS(name)}': '${escapeForJS(customProperties[name])}'`);\n\n\t\treturn mjsLines;\n\t}, []).join(',\\n');\n\tconst mjs = `export const customProperties = {\\n${mjsContents}\\n};\\n`;\n\n\tawait writeFile(to, mjs);\n}\n\n/* Write Custom Properties to Exports\n/* ========================================================================== */\n\nexport default function writeCustomPropertiesToExports(customProperties, destinations) {\n\treturn Promise.all(destinations.map(async destination => {\n\t\tif (destination instanceof Function) {\n\t\t\tawait destination(defaultCustomPropertiesToJSON(customProperties));\n\t\t} else {\n\t\t\t// read the destination as an object\n\t\t\tconst opts = destination === Object(destination) ? destination : { to: String(destination) };\n\n\t\t\t// transformer for Custom Properties into a JSON-compatible object\n\t\t\tconst toJSON = opts.toJSON || defaultCustomPropertiesToJSON;\n\n\t\t\tif ('customProperties' in opts) {\n\t\t\t\t// write directly to an object as customProperties\n\t\t\t\topts.customProperties = toJSON(customProperties);\n\t\t\t} else if ('custom-properties' in opts) {\n\t\t\t\t// write directly to an object as custom-properties\n\t\t\t\topts['custom-properties'] = toJSON(customProperties);\n\t\t\t} else {\n\t\t\t\t// destination pathname\n\t\t\t\tconst to = String(opts.to || '');\n\n\t\t\t\t// type of file being written to\n\t\t\t\tconst type = (opts.type || path.extname(opts.to).slice(1)).toLowerCase();\n\n\t\t\t\t// transformed Custom Properties\n\t\t\t\tconst customPropertiesJSON = toJSON(customProperties);\n\n\t\t\t\tif (type === 'css') {\n\t\t\t\t\tawait writeCustomPropertiesToCssFile(to, customPropertiesJSON);\n\t\t\t\t}\n\n\t\t\t\tif (type === 'js') {\n\t\t\t\t\tawait writeCustomPropertiesToCjsFile(to, customPropertiesJSON);\n\t\t\t\t}\n\n\t\t\t\tif (type === 'json') {\n\t\t\t\t\tawait writeCustomPropertiesToJsonFile(to, customPropertiesJSON);\n\t\t\t\t}\n\n\t\t\t\tif (type === 'mjs') {\n\t\t\t\t\tawait writeCustomPropertiesToMjsFile(to, customPropertiesJSON);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}));\n}\n\n/* Helper utilities\n/* ========================================================================== */\n\nconst defaultCustomPropertiesToJSON = customProperties => {\n\treturn Object.keys(customProperties).reduce((customPropertiesJSON, key) => {\n\t\tcustomPropertiesJSON[key] = String(customProperties[key]);\n\n\t\treturn customPropertiesJSON;\n\t}, {});\n};\n\nconst writeFile = (to, text) => new Promise((resolve, reject) => {\n\tfs.writeFile(to, text, error => {\n\t\tif (error) {\n\t\t\treject(error);\n\t\t} else {\n\t\t\tresolve();\n\t\t}\n\t});\n});\n\nconst escapeForJS = string => string.replace(/\\\\([\\s\\S])|(')/g, '\\\\$1$2').replace(/\\n/g, '\\\\n').replace(/\\r/g, '\\\\r');\n","import postcss from 'postcss';\nimport getCustomPropertiesFromRoot from './lib/get-custom-properties-from-root';\nimport getCustomPropertiesFromImports from './lib/get-custom-properties-from-imports';\nimport transformProperties from './lib/transform-properties';\nimport writeCustomPropertiesToExports from './lib/write-custom-properties-to-exports';\n\nexport default postcss.plugin('postcss-custom-properties', opts => {\n\t// whether to preserve custom selectors and rules using them\n\tconst preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;\n\n\t// sources to import custom selectors from\n\tconst importFrom = [].concat(Object(opts).importFrom || []);\n\n\t// destinations to export custom selectors to\n\tconst exportTo = [].concat(Object(opts).exportTo || []);\n\n\t// promise any custom selectors are imported\n\tconst customPropertiesPromise = getCustomPropertiesFromImports(importFrom);\n\n\t// synchronous transform\n\tconst syncTransform = root => {\n\t\tconst customProperties = getCustomPropertiesFromRoot(root, { preserve });\n\n\t\ttransformProperties(root, customProperties, { preserve });\n\t};\n\n\t// asynchronous transform\n\tconst asyncTransform = async root => {\n\t\tconst customProperties = Object.assign(\n\t\t\t{},\n\t\t\tawait customPropertiesPromise,\n\t\t\tgetCustomPropertiesFromRoot(root, { preserve })\n\t\t);\n\n\t\tawait writeCustomPropertiesToExports(customProperties, exportTo);\n\n\t\ttransformProperties(root, customProperties, { preserve });\n\t};\n\n\t// whether to return synchronous function if no asynchronous operations are requested\n\tconst canReturnSyncFunction = importFrom.length === 0 && exportTo.length === 0;\n\n\treturn canReturnSyncFunction ? syncTransform : asyncTransform;\n});\n"],"names":["parse","string","valueParser","isBlockIgnored","ruleOrDeclaration","rule","selector","parent","test","toString","isRuleIgnored","previous","prev","Boolean","type","text","getCustomPropertiesFromRoot","root","opts","customPropertiesFromHtmlElement","customPropertiesFromRootPseudo","nodes","slice","forEach","customPropertiesObject","isHtmlRule","isRootRule","decl","isCustomDecl","prop","value","preserve","remove","isEmptyParent","htmlSelectorRegExp","rootSelectorRegExp","customPropertyRegExp","node","Object","length","getCustomPropertiesFromCSSFile","from","css","readFile","postcss","getCustomPropertiesFromObject","object","customProperties","assign","key","String","getCustomPropertiesFromJSONFile","readJSON","getCustomPropertiesFromJSFile","getCustomPropertiesFromImports","sources","map","source","Promise","Function","path","resolve","extname","toLowerCase","reduce","reject","fs","error","result","JSON","transformValueAST","child","isVarFunction","propertyNode","comma","fallbacks","name","asClonedArrayWithBeforeSpacing","raws","before","replaceWith","retransformValueAST","index","indexOf","splice","withoutProperty","nextCustomProperties","varRegExp","array","beforeSpacing","clonedArray","asClonedArray","asClonedNode","cloneNode","constructor","Array","walkDecls","isTransformableDecl","originalValue","valueAST","cloneBefore","customPropertiesRegExp","writeCustomPropertiesToCssFile","to","cssContent","keys","cssLines","push","join","writeFile","writeCustomPropertiesToJsonFile","jsonContent","stringify","json","writeCustomPropertiesToCjsFile","jsContents","jsLines","escapeForJS","js","writeCustomPropertiesToMjsFile","mjsContents","mjsLines","mjs","writeCustomPropertiesToExports","destinations","all","destination","defaultCustomPropertiesToJSON","toJSON","customPropertiesJSON","replace","plugin","importFrom","concat","exportTo","customPropertiesPromise","syncTransform","transformProperties","asyncTransform","canReturnSyncFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,SAASA,KAAT,CAAgBC,MAAhB,EAAwB;SACvBC,WAAW,CAACD,MAAD,CAAX,CAAoBD,KAApB,EAAP;;;ACHD,SAASG,cAAT,CAAwBC,iBAAxB,EAA2C;MACtCC,IAAI,GAAGD,iBAAiB,CAACE,QAAlB,GACVF,iBADU,GACUA,iBAAiB,CAACG,MADvC;SAGO,6CAA6CC,IAA7C,CAAkDH,IAAI,CAACI,QAAL,EAAlD,CAAP;;;AAGD,SAASC,aAAT,CAAuBL,IAAvB,EAA6B;MACxBM,QAAQ,GAAGN,IAAI,CAACO,IAAL,EAAf;SAEOC,OAAO,CAACV,cAAc,CAACE,IAAD,CAAd,IACdM,QAAQ,IACRA,QAAQ,CAACG,IAAT,KAAkB,SADlB,IAEA,uDAAuDN,IAAvD,CAA4DG,QAAQ,CAACI,IAArE,CAHa,CAAd;;;ACNc,SAASC,2BAAT,CAAqCC,IAArC,EAA2CC,IAA3C,EAAiD;;QAEzDC,+BAA+B,GAAG,EAAxC;QACMC,8BAA8B,GAAG,EAAvC,CAH+D;;EAM/DH,IAAI,CAACI,KAAL,CAAWC,KAAX,GAAmBC,OAAnB,CAA2Bl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