structure, layout and automation

This commit is contained in:
Tancre
2020-09-16 14:23:28 +02:00
commit 0efda7fffe
15549 changed files with 1280031 additions and 0 deletions

269
node_modules/gulp/CHANGELOG.md generated vendored Normal file
View File

@ -0,0 +1,269 @@
# gulp changelog
## 4.0.0
### Task system changes
- replaced 3.x task system (orchestrator) with new task system (bach)
- removed gulp.reset
- removed 3 argument syntax for `gulp.task`
- `gulp.task` should only be used when you will call the task with the CLI
- added `gulp.series` and `gulp.parallel` methods for composing tasks. Everything must use these now.
- added single argument syntax for `gulp.task` which allows a named function to be used as the name of the task and task function.
- added `gulp.tree` method for retrieving the task tree. Pass `{ deep: true }` for an `archy` compatible node list.
- added `gulp.registry` for setting custom registries.
### CLI changes
- split CLI out into a module if you want to save bandwidth/disk space. you can install the gulp CLI using either `npm install gulp -g` or `npm install gulp-cli -g`, where gulp-cli is the smaller one (no module code included)
- add `--tasks-json` flag to CLI to dump the whole tree out for other tools to consume
- added `--verify` flag to check the dependencies in package.json against the plugin blacklist.
### vinyl/vinyl-fs changes
- added `gulp.symlink` which functions exactly like `gulp.dest`, but symlinks instead.
- added `dirMode` param to `gulp.dest` and `gulp.symlink` which allows better control over the mode of the destination folder that is created.
- globs passed to `gulp.src` will be evaluated in order, which means this is possible `gulp.src(['*.js', '!b*.js', 'bad.js'])` (exclude every JS file that starts with a b except bad.js)
- performance for gulp.src has improved massively
- `gulp.src(['**/*', '!b.js'])` will no longer eat CPU since negations happen during walking now
- added `since` option to `gulp.src` which lets you only match files that have been modified since a certain date (for incremental builds)
- fixed `gulp.src` not following symlinks
- added `overwrite` option to `gulp.dest` which allows you to enable or disable overwriting of existing files
## 3.9.1
- update interpret to 1.0.0 (support for babel-register)
- fix to include manpages in published tarball
- documentation/recipe updates
## 3.9.0
- add babel support
- add transpiler fallback support
- add support for some renamed transpilers: livescript, etc
- add JSCS
- update dependencies (liftoff, interpret)
- documentation tweaks
## 3.8.11
- fix node 0.12/iojs problems
- add node 0.12 and iojs to travis
- update dependencies (liftoff, v8flags)
- documentation tweaks
## 3.8.10
- add link to spanish docs
- update dependencies (archy, semver, mocha, etc)
- documentation tweaks
## 3.8.9
- fix local version undefined output
- add completion for fish shell
- fix powershell completion line splitting
- add support for arbitrary node flags (oops, should have been a minor bump)
- add v8flags dependency
- update dependencies (liftoff)
- documentation tweaks
## 3.8.8
- update dependencies (minimist, tildify)
- documentation tweaks
## 3.8.7
- handle errors a bit better
- update dependencies (gulp-util, semver, etc)
- documentation tweaks
## 3.8.6
- remove executable flag from LICENSE
- update dependencies (chalk, minimist, liftoff, etc)
- documentation tweaks
## 3.8.5
- simplify --silent and --tasks-simple
- fix bug in autocomplete where errors would come out
## 3.8.4
- CLI will use exit code 1 on exit when any task fails during the lifetime of the process
## 3.8.3
- Tweak error formatting to work better with PluginErrors and strings
## 3.8.2
- add manpage generation
## 3.8.1
- the CLI now adds process.env.INIT_CWD which is the original cwd it was launched from
## 3.8.0
- update vinyl-fs
- gulp.src is now a writable passthrough, this means you can use it to add files to your pipeline at any point
- gulp.dest can now take a function to determine the folder
This is now possible!
```js
gulp.src('lib/*.js')
.pipe(uglify())
.pipe(gulp.src('styles/*.css'))
.pipe(gulp.dest(function(file){
// I don't know, you can do something cool here
return 'build/whatever';
}));
```
## 3.7.0
- update vinyl-fs to remove BOM from UTF8 files
- add --tasks-simple flag for plaintext task listings
- updated autocomplete scripts to be simpler and use new --tasks-simple flag
- added support for transpilers via liftoff 0.11 and interpret
- just npm install your compiler (coffee-script for example) and it will work out of the box
## 3.5.5
- update deps
- gulp.dest now support mode option, uses source file mode by default (file.stat.mode)
- use chalk for colors in bin
- update gulp.env deprecation msg to be more helpful
## 3.5.2
- add -V for version on CLI (unix standard)
- -v is deprecated, use -V
- add -T as an alias for --tasks
- documentation
## 3.5
- added `gulp.watch(globs, tasksArray)` sugar
- remove gulp.taskQueue
- deprecate gulp.run
- deprecate gulp.env
- add engineStrict to prevent people with node < 0.9 from installing
## 3.4
- added `--tasks` that prints out the tree of tasks + deps
- global cli + local install mismatch is no longer fatal
- remove tests for fs stuff
- switch core src, dest, and watch to vinyl-fs
- internal cleaning
## 3.3.4
- `--base` is now `--cwd`
## 3.3.3
- support for `--base` CLI arg to change where the search for gulpfile/`--require`s starts
- support for `--gulpfile` CLI arg to point to a gulpfile specifically
## 3.3.0
- file.contents streams are no longer paused coming out of src
- dest now passes files through before they are empty to fix passing to multiple dests
## 3.2.4
- Bug fix - we didn't have any CLI tests
## 3.2.3
- Update dependencies for bug fixes
- autocomplete stuff in the completion folder
## 3.2
- File object is now [vinyl](https://github.com/wearefractal/vinyl)
- .watch() is now [glob-watcher](https://github.com/wearefractal/glob-watcher)
- Fix CLI -v when no gulpfile found
- gulp-util updated
- Logging moved to CLI bin file
- Will cause double logging if you update global CLI to 3.2 but not local
- Will cause no logging if you update local to 3.1 but not global CLI
- Drop support for < 0.9
## 3.1.3
- Move isStream and isBuffer to gulp-util
## 3.1
- Move file class to gulp-util
## 3.0
- Ability to pass multiple globs and glob negations to glob-stream
- Breaking change to the way glob-stream works
- File object is now a class
- file.shortened changed to file.relative
- file.cwd added
- Break out getStats to avoid nesting
- Major code reorganization
## 2.7
- Breaking change to the way options are passed to glob-stream
- Introduce new File object to ease pain of computing shortened names (now a getter)
## 2.4 - 2.6
- Moved stuff to gulp-util
- Quit exposing createGlobStream (just use the glob-stream module)
- More logging
- Prettier time durations
- Tons of documentation changes
- gulp.trigger(tasks...) as a through stream
## 1.2-2.4 (11/12/13)
- src buffer=false fixed for 0.8 and 0.9 (remember to .resume() on these versions before consuming)
- CLI completely rewritten
- Colorful logging
- Uses local version of gulp to run tasks
- Uses findup to locate gulpfile (so you can run it anywhere in your project)
- chdir to gulpfile directory before loading it
- Correct exit codes on errors
- silent flag added to gulp to disable logging
- Fixes to task orchestration (3rd party)
- Better support for globbed directories (thanks @robrich)
## 1.2 (10/28/13)
- Can specify buffer=false on src streams to make file.content a stream
- Can specify read=false on src streams to disable file.content
## 1.1 (10/21/13)
- Can specify run callback
- Can specify task dependencies
- Tasks can accept callback or return promise
- `gulp.verbose` exposes run-time internals
## 1.0 (9/26/13)
- Specify dependency versions
- Updated docs
## 0.2 (8/6/13)
- Rename .files() to .src() and .folder() to .dest()
## 0.1 (7/18/13)
- Initial Release

21
node_modules/gulp/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2013-2018 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
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.

284
node_modules/gulp/README.md generated vendored Normal file
View File

@ -0,0 +1,284 @@
<p align="center">
<a href="https://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
<p align="center">The streaming build system</p>
</p>
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Azure Pipelines Build Status][azure-pipelines-image]][azure-pipelines-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![OpenCollective Backers][backer-badge]][backer-url] [![OpenCollective Sponsors][sponsor-badge]][sponsor-url] [![Gitter chat][gitter-image]][gitter-url]
## What is gulp?
- **Automation** - gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow.
- **Platform-agnostic** - Integrations are built into all major IDEs and people are using gulp with PHP, .NET, Node.js, Java, and other platforms.
- **Strong Ecosystem** - Use npm modules to do anything you want + over 2000 curated plugins for streaming file transformations
- **Simple** - By providing only a minimal API surface, gulp is easy to learn and simple to use
## What's new in 4.0?!
* The task system was rewritten from the ground-up, allowing task composition using `series()` and `parallel()` methods
* The watcher was updated, now using chokidar (no more need for gulp-watch!), with feature parity to our task system
* First-class support was added for incremental builds using `lastRun()`
* A `symlink()` method was exposed to create symlinks instead of copying files
* Built-in support for sourcemaps was added - the gulp-sourcemaps plugin is no longer necessary!
* Task registration of exported functions - using node or ES exports - is now recommended
* Custom registries were designed, allowing for shared tasks or augmented functionality
* Stream implementations were improved, allowing for better conditional and phased builds
## Installation
Follow our [Quick Start guide][quick-start].
## Roadmap
Find out about all our work-in-progress and outstanding issues at https://github.com/orgs/gulpjs/projects.
## Documentation
Check out the [Getting Started guide][getting-started-guide] and [API docs][api-docs] on our website!
__Excuse our dust! All other docs will be behind until we get everything updated. Please open an issue if something isn't working.__
## Sample `gulpfile.js`
This file will give you a taste of what gulp does.
```js
var gulp = require('gulp');
var less = require('gulp-less');
var babel = require('gulp-babel');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var cleanCSS = require('gulp-clean-css');
var del = require('del');
var paths = {
styles: {
src: 'src/styles/**/*.less',
dest: 'assets/styles/'
},
scripts: {
src: 'src/scripts/**/*.js',
dest: 'assets/scripts/'
}
};
/* Not all tasks need to use streams, a gulpfile is just another node program
* and you can use all packages available on npm, but it must return either a
* Promise, a Stream or take a callback and call it
*/
function clean() {
// You can use multiple globbing patterns as you would with `gulp.src`,
// for example if you are using del 2.0 or above, return its promise
return del([ 'assets' ]);
}
/*
* Define our tasks using plain functions
*/
function styles() {
return gulp.src(paths.styles.src)
.pipe(less())
.pipe(cleanCSS())
// pass in options to the stream
.pipe(rename({
basename: 'main',
suffix: '.min'
}))
.pipe(gulp.dest(paths.styles.dest));
}
function scripts() {
return gulp.src(paths.scripts.src, { sourcemaps: true })
.pipe(babel())
.pipe(uglify())
.pipe(concat('main.min.js'))
.pipe(gulp.dest(paths.scripts.dest));
}
function watch() {
gulp.watch(paths.scripts.src, scripts);
gulp.watch(paths.styles.src, styles);
}
/*
* Specify if tasks run in series or parallel using `gulp.series` and `gulp.parallel`
*/
var build = gulp.series(clean, gulp.parallel(styles, scripts));
/*
* You can use CommonJS `exports` module notation to declare tasks
*/
exports.clean = clean;
exports.styles = styles;
exports.scripts = scripts;
exports.watch = watch;
exports.build = build;
/*
* Define default task that can be called by just running `gulp` from cli
*/
exports.default = build;
```
## Use latest JavaScript version in your gulpfile
__Most new versions of node support most features that Babel provides, except the `import`/`export` syntax. When only that syntax is desired, rename to `gulpfile.esm.js`, install the [esm][esm-module] module, and skip the Babel portion below.__
Node already supports a lot of __ES2015+__ features, but to avoid compatibility problems we suggest to install Babel and rename your `gulpfile.js` to `gulpfile.babel.js`.
```sh
npm install --save-dev @babel/register @babel/core @babel/preset-env
```
Then create a **.babelrc** file with the preset configuration.
```js
{
"presets": [ "@babel/preset-env" ]
}
```
And here's the same sample from above written in **ES2015+**.
```js
import gulp from 'gulp';
import less from 'gulp-less';
import babel from 'gulp-babel';
import concat from 'gulp-concat';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import cleanCSS from 'gulp-clean-css';
import del from 'del';
const paths = {
styles: {
src: 'src/styles/**/*.less',
dest: 'assets/styles/'
},
scripts: {
src: 'src/scripts/**/*.js',
dest: 'assets/scripts/'
}
};
/*
* For small tasks you can export arrow functions
*/
export const clean = () => del([ 'assets' ]);
/*
* You can also declare named functions and export them as tasks
*/
export function styles() {
return gulp.src(paths.styles.src)
.pipe(less())
.pipe(cleanCSS())
// pass in options to the stream
.pipe(rename({
basename: 'main',
suffix: '.min'
}))
.pipe(gulp.dest(paths.styles.dest));
}
export function scripts() {
return gulp.src(paths.scripts.src, { sourcemaps: true })
.pipe(babel())
.pipe(uglify())
.pipe(concat('main.min.js'))
.pipe(gulp.dest(paths.scripts.dest));
}
/*
* You could even use `export as` to rename exported tasks
*/
function watchFiles() {
gulp.watch(paths.scripts.src, scripts);
gulp.watch(paths.styles.src, styles);
}
export { watchFiles as watch };
const build = gulp.series(clean, gulp.parallel(styles, scripts));
/*
* Export a default task
*/
export default build;
```
## Incremental Builds
You can filter out unchanged files between runs of a task using
the `gulp.src` function's `since` option and `gulp.lastRun`:
```js
const paths = {
...
images: {
src: 'src/images/**/*.{jpg,jpeg,png}',
dest: 'build/img/'
}
}
function images() {
return gulp.src(paths.images.src, {since: gulp.lastRun(images)})
.pipe(imagemin({optimizationLevel: 5}))
.pipe(gulp.dest(paths.images.dest));
}
function watch() {
gulp.watch(paths.images.src, images);
}
```
Task run times are saved in memory and are lost when gulp exits. It will only
save time during the `watch` task when running the `images` task
for a second time.
## Want to contribute?
Anyone can help make this project better - check out our [Contributing guide](/CONTRIBUTING.md)!
## Backers
Support us with a monthly donation and help us continue our activities.
[![Backers][backers-image]][support-url]
## Sponsors
Become a sponsor to get your logo on our README on Github.
[![Sponsors][sponsors-image]][support-url]
[downloads-image]: https://img.shields.io/npm/dm/gulp.svg
[npm-url]: https://www.npmjs.com/package/gulp
[npm-image]: https://img.shields.io/npm/v/gulp.svg
[azure-pipelines-url]: https://dev.azure.com/gulpjs/gulp/_build/latest?definitionId=1&branchName=master
[azure-pipelines-image]: https://dev.azure.com/gulpjs/gulp/_apis/build/status/gulp?branchName=master
[travis-url]: https://travis-ci.org/gulpjs/gulp
[travis-image]: https://img.shields.io/travis/gulpjs/gulp.svg?label=travis-ci
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/gulp
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/gulp.svg?label=appveyor
[coveralls-url]: https://coveralls.io/r/gulpjs/gulp
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp/master.svg
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
[backer-url]: #backers
[backer-badge]: https://opencollective.com/gulpjs/backers/badge.svg?color=blue
[sponsor-url]: #sponsors
[sponsor-badge]: https://opencollective.com/gulpjs/sponsors/badge.svg?color=blue
[support-url]: https://opencollective.com/gulpjs#support
[backers-image]: https://opencollective.com/gulpjs/backers.svg
[sponsors-image]: https://opencollective.com/gulpjs/sponsors.svg
[quick-start]: https://gulpjs.com/docs/en/getting-started/quick-start
[getting-started-guide]: https://gulpjs.com/docs/en/getting-started/quick-start
[api-docs]: https://gulpjs.com/docs/en/api/concepts

