deno
fcbe725f - fix(config): hook up verbatimModuleSyntax for the emit pipeline (#34495)

Commit
62 days ago
fix(config): hook up verbatimModuleSyntax for the emit pipeline (#34495) ## Summary \`verbatimModuleSyntax\` was accepted in \`compilerOptions\` and forwarded to TSC for type-checking, but the transpile path always threaded \`verbatim_module_syntax: false\` into \`deno_ast::TranspileOptions\` (with a \`todo!\` from @dsherret). That meant value imports used only as types were elided at emit time even when the user opted into \`verbatimModuleSyntax: true\`. This wires the option through: - \`EmitConfigOptions\` gains a \`verbatim_module_syntax: bool\` field (defaulted to \`false\` for compatibility). - \`compiler_options_to_transpile_and_emit_options\` passes it into \`deno_ast::TranspileOptions\` instead of hard-coding \`false\`. With this change, swc's TypeScript pass treats \`import type\` declarations as the only ones to strip and preserves every other import literally — matching TypeScript's \`verbatimModuleSyntax\` semantics. Fixes #26678. ## Test plan - [x] New spec test \`tests/specs/run/verbatim_module_syntax\` covers both directions: - With \`verbatimModuleSyntax: true\`, an import whose binding is only used as a type is preserved at runtime (its side-effecting \`console.log\` fires). - With \`verbatimModuleSyntax: false\` (or unset), the same import is elided as before. - [x] \`cargo check -p deno_config\` and \`cargo check -p deno_resolver\` pass. Closes denoland/orchid#267 Co-authored-by: divybot <divybot@users.noreply.github.com> Co-authored-by: Divy Srivastava <me@littledivy.com>
Author
Parents
Loading