Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
feat: ignore typescript compile options which ignore by Deno
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Apr 10, 2020
1 parent 7072f56 commit b48fed0
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions typescript-deno-plugin/src/plugin.ts
Expand Up @@ -13,6 +13,64 @@ import { normalizeImportStatement } from "../../core/deno_normalize_import_state
import { readConfigurationFromVscodeSettings } from "../../core/vscode_settings";
import { getImportModules } from "../../core/deno_deps";

const ignoredCompilerOptions: readonly string[] = [
"allowSyntheticDefaultImports",
"baseUrl",
"build",
"composite",
"declaration",
"declarationDir",
"declarationMap",
"diagnostics",
"downlevelIteration",
"emitBOM",
"emitDeclarationOnly",
"esModuleInterop",
"extendedDiagnostics",
"forceConsistentCasingInFileNames",
"help",
"importHelpers",
"incremental",
"inlineSourceMap",
"inlineSources",
"init",
"isolatedModules",
"listEmittedFiles",
"listFiles",
"mapRoot",
"maxNodeModuleJsDepth",
"module",
"moduleResolution",
"newLine",
"noEmit",
"noEmitHelpers",
"noEmitOnError",
"noLib",
"noResolve",
"out",
"outDir",
"outFile",
"paths",
"preserveSymlinks",
"preserveWatchOutput",
"pretty",
"rootDir",
"rootDirs",
"showConfig",
"skipDefaultLibCheck",
"skipLibCheck",
"sourceMap",
"sourceRoot",
"stripInternal",
"target",
"traceResolution",
"tsBuildInfoFile",
"types",
"typeRoots",
"version",
"watch",
];

export class DenoPlugin implements ts_module.server.PluginModule {
// plugin name
static readonly PLUGIN_NAME = "typescript-deno-plugin";
Expand Down Expand Up @@ -89,6 +147,14 @@ export class DenoPlugin implements ts_module.server.PluginModule {
return projectConfig;
}

// delete the option which ignore by Deno
// see https://github.com/denoland/deno/blob/bced52505f/cli/js/compiler/host.ts#L65-L121
for (const option in projectConfig) {
if (ignoredCompilerOptions.includes(option)) {
delete projectConfig[option];
}
}

const compilationSettings = merge(
merge(this.DEFAULT_OPTIONS, projectConfig),
this.MUST_OVERWRITE_OPTIONS
Expand Down

0 comments on commit b48fed0

Please sign in to comment.