3
node_modules/gulp/bin/gulp.js generated vendored Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env node
require('gulp-cli')();

55
node_modules/gulp/index.js generated vendored Normal file
View File

@ -0,0 +1,55 @@
'use strict';
var util = require('util');
var Undertaker = require('undertaker');
var vfs = require('vinyl-fs');
var watch = require('glob-watcher');
function Gulp() {
Undertaker.call(this);
// Bind the functions for destructuring
this.watch = this.watch.bind(this);
this.task = this.task.bind(this);
this.series = this.series.bind(this);
this.parallel = this.parallel.bind(this);
this.registry = this.registry.bind(this);
this.tree = this.tree.bind(this);
this.lastRun = this.lastRun.bind(this);
this.src = this.src.bind(this);
this.dest = this.dest.bind(this);
this.symlink = this.symlink.bind(this);
}
util.inherits(Gulp, Undertaker);
Gulp.prototype.src = vfs.src;
Gulp.prototype.dest = vfs.dest;
Gulp.prototype.symlink = vfs.symlink;
Gulp.prototype.watch = function(glob, opt, task) {
if (typeof opt === 'string' || typeof task === 'string' ||
Array.isArray(opt) || Array.isArray(task)) {
throw new Error('watching ' + glob + ': watch task has to be ' +
'a function (optionally generated by using gulp.parallel ' +
'or gulp.series)');
}
if (typeof opt === 'function') {
task = opt;
opt = {};
}
opt = opt || {};
var fn;
if (typeof task === 'function') {
fn = this.parallel(task);
}
return watch(glob, opt, fn);
};
// Let people use this class from our instance
Gulp.prototype.Gulp = Gulp;
var inst = new Gulp();
module.exports = inst;

1
node_modules/gulp/node_modules/.bin/gulp generated vendored Symbolic link
View File

@ -0,0 +1 @@
../gulp-cli/bin/gulp.js

21
node_modules/gulp/node_modules/gulp-cli/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Blaine Bublitz, Eric Schoffstall and other contributors
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.

240
node_modules/gulp/node_modules/gulp-cli/README.md generated vendored Normal file
View File

