From 3c51c3be85bb0d1bdb87ea0d6632f1c256912f27 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sun, 6 Oct 2019 21:37:45 +0200 Subject: build: Add some required modules for node --- node_modules/postcss-load-plugins/CHANGELOG.md | 37 ++++ node_modules/postcss-load-plugins/LICENSE | 21 ++ node_modules/postcss-load-plugins/README.md | 247 +++++++++++++++++++++++ node_modules/postcss-load-plugins/index.js | 63 ++++++ node_modules/postcss-load-plugins/lib/plugins.js | 84 ++++++++ node_modules/postcss-load-plugins/package.json | 96 +++++++++ 6 files changed, 548 insertions(+) create mode 100644 node_modules/postcss-load-plugins/CHANGELOG.md create mode 100644 node_modules/postcss-load-plugins/LICENSE create mode 100644 node_modules/postcss-load-plugins/README.md create mode 100644 node_modules/postcss-load-plugins/index.js create mode 100644 node_modules/postcss-load-plugins/lib/plugins.js create mode 100644 node_modules/postcss-load-plugins/package.json (limited to 'node_modules/postcss-load-plugins') diff --git a/node_modules/postcss-load-plugins/CHANGELOG.md b/node_modules/postcss-load-plugins/CHANGELOG.md new file mode 100644 index 0000000..3d7178f --- /dev/null +++ b/node_modules/postcss-load-plugins/CHANGELOG.md @@ -0,0 +1,37 @@ + +# [2.3.0](https://github.com/michael-ciniawsky/postcss-load-plugins/compare/v2.2.0...v2.3.0) (2017-02-13) + + +### Features + +* **index:** Allow extensions for .postcssrc ([65cc0d0](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/65cc0d0)) + + + + +# 2.2.0 (2017-01-11) + + +### Features + +* **index:** expose config file ([c643172](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/c643172)) +* **index:** improve error handling ([f3a4048](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/f3a4048)) +* **lib:** improve error handling ([a64bb03](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/a64bb03)) + + + + +# 2.1.0 (2016-12-05) + + +### Bug Fixes + +* **index:** set NODE_ENV if undefined ([920f806](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/920f806)) +* **index:** support node v0.12 ([e31fab3](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/e31fab3)) +* **lib/plugins:** support node v0.12 ([c440e6b](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/c440e6b)) +* **loadPlugins:** add object-assign polyfill ([acd3f84](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/acd3f84)) +* **plugins:** check for plugin.default ([024e8c7](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/024e8c7)) + +### Features + +* function support, jsdoc, cleanups ([f637d60](https://github.com/michael-ciniawsky/postcss-load-plugins/commit/f637d60)) diff --git a/node_modules/postcss-load-plugins/LICENSE b/node_modules/postcss-load-plugins/LICENSE new file mode 100644 index 0000000..d36964f --- /dev/null +++ b/node_modules/postcss-load-plugins/LICENSE @@ -0,0 +1,21 @@ +License (MIT) + +Copyright (c) Michael Ciniawsky + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/postcss-load-plugins/README.md b/node_modules/postcss-load-plugins/README.md new file mode 100644 index 0000000..b54c876 --- /dev/null +++ b/node_modules/postcss-load-plugins/README.md @@ -0,0 +1,247 @@ +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![tests][tests]][tests-url] +[![coverage][cover]][cover-url] +[![code style][style]][style-url] +[![chat][chat]][chat-url] + +
+ + + + +

Load Plugins

+
+ +

Install

+ +```bash +npm i -D postcss-load-plugins +``` + +

Usage

+ +``` +npm i -S|-D postcss-plugin +``` + +Install plugins and save them to your ***package.json*** dependencies/devDependencies. + +### `package.json` + +Create **`postcss`** section in your projects **`package.json`**. + +``` +App + |– client + |– public + | + |- package.json +``` + +```json +{ + "postcss": { + "plugins": { + "postcss-plugin": {} + } + } +} +``` + +### `.postcssrc` + +Create a **`.postcssrc`** file. + +``` +App + |– client + |– public + | + |- (.postcssrc|.postcssrc.json|.postcssrc.yaml) + |- package.json +``` + +**`JSON`** +```json +{ + "plugins": { + "postcss-plugin": {} + } +} +``` + +**`YAML`** +```yaml +plugins: + postcss-plugin: {} +``` + +### `postcss.config.js` or `.postcssrc.js` + +You may need some JavaScript logic to generate your config. For this case you can use a file named **`postcss.config.js`** or **`.postcssrc.js`**. + +``` +App + |– client + |– public + | + |- (postcss.config.js|.postcssrc.js) + |- package.json +``` + +Plugins can be loaded in either using an `{Object}` or an `{Array}`. + +##### `{Object}` + +```js +module.exports = (ctx) => ({ + plugins: { + 'postcss-plugin': ctx.plugin + } +}) +``` + +##### `{Array}` + +```js +module.exports = (ctx) => ({ + plugins: [ + require('postcss-plugin')(ctx.plugin) + ] +}) +``` + +

Options

