{"record":{"id":"6ec532ec77b32995","repo":"denoland/deno","slug":"cannot-represent-compiler-option-name-as-a-gen","errorCode":null,"errorMessage":"Cannot represent compiler option '{name}' as a generated JSX pragma.","messagePattern":"Cannot represent compiler option '(.+?)' as a generated JSX pragma\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/publish/module_content.rs","lineNumber":32,"sourceCode":"use deno_graph::ModuleGraph;\nuse deno_resolver::cache::LazyGraphSourceParser;\nuse deno_resolver::cache::ParsedSourceCache;\nuse deno_resolver::deno_json::CompilerOptionsResolver;\nuse deno_resolver::workspace::ResolutionKind;\nuse lazy_regex::Lazy;\n\nuse super::diagnostics::PublishDiagnostic;\nuse super::diagnostics::PublishDiagnosticsCollector;\nuse super::unfurl::PositionOrSourceRangeRef;\nuse super::unfurl::SpecifierUnfurler;\nuse super::unfurl::SpecifierUnfurlerDiagnostic;\nuse super::unfurl::SpecifierUnfurlerSys;\nuse crate::sys::CliSys;\nuse crate::tools::unfurl_utils::is_safe_unquoted_comment_value;\n\nfn jsx_pragma(name: &str, value: &str) -> Result<String, AnyError> {\n  if !is_safe_unquoted_comment_value(value) {\n    return Err(deno_core::anyhow::anyhow!(\n      \"Cannot represent compiler option '{name}' as a generated JSX pragma.\"\n    ));\n  }\n  Ok(format!(\"/** @{name} {value} */\"))\n}\n\nstruct JsxFolderOptions<'a> {\n  jsx_runtime: &'static str,\n  jsx_classic: Option<Cow<'a, deno_ast::JsxClassicOptions>>,\n  jsx_import_source: Option<String>,\n  jsx_import_source_types: Option<String>,\n}\n\n#[sys_traits::auto_impl]\npub trait ModuleContentProviderSys: SpecifierUnfurlerSys {}\n\npub struct ModuleContentProvider<TSys: ModuleContentProviderSys = CliSys> {\n  specifier_unfurler: SpecifierUnfurler<TSys>,","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/publish/module_content.rs#L14-L50","documentation":"When publishing, Deno inlines JSX compiler options (`jsxImportSource`, `jsxImportSourceTypes`, `jsxFactory`, `jsxFragmentFactory`) into published files as `/** @jsx ... */` pragma comments. `is_safe_unquoted_comment_value` accepts only non-empty values with no `*/`, no whitespace, and no control characters; anything else cannot be written faithfully into a comment, so publish fails naming the offending option.","triggerScenarios":"A deno.json `compilerOptions` JSX value containing a space, newline, `*/`, or a control character — e.g. `\"jsxFactory\": \"h.createElement \"` with a trailing space — while publishing files that use JSX.","commonSituations":"Copy-pasted compiler options with stray whitespace; template-generated deno.json inserting newlines into values; deliberately exotic factory strings such as `my lib.h`.","solutions":["Set the JSX option to a plain identifier path with no whitespace, no comment terminators, and no control characters (letters, digits, dots, underscores, dollar signs)","Remove the offending option entirely if nothing uses it","Run `deno publish --dry-run` to confirm the pragma generation succeeds"],"exampleFix":"// before — deno.json\n{\n  \"compilerOptions\": {\n    \"jsxFactory\": \"h.createElement \"\n  }\n}\n// after\n{\n  \"compilerOptions\": {\n    \"jsxFactory\": \"h.createElement\"\n  }\n}","handlingStrategy":"validation","validationCode":"# fail fast before publish: JSX option values must be non-empty,\n# with no whitespace, no control chars, and no */\ndeno eval 'const c = JSON.parse(Deno.readTextFileSync(\"deno.json\")).compilerOptions ?? {};\nfor (const k of [\"jsxFactory\", \"jsxFragmentFactory\", \"jsxImportSource\", \"jsxImportSourceTypes\"]) {\n  const v = c[k];\n  if (v === undefined) continue;\n  if (v === \"\" || /\\s/.test(v) || /[\\u0000-\\u001f]/.test(v) || v.includes(\"*/\")) {\n    console.error(`unsafe ${k}: ${JSON.stringify(v)}`); Deno.exit(1);\n  }\n}'","typeGuard":"// value can be embedded safely as an unquoted /** @jsx <value> */ pragma\nconst isSafePragmaValue = (v: string): boolean =>\n  v.length > 0 && !v.includes(\"*/\") && !/\\s|[\\u0000-\\u001f\\u007f]/.test(v);","tryCatchPattern":null,"preventionTips":["Keep JSX option values as plain identifier paths (letters, digits, dots, underscores)","Run `deno publish --dry-run` in CI so pragma generation is exercised before the real publish","Validate generated deno.json files in a config lint step"],"tags":["publish","jsx","deno-json","escaping","compiler-options"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}