@ -0,0 +1,240 @@
<p align="center">
<a href="http://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
</a>
</p>
# gulp-cli
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
Command Line Utility for Gulp
## Usage
```bash
> gulp [flags] <task> <task>...
```
## Custom Metadata
When listing tasks with the `gulp -T` command, gulp-cli displays some custom metadata as defined upon task functions. Currently supported properties:
* `task.description` - String of the description to display.
```js
function clean() { ... }
clean.description = 'Cleans up generated files.';
```
* `task.flags` - Object with key/value pairs being flag/description to display.
```js
function build() { ... }
build.flags = {
'--prod': 'Builds in production mode.'
};
```
Example Usage:
```js
function build() { ... }
build.description = 'Build entire project.';
build.flags = {
'--prod': 'Builds in production mode (minification, etc).'
};
// gulp 3.x
gulp.task('build', build);
// gulp 4.x
gulp.task(build);
```
## Tasks
The task(s) listed on the command line will be executed.
If more than one task is listed, Gulp will execute all of them
concurrently, that is, as if they had all been listed as dependencies of
a single task.
By default, Gulp does not serialize tasks listed on the command line. If you would like to execute tasks serially, you must specify the `--series` flag. e.g. `gulp clean build --series`
Just running `gulp` will execute the task `default`. If there is no
`default` task, gulp will error.
## Completion
> Thanks to the grunt team, specifically Tyler Kellen
To enable tasks auto-completion in shell you should add `eval "$(gulp --completion=shell)"` in your `.shellrc` file.
###### Bash:
Add `eval "$(gulp --completion=bash)"` to `~/.bashrc`.
###### Zsh:
Add `eval "$(gulp --completion=zsh)"` to `~/.zshrc`.
###### Powershell:
Add `Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine)` to `$PROFILE`.
###### Fish:
Add `gulp --completion=fish | source` to `~/.config/fish/config.fish`.
## Compilers
You can find a list of supported languages at https://github.com/js-cli/js-interpret. If you would like to add support for a new language, send pull requests/open issues on that project.
## Environment
The CLI adds process.env.INIT_CWD which is the original cwd it was launched from.
## Configuration
Configuration is supported through the use of a `.gulp.*` file (e.g. `.gulp.json`, `.gulp.yml`). You can find a list of supported languages at https://github.com/js-cli/js-interpret.
Configuration from the home directory (`~`) and current working directory (`cwd`) are merged with `cwd` taking precedence.
Supported configurations properties:
| Property | Description |
|--------------------|-------------|
| description | Top-level description of the project/gulpfile (Replaces "Tasks for ~/path/of/gulpfile.js") |
| flags.continue | Continue execution of tasks upon failure by default. |
| flags.compactTasks | Reduce the output of task dependency tree by default. |
| flags.tasksDepth | Set default depth of task dependency tree. |
| flags.gulpfile | Set a default gulpfile |
| flags.silent | Silence logging by default |
| flags.series | Run tasks given on the CLI in series (the default is parallel) |
| flags.require | An array of modules to require before running the gulpfile. Any relative paths will be resolved against the `--cwd` directory (if you don't want that behavior, use absolute paths) |
| flags.nodeFlags | An array of flags used to forcibly respawn the process upon startup. For example, if you always want your gulpfiles to run in node's harmony mode, you can set `--harmony` here |
## Flags
gulp has very few flags to know about. All other flags are for tasks to use if needed.
__Some flags only work with gulp 4 and will be ignored when invoked against gulp 3.__
<table>
<thead>
<tr>
<th width="25%">Flag</th>
<th width="15%">Short Flag</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>--help</td>
<td>-h</td>
<td>Show this help.</td>
</tr>
<tr>
<td>--version</td>
<td>-v</td>
<td>Print the global and local gulp versions.</td>
</tr>
<tr>
<td>--require [path]</td>
<td></td>
<td>Will require a module before running the gulpfile. This is useful for transpilers but also has other applications.</td>
</tr>
<tr>
<td>--gulpfile [path]</td>
<td>-f</td>
<td>Manually set path of gulpfile. Useful if you have multiple gulpfiles. This will set the CWD to the gulpfile directory as well.</td>
</tr>
<tr>
<td>--cwd [path]</td>
<td></td>
<td>Manually set the CWD. The search for the gulpfile, as well as the relativity of all requires (including the `--require` flag) will be from here.</td>
</tr>
<tr>
<td>--verify [path (optional)]</td>
<td></td>
<td>Will verify plugins referenced in project's package.json against the plugins blacklist.</td>
</tr>
<tr>
<td>--tasks</td>
<td>-T</td>
<td>Print the task dependency tree for the loaded gulpfile.</td>
</tr>
<tr>
<td>--tasks-simple</td>
<td></td>
<td>Print a plaintext list of tasks for the loaded gulpfile.</td>
</tr>
<tr>
<td>--tasks-json [path]</td>
<td></td>
<td>Print the task dependency tree, in JSON format, for the loaded gulpfile. The [path] argument is optional, and if given writes the JSON to the path.</td>
</tr>
<tr>
<td>--tasks-depth [number]</td>
<td></td>
<td>Specify the depth of the task dependency tree to print. This flag can be used with --tasks or --tasks-json. (This flag was named --depth before but is deprecated.)</td>
</tr>
<tr>
<td>--compact-tasks</td>
<td></td>
<td>Reduce the output of task dependency tree by printing only top tasks and their child tasks. This flag can be used with --tasks or --tasks-json.</td>
</tr>
<tr>
<td>--sort-tasks</td>
<td></td>
<td>Will sort top tasks of task dependency tree. This flag can be used with --tasks.</td>
</tr>
<tr>
<td>--color</td>
<td></td>
<td>Will force gulp and gulp plugins to display colors, even when no color support is detected.</td>
</tr>
<tr>
<td>--no-color</td>
<td></td>
<td>Will force gulp and gulp plugins to not display colors, even when color support is detected.</td>
</tr>
<tr>
<td>--silent</td>
<td>-S</td>
<td>Suppress all gulp logging.</td>
</tr>
<tr>
<td>--continue</td>
<td></td>
<td>Continue execution of tasks upon failure.</td>
</tr>
<tr>
<td>--series</td>
<td></td>
<td>Run tasks given on the CLI in series (the default is parallel).</td>
</tr>
<tr>
<td>--log-level</td>
<td>-L</td>
<td>Set the loglevel. -L for least verbose and -LLLL for most verbose. -LLL is default.</td>
</tr>
</tbody>
</table>
## License
MIT
[downloads-image]: http://img.shields.io/npm/dm/gulp-cli.svg
[npm-url]: https://www.npmjs.com/package/gulp-cli
[npm-image]: http://img.shields.io/npm/v/gulp-cli.svg
[travis-url]: https://travis-ci.org/gulpjs/gulp-cli
[travis-image]: http://img.shields.io/travis/gulpjs/gulp-cli.svg?label=travis-ci
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/gulp-cli
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/gulp-cli.svg?label=appveyor
[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-cli
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/gulp-cli/master.svg
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg

5
node_modules/gulp/node_modules/gulp-cli/bin/gulp.js generated vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env node
'use strict';
require('../')();

View File

@ -0,0 +1,20 @@
# Completion for gulp
> Thanks to the grunt team, specifically Tyler Kellen
To enable tasks auto-completion in shell you should add `eval "$(gulp --completion=shell)"` in your `.shellrc` file.
## Bash
Add `eval "$(gulp --completion=bash)"` to `~/.bashrc`.
## Zsh
Add `eval "$(gulp --completion=zsh)"` to `~/.zshrc`.
## Powershell
Add `Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine)` to `$PROFILE`.
## Fish
Add `gulp --completion=fish | source` to `~/.config/fish/config.fish`.

View File

@ -0,0 +1,27 @@
#!/bin/bash
# Borrowed from grunt-cli
# http://gruntjs.com/
#
# Copyright (c) 2012 Tyler Kellen, contributors
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
# Usage:
#
# To enable bash <tab> completion for gulp, add the following line (minus the
# leading #, which is the bash comment character) to your ~/.bashrc file:
#
# eval "$(gulp --completion=bash)"
# Enable bash autocompletion.
function _gulp_completions() {
# The currently-being-completed word.
local cur="${COMP_WORDS[COMP_CWORD]}"
#Grab tasks
local compls=$(gulp --tasks-simple)
# Tell complete what stuff to show.
COMPREPLY=($(compgen -W "$compls" -- "$cur"))
}
complete -o default -F _gulp_completions gulp

View File

@ -0,0 +1,10 @@
#!/usr/bin/env fish
# Usage:
#
# To enable fish <tab> completion for gulp, add the following line to
# your ~/.config/fish/config.fish file:
#
# gulp --completion=fish | source
complete -c gulp -a "(gulp --tasks-simple)" -f

View File

@ -0,0 +1,61 @@
# Copyright (c) 2014 Jason Jarrett
#
# Tab completion for the `gulp`
#
# Usage:
#
# To enable powershell <tab> completion for gulp you need to be running
# at least PowerShell v3 or greater and add the below to your $PROFILE
#
# Invoke-Expression ((gulp --completion=powershell) -join [System.Environment]::NewLine)
#
#
$gulp_completion_Process = {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
# Load up an assembly to read the gulpfile's sha1
if(-not $global:GulpSHA1Managed) {
[Reflection.Assembly]::LoadWithPartialName("System.Security") | out-null
$global:GulpSHA1Managed = new-Object System.Security.Cryptography.SHA1Managed
}
# setup a global (in-memory) cache
if(-not $global:GulpfileShaCache) {
$global:GulpfileShaCache = @{};
}
$cache = $global:GulpfileShaCache;
# Get the gulpfile's sha1
$sha1gulpFile = (resolve-path gulpfile.js -ErrorAction Ignore | %{
$file = [System.IO.File]::Open($_.Path, "open", "read")
[string]::join('', ($global:GulpSHA1Managed.ComputeHash($file) | %{ $_.ToString("x2") }))
$file.Dispose()
})
# lookup the sha1 for previously cached task lists.
if($cache.ContainsKey($sha1gulpFile)){
$tasks = $cache[$sha1gulpFile];
} else {
$tasks = (gulp --tasks-simple).split("`n");
$cache[$sha1gulpFile] = $tasks;
}
$tasks |
where { $_.startswith($commandName) }
Sort-Object |
foreach { New-Object System.Management.Automation.CompletionResult $_, $_, 'ParameterValue', ('{0}' -f $_) }
}
if (-not $global:options) {
$global:options = @{
CustomArgumentCompleters = @{};
NativeArgumentCompleters = @{}
}
}
$global:options['NativeArgumentCompleters']['gulp'] = $gulp_completion_Process
$function:tabexpansion2 = $function:tabexpansion2 -replace 'End\r\n{','End { if ($null -ne $options) { $options += $global:options} else {$options = $global:options}'

25
node_modules/gulp/node_modules/gulp-cli/completion/zsh generated vendored Normal file
View File

@ -0,0 +1,25 @@
#!/bin/zsh
# Borrowed from grunt-cli
# http://gruntjs.com/
#
# Copyright (c) 2012 Tyler Kellen, contributors
# Licensed under the MIT license.
# https://github.com/gruntjs/grunt/blob/master/LICENSE-MIT
# Usage:
#
# To enable zsh <tab> completion for gulp, add the following line (minus the
# leading #, which is the zsh comment character) to your ~/.zshrc file:
#
# eval "$(gulp --completion=zsh)"
# Enable zsh autocompletion.
function _gulp_completion() {
# Grab tasks
compls=$(gulp --tasks-simple)
completions=(${=compls})
compadd -- $completions
}
compdef _gulp_completion gulp

83
node_modules/gulp/node_modules/gulp-cli/gulp.1 generated vendored Normal file
View File

@ -0,0 +1,83 @@
.TH "GULP" "" "June 2020" "" ""
.SH "NAME"
\fBgulp\fR
.SS Usage
.P
\fBgulp [flags] <task> <task>\.\.\.\fP
.SS Tasks
.P
The task(s) listed will be executed\.
If more than one task is listed, Gulp will execute all of them
concurrently, that is, as if they had all been listed as dependencies of
a single task\.
.P
By default, Gulp does not serialize tasks listed on the command line\. If you would like to execute tasks serially, you must specify the \fB\-\-series\fP flag\. e\.g\. \fBgulp clean build \-\-series\fP
.P
Just running \fBgulp\fP will execute the task \fBdefault\fP\|\. If there is no
\fBdefault\fP task, gulp will error\.
.SS Compilers
.P
You can find a list of supported languages at https:// If you would like to add support for a new language, send pull requests/open issues on that project\.
.SS Environment
.P
The CLI adds process\.env\.INIT_CWD which is the original cwd it was launched from\.
.SS Flags
.P
gulp has very few flags to know about\. All other flags are for tasks to use if needed\.
.P
\fBSome flags only work with gulp 4 and will be ignored when invoked against gulp 3\.\fR
.P
\fB\-\-help\fR, \fB\-h\fR
Show the help\.
.P
\fB\-\-version\fR, \fB\-v\fR
Print the global and local gulp versions\.
.P
\fB\-\-require\fR [path]
Will require a module before running the gulpfile\. This is useful for transpilers but also has other applications\.
.P
\fB\-\-gulpfile\fR [path], \fB\-f\fR [path]
Manually set path of gulpfile\. Useful if you have multiple gulpfiles\. This will set the CWD to the gulpfile directory as well\.
.P
\fB\-\-cwd\fR [path]
Manually set the CWD\. The search for the gulpfile, as well as the relativity of all requires will be from here\.
.P
\fB\-\-verify\fR [path (optional)]
Will verify plugins referenced in project's package\.json against the plugins blacklist\.
.P
\fB\-\-tasks\fR, \fB\-T\fR
Print the task dependency tree for the loaded gulpfile\.
.P
\fB\-\-tasks\-simple\fR
Print a plaintext list of tasks for the loaded gulpfile\.
.P
\fB\-\-tasks\-json\fR [path]
Print the task dependency tree, in JSON format, for the loaded gulpfile\. The [path] argument is optional, and if given writes the JSON to the path\.
.P
\fB\-\-tasks\-depth\fR [number]
Specify the depth of the task dependency tree to print\. This flag can be used with \-\-tasks or \-\-tasks\-json\. (This flag was named \-\-depth before but is deprecated\.)
.P
\fB\-\-compact\-tasks\fR
Reduce the output of task dependency tree by printing only top tasks and their child tasks\. This flag can be used with \-\-tasks or \-\-tasks\-json\.
.P
\fB\-\-sort\-tasks\fR
Will sort top tasks of task dependency tree\. This flag can be used with \-\-tasks\.
.P
\fB\-\-color\fR
Will force gulp and gulp plugins to display colors, even when no color support is detected\.
.P
\fB\-\-no\-color\fR
Will force gulp and gulp plugins to not display colors, even when color support is detected\.
.P
\fB\-\-silent\fR, \fB\-S\fR
Suppress all gulp logging\.
.P
\fB\-\-continue\fR
Continue execution of tasks upon failure\.
.P
\fB\-\-series\fR
Run tasks given on the CLI in series (the default is parallel)\.
.P
\fB\-\-log\-level\fR, \fB\-L\fR
Set the loglevel\. \-L for least verbose and \-LLLL for most verbose\. \-LLL is default\.

212
node_modules/gulp/node_modules/gulp-cli/index.js generated vendored Normal file
View File

@ -0,0 +1,212 @@
'use strict';
var fs = require('fs');
var path = require('path');
var log = require('gulplog');
var yargs = require('yargs');
var Liftoff = require('liftoff');
var interpret = require('interpret');
var v8flags = require('v8flags');
var findRange = require('semver-greatest-satisfied-range');
var ansi = require('./lib/shared/ansi');
var exit = require('./lib/shared/exit');
var tildify = require('./lib/shared/tildify');
var makeTitle = require('./lib/shared/make-title');
var cliOptions = require('./lib/shared/cli-options');
var completion = require('./lib/shared/completion');
var verifyDeps = require('./lib/shared/verify-dependencies');
var cliVersion = require('./package.json').version;
var getBlacklist = require('./lib/shared/get-blacklist');
var toConsole = require('./lib/shared/log/to-console');
var loadConfigFiles = require('./lib/shared/config/load-files');
var mergeConfigToCliFlags = require('./lib/shared/config/cli-flags');
var mergeConfigToEnvFlags = require('./lib/shared/config/env-flags');
// Logging functions
var logVerify = require('./lib/shared/log/verify');
var logBlacklistError = require('./lib/shared/log/blacklist-error');
// Get supported ranges
var ranges = fs.readdirSync(path.join(__dirname, '/lib/versioned/'));
// Set env var for ORIGINAL cwd
// before anything touches it
process.env.INIT_CWD = process.cwd();
var cli = new Liftoff({
name: 'gulp',
processTitle: makeTitle('gulp', process.argv.slice(2)),
completions: completion,
extensions: interpret.jsVariants,
v8flags: v8flags,
configFiles: {
'.gulp': {
home: {
path: '~',
extensions: interpret.extensions,
},
cwd: {
path: '.',
extensions: interpret.extensions,
},
},
},
});
var usage =
'\n' + ansi.bold('Usage:') +
' gulp ' + ansi.blue('[options]') + ' tasks';
var parser = yargs.usage(usage, cliOptions);
var opts = parser.argv;
cli.on('require', function(name) {
// This is needed because interpret needs to stub the .mjs extension
// Without the .mjs require hook, rechoir blows up
// However, we don't want to show the mjs-stub loader in the logs
if (path.basename(name, '.js') !== 'mjs-stub') {
log.info('Requiring external module', ansi.magenta(name));
}
});
cli.on('requireFail', function(name, error) {
log.warn(
ansi.yellow('Failed to load external module'),
ansi.magenta(name)
);
/* istanbul ignore else */
if (error) {
log.warn(ansi.yellow(error.toString()));
}
});
cli.on('respawn', function(flags, child) {
var nodeFlags = ansi.magenta(flags.join(', '));
var pid = ansi.magenta(child.pid);
log.info('Node flags detected:', nodeFlags);
log.info('Respawned to PID:', pid);
});
function run() {
cli.prepare({
cwd: opts.cwd,
configPath: opts.gulpfile,
require: opts.require,
completion: opts.completion,
}, function(env) {
var cfgLoadOrder = ['home', 'cwd'];
var cfg = loadConfigFiles(env.configFiles['.gulp'], cfgLoadOrder);
opts = mergeConfigToCliFlags(opts, cfg);
env = mergeConfigToEnvFlags(env, cfg, opts);
env.configProps = cfg;
// Set up event listeners for logging again after configuring.
toConsole(log, opts);
cli.execute(env, env.nodeFlags, handleArguments);
});
}
module.exports = run;
// The actual logic
function handleArguments(env) {
// This translates the --continue flag in gulp
// To the settle env variable for undertaker
// We use the process.env so the user's gulpfile
// Can know about the flag
if (opts.continue) {
process.env.UNDERTAKER_SETTLE = 'true';
}
if (opts.help) {
parser.showHelp(console.log);
exit(0);
}
// Anything that needs to print outside of the logging mechanism should use console.log
if (opts.version) {
console.log('CLI version:', cliVersion);
console.log('Local version:', env.modulePackage.version || 'Unknown');
exit(0);
}
if (opts.verify) {
var pkgPath = opts.verify !== true ? opts.verify : 'package.json';
/* istanbul ignore else */
if (path.resolve(pkgPath) !== path.normalize(pkgPath)) {
pkgPath = path.join(env.cwd, pkgPath);
}
log.info('Verifying plugins in ' + pkgPath);
return getBlacklist(function(err, blacklist) {
/* istanbul ignore if */
if (err) {
return logBlacklistError(err);
}
var blacklisted = verifyDeps(require(pkgPath), blacklist);
logVerify(blacklisted);
});
}
if (!env.modulePath) {
/* istanbul ignore next */
var missingNodeModules =
fs.existsSync(path.join(env.cwd, 'package.json'))
&& !fs.existsSync(path.join(env.cwd, 'node_modules'));
/* istanbul ignore next */
var missingGulpMessage =
missingNodeModules
? 'Local modules not found in'
: 'Local gulp not found in';
log.error(
ansi.red(missingGulpMessage),
ansi.magenta(tildify(env.cwd))
);
var hasYarn = fs.existsSync(path.join(env.cwd, 'yarn.lock'));
/* istanbul ignore next */
var installCommand =
missingNodeModules
? hasYarn
? 'yarn install'
: 'npm install'
: hasYarn
? 'yarn add gulp'
: 'npm install gulp';
log.error(ansi.red('Try running: ' + installCommand));
exit(1);
}
if (!env.configPath) {
log.error(ansi.red('No gulpfile found'));
exit(1);
}
// Chdir before requiring gulpfile to make sure
// we let them chdir as needed
if (process.cwd() !== env.cwd) {
process.chdir(env.cwd);
log.info(
'Working directory changed to',
ansi.magenta(tildify(env.cwd))
);
}
// Find the correct CLI version to run
var range = findRange(env.modulePackage.version, ranges);
if (!range) {
log.error(
ansi.red('Unsupported gulp version', env.modulePackage.version)
);
exit(1);
}
// Load and execute the CLI version
var versionedDir = path.join(__dirname, '/lib/versioned/', range, '/');
require(versionedDir)(opts, env, env.configProps);
}

View File

@ -0,0 +1,41 @@
'use strict';
var colors = require('ansi-colors');
var supportsColor = require('color-support');
var hasColors = colorize();
/* istanbul ignore next */
module.exports = {
red: hasColors ? colors.red : noColor,
green: hasColors ? colors.green : noColor,
blue: hasColors ? colors.blue : noColor,
magenta: hasColors ? colors.magenta : noColor,
cyan: hasColors ? colors.cyan : noColor,
white: hasColors ? colors.white : noColor,
gray: hasColors ? colors.gray : noColor,
bgred: hasColors ? colors.bgred : noColor,
bold: hasColors ? colors.bold : noColor,
yellow: hasColors ? colors.yellow : noColor,
};
function noColor(message) {
return message;
}
function hasFlag(flag) {
return (process.argv.indexOf('--' + flag) !== -1);
}
function colorize() {
if (hasFlag('no-color')) {
return false;
}
/* istanbul ignore if */
if (hasFlag('color')) {
return true;
}
return supportsColor();
}

View File

@ -0,0 +1,122 @@
'use strict';
var ansi = require('./ansi');
module.exports = {
help: {
alias: 'h',
type: 'boolean',
desc: ansi.gray(
'Show this help.'),
},
version: {
alias: 'v',
type: 'boolean',
desc: ansi.gray(
'Print the global and local gulp versions.'),
},
require: {
type: 'string',
requiresArg: true,
desc: ansi.gray(
'Will require a module before running the gulpfile. ' +
'This is useful for transpilers but also has other applications.'),
},
gulpfile: {
alias: 'f',
type: 'string',
requiresArg: true,
desc: ansi.gray(
'Manually set path of gulpfile. Useful if you have multiple gulpfiles. ' +
'This will set the CWD to the gulpfile directory as well.'),
},
cwd: {
type: 'string',
requiresArg: true,
desc: ansi.gray(
'Manually set the CWD. The search for the gulpfile, ' +
'as well as the relativity of all requires will be from here.'),
},
verify: {
desc: ansi.gray(
'Will verify plugins referenced in project\'s package.json against ' +
'the plugins blacklist.'),
},
tasks: {
alias: 'T',
type: 'boolean',
desc: ansi.gray(
'Print the task dependency tree for the loaded gulpfile.'),
},
'tasks-simple': {
type: 'boolean',
desc: ansi.gray(
'Print a plaintext list of tasks for the loaded gulpfile.'),
},
'tasks-json': {
desc: ansi.gray(
'Print the task dependency tree, ' +
'in JSON format, for the loaded gulpfile.'),
},
'tasks-depth': {
alias: 'depth',
type: 'number',
requiresArg: true,
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Specify the depth of the task dependency tree.'),
},
'compact-tasks': {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Reduce the output of task dependency tree by printing ' +
'only top tasks and their child tasks.'),
},
'sort-tasks': {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Will sort top tasks of task dependency tree.'),
},
color: {
type: 'boolean',
desc: ansi.gray(
'Will force gulp and gulp plugins to display colors, ' +
'even when no color support is detected.'),
},
'no-color': {
type: 'boolean',
desc: ansi.gray(
'Will force gulp and gulp plugins to not display colors, ' +
'even when color support is detected.'),
},
silent: {
alias: 'S',
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Suppress all gulp logging.'),
},
continue: {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Continue execution of tasks upon failure.'),
},
series: {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Run tasks given on the CLI in series (the default is parallel).'),
},
'log-level': {
alias: 'L',
// Type isn't needed because count acts as a boolean
count: true,
default: undefined, // To detect if this cli option is specified.
desc: ansi.gray(
'Set the loglevel. -L for least verbose and -LLLL for most verbose. ' +
'-LLL is default.'),
},
};

View File

@ -0,0 +1,22 @@
'use strict';
var fs = require('fs');
var path = require('path');
module.exports = function(name) {
if (typeof name !== 'string') {
throw new Error('Missing completion type');
}
var file = path.join(__dirname, '../../completion', name);
try {
console.log(fs.readFileSync(file, 'utf8'));
process.exit(0);
} catch (err) {
console.log(
'echo "gulp autocompletion rules for',
'\'' + name + '\'',
'not found"'
);
process.exit(5);
}
};

View File

@ -0,0 +1,25 @@
'use strict';
var copyProps = require('copy-props');
var fromTo = {
'flags.silent': 'silent',
'flags.continue': 'continue',
'flags.series': 'series',
'flags.logLevel': 'logLevel',
'flags.compactTasks': 'compactTasks',
'flags.tasksDepth': 'tasksDepth',
'flags.sortTasks': 'sortTasks',
};
function mergeConfigToCliFlags(opt, config) {
return copyProps(config, opt, fromTo, defaults);
}
function defaults(cfgInfo, optInfo) {
if (optInfo.value === undefined) {
return cfgInfo.value;
}
}
module.exports = mergeConfigToCliFlags;

View File

@ -0,0 +1,44 @@
'use strict';
var path = require('path');
var copyProps = require('copy-props');
var toFrom = {
configPath: 'flags.gulpfile',
configBase: 'flags.gulpfile',
require: 'flags.require',
nodeFlags: 'flags.nodeFlags',
};
function mergeConfigToEnvFlags(env, config, cliOpts) {
// This must reverse because `flags.gulpfile` determines 2 different properties
var reverse = true;
return copyProps(env, config, toFrom, convert, reverse);
function convert(configInfo, envInfo) {
if (envInfo.keyChain === 'configBase') {
if (cliOpts.gulpfile === undefined) {
return path.dirname(configInfo.value);
}
return;
}
if (envInfo.keyChain === 'configPath') {
if (cliOpts.gulpfile === undefined) {
return configInfo.value;
}
return;
}
if (envInfo.keyChain === 'require') {
return [].concat(envInfo.value, configInfo.value);
}
/* istanbul ignore else */
if (envInfo.keyChain === 'nodeFlags') {
return [].concat(configInfo.value || []);
}
}
}
module.exports = mergeConfigToEnvFlags;

View File

@ -0,0 +1,30 @@
'use strict';
var copyProps = require('copy-props');
var path = require('path');
function loadConfigFiles(configFiles, configFileOrder) {
var config = {};
configFileOrder.forEach(loadFile);
function loadFile(key) {
var filePath = configFiles[key];
if (!filePath) {
return;
}
copyProps(require(filePath), config, convert);
function convert(loadedInfo) {
if (loadedInfo.keyChain === 'flags.gulpfile') {
return path.resolve(path.dirname(filePath), loadedInfo.value);
}
return loadedInfo.value;
}
}
return config;
}
module.exports = loadConfigFiles;

View File

@ -0,0 +1,15 @@
'use strict';
// Fix stdout truncation on windows
function exit(code) {
/* istanbul ignore next */
if (process.platform === 'win32' && process.stdout.bufferSize) {
process.stdout.once('drain', function() {
process.exit(code);
});
return;
}
process.exit(code);
}
module.exports = exit;

View File

@ -0,0 +1,62 @@
'use strict';
var https = require('https');
var concat = require('concat-stream');
var url = 'https://raw.githubusercontent.com/gulpjs/plugins/master/src/blackList.json';
function collect(stream, cb) {
stream.on('error', cb);
stream.pipe(concat(onSuccess));
function onSuccess(result) {
cb(null, result);
}
}
function parse(str, cb) {
try {
cb(null, JSON.parse(str));
} catch (err) {
/* istanbul ignore next */
cb(new Error('Invalid Blacklist JSON.'));
}
}
// TODO: Test this impl
function getBlacklist(cb) {
https.get(url, onRequest);
function onRequest(res) {
/* istanbul ignore if */
if (res.statusCode !== 200) {
// TODO: Test different status codes
return cb(new Error('Request failed. Status Code: ' + res.statusCode));
}
res.setEncoding('utf8');
collect(res, onCollect);
}
function onCollect(err, result) {
/* istanbul ignore if */
if (err) {
return cb(err);
}
parse(result, onParse);
}
function onParse(err, blacklist) {
/* istanbul ignore if */
if (err) {
return cb(err);
}
cb(null, blacklist);
}
}
module.exports = getBlacklist;

View File

@ -0,0 +1,15 @@
'use strict';
var log = require('gulplog');
var ansi = require('../ansi');
var exit = require('../exit');
/* istanbul ignore next */
function logBlacklistError(err) {
log.error(ansi.red('Error: failed to retrieve plugins black-list'));
log.error(err.message); // Avoid duplicating for each version
exit(1);
}
module.exports = logBlacklistError;

View File

@ -0,0 +1,81 @@
'use strict';
function copyNode(node) {
var newNode = {};
Object.keys(node).forEach(function(key) {
newNode[key] = node[key];
});
return newNode;
}
var defaultNodeFactory = {
topNode: copyNode,
taskNode: copyNode,
childNode: copyNode,
};
function copyTree(tree, opts, nodeFactory) {
opts = opts || {};
var depth = opts.tasksDepth;
depth = typeof depth === 'number' ? ((depth < 1) ? 1 : depth) : null;
nodeFactory = nodeFactory || defaultNodeFactory;
var newTree = nodeFactory.topNode(tree);
newTree.nodes = [];
if (Array.isArray(tree.nodes)) {
tree.nodes.forEach(visit);
}
function visit(node) {
var newNode = nodeFactory.taskNode(node);
newNode.nodes = [];
newTree.nodes.push(newNode);
if (opts.compactTasks) {
forEach(node.nodes, copyNotRecursively, newNode);
} else if (!depth || depth > 1) {
forEach(node.nodes, copyRecursively, depth, 2, newNode);
}
}
function copyNotRecursively(child, newParent) {
var newChild = nodeFactory.childNode(child);
newChild.nodes = [];
newParent.nodes.push(newChild);
if (child.branch) {
forEach(child.nodes, copyNotRecursively, newChild);
}
}
function copyRecursively(child, maxDepth, nowDepth, newParent) {
var newChild = nodeFactory.childNode(child);
newChild.nodes = [];
newParent.nodes.push(newChild);
if (!maxDepth || maxDepth > nowDepth) {
forEach(child.nodes, copyRecursively, maxDepth, nowDepth + 1, newChild);
}
}
return newTree;
}
function forEach(nodes, fn) {
if (!Array.isArray(nodes)) {
return;
}
var args = Array.prototype.slice.call(arguments, 2);
for (var i = 0, n = nodes.length; i < n; i++) {
fn.apply(nodes[i], [nodes[i]].concat(args));
}
}
module.exports = copyTree;

View File

@ -0,0 +1,166 @@
'use strict';
var archy = require('archy');
var log = require('gulplog');
var sortBy = require('array-sort');
var isObject = require('isobject');
var ansi = require('../ansi');
var copyTree = require('./copy-tree');
function logTasks(tree, opts, getTask) {
if (opts.sortTasks) {
tree.nodes = sortBy(tree.nodes, 'label');
}
var lineInfos = [];
var entryObserver = getLineInfoCollector(lineInfos);
var nodeFactory = getNodeFactory(getTask, entryObserver);
tree = copyTree(tree, opts, nodeFactory);
var spacer = getSpacerForLineIndents(tree, lineInfos);
var lines = getLinesContainingOnlyBranches(tree);
log.info(tree.label);
printTreeList(lines, spacer, lineInfos);
}
function getLineInfoCollector(lineInfos) {
return {
topTask: function(node) {
lineInfos.push({
name: node.label,
desc: node.desc,
type: 'top',
});
},
option: function(opt) {
lineInfos.push({
name: opt.label,
desc: opt.desc,
type: 'option',
});
},
childTask: function(node) {
lineInfos.push({
name: node.label,
type: 'child',
});
},
};
}
function getNodeFactory(getTask, entryObserver) {
return {
topNode: function(node) {
return {
label: node.label,
};
},
taskNode: function(node) {
/* istanbul ignore next */
var task = getTask(node.label) || {};
var newNode = {
label: node.label,
desc: typeof task.description === 'string' ? task.description : '',
opts: [],
};
entryObserver.topTask(newNode);
if (isObject(task.flags)) {
Object.keys(task.flags).sort().forEach(function(flag) {
if (flag.length === 0) {
return;
}
/* istanbul ignore next */
var opt = {
label: flag,
desc: typeof task.flags[flag] === 'string' ? task.flags[flag] : '',
};
entryObserver.option(opt);
newNode.opts.push(opt);
newNode.label += '\n' + opt.label; // The way of archy for options.
});
}
return newNode;
},
childNode: function(node) {
var newChild = {
label: node.label,
};
entryObserver.childTask(newChild);
newChild.label = ''; // Because don't use child tasks to calc indents.
return newChild;
},
};
}
function getSpacerForLineIndents(tree, lineInfos) {
var maxSize = 0;
var sizes = [];
archy(tree)
.split('\n')
.slice(1, -1)
.forEach(function(line, index) {
var info = lineInfos[index];
if (info.type === 'top' || info.type === 'option') {
maxSize = Math.max(maxSize, line.length);
sizes.push(line.length);
} else {
sizes.push(0);
}
});
maxSize += 3;
return function(index) {
return Array(maxSize - sizes[index]).join(' ');
};
}
function getLinesContainingOnlyBranches(tree) {
tree.nodes.forEach(function(node) {
node.label = '';
node.opts.forEach(function() {
node.label += '\n';
});
});
return archy(tree)
.split('\n')
.slice(1, -1);
}
function printTreeList(lines, spacer, lineInfos) {
lines.forEach(function(branch, index) {
var info = lineInfos[index];
var line = ansi.white(branch);
if (info.type === 'top') {
line += ansi.cyan(info.name);
if (info.desc.length > 0) {
line += spacer(index) + ansi.white(info.desc);
}
} else if (info.type === 'option') {
line += ansi.magenta(info.name);
if (info.desc.length > 0) {
line += spacer(index) + ansi.white('…' + info.desc);
}
} else { // If (info.type === 'child') {
line += ansi.white(info.name);
}
log.info(line);
});
}
module.exports = logTasks;

View File

@ -0,0 +1,58 @@
'use strict';
var fancyLog = require('fancy-log');
/* istanbul ignore next */
function noop() {}
// The sorting of the levels is
// significant.
var levels = [
'error', // -L: Logs error events.
'warn', // -LL: Logs warn and error events.
'info', // -LLL: Logs info, warn and error events.
'debug', // -LLLL: Logs all log levels.
];
function cleanup(log) {
levels.forEach(removeListeners);
function removeListeners(level) {
if (level === 'error') {
log.removeListener(level, noop);
log.removeListener(level, fancyLog.error);
} else {
log.removeListener(level, fancyLog);
}
}
}
function toConsole(log, opts) {
// Remove previous listeners to enable to call this twice.
cleanup(log);
// Return immediately if logging is
// not desired.
if (opts.tasksSimple || opts.tasksJson || opts.help || opts.version || opts.silent) {
// Keep from crashing process when silent.
log.on('error', noop);
return;
}
// Default loglevel to info level (3).
var loglevel = opts.logLevel || 3;
levels
.filter(function(item, i) {
return i < loglevel;
})
.forEach(function(level) {
if (level === 'error') {
log.on(level, fancyLog.error);
} else {
log.on(level, fancyLog);
}
});
}
module.exports = toConsole;

View File

@ -0,0 +1,28 @@
'use strict';
var log = require('gulplog');
var ansi = require('../ansi');
var exit = require('../exit');
function logVerify(blacklisted) {
var pluginNames = Object.keys(blacklisted);
if (!pluginNames.length) {
log.info(
ansi.green('There are no blacklisted plugins in this project')
);
exit(0);
}
log.warn(ansi.red('Blacklisted plugins found in this project:'));
pluginNames.map(function(pluginName) {
var reason = blacklisted[pluginName];
log.warn(ansi.bgred(pluginName) + ': ' + reason);
});
exit(1);
}
module.exports = logVerify;

View File

@ -0,0 +1,11 @@
'use strict';
function makeTitle(cmd, argv) {
if (!argv || argv.length === 0) {
return cmd;
}
return [cmd].concat(argv).join(' ');
}
module.exports = makeTitle;

View File

@ -0,0 +1,21 @@
'use strict';
function registerExports(gulpInst, tasks) {
var taskNames = Object.keys(tasks);
if (taskNames.length) {
taskNames.forEach(register);
}
function register(taskName) {
var task = tasks[taskName];
if (typeof task !== 'function') {
return;
}
gulpInst.task(task.displayName || taskName, task);
}
}
module.exports = registerExports;

View File

@ -0,0 +1,32 @@
'use strict';
var pathToFileURL = require('url').pathToFileURL;
var importESM;
try {
// Node.js <10 errors out with a SyntaxError when loading a script that uses import().
// So a function is dynamically created to catch the SyntaxError at runtime instead of parsetime.
// That way we can keep supporting all Node.js versions all the way back to 0.10.
importESM = new Function('id', 'return import(id);');
} catch (e) {
importESM = null;
}
function requireOrImport(path, callback) {
var err = null;
var cjs;
try {
cjs = require(path);
} catch (e) {
if (pathToFileURL && importESM && e.code === 'ERR_REQUIRE_ESM') {
// This is needed on Windows, because import() fails if providing a Windows file path.
var url = pathToFileURL(path);
importESM(url).then(function(esm) { callback(null, esm); }, callback);
return;
}
err = e;
}
process.nextTick(function() { callback(err, cjs); });
}
module.exports = requireOrImport;

View File

@ -0,0 +1,9 @@
'use strict';
var replaceHomedir = require('replace-homedir');
function tildify(filepath) {
return replaceHomedir(filepath, '~');
}
module.exports = tildify;

View File

@ -0,0 +1,25 @@
'use strict';
var matchdep = require('matchdep');
/**
* Given a collection of plugin names verifies this collection against
* the blacklist. Returns an object with:
* [plugin name]=>[blacklisting reason]
* or an empty object if none of the dependencies to check are blacklisted.
*
* @param pkg - package.json contents
* @param blacklist - contents of the blacklist in JSON format
*/
function verifyDependencies(pkg, blacklist) {
var blacklisted = matchdep
.filterAll(Object.keys(blacklist), pkg)
.reduce(function(blacklisted, pluginName) {
blacklisted[pluginName] = blacklist[pluginName];
return blacklisted;
}, {});
return blacklisted;
}
module.exports = verifyDependencies;

View File

@ -0,0 +1,23 @@
'use strict';
// Format orchestrator errors
function formatError(e) {
if (!e.err) {
return e.message;
}
// PluginError
if (typeof e.err.showStack === 'boolean') {
return e.err.toString();
}
// Normal error
if (e.err.stack) {
return e.err.stack;
}
// Unknown (string, number, etc.)
return new Error(String(e.err)).stack;
}
module.exports = formatError;

View File

@ -0,0 +1,83 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var taskTree = require('./task-tree');
var copyTree = require('../../shared/log/copy-tree');
var tildify = require('../../shared/tildify');
var logTasks = require('../../shared/log/tasks');
var ansi = require('../../shared/ansi');
var exit = require('../../shared/exit');
var logEvents = require('./log/events');
var logTasksSimple = require('./log/tasks-simple');
var registerExports = require('../../shared/register-exports');
var requireOrImport = require('../../shared/require-or-import');
function execute(opts, env, config) {
var tasks = opts._;
var toRun = tasks.length ? tasks : ['default'];
if (opts.tasksSimple || opts.tasks || opts.tasksJson) {
// Mute stdout if we are listing tasks
stdout.mute();
}
// This is what actually loads up the gulpfile
requireOrImport(env.configPath, function(err, exported) {
// Before import(), if require() failed we got an unhandled exception on the module level.
// So console.error() & exit() were added here to mimic the old behavior as close as possible.
if (err) {
console.error(err);
exit(1);
}
log.info('Using gulpfile', ansi.magenta(tildify(env.configPath)));
var gulpInst = require(env.modulePath);
logEvents(gulpInst);
registerExports(gulpInst, exported);
// Always unmute stdout after gulpfile is required
stdout.unmute();
var tree;
if (opts.tasksSimple) {
return logTasksSimple(env, gulpInst);
}
if (opts.tasks) {
tree = taskTree(gulpInst.tasks);
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + ansi.magenta(tildify(env.configPath));
}
return logTasks(tree, opts, function(task) {
return gulpInst.tasks[task].fn;
});
}
if (opts.tasksJson) {
tree = taskTree(gulpInst.tasks);
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + tildify(env.configPath);
}
var output = JSON.stringify(copyTree(tree, opts));
if (typeof opts.tasksJson === 'boolean') {
return console.log(output);
}
return fs.writeFileSync(opts.tasksJson, output, 'utf-8');
}
gulpInst.start.apply(gulpInst, toRun);
});
}
module.exports = execute;

