initial commit

This commit is contained in:
2026-03-22 03:21:45 +02:00
commit 897fea9f4e
15431 changed files with 2548840 additions and 0 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" "" "June 2025" "" ""
.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;

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

@@ -0,0 +1,40 @@
'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 */
// Check 'ERR_REQUIRE_ASYNC_MODULE' if on node v22.12.0 or later to allow importing from files using top level await.
if (e.code === 'ERR_REQUIRE_ESM' || process.env.NYC_CONFIG || e.code === 'ERR_REQUIRE_ASYNC_MODULE') {
// 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;

415
node_modules/gulp-cli/node_modules/chalk/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,415 @@
/**
Basic foreground colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type ForegroundColor =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright';
/**
Basic background colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type BackgroundColor =
| 'bgBlack'
| 'bgRed'
| 'bgGreen'
| 'bgYellow'
| 'bgBlue'
| 'bgMagenta'
| 'bgCyan'
| 'bgWhite'
| 'bgGray'
| 'bgGrey'
| 'bgBlackBright'
| 'bgRedBright'
| 'bgGreenBright'
| 'bgYellowBright'
| 'bgBlueBright'
| 'bgMagentaBright'
| 'bgCyanBright'
| 'bgWhiteBright';
/**
Basic colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type Color = ForegroundColor | BackgroundColor;
declare type Modifiers =
| 'reset'
| 'bold'
| 'dim'
| 'italic'
| 'underline'
| 'inverse'
| 'hidden'
| 'strikethrough'
| 'visible';
declare namespace chalk {
/**
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
type Level = 0 | 1 | 2 | 3;
interface Options {
/**
Specify the color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level?: Level;
}
/**
Return a new Chalk instance.
*/
type Instance = new (options?: Options) => Chalk;
/**
Detect whether the terminal supports color.
*/
interface ColorSupport {
/**
The color level used by Chalk.
*/
level: Level;
/**
Return whether Chalk supports basic 16 colors.
*/
hasBasic: boolean;
/**
Return whether Chalk supports ANSI 256 colors.
*/
has256: boolean;
/**
Return whether Chalk supports Truecolor 16 million colors.
*/
has16m: boolean;
}
interface ChalkFunction {
/**
Use a template string.
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
@example
```
import chalk = require('chalk');
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
```
@example
```
import chalk = require('chalk');
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
```
*/
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
(...text: unknown[]): string;
}
interface Chalk extends ChalkFunction {
/**
Return a new Chalk instance.
*/
Instance: Instance;
/**
The color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level: Level;
/**
Use HEX value to set text color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.hex('#DEADED');
```
*/
hex(color: string): Chalk;
/**
Use keyword color value to set text color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.keyword('orange');
```
*/
keyword(color: string): Chalk;
/**
Use RGB values to set text color.
*/
rgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set text color.
*/
hsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set text color.
*/
hsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set text color.
*/
hwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
*/
ansi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
*/
ansi256(index: number): Chalk;
/**
Use HEX value to set background color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgHex('#DEADED');
```
*/
bgHex(color: string): Chalk;
/**
Use keyword color value to set background color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgKeyword('orange');
```
*/
bgKeyword(color: string): Chalk;
/**
Use RGB values to set background color.
*/
bgRgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set background color.
*/
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set background color.
*/
bgHsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set background color.
*/
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
Use the foreground code, not the background code (for example, not 41, nor 101).
*/
bgAnsi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
*/
bgAnsi256(index: number): Chalk;
/**
Modifier: Resets the current color chain.
*/
readonly reset: Chalk;
/**
Modifier: Make text bold.
*/
readonly bold: Chalk;
/**
Modifier: Emitting only a small amount of light.
*/
readonly dim: Chalk;
/**
Modifier: Make text italic. (Not widely supported)
*/
readonly italic: Chalk;
/**
Modifier: Make text underline. (Not widely supported)
*/
readonly underline: Chalk;
/**
Modifier: Inverse background and foreground colors.
*/
readonly inverse: Chalk;
/**
Modifier: Prints the text, but makes it invisible.
*/
readonly hidden: Chalk;
/**
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
*/
readonly strikethrough: Chalk;
/**
Modifier: Prints the text only when Chalk has a color support level > 0.
Can be useful for things that are purely cosmetic.
*/
readonly visible: Chalk;
readonly black: Chalk;
readonly red: Chalk;
readonly green: Chalk;
readonly yellow: Chalk;
readonly blue: Chalk;
readonly magenta: Chalk;
readonly cyan: Chalk;
readonly white: Chalk;
/*
Alias for `blackBright`.
*/
readonly gray: Chalk;
/*
Alias for `blackBright`.
*/
readonly grey: Chalk;
readonly blackBright: Chalk;
readonly redBright: Chalk;
readonly greenBright: Chalk;
readonly yellowBright: Chalk;
readonly blueBright: Chalk;
readonly magentaBright: Chalk;
readonly cyanBright: Chalk;
readonly whiteBright: Chalk;
readonly bgBlack: Chalk;
readonly bgRed: Chalk;
readonly bgGreen: Chalk;
readonly bgYellow: Chalk;
readonly bgBlue: Chalk;
readonly bgMagenta: Chalk;
readonly bgCyan: Chalk;
readonly bgWhite: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGray: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGrey: Chalk;
readonly bgBlackBright: Chalk;
readonly bgRedBright: Chalk;
readonly bgGreenBright: Chalk;
readonly bgYellowBright: Chalk;
readonly bgBlueBright: Chalk;
readonly bgMagentaBright: Chalk;
readonly bgCyanBright: Chalk;
readonly bgWhiteBright: Chalk;
}
}
/**
Main Chalk object that allows to chain styles together.
Call the last one as a method with a string argument.
Order doesn't matter, and later styles take precedent in case of a conflict.
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
*/
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
supportsColor: chalk.ColorSupport | false;
Level: chalk.Level;
Color: Color;
ForegroundColor: ForegroundColor;
BackgroundColor: BackgroundColor;
Modifiers: Modifiers;
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
};
export = chalk;

