Skip to content

Commit

Permalink
Merge branch 'master' into requireJson
Browse files Browse the repository at this point in the history
  • Loading branch information
sheetalkamat committed Mar 8, 2018
2 parents c154b81 + 17b10dc commit 256ef2a
Show file tree
Hide file tree
Showing 1,506 changed files with 56,155 additions and 55,786 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ workflows:
base: &base
environment:
- workerCount: 4
- timeout: 400000
steps:
- checkout
- run: |
Expand Down
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ tslint.json
Jakefile.js
.editorconfig
.gitattributes
.gitmodules
.settings/
.travis.yml
.circleci
.vscode/
.parallelperf.json
test.config
package-lock.json
yarn.lock
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ node_js:
sudo: false

env:
- workerCount=3
- workerCount=3 timeout=600000

matrix:
fast_finish: true
Expand Down
8 changes: 5 additions & 3 deletions Gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ const es2017LibrarySource = [
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
({ target: "lib." + source, sources: ["header.d.ts", source] }));

const es2018LibrarySource = [];
const es2018LibrarySource = [
"es2018.regexp.d.ts",
"es2018.promise.d.ts"
];
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
({ target: "lib." + source, sources: ["header.d.ts", source] }));

const esnextLibrarySource = [
"esnext.asynciterable.d.ts",
"esnext.array.d.ts",
"esnext.promise.d.ts"
"esnext.array.d.ts"
];

const esnextLibrarySourceMap = esnextLibrarySource.map(source =>
Expand Down
8 changes: 5 additions & 3 deletions Jakefile.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,18 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
});

var es2018LibrarySource = [];
var es2018LibrarySource = [
"es2018.regexp.d.ts",
"es2018.promise.d.ts"
];

var es2018LibrarySourceMap = es2018LibrarySource.map(function (source) {
return { target: "lib." + source, sources: ["header.d.ts", source] };
});

var esnextLibrarySource = [
"esnext.asynciterable.d.ts",
"esnext.array.d.ts",
"esnext.promise.d.ts"
"esnext.array.d.ts"
];

var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
Expand Down
220 changes: 128 additions & 92 deletions src/compiler/binder.ts

Large diffs are not rendered by default.

1,032 changes: 633 additions & 399 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