View File

@ -0,0 +1,60 @@
'use strict';
var log = require('gulplog');
var prettyTime = require('pretty-hrtime');
var ansi = require('../../../shared/ansi');
var exit = require('../../../shared/exit');
var formatError = require('../format-error');
// Wire up logging events
function logEvents(gulpInst) {
// Exit with 0 or 1
var failed = false;
process.once('exit', function(code) {
if (code === 0 && failed) {
exit(1);
}
});
// Total hack due to poor error management in orchestrator
gulpInst.on('err', function() {
failed = true;
});
gulpInst.on('task_start', function(e) {
// TODO: batch these
// so when 5 tasks start at once it only logs one time with all 5
log.info('Starting', '\'' + ansi.cyan(e.task) + '\'...');
});
gulpInst.on('task_stop', function(e) {
var time = prettyTime(e.hrDuration);
log.info(
'Finished', '\'' + ansi.cyan(e.task) + '\'',
'after', ansi.magenta(time)
);
});
gulpInst.on('task_err', function(e) {
var msg = formatError(e);
var time = prettyTime(e.hrDuration);
log.error(
'\'' + ansi.cyan(e.task) + '\'',
ansi.red('errored after'),
ansi.magenta(time)
);
log.error(msg);
});
gulpInst.on('task_not_found', function(err) {
log.error(
ansi.red('Task \'' + err.task + '\' is not in your gulpfile')
);
log.error('Please check the documentation for proper gulpfile formatting');
exit(1);
});
}
module.exports = logEvents;

