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-cli | |
parent | 412c104bebc507bea9c94fd53b5bdc4b64cbfe31 (diff) | |
download | website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.tar.gz website-3c51c3be85bb0d1bdb87ea0d6632f1c256912f27.zip |
build: Add some required modules for node
Diffstat (limited to 'node_modules/postcss-cli')
-rw-r--r-- | node_modules/postcss-cli/CHANGELOG.md | 224 | ||||
-rw-r--r-- | node_modules/postcss-cli/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/postcss-cli/README.md | 148 | ||||
-rwxr-xr-x | node_modules/postcss-cli/bin/postcss | 3 | ||||
-rw-r--r-- | node_modules/postcss-cli/index.js | 284 | ||||
-rw-r--r-- | node_modules/postcss-cli/lib/args.js | 146 | ||||
-rw-r--r-- | node_modules/postcss-cli/lib/depGraph.js | 22 | ||||
-rw-r--r-- | node_modules/postcss-cli/package.json | 103 |
8 files changed, 951 insertions, 0 deletions
diff --git a/node_modules/postcss-cli/CHANGELOG.md b/node_modules/postcss-cli/CHANGELOG.md new file mode 100644 index 0000000..4f5db19 --- /dev/null +++ b/node_modules/postcss-cli/CHANGELOG.md @@ -0,0 +1,224 @@ +# 5.0.0 / 2018-02-06 + +- Now allows passing a directory as the input (all files in the directory will be processed) +- The CLI is now silent by default; added `--verbose` flag for if you want noisy logs +- Doesn't exit watch mode when there's an error in the plugin chain +- Removed non-obvious shorthand arguments (`-x`, `-p`, `-s`, `-t`, `-e`, `-b`, & `-c`). Also removed `-v` as an alias for `--version`. +- Prevent stupid option combinations like `--dir` & `-o`, and `--watch` & `--replace` +- Doesn't allow `--watch` when writing to STDOUT + +# 4.1.1 / 2017-08-17 + +- Fixed bug with `--config` +- Upgraded dependencies + +# 4.1.0 / 2017-06-10 + +- Can now pass a number to `--poll` to set poll interval +- Updated `postcss-reporter` dependency to v4.0.0 + +# 4.0.0 / 2017-05-09 + +- **BREAKING:** Upgrade postcss to v6.x + +# 3.2.0 / 2017-04-21 + +- Added `--base` CLI option for keeping directory structure + +# 3.1.1 / 2017-04-04 + +- Fixed `files` property in `package.json`; `lib/` folder wasn't included in v3.1.0 + +# 3.1.0 / 2017-04-04 + +- Improved incremental rebuilds for better performance in watch mode. +- Switched to `read-cache` for file reading for better performance. +- Set a dummy filename when reading from stdin to help plugins like autoprefixer find config files. +- Updated `fs-promise` dependency. + +# 3.0.0 / 2017-03-15 + +## Changes since 3.0.0-beta + +### Breaking Changes + +- Don't exit on `CssSyntaxError` in watch mode. v2 behaved this way, but v3.0.0-beta didn't. +- Error out if `from` or `to` options are set in the config file. Use command line arguments instead. + +### New Features + +- Add `--poll` option. v2 had this, however, this new implementation removes the capability to set the interval, which was supported in v2. + +### Bugfixes + +- Set `from` option for correct sourcemaps +- Fix `--watch`'s glob handling +- Fix error handling + +## Changes since v2.6.0 + +### Breaking Changes + +- Uses https://github.com/michael-ciniawsky/postcss-load-config for config files. Dropped support for the v2 config file format. +- Can't set input files in config file; pass input files on the command line instead. +- `--use` accepts a list of plugins. This may cause issues if you have your list of css files at the end of your command. +- Can't pass options to plugins via `--plugin.key=value` anymore, use a config file. +- Changed usage of the `--map` option; use `--map` for external sourcemaps, `--no-map` to disable all maps. Inline sourcemaps are default. +- Removed `--log` flag; this behavior is now default. +- Removed the `--local-plugins` flag; same result can be achieved with `postcss.config.js`. +- Removed the global `watchCSS` handler, plugins that import/rely on other files should use a `dependency` message instead. +- Changed behavior of the `--poll` option; no longer accepts an integer `interval`. + +### New Features + +- `--ext` (`-x`) option allows you to set the file extensions for your output files when using `--dir`. +- `--env` allows you to set `NODE_ENV` in a cross-platform manner. + +Migration guide for upgrading from v2: https://github.com/postcss/postcss-cli/wiki/Migrating-from-v2-to-v3 + +# 3.0.0-beta / 2017-03-17 + +## Breaking Changes + +- Uses https://github.com/michael-ciniawsky/postcss-load-config for config files. Dropped support for the v2 config file format. +- Can't set input files in config file; pass input files on the command line instead. +- `--use` accepts a list of plugins. This may cause issues if you have your list of css files at the end of your command. +- Can't pass options to plugins via `--plugin.key=value` anymore, use a config file. +- Changed usage of the `--map` option; use `--map` for external sourcemaps, `--no-map` to disable all maps. Inline sourcemaps are default. +- Removed `--log` flag; this behavior is now default. +- Removed the `--local-plugins` flag; same result can be achieved with `postcss.config.js`. +- Removed the global `watchCSS` handler, plugins that import/rely on other files should use a `dependency` message instead. + +## New Features + +- `--ext` (`-x`) option allows you to set the file extensions for your output files when using `--dir`. +- `--env` allows you to set `NODE_ENV` in a cross-platform manner. + +Migration guide: https://github.com/postcss/postcss-cli/wiki/Migrating-from-v2-to-v3 + +# 2.6.0 / 2016-08-30 + +- Add log option +- Update postcss-import to v8.1.2 from v7.1.0 +- Update globby to v4.1.0 from v3.0.1 +- Update postcss-url to v5.1.2 from v4.0.0 +- Update jshint to v2.9.2 from v2.6.3 +- Update chokidar to v1.5.1 from v1.0.3 +- Update yargs to v4.7.1 from v3.32.0 +- Support es6 export +- Allow running without plugins +- Add test for --poll +- Add --poll flag + +# 2.5.2 / 2016-04-18 + +- Fix typo in help message: -use => [--use|-u] +- npm install --save mkdirp +- Support mkdirp to create dest path if it doesn't exists +- Fix booleans in config file + +# 2.5.1 / 2016-02-11 + +- fix `input` argument + +# 2.5.0 / 2016-01-30 + +- move to postcss/postcss-cli repository +- Update Readme.md + +# 2.4.1 / 2016-01-27 + +- improve warning disply format + +# 2.4.0 / 2016-01-15 + +- add support for source maps + +# 2.3.3 / 2015-12-28 + +- add usage example for `local-plugins` option in config file + +# 2.3.2 / 2015-10-27 + +- auto-configure postcss-import support +- add support for watching multiple entry points + +# 2.3.1 / 2015-10-25 + +- update Travis config +- upgrade postcss-import dependency - fix deprecation warnings during make test-watch + +# 2.3.0 / 2015-10-24 + +- add --local-plugins option that lets postcss-cli to look for plugins in current directory + +# 2.2.0 / 2015-10-09 + +- add support for --replace|-r - if used input files are replaced with generated output +- refactor support for custom syntax options + +# 2.1.1 / 2015-10-08 + +- add globby to support wildcards in Windows +- remove obsolete note on postcss-import compatibility + +# 2.1.0 / 2015-09-01 + +- add support for PostCSS 5.0 custom syntax options + +# 2.0.0 / 2015-08-24 + +- remove support for --safe option +- switch to using postcss 5.x + +# 1.5.0 / 2015-07-20 + +- add watch mode (-w|--watch) in which postcss-cli observes and recompiles inputs whenever they change +- update neo-async dependency to released version +- update postcss-url dependency (used in tests only) + +# 1.4.0 / 2015-07-12 + +- allow specifying input file via config file +- allow specifying -u|--use via config file + +# 1.3.1 / 2015-05-03 + +- update npm keyword: postcssrunner -> postcss-runner + +# 1.3.0 / 2015-04-28 + +- add support for stdin/stdout if no input/output file specified + +# 1.2.1 / 2015-04-20 + +- fix typo in readme + +# 1.2.0 / 2015-04-02 + +- display warnings and errors +- stop testing on node 0.10 + +# 1.1.0 / 2015-03-28 + +- prefer postcss async API if available + +# 1.0.0 / 2015-03-22 + +- use official yargs version +- add support for multiple input files + +# 0.3.0 / 2015-03-19 + +- support JS format as plugins config + +# 0.2.0 / 2015-03-13 + +- use autoprefixer instead of autoprefixer-core +- change short options for --use from `p` to `u` +- add -v|--version support +- add --safe option to enable postcss safe mode + +# 0.1.0 / 2015-03-11 + +- initial implementaion diff --git a/node_modules/postcss-cli/LICENSE b/node_modules/postcss-cli/LICENSE new file mode 100644 index 0000000..e4d2d4a --- /dev/null +++ b/node_modules/postcss-cli/LICENSE @@ -0,0 +1,21 @@ +License (MIT) + +Copyright (c) 2016 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-cli/README.md b/node_modules/postcss-cli/README.md new file mode 100644 index 0000000..80d59dd --- /dev/null +++ b/node_modules/postcss-cli/README.md @@ -0,0 +1,148 @@ +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![Greenkeeper badge](https://badges.greenkeeper.io/postcss/postcss-cli.svg)](https://greenkeeper.io/) +[![tests][tests]][tests-url] +[![cover][cover]][cover-url] +[![chat][chat]][chat-url] + +<div align="center"> + <img width="100" height="100" title="CLI" src="http://postcss.github.io/postcss-cli/logo.svg"> + <a href="https://github.com/postcss/postcss"> + <img width="110" height="110" title="PostCSS" src="http://postcss.github.io/postcss/logo.svg" hspace="10"> + </a> + <h1>PostCSS CLI</h1> +</div> + +<h2 align="center">Install</h2> + +```bash +npm i -g|-D postcss-cli +``` + +<h2 align="center">Usage</h2> + +``` +Usage: + postcss [input.css] [OPTIONS] [-o|--output output.css] [--watch|-w] + postcss <input.css>... [OPTIONS] --dir <output-directory> [--watch|-w] + postcss <input-directory> [OPTIONS] --dir <output-directory> [--watch|-w] + postcss <input-glob-pattern> [OPTIONS] --dir <output-directory> [--watch|-w] + postcss <input.css>... [OPTIONS] --replace + +Basic options: + -o, --output Output file [string] + -d, --dir Output directory [string] + -r, --replace Replace (overwrite) the input file [boolean] + --map, -m Create an external sourcemap + --no-map Disable the default inline sourcemaps + --verbose Be verbose [boolean] + --watch, -w Watch files for changes and recompile as needed [boolean] + --env A shortcut for setting NODE_ENV [string] + +Options for when not using a config file: + -u, --use List of postcss plugins to use [array] + --parser Custom postcss parser [string] + --stringifier Custom postcss stringifier [string] + --syntax Custom postcss syntax [string] + +Advanced options: + --ext Override the output file extension; for use with --dir [string] + --base Mirror the directory structure relative to this path in the output + directory, for use with --dir [string] + --poll Use polling for file watching. Can optionally pass polling interval; + default 100 ms + --config Set a custom path to look for a config file [string] + +Options: + --version Show version number [boolean] + -h, --help Show help [boolean] + +Examples: + postcss input.css -o output.css Basic usage + postcss src/**/*.css --base src --dir build Glob Pattern & output + cat input.css | postcss -u autoprefixer > output.css Piping input & output + +If no input files are passed, it reads from stdin. If neither -o, --dir, or +--replace is passed, it writes to stdout. + +If there are multiple input files, the --dir or --replace option must be passed. + +Input files may contain globs (ie: src/**/*.css). If you pass an input directory, it will process +all files in the directory and any subdirectories, respecting the glob pattern. +``` + +> ℹ️ More details on custom parsers, stringifiers and syntaxes, can be found [here](https://github.com/postcss/postcss#syntaxes). + +### [Config](https://github.com/michael-ciniawsky/postcss-load-config) + +If you need to pass options to your plugins, or have a long plugin chain, you'll want to use a configuration file. + +**postcss.config.js** + +```js +module.exports = { + parser: 'sugarss', + plugins: [ + require('postcss-import')({ ...options }), + require('postcss-url')({ url: 'copy', useHash: true }) + ] +} +``` + +Note that you **can not** set the `from` or `to` options for postcss in the config file. They are set automatically based on the CLI arguments. + +### Context + +For more advanced usage it's recommend to to use a function in `postcss.config.js`, this gives you access to the CLI context to dynamically apply options and plugins **per file** + +| Name | Type | Default | Description | +| :-------: | :--------: | :--------------------------------: | :------------------- | +| `env` | `{String}` | `'development'` | process.env.NODE_ENV | +| `file` | `{Object}` | `dirname, basename, extname` | File | +| `options` | `{Object}` | `map, parser, syntax, stringifier` | PostCSS Options | + +**postcss.config.js** + +```js +module.exports = ctx => ({ + map: ctx.options.map, + parser: ctx.file.extname === '.sss' ? 'sugarss' : false, + plugins: { + 'postcss-import': { root: ctx.file.dirname }, + cssnano: ctx.env === 'production' ? {} : false + } +}) +``` + +> ⚠️ If you want to set options via CLI, it's mandatory to reference `ctx.options` in `postcss.config.js` + +```bash +postcss input.sss -p sugarss -o output.css -m +``` + +**postcss.config.js** + +```js +module.exports = ctx => ({ + map: ctx.options.map, + parser: ctx.options.parser, + plugins: { + 'postcss-import': { root: ctx.file.dirname }, + cssnano: ctx.env === 'production' ? {} : false + } +}) +``` + +[npm]: https://img.shields.io/npm/v/postcss-cli.svg +[npm-url]: https://npmjs.com/package/postcss-cli +[node]: https://img.shields.io/node/v/postcss-cli.svg +[node-url]: https://nodejs.org/ +[deps]: https://img.shields.io/gemnasium/postcss/postcss-cli.svg +[deps-url]: https://gemnasium.com/postcss/postcss-cli +[tests]: http://img.shields.io/travis/postcss/postcss-cli/master.svg +[tests-url]: https://travis-ci.org/postcss/postcss-cli +[cover]: https://img.shields.io/coveralls/postcss/postcss-cli/master.svg +[cover-url]: https://coveralls.io/github/postcss/postcss-cli +[chat]: https://img.shields.io/gitter/room/postcss/postcss.svg +[chat-url]: https://gitter.im/postcss/postcss diff --git a/node_modules/postcss-cli/bin/postcss b/node_modules/postcss-cli/bin/postcss new file mode 100755 index 0000000..d40abef --- /dev/null +++ b/node_modules/postcss-cli/bin/postcss @@ -0,0 +1,3 @@ +#!/usr/bin/env node + +require('../') diff --git a/node_modules/postcss-cli/index.js b/node_modules/postcss-cli/index.js new file mode 100644 index 0000000..764f2a4 --- /dev/null +++ b/node_modules/postcss-cli/index.js @@ -0,0 +1,284 @@ +'use strict' + +const fs = require('fs-extra') +const path = require('path') + +const prettyHrtime = require('pretty-hrtime') +const stdin = require('get-stdin') +const read = require('read-cache') +const chalk = require('chalk') +const globber = require('globby') +const chokidar = require('chokidar') + +const postcss = require('postcss') +const postcssrc = require('postcss-load-config') +const reporter = require('postcss-reporter/lib/formatter')() + +const argv = require('./lib/args') +const depGraph = require('./lib/depGraph') + +const dir = argv.dir + +let input = argv._ +const output = argv.output + +if (argv.map) argv.map = { inline: false } + +const cliConfig = { + options: { + map: argv.map !== undefined ? argv.map : { inline: true }, + parser: argv.parser ? require(argv.parser) : undefined, + syntax: argv.syntax ? require(argv.syntax) : undefined, + stringifier: argv.stringifier ? require(argv.stringifier) : undefined + }, + plugins: argv.use + ? argv.use.map(plugin => { + try { + return require(plugin)() + } catch (e) { + return error(`Plugin Error: Cannot find module '${plugin}'`) + } + }) + : [] +} + +let configFile + +if (argv.env) process.env.NODE_ENV = argv.env +if (argv.config) argv.config = path.resolve(argv.config) + +Promise.resolve() + .then(() => { + if (argv.watch && !(argv.output || argv.replace || argv.dir)) { + error('Cannot write to stdout in watch mode') + } + if (input && input.length) return globber(input) + + if (argv.replace || argv.dir) { + error( + 'Input Error: Cannot use --dir or --replace when reading from stdin' + ) + } + + if (argv.watch) { + error('Input Error: Cannot run in watch mode when reading from stdin') + } + + return ['stdin'] + }) + .then(i => { + if (!i || !i.length) { + error('Input Error: You must pass a valid list of files to parse') + } + + if (i.length > 1 && !argv.dir && !argv.replace) { + error( + 'Input Error: Must use --dir or --replace with multiple input files' + ) + } + + if (i[0] !== 'stdin') i = i.map(i => path.resolve(i)) + + input = i + + return files(input) + }) + .then(results => { + if (argv.watch) { + const printMessage = () => + printVerbose(chalk.dim('\nWaiting for file changes...')) + const watcher = chokidar.watch(input.concat(dependencies(results)), { + usePolling: argv.poll, + interval: argv.poll && typeof argv.poll === 'number' ? argv.poll : 100, + awaitWriteFinish: { + stabilityThreshold: 50, + pollInterval: 10 + } + }) + + if (configFile) watcher.add(configFile) + + watcher.on('ready', printMessage).on('change', file => { + let recompile = [] + + if (~input.indexOf(file)) recompile.push(file) + + recompile = recompile.concat( + depGraph.dependantsOf(file).filter(file => ~input.indexOf(file)) + ) + + if (!recompile.length) recompile = input + + return files(recompile) + .then(results => watcher.add(dependencies(results))) + .then(printMessage) + .catch(error) + }) + } + }) + .catch(err => { + error(err) + + process.exit(1) + }) + +function rc(ctx, path) { + if (argv.use) return Promise.resolve(cliConfig) + + // Set argv: false to keep cosmiconfig from attempting to read the --config + // flag from process.argv + return postcssrc(ctx, path, { argv: false }) + .then(rc => { + if (rc.options.from || rc.options.to) { + error( + 'Config Error: Can not set from or to options in config file, use CLI arguments instead' + ) + } + configFile = rc.file + return rc + }) + .catch(err => { + if (err.message.indexOf('No PostCSS Config found') === -1) throw err + }) +} + +function files(files) { + if (typeof files === 'string') files = [files] + + return Promise.all( + files.map(file => { + if (file === 'stdin') { + return stdin().then(content => { + if (!content) return error('Input Error: Did not receive any STDIN') + return css(content, 'stdin') + }) + } + + return read(file).then(content => css(content, file)) + }) + ) +} + +function css(css, file) { + const ctx = { options: cliConfig.options } + + if (file !== 'stdin') { + ctx.file = { + dirname: path.dirname(file), + basename: path.basename(file), + extname: path.extname(file) + } + + if (!argv.config) argv.config = path.dirname(file) + } + + const relativePath = + file !== 'stdin' ? path.relative(path.resolve(), file) : file + + if (!argv.config) argv.config = process.cwd() + + const time = process.hrtime() + + printVerbose(chalk`{cyan Processing {bold ${relativePath}}...}`) + + return rc(ctx, argv.config) + .then(config => { + config = config || cliConfig + const options = Object.assign({}, config.options) + + if (file === 'stdin' && output) file = output + + // TODO: Unit test this + options.from = file === 'stdin' ? path.join(process.cwd(), 'stdin') : file + + if (output || dir || argv.replace) { + const base = argv.base + ? file.replace(path.resolve(argv.base), '') + : path.basename(file) + options.to = output || (argv.replace ? file : path.join(dir, base)) + + if (argv.ext) { + options.to = options.to.replace(path.extname(options.to), argv.ext) + } + + options.to = path.resolve(options.to) + } + + if (!options.to && config.options.map && !config.options.map.inline) { + error( + 'Output Error: Cannot output external sourcemaps when writing to STDOUT' + ) + } + + return postcss(config.plugins) + .process(css, options) + .then(result => { + const tasks = [] + + if (options.to) { + tasks.push(fs.outputFile(options.to, result.css)) + + if (result.map) { + const mapfile = options.to.replace( + path.extname(options.to), + `${path.extname(options.to)}.map` + ) + tasks.push(fs.outputFile(mapfile, result.map)) + } + } else process.stdout.write(result.css, 'utf8') + + return Promise.all(tasks).then(() => { + const prettyTime = prettyHrtime(process.hrtime(time)) + printVerbose( + chalk`{green Finished {bold ${relativePath}} in {bold ${prettyTime}}}` + ) + + if (result.warnings().length) { + console.warn(reporter(result)) + } + + return result + }) + }) + }) + .catch(err => { + throw err + }) +} + +function dependencies(results) { + if (!Array.isArray(results)) results = [results] + + const messages = [] + + results.forEach(result => { + if (result.messages <= 0) return + + result.messages + .filter(msg => (msg.type === 'dependency' ? msg : '')) + .map(depGraph.add) + .forEach(dependency => messages.push(dependency.file)) + }) + + return messages +} + +function printVerbose(message) { + if (argv.verbose) console.warn(message) +} + +function error(err) { + // Seperate error from logging output + if (argv.verbose) console.error() + + if (typeof err === 'string') { + console.error(chalk.red(err)) + } else if (err.name === 'CssSyntaxError') { + console.error(err.toString()) + } else { + console.error(err) + } + // Watch mode shouldn't exit on error + if (argv.watch) return + process.exit(1) +} diff --git a/node_modules/postcss-cli/lib/args.js b/node_modules/postcss-cli/lib/args.js new file mode 100644 index 0000000..2e6e543 --- /dev/null +++ b/node_modules/postcss-cli/lib/args.js @@ -0,0 +1,146 @@ +'use strict' +const chalk = require('chalk') + +const logo = ` + /|\\ + // // + // // + //___*___*___// + //--*---------*--// + /|| * * ||/ + // ||* *|| // + // || * * || // + //_____||___*_________*___||_____// +` + +const cli = require('../package.json').version +const version = chalk.bold.red(` + /|\\ + // // + // // + //___*___*___// + //--*---------*--// + /|| * * ||/ + // ||* v${cli} *|| // + // || * * || // + //_____||___*_________*___||_____// +`) + +module.exports = require('yargs') + .usage( + `${chalk.bold.red(logo)} +Usage: + $0 [input.css] [OPTIONS] [-o|--output output.css] [--watch|-w] + $0 <input.css>... [OPTIONS] --dir <output-directory> [--watch|-w] + $0 <input-directory> [OPTIONS] --dir <output-directory> [--watch|-w] + $0 <input-glob-pattern> [OPTIONS] --dir <output-directory> [--watch|-w] + $0 <input.css>... [OPTIONS] --replace` + ) + .group( + ['o', 'd', 'r', 'map', 'no-map', 'verbose', 'watch', 'env'], + 'Basic options:' + ) + .option('o', { + alias: 'output', + desc: 'Output file', + type: 'string', + conflicts: ['dir', 'replace'] + }) + .option('d', { + alias: 'dir', + desc: 'Output directory', + type: 'string', + conflicts: ['output', 'replace'] + }) + .option('r', { + alias: 'replace', + desc: 'Replace (overwrite) the input file', + type: 'boolean', + // HACK: conflicts doesn't work with boolean opts correctly, so we do this + // See https://github.com/yargs/yargs/issues/929 + coerce: v => v || undefined, + conflicts: ['output', 'dir'] + }) + .alias('map', 'm') + .describe('map', 'Create an external sourcemap') + .describe('no-map', 'Disable the default inline sourcemaps') + .option('verbose', { + desc: 'Be verbose', + type: 'boolean' + }) + .option('watch', { + alias: 'w', + desc: 'Watch files for changes and recompile as needed', + type: 'boolean', + // HACK: conflicts doesn't work with boolean opts correctly, so we do this + // See https://github.com/yargs/yargs/issues/929 + coerce: v => v || undefined, + conflicts: 'replace' + }) + .option('env', { + desc: 'A shortcut for setting NODE_ENV', + type: 'string' + }) + .group( + ['u', 'parser', 'stringifier', 'syntax'], + 'Options for when not using a config file:' + ) + .option('u', { + alias: 'use', + desc: 'List of postcss plugins to use', + type: 'array' + }) + .option('parser', { + desc: 'Custom postcss parser', + type: 'string' + }) + .option('stringifier', { + desc: 'Custom postcss stringifier', + type: 'string' + }) + .option('syntax', { + desc: 'Custom postcss syntax', + type: 'string' + }) + .group(['ext', 'base', 'poll', 'config'], 'Advanced options:') + .option('ext', { + desc: 'Override the output file extension; for use with --dir', + type: 'string', + implies: 'dir', + coerce(ext) { + if (ext.indexOf('.') !== 0) return `.${ext}` + return ext + } + }) + .option('base', { + desc: + 'Mirror the directory structure relative to this path in the output directory, for use with --dir', + type: 'string', + implies: 'dir' + }) + .option('poll', { + desc: + 'Use polling for file watching. Can optionally pass polling interval; default 100 ms', + implies: 'watch' + }) + .option('config', { + desc: 'Set a custom path to look for a config file', + type: 'string' + }) + .version(version) + .alias('h', 'help') + .example('$0 input.css -o output.css', 'Basic usage') + .example('$0 src/**/*.css --base src --dir build', 'Glob Pattern & output') + .example( + 'cat input.css | $0 -u autoprefixer > output.css', + 'Piping input & output' + ) + .epilog( + `If no input files are passed, it reads from stdin. If neither -o, --dir, or --replace is passed, it writes to stdout. + +If there are multiple input files, the --dir or --replace option must be passed. + +Input files may contain globs (ie: src/**/*.css). If you pass an input directory, it will process all files in the directory and any subdirectories, respecting the glob pattern. + +For more details, please see https://github.com/postcss/postcss-cli` + ).argv diff --git a/node_modules/postcss-cli/lib/depGraph.js b/node_modules/postcss-cli/lib/depGraph.js new file mode 100644 index 0000000..19bd6b7 --- /dev/null +++ b/node_modules/postcss-cli/lib/depGraph.js @@ -0,0 +1,22 @@ +'use strict' +const path = require('path') +const DepGraph = require('dependency-graph').DepGraph + +const graph = new DepGraph() + +exports.add = message => { + message.parent = path.resolve(message.parent) + message.file = path.resolve(message.file) + + graph.addNode(message.parent) + graph.addNode(message.file) + graph.addDependency(message.parent, message.file) + return message +} + +exports.dependantsOf = node => { + node = path.resolve(node) + + if (graph.hasNode(node)) return graph.dependantsOf(node) + return [] +} diff --git a/node_modules/postcss-cli/package.json b/node_modules/postcss-cli/package.json new file mode 100644 index 0000000..6948dc0 --- /dev/null +++ b/node_modules/postcss-cli/package.json @@ -0,0 +1,103 @@ +{ + "_args": [ + [ + "[email protected]", + "/home/dstaesse/git/website" + ] + ], + "_development": true, + "_from": "[email protected]", + "_id": "[email protected]", + "_inBundle": false, + "_integrity": "sha512-yrvWl8axFdiXlJuVQRIHM4qskvl0F4/fWUUIYyYo0RV6lOdB0Vcyt8Rv7lBvtwVuNa0pClz88LgxzT4ZzC7UWA==", + "_location": "/postcss-cli", + "_phantomChildren": {}, + "_requested": { + "type": "version", + "registry": true, + "raw": "[email protected]", + "name": "postcss-cli", + "escapedName": "postcss-cli", + "rawSpec": "5.0.1", + "saveSpec": null, + "fetchSpec": "5.0.1" + }, + "_requiredBy": [ + "#DEV:/" + ], + "_resolved": "https://registry.npmjs.org/postcss-cli/-/postcss-cli-5.0.1.tgz", + "_spec": "5.0.1", + "_where": "/home/dstaesse/git/website", + "bin": { + "postcss": "./bin/postcss" + }, + "bugs": { + "url": "https://github.com/postcss/postcss-cli/issues" + }, + "contributors": [ + { + "name": "Michael Ciniawky", + "email": "[email protected]" + }, + { + "name": "Ryan Zimmermann", + "email": "[email protected]" + } + ], + "dependencies": { + "chalk": "^2.1.0", + "chokidar": "^2.0.0", + "dependency-graph": "^0.7.0", + "fs-extra": "^5.0.0", + "get-stdin": "^6.0.0", + "globby": "^8.0.0", + "postcss": "^6.0.1", + "postcss-load-config": "^1.1.0", + "postcss-reporter": "^5.0.0", + "pretty-hrtime": "^1.0.3", + "read-cache": "^1.0.0", + "yargs": "^11.0.0" + }, + "description": "CLI for PostCSS", + "devDependencies": { + "ava": "^0.25.0", + "coveralls": "^3.0.0", + "eslint": "^4.2.0", + "eslint-config-problems": "0.0.2", + "nyc": "^11.0.2", + "postcss-import": "^11.0.0", + "prettier": "1.13.0", + "sugarss": "^1.0.0", + "uuid": "^3.0.1" + }, + "engines": { + "node": ">=4" + }, + "files": [ + "bin", + "index.js", + "lib" + ], + "homepage": "https://github.com/postcss/postcss-cli#readme", + "keywords": [ + "cli", + "postcss", + "postcss-runner" + ], + "license": "MIT", + "main": "index.js", + "name": "postcss-cli", + "repository": { + "type": "git", + "url": "git+https://github.com/postcss/postcss-cli.git" + }, + "scripts": { + "ci": "eslint . && nyc ava -v && npm run prettier -- --list-different", + "clean": "node test/helpers/clean.js", + "format": "npm run prettier -- --write && eslint . --fix", + "pretest": "npm run clean && npm run format", + "prettier": "prettier --single-quote --no-semi **/*.{js,md}", + "test": "nyc ava -v" + }, + "version": "5.0.1" +} |