Skip to content

Commit c5d2bb6

Browse files
author
Josh Goldberg
committed
Merge branch 'master' into pretty-watch-error-summaries
# Conflicts: # src/compiler/diagnosticMessages.json # src/compiler/watch.ts
2 parents 9cf5538 + 3480bf2 commit c5d2bb6

1,519 files changed

Lines changed: 56487 additions & 55892 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ workflows:
6565
base: &base
6666
environment:
6767
- workerCount: 4
68+
- timeout: 400000
6869
steps:
6970
- checkout
7071
- run: |

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ tslint.json
1515
Jakefile.js
1616
.editorconfig
1717
.gitattributes
18+
.gitmodules
1819
.settings/
1920
.travis.yml
21+
.circleci
2022
.vscode/
23+
.parallelperf.json
2124
test.config
2225
package-lock.json
26+
yarn.lock

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node_js:
88
sudo: false
99

1010
env:
11-
- workerCount=3
11+
- workerCount=3 timeout=600000
1212

1313
matrix:
1414
fast_finish: true

Gulpfile.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,16 @@ const es2017LibrarySource = [
143143
const es2017LibrarySourceMap = es2017LibrarySource.map(source =>
144144
({ target: "lib." + source, sources: ["header.d.ts", source] }));
145145

146-
const es2018LibrarySource = [];
146+
const es2018LibrarySource = [
147+
"es2018.regexp.d.ts",
148+
"es2018.promise.d.ts"
149+
];
147150
const es2018LibrarySourceMap = es2018LibrarySource.map(source =>
148151
({ target: "lib." + source, sources: ["header.d.ts", source] }));
149152

150153
const esnextLibrarySource = [
151154
"esnext.asynciterable.d.ts",
152-
"esnext.array.d.ts",
153-
"esnext.promise.d.ts"
155+
"esnext.array.d.ts"
154156
];
155157

156158
const esnextLibrarySourceMap = esnextLibrarySource.map(source =>

Jakefile.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,16 +206,18 @@ var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
206206
return { target: "lib." + source, sources: ["header.d.ts", source] };
207207
});
208208

209-
var es2018LibrarySource = [];
209+
var es2018LibrarySource = [
210+
"es2018.regexp.d.ts",
211+
"es2018.promise.d.ts"
212+
];
210213

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

215218
var esnextLibrarySource = [
216219
"esnext.asynciterable.d.ts",
217-
"esnext.array.d.ts",
218-
"esnext.promise.d.ts"
220+
"esnext.array.d.ts"
219221
];
220222