View File

@ -0,0 +1,9 @@
'use strict';
function logTasksSimple(env, localGulp) {
console.log(Object.keys(localGulp.tasks)
.join('\n')
.trim());
}
module.exports = logTasksSimple;

View File

@ -0,0 +1,27 @@
'use strict';
module.exports = function(tasks) {
var map = {};
var arr = [];
Object.keys(tasks).forEach(function(taskname) {
var task = {
label: taskname,
type: 'task',
nodes: [],
};
map[taskname] = task;
arr.push(task);
});
Object.keys(tasks).forEach(function(taskname) {
var task = map[taskname];
tasks[taskname].dep.forEach(function(childname) {
var child = map[childname] || {
label: childname,
type: 'task',
nodes: [],
};
task.nodes.push(child);
});
});
return { label: 'Tasks', nodes: arr };
};

View File

@ -0,0 +1,96 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var ansi = require('../../shared/ansi');
var exit = require('../../shared/exit');
var tildify = require('../../shared/tildify');
var logTasks = require('../../shared/log/tasks');
var logEvents = require('../^4.0.0/log/events');
var logSyncTask = require('../^4.0.0/log/sync-task');
var logTasksSimple = require('../^4.0.0/log/tasks-simple');
var registerExports = require('../../shared/register-exports');
var copyTree = require('../../shared/log/copy-tree');
var requireOrImport = require('../../shared/require-or-import');
function execute(opts, env, config) {
var tasks = opts._;
var toRun = tasks.length ? tasks : ['default'];
if (opts.tasksSimple || opts.tasks || opts.tasksJson) {
// Mute stdout if we are listing tasks
stdout.mute();
}
var gulpInst = require(env.modulePath);
logEvents(gulpInst);
logSyncTask(gulpInst, opts);
// This is what actually loads up the gulpfile
requireOrImport(env.configPath, function(err, exported) {
// Before import(), if require() failed we got an unhandled exception on the module level.
// So console.error() & exit() were added here to mimic the old behavior as close as possible.
if (err) {
console.error(err);
exit(1);
}
registerExports(gulpInst, exported);
// Always unmute stdout after gulpfile is required
stdout.unmute();
var tree;
if (opts.tasksSimple) {
return logTasksSimple(gulpInst.tree());
}
if (opts.tasks) {
tree = {};
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + ansi.magenta(tildify(env.configPath));
}
tree.nodes = gulpInst.tree({ deep: true });
return logTasks(tree, opts, function(taskname) {
return gulpInst.task(taskname);
});
}
if (opts.tasksJson) {
tree = {};
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + tildify(env.configPath);
}
tree.nodes = gulpInst.tree({ deep: true });
var output = JSON.stringify(copyTree(tree, opts));
if (typeof opts.tasksJson === 'boolean' && opts.tasksJson) {
return console.log(output);
}
return fs.writeFileSync(opts.tasksJson, output, 'utf-8');
}
try {
log.info('Using gulpfile', ansi.magenta(tildify(env.configPath)));
var runMethod = opts.series ? 'series' : 'parallel';
gulpInst[runMethod](toRun)(function(err) {
if (err) {
exit(1);
}
});
} catch (err) {
log.error(ansi.red(err.message));
log.error('To list available tasks, try running: gulp --tasks');
exit(1);
}
});
}
module.exports = execute;

