-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new project.compilerOptions property that has the ability t…
…o change the compiler options. BREAKING CHANGE: ScriptTarget was moved from manipulation settings to be stored exclusively in the compiler options.
- Loading branch information
Showing
21 changed files
with
97 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {CompilerOptions} from "../typescript"; | ||
import {SettingsContainer} from "./SettingsContainer"; | ||
|
||
/** | ||
* Holds the compiler options. | ||
*/ | ||
export class CompilerOptionsContainer extends SettingsContainer<CompilerOptions> { | ||
constructor() { | ||
super({}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import * as objectAssign from "object-assign"; | ||
|
||
export abstract class SettingsContainer<T extends object> { | ||
private readonly defaultSettings: T; | ||
protected settings: T; | ||
|
||
constructor(defaultSettings: T) { | ||
this.defaultSettings = objectAssign({}, defaultSettings); | ||
this.settings = defaultSettings; | ||
} | ||
|
||
/** | ||
* Resets the settings to the default. | ||
*/ | ||
reset() { | ||
this.settings = objectAssign({}, this.defaultSettings); | ||
} | ||
|
||
/** | ||
* Gets a copy of the settings as an object. | ||
*/ | ||
get(): T { | ||
return objectAssign({}, this.settings); | ||
} | ||
|
||
/** | ||
* Sets one or all of the settings. | ||
* @param settings - Settings to set. | ||
*/ | ||
set(settings: Partial<T>) { | ||
objectAssign(this.settings, settings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from "./CompilerOptionsContainer"; | ||
export * from "./ManipulationSettingsContainer"; | ||
export * from "./SettingsContainer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import {ts, ScriptTarget} from "../../typescript"; | ||
|
||
export function createCompilerSourceFile(filePath: string, text: string, scriptTarget: ScriptTarget) { | ||
return ts.createSourceFile(filePath, text, scriptTarget, true); | ||
export function createCompilerSourceFile(filePath: string, text: string, scriptTarget: ScriptTarget | undefined) { | ||
return ts.createSourceFile(filePath, text, scriptTarget == null ? ScriptTarget.Latest : scriptTarget, true); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.