221223
var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {

src/compiler/binder.ts

Lines changed: 128 additions & 92 deletions
Large diffs are not rendered by default.

src/compiler/checker.ts

Lines changed: 685 additions & 477 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ namespace ts {
6262
category: Diagnostics.Command_line_Options,
6363
description: Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental
6464
},
65+
{
66+
name: "preserveWatchOutput",
67+
type: "boolean",
68+
showInSimplifiedHelpView: false,
69+
category: Diagnostics.Command_line_Options,
70+
description: Diagnostics.Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen,
71+
},
6572
{
6673
name: "watch",
6774
shortName: "w",
@@ -144,9 +151,10 @@ namespace ts {
144151
"es2017.string": "lib.es2017.string.d.ts",
145152
"es2017.intl": "lib.es2017.intl.d.ts",
146153
"es2017.typedarrays": "lib.es2017.typedarrays.d.ts",
154+
"es2018.promise": "lib.es2018.promise.d.ts",
155+
"es2018.regexp": "lib.es2018.regexp.d.ts",
147156
"esnext.array": "lib.esnext.array.d.ts",
148157
"esnext.asynciterable": "lib.esnext.asynciterable.d.ts",
149-
"esnext.promise": "lib.esnext.promise.d.ts",
150158
}),
151159
},
152160
showInSimplifiedHelpView: true,
@@ -1731,7 +1739,7 @@ namespace ts {
17311739
function getExtendedConfig(
17321740
sourceFile: JsonSourceFile,
17331741
extendedConfigPath: string,
1734-
host: ts.ParseConfigHost,
1742+
host: ParseConfigHost,
17351743
basePath: string,
17361744
resolutionStack: string[],
17371745
errors: Push<Diagnostic>,
@@ -2021,7 +2029,7 @@ namespace ts {
20212029
export function getFileNamesFromConfigSpecs(spec: ConfigFileSpecs, basePath: string, options: CompilerOptions, host: ParseConfigHost, extraFileExtensions: ReadonlyArray<JsFileExtensionInfo> = []): ExpandResult {
20222030
basePath = normalizePath(basePath);
20232031

2024-
const keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
2032+
const keyMapper = host.useCaseSensitiveFileNames ? identity : toLowerCase;
20252033

20262034
// Literal file names (provided via the "files" array in tsconfig.json) are stored in a
20272035
// file map with a possibly case insensitive key. We use this map later when when including
@@ -2107,7 +2115,7 @@ namespace ts {
21072115
}
21082116
}
21092117

2110-
function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): ts.DiagnosticMessage | undefined {
2118+
function specToDiagnostic(spec: string, allowTrailingRecursion: boolean): DiagnosticMessage | undefined {
21112119
if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) {
21122120
return Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0;
21132121
}
@@ -2134,7 +2142,7 @@ namespace ts {
21342142
// /a/b/a?z - Watch /a/b directly to catch any new file matching a?z
21352143
const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
21362144
const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i");
2137-
const wildcardDirectories: ts.MapLike<WatchDirectoryFlags> = {};
2145+
const wildcardDirectories: MapLike<WatchDirectoryFlags> = {};
21382146
if (include !== undefined) {
21392147
const recursiveKeys: string[] = [];
21402148
for (const file of include) {
@@ -2225,31 +2233,13 @@ namespace ts {
22252233
}
22262234
}
22272235

2228-
/**
2229-
* Gets a case sensitive key.
2230-
*
2231-
* @param key The original key.
2232-
*/
2233-
function caseSensitiveKeyMapper(key: string) {
2234-
return key;
2235-
}
2236-
2237-
/**
2238-
* Gets a case insensitive key.
2239-
*
2240-
* @param key The original key.
2241-
*/
2242-
function caseInsensitiveKeyMapper(key: string) {
2243-
return key.toLowerCase();
2244-
}
2245-
22462236
/**
22472237
* Produces a cleaned version of compiler options with personally identifiying info (aka, paths) removed.
22482238
* Also converts enum values back to strings.
22492239
*/
22502240
/* @internal */
2251-
export function convertCompilerOptionsForTelemetry(opts: ts.CompilerOptions): ts.CompilerOptions {
2252-
const out: ts.CompilerOptions = {};
2241+
export function convertCompilerOptionsForTelemetry(opts: CompilerOptions): CompilerOptions {
2242+
const out: CompilerOptions = {};
22532243
for (const key in opts) {
22542244
if (opts.hasOwnProperty(key)) {
22552245
const type = getOptionFromName(key);
@@ -2273,9 +2263,9 @@ namespace ts {
22732263
return typeof value === "boolean" ? value : "";
22742264
case "list":
22752265
const elementType = (option as CommandLineOptionOfListType).element;
2276-
return ts.isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
2266+
return isArray(value) ? value.map(v => getOptionValueWithEmptyStrings(v, elementType)) : "";
22772267
default:
2278-
return ts.forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
2268+
return forEachEntry(option.type, (optionEnumValue, optionStringValue) => {
22792269
if (optionEnumValue === value) {
22802270
return optionStringValue;
22812271
}

src/compiler/core.ts

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ namespace ts {
2525
/* @internal */
2626
namespace ts {
2727
export const emptyArray: never[] = [] as never[];
28+
export function closeFileWatcher(watcher: FileWatcher) {
29+
watcher.close();
30+
}
31+
2832
/** Create a MapLike with good performance. */
2933
function createDictionaryObject<T>(): MapLike<T> {
3034
const map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
@@ -1590,7 +1594,7 @@ namespace ts {
15901594
return text.replace(/{(\d+)}/g, (_match, index?) => args[+index + baseIndex]);
15911595
}
15921596

1593-
export let localizedDiagnosticMessages: MapLike<string> = undefined;
1597+
export let localizedDiagnosticMessages: MapLike<string>;
15941598

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

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

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

2563-
for (const current of sort(files, comparer)) {
2566+
for (const current of sort(files, compareStringsCaseSensitive)) {
25642567
const name = combinePaths(path, current);
25652568
const absoluteName = combinePaths(absolutePath, current);
25662569
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
@@ -2583,7 +2586,7 @@ namespace ts {
25832586
}
25842587
}
25852588

2586-
for (const current of sort(directories, comparer)) {
2589+
for (const current of sort(directories, compareStringsCaseSensitive)) {
25872590
const name = combinePaths(path, current);
25882591
const absoluteName = combinePaths(absolutePath, current);
25892592
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
@@ -2618,7 +2621,7 @@ namespace ts {
26182621
// Iterate over each include base path and include unique base paths that are not a
26192622
// subpath of an existing base path
26202623
for (const includeBasePath of includeBasePaths) {
2621-
if (ts.every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
2624+
if (every(basePaths, basePath => !containsPath(basePath, includeBasePath, path, !useCaseSensitiveFileNames))) {
26222625
basePaths.push(includeBasePath);
26232626
}
26242627
}
@@ -3049,7 +3052,7 @@ namespace ts {
30493052

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

@@ -3143,4 +3146,36 @@ namespace ts {
31433146
export function singleElementArray<T>(t: T | undefined): T[] | undefined {
31443147
return t === undefined ? undefined : [t];
31453148
}
3149+
3150+
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) {
3151+
unchanged = unchanged || noop;
3152+
let newIndex = 0;
3153+
let oldIndex = 0;
3154+
const newLen = newItems.length;
3155+
const oldLen = oldItems.length;
3156+
while (newIndex < newLen && oldIndex < oldLen) {
3157+
const newItem = newItems[newIndex];
3158+
const oldItem = oldItems[oldIndex];
3159+
const compareResult = comparer(newItem, oldItem);
3160+
if (compareResult === Comparison.LessThan) {
3161+
inserted(newItem);
3162+
newIndex++;
3163+
}
3164+
else if (compareResult === Comparison.GreaterThan) {
3165+
deleted(oldItem);
3166+
oldIndex++;
3167+
}
3168+
else {
3169+
unchanged(oldItem, newItem);
3170+
newIndex++;
3171+
oldIndex++;
3172+
}
3173+
}
3174+
while (newIndex < newLen) {
3175+
inserted(newItems[newIndex++]);
3176+
}
3177+
while (oldIndex < oldLen) {
3178+
deleted(oldItems[oldIndex++]);
3179+
}
3180+
}
31463181
}

src/compiler/declarationEmitter.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,12 @@ namespace ts {
608608
"?");
609609
}
610610
write(": ");
611-
emitType(node.type);
611+
if (node.type) {
612+
emitType(node.type);
613+
}
614+
else {
615+
write("any");
616+
}
612617
write(";");
613618
writeLine();
614619
decreaseIndent();

0 commit comments

Comments
 (0)