View File

@ -0,0 +1,96 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var ansi = require('../../shared/ansi');
var exit = require('../../shared/exit');
var tildify = require('../../shared/tildify');
var logTasks = require('../../shared/log/tasks');
var logEvents = require('../^4.0.0/log/events');
var logSyncTask = require('../^4.0.0/log/sync-task');
var logTasksSimple = require('../^4.0.0/log/tasks-simple');
var registerExports = require('../../shared/register-exports');
var copyTree = require('../../shared/log/copy-tree');
var getTask = require('../^4.0.0/log/get-task');
var requireOrImport = require('../../shared/require-or-import');
function execute(opts, env, config) {
var tasks = opts._;
var toRun = tasks.length ? tasks : ['default'];
if (opts.tasksSimple || opts.tasks || opts.tasksJson) {
// Mute stdout if we are listing tasks
stdout.mute();
}
var gulpInst = require(env.modulePath);
logEvents(gulpInst);
logSyncTask(gulpInst, opts);
// This is what actually loads up the gulpfile
requireOrImport(env.configPath, function(err, exported) {
// Before import(), if require() failed we got an unhandled exception on the module level.
// So console.error() & exit() were added here to mimic the old behavior as close as possible.
if (err) {
console.error(err);
exit(1);
}
registerExports(gulpInst, exported);
// Always unmute stdout after gulpfile is required
stdout.unmute();
var tree;
if (opts.tasksSimple) {
tree = gulpInst.tree();
return logTasksSimple(tree.nodes);
}
if (opts.tasks) {
tree = gulpInst.tree({ deep: true });
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + ansi.magenta(tildify(env.configPath));
}
return logTasks(tree, opts, getTask(gulpInst));
}
if (opts.tasksJson) {
tree = gulpInst.tree({ deep: true });
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + tildify(env.configPath);
}
var output = JSON.stringify(copyTree(tree, opts));
if (typeof opts.tasksJson === 'boolean' && opts.tasksJson) {
return console.log(output);
}
return fs.writeFileSync(opts.tasksJson, output, 'utf-8');
}
try {
log.info('Using gulpfile', ansi.magenta(tildify(env.configPath)));
var runMethod = opts.series ? 'series' : 'parallel';
gulpInst[runMethod](toRun)(function(err) {
if (err) {
exit(1);
}
});
} catch (err) {
log.error(ansi.red(err.message));
log.error('To list available tasks, try running: gulp --tasks');
exit(1);
}
});
}
module.exports = execute;

