Initial import with skill sheet working
This commit is contained in:
19
node_modules/gulp-cli/lib/shared/array-find.js
generated
vendored
Normal file
19
node_modules/gulp-cli/lib/shared/array-find.js
generated
vendored
Normal 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
20
node_modules/gulp-cli/lib/shared/completion.js
generated
vendored
Normal 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
26
node_modules/gulp-cli/lib/shared/config/cli-flags.js
generated
vendored
Normal 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
15
node_modules/gulp-cli/lib/shared/exit.js
generated
vendored
Normal 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
7
node_modules/gulp-cli/lib/shared/is-object.js
generated
vendored
Normal 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
81
node_modules/gulp-cli/lib/shared/log/copy-tree.js
generated
vendored
Normal 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
48
node_modules/gulp-cli/lib/shared/log/format-hrtime.js
generated
vendored
Normal 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
171
node_modules/gulp-cli/lib/shared/log/tasks.js
generated
vendored
Normal 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
135
node_modules/gulp-cli/lib/shared/log/to-console.js
generated
vendored
Normal 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
11
node_modules/gulp-cli/lib/shared/make-title.js
generated
vendored
Normal 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;
|
94
node_modules/gulp-cli/lib/shared/options/cli-options.js
generated
vendored
Normal file
94
node_modules/gulp-cli/lib/shared/options/cli-options.js
generated
vendored
Normal 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
24
node_modules/gulp-cli/lib/shared/options/make-help.js
generated
vendored
Normal 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
21
node_modules/gulp-cli/lib/shared/register-exports.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
function registerExports(gulpInst, tasks) {
|
||||
var taskNames = Object.keys(tasks);
|
||||
|
||||
if (taskNames.length) {
|
||||
taskNames.forEach(register);
|
||||
}
|
||||
|
||||
function register(taskName) {
|
||||
var task = tasks[taskName];
|
||||
|
||||
if (typeof task !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
gulpInst.task(task.displayName || taskName, task);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = registerExports;
|
39
node_modules/gulp-cli/lib/shared/require-or-import.js
generated
vendored
Normal file
39
node_modules/gulp-cli/lib/shared/require-or-import.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
|
||||
var pathToFileURL = require('url').pathToFileURL;
|
||||
|
||||
var importESM;
|
||||
try {
|
||||
// Node.js <10 errors out with a SyntaxError when loading a script that uses import().
|
||||
// So a function is dynamically created to catch the SyntaxError at runtime instead of parsetime.
|
||||
// That way we can keep supporting all Node.js versions all the way back to 0.10.
|
||||
importESM = new Function('id', 'return import(id);');
|
||||
} catch (e) {
|
||||
/* istanbul ignore next */
|
||||
importESM = null;
|
||||
}
|
||||
|
||||
function requireOrImport(path, callback) {
|
||||
var err = null;
|
||||
var cjs;
|
||||
try {
|
||||
cjs = require(path);
|
||||
} catch (e) {
|
||||
/* istanbul ignore else */
|
||||
if (pathToFileURL && importESM) {
|
||||
// Because e.code is undefined on nyc process.
|
||||
/* istanbul ignore else */
|
||||
if (e.code === 'ERR_REQUIRE_ESM' || process.env.NYC_CONFIG) {
|
||||
// This is needed on Windows, because import() fails if providing a Windows file path.
|
||||
var url = pathToFileURL(path);
|
||||
importESM(url).then(function(esm) { callback(null, esm); }, callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
err = e;
|
||||
}
|
||||
process.nextTick(function() { callback(err, cjs); });
|
||||
}
|
||||
|
||||
module.exports = requireOrImport;
|
9
node_modules/gulp-cli/lib/shared/tildify.js
generated
vendored
Normal file
9
node_modules/gulp-cli/lib/shared/tildify.js
generated
vendored
Normal 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
305
node_modules/gulp-cli/lib/shared/translate.js
generated
vendored
Normal 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;
|
Reference in New Issue
Block a user