Instead of --jsExtensions support --allowJs with .js and .jsx as supported extensions
This commit is contained in:
parent
57362f6017
commit
ba3d34f9df
|
@ -249,11 +249,9 @@ namespace ts {
|
|||
error: Diagnostics.Argument_for_moduleResolution_option_must_be_node_or_classic,
|
||||
},
|
||||
{
|
||||
name: "jsExtensions",
|
||||
type: "string[]",
|
||||
description: Diagnostics.Specifies_extensions_to_treat_as_javascript_file_To_specify_multiple_extensions_either_use_this_option_multiple_times_or_provide_comma_separated_list,
|
||||
paramType: Diagnostics.EXTENSION_S,
|
||||
error: Diagnostics.Argument_for_jsExtensions_option_must_be_either_extension_or_comma_separated_list_of_extensions,
|
||||
name: "allowJs",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled,
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -729,9 +729,11 @@ namespace ts {
|
|||
* List of supported extensions in order of file resolution precedence.
|
||||
*/
|
||||
export const supportedTypeScriptExtensions = ["ts", "tsx", "d.ts"];
|
||||
export const supportedJavascriptExtensions = ["js", "jsx"];
|
||||
export const supportedExtensionsWhenAllowedJs = supportedTypeScriptExtensions.concat(supportedJavascriptExtensions);
|
||||
|
||||
export function getSupportedExtensions(options?: CompilerOptions): string[] {
|
||||
return options && options.jsExtensions ? supportedTypeScriptExtensions.concat(options.jsExtensions) : supportedTypeScriptExtensions;
|
||||
return options && options.allowJs ? supportedExtensionsWhenAllowedJs : supportedTypeScriptExtensions;
|
||||
}
|
||||
|
||||
export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) {
|
||||
|
|
|
@ -2181,10 +2181,6 @@
|
|||
"category": "Message",
|
||||
"code": 6038
|
||||
},
|
||||
"EXTENSION[S]": {
|
||||
"category": "Message",
|
||||
"code": 6039
|
||||
},
|
||||
"Compilation complete. Watching for file changes.": {
|
||||
"category": "Message",
|
||||
"code": 6042
|
||||
|
@ -2269,10 +2265,6 @@
|
|||
"category": "Error",
|
||||
"code": 6063
|
||||
},
|
||||
"Argument for '--jsExtensions' option must be either extension or comma separated list of extensions.": {
|
||||
"category": "Error",
|
||||
"code": 6064
|
||||
},
|
||||
|
||||
"Specify JSX code generation: 'preserve' or 'react'": {
|
||||
"category": "Message",
|
||||
|
@ -2310,7 +2302,7 @@
|
|||
"category": "Message",
|
||||
"code": 6072
|
||||
},
|
||||
"Specifies extensions to treat as javascript file. To specify multiple extensions, either use this option multiple times or provide comma separated list.": {
|
||||
"Allow javascript files to be compiled.": {
|
||||
"category": "Message",
|
||||
"code": 6073
|
||||
},
|
||||
|
|
|
@ -359,7 +359,7 @@ namespace ts {
|
|||
(oldOptions.target !== options.target) ||
|
||||
(oldOptions.noLib !== options.noLib) ||
|
||||
(oldOptions.jsx !== options.jsx) ||
|
||||
(oldOptions.jsExtensions !== options.jsExtensions)) {
|
||||
(oldOptions.allowJs !== options.allowJs)) {
|
||||
oldProgram = undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2089,7 +2089,7 @@ namespace ts {
|
|||
experimentalDecorators?: boolean;
|
||||
emitDecoratorMetadata?: boolean;
|
||||
moduleResolution?: ModuleResolutionKind;
|
||||
jsExtensions?: string[];
|
||||
allowJs?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
// Skip checking lib.d.ts to help speed up tests.
|
||||
|
|
|
@ -2002,7 +2002,7 @@ namespace ts {
|
|||
let getCanonicalFileName = createGetCanonicalFileName(!!useCaseSensitiveFileNames);
|
||||
|
||||
function getKeyFromCompilationSettings(settings: CompilerOptions): string {
|
||||
return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + +"|" + settings.jsExtensions;
|
||||
return "_" + settings.target + "|" + settings.module + "|" + settings.noResolve + "|" + settings.jsx + +"|" + settings.allowJs;
|
||||
}
|
||||
|
||||
function getBucketForCompilationSettings(settings: CompilerOptions, createIfMissing: boolean): FileMap<DocumentRegistryEntry> {
|
||||
|
@ -2633,7 +2633,7 @@ namespace ts {
|
|||
oldSettings.module !== newSettings.module ||
|
||||
oldSettings.noResolve !== newSettings.noResolve ||
|
||||
oldSettings.jsx !== newSettings.jsx ||
|
||||
oldSettings.jsExtensions !== newSettings.jsExtensions);
|
||||
oldSettings.allowJs !== newSettings.allowJs);
|
||||
|
||||
// Now create a new compiler
|
||||
let compilerHost: CompilerHost = {
|
||||
|
|
Loading…
Reference in a new issue