9
node_modules/gulp-cli/node_modules/chalk/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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.

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

@@ -0,0 +1,68 @@
{
"name": "chalk",
"version": "4.1.2",
"description": "Terminal string styling done right",
"license": "MIT",
"repository": "chalk/chalk",
"funding": "https://github.com/chalk/chalk?sponsor=1",
"main": "source",
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && nyc ava && tsd",
"bench": "matcha benchmark.js"
},
"files": [
"source",
"index.d.ts"
],
"keywords": [
"color",
"colour",
"colors",
"terminal",
"console",
"cli",
"string",
"str",
"ansi",
"style",
"styles",
"tty",
"formatting",
"rgb",
"256",
"shell",
"xterm",
"log",
"logging",
"command-line",
"text"
],
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"devDependencies": {
"ava": "^2.4.0",
"coveralls": "^3.0.7",
"execa": "^4.0.0",
"import-fresh": "^3.1.0",
"matcha": "^0.7.0",
"nyc": "^15.0.0",
"resolve-from": "^5.0.0",
"tsd": "^0.7.4",
"xo": "^0.28.2"
},
"xo": {
"rules": {
"unicorn/prefer-string-slice": "off",
"unicorn/prefer-includes": "off",
"@typescript-eslint/member-ordering": "off",
"no-redeclare": "off",
"unicorn/string-content": "off",
"unicorn/better-regex": "off"
}
}
}

341
node_modules/gulp-cli/node_modules/chalk/readme.md generated vendored Normal file
View File

