remove unused dependencies to reduce the size of output file

This commit is contained in:
Vladimir Matveev 2016-08-12 14:26:09 -07:00
parent b1871a5bf9
commit 959b6b6c07
4 changed files with 17 additions and 13 deletions

View File

@ -942,7 +942,7 @@ namespace ts {
* [^./] # matches everything up to the first . character (excluding directory seperators)
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
*/
const singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*";
const singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*";
const singleAsteriskRegexFragmentOther = "[^/]*";
export function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude") {
@ -1196,6 +1196,14 @@ namespace ts {
return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions;
}
export function hasJavaScriptFileExtension(fileName: string) {
return forEach(supportedJavascriptExtensions, extension => fileExtensionIs(fileName, extension));
}
export function hasTypeScriptFileExtension(fileName: string) {
return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension));
}
export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) {
if (!fileName) { return false; }

View File

@ -2718,14 +2718,6 @@ namespace ts {
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
}
export function hasJavaScriptFileExtension(fileName: string) {
return forEach(supportedJavascriptExtensions, extension => fileExtensionIs(fileName, extension));
}
export function hasTypeScriptFileExtension(fileName: string) {
return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension));
}
/**
* Replace each instance of non-ascii characters by one, two, three, or four escape sequences
* representing the UTF-8 encoding of the character, and return the expanded char code list.

View File

@ -1,5 +1,4 @@
/// <reference path="../../services/JsTyping.ts"/>
/// <reference path="../../services/shims.ts"/>
/// <reference path="../types.d.ts"/>
namespace ts.server.typingsInstaller {

View File

@ -1,7 +1,9 @@
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
// See LICENSE.txt in the project root for complete license information.
/// <reference path='services.ts' />
/// <reference path='../compiler/types.ts' />
/// <reference path='../compiler/core.ts' />
/// <reference path='../compiler/commandLineParser.ts' />
/* @internal */
namespace ts.JsTyping {
@ -54,7 +56,10 @@ namespace ts.JsTyping {
}
// Only infer typings for .js and .jsx files
fileNames = filter(map(fileNames, normalizePath), f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JS, ScriptKind.JSX));
fileNames = filter(map(fileNames, normalizePath), f => {
const kind = ensureScriptKind(f, getScriptKindFromFileName(f));
return kind === ScriptKind.JS || kind === ScriptKind.JSX;
});
if (!safeList) {
const result = readConfigFile(safeListPath, (path: string) => host.readFile(path));
@ -170,7 +175,7 @@ namespace ts.JsTyping {
mergeTypings(filter(cleanedTypingNames, f => hasProperty(safeList, f)));
}
const hasJsxFile = forEach(fileNames, f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JSX));
const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX);
if (hasJsxFile) {
mergeTypings(["react"]);
}