{"version":3,"file":"index.cjs","sources":["../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":["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 valuesParser from 'postcss-value-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] = valuesParser(decl.value);\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' && node.selector.split(',').some(item => htmlSelectorRegExp.test(item)) && Object(node.nodes).length;\nconst isRootRule = node => node.type === 'rule' && node.selector.split(',').some(item => rootSelectorRegExp.test(item)) && 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 { parse } from 'postcss';\nimport valuesParser from 'postcss-value-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 = 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] = valuesParser(String(customProperties[key]));\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' || type === 'pcss') {\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\tconst [propertyNode, ...fallbacks] = child.nodes.filter((node) => node.type !== 'div');\n\t\t\t\tconst { value: name } = propertyNode;\n\t\t\t\tconst index = root.nodes.indexOf(child);\n\n\t\t\t\tif (name in Object(customProperties)) {\n\t\t\t\t\t// Direct match of a custom property to a parsed value\n\t\t\t\t\tconst nodes = customProperties[name].nodes;\n\n\t\t\t\t\t// Re-transform nested properties without given one to avoid circular from keeping this forever\n\t\t\t\t\tretransformValueAST({ nodes }, customProperties, name);\n\n\t\t\t\t\tif (index > -1) {\n\t\t\t\t\t\troot.nodes.splice(index, 1, ...nodes);\n\t\t\t\t\t}\n\t\t\t\t} else if (fallbacks.length) {\n\t\t\t\t\t// No match, but fallback available\n\t\t\t\t\tif (index > -1) {\n\t\t\t\t\t\troot.nodes.splice(index, 1, ...fallbacks);\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\t// Transform child nodes of current child\n\t\t\t\ttransformValueAST(child, customProperties);\n\t\t\t}\n\t\t});\n\t}\n\n\treturn root.toString();\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 === 'function' && varRegExp.test(node.value) && Object(node.nodes).length > 0;\n","import valuesParser from 'postcss-value-parser';\nimport transformValueAST from './transform-value-ast';\nimport { isRuleIgnored } from './is-ignored';\n\n// transform custom pseudo selectors with custom selectors\nexport default (decl, customProperties, opts) => {\n\tif (isTransformableDecl(decl) && !isRuleIgnored(decl)) {\n\t\tconst originalValue = decl.value;\n\t\tconst valueAST = valuesParser(originalValue);\n\t\tlet value = transformValueAST(valueAST, customProperties);\n\n\t\t// protect against circular references\n\t\tconst valueSet = new Set();\n\n\t\twhile (customPropertiesRegExp.test(value) && !valueSet.has(value)) {\n\t\t\tvalueSet.add(value);\n\t\t\tconst parsedValueAST = valuesParser(value);\n\t\t\tvalue = transformValueAST(parsedValueAST, customProperties);\n\t\t}\n\n\t\t// conditionally transform values that have changed\n\t\tif (value !== originalValue) {\n\t\t\tif (opts.preserve) {\n\t\t\t\tconst beforeDecl = decl.cloneBefore({ value });\n\n\t\t\t\tif (hasTrailingComment(beforeDecl)) {\n\t\t\t\t\tbeforeDecl.raws.value.value = beforeDecl.value.replace(trailingCommentRegExp, '$1');\n\t\t\t\t\tbeforeDecl.raws.value.raw = beforeDecl.raws.value.value + beforeDecl.raws.value.raw.replace(trailingCommentRegExp, '$2');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdecl.value = value;\n\n\t\t\t\tif (hasTrailingComment(decl)) {\n\t\t\t\t\tdecl.raws.value.value = decl.value.replace(trailingCommentRegExp, '$1');\n\t\t\t\t\tdecl.raws.value.raw = decl.raws.value.value + decl.raws.value.raw.replace(trailingCommentRegExp, '$2');\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\n// whether the declaration has a trailing comment\nconst hasTrailingComment = decl => 'value' in Object(Object(decl.raws).value) && 'raw' in decl.raws.value && trailingCommentRegExp.test(decl.raws.value.raw);\nconst trailingCommentRegExp = /^([\\W\\w]+)(\\s*\\/\\*[\\W\\w]+?\\*\\/)$/;\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 SCSS File\n/* ========================================================================== */\n\nasync function writeCustomPropertiesToScssFile(to, customProperties) {\n\tconst scssContent = Object.keys(customProperties).reduce((scssLines, name) => {\n\t\tconst scssName = name.replace('--', '$');\n\t\tscssLines.push(`${scssName}: ${customProperties[name]};`);\n\n\t\treturn scssLines;\n\t}, []).join('\\n');\n\tconst scss = `${scssContent}\\n`;\n\n\tawait writeFile(to, scss);\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 === 'scss') {\n\t\t\t\t\tawait writeCustomPropertiesToScssFile(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\tconst valueNodes = customProperties[key];\n\t\tcustomPropertiesJSON[key] = valueNodes.toString();\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 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\nconst creator = 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\tlet customProperties;\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 {\n\t\tpostcssPlugin: 'postcss-custom-properties',\n\t\tprepare ({ root }) {\n\t\t\tif (canReturnSyncFunction) {\n\t\t\t\tcustomProperties = getCustomPropertiesFromRoot(root, { preserve });\n\n\t\t\t\treturn {\n\t\t\t\t\tDeclaration: (decl) => transformProperties(decl, customProperties, { preserve }),\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tOnce: async root => {\n\t\t\t\t\t\tcustomProperties = Object.assign(\n\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\tgetCustomPropertiesFromRoot(root, { preserve }),\n\t\t\t\t\t\t\tawait customPropertiesPromise,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tawait writeCustomPropertiesToExports(customProperties, exportTo);\n\t\t\t\t\t},\n\t\t\t\t\tDeclaration: (decl) => transformProperties(decl, customProperties, { preserve }),\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t};\n};\n\ncreator.postcss = true;\n\nexport default creator;\n"],"names":["isBlockIgnored","ruleOrDeclaration","rule","selector","parent","test","toString","getCustomPropertiesFromRoot","root","opts","customPropertiesFromHtmlElement","customPropertiesFromRootPseudo","nodes","slice","forEach","customPropertiesObject","isHtmlRule","isRootRule","decl","isCustomDecl","prop","valuesParser","value","preserve","remove","isEmptyParent","htmlSelectorRegExp","rootSelectorRegExp","customPropertyRegExp","node","type","split","some","item","Object","length","getCustomPropertiesFromObject","object","customProperties","assign","key","String","getCustomPropertiesFromImports","sources","map","source","Promise","Function","from","path","resolve","extname","toLowerCase","reduce","async","css","readFile","parse","getCustomPropertiesFromCSSFile","getCustomPropertiesFromJSFile","readJSON","getCustomPropertiesFromJSONFile","reject","fs","error","result","JSON","transformValueAST","child","isVarFunction","propertyNode","fallbacks","filter","name","index","indexOf","withoutProperty","nextCustomProperties","retransformValueAST","splice","varRegExp","isTransformableDecl","previous","prev","Boolean","text","originalValue","valueSet","Set","customPropertiesRegExp","has","add","beforeDecl","cloneBefore","hasTrailingComment","raws","replace","trailingCommentRegExp","raw","writeCustomPropertiesToExports","destinations","all","destination","defaultCustomPropertiesToJSON","to","toJSON","customPropertiesJSON","keys","cssLines","push","join","writeFile","writeCustomPropertiesToCssFile","scss","scssLines","scssName","writeCustomPropertiesToScssFile","js","jsLines","escapeForJS","writeCustomPropertiesToCjsFile","json","stringify","writeCustomPropertiesToJsonFile","mjs","mjsLines","writeCustomPropertiesToMjsFile","valueNodes","string","creator","importFrom","concat","exportTo","customPropertiesPromise","canReturnSyncFunction","postcssPlugin","prepare","Declaration","transformProperties","Once","postcss"],"mappings":"0eAAA,SAASA,EAAeC,OACnBC,EAAOD,EAAkBE,SAC5BF,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