Skip to content

Commit 3c34498

Browse files
committed
Merge branch 'master' into transforms
2 parents 5732a60 + 32178ac commit 3c34498

2,266 files changed

Lines changed: 80787 additions & 31847 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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ build.json
2828
*.actual
2929
tests/webhost/*.d.ts
3030
tests/webhost/webtsc.js
31-
tests/*.js
32-
tests/*.js.map
33-
tests/*.d.ts
31+
tests/cases/**/*.js
32+
tests/cases/**/*.js.map
33+
tests/cases/**/*.d.ts
3434
*.config
3535
scripts/debug.bat
3636
scripts/run.bat

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Issues that ask questions answered in the FAQ will be closed without elaboration
1313
## 3. Do you have a question?
1414

1515
The issue tracker is for **issues**, in other words, bugs and suggestions.
16-
If you have a *question*, please use [http://stackoverflow.com/questions/tagged/typescript](Stack Overflow), [https://gitter.im/Microsoft/TypeScript](Gitter), your favorite search engine, or other resources.
16+
If you have a *question*, please use [Stack Overflow](http://stackoverflow.com/questions/tagged/typescript), [Gitter](https://gitter.im/Microsoft/TypeScript), your favorite search engine, or other resources.
1717
Due to increased traffic, we can no longer answer questions in the issue tracker.
1818

1919
## 4. Did you find a bug?

Jakefile.js

Lines changed: 50 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,10 @@ var harnessSources = harnessCoreSources.concat([
176176
"reuseProgramStructure.ts",
177177
"cachingInServerLSHost.ts",
178178
"moduleResolution.ts",
179-
"tsconfigParsing.ts"
179+
"tsconfigParsing.ts",
180+
"commandLineParsing.ts",
181+
"convertCompilerOptionsFromJson.ts",
182+
"convertTypingOptionsFromJson.ts"
180183
].map(function (f) {
181184
return path.join(unittestsDirectory, f);
182185
})).concat([
@@ -250,51 +253,59 @@ var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
250253
* @param prereqs: prerequisite tasks to compiling the file
251254
* @param prefixes: a list of files to prepend to the target file
252255
* @param useBuiltCompiler: true to use the built compiler, false to use the LKG
253-
* @param noOutFile: true to compile without using --out
254-
* @param generateDeclarations: true to compile using --declaration
255-
* @param outDir: true to compile using --outDir
256-
* @param keepComments: false to compile using --removeComments
256+
* @parap {Object} opts - property bag containing auxiliary options
257+
* @param {boolean} opts.noOutFile: true to compile without using --out
258+
* @param {boolean} opts.generateDeclarations: true to compile using --declaration
259+
* @param {string} opts.outDir: value for '--outDir' command line option
260+
* @param {boolean} opts.keepComments: false to compile using --removeComments
261+
* @param {boolean} opts.preserveConstEnums: true if compiler should keep const enums in code
262+
* @param {boolean} opts.noResolve: true if compiler should not include non-rooted files in compilation
263+
* @param {boolean} opts.stripInternal: true if compiler should remove declarations marked as @internal
264+
* @param {boolean} opts.noMapRoot: true if compiler omit mapRoot option
257265
* @param callback: a function to execute after the compilation process ends
258266
*/
259-
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOutFile, generateDeclarations, outDir, preserveConstEnums, keepComments, noResolve, stripInternal, callback) {
267+
function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts, callback) {
260268
file(outFile, prereqs, function() {
261269
var compilerPath = useBuiltCompiler ? builtLocalCompiler : LKGCompiler;
262270
var options = "--noImplicitAny --noEmitOnError --pretty";
263-
271+
opts = opts || {};
264272
// Keep comments when specifically requested
265273
// or when in debug mode.
266-
if (!(keepComments || useDebugMode)) {
274+
if (!(opts.keepComments || useDebugMode)) {
267275
options += " --removeComments";
268276
}
269277

270-
if (generateDeclarations) {
278+
if (opts.generateDeclarations) {
271279
options += " --declaration";
272280
}
273281

274-
if (preserveConstEnums || useDebugMode) {
282+
if (opts.preserveConstEnums || useDebugMode) {
275283
options += " --preserveConstEnums";
276284
}
277285

278-
if (outDir) {
279-
options += " --outDir " + outDir;
286+
if (opts.outDir) {
287+
options += " --outDir " + opts.outDir;
280288
}
281289

282-
if (!noOutFile) {
290+
if (!opts.noOutFile) {
283291
options += " --out " + outFile;
284292
}
285293
else {
286294
options += " --module commonjs"
287295
}
288296

289-
if(noResolve) {
297+
if(opts.noResolve) {
290298
options += " --noResolve";
291299
}
292300

293301
if (useDebugMode) {
294-
options += " -sourcemap -mapRoot file:///" + path.resolve(path.dirname(outFile));
302+
options += " -sourcemap";
303+
if (!opts.noMapRoot) {
304+
options += " -mapRoot file:///" + path.resolve(path.dirname(outFile));
305+
}
295306
}
296307

297-
if (stripInternal) {
308+
if (opts.stripInternal) {
298309
options += " --stripInternal"
299310
}
300311

@@ -413,13 +424,7 @@ compileFile(/*outfile*/configureNightlyJs,
413424
/*prereqs*/ [configureNightlyTs],
414425
/*prefixes*/ [],
415426
/*useBuiltCompiler*/ false,
416-
/*noOutFile*/ false,
417-
/*generateDeclarations*/ false,
418-
/*outDir*/ undefined,
419-
/*preserveConstEnums*/ undefined,
420-
/*keepComments*/ false,
421-
/*noResolve*/ false,
422-
/*stripInternal*/ false);
427+
{ noOutFile: false, generateDeclarations: false, keepComments: false, noResolve: false, stripInternal: false });
423428

424429
task("setDebugMode", function() {
425430
useDebugMode = true;
@@ -473,6 +478,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
473478
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
474479

475480
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
481+
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
476482
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
477483
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
478484
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -481,13 +487,7 @@ var nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_s
481487
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
482488
/*prefixes*/ [copyright],
483489
/*useBuiltCompiler*/ true,
484-
/*noOutFile*/ false,
485-
/*generateDeclarations*/ true,
486-
/*outDir*/ undefined,
487-
/*preserveConstEnums*/ true,
488-
/*keepComments*/ true,
489-
/*noResolve*/ false,
490-
/*stripInternal*/ true,
490+
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true },
491491
/*callback*/ function () {
492492
jake.cpR(servicesFile, nodePackageFile, {silent: true});
493493

@@ -510,6 +510,16 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
510510
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
511511
});
512512

513+
compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
514+
/*prefixes*/ [copyright],
515+
/*useBuiltCompiler*/ true,
516+
{ noOutFile: false, generateDeclarations: true, preserveConstEnums: true, keepComments: true, noResolve: false, stripInternal: true, noMapRoot: true },
517+
/*callback*/ function () {
518+
var content = fs.readFileSync(servicesFileInBrowserTest).toString();
519+
var i = content.lastIndexOf("\n");
520+
fs.writeFileSync(servicesFileInBrowserTest, content.substring(0, i) + "\r\n//# sourceURL=../built/local/typeScriptServices.js" + content.substring(i));
521+
});
522+
513523

514524
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
515525
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -521,8 +531,7 @@ compileFile(
521531
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
522532
/*prefixes*/ [copyright],
523533
/*useBuiltCompiler*/ true,
524-
/*noOutFile*/ false,
525-
/*generateDeclarations*/ true);
534+
{ noOutFile: false, generateDeclarations: true });
526535

527536
// Local target to build the language service server library
528537
desc("Builds language service server library");
@@ -681,7 +690,7 @@ function deleteTemporaryProjectOutput() {
681690
}
682691
}
683692

684-
function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
693+
function runConsoleTests(defaultReporter, defaultSubsets) {
685694
cleanTestDirs();
686695
var debug = process.env.debug || process.env.d;
687696
tests = process.env.test || process.env.tests || process.env.t;
@@ -714,13 +723,13 @@ function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
714723
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
715724
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
716725
}
717-
subsetRegexes.forEach(function (subsetRegex) {
726+
subsetRegexes.forEach(function (subsetRegex, i) {
718727
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
719728
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
720729
console.log(cmd);
721730
exec(cmd, function () {
722731
deleteTemporaryProjectOutput();
723-
if (postLint) {
732+
if (i === 0) {
724733
var lint = jake.Task['lint'];
725734
lint.addListener('complete', function () {
726735
complete();
@@ -742,7 +751,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
742751

743752
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.");
744753
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
745-
runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true);
754+
runConsoleTests('mocha-fivemat-progress-reporter', []);
746755
}, {async: true});
747756

748757
desc("Generates code coverage data via instanbul");
@@ -755,7 +764,7 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
755764
// Browser tests
756765
var nodeServerOutFile = 'tests/webTestServer.js'
757766
var nodeServerInFile = 'tests/webTestServer.ts'
758-
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, /*noOutFile*/ true);
767+
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true });
759768

760769
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
761770
task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function() {
@@ -764,7 +773,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
764773
}, {async: true});
765774

766775
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]");
767-
task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function() {
776+
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
768777
cleanTestDirs();
769778
host = "node"
770779
port = process.env.port || process.env.p || '8888';
@@ -916,7 +925,8 @@ var tslintRulesOutFiles = tslintRules.map(function(p) {
916925
desc("Compiles tslint rules to js");
917926
task("build-rules", tslintRulesOutFiles);
918927
tslintRulesFiles.forEach(function(ruleFile, i) {
919-
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
928+
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false,
929+
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint")});
920930
});
921931

922932
function getLinterOptions() {
@@ -955,6 +965,7 @@ var servicesLintTargets = [
955965
"patternMatcher.ts",
956966
"services.ts",
957967
"shims.ts",
968+
"jsTyping.ts"
958969
].map(function (s) {
959970
return path.join(servicesDirectory, s);
960971
});

doc/handbook/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# The TypeScript Handbook
2+
3+
The contents of the TypeScript Handbook can be read from [its GitHub repository](https://github.com/Microsoft/TypeScript-Handbook).
4+
Issues and pull requests should be directed there.

doc/wiki/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# The TypeScript Wiki
2+
3+
To read the wiki, [visit the wiki on GitHub](https://github.com/Microsoft/TypeScript/wiki).
4+
5+
To contribute by filing an issue or sending a pull request, [visit the wiki repository](https://github.com/Microsoft/TypeScript-wiki).
6+

issue_template.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!--
2+
Thank you for contributing to TypeScript! Please review this checklist
3+
before submitting your issue.
4+
[ ] Many common issues and suggestions are addressed in the FAQ
5+
https://github.com/Microsoft/TypeScript/wiki/FAQ
6+
[ ] Search for duplicates before logging new issues
7+
https://github.com/Microsoft/TypeScript/issues?utf8=%E2%9C%93&q=is%3Aissue
8+
[ ] Questions are best asked and answered at Stack Overflow
9+
http://stackoverflow.com/questions/tagged/typescript
10+
11+
For bug reports, please include the information below.
12+
__________________________________________________________ -->
13+
14+
**TypeScript Version:**
15+
16+
1.7.5 / 1.8.0-beta / nightly (1.9.0-dev.20160217)
17+
18+
**Code**
19+
20+
```ts
21+
// A self-contained demonstration of the problem follows...
22+
23+
```
24+
25+
**Expected behavior:**
26+
27+
**Actual behavior:**

0 commit comments

Comments
 (0)