diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2020-11-02 13:51:56 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-02 13:51:56 +1100 |
commit | fdcc78500cc1aff8c87d76abd1692e79977ac9cc (patch) | |
tree | b3ce97db2d23344c9469d9488097601058b5e0e5 /cli/tsc_config.rs | |
parent | 3558769d4654aad478804e506ccdcac38881dac1 (diff) |
refactor(cli): migrate runtime compile/bundle to new infrastructure (#8192)
Fixes #8060
Diffstat (limited to 'cli/tsc_config.rs')
-rw-r--r-- | cli/tsc_config.rs | 58 |
1 files changed, 22 insertions, 36 deletions
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<Value>, } -pub fn parse_raw_config(config_text: &str) -> Result<Value, AnyError> { - 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<String, Value>, maybe_path: Option<PathBuf>, @@ -395,18 +393,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!({ "strict": true, |