From fdcc78500cc1aff8c87d76abd1692e79977ac9cc Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 2 Nov 2020 13:51:56 +1100 Subject: refactor(cli): migrate runtime compile/bundle to new infrastructure (#8192) Fixes #8060 --- cli/tsc_config.rs | 58 +++++++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) (limited to 'cli/tsc_config.rs') diff --git a/cli/tsc_config.rs b/cli/tsc_config.rs index 52daf2e46..92332cca6 100644 --- a/cli/tsc_config.rs +++ b/cli/tsc_config.rs @@ -52,37 +52,49 @@ impl fmt::Display for IgnoredCompilerOptions { /// A static slice of all the compiler options that should be ignored that /// either have no effect on the compilation or would cause the emit to not work /// in Deno. -const IGNORED_COMPILER_OPTIONS: [&str; 10] = [ +const IGNORED_COMPILER_OPTIONS: &[&str] = &[ "allowSyntheticDefaultImports", + "allowUmdGlobalAccess", + "baseUrl", + "declaration", + "declarationMap", + "downlevelIteration", "esModuleInterop", + "emitDeclarationOnly", + "importHelpers", "inlineSourceMap", "inlineSources", // TODO(nayeemrmn): Add "isolatedModules" here for 1.6.0. "module", + "noEmitHelpers", "noLib", + "noResolve", + "outDir", + "paths", "preserveConstEnums", "reactNamespace", + "rootDir", + "rootDirs", + "skipLibCheck", "sourceMap", + "sourceRoot", "target", + "types", + "useDefineForClassFields", ]; -const IGNORED_RUNTIME_COMPILER_OPTIONS: [&str; 50] = [ - "allowUmdGlobalAccess", +const IGNORED_RUNTIME_COMPILER_OPTIONS: &[&str] = &[ "assumeChangesOnlyAffectDirectDependencies", - "baseUrl", "build", + "charset", "composite", - "declaration", - "declarationMap", "diagnostics", - "downlevelIteration", + "disableSizeLimit", "emitBOM", - "emitDeclarationOnly", "extendedDiagnostics", "forceConsistentCasingInFileNames", "generateCpuProfile", "help", - "importHelpers", "incremental", "init", "listEmittedFiles", @@ -92,29 +104,21 @@ const IGNORED_RUNTIME_COMPILER_OPTIONS: [&str; 50] = [ "moduleResolution", "newLine", "noEmit", - "noEmitHelpers", "noEmitOnError", - "noResolve", "out", "outDir", "outFile", - "paths", "preserveSymlinks", "preserveWatchOutput", "pretty", + "project", "resolveJsonModule", - "rootDir", - "rootDirs", "showConfig", "skipDefaultLibCheck", - "skipLibCheck", - "sourceRoot", "stripInternal", "traceResolution", "tsBuildInfoFile", - "types", "typeRoots", - "useDefineForClassFields", "version", "watch", ]; @@ -170,12 +174,6 @@ struct TSConfigJson { type_acquisition: Option, } -pub fn parse_raw_config(config_text: &str) -> Result { - assert!(!config_text.is_empty()); - let jsonc = jsonc_parser::parse_to_value(config_text)?.unwrap(); - Ok(jsonc_to_serde(jsonc)) -} - fn parse_compiler_options( compiler_options: &HashMap, maybe_path: Option, @@ -394,18 +392,6 @@ mod tests { ); } - #[test] - fn test_parse_raw_config() { - let invalid_config_text = r#"{ - "compilerOptions": { - // comments are allowed - }"#; - let errbox = parse_raw_config(invalid_config_text).unwrap_err(); - assert!(errbox - .to_string() - .starts_with("Unterminated object on line 1")); - } - #[test] fn test_tsconfig_as_bytes() { let mut tsconfig1 = TsConfig::new(json!({ -- cgit v1.2.3