View File

@ -0,0 +1,24 @@
'use strict';
// Format orchestrator errors
/* istanbul ignore next */
function formatError(e) {
if (!e.error) {
return e.message;
}
// PluginError
if (typeof e.error.showStack === 'boolean') {
return e.error.toString();
}
// Normal error
if (e.error.stack) {
return e.error.stack;
}
// Unknown (string, number, etc.)
return new Error(String(e.error)).stack;
}
module.exports = formatError;

View File

@ -0,0 +1,96 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var ansi = require('../../shared/ansi');
var exit = require('../../shared/exit');
var tildify = require('../../shared/tildify');
var logTasks = require('../../shared/log/tasks');
var logEvents = require('./log/events');
var logSyncTask = require('./log/sync-task');
var logTasksSimple = require('./log/tasks-simple');
var registerExports = require('../../shared/register-exports');
var copyTree = require('../../shared/log/copy-tree');
var getTask = require('./log/get-task');
var requireOrImport = require('../../shared/require-or-import');
function execute(opts, env, config) {
var tasks = opts._;
var toRun = tasks.length ? tasks : ['default'];
if (opts.tasksSimple || opts.tasks || opts.tasksJson) {
// Mute stdout if we are listing tasks
stdout.mute();
}
var gulpInst = require(env.modulePath);
logEvents(gulpInst);
logSyncTask(gulpInst, opts);
// This is what actually loads up the gulpfile
requireOrImport(env.configPath, function(err, exported) {
// Before import(), if require() failed we got an unhandled exception on the module level.
// So console.error() & exit() were added here to mimic the old behavior as close as possible.
if (err) {
console.error(err);
exit(1);
}
registerExports(gulpInst, exported);
// Always unmute stdout after gulpfile is required
stdout.unmute();
var tree;
if (opts.tasksSimple) {
tree = gulpInst.tree();
return logTasksSimple(tree.nodes);
}
if (opts.tasks) {
tree = gulpInst.tree({ deep: true });
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + ansi.magenta(tildify(env.configPath));
}
return logTasks(tree, opts, getTask(gulpInst));
}
if (opts.tasksJson) {
tree = gulpInst.tree({ deep: true });
if (config.description && typeof config.description === 'string') {
tree.label = config.description;
} else {
tree.label = 'Tasks for ' + tildify(env.configPath);
}
var output = JSON.stringify(copyTree(tree, opts));
if (typeof opts.tasksJson === 'boolean' && opts.tasksJson) {
return console.log(output);
}
return fs.writeFileSync(opts.tasksJson, output, 'utf-8');
}
try {
log.info('Using gulpfile', ansi.magenta(tildify(env.configPath)));
var runMethod = opts.series ? 'series' : 'parallel';
gulpInst[runMethod](toRun)(function(err) {
if (err) {
exit(1);
}
});
} catch (err) {
log.error(ansi.red(err.message));
log.error('To list available tasks, try running: gulp --tasks');
exit(1);
}
});
}
module.exports = execute;

View File

