PHP 7.4.33
Preview: index.js Size: 1.18 KB
/var/www/cookieconsent.bitkit.dk/httpdocs/node_modules/postcss-calc/src/index.js
'use strict';
const transform = require('./lib/transform.js');

/**
 * @typedef {{precision?: number | false,
 *          preserve?: boolean,
 *          warnWhenCannotResolve?: boolean,
 *          mediaQueries?: boolean,
 *          selectors?: boolean}} PostCssCalcOptions
 */
/**
 * @type {import('postcss').PluginCreator<PostCssCalcOptions>}
 * @param {PostCssCalcOptions} opts
 * @return {import('postcss').Plugin}
 */
function pluginCreator(opts) {
  const options = Object.assign(
    {
      precision: 5,
      preserve: false,
      warnWhenCannotResolve: false,
      mediaQueries: false,
      selectors: false,
    },
    opts
  );

  return {
    postcssPlugin: 'postcss-calc',
    OnceExit(css, { result }) {
      css.walk((node) => {
        const { type } = node;
        if (type === 'decl') {
          transform(node, 'value', options, result);
        }

        if (type === 'atrule' && options.mediaQueries) {
          transform(node, 'params', options, result);
        }

        if (type === 'rule' && options.selectors) {
          transform(node, 'selector', options, result);
        }
      });
    },
  };
}

pluginCreator.postcss = true;

module.exports = pluginCreator;

Directory Contents

Dirs: 1 × Files: 3
Name Size Perms Modified Actions
lib DIR
- drwxr-xr-x 2025-06-16 05:45:39
Edit Download
1.18 KB lrw-r--r-- 2025-06-16 05:45:39
Edit Download
1.46 KB lrw-r--r-- 2025-06-16 05:45:40
Edit Download
130.44 KB lrw-r--r-- 2025-06-16 05:45:39
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).