mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Added environment variable to force experimental transformations.
This commit is contained in:
1 parent
3c344987de
commit
02ebfa5d11
4 files changed
+19
-11
No files matched your search
@@ -994,6 +994,11 @@ namespace ts {
|
||||
|
||||
const start = new Date().getTime();
|
||||
|
||||
// TODO(rbuckton): remove USE_TRANSFORMS condition when we switch to transforms permenantly.
|
||||
if (Boolean(sys.getEnvironmentVariable("USE_TRANSFORMS"))) {
|
||||
options.experimentalTransforms = true;
|
||||
}
|
||||
|
||||
const fileEmitter = options.experimentalTransforms ? printFiles : emitFiles;
|
||||
const emitResult = fileEmitter(
|
||||
emitResolver,
|
||||
|
||||
+10
-2
@@ -8,7 +8,6 @@ namespace ts {
|
||||
args: string[];
|
||||
newLine: string;
|
||||
useCaseSensitiveFileNames: boolean;
|
||||
/*@internal*/ developmentMode?: boolean;
|
||||
write(s: string): void;
|
||||
readFile(path: string, encoding?: string): string;
|
||||
writeFile(path: string, data: string, writeByteOrderMark?: boolean): void;
|
||||
@@ -23,6 +22,7 @@ namespace ts {
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
/*@internal*/ getEnvironmentVariable(name: string): string;
|
||||
/*@internal*/ tryEnableSourceMapsForHost?(): void;
|
||||
}
|
||||
|
||||
@@ -213,6 +213,9 @@ namespace ts {
|
||||
getCurrentDirectory() {
|
||||
return new ActiveXObject("WScript.Shell").CurrentDirectory;
|
||||
},
|
||||
getEnvironmentVariable(name: string) {
|
||||
return new ActiveXObject("WScript.Shell").ExpandEnvironmentStrings(`%${name}%`);
|
||||
},
|
||||
readDirectory,
|
||||
exit(exitCode?: number): void {
|
||||
try {
|
||||
@@ -523,7 +526,6 @@ namespace ts {
|
||||
args: process.argv.slice(2),
|
||||
newLine: _os.EOL,
|
||||
useCaseSensitiveFileNames: useCaseSensitiveFileNames,
|
||||
developmentMode: /^development$/i.test(String(process.env.NODE_ENV)),
|
||||
write(s: string): void {
|
||||
process.stdout.write(s);
|
||||
},
|
||||
@@ -581,6 +583,9 @@ namespace ts {
|
||||
getCurrentDirectory() {
|
||||
return process.cwd();
|
||||
},
|
||||
getEnvironmentVariable(name: string) {
|
||||
return process.env[name] || "";
|
||||
},
|
||||
readDirectory,
|
||||
getMemoryUsage() {
|
||||
if (global.gc) {
|
||||
@@ -627,6 +632,9 @@ namespace ts {
|
||||
createDirectory: ChakraHost.createDirectory,
|
||||
getExecutingFilePath: () => ChakraHost.executingFile,
|
||||
getCurrentDirectory: () => ChakraHost.currentDirectory,
|
||||
getEnvironmentVariable(name: string) {
|
||||
return "";
|
||||
},
|
||||
readDirectory: ChakraHost.readDirectory,
|
||||
exit: ChakraHost.quit,
|
||||
};
|
||||
|
||||
+1
-1
@@ -781,7 +781,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
if (ts.sys.developmentMode && ts.sys.tryEnableSourceMapsForHost) {
|
||||
if (ts.sys.tryEnableSourceMapsForHost && /^development$/i.test(ts.sys.getEnvironmentVariable("NODE_ENV"))) {
|
||||
ts.sys.tryEnableSourceMapsForHost();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user