diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-05-17 19:50:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-17 13:50:31 -0400 |
commit | f57aac77ff9ce514730504066daca0a61a959d32 (patch) | |
tree | 34be59895172b93a255c933d0f2e579dbf3a3ccc /cli/emit.rs | |
parent | 9766399a3fefcab322051b4a7af41f9d40d79150 (diff) |
BREAKING: Remove unstable Deno.emit and Deno.formatDiagnostics APIs (#14463)
Diffstat (limited to 'cli/emit.rs')
-rw-r--r-- | cli/emit.rs | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/cli/emit.rs b/cli/emit.rs index 5896d0dff..b0ecb78bd 100644 --- a/cli/emit.rs +++ b/cli/emit.rs @@ -146,8 +146,6 @@ pub enum ConfigType { Check { lib: TypeLib, tsc_emit: bool }, /// Return a configuration to use swc to emit single module files. Emit, - /// Return a configuration as a base for the runtime `Deno.emit()` API. - RuntimeEmit { tsc_emit: bool }, } /// For a given configuration type and optionally a configuration file, return a @@ -216,44 +214,6 @@ pub fn get_ts_config( "jsxFragmentFactory": "React.Fragment", "resolveJsonModule": true, })), - ConfigType::RuntimeEmit { tsc_emit } => { - let mut ts_config = TsConfig::new(json!({ - "allowJs": true, - "allowSyntheticDefaultImports": true, - "checkJs": false, - "emitDecoratorMetadata": false, - "experimentalDecorators": true, - "importsNotUsedAsValues": "remove", - "incremental": true, - "isolatedModules": true, - "jsx": "react", - "jsxFactory": "React.createElement", - "jsxFragmentFactory": "React.Fragment", - "lib": TypeLib::DenoWindow, - "module": "esnext", - "removeComments": true, - "inlineSourceMap": false, - "inlineSources": false, - "sourceMap": true, - "strict": true, - "target": "esnext", - "tsBuildInfoFile": "deno:///.tsbuildinfo", - "useDefineForClassFields": true, - // TODO(@kitsonk) remove for Deno 2.0 - "useUnknownInCatchVariables": false, - })); - if tsc_emit { - ts_config.merge(&json!({ - "importsNotUsedAsValues": "remove", - "outDir": "deno://", - })); - } else { - ts_config.merge(&json!({ - "noEmit": true, - })); - } - ts_config - } }; let maybe_ignored_options = if let Some(user_options) = maybe_user_config { ts_config.merge_user_config(user_options)? @@ -946,47 +906,6 @@ impl fmt::Display for GraphError { } } -/// Convert a module graph to a map of "files", which are used by the runtime -/// emit to be passed back to the caller. -pub fn to_file_map( - graph: &ModuleGraph, - cache: &dyn Cacher, -) -> HashMap<String, String> { - let mut files = HashMap::new(); - for (_, result) in graph.specifiers().into_iter() { - if let Ok((specifier, _, media_type)) = result { - if let Some(emit) = cache.get(CacheType::Emit, &specifier) { - files.insert(format!("{}.js", specifier), emit); - if let Some(map) = cache.get(CacheType::SourceMap, &specifier) { - files.insert(format!("{}.js.map", specifier), map); - } - } else if matches!( - media_type, - MediaType::JavaScript - | MediaType::Mjs - | MediaType::Cjs - | MediaType::Json - | MediaType::Unknown - ) { - if let Some(module) = graph.get(&specifier) { - files.insert( - specifier.to_string(), - module - .maybe_source - .as_ref() - .map(|s| s.to_string()) - .unwrap_or_else(|| "".to_string()), - ); - } - } - if let Some(declaration) = cache.get(CacheType::Declaration, &specifier) { - files.insert(format!("{}.d.ts", specifier), declaration); - } - } - } - files -} - /// This contains the logic for Deno to rewrite the `import.meta` when bundling. pub struct BundleHook; |