@@ -0,0 +1,341 @@
<h1 align="center">
<br>
<br>
<img width="320" src="media/logo.svg" alt="Chalk">
<br>
<br>
<br>
</h1>
> Terminal string styling done right
[![Build Status](https://travis-ci.org/chalk/chalk.svg?branch=master)](https://travis-ci.org/chalk/chalk) [![Coverage Status](https://coveralls.io/repos/github/chalk/chalk/badge.svg?branch=master)](https://coveralls.io/github/chalk/chalk?branch=master) [![npm dependents](https://badgen.net/npm/dependents/chalk)](https://www.npmjs.com/package/chalk?activeTab=dependents) [![Downloads](https://badgen.net/npm/dt/chalk)](https://www.npmjs.com/package/chalk) [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://www.youtube.com/watch?v=9auOCbH5Ns4) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/xojs/xo) ![TypeScript-ready](https://img.shields.io/npm/types/chalk.svg) [![run on repl.it](https://repl.it/badge/github/chalk/chalk)](https://repl.it/github/chalk/chalk)
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
<br>
---
<div align="center">
<p>
<p>
<sup>
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
</sup>
</p>
<sup>Special thanks to:</sup>
<br>
<br>
<a href="https://standardresume.co/tech">
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
</a>
<br>
<br>
<a href="https://retool.com/?utm_campaign=sindresorhus">
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
</a>
<br>
<br>
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
<div>
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
</div>
<b>All your environment variables, in one place</b>
<div>
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
<br>
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
</div>
</a>
<br>
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
<div>
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
</div>
</a>
</p>
</div>
---
<br>
## Highlights
- Expressive API
- Highly performant
- Ability to nest styles
- [256/Truecolor color support](#256-and-truecolor-color-support)
- Auto-detects color support
- Doesn't extend `String.prototype`
- Clean and focused
- Actively maintained
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
## Install
```console
$ npm install chalk
```
## Usage
```js
const chalk = require('chalk');
console.log(chalk.blue('Hello world!'));
```
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
```js
const chalk = require('chalk');
const log = console.log;
// Combine styled and normal strings
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
// Compose multiple styles using the chainable API
log(chalk.blue.bgRed.bold('Hello world!'));
// Pass in multiple arguments
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
// Nest styles
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
// Nest styles of the same type even (color, underline, background)
log(chalk.green(
'I am a green line ' +
chalk.blue.underline.bold('with a blue substring') +
' that becomes green again!'
));
// ES2015 template literal
log(`
CPU: ${chalk.red('90%')}
RAM: ${chalk.green('40%')}
DISK: ${chalk.yellow('70%')}
`);
// ES2015 tagged template literal
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
// Use RGB colors in terminal emulators that support it.
log(chalk.keyword('orange')('Yay for orange colored text!'));
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
log(chalk.hex('#DEADED').bold('Bold gray!'));
```
Easily define your own themes:
```js
const chalk = require('chalk');
const error = chalk.bold.red;
const warning = chalk.keyword('orange');
console.log(error('Error!'));
console.log(warning('Warning!'));
```
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
```js
const name = 'Sindre';
console.log(chalk.green('Hello %s'), name);
//=> 'Hello Sindre'
```
## API
### chalk.`<style>[.<style>...](string, [string...])`
Example: `chalk.red.bold.underline('Hello', 'world');`
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
Multiple arguments will be separated by space.
### chalk.level
Specifies the level of color support.
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
If you need to change this in a reusable module, create a new instance:
```js
const ctx = new chalk.Instance({level: 0});
```
| Level | Description |
| :---: | :--- |
| `0` | All colors disabled |
| `1` | Basic color support (16 colors) |
| `2` | 256 color support |
| `3` | Truecolor support (16 million colors) |
### chalk.supportsColor
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
### chalk.stderr and chalk.stderr.supportsColor
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
## Styles
### Modifiers
- `reset` - Resets the current color chain.
- `bold` - Make text bold.
- `dim` - Emitting only a small amount of light.
- `italic` - Make text italic. *(Not widely supported)*
- `underline` - Make text underline. *(Not widely supported)*
- `inverse`- Inverse background and foreground colors.
- `hidden` - Prints the text, but makes it invisible.
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
### Colors
- `black`
- `red`
- `green`
- `yellow`
- `blue`
- `magenta`
- `cyan`
- `white`
- `blackBright` (alias: `gray`, `grey`)
- `redBright`
- `greenBright`
- `yellowBright`
- `blueBright`
- `magentaBright`
- `cyanBright`
- `whiteBright`
### Background colors
- `bgBlack`
- `bgRed`
- `bgGreen`
- `bgYellow`
- `bgBlue`
- `bgMagenta`
- `bgCyan`
- `bgWhite`
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
- `bgRedBright`
- `bgGreenBright`
- `bgYellowBright`
- `bgBlueBright`
- `bgMagentaBright`
- `bgCyanBright`
- `bgWhiteBright`
## Tagged template literal
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
```js
const chalk = require('chalk');
const miles = 18;
const calculateFeet = miles => miles * 5280;
console.log(chalk`
There are {bold 5280 feet} in a mile.
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
`);
```
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
```js
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
```
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
## 256 and Truecolor color support
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
Examples:
- `chalk.hex('#DEADED').underline('Hello, world!')`
- `chalk.keyword('orange')('Some orange text')`
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
- `chalk.bgKeyword('orange')('Some orange text')`
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
The following color models can be used:
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
## Windows
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
## Origin story
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
## chalk for enterprise
Available as part of the Tidelift Subscription.
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
## Related
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
## Maintainers
- [Sindre Sorhus](https://github.com/sindresorhus)
- [Josh Junon](https://github.com/qix-)

View File

@@ -0,0 +1,229 @@
'use strict';
const ansiStyles = require('ansi-styles');
const {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');
const {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
} = require('./util');
const {isArray} = Array;
// `supportsColor.level` → `ansiStyles.color[name]` mapping
const levelMapping = [
'ansi',
'ansi',
'ansi256',
'ansi16m'
];
const styles = Object.create(null);
const applyOptions = (object, options = {}) => {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error('The `level` option should be an integer from 0 to 3');
}
// Detect level if not set manually
const colorLevel = stdoutColor ? stdoutColor.level : 0;
object.level = options.level === undefined ? colorLevel : options.level;
};
class ChalkClass {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}
const chalkFactory = options => {
const chalk = {};
applyOptions(chalk, options);
chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);
Object.setPrototypeOf(chalk, Chalk.prototype);
Object.setPrototypeOf(chalk.template, chalk);
chalk.template.constructor = () => {
throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');
};
chalk.template.Instance = ChalkClass;
return chalk.template;
};
function Chalk(options) {
return chalkFactory(options);
}
for (const [styleName, style] of Object.entries(ansiStyles)) {
styles[styleName] = {
get() {
const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);
Object.defineProperty(this, styleName, {value: builder});
return builder;
}
};
}
styles.visible = {
get() {
const builder = createBuilder(this, this._styler, true);
Object.defineProperty(this, 'visible', {value: builder});
return builder;
}
};
const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];
for (const model of usedModels) {
styles[model] = {
get() {
const {level} = this;
return function (...arguments_) {
const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
}
for (const model of usedModels) {
const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);
styles[bgModel] = {
get() {
const {level} = this;
return function (...arguments_) {
const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);
return createBuilder(this, styler, this._isEmpty);
};
}
};
}
const proto = Object.defineProperties(() => {}, {
...styles,
level: {
enumerable: true,
get() {
return this._generator.level;
},
set(level) {
this._generator.level = level;
}
}
});
const createStyler = (open, close, parent) => {
let openAll;
let closeAll;
if (parent === undefined) {
openAll = open;
closeAll = close;
} else {
openAll = parent.openAll + open;
closeAll = close + parent.closeAll;
}
return {
open,
close,
openAll,
closeAll,
parent
};
};
const createBuilder = (self, _styler, _isEmpty) => {
const builder = (...arguments_) => {
if (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {
// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`
return applyStyle(builder, chalkTag(builder, ...arguments_));
}
// Single argument is hot path, implicit coercion is faster than anything
// eslint-disable-next-line no-implicit-coercion
return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));
};
// We alter the prototype because we must return a function, but there is
// no way to create a function with a different prototype
Object.setPrototypeOf(builder, proto);
builder._generator = self;
builder._styler = _styler;
builder._isEmpty = _isEmpty;
return builder;
};
const applyStyle = (self, string) => {
if (self.level <= 0 || !string) {
return self._isEmpty ? '' : string;
}
let styler = self._styler;
if (styler === undefined) {
return string;
}
const {openAll, closeAll} = styler;
if (string.indexOf('\u001B') !== -1) {
while (styler !== undefined) {
// Replace any instances already present with a re-opening code
// otherwise only the part of the string until said closing code
// will be colored, and the rest will simply be 'plain'.
string = stringReplaceAll(string, styler.close, styler.open);
styler = styler.parent;
}
}
// We can move both next actions out of loop, because remaining actions in loop won't have
// any/visible effect on parts we add here. Close the styling before a linebreak and reopen
// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92
const lfIndex = string.indexOf('\n');
if (lfIndex !== -1) {
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
}
return openAll + string + closeAll;
};
let template;
const chalkTag = (chalk, ...strings) => {
const [firstString] = strings;
if (!isArray(firstString) || !isArray(firstString.raw)) {
// If chalk() was called by itself or with a string,
// return the string itself as a string.
return strings.join(' ');
}
const arguments_ = strings.slice(1);
const parts = [firstString.raw[0]];
for (let i = 1; i < firstString.length; i++) {
parts.push(
String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'),
String(firstString.raw[i])
);
}
if (template === undefined) {
template = require('./templates');
}
return template(chalk, parts.join(''));
};
Object.defineProperties(Chalk.prototype, styles);
const chalk = Chalk(); // eslint-disable-line new-cap
chalk.supportsColor = stdoutColor;
chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap
chalk.stderr.supportsColor = stderrColor;
module.exports = chalk;

View File

@@ -0,0 +1,134 @@
'use strict';
const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;
const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;
const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;
const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;
const ESCAPES = new Map([
['n', '\n'],
['r', '\r'],
['t', '\t'],
['b', '\b'],
['f', '\f'],
['v', '\v'],
['0', '\0'],
['\\', '\\'],
['e', '\u001B'],
['a', '\u0007']
]);
function unescape(c) {
const u = c[0] === 'u';
const bracket = c[1] === '{';
if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {
return String.fromCharCode(parseInt(c.slice(1), 16));
}
if (u && bracket) {
return String.fromCodePoint(parseInt(c.slice(2, -1), 16));
}
return ESCAPES.get(c) || c;
}
function parseArguments(name, arguments_) {
const results = [];
const chunks = arguments_.trim().split(/\s*,\s*/g);
let matches;
for (const chunk of chunks) {
const number = Number(chunk);
if (!Number.isNaN(number)) {
results.push(number);
} else if ((matches = chunk.match(STRING_REGEX))) {
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
} else {
throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);
}
}
return results;
}
function parseStyle(style) {
STYLE_REGEX.lastIndex = 0;
const results = [];
let matches;
while ((matches = STYLE_REGEX.exec(style)) !== null) {
const name = matches[1];
if (matches[2]) {
const args = parseArguments(name, matches[2]);
results.push([name].concat(args));
} else {
results.push([name]);
}
}
return results;
}
function buildStyle(chalk, styles) {
const enabled = {};
for (const layer of styles) {
for (const style of layer.styles) {
enabled[style[0]] = layer.inverse ? null : style.slice(1);
}
}
let current = chalk;
for (const [styleName, styles] of Object.entries(enabled)) {
if (!Array.isArray(styles)) {
continue;
}
if (!(styleName in current)) {
throw new Error(`Unknown Chalk style: ${styleName}`);
}
current = styles.length > 0 ? current[styleName](...styles) : current[styleName];
}
return current;
}
module.exports = (chalk, temporary) => {
const styles = [];
const chunks = [];
let chunk = [];
// eslint-disable-next-line max-params
temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {
if (escapeCharacter) {
chunk.push(unescape(escapeCharacter));
} else if (style) {
const string = chunk.join('');
chunk = [];
chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));
styles.push({inverse, styles: parseStyle(style)});
} else if (close) {
if (styles.length === 0) {
throw new Error('Found extraneous } in Chalk template literal');
}
chunks.push(buildStyle(chalk, styles)(chunk.join('')));
chunk = [];
styles.pop();
} else {
chunk.push(character);
}
});
chunks.push(chunk.join(''));
if (styles.length > 0) {
const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`;
throw new Error(errMessage);
}
return chunks.join('');
};

View File

@@ -0,0 +1,39 @@
'use strict';
const stringReplaceAll = (string, substring, replacer) => {
let index = string.indexOf(substring);
if (index === -1) {
return string;
}
const substringLength = substring.length;
let endIndex = 0;
let returnValue = '';
do {
returnValue += string.substr(endIndex, index - endIndex) + substring + replacer;
endIndex = index + substringLength;
index = string.indexOf(substring, endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {
let endIndex = 0;
let returnValue = '';
do {
const gotCR = string[index - 1] === '\r';
returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix;
endIndex = index + 1;
index = string.indexOf('\n', endIndex);
} while (index !== -1);
returnValue += string.substr(endIndex);
return returnValue;
};
module.exports = {
stringReplaceAll,
stringEncaseCRLFWithFirstIndex
};

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

@@ -0,0 +1,80 @@
{
"name": "gulp-cli",
"version": "3.1.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.1",
"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"
]
}