Yuku

Print

print turns a file or any node back into code. From Zig, see codegen.

import { print } from "yuku";

const { code, map, diagnostics } = print(file, { strip: true, sourceMap: true });
OptionDefaultDescription
stripfalsePrint TypeScript as JavaScript, reporting what has no JavaScript form
minifyfalseMinify, rewriting syntax to shorter forms such as !0 and obj.foo
format"pretty", or "compact" minifyingOr "compact"
indent2Spaces per level in the pretty format
quotes"preserve", or "shortest" minifying"preserve", "double", "single", or "shortest"
comments"all", or "some" minifying"all", "some", "none", "line", or "block", of the attached comments
sourceMapfalsetrue, or { file, sourceRoot, sourcesContent }, when printing a file

"some" keeps legal headers, JSDoc, and @ or # annotations, as bundlers do.