bun.fmt resolves to packages/runtime/src/fmt.zig (home.zig:173), whose highlighter does nothing:
pub fn format(self: QuickAndDirtyJavaScriptSyntaxHighlighter, writer: *std.Io.Writer) std.Io.Writer.Error!void {
_ = self.opts;
try writer.writeAll(self.text);
}Every option is discarded — enable_colors, check_for_unhighlighted_write, and redact_sensitive_information (declared at fmt.zig:237) all have no effect. Any caller asking for highlighted or redacted output silently gets the raw text back.
The real implementation is packages/runtime/src/bun_core/fmt.zig (fmtJavaScript at :694, redaction at :146 via strings.startsWithSecret).
The stated blocker is stale
jsc/js2native_workarounds.zig claimed the real highlighter "needs unported strings.startsWith{Secret,UUID}". Both are present:
startsWithUUID—string/immutable.zig:209, re-exported atstrings.zig:48startsWithSecret—string/immutable.zig:312, not re-exported
So the actual blocker is a single missing re-export in strings.zig, not an unported function. (I corrected that comment in 445b0d5f3.)
Impact
js/bun/util/highlighter.test.tsis 15 pass / 1 fail; the failure is this stub. It was a SIGABRT before445b0d5f3added the missingFormattervariant.- Anything else printing highlighted source — error overlays,
Bun.inspectof code, the markdown ANSI renderer — is silently unhighlighted.
Suggested shape
- Re-export
startsWithSecretfromstrings.zignext tostartsWithUUID. - Check whether
bun_core/fmt.zigthen compiles as-is. - Decide whether
bun.fmtshould point atbun_core/fmt.zig, or whether the two modules should merge —home.zig:173currently binds the stub, so switching it affects everybun.fmtcaller and wants its own diff and test pass.
Refs #66