本文整理汇总了TypeScript中chalk.constructor类的典型用法代码示例。如果您正苦于以下问题:TypeScript constructor类的具体用法?TypeScript constructor怎么用?TypeScript constructor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了constructor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getTypeScriptInstance
export function getTypeScriptInstance(
loaderOptions: LoaderOptions,
loader: Webpack
): { instance?: TSInstance; error?: WebpackError } {
if (instances.hasOwnProperty(loaderOptions.instance)) {
const instance = instances[loaderOptions.instance];
ensureProgram(instance);
return { instance: instances[loaderOptions.instance] };
}
const colors = new chalk.constructor({ enabled: loaderOptions.colors });
const log = logger.makeLogger(loaderOptions, colors);
const compiler = getCompiler(loaderOptions, log);
if (compiler.errorMessage !== undefined) {
return { error: makeError(colors.red(compiler.errorMessage), undefined) };
}
return successfulTypeScriptInstance(
loaderOptions,
loader,
log,
colors,
compiler.compiler!,
compiler.compilerCompatible!,
compiler.compilerDetailsLogMessage!
);
}
开发者ID:johnnyreilly,项目名称:ts-loader,代码行数:28,代码来源:instances.ts
示例2: String
export const bug = (err: Error): void => {
console.log(
color.red('! %s\n\n! Please raise an issue at %s\n\n%s'),
err.message,
color.underline('https://github.com/JamieMason/ImageOptim-CLI/issues'),
String(err.stack).replace(/^/gm, ' ')
);
process.exit(1);
};
开发者ID:JamieMason,项目名称:ImageOptim-CLI,代码行数:9,代码来源:log.ts
示例3:
export const result = (
label: string = 'TOTAL',
prettySizeBefore: string,
prettySizeAfter: string,
prettySizeSaving: string,
sizeSavingPercent: number,
qualityPercent: number
) => {
console.log(
'%s %s was: %s now: %s saving: %s (%s)',
color.green('â'),
chalk.underline(label),
color.red(prettySizeBefore),
color.green(prettySizeAfter),
color.green(prettySizeSaving),
color.green(`${sizeSavingPercent.toFixed(2)}%`)
);
};
开发者ID:JamieMason,项目名称:ImageOptim-CLI,代码行数:18,代码来源:log.ts
示例4: write
function write(entry: ILogEntry, stream: NodeJS.WritableStream) {
let line =
asISODate(entry.time).split(/T|Z/)[1] + " " + asColoredLevel(entry);
line += " ";
if (entry.name) {
line += "(" + entry.name + ") ";
}
if (entry.msg) {
line += chalk.cyan(entry.msg);
}
line += "\n";
stream.write(line);
}
开发者ID:HorrerGames,项目名称:itch,代码行数:13,代码来源:console-write.ts
注:本文中的chalk.constructor类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论