44 changes: 17 additions & 27 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ namespace ts {
category: Diagnostics.Command_line_Options,
description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental
},
{
name: "preserveWatchOutput",
type: "boolean",
showInSimplifiedHelpView: false,
category: Diagnostics.Command_line_Options,
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
},
{
name: "watch",
shortName: "w",
Expand Down Expand Up @@ -144,9 +151,10 @@ namespace ts {
"es2017.string": "lib.es2017.string.d.ts",
"es2017.intl": "lib.es2017.intl.d.ts",
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
"es2018.promise": "lib.es2018.promise.d.ts",
"es2018.regexp": "lib.es2018.regexp.d.ts",
"esnext.array": "lib.esnext.array.d.ts",
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
"esnext.promise": "lib.esnext.promise.d.ts",
}),
},
showInSimplifiedHelpView: true,
Expand Down Expand Up @@ -1742,7 +1750,7 @@ namespace ts {
function getExtendedConfig(
sourceFile: TsConfigSourceFile,
extendedConfigPath: string,
host: ts.ParseConfigHost,
host: ParseConfigHost,
basePath: string,
resolutionStack: string[],
errors: Push<Diagnostic>,
Expand Down Expand Up @@ -2032,7 +2040,7 @@ namespace ts {
export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: ReadonlyArray<JsFileExtensionInfo> = []): ExpandResult {
basePath = normalizePath(basePath);

const keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
const keyMapper = host.useCaseSensitiveFileNames ? identity : toLowerCase;

// Literal file names (provided via the "files" array in tsconfig.json) are stored in a
// file map with a possibly case insensitive key. We use this map later when when including
Expand Down Expand Up @@ -2119,7 +2127,7 @@ namespace ts {
}
}

function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): ts.DiagnosticMessage | undefined {
function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): DiagnosticMessage | undefined {
if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
return Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0;
}
Expand All @@ -2146,7 +2154,7 @@ namespace ts {
// /a/b/a?z - Watch /a/b directly to catch any new file matching a?z
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
const wildcardDirectories: ts.MapLike<WatchDirectoryFlags> = {};
const wildcardDirectories: MapLike<WatchDirectoryFlags> = {};
if (include !== undefined) {
const recursiveKeys: string[] = [];
for (const file of include) {
Expand Down Expand Up @@ -2237,31 +2245,13 @@ namespace ts {
}
}

/**
* Gets a case sensitive key.
*
* @param key The original key.
*/
function caseSensitiveKeyMapper(key: string) {
return key;
}

/**
* Gets a case insensitive key.
*
* @param key The original key.
*/
function caseInsensitiveKeyMapper(key: string) {
return key.toLowerCase();
}

/**
* Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed.
* Also converts enum values back to strings.
*/
/* @internal */
export function convertCompilerOptionsForTelemetry(opts: ts.CompilerOptions): ts.CompilerOptions {
const out: ts.CompilerOptions = {};
export function convertCompilerOptionsForTelemetry(opts: CompilerOptions): CompilerOptions {
const out: CompilerOptions = {};
for (const key in opts) {
if (opts.hasOwnProperty(key)) {
const type = getOptionFromName(key);
Expand All @@ -2285,9 +2275,9 @@ namespace ts {
return typeof value === "boolean" ? value : "";
case "list":
const elementType = (option as CommandLineOptionOfListType).element;
return ts.isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
return isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
default:
return ts.forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
if (optionEnumValue === value) {
return optionStringValue;
}
Expand Down
47 changes: 41 additions & 6 deletions src/compiler/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ namespace ts {
/* @internal */
namespace ts {
export const emptyArray: never[] = [] as never[];
export function closeFileWatcher(watcher: FileWatcher) {
watcher.close();
}

/** Create a MapLike with good performance. */
function createDictionaryObject<T>(): MapLike<T> {
const map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
Expand Down Expand Up @@ -1590,7 +1594,7 @@ namespace ts {
return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
}

export let localizedDiagnosticMessages: MapLike<string> = undefined;
export let localizedDiagnosticMessages: MapLike<string>;

export function getLocaleSpecificMessage(message: DiagnosticMessage) {
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
Expand Down Expand Up @@ -2539,7 +2543,6 @@ namespace ts {
path = normalizePath(path);
currentDirectory = normalizePath(currentDirectory);

const comparer = useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive;
const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);

const regexFlag = useCaseSensitiveFileNames ? "" : "i";
Expand All @@ -2560,7 +2563,7 @@ namespace ts {
function visitDirectory(path: string, absolutePath: string, depth: number | undefined) {
const { files, directories } = getFileSystemEntries(path);

for (const current of sort(files, comparer)) {
for (const current of sort(files, compareStringsCaseSensitive)) {
const name = combinePaths(path, current);
const absoluteName = combinePaths(absolutePath, current);
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
Expand All @@ -2583,7 +2586,7 @@ namespace ts {
}
}

for (const current of sort(directories, comparer)) {
for (const current of sort(directories, compareStringsCaseSensitive)) {
const name = combinePaths(path, current);
const absoluteName = combinePaths(absolutePath, current);
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
Expand Down Expand Up @@ -2618,7 +2621,7 @@ namespace ts {
// Iterate over each include base path and include unique base paths that are not a
// subpath of an existing base path
for (const includeBasePath of includeBasePaths) {
if (ts.every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
if (every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
basePaths.push(includeBasePath);
}
}
Expand Down Expand Up @@ -3049,7 +3052,7 @@ namespace ts {

/** Return the object corresponding to the best pattern to match `candidate`. */
export function findBestPatternMatch<T>(values: ReadonlyArray<T>, getPattern: (value: T) => Pattern, candidate: string): T | undefined {
let matchedValue: T | undefined = undefined;
let matchedValue: T | undefined;
// use length of prefix as betterness criteria
let longestMatchPrefixLength = -1;

Expand Down Expand Up @@ -3147,4 +3150,36 @@ namespace ts {
export function singleElementArray<T>(t: T | undefined): T[] | undefined {
return t === undefined ? undefined : [t];
}

export function enumerateInsertsAndDeletes<T, U>(newItems: ReadonlyArray<T>, oldItems: ReadonlyArray<U>, comparer: (a: T, b: U) => Comparison, inserted: (newItem: T) => void, deleted: (oldItem: U) => void, unchanged?: (oldItem: U, newItem: T) => void) {
unchanged = unchanged || noop;
let newIndex = 0;
let oldIndex = 0;
const newLen = newItems.length;
const oldLen = oldItems.length;
while (newIndex < newLen && oldIndex < oldLen) {
const newItem = newItems[newIndex];
const oldItem = oldItems[oldIndex];
const compareResult = comparer(newItem, oldItem);
if (compareResult === Comparison.LessThan) {
inserted(newItem);
newIndex++;
}
else if (compareResult === Comparison.GreaterThan) {
deleted(oldItem);
oldIndex++;
}
else {
unchanged(oldItem, newItem);
newIndex++;
oldIndex++;
}
}
while (newIndex < newLen) {
inserted(newItems[newIndex++]);
}
while (oldIndex < oldLen) {
deleted(oldItems[oldIndex++]);
}
}
}
7 changes: 6 additions & 1 deletion src/compiler/declarationEmitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,12 @@ namespace ts {
"?");
}
write(": ");
emitType(node.type);
if (node.type) {
emitType(node.type);
}
else {
write("any");
}
write(";");
writeLine();
decreaseIndent();
Expand Down
41 changes: 39 additions & 2 deletions src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -2317,6 +2317,10 @@
"category": "Error",
"code": 2723
},
"Module '{0}' has no exported member '{1}'. Did you mean '{2}'?": {
"category": "Error",
"code": 2724
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
Expand Down Expand Up @@ -2602,7 +2606,7 @@
"code": 4083
},
"Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict.": {
"category": "Message",
"category": "Error",
"code": 4090
},
"Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'.": {
Expand Down Expand Up @@ -3296,7 +3300,7 @@
"category": "Message",
"code": 6146
},
"Resolution for module '{0}' was found in cache.": {
"Resolution for module '{0}' was found in cache from location '{1}'.": {
"category": "Message",
"code": 6147
},
Expand Down Expand Up @@ -3472,6 +3476,14 @@
"category": "Message",
"code": 6190
},
"Whether to keep outdated console output in watch mode instead of clearing the screen.": {
"category": "Message",
"code": 6191
},
"All imports in import declaration are unused.": {
"category": "Error",
"code": 6192
},
"Variable '{0}' implicitly has an '{1}' type.": {
"category": "Error",
"code": 7005
Expand Down Expand Up @@ -3788,6 +3800,10 @@
"category": "Error",
"code": 17016
},
"JSX fragment is not supported when using an inline JSX factory pragma": {
"category": "Error",
"code": 17017
},

"Circularity detected while resolving configuration: {0}": {
"category": "Error",
Expand All @@ -3806,6 +3822,23 @@
"code": 18003
},

"File is a CommonJS module; it may be converted to an ES6 module.": {
"category": "Suggestion",
"code": 80001
},
"This constructor function may be converted to a class declaration.": {
"category": "Suggestion",
"code": 80002
},
"Import may be converted to a default import.": {
"category": "Suggestion",
"code": 80003
},
"JSDoc types may be moved to TypeScript types.": {
"category": "Suggestion",
"code": 80004
},

"Add missing 'super()' call": {
"category": "Message",
"code": 90001
Expand All @@ -3822,6 +3855,10 @@
"category": "Message",
"code": 90004
},
"Remove import from '{0}'": {
"category": "Message",
"code": 90005
},
"Implement interface '{0}'": {
"category": "Message",
"code": 90006
Expand Down
Loading

0 comments on commit 256ef2a

Please sign in to comment.