pub fn strip_project_to_js(
out: ProjectOutput,
) -> Result<ProjectOutput, StripError>Expand description
Rewrite a compiled ProjectOutput from
TypeScript into a JavaScript artefact (the in-browser track’s first-class JS
output — ADR 0137). The emitter always produces TypeScript; a JS artefact is
that same output with types stripped, which is total because the emitter is
strip-only (ADR 0136).
Dispatches on Document directly (P7.6,
#1309) — no CompiledFile text intermediate. Every Ts document is
printed through the one printer that owns a character (R7.3), then
type-stripped and renamed to .js as its own Document::Js; tsconfig.json
is dropped (a TypeScript-compiler config with no role for a JS artefact);
wrangler.toml’s real tree gets its main entry patched structurally,
in place — no print-then-reparse (Decision E) — since the Workers
manifest names its entry module and a main left pointing at the
stripped .ts breaks wrangler dev/deploy on the emitted output. Source
maps and the debug sidecar are dropped — they map into the .ts the JS
replaces. Import specifiers are already .js (the default ImportExt),
so the renamed tree resolves as-is.