diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-11-01 21:30:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-01 20:30:23 +0000 |
commit | 587f2e0800a55e58b2579758d4278a4129b609c0 (patch) | |
tree | afc3763fd3bd9f7bec35914b961cbb2877a4001f /cli/tsc/99_main_compiler.js | |
parent | 658f958fb860e9ad3ea531f26f628f18f3bff63e (diff) |
feat: precompile JSX (#20962)
Co-authored-by: Marvin Hagemeister <marvin@deno.com>
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r-- | cli/tsc/99_main_compiler.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index a2079c01e..4c750cfe7 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -862,12 +862,25 @@ delete Object.prototype.__proto__; } } + /** @param {Record<string, string>} config */ + function normalizeConfig(config) { + // the typescript compiler doesn't know about the precompile + // transform at the moment, so just tell it we're using react-jsx + if (config.jsx === "precompile") { + config.jsx = "react-jsx"; + } + return config; + } + /** The API that is called by Rust when executing a request. * @param {Request} request */ function exec({ config, debug: debugFlag, rootNames, localOnly }) { setLogDebug(debugFlag, "TS"); performanceStart(); + + config = normalizeConfig(config); + if (logDebug) { debug(">>> exec start", { rootNames }); debug(config); @@ -983,8 +996,9 @@ delete Object.prototype.__proto__; return respond(id, true); } case "$configure": { + const config = normalizeConfig(args[0]); const { options, errors } = ts - .convertCompilerOptionsFromJson(args[0], ""); + .convertCompilerOptionsFromJson(config, ""); Object.assign(options, { allowNonTsExtensions: true, allowImportingTsExtensions: true, |