Commit 3d62660
Changed files (4)
src/core.ts
@@ -796,7 +796,7 @@ export class ProcessOutput extends Error {
static getErrorMessage = formatErrorMessage;
[inspect.custom](): string {
- let stringify = (s: string, c: ChalkInstance) =>
+ const stringify = (s: string, c: ChalkInstance) =>
s.length === 0 ? "''" : c(inspect(s))
return `ProcessOutput {
stdout: ${stringify(this.stdout, chalk.green)},
src/log.ts
@@ -85,18 +85,16 @@ const formatters: LogFormatters = {
},
fetch(entry) {
const init = entry.init ? ' ' + inspect(entry.init) : ''
- return '$ ' + chalk.greenBright('fetch') + ` ${entry.url}${init}\n`
+ return `$ ${chalk.greenBright('fetch')} ${entry.url}${init}\n`
},
cd(entry) {
- return '$ ' + chalk.greenBright('cd') + ` ${entry.dir}\n`
+ return `$ ${chalk.greenBright('cd')} ${entry.dir}\n`
},
retry(entry) {
- return (
- chalk.bgRed.white(' FAIL ') +
- ` Attempt: ${entry.attempt}${entry.total == Infinity ? '' : `/${entry.total}`}` +
- (entry.delay > 0 ? `; next in ${entry.delay}ms` : '') +
- '\n'
- )
+ const attempt = `Attempt: ${entry.attempt}${entry.total == Infinity ? '' : `/${entry.total}`}`
+ const delay = entry.delay > 0 ? `; next in ${entry.delay}ms` : ''
+
+ return `${chalk.bgRed.white(' FAIL ')} ${attempt}${delay}\n`
},
end() {
return ''
src/util.ts
@@ -68,8 +68,6 @@ export const bufArrJoin = (arr: TSpawnStoreChunks) =>
export const getLast = <T>(arr: { length: number; [i: number]: any }): T =>
arr[arr.length - 1]
-const pad = (v: string) => (v === ' ' ? ' ' : '')
-
export function preferLocalBin(
env: NodeJS.ProcessEnv,
...dirs: (string | undefined)[]
@@ -99,23 +97,6 @@ export function preferLocalBin(
}
}
-// export function normalizeMultilinePieces(
-// pieces: TemplateStringsArray
-// ): TemplateStringsArray {
-// return Object.assign(
-// pieces.map((p, i) =>
-// p.trim()
-// ? pad(p[0]) +
-// parseLine(p)
-// .words.map(({ w }) => (w === '\\' ? '' : w.trim()))
-// .join(' ') +
-// pad(p[p.length - 1])
-// : pieces[i]
-// ),
-// { raw: pieces.raw }
-// )
-// }
-
export function quote(arg: string): string {
if (arg === '') return `$''`
if (/^[\w/.\-@:=]+$/.test(arg)) return arg
.size-limit.json
@@ -9,7 +9,7 @@
{
"name": "zx/index",
"path": "build/*.{js,cjs}",
- "limit": "812.1 kB",
+ "limit": "812 kB",
"brotli": false,
"gzip": false
},