install gulp to process code

This commit is contained in:
isUnknown 2024-09-20 10:32:49 +02:00
parent 24f6606c2c
commit b6a3900ee2
1651 changed files with 253427 additions and 39 deletions

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

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015, 2017-2020, 2022-2023 Blaine Bublitz <blaine.bublitz@gmail.com> and Eric Schoffstall <yo@contra.io>
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.

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

@ -0,0 +1,243 @@
<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>
# gulp-cli
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]
Command Line Utility for Gulp
## Install
```bash
npm install --global gulp-cli
```
## 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 JavaScript variant languages in [Interpret][interpret-js-variants]. 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.js`, `.gulp.ts`). You can find a list of supported JavaScript variant languages in [Interpret][interpret-js-variants].
A configuration file from the current working directory (`cwd`) or above are selected before a configuration file from the home directory (`~`).
Supported configurations properties:
| Property | Description |
|--------------------|-------------|
| description | Top-level description of the project/gulpfile (Replaces "Tasks for ~/path/of/gulpfile.js") |
| gulpfile | Set a default gulpfile |
| preload | An array of modules to preload before running the gulpfile. Any relative paths will be resolved against the `--cwd` directory (if you don't want that behavior, use absolute paths) |
| 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.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.silent | Silence logging by default |
| flags.series | Run tasks given on the CLI in series (the default is parallel) |
| message(data) | A function used to translate messages that pass through gulp-cli. Can receive an object like `{ tag: Symbol(), ...props }` where the `tag` is a symbol from `@gulpjs/messages`. The string returned from this function will be logged. If `false` is explicitly returned, no message will be logged. |
| timestamp(data) | A function used to provide timestamps for gulp-cli. Can receive an object like `{ tag: Symbol(), ...props }` where the `tag` is a symbol from `@gulpjs/messages`. The string returned from this function will be output before any messages. If `false` is explicitly returned, no timestamp will be output. |
## 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>--preload [path]</td>
<td></td>
<td>Will preload 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 preloads (with the `--preload` flag) will be from here.</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
<!-- prettier-ignore-start -->
[interpret-js-variants]: https://github.com/gulpjs/interpret#jsvariants
<!-- prettier-ignore-end -->
<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/gulp-cli.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/gulp-cli
[npm-image]: https://img.shields.io/npm/v/gulp-cli.svg?style=flat-square
[ci-url]: https://github.com/gulpjs/gulp-cli/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/gulp-cli/dev.yml?branch=master&style=flat-square
[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-cli
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp-cli.svg?style=flat-square
<!-- prettier-ignore-end -->

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

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

20
node_modules/gulp-cli/completion/README.md generated vendored Normal file
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`.

27
node_modules/gulp-cli/completion/bash generated vendored Normal file
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

10
node_modules/gulp-cli/completion/fish generated vendored Normal file
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

61
node_modules/gulp-cli/completion/powershell generated vendored Normal file
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-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

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

@ -0,0 +1,80 @@
.TH "GULP" "" "March 2024" "" ""
.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://github\.com/gulpjs/interpret \fIhttps://github\.com/gulpjs/interpret\fR\|\. 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\-\-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\.

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

@ -0,0 +1,231 @@
'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 messages = require('@gulpjs/messages');
var findRange = require('semver-greatest-satisfied-range');
var exit = require('./lib/shared/exit');
var arrayFind = require('./lib/shared/array-find');
var makeTitle = require('./lib/shared/make-title');
var makeHelp = require('./lib/shared/options/make-help');
var cliOptions = require('./lib/shared/options/cli-options');
var completion = require('./lib/shared/completion');
var cliVersion = require('./package.json').version;
var toConsole = require('./lib/shared/log/to-console');
var mergeCliOpts = require('./lib/shared/config/cli-flags');
var buildTranslations = require('./lib/shared/translate');
// 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)),
extensions: interpret.jsVariants,
v8flags: v8flags,
configFiles: [
{
name: '.gulp',
path: '.',
extensions: interpret.jsVariants,
findUp: true,
},
{
name: '.gulp',
path: '~',
extensions: interpret.jsVariants,
},
],
});
var parser = yargs
.help(false)
.version(false)
.detectLocale(false)
.showHelpOnFail(false)
.exitProcess(false)
.fail(onFail)
.options(cliOptions);
var opts = parser.parse();
// Set up event listeners for logging temporarily.
// TODO: Rework console logging before we can set up proper config
// Possibly by batching messages in gulplog until listeners are attached
var cleanupListeners = toConsole(log, opts, buildTranslations());
cli.on('preload:before', function(name) {
log.info({ tag: messages.PRELOAD_BEFORE, name: name });
});
cli.on('preload:success', function(name) {
log.info({ tag: messages.PRELOAD_SUCCESS, name: name });
});
cli.on('preload:failure', function(name, error) {
log.warn({ tag: messages.PRELOAD_FAILURE, name: name });
if (error) {
log.warn({ tag: messages.PRELOAD_ERROR, error: error });
}
});
cli.on('loader:success', 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
/* istanbul ignore else */
if (path.basename(name, '.js') !== 'mjs-stub') {
log.info({ tag: messages.LOADER_SUCCESS, name: name });
}
});
cli.on('loader:failure', function(name, error) {
log.warn({ tag: messages.LOADER_FAILURE, name: name });
if (error) {
log.warn({ tag: messages.LOADER_ERROR, error: error });
}
});
cli.on('respawn', function(flags, child) {
log.info({ tag: messages.NODE_FLAGS, flags: flags });
log.info({ tag: messages.RESPAWNED, pid: child.pid });
});
function run() {
cli.prepare({
cwd: opts.cwd,
configPath: opts.gulpfile,
preload: opts.preload,
}, onPrepare);
}
module.exports = run;
function isDefined(cfg) {
return cfg != null;
}
function onFail(message, error) {
// Run Liftoff#prepare to get the env. Primarily to load themes.
cli.prepare({}, function (env) {
// We only use the first config found, which is a departure from
// the previous implementation that merged with the home
var cfg = arrayFind(env.config, isDefined);
var translate = buildTranslations(cfg);
var errorMsg = translate.message({ tag: messages.ARGV_ERROR, message: message, error: error });
if (errorMsg) {
console.error(errorMsg);
}
makeHelp(parser, translate).showHelp(console.error);
exit(1);
});
}
function onPrepare(env) {
// We only use the first config found, which is a departure from
// the previous implementation that merged with the home
var cfg = arrayFind(env.config, isDefined);
var flags = mergeCliOpts(opts, cfg);
// Remove the previous listeners since we have appropriate config now
cleanupListeners();
var translate = buildTranslations(cfg);
// Set up event listeners for logging again after configuring.
toConsole(log, flags, translate);
cli.execute(env, cfg.nodeFlags, function (env) {
onExecute(env, flags, translate);
});
}
// The actual logic
function onExecute(env, flags, translate) {
// Moved the completion logic outside of Liftoff since we need to include translations
if (flags.completion) {
return completion(flags.completion, translate);
}
// 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 (flags.continue) {
process.env.UNDERTAKER_SETTLE = 'true';
}
if (flags.help) {
makeHelp(parser, translate).showHelp(console.log);
exit(0);
}
// Anything that needs to print outside of the logging mechanism should use console.log
if (flags.version) {
console.log('CLI version:', cliVersion);
console.log('Local version:', env.modulePackage.version || 'Unknown');
exit(0);
}
if (!env.modulePath) {
var missingNodeModules =
fs.existsSync(path.join(env.cwd, 'package.json'))
&& !fs.existsSync(path.join(env.cwd, 'node_modules'));
var hasYarn = fs.existsSync(path.join(env.cwd, 'yarn.lock'));
if (missingNodeModules) {
log.error({ tag: messages.MISSING_NODE_MODULES, cwd: env.cwd });
if (hasYarn) {
log.error({ tag: messages.YARN_INSTALL })
} else {
log.error({ tag: messages.NPM_INSTALL })
}
} else {
log.error({ tag: messages.MISSING_GULP, cwd: env.cwd });
if (hasYarn) {
log.error({ tag: messages.YARN_INSTALL_GULP });
} else {
log.error({ tag: messages.NPM_INSTALL_GULP });
}
}
exit(1);
}
if (!env.configPath) {
log.error({ tag: messages.MISSING_GULPFILE });
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({ tag: messages.CWD_CHANGED, cwd: env.cwd });
}
// Find the correct CLI version to run
var range = findRange(env.modulePackage.version, ranges);
if (!range) {
log.error({ tag: messages.UNSUPPORTED_GULP_VERSION, version: env.modulePackage.version });
exit(1);
}
// Load and execute the CLI version
var versionedDir = path.join(__dirname, '/lib/versioned/', range, '/');
require(versionedDir)(env, flags, translate);
}

19
node_modules/gulp-cli/lib/shared/array-find.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
'use strict';
function arrayFind(arr, fn) {
if (!Array.isArray(arr)) {
return;
}
var idx = 0;
while (idx < arr.length) {
var result = fn(arr[idx]);
if (result) {
// TODO: This is wrong in Liftoff
return arr[idx];
}
idx++;
}
}
module.exports = arrayFind;

20
node_modules/gulp-cli/lib/shared/completion.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
'use strict';
var fs = require('fs');
var path = require('path');
var messages = require('@gulpjs/messages');
module.exports = function(name, translate) {
if (typeof name !== 'string') {
throw new Error(translate.message({ tag: messages.COMPLETION_TYPE_MISSING }));
}
var file = path.join(__dirname, '../../completion', name);
try {
console.log(fs.readFileSync(file, 'utf8'));
process.exit(0);
} catch (err) {
console.log(translate.message({ tag: messages.COMPLETION_TYPE_UNKNOWN, name: name }));
process.exit(5);
}
};

26
node_modules/gulp-cli/lib/shared/config/cli-flags.js generated vendored Normal file
View file

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

15
node_modules/gulp-cli/lib/shared/exit.js generated vendored Normal file
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;

7
node_modules/gulp-cli/lib/shared/is-object.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
'use strict';
function isObject(v) {
return (v != null && typeof v === 'object' && !Array.isArray(v));
}
module.exports = isObject;

81
node_modules/gulp-cli/lib/shared/log/copy-tree.js generated vendored Normal file
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;

48
node_modules/gulp-cli/lib/shared/log/format-hrtime.js generated vendored Normal file
View file

@ -0,0 +1,48 @@
'use strict';
var units = [
[ 'h', 3600e9 ],
[ 'min', 60e9 ],
[ 's', 1e9 ],
[ 'ms', 1e6 ],
[ 'μs', 1e3 ],
];
function formatHrTime(hrtime) {
if (!Array.isArray(hrtime) || hrtime.length !== 2) {
return '';
}
if (typeof hrtime[0] !== 'number' || typeof hrtime[1] !== 'number') {
return '';
}
var nano = hrtime[0] * 1e9 + hrtime[1];
for (var i = 0; i < units.length; i++) {
if (nano < units[i][1]) {
continue;
}
if (nano >= units[i][1] * 10) {
return Math.round(nano / units[i][1]) + ' ' + units[i][0];
}
var s = String(Math.round(nano * 1e2 / units[i][1]));
if (s.slice(-2) === '00') {
s = s.slice(0, -2);
} else if (s.slice(-1) === '0') {
s = s.slice(0, -2) + '.' + s.slice(-2, -1);
} else {
s = s.slice(0, -2) + '.' + s.slice(-2);
}
return s + ' ' + units[i][0];
}
if (nano > 0) {
return nano + ' ns';
}
return '';
}
module.exports = formatHrTime;

171
node_modules/gulp-cli/lib/shared/log/tasks.js generated vendored Normal file
View file

@ -0,0 +1,171 @@
'use strict';
var stringWidth = require('string-width');
var messages = require('@gulpjs/messages');
var isObject = require('../is-object');
function logTasks(tree, opts, getTask, translate) {
if (opts.sortTasks) {
tree.nodes = tree.nodes.sort(compareByLabel);
}
var maxDepth = opts.tasksDepth;
if (typeof maxDepth !== 'number') {
maxDepth = 50;
} else if (maxDepth < 1) {
maxDepth = 1;
}
var compactedTasks = opts.compactTasks ? tree.nodes : [];
var treeOpts = {
maxDepth: maxDepth,
compactedTasks: compactedTasks,
getTask: getTask,
};
printTaskTree(tree, treeOpts);
function printTaskTree(tree, opts) {
var lines = [];
lines.push({ label: tree.label });
var maxLabelWidth = 0;
tree.nodes.forEach(function(node, idx, arr) {
var isLast = idx === arr.length - 1;
var w = createTreeLines(node, lines, opts, 1, '', isLast);
maxLabelWidth = Math.max(maxLabelWidth, w);
});
lines.forEach(function(line) {
var s = line.label;
if (line.desc) {
var spaces = ' '.repeat(maxLabelWidth - line.width) + ' ';
s += spaces + line.desc;
}
if (s) {
// We don't need timestamps here
console.log(s);
}
});
}
function createTreeLines(node, lines, opts, depth, bars, isLast) {
var task = { label: node.label, bars: bars, depth: depth };
if (depth === 1) {
var t = opts.getTask(node.label);
task.desc = t.description;
task.flags = t.flags;
}
var isLeaf = isLeafNode(node, depth, opts);
var maxLabelWidth = addTaskToLines(task, lines, isLast, isLeaf);
if (!isLeaf) {
bars += (isLast ? ' ' : translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_VERTICAL }));
bars += ' '
node.nodes.forEach(function(node, idx, arr) {
var isLast = idx === arr.length - 1;
createTreeLines(node, lines, opts, depth + 1, bars, isLast);
});
}
return maxLabelWidth;
}
function addTaskToLines(task, lines, isLast, isLeaf) {
var taskBars = task.bars + (isLast
? translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_UP_AND_RIGHT })
: translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT })) +
translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_HORIZONTAL });
if (isLeaf) {
taskBars += translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_HORIZONTAL });
} else {
taskBars += translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL });
}
taskBars += ' ';
var line = {};
if (task.depth === 1) {
line.label = taskBars + translate.message({ tag: messages.TASK_NAME, name: task.label });
} else {
line.label = taskBars + translate.message({ tag: messages.TASK_NAME, name: task.label });
}
line.width = stringWidth(line.label);
if (typeof task.desc === 'string' && task.desc) {
line.desc = translate.message({ tag: messages.TASK_DESCRIPTION, description: task.desc });
}
lines.push(line);
var maxLabelWidth = line.width;
if (!isObject(task.flags)) {
return maxLabelWidth;
}
var flagBars = task.bars;
if (isLast) {
flagBars += ' ';
} else {
flagBars += translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_VERTICAL });
}
flagBars += ' ';
if (isLeaf) {
flagBars += ' ';
} else {
flagBars += translate.message({ tag: messages.BOX_DRAWINGS_LIGHT_VERTICAL });
}
flagBars += ' ';
Object.entries(task.flags).sort(flagSorter).forEach(addFlagsToLines);
function addFlagsToLines(ent) {
if (typeof ent[0] !== 'string' || !ent[0]) return;
var line = {};
line.label = flagBars + translate.message({ tag: messages.TASK_FLAG, flag: ent[0] });
line.width = stringWidth(line.label);
maxLabelWidth = Math.max(maxLabelWidth, line.width);
if (typeof ent[1] === 'string' && ent[1] !== '') {
line.desc = translate.message({ tag: messages.TASK_FLAG_DESCRIPTION, description: ent[1] });
}
lines.push(line);
}
return maxLabelWidth;
}
}
function isLeafNode(node, depth, opts) {
if (depth >= opts.maxDepth) {
return true;
} else if (depth > 1 && opts.compactedTasks.includes(node)) {
return true;
} else if (!Array.isArray(node.nodes) || node.nodes.length === 0) {
return true;
}
return false;
}
function compareByLabel(a, b) {
/* istanbul ignore if */
if (!b.label) {
return -1;
} else /* istanbul ignore if */ if (!a.label) {
return 1;
} else {
return (a.label <= b.label) ? -1 : 1;
}
}
function flagSorter(a, b) {
return (a[0] <= b[0]) ? -1 : 1;
}
module.exports = logTasks;

135
node_modules/gulp-cli/lib/shared/log/to-console.js generated vendored Normal file
View file

@ -0,0 +1,135 @@
'use strict';
var messages = require('@gulpjs/messages');
/* istanbul ignore next */
function noop() {}
function toConsole(log, opts, translate) {
// 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 function () {
log.removeListener('error', noop);
};
}
// Default loglevel to info level (3).
var loglevel = opts.logLevel || 3;
var deprecatedPrinted = false;
log.on('deprecated', onDeprecated);
// -L: Logs error events.
if (loglevel > 0) {
log.on('error', onError);
}
// -LL: Logs warn and error events.
if (loglevel > 1) {
log.on('warn', onWarn);
}
// -LLL: Logs info, warn and error events.
if (loglevel > 2) {
log.on('info', onInfo);
}
if (loglevel > 3) {
log.on('debug', onDebug);
}
return function () {
log.removeListener('deprecated', onDeprecated);
log.removeListener('error', onError);
log.removeListener('warn', onWarn);
log.removeListener('info', onInfo);
log.removeListener('debug', onDebug);
};
function onDeprecated() {
if (!deprecatedPrinted) {
var msg = { tag: messages.GULPLOG_DEPRECATED };
// Get message and timestamp before printing anything to avoid
// logging a half message if there's an error in one of them
var message = translate.message(msg);
var timestamp = translate.timestamp(msg);
if (message) {
// Ensure timestamp is not written without a message
if (timestamp) {
process.stderr.write(timestamp + ' ');
}
console.error(message);
}
deprecatedPrinted = true;
}
}
function onError(msg) {
// Get message and timestamp before printing anything to avoid
// logging a half message if there's an error in one of them
var message = translate.message(msg);
var timestamp = translate.timestamp(msg);
if (message) {
// Ensure timestamp is not written without a message
if (timestamp) {
process.stderr.write(timestamp + ' ');
}
console.error(message);
}
}
// onWarn, onInfo, and onDebug are currently all the same
// implementation but separated to change independently
function onWarn(msg) {
// Get message and timestamp before printing anything to avoid
// logging a half message if there's an error in one of them
var message = translate.message(msg);
var timestamp = translate.timestamp(msg);
if (message) {
// Ensure timestamp is not written without a message
if (timestamp) {
process.stdout.write(timestamp + ' ');
}
console.log(message);
}
}
function onInfo(msg) {
// Get message and timestamp before printing anything to avoid
// logging a half message if there's an error in one of them
var message = translate.message(msg);
var timestamp = translate.timestamp(msg);
if (message) {
// Ensure timestamp is not written without a message
if (timestamp) {
process.stdout.write(timestamp + ' ');
}
console.log(message);
}
}
function onDebug(msg) {
// Get message and timestamp before printing anything to avoid
// logging a half message if there's an error in one of them
var message = translate.message(msg);
var timestamp = translate.timestamp(msg);
if (message) {
// Ensure timestamp is not written without a message
if (timestamp) {
process.stdout.write(timestamp + ' ');
}
console.log(message);
}
}
}
module.exports = toConsole;

11
node_modules/gulp-cli/lib/shared/make-title.js generated vendored Normal file
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,94 @@
'use strict';
var messages = require('@gulpjs/messages');
var options = {
help: {
alias: 'h',
type: 'boolean',
tag: messages.FLAG_HELP,
},
version: {
alias: 'v',
type: 'boolean',
tag: messages.FLAG_VERSION,
},
preload: {
type: 'string',
requiresArg: true,
tag: messages.FLAG_PRELOAD,
},
gulpfile: {
alias: 'f',
type: 'string',
requiresArg: true,
tag: messages.FLAG_GULPFILE,
},
cwd: {
type: 'string',
requiresArg: true,
tag: messages.FLAG_CWD,
},
tasks: {
alias: 'T',
type: 'boolean',
tag: messages.FLAG_TASKS,
},
'tasks-simple': {
type: 'boolean',
tag: messages.FLAG_TASKS_SIMPLE,
},
'tasks-json': {
tag: messages.FLAG_TASKS_JSON,
},
'tasks-depth': {
alias: 'depth',
type: 'number',
requiresArg: true,
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_TASKS_DEPTH,
},
'compact-tasks': {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_COMPACT_TASKS,
},
'sort-tasks': {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_SORT_TASKS,
},
color: {
type: 'boolean',
tag: messages.FLAG_COLOR,
},
'no-color': {
type: 'boolean',
tag: messages.FLAG_NO_COLOR,
},
silent: {
alias: 'S',
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_SILENT,
},
continue: {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_CONTINUE,
},
series: {
type: 'boolean',
default: undefined, // To detect if this cli option is specified.
tag: messages.FLAG_SERIES,
},
'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.
tag: messages.FLAG_LOG_LEVEL,
}
};
module.exports = options;

24
node_modules/gulp-cli/lib/shared/options/make-help.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
'use strict';
var cliOptions = require('./cli-options');
var messages = require('@gulpjs/messages');
function makeHelp(parser, translate) {
var usage = translate.message({ tag: messages.USAGE });
if (usage) {
parser.usage(usage);
}
Object.keys(cliOptions).forEach(function (flag) {
var opt = cliOptions[flag];
var description = translate.message({ tag: opt.tag });
if (description) {
parser.describe(flag, description);
}
});
return parser;
}
module.exports = makeHelp;

21
node_modules/gulp-cli/lib/shared/register-exports.js generated vendored Normal file
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;

39
node_modules/gulp-cli/lib/shared/require-or-import.js generated vendored Normal file
View file

@ -0,0 +1,39 @@
'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) {
/* istanbul ignore next */
importESM = null;
}
function requireOrImport(path, callback) {
var err = null;
var cjs;
try {
cjs = require(path);
} catch (e) {
/* istanbul ignore else */
if (pathToFileURL && importESM) {
// Because e.code is undefined on nyc process.
/* istanbul ignore else */
if (e.code === 'ERR_REQUIRE_ESM' || process.env.NYC_CONFIG) {
// 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;
}
}
/* istanbul ignore next */
err = e;
}
process.nextTick(function() { callback(err, cjs); });
}
module.exports = requireOrImport;

9
node_modules/gulp-cli/lib/shared/tildify.js generated vendored Normal file
View file

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

305
node_modules/gulp-cli/lib/shared/translate.js generated vendored Normal file
View file

@ -0,0 +1,305 @@
'use strict';
var util = require('util');
var chalk = require('chalk');
var messages = require('@gulpjs/messages');
var tildify = require('./tildify');
var formatTime = require('./log/format-hrtime');
function Timestamp() {
this.now = new Date();
}
Timestamp.prototype[util.inspect.custom] = function (depth, opts) {
var timestamp = this.now.toLocaleTimeString('en', { hour12: false });
return '[' + opts.stylize(timestamp, 'date') + ']';
};
function getDefaultMessage(data) {
switch (data.tag) {
case messages.PRELOAD_BEFORE: {
return 'Preloading external module: ' + chalk.magenta(data.name);
}
case messages.PRELOAD_SUCCESS: {
return 'Preloaded external module: ' + chalk.magenta(data.name)
}
case messages.PRELOAD_FAILURE: {
return chalk.yellow('Failed to preload external module: ') + chalk.magenta(data.name);
}
case messages.PRELOAD_ERROR: {
return chalk.yellow(data.error.toString());
}
case messages.LOADER_SUCCESS: {
return 'Loaded external module: ' + chalk.magenta(data.name);
}
case messages.LOADER_FAILURE: {
return chalk.yellow('Failed to load external module: ') + chalk.magenta(data.name);
}
case messages.LOADER_ERROR: {
return chalk.yellow(data.error.toString());
}
case messages.NODE_FLAGS: {
var nodeFlags = chalk.magenta(data.flags.join(', '));
return 'Node flags detected: ' + nodeFlags;
}
case messages.RESPAWNED: {
var pid = chalk.magenta(data.pid);
return 'Respawned to PID: ' + pid;
}
case messages.MISSING_GULPFILE: {
return chalk.red('No gulpfile found');
}
case messages.CWD_CHANGED: {
return 'Working directory changed to ' + chalk.magenta(tildify(data.cwd));
}
case messages.UNSUPPORTED_GULP_VERSION: {
return chalk.red('Unsupported gulp version', data.version)
}
case messages.DESCRIPTION: {
return 'Tasks for ' + chalk.magenta(tildify(data.path));
}
case messages.GULPFILE: {
return 'Using gulpfile ' + chalk.magenta(tildify(data.path));
}
case messages.TASK_START: {
return "Starting '" + chalk.cyan(data.task) + "'..."
}
case messages.TASK_STOP: {
return "Finished '" + chalk.cyan(data.task) + "' after " + chalk.magenta(formatTime(data.duration));
}
case messages.TASK_FAILURE: {
return "'" + chalk.cyan(data.task) + "' " + chalk.red('errored after') + ' ' + chalk.magenta(formatTime(data.duration));
}
case messages.TASK_MISSING: {
if (data.similar) {
return chalk.red('Task never defined: ' + data.task + ' - did you mean? ' + data.similar.join(', '))
+ '\nTo list available tasks, try running: gulp --tasks';
} else {
return chalk.red('Task never defined: ' + data.task) +
'\nTo list available tasks, try running: gulp --tasks';
}
}
case messages.TASK_SYNC: {
return chalk.red('The following tasks did not complete: ') + chalk.cyan(data.tasks) + "\n"
+ chalk.red('Did you forget to signal async completion?');
}
case messages.MISSING_NODE_MODULES: {
return chalk.red('Local modules not found in') + ' ' + chalk.magenta(tildify(data.cwd));
}
case messages.MISSING_GULP: {
return chalk.red('Local gulp not found in') + ' ' + chalk.magenta(tildify(data.cwd));
}
case messages.YARN_INSTALL: {
return chalk.red('Try running: yarn install');
}
case messages.NPM_INSTALL: {
return chalk.red('Try running: npm install');
}
case messages.YARN_INSTALL_GULP: {
return chalk.red('Try running: yarn add gulp');
}
case messages.NPM_INSTALL_GULP: {
return chalk.red('Try running: npm install gulp');
}
case messages.GULPLOG_DEPRECATED: {
return chalk.yellow("gulplog v1 is deprecated. Please help your plugins update!");
}
case messages.COMPLETION_TYPE_MISSING: {
return 'Missing completion type';
}
case messages.COMPLETION_TYPE_UNKNOWN: {
return 'echo "gulp autocompletion rules for' + " '" + data.name + "' " + 'not found"'
}
case messages.ARGV_ERROR: {
return data.message;
}
case messages.EXEC_ERROR: {
return data.message;
}
case messages.TASK_ERROR: {
return data.message;
}
case messages.USAGE: {
return '\n' + chalk.bold('Usage:') + ' gulp ' + chalk.blue('[options]') + ' tasks';
}
case messages.FLAG_HELP: {
return chalk.gray('Show this help.');
}
case messages.FLAG_VERSION: {
return chalk.gray('Print the global and local gulp versions.');
}
case messages.FLAG_PRELOAD: {
return chalk.gray(
'Will preload a module before running the gulpfile. ' +
'This is useful for transpilers but also has other applications.'
);
}
case messages.FLAG_GULPFILE: {
return chalk.gray(
'Manually set path of gulpfile. Useful if you have multiple gulpfiles. ' +
'This will set the CWD to the gulpfile directory as well.'
)
}
case messages.FLAG_CWD: {
return chalk.gray(
'Manually set the CWD. The search for the gulpfile, ' +
'as well as the relativity of all requires will be from here.'
);
}
case messages.FLAG_TASKS: {
return chalk.gray('Print the task dependency tree for the loaded gulpfile.');
}
case messages.FLAG_TASKS_SIMPLE: {
return chalk.gray('Print a plaintext list of tasks for the loaded gulpfile.');
}
case messages.FLAG_TASKS_JSON: {
return chalk.gray(
'Print the task dependency tree, ' +
'in JSON format, for the loaded gulpfile.'
);
}
case messages.FLAG_TASKS_DEPTH: {
return chalk.gray('Specify the depth of the task dependency tree.');
}
case messages.FLAG_COMPACT_TASKS: {
return chalk.gray(
'Reduce the output of task dependency tree by printing ' +
'only top tasks and their child tasks.'
);
}
case messages.FLAG_SORT_TASKS: {
return chalk.gray('Will sort top tasks of task dependency tree.');
}
case messages.FLAG_COLOR: {
return chalk.gray(
'Will force gulp and gulp plugins to display colors, ' +
'even when no color support is detected.'
);
}
case messages.FLAG_NO_COLOR: {
return chalk.gray(
'Will force gulp and gulp plugins to not display colors, ' +
'even when color support is detected.'
);
}
case messages.FLAG_SILENT: {
return chalk.gray('Suppress all gulp logging.');
}
case messages.FLAG_CONTINUE: {
return chalk.gray('Continue execution of tasks upon failure.');
}
case messages.FLAG_SERIES: {
return chalk.gray('Run tasks given on the CLI in series (the default is parallel).');
}
case messages.FLAG_LOG_LEVEL: {
return chalk.gray(
'Set the loglevel. -L for least verbose and -LLLL for most verbose. ' +
'-LLL is default.'
);
}
case messages.TASK_NAME: {
return chalk.cyan(data.name);
}
case messages.TASK_DESCRIPTION: {
return chalk.white(data.description);
}
case messages.TASK_FLAG: {
return chalk.magenta(data.flag);
}
case messages.TASK_FLAG_DESCRIPTION: {
return chalk.white('…' + data.description);
}
case messages.BOX_DRAWINGS_LIGHT_UP_AND_RIGHT: {
return chalk.white('└');
}
case messages.BOX_DRAWINGS_LIGHT_VERTICAL_AND_RIGHT: {
return chalk.white('├');
}
case messages.BOX_DRAWINGS_LIGHT_HORIZONTAL: {
return chalk.white('─');
}
case messages.BOX_DRAWINGS_LIGHT_DOWN_AND_HORIZONTAL: {
return chalk.white('┬');
}
case messages.BOX_DRAWINGS_LIGHT_VERTICAL: {
return chalk.white('│');
}
default: {
return data;
}
}
}
function getDefaultTimestamp() {
return util.inspect(new Timestamp(), { colors: !!chalk.supportsColor });
}
function buildTranslations(cfg) {
cfg = cfg || {};
return {
message: function (data) {
// Don't allow an `undefined` message through
if (typeof data === 'undefined') {
data = Object.create(null);
}
var message;
if (typeof cfg.message === 'function') {
try {
message = cfg.message(data);
} catch (err) {
console.error('A problem occurred with the user-defined `message()` function.');
console.error('Please correct your `.gulp.*` config file.');
}
}
// If the user has provided a message, return it
if (message) {
return message;
}
// Users can filter messages by explicitly returning `false`
if (message === false) {
return '';
}
// If the user hasn't returned a message or silenced it with `false`
// get the default message. Will return the first argument if the message
// is not defined in the `@gulpjs/messages` package
return getDefaultMessage(data);
},
timestamp: function (data) {
// Don't allow an `undefined` message through
if (typeof data === 'undefined') {
data = Object.create(null);
}
var time;
if (typeof cfg.timestamp === 'function') {
try {
time = cfg.timestamp(data);
} catch (err) {
console.error('A problem occurred with the user-defined `timestamp()` function.');
console.error('Please correct your `.gulp.*` config file.');
}
}
// If the user has provided a timestamp, return it
if (time) {
return time;
}
// Users can filter timestamps by explicitly returning `false`
if (time === false) {
return '';
}
return getDefaultTimestamp();
}
}
}
module.exports = buildTranslations;

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;

74
node_modules/gulp-cli/lib/versioned/^3.7.0/index.js generated vendored Normal file
View file

@ -0,0 +1,74 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var messages = require('@gulpjs/messages');
var taskTree = require('./task-tree');
var copyTree = require('../../shared/log/copy-tree');
var logTasks = require('../../shared/log/tasks');
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(env, opts, translate) {
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({ tag: messages.GULPFILE, path: 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);
tree.label = translate.message({ tag: messages.DESCRIPTION, path: env.configPath });
return logTasks(tree, opts, function(task) {
return gulpInst.tasks[task].fn;
}, translate);
}
if (opts.tasksJson) {
tree = taskTree(gulpInst.tasks);
tree.label = translate.message({ tag: messages.DESCRIPTION, path: 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,46 @@
'use strict';
var log = require('gulplog');
var messages = require('@gulpjs/messages');
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({ tag: messages.TASK_START, task: e.task });
});
gulpInst.on('task_stop', function(e) {
log.info({ tag: messages.TASK_STOP, task: e.task, duration: e.hrDuration });
});
gulpInst.on('task_err', function(e) {
log.error({ tag: messages.TASK_FAILURE, task: e.task, duration: e.hrDuration });
log.error({ tag: messages.TASK_ERROR, message: formatError(e) });
});
gulpInst.on('task_not_found', function(err) {
log.error({ tag: messages.TASK_MISSING, task: err.task });
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,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;

91
node_modules/gulp-cli/lib/versioned/^4.0.0/index.js generated vendored Normal file
View file

@ -0,0 +1,91 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var messages = require('@gulpjs/messages');
var exit = require('../../shared/exit');
var logTasks = require('../../shared/log/tasks');
var logEvents = require('./log/events');
var logSyncTask = require('./log/sync-task');
var normalizeError = require('./normalize-error');
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(env, opts, translate) {
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 });
tree.label = translate.message({ tag: messages.DESCRIPTION, path: env.configPath });
return logTasks(tree, opts, getTask(gulpInst), translate);
}
if (opts.tasksJson) {
tree = gulpInst.tree({ deep: true });
tree.label = translate.message({ tag: messages.DESCRIPTION, path: 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({ tag: messages.GULPFILE, path: env.configPath });
var runMethod = opts.series ? 'series' : 'parallel';
gulpInst[runMethod](toRun)(function(err) {
if (err) {
exit(1);
}
});
} catch (err) {
normalizeError(err);
if (err.task) {
log.error({ tag: messages.TASK_MISSING, task: err.task, similar: err.similar });
} else {
log.error({ tag: messages.EXEC_ERROR, message: err.message, error: err });
}
exit(1);
}
});
}
module.exports = execute;

View file

@ -0,0 +1,39 @@
'use strict';
var log = require('gulplog');
var messages = require('@gulpjs/messages');
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]({ tag: messages.TASK_START, task: evt.name });
});
gulpInst.on('stop', function(evt) {
/* istanbul ignore next */
var level = evt.branch ? 'debug' : 'info';
log[level]({ tag: messages.TASK_STOP, task: evt.name, duration: evt.duration });
});
gulpInst.on('error', function(evt) {
var level = evt.branch ? 'debug' : 'error';
log[level]({ tag: messages.TASK_FAILURE, task: evt.name, duration: evt.duration });
// If we haven't logged this before, log it and add to list
if (loggedErrors.indexOf(evt.error) === -1) {
log.error({ tag: messages.TASK_ERROR, message: formatError(evt) });
loggedErrors.push(evt.error);
}
});
}
module.exports = logEvents;

View file

@ -0,0 +1,43 @@
'use strict';
var isObject = require('../../../shared/is-object');
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,46 @@
'use strict';
var log = require('gulplog');
var messages = require('@gulpjs/messages');
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({ tag: messages.TASK_SYNC, tasks: taskNames });
}
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;

View file

@ -0,0 +1,26 @@
'use strict';
// Normalize an undertaker v1 error like an undertaker v2 error
function normalizeError(err) {
/* istanbul ignore if */
if (!err || !err.message) {
return;
}
var fixed0 = 'Task never defined: ';
var fixed1 = ' - did you mean? ';
if (err.message.startsWith(fixed0)) {
var task = err.message.slice(fixed0.length);
var index = task.indexOf(fixed1);
if (index >= 0) {
err.similar = task.slice(index + fixed1.length).split(', ');
err.task = task.slice(0, index);
} else {
err.task = task
}
}
}
module.exports = normalizeError;

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;

89
node_modules/gulp-cli/lib/versioned/^5.0.0/index.js generated vendored Normal file
View file

@ -0,0 +1,89 @@
'use strict';
var fs = require('fs');
var log = require('gulplog');
var stdout = require('mute-stdout');
var messages = require('@gulpjs/messages');
var exit = require('../../shared/exit');
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(env, opts, translate) {
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 });
tree.label = translate.message({ tag: messages.DESCRIPTION, path: env.configPath });
return logTasks(tree, opts, getTask(gulpInst), translate);
}
if (opts.tasksJson) {
tree = gulpInst.tree({ deep: true });
tree.label = translate.message({ tag: messages.DESCRIPTION, path: 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({ tag: messages.GULPFILE, path: env.configPath });
var runMethod = opts.series ? 'series' : 'parallel';
gulpInst[runMethod](toRun)(function(err) {
if (err) {
exit(1);
}
});
} catch (err) {
if (err.task) {
log.error({ tag: messages.TASK_MISSING, task: err.task, similar: err.similar });
} else {
log.error({ tag: messages.EXEC_ERROR, message: err.message, error: err });
}
exit(1);
}
});
}
module.exports = execute;

View file

@ -0,0 +1,39 @@
'use strict';
var log = require('gulplog');
var messages = require('@gulpjs/messages');
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]({ tag: messages.TASK_START, task: evt.name });
});
gulpInst.on('stop', function(evt) {
/* istanbul ignore next */
var level = evt.branch ? 'debug' : 'info';
log[level]({ tag: messages.TASK_STOP, task: evt.name, duration: evt.duration });
});
gulpInst.on('error', function(evt) {
var level = evt.branch ? 'debug' : 'error';
log[level]({ tag: messages.TASK_FAILURE, task: evt.name, duration: evt.duration });
// If we haven't logged this before, log it and add to list
if (loggedErrors.indexOf(evt.error) === -1) {
log.error({ tag: messages.TASK_ERROR, message: formatError(evt) });
loggedErrors.push(evt.error);
}
});
}
module.exports = logEvents;

View file

@ -0,0 +1,43 @@
'use strict';
var isObject = require('../../../shared/is-object');
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,46 @@
'use strict';
var log = require('gulplog');
var messages = require('@gulpjs/messages');
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({ tag: messages.TASK_SYNC, tasks: taskNames });
}
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;

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

@ -0,0 +1,80 @@
{
"name": "gulp-cli",
"version": "3.0.0",
"description": "Command line interface for gulp",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"contributors": [],
"homepage": "https://gulpjs.com",
"repository": "gulpjs/gulp-cli",
"license": "MIT",
"man": "gulp.1",
"engines": {
"node": ">=10.13.0"
},
"main": "index.js",
"bin": {
"gulp": "bin/gulp.js"
},
"files": [
"index.js",
"lib",
"bin",
"completion",
"gulp.1"
],
"scripts": {
"lint": "eslint .",
"manpage": "marked-man --name gulp docs/CLI.md > gulp.1",
"pretest": "npm run lint",
"test": "mocha --async-only --timeout 5000 test/lib test",
"cover": "nyc mocha --async-only --timeout 5000 test/lib test"
},
"dependencies": {
"@gulpjs/messages": "^1.1.0",
"chalk": "^4.1.2",
"copy-props": "^4.0.0",
"gulplog": "^2.2.0",
"interpret": "^3.1.1",
"liftoff": "^5.0.0",
"mute-stdout": "^2.0.0",
"replace-homedir": "^2.0.0",
"semver-greatest-satisfied-range": "^2.0.0",
"string-width": "^4.2.3",
"v8flags": "^4.0.0",
"yargs": "^16.2.0"
},
"devDependencies": {
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"@babel/register": "^7.18.9",
"@gulpjs/gulplog-v1": "npm:gulplog@1.0.0",
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"expect": "^27.5.1",
"gulp": "^4.0.2",
"marked-man": "^0.7.0",
"marked": "^0.7.0",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"semver": "^7.3.8"
},
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
},
"prettier": {
"singleQuote": true
},
"keywords": [
"build",
"stream",
"system",
"make",
"tool",
"asset",
"pipeline"
]
}