diff options
author | Dimitri Staessens <[email protected]> | 2019-10-06 21:37:45 +0200 |
---|---|---|
committer | Dimitri Staessens <[email protected]> | 2019-10-06 21:37:45 +0200 |
commit | 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 (patch) | |
tree | c7ccc8279b12c4f7bdbbb4270d617e48f51722e4 /node_modules/postcss/lib/postcss.js | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/postcss/lib/postcss.js')
-rw-r--r-- | node_modules/postcss/lib/postcss.js | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/node_modules/postcss/lib/postcss.js b/node_modules/postcss/lib/postcss.js new file mode 100644 index 0000000..86eb7fe --- /dev/null +++ b/node_modules/postcss/lib/postcss.js @@ -0,0 +1,292 @@ +'use strict'; + +exports.__esModule = true; + +var _declaration = require('./declaration'); + +var _declaration2 = _interopRequireDefault(_declaration); + +var _processor = require('./processor'); + +var _processor2 = _interopRequireDefault(_processor); + +var _stringify = require('./stringify'); + +var _stringify2 = _interopRequireDefault(_stringify); + +var _comment = require('./comment'); + +var _comment2 = _interopRequireDefault(_comment); + +var _atRule = require('./at-rule'); + +var _atRule2 = _interopRequireDefault(_atRule); + +var _vendor = require('./vendor'); + +var _vendor2 = _interopRequireDefault(_vendor); + +var _parse = require('./parse'); + +var _parse2 = _interopRequireDefault(_parse); + +var _list = require('./list'); + +var _list2 = _interopRequireDefault(_list); + +var _rule = require('./rule'); + +var _rule2 = _interopRequireDefault(_rule); + +var _root = require('./root'); + +var _root2 = _interopRequireDefault(_root); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Create a new {@link Processor} instance that will apply `plugins` + * as CSS processors. + * + * @param {Array.<Plugin|pluginFunction>|Processor} plugins - PostCSS + * plugins. See {@link Processor#use} for plugin format. + * + * @return {Processor} Processor to process multiple CSS + * + * @example + * import postcss from 'postcss'; + * + * postcss(plugins).process(css, { from, to }).then(result => { + * console.log(result.css); + * }); + * + * @namespace postcss + */ +function postcss() { + for (var _len = arguments.length, plugins = Array(_len), _key = 0; _key < _len; _key++) { + plugins[_key] = arguments[_key]; + } + + if (plugins.length === 1 && Array.isArray(plugins[0])) { + plugins = plugins[0]; + } + return new _processor2.default(plugins); +} + +/** + * Creates a PostCSS plugin with a standard API. + * + * The newly-wrapped function will provide both the name and PostCSS + * version of the plugin. + * + * ```js + * const processor = postcss([replace]); + * processor.plugins[0].postcssPlugin //=> 'postcss-replace' + * processor.plugins[0].postcssVersion //=> '5.1.0' + * ``` + * + * The plugin function receives 2 arguments: {@link Root} + * and {@link Result} instance. The function should mutate the provided + * `Root` node. Alternatively, you can create a new `Root` node + * and override the `result.root` property. + * + * ```js + * const cleaner = postcss.plugin('postcss-cleaner', () => { + * return (root, result) => { + * result.root = postcss.root(); + * }; + * }); + * ``` + * + * As a convenience, plugins also expose a `process` method so that you can use + * them as standalone tools. + * + * ```js + * cleaner.process(css, processOpts, pluginOpts); + * // This is equivalent to: + * postcss([ cleaner(pluginOpts) ]).process(css, processOpts); + * ``` + * + * Asynchronous plugins should return a `Promise` instance. + * + * ```js + * postcss.plugin('postcss-import', () => { + * return (root, result) => { + * return new Promise( (resolve, reject) => { + * fs.readFile('base.css', (base) => { + * root.prepend(base); + * resolve(); + * }); + * }); + * }; + * }); + * ``` + * + * Add warnings using the {@link Node#warn} method. + * Send data to other plugins using the {@link Result#messages} array. + * + * ```js + * postcss.plugin('postcss-caniuse-test', () => { + * return (root, result) => { + * root.walkDecls(decl => { + * if ( !caniuse.support(decl.prop) ) { + * decl.warn(result, 'Some browsers do not support ' + decl.prop); + * } + * }); + * }; + * }); + * ``` + * + * @param {string} name - PostCSS plugin name. Same as in `name` + * property in `package.json`. It will be saved + * in `plugin.postcssPlugin` property. + * @param {function} initializer - will receive plugin options + * and should return {@link pluginFunction} + * + * @return {Plugin} PostCSS plugin + */ +postcss.plugin = function plugin(name, initializer) { + var creator = function creator() { + var transformer = initializer.apply(undefined, arguments); + transformer.postcssPlugin = name; + transformer.postcssVersion = new _processor2.default().version; + return transformer; + }; + + var cache = void 0; + Object.defineProperty(creator, 'postcss', { + get: function get() { + if (!cache) cache = creator(); + return cache; + } + }); + + creator.process = function (css, processOpts, pluginOpts) { + return postcss([creator(pluginOpts)]).process(css, processOpts); + }; + + return creator; +}; + +/** + * Default function to convert a node tree into a CSS string. + * + * @param {Node} node - start node for stringifing. Usually {@link Root}. + * @param {builder} builder - function to concatenate CSS from node’s parts + * or generate string and source map + * + * @return {void} + * + * @function + */ +postcss.stringify = _stringify2.default; + +/** + * Parses source css and returns a new {@link Root} node, + * which contains the source CSS nodes. + * + * @param {string|toString} css - string with input CSS or any object + * with toString() method, like a Buffer + * @param {processOptions} [opts] - options with only `from` and `map` keys + * + * @return {Root} PostCSS AST + * + * @example + * // Simple CSS concatenation with source map support + * const root1 = postcss.parse(css1, { from: file1 }); + * const root2 = postcss.parse(css2, { from: file2 }); + * root1.append(root2).toResult().css; + * + * @function + */ +postcss.parse = _parse2.default; + +/** + * @member {vendor} - Contains the {@link vendor} module. + * + * @example + * postcss.vendor.unprefixed('-moz-tab') //=> ['tab'] + */ +postcss.vendor = _vendor2.default; + +/** + * @member {list} - Contains the {@link list} module. + * + * @example + * postcss.list.space('5px calc(10% + 5px)') //=> ['5px', 'calc(10% + 5px)'] + */ +postcss.list = _list2.default; + +/** + * Creates a new {@link Comment} node. + * + * @param {object} [defaults] - properties for the new node. + * + * @return {Comment} new Comment node + * + * @example + * postcss.comment({ text: 'test' }) + */ +postcss.comment = function (defaults) { + return new _comment2.default(defaults); +}; + +/** + * Creates a new {@link AtRule} node. + * + * @param {object} [defaults] - properties for the new node. + * + * @return {AtRule} new AtRule node + * + * @example + * postcss.atRule({ name: 'charset' }).toString() //=> "@charset" + */ +postcss.atRule = function (defaults) { + return new _atRule2.default(defaults); +}; + +/** + * Creates a new {@link Declaration} node. + * + * @param {object} [defaults] - properties for the new node. + * + * @return {Declaration} new Declaration node + * + * @example + * postcss.decl({ prop: 'color', value: 'red' }).toString() //=> "color: red" + */ +postcss.decl = function (defaults) { + return new _declaration2.default(defaults); +}; + +/** + * Creates a new {@link Rule} node. + * + * @param {object} [defaults] - properties for the new node. + * + * @return {Rule} new Rule node + * + * @example + * postcss.rule({ selector: 'a' }).toString() //=> "a {\n}" + */ +postcss.rule = function (defaults) { + return new _rule2.default(defaults); +}; + +/** + * Creates a new {@link Root} node. + * + * @param {object} [defaults] - properties for the new node. + * + * @return {Root} new Root node + * + * @example + * postcss.root({ after: '\n' }).toString() //=> "\n" + */ +postcss.root = function (defaults) { + return new _root2.default(defaults); +}; + +exports.default = postcss; +module.exports = exports['default']; +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBvc3Rjc3MuZXM2Il0sIm5hbWVzIjpbInBvc3Rjc3MiLCJwbHVnaW5zIiwibGVuZ3RoIiwiQXJyYXkiLCJpc0FycmF5IiwiUHJvY2Vzc29yIiwicGx1Z2luIiwibmFtZSIsImluaXRpYWxpemVyIiwiY3JlYXRvciIsInRyYW5zZm9ybWVyIiwicG9zdGNzc1BsdWdpbiIsInBvc3Rjc3NWZXJzaW9uIiwidmVyc2lvbiIsImNhY2hlIiwiT2JqZWN0IiwiZGVmaW5lUHJvcGVydHkiLCJnZXQiLCJwcm9jZXNzIiwiY3NzIiwicHJvY2Vzc09wdHMiLCJwbHVnaW5PcHRzIiwic3RyaW5naWZ5IiwicGFyc2UiLCJ2ZW5kb3IiLCJsaXN0IiwiY29tbWVudCIsIkNvbW1lbnQiLCJkZWZhdWx0cyIsImF0UnVsZSIsIkF0UnVsZSIsImRlY2wiLCJEZWNsYXJhdGlvbiIsInJ1bGUiLCJSdWxlIiwicm9vdCIsIlJvb3QiXSwibWFwcGluZ3MiOiI7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Jlc29sdmUsIHJlamVjdCkgPT4ge1xuICogICAgICAgZnMucmVhZEZpbGUoJ2Jhc2UuY3NzJywgKGJhc2UpID0+IHtcbiAqICAgICAgICAgcm9vdC5wcmVwZW5kKGJhc2UpO1xuICogICAgICAgICByZXNvbHZlKCk7XG4gKiAgICAgICB9KTtcbiAqICAgICB9KTtcbiAqICAgfTtcbiAqIH0pO1xuICogYGBgXG4gKlxuICogQWRkIHdhcm5pbmdzIHVzaW5nIHRoZSB7QGxpbmsgTm9kZSN3YXJufSBtZXRob2QuXG4gKiBTZW5kIGRhdGEgdG8gb3RoZXIgcGx1Z2lucyB1c2luZyB0aGUge0BsaW5rIFJlc3VsdCNtZXNzYWdlc30gYXJyYXkuXG4gKlxuICogYGBganNcbiAqIHBvc3Rjc3MucGx1Z2luKCdwb3N0Y3NzLWNhbml1c2UtdGVzdCcsICgpID0+IHtcbiAqICAgcmV0dXJuIChyb290LCByZXN1bHQpID0+IHtcbiAqICAgICByb290LndhbGtEZWNscyhkZWNsID0+IHtcbiAqICAgICAgIGlmICggIWNhbml1c2Uuc3VwcG9ydChkZWNsLnByb3ApICkge1xuICogICAgICAgICBkZWNsLndhcm4ocmVzdWx0LCAnU29tZSBicm93c2VycyBkbyBub3Qgc3VwcG9ydCAnICsgZGVjbC5wcm9wKTtcbiAqICAgICAgIH1cbiAqICAgICB9KTtcbiAqICAgfTtcbiAqIH0pO1xuICogYGBgXG4gKlxuICogQHBhcmFtIHtzdHJpbmd9IG5hbWUgICAgICAgICAgLSBQb3N0Q1NTIHBsdWdpbiBuYW1lLiBTYW1lIGFzIGluIGBuYW1lYFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9wZXJ0eSBpbiBgcGFja2FnZS5qc29uYC4gSXQgd2lsbCBiZSBzYXZlZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpbiBgcGx1Z2luLnBvc3Rjc3NQbHVnaW5gIHByb3BlcnR5LlxuICogQHBhcmFtIHtm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