Skip to content

Commit 07e96c2

Browse files
committed
fix: use standardized units in text outputs
See: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
1 parent 67cbf87 commit 07e96c2

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

pkg/api/api_impl.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,13 +1146,13 @@ func (ctx *internalContext) Dispose() {
11461146
func prettyPrintByteCount(n int) string {
11471147
var size string
11481148
if n < 1024 {
1149-
size = fmt.Sprintf("%db ", n)
1149+
size = fmt.Sprintf("%dB ", n)
11501150
} else if n < 1024*1024 {
1151-
size = fmt.Sprintf("%.1fkb", float64(n)/(1024))
1151+
size = fmt.Sprintf("%.1fKiB", float64(n)/(1024))
11521152
} else if n < 1024*1024*1024 {
1153-
size = fmt.Sprintf("%.1fmb", float64(n)/(1024*1024))
1153+
size = fmt.Sprintf("%.1fMiB", float64(n)/(1024*1024))
11541154
} else {
1155-
size = fmt.Sprintf("%.1fgb", float64(n)/(1024*1024*1024))
1155+
size = fmt.Sprintf("%.1fGiB", float64(n)/(1024*1024*1024))
11561156
}
11571157
return size
11581158
}

scripts/js-api-tests.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6962,15 +6962,15 @@ let analyzeTests = {
69626962
}
69636963
}
69646964
assert.strictEqual(await esbuild.analyzeMetafile(metafile), `
6965-
out.js 100b 100.0%
6966-
├ lib.js 50b 50.0%
6967-
└ entry.js 25b 25.0%
6965+
out.js 100B 100.0%
6966+
├ lib.js 50B 50.0%
6967+
└ entry.js 25B 25.0%
69686968
`)
69696969
assert.strictEqual(await esbuild.analyzeMetafile(metafile, { verbose: true }), `
6970-
out.js ────── 100b ── 100.0%
6971-
├ lib.js ──── 50b ─── 50.0%
6970+
out.js ────── 100B ─── 100.0%
6971+
├ lib.js ──── 50B ──── 50.0%
69726972
│ └ entry.js
6973-
└ entry.js ── 25b ─── 25.0%
6973+
└ entry.js ── 25B ──── 25.0%
69746974
`)
69756975
},
69766976
}
@@ -7192,15 +7192,15 @@ ${path.relative(process.cwd(), input).split(path.sep).join('/')}:1:2: ERROR: Une
71927192
}
71937193
}
71947194
assert.strictEqual(esbuild.analyzeMetafileSync(metafile), `
7195-
out.js 100b 100.0%
7196-
├ lib.js 50b 50.0%
7197-
└ entry.js 25b 25.0%
7195+
out.js 100B 100.0%
7196+
├ lib.js 50B 50.0%
7197+
└ entry.js 25B 25.0%
71987198
`)
71997199
assert.strictEqual(esbuild.analyzeMetafileSync(metafile, { verbose: true }), `
7200-
out.js ────── 100b ── 100.0%
7201-
├ lib.js ──── 50b ─── 50.0%
7200+
out.js ────── 100B ─── 100.0%
7201+
├ lib.js ──── 50B ──── 50.0%
72027202
│ └ entry.js
7203-
└ entry.js ── 25b ─── 25.0%
7203+
└ entry.js ── 25B ──── 25.0%
72047204
`)
72057205
},
72067206
}

0 commit comments

Comments
 (0)