Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
betterModuleName = betterModuleName
.replace( /\\/g, '/' )
.replace( './', '' )
.replace( 'multi ', '' );
// Add extra details about whether the currently processed module is an internal or external one
if ( betterModuleName.startsWith( 'node_modules' ) ) {
betterModuleName = `${ betterModuleName } ~ external`;
}
if ( betterModuleName.startsWith( 'src' ) ) {
betterModuleName = `${ betterModuleName } ~ internal`;
}
const [ betterModulesDone, betterAllModules ] = moduleProgress.split( '/' );
const moduleDetails = `${ betterModulesDone } of ${ betterAllModules } :: ${ betterModuleName }`;
logLines.push( chalk.grey( ` ${ figures.arrowRight } ${ moduleDetails }` ) );
}
} else if ( progress > 0.7 ) {
logLines.push( chalk.green( ` ${ figures.tick } Build modules` ) );
}
// STEP 3: OPTIMIZATION
if ( progress > 0.7 && progress < 0.95 ) {
// Skip if we jumped back a step, else update the step counter
if ( previousStep > 3 ) {
return;
}
if (typeof task.skipped === 'string') {
data = task.skipped;
}
} else if (data == null) {
data = task.message;
}
if (data != null) {
data = stripAnsi(
data
.trim()
.split('\n')
.filter(Boolean)
.pop(),
);
const out = indentString(`${figures.arrowRight} ${data}`, level, ' ');
output.push(
// $FlowFixMe
` ${chalk.gray(cliTruncate(out, process.stdout.columns - 3))}`,
);
}
}
if (
(task.pending || task.error != null || !task.collapse) &&
task.subtasks != null &&
task.subtasks.length > 0
) {
output = output.concat(renderTasks(task.subtasks, spinners, level + 1));
}
}
return __awaiter(this, void 0, void 0, function* () {
const iconInfo = chalk_1.default.blueBright(figures_1.info);
const iconArrow = chalk_1.default.yellow(figures_1.arrowRight);
const iconError = chalk_1.default.redBright(figures_1.cross);
const iconWarning = chalk_1.default.yellow(figures_1.warning);
const textColor = chalk_1.default.cyanBright;
const textCommand = chalk_1.default.cyan;
const highlight = chalk_1.default.yellowBright;
if (!!options.sourceCodeDir) {
fse.mkdirs(options.sourceCodeDir);
}
if (!!options.executionResultDir) {
fse.mkdirs(options.executionResultDir);
}
const executionPath = process.cwd();
const cfgMaker = new ConfigMaker_1.ConfigMaker();
const writeF = util_1.promisify(fs_1.writeFile);
// About codeceptj.json ------------------------------------------------
const CONFIG_FILE_NAME = 'codecept.json';
const renderHelper = (tasks, options, level) => {
level = level || 0;
let output = [];
for (const task of tasks) {
if (task.isEnabled()) {
const skipped = task.isSkipped() ? ` ${chalk.dim('[skipped]')}` : '';
output.push(indentString(` ${getSymbol(task, options)} ${task.title}${skipped}`, level, ' '));
if ((task.isPending() || task.isSkipped() || task.hasFailed() || task.isCompleted()) && isDefined(task.output)) {
const data = task.output.split('\n');
if (Array.isArray(data) && data.length) {
for (const datum of data) {
const out = indentString(`${figures.arrowRight} ${datum}`, level, ' ');
output.push(` ${chalk.gray(out)}`);
}
}
}
if ((task.isPending() || task.hasFailed() || options.collapse === false) && (task.hasFailed() || options.showSubtasks !== false) && task.subtasks.length > 0) {
output = output.concat(renderHelper(task.subtasks, options, level + 1));
}
}
}
return output.join('\n');
};
output.push(indentString(` ${utils.getSymbol(task, options)} ${task.title}${skipped}`, level, ' '));
if ((task.isPending() || task.isSkipped() || task.hasFailed()) && utils.isDefined(task.output)) {
let data = task.output;
if (typeof data === 'string') {
data = stripAnsi(data.trim().split('\n').filter(Boolean).pop());
if (data === '') {
data = undefined;
}
}
if (utils.isDefined(data)) {
const out = indentString(`${figures.arrowRight} ${data}`, level, ' ');
output.push(` ${chalk.gray(cliTruncate(out, process.stdout.columns - 3))}`);
}
}
if ((task.isPending() || task.hasFailed() || options.collapse === false) && (task.hasFailed() || options.showSubtasks !== false) && task.subtasks.length > 0) {
output = output.concat(renderHelper(task.subtasks, options, level + 1));
}
}
}
return output.join('\n');
};
state: task => {
const message = createMessage(task)
log(`${chalk.bold(task.title)} ${message}`)
if (task.isSkipped() && task.output) {
log(`${chalk.red(figures.arrowRight)} ${chalk.grey(task.output)}`)
}
},
data: (task, event) => {
renderDepsTree(depsTree: DepsTree, output: string[] = []) {
let indent = Array(depsTree.depth * this.props.indent)
.fill(' ')
.join('')
let frames = Spinners.dots.frames as string[]
let symbol = {
[TaskState.waiting]: chalk.gray(logFigures.ellipsis),
[TaskState.pending]: chalk.blueBright(logFigures.arrowRight),
[TaskState.loading]: chalk.cyan(frames[this.count(depsTree.uid) % frames.length]),
[TaskState.succeeded]: chalk.green(logFigures.tick),
[TaskState.failed]: chalk.red(logFigures.cross),
[TaskState.skipped]: chalk.yellow(logFigures.info),
...this.props.symbolMap,
}[depsTree.state]
let color =
(this.props.grayState || [TaskState.waiting]).indexOf(depsTree.state) >= 0
? f => chalk.gray(f)
: f => f
let skipped = depsTree.state === TaskState.skipped
output.push(
`${indent}${symbol} ${color(depsTree.task.name)}${skipped ? chalk.gray(` [skipped]`) : ''}${depsTree.priority ? chalk.gray(` [priority: ${depsTree.priority}]`) : ''}`,
)
let childDeps = ([] as DepsTree[])
.concat(...depsTree.asyncDeps)
'use strict';
var gzipSize = require('gzip-size');
var prettyBytes = require('pretty-bytes');
var chalk = require('chalk');
var figures = require('figures');
var arrow = ' ' + figures.arrowRight + ' ';
function format(size) {
return chalk.green(prettyBytes(size));
}
module.exports = function (max, min, useGzip) {
if (max == null || min == null) {
throw new Error('`max` and `min` required');
}
var ret = format(typeof max === 'number' ? max : max.length) + arrow + format(typeof min === 'number' ? min : min.length);
if (useGzip === true && typeof min !== 'number') {
ret += arrow + format(gzipSize.sync(min)) + chalk.gray(' (gzip)');
}
'use strict';
var gzipSize = require('gzip-size');
var prettyBytes = require('pretty-bytes');
var chalk = require('chalk');
var figures = require('figures');
var arrow = ' ' + figures.arrowRight + ' ';
function format(size) {
return chalk.green(prettyBytes(size));
}
module.exports = function (max, min, useGzip) {
var ret = format(typeof max === 'number' ? max : max.length) + arrow + format(typeof min === 'number' ? min : min.length);
if (useGzip === true && typeof min !== 'number') {
ret += arrow + format(gzipSize.sync(min)) + chalk.gray(' (gzip)');
}
return ret;
};
'use strict';
var util = require('util');
var barrage = require('barrage');
var css = require('css');
var CleanCSS = require('clean-css');
var cheerio = require('cheerio');
var chalk = require('chalk');
var prettyBytes = require('pretty-bytes');
var figures = require('figures');
var arrow = ' ' + figures.arrowRight + ' ';
function cleanCSS(css) {
return new CleanCSS().minify(css).styles;
}
function formatSize(size, tag) {
return chalk.green(prettyBytes(size)) + ' ' + chalk.gray('(' + tag + ')');
}
module.exports = eliminateDeadStyles;
function eliminateDeadStyles(options) {
options = options || {};
if (!options.deadCode) {
var stream = new barrage.Transform({objectMode: true});
stream._transform = function (page, _, cb) {
if (page.headers['content-type'].indexOf('text/css') !== -1 && (!options.filter || options.filter(page.url))) {
var before = page.body.length;