+ +Plugin **options** can take the following values. + +**`{}`: Plugin loads with defaults** + +```js +'postcss-plugin': {} || null +``` + +> :warning: `{}` must be an **empty** object + +**`{Object}`: Plugin loads with options** + +```js +'postcss-plugin': { option: '', option: '' } +``` + +**`false`: Plugin will not be loaded** + +```js +'postcss-plugin': false +``` + +### Order + +Plugin **order** is determined by declaration in the plugins section. + +```js +{ + plugins: { + 'postcss-plugin': {}, // plugins[0] + 'postcss-plugin': {}, // plugins[1] + 'postcss-plugin': {} // plugins[2] + } +} +``` + +### Context + +When using a function `(postcss.config.js)`, it is possible to pass context to `postcss-load-plugins`, which will be evaluated before loading your plugins. By default `ctx.env (process.env.NODE_ENV)` and `ctx.cwd (process.cwd())` are available. + +

Examples

+ +**`postcss.config.js`** + +```js +module.exports = (ctx) => ({ + plugins: { + postcss-import: {}, + postcss-modules: ctx.modules ? {} : false, + cssnano: ctx.env === 'production' ? {} : false + } +}) +``` + +### + +```js +const { readFileSync } = require('fs') + +const postcss = require('postcss') +const pluginsrc = require('postcss-load-plugins') + +const css = readFileSync('index.css', 'utf8') + +const ctx = { modules: true } + +pluginsrc(ctx).then((plugins) => { + postcss(plugins) + .process(css) + .then((result) => console.log(result.css)) +}) +``` + +

Maintainers

+ + + + + + + + +
+ +
+ Michael Ciniawsky +
+ +
+ Mateusz Derks +
+ +

Contributors

