Skip to content

Commit adc6d11

Browse files
author
Yui T
committed
Merge branch 'master' into useprintVersion
Conflicts: src/compiler/tsc.ts
2 parents fe3fb17 + b1c8245 commit adc6d11

1,979 files changed

Lines changed: 99176 additions & 58744 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.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ scripts/processDiagnosticMessages.js
3131
scripts/importDefinitelyTypedTests/importDefinitelyTypedTests.js
3232
src/harness/*.js
3333
src/compiler/diagnosticInformationMap.generated.ts
34+
src/compiler/diagnosticMessages.generated.json
3435
rwc-report.html
3536
*.swp
3637
build.json

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
built
22
doc
3+
lib/README.md
34
scripts
45
src
56
tests

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: node_js
22

33
node_js:
4+
- 'stable'
45
- '4'
56
- '0.10'
67

AUTHORS.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ TypeScript is authored by:
88
* Basarat Ali Syed
99
* Ben Duffield
1010
* Bill Ticehurst
11+
* Brett Mayen
1112
* Bryan Forbes
1213
* Caitlin Potter
1314
* Chris Bubernak
@@ -17,11 +18,14 @@ TypeScript is authored by:
1718
* Dan Quirk
1819
* Daniel Rosenwasser
1920
* David Li
20-
* Dick van den Brink
21-
* Dirk Bäumer
21+
* Denis Nedelyaev
22+
* Dick van den Brink
23+
* Dirk Bäumer
24+
* Eyas Sharaiha
2225
* Frank Wallis
2326
* Gabriel Isenberg
2427
* Gilad Peleg
28+
* Graeme Wicksted
2529
* Guillaume Salles
2630
* Harald Niesche
2731
* Ingvar Stepanyan
@@ -31,30 +35,39 @@ TypeScript is authored by:
3135
* Jason Ramsay
3236
* Jed Mao
3337
* Johannes Rieken
38+
* John Vilk
3439
* Jonathan Bond-Caron
3540
* Jonathan Park
3641
* Jonathan Turner
3742
* Josh Kalderimis
43+
* Julian Williams
3844
* Kagami Sascha Rosylight
3945
* Keith Mashinter
46+
* Ken Howard
4047
* Kenji Imamula
4148
* Lorant Pinter
49+
* Martin Všetička
4250
* Masahiro Wakame
4351
* Max Deepfield
4452
* Micah Zoltu
4553
* Mohamed Hegazy
54+
* Nathan Shively-Sanders
4655
* Oleg Mihailik
4756
* Oleksandr Chekhovskyi
4857
* Paul van Brenk
4958
* Pedro Maltez
5059
* Philip Bulley
5160
* piloopin
61+
* @progre
62+
* Punya Biswal
5263
* Ron Buckton
5364
* Ryan Cavanaugh
65+
* Ryohei Ikegami
66+
* Sébastien Arod
5467
* Sheetal Nandi
5568
* Shengping Zhong
5669
* Shyyko Serhiy
57-
* Simon Hürlimann
70+
* Simon Hürlimann
5871
* Solal Pirelli
5972
* Stan Thomas
6073
* Steve Lucco
@@ -63,8 +76,10 @@ TypeScript is authored by:
6376
* togru
6477
* Tomas Grubliauskas
6578
* TruongSinh Tran-Nguyen
79+
* Viliv Vane
6680
* Vladimir Matveev
6781
* Wesley Wigham
82+
* York Yao
6883
* Yui Tanglertsampan
6984
* Zev Spitz
70-
* Zhengbo Li
85+
* Zhengbo Li

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ Your pull request should:
3232
* Follow the code conventions descriped in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines)
3333
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
3434

35+
## Contributing `lib.d.ts` fixes
36+
37+
The library sources are in: [src/lib](https://github.com/Microsoft/TypeScript/tree/master/src/lib)
38+
39+
To build the library files, run
40+
```Shell
41+
jake lib
42+
```
43+
44+
#### `src/lib/dom.generated.d.ts` and `src/lib/webworker.generated.d.ts`
45+
46+
These two files represent the DOM typings and are auto-generated. To make any modifications to them, please submit a PR to https://github.com/Microsoft/TSJS-lib-generator
47+
3548
## Running the Tests
3649

3750
To run all tests, invoke the `runtests` target using jake:

Jakefile.js

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,17 @@ var servicesSources = [
9696
return path.join(servicesDirectory, f);
9797
}));
9898

99-
var serverSources = [
99+
var serverCoreSources = [
100100
"node.d.ts",
101101
"editorServices.ts",
102102
"protocol.d.ts",
103103
"session.ts",
104104
"server.ts"
105105
].map(function (f) {
106106
return path.join(serverDirectory, f);
107-
}).concat(servicesSources);
107+
});
108+
109+
var serverSources = serverCoreSources.concat(servicesSources);
108110

109111
var languageServiceLibrarySources = [
110112
"editorServices.ts",
@@ -145,7 +147,8 @@ var harnessSources = harnessCoreSources.concat([
145147
"transpile.ts",
146148
"reuseProgramStructure.ts",
147149
"cachingInServerLSHost.ts",
148-
"moduleResolution.ts"
150+
"moduleResolution.ts",
151+
"tsconfigParsing.ts"
149152
].map(function (f) {
150153
return path.join(unittestsDirectory, f);
151154
})).concat([
@@ -164,7 +167,7 @@ var librarySourceMap = [
164167
{ target: "lib.scriptHost.d.ts", sources: ["importcore.d.ts", "scriptHost.d.ts"], },
165168
{ target: "lib.d.ts", sources: ["core.d.ts", "intl.d.ts", "dom.generated.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"], },
166169
{ target: "lib.core.es6.d.ts", sources: ["core.d.ts", "es6.d.ts"]},
167-
{ target: "lib.es6.d.ts", sources: ["core.d.ts", "es6.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
170+
{ target: "lib.es6.d.ts", sources: ["es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
168171
];
169172

170173
var libraryTargets = librarySourceMap.map(function (f) {
@@ -225,7 +228,7 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
225228
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
226229
file(outFile, prereqs, function() {
227230
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
228-
var options = "--module commonjs --noImplicitAny --noEmitOnError";
231+
var options = "--noImplicitAny --noEmitOnError --pretty";
229232

230233
// Keep comments when specifically requested
231234
// or when in debug mode.
@@ -248,6 +251,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
248251
if (!noOutFile) {
249252
options += " --out " + outFile;
250253
}
254+
else {
255+
options += " --module commonjs"
256+
}
251257

252258
if(noResolve) {
253259
options += " --noResolve";
@@ -320,6 +326,8 @@ var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnostic
320326
var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts");
321327
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
322328
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
329+
var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json");
330+
var builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "diagnosticMessages.generated.json");
323331

324332
file(processDiagnosticMessagesTs);
325333

@@ -348,6 +356,12 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
348356
ex.run();
349357
}, {async: true});
350358

359+
file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], function() {
360+
if (fs.existsSync(builtLocalDirectory)) {
361+
jake.cpR(generatedDiagnosticMessagesJSON, builtGeneratedDiagnosticMessagesJSON);
362+
}
363+
});
364+
351365
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
352366
task("generate-diagnostics", [diagnosticInfoMapTs]);
353367

@@ -444,6 +458,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
444458
// Stanalone/web definition file using global 'ts' namespace
445459
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
446460
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
461+
definitionFileContents = definitionFileContents.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, '$1$2enum $3 {$4');
462+
fs.writeFileSync(standaloneDefinitionsFile, definitionFileContents);
447463

448464
// Official node package definition file, pointed to by 'typings' in package.json
449465
// Created by appending 'export = ts;' at the end of the standalone file to turn it into an external module
@@ -476,7 +492,7 @@ task("lssl", [lsslFile]);
476492

477493
// Local target to build the compiler and services
478494
desc("Builds the full compiler and services");
479-
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]);
495+
task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile, builtGeneratedDiagnosticMessagesJSON]);
480496

481497
// Local target to build only tsc.js
482498
desc("Builds only the compiler");
@@ -626,9 +642,7 @@ function deleteTemporaryProjectOutput() {
626642
}
627643
}
628644

629-
var testTimeout = 20000;
630-
desc("Runs the tests using the built run.js file. Syntax is jake runtests. Optional parameters 'host=', 'tests=[regex], reporter=[list|spec|json|<more>]', debug=true.");
631-
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
645+
function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
632646
cleanTestDirs();
633647
var debug = process.env.debug || process.env.d;
634648
tests = process.env.test || process.env.tests || process.env.t;
@@ -638,7 +652,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
638652
fs.unlinkSync(testConfigFile);
639653
}
640654

641-
if(tests || light) {
655+
if (tests || light) {
642656
writeTestConfigFile(tests, light, testConfigFile);
643657
}
644658

@@ -648,20 +662,48 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
648662

649663
colors = process.env.colors || process.env.color
650664
colors = colors ? ' --no-colors ' : ' --colors ';
651-
tests = tests ? ' -g ' + tests : '';
652-
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
665+
reporter = process.env.reporter || process.env.r || defaultReporter;
666+
653667
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
654668
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
655-
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
656-
console.log(cmd);
657-
exec(cmd, function() {
658-
deleteTemporaryProjectOutput();
659-
var lint = jake.Task['lint'];
660-
lint.addListener('complete', function () {
661-
complete();
669+
var subsetRegexes;
670+
if(defaultSubsets.length === 0) {
671+
subsetRegexes = [tests]
672+
}
673+
else {
674+
var subsets = tests ? tests.split("|") : defaultSubsets;
675+
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
676+
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
677+
}
678+
subsetRegexes.forEach(function (subsetRegex) {
679+
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
680+
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
681+
console.log(cmd);
682+
exec(cmd, function () {
683+
deleteTemporaryProjectOutput();
684+
if (postLint) {
685+
var lint = jake.Task['lint'];
686+
lint.addListener('complete', function () {
687+
complete();
688+
});
689+
lint.invoke();
690+
}
691+
else {
692+
complete();
693+
}
662694
});
663-
lint.invoke();
664695
});
696+
}
697+
698+
var testTimeout = 20000;
699+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
700+
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], function() {
701+
runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']);
702+
}, {async: true});
703+
704+
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false.");
705+
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
706+
runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true);
665707
}, {async: true});
666708

667709
desc("Generates code coverage data via instanbul");
@@ -820,7 +862,9 @@ var tslintRuleDir = "scripts/tslint";
820862
var tslintRules = ([
821863
"nextLineRule",
822864
"noNullRule",
823-
"booleanTriviaRule"
865+
"preferConstRule",
866+
"booleanTriviaRule",
867+
"typeOperatorSpacingRule"
824868
]);
825869
var tslintRulesFiles = tslintRules.map(function(p) {
826870
return path.join(tslintRuleDir, p + ".ts");
@@ -863,7 +907,9 @@ function lintFileAsync(options, path, cb) {
863907
});
864908
}
865909

866-
var lintTargets = compilerSources.concat(harnessCoreSources);
910+
var lintTargets = compilerSources
911+
.concat(harnessCoreSources)
912+
.concat(serverCoreSources);
867913

868914
desc("Runs tslint on the compiler sources");
869915
task("lint", ["build-rules"], function() {

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
2-
[![npm version](https://badge.fury.io/js/typescript.svg)](http://badge.fury.io/js/typescript)
3-
[![Downloads](http://img.shields.io/npm/dm/TypeScript.svg)](https://npmjs.org/package/typescript)
2+
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
3+
[![Downloads](https://img.shields.io/npm/dm/TypeScript.svg)](https://www.npmjs.com/package/typescript)
44

55
# TypeScript
66

lib/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Read this!
2+
3+
These files are not meant to be edited by hand.
4+
If you need to make modifications, the respective files should be changed within the repository's top-level `src` directory.

lib/lib.core.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ interface ArrayBuffer {
12251225
interface ArrayBufferConstructor {
12261226
prototype: ArrayBuffer;
12271227
new (byteLength: number): ArrayBuffer;
1228-
isView(arg: any): boolean;
1228+
isView(arg: any): arg is ArrayBufferView;
12291229
}
12301230
declare var ArrayBuffer: ArrayBufferConstructor;
12311231

lib/lib.core.es6.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ interface ArrayBuffer {
12251225
interface ArrayBufferConstructor {
12261226
prototype: ArrayBuffer;
12271227
new (byteLength: number): ArrayBuffer;
1228-
isView(arg: any): boolean;
1228+
isView(arg: any): arg is ArrayBufferView;
12291229
}
12301230
declare var ArrayBuffer: ArrayBufferConstructor;
12311231

0 commit comments

Comments
 (0)