@ -0,0 +1,50 @@
'use strict';
var log = require('gulplog');
var prettyTime = require('pretty-hrtime');
var ansi = require('../../../shared/ansi');
var formatError = require('../format-error');
// Wire up logging events
function logEvents(gulpInst) {
var loggedErrors = [];
gulpInst.on('start', function(evt) {
/* istanbul ignore next */
// TODO: batch these
// so when 5 tasks start at once it only logs one time with all 5
var level = evt.branch ? 'debug' : 'info';
log[level]('Starting', '\'' + ansi.cyan(evt.name) + '\'...');
});
gulpInst.on('stop', function(evt) {
var time = prettyTime(evt.duration);
/* istanbul ignore next */
var level = evt.branch ? 'debug' : 'info';
log[level](
'Finished', '\'' + ansi.cyan(evt.name) + '\'',
'after', ansi.magenta(time)
);
});
gulpInst.on('error', function(evt) {
var msg = formatError(evt);
var time = prettyTime(evt.duration);
var level = evt.branch ? 'debug' : 'error';
log[level](
'\'' + ansi.cyan(evt.name) + '\'',
ansi.red('errored after'),
ansi.magenta(time)
);
// If we haven't logged this before, log it and add to list
if (loggedErrors.indexOf(evt.error) === -1) {
log.error(msg);
loggedErrors.push(evt.error);
}
});
}
module.exports = logEvents;

View File

@ -0,0 +1,43 @@
'use strict';
var isObject = require('isobject');
function getTask(gulpInst) {
return function(name) {
var task = gulpInst.task(name);
return {
description: getDescription(task),
flags: getFlags(task),
};
};
}
function getDescription(task) {
if (typeof task.description === 'string') {
return task.description;
}
/* istanbul ignore else */
if (typeof task.unwrap === 'function') {
var origFn = task.unwrap();
if (typeof origFn.description === 'string') {
return origFn.description;
}
}
return undefined;
}
function getFlags(task) {
if (isObject(task.flags)) {
return task.flags;
}
/* istanbul ignore else */
if (typeof task.unwrap === 'function') {
var origFn = task.unwrap();
if (isObject(origFn.flags)) {
return origFn.flags;
}
}
return undefined;
}
module.exports = getTask;

View File

@ -0,0 +1,52 @@
'use strict';
var log = require('gulplog');
var ansi = require('../../../shared/ansi');
var tasks = {};
function warn() {
var taskKeys = Object.keys(tasks);
if (!taskKeys.length) {
return;
}
var taskNames = taskKeys.map(function(key) {
return tasks[key];
}).join(', ');
process.exitCode = 1;
log.warn(
ansi.red('The following tasks did not complete:'),
ansi.cyan(taskNames)
);
log.warn(
ansi.red('Did you forget to signal async completion?')
);
}
function start(e) {
tasks[e.uid] = e.name;
}
function clear(e) {
delete tasks[e.uid];
}
function clearAll() {
tasks = {};
}
function logSyncTask(gulpInst, opts) {
process.once('exit', warn);
gulpInst.on('start', start);
gulpInst.on('stop', clear);
// When not running in --continue mode, we need to clear everything on error to avoid
// false positives.
gulpInst.on('error', opts.continue ? clear : clearAll);
}
module.exports = logSyncTask;

View File

@ -0,0 +1,7 @@
'use strict';
function logTasksSimple(nodes) {
console.log(nodes.join('\n').trim());
}
module.exports = logTasksSimple;

114
node_modules/gulp/node_modules/gulp-cli/package.json generated vendored Normal file
View File

@ -0,0 +1,114 @@
{
"_from": "gulp-cli@^2.2.0",
"_id": "gulp-cli@2.3.0",
"_inBundle": false,
"_integrity": "sha512-zzGBl5fHo0EKSXsHzjspp3y5CONegCm8ErO5Qh0UzFzk2y4tMvzLWhoDokADbarfZRL2pGpRp7yt6gfJX4ph7A==",
"_location": "/gulp/gulp-cli",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "gulp-cli@^2.2.0",
"name": "gulp-cli",
"escapedName": "gulp-cli",
"rawSpec": "^2.2.0",
"saveSpec": null,
"fetchSpec": "^2.2.0"
},
"_requiredBy": [
"/gulp"
],
"_resolved": "https://registry.npmjs.org/gulp-cli/-/gulp-cli-2.3.0.tgz",
"_shasum": "ec0d380e29e52aa45e47977f0d32e18fd161122f",
"_spec": "gulp-cli@^2.2.0",
"_where": "/home/outis/Documents/Sites/BBB/node_modules/gulp",
"author": {
"name": "Gulp Team",
"email": "team@gulpjs.com",
"url": "https://gulpjs.com/"
},
"bin": {
"gulp": "bin/gulp.js"
},
"bugs": {
"url": "https://github.com/gulpjs/gulp-cli/issues"
},
"bundleDependencies": false,
"contributors": [],
"dependencies": {
"ansi-colors": "^1.0.1",
"archy": "^1.0.0",
"array-sort": "^1.0.0",
"color-support": "^1.1.3",
"concat-stream": "^1.6.0",
"copy-props": "^2.0.1",
"fancy-log": "^1.3.2",
"gulplog": "^1.0.0",
"interpret": "^1.4.0",
"isobject": "^3.0.1",
"liftoff": "^3.1.0",
"matchdep": "^2.0.0",
"mute-stdout": "^1.0.0",
"pretty-hrtime": "^1.0.0",
"replace-homedir": "^1.0.0",
"semver-greatest-satisfied-range": "^1.1.0",
"v8flags": "^3.2.0",
"yargs": "^7.1.0"
},
"deprecated": false,
"description": "Command line interface for gulp",
"devDependencies": {
"babel-preset-es2015": "^6.5.0",
"babel-register": "^6.5.1",
"coveralls": "^3.0.3",
"eslint": "^2.13.1",
"eslint-config-gulp": "^3.0.1",
"expect": "^1.20.2",
"gulp": "^4.0.0",
"gulp-test-tools": "^0.6.1",
"marked-man": "^0.2.1",
"mocha": "^3.2.0",
"nyc": "^13.3.0",
"rimraf": "^2.6.1",
"semver": "^5.7.1"
},
"engines": {
"node": ">= 0.10"
},
"files": [
"index.js",
"lib",
"bin",
"completion",
"gulp.1"
],
"homepage": "https://gulpjs.com",
"keywords": [
"build",
"stream",
"system",
"make",
"tool",
"asset",
"pipeline"
],
"license": "MIT",
"main": "index.js",
"man": [
"gulp.1"
],
"name": "gulp-cli",
"repository": {
"type": "git",
"url": "git+https://github.com/gulpjs/gulp-cli.git"
},
"scripts": {
"cover": "nyc --reporter=lcov --reporter=text-summary npm test",
"coveralls": "nyc --reporter=text-lcov npm test | coveralls",
"lint": "eslint .",
"prepublish": "marked-man --name gulp docs/CLI.md > gulp.1",
"pretest": "npm run lint",
"test": "mocha --async-only --timeout 5000 test/lib test"
},
"version": "2.3.0"
}

121
node_modules/gulp/package.json generated vendored Normal file
View File

@ -0,0 +1,121 @@
{
"_from": "gulp",
"_id": "gulp@4.0.2",
"_inBundle": false,
"_integrity": "sha512-dvEs27SCZt2ibF29xYgmnwwCYZxdxhQ/+LFWlbAW8y7jt68L/65402Lz3+CKy0Ov4rOs+NERmDq7YlZaDqUIfA==",
"_location": "/gulp",
"_phantomChildren": {
"ansi-colors": "1.1.0",
"archy": "1.0.0",
"array-sort": "1.0.0",
"color-support": "1.1.3",
"concat-stream": "1.6.2",
"copy-props": "2.0.4",
"fancy-log": "1.3.3",
"gulplog": "1.0.0",
"interpret": "1.4.0",
"isobject": "3.0.1",
"liftoff": "3.1.0",
"matchdep": "2.0.0",
"mute-stdout": "1.0.1",
"pretty-hrtime": "1.0.3",
"replace-homedir": "1.0.0",
"semver-greatest-satisfied-range": "1.1.0",
"v8flags": "3.2.0",
"yargs": "7.1.1"
},
"_requested": {
"type": "tag",
"registry": true,
"raw": "gulp",
"name": "gulp",
"escapedName": "gulp",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/gulp/-/gulp-4.0.2.tgz",
"_shasum": "543651070fd0f6ab0a0650c6a3e6ff5a7cb09caa",
"_spec": "gulp",
"_where": "/home/outis/Documents/Sites/BBB",
"author": {
"name": "Gulp Team",
"email": "team@gulpjs.com",
"url": "https://gulpjs.com/"
},
"bin": {
"gulp": "bin/gulp.js"
},
"bugs": {
"url": "https://github.com/gulpjs/gulp/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Eric Schoffstall",
"email": "yo@contra.io"
},
{
"name": "Blaine Bublitz",
"email": "blaine.bublitz@gmail.com"
}
],
"dependencies": {
"glob-watcher": "^5.0.3",
"gulp-cli": "^2.2.0",
"undertaker": "^1.2.1",
"vinyl-fs": "^3.0.0"
},
"deprecated": false,
"description": "The streaming build system.",
"devDependencies": {
"coveralls": "github:phated/node-coveralls#2.x",
"eslint": "^2.13.1",
"eslint-config-gulp": "^3.0.1",
"expect": "^1.20.2",
"mkdirp": "^0.5.1",
"mocha": "^3.0.0",
"nyc": "^10.3.2",
"rimraf": "^2.6.3"
},
"engines": {
"node": ">= 0.10"
},
"files": [
"LICENSE",
"index.js",
"bin"
],
"homepage": "https://gulpjs.com",
"keywords": [
"build",
"stream",
"system",
"make",
"tool",
"asset",
"pipeline",
"series",
"parallel",
"streaming"
],
"license": "MIT",
"main": "index.js",
"name": "gulp",
"repository": {
"type": "git",
"url": "git+https://github.com/gulpjs/gulp.git"
},
"scripts": {
"azure-pipelines": "nyc mocha --async-only --reporter xunit -O output=test.xunit",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha --async-only"
},
"version": "4.0.2"
}