+ + + + + + + +
+ +
+ Diogo Franco +
+ + +[npm]: https://img.shields.io/npm/v/postcss-load-plugins.svg +[npm-url]: https://npmjs.com/package/postcss-load-plugins + +[node]: https://img.shields.io/node/v/postcss-load-plugins.svg +[node-url]: https://nodejs.org/ + +[deps]: https://david-dm.org/michael-ciniawsky/postcss-load-plugins.svg +[deps-url]: https://david-dm.org/michael-ciniawsky/postcss-load-plugins + +[tests]: http://img.shields.io/travis/michael-ciniawsky/postcss-load-plugins.svg +[tests-url]: https://travis-ci.org/michael-ciniawsky/postcss-load-plugins + +[cover]: https://coveralls.io/repos/github/michael-ciniawsky/postcss-load-plugins/badge.svg +[cover-url]: https://coveralls.io/github/michael-ciniawsky/postcss-load-plugins + +[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg +[style-url]: http://standardjs.com/ + +[chat]: https://img.shields.io/gitter/room/postcss/postcss.svg +[chat-url]: https://gitter.im/postcss/postcss diff --git a/node_modules/postcss-load-plugins/index.js b/node_modules/postcss-load-plugins/index.js new file mode 100644 index 0000000..c10ea2c --- /dev/null +++ b/node_modules/postcss-load-plugins/index.js @@ -0,0 +1,63 @@ +// ------------------------------------ +// # POSTCSS - LOAD PLUGINS - INDEX +// ------------------------------------ + +'use strict' + +var resolve = require('path').resolve + +var config = require('cosmiconfig') +var assign = require('object-assign') + +var loadPlugins = require('./lib/plugins') + +/** + * Autoload Plugins for PostCSS + * + * @author Michael Ciniawsky (@michael-ciniawsky) + * @license MIT + * + * @module postcss-load-plugins + * @version 2.3.0 + * + * @requires cosmiconfig + * @requires object-assign + * @requires ./lib/plugins.js + * + * @method pluginsrc + * + * @param {Object} ctx Context + * @param {String} path Directory + * @param {Object} options Options + * + * @return {Array} config PostCSS Plugins + */ +module.exports = function pluginsrc (ctx, path, options) { + ctx = assign({ cwd: process.cwd(), env: process.env.NODE_ENV }, ctx) + + path = path ? resolve(path) : process.cwd() + + options = assign({ rcExtensions: true }, options) + + if (!ctx.env) process.env.NODE_ENV = 'development' + + var file + + return config('postcss', options) + .load(path) + .then(function (result) { + if (!result) throw new Error('No PostCSS Config found in: ' + path) + + file = result ? result.filepath : '' + + return result ? result.config : {} + }) + .then(function (plugins) { + if (typeof plugins === 'function') plugins = plugins(ctx) + else plugins = assign(plugins, ctx) + + if (!plugins.plugins) plugins.plugins = [] + + return { plugins: loadPlugins(plugins), file: file } + }) +} diff --git a/node_modules/postcss-load-plugins/lib/plugins.js b/node_modules/postcss-load-plugins/lib/plugins.js new file mode 100644 index 0000000..1cfcc2b --- /dev/null +++ b/node_modules/postcss-load-plugins/lib/plugins.js @@ -0,0 +1,84 @@ +// ------------------------------------ +// # POSTCSS - LOAD PLUGINS - PLUGINS +// ------------------------------------ + +'use strict' + +/** + * @method plugins + * + * @param {Object} config PostCSS Config + * + * @return {Array} plugins PostCSS Plugins + */ +module.exports = function plugins (config) { + var plugins = [] + + if (Array.isArray(config.plugins)) { + plugins = config.plugins.filter(Boolean) + + if (plugins.length && plugins.length > 0) { + plugins.forEach(function (plugin, i) { + if (!plugin) throw new Error('Loading PostCSS Plugin failed') + + if (plugin.postcss) plugin = plugin.postcss + + if (plugin.default) plugin = plugin.default + + if ( + !(typeof plugin === 'object' && Array.isArray(plugin.plugins) || + typeof plugin === 'function') + ) { + throw new TypeError('Invalid PostCSS Plugin found: ' + '[' + i + ']') + } + }) + } + + return plugins + } else { + config = config.plugins + + var load = function (plugin, options) { + if (options === null || Object.keys(options).length === 0) { + try { + return require(plugin) + } catch (err) { + err.message = 'Loading PostCSS Plugin failed: ' + err.message + + throw err + } + } else { + try { + return require(plugin)(options) + } catch (err) { + err.message = 'Loading PostCSS Plugin failed: ' + err.message + + throw err + } + } + } + + Object.keys(config) + .filter(function (plugin) { + return config[plugin] !== false ? plugin : '' + }) + .forEach(function (plugin, i) { + plugin = load(plugin, config[plugin]) + + if (plugin.postcss) plugin = plugin.postcss + + if (plugin.default) plugin = plugin.default + + if ( + !(typeof plugin === 'object' && Array.isArray(plugin.plugins) || + typeof plugin === 'function') + ) { + throw new TypeError('Invalid PostCSS Plugin found: ' + '[' + i + ']') + } + + return plugins.push(plugin) + }) + + return plugins + } +} diff --git a/node_modules/postcss-load-plugins/package.json b/node_modules/postcss-load-plugins/package.json new file mode 100644 index 0000000..bf4e9e5 --- /dev/null +++ b/node_modules/postcss-load-plugins/package.json @@ -0,0 +1,96 @@ +{ + "_args": [ + [ + "postcss-load-plugins@2.3.0", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "postcss-load-plugins@2.3.0", + "_id": "postcss-load-plugins@2.3.0", + "_inBundle": false, + "_integrity": "sha1-dFdoEWWZrKLwCfrUJrABdQSdjZI=", + "_location": "/postcss-load-plugins", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "postcss-load-plugins@2.3.0", + "name": "postcss-load-plugins", + "escapedName": "postcss-load-plugins", + "rawSpec": "2.3.0", + "saveSpec": null, + "fetchSpec": "2.3.0" + }, + "_requiredBy": [ + "/postcss-load-config" + ], + "_resolved": "https://registry.npmjs.org/postcss-load-plugins/-/postcss-load-plugins-2.3.0.tgz", + "_spec": "2.3.0", + "_where": "/home/dstaesse/git/website", + "author": { + "name": "Michael Ciniawky", + "email": "michael.ciniawsky@gmail.com" + }, + "bugs": { + "url": "https://github.com/michael-ciniawsky/postcss-load-plugins/issues" + }, + "contributors": [ + { + "name": "Mateusz Derks", + "url": "http://ertrzyiks.me" + }, + { + "name": "Diogo Franco", + "email": "diogomfranco@gmail.com" + } + ], + "dependencies": { + "cosmiconfig": "^2.1.1", + "object-assign": "^4.1.0" + }, + "description": "Autoload Plugins for PostCSS", + "devDependencies": { + "ava": "^0.18.1", + "coveralls": "^2.11.16", + "cssnano": "^3.10.0", + "jsdoc-to-markdown": "^3.0.0", + "nyc": "^10.1.0", + "postcss": "^5.2.12", + "postcss-cssnext": "^2.8.0", + "postcss-import": "^9.1.0", + "postcss-nested": "^1.0.0", + "postcss-sprites": "^4.2.0", + "standard": "^8.6.0", + "standard-changelog": "0.0.1", + "sugarss": "^0.2.0" + }, + "engines": { + "node": ">=0.12" + }, + "files": [ + "lib", + "index.js" + ], + "homepage": "https://github.com/michael-ciniawsky/postcss-load-plugins#readme", + "keywords": [ + "postcss", + "postcss-plugin" + ], + "license": "MIT", + "main": "index.js", + "name": "postcss-load-plugins", + "repository": { + "type": "git", + "url": "git+https://github.com/michael-ciniawsky/postcss-load-plugins.git" + }, + "scripts": { + "clean": "rm -rf .nyc_output coverage jsdoc-api dmd", + "docs": "jsdoc2md index.js lib/plugins.js > INDEX.md", + "lint": "standard", + "logs": "standard-changelog -i CHANGELOG.md -w", + "start": "sudo npm run clean && npm run lint && sudo npm test", + "test": "nyc ava -v test/err/index.js test/rc/index.js test/pkg/index.js test/js/**/index.js" + }, + "version": "2.3.0" +} -- cgit v1.2.3