{"version":3,"file":"index.mjs","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","import","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":"0GAAA,SAASA,EAAeC,OACnBC,EAAOD,EAAkBE,SAC5B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