Skip to content

Commit 3600ccc

Browse files
author
Kanchalai Tanglertsampan
committed
Merge branch 'master' into master-14217
# Conflicts: # tests/baselines/reference/bestChoiceType.symbols # tests/baselines/reference/classExpressionWithStaticProperties3.symbols # tests/baselines/reference/classExpressionWithStaticPropertiesES63.symbols # tests/baselines/reference/declarationEmitPromise.symbols # tests/baselines/reference/keyofAndIndexedAccess.symbols # tests/baselines/reference/mapOnTupleTypes01.symbols # tests/baselines/reference/mapOnTupleTypes02.symbols # tests/baselines/reference/mappedTypeRelationships.errors.txt # tests/baselines/reference/noImplicitAnyInContextuallyTypesFunctionParamter.symbols # tests/baselines/reference/specializationsShouldNotAffectEachOther.symbols # tests/baselines/reference/tsxSpreadChildren.symbols # tests/baselines/reference/typedArrays.symbols
2 parents 132f9f9 + 363c514 commit 3600ccc

File tree

466 files changed

+16774
-2568
lines changed

Some content is hidden

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

466 files changed

+16774
-2568
lines changed

Gulpfile.ts

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import * as cp from "child_process";
33
import * as path from "path";
44
import * as fs from "fs";
5+
import child_process = require("child_process");
56
import originalGulp = require("gulp");
67
import helpMaker = require("gulp-help");
78
import runSequence = require("run-sequence");
@@ -416,7 +417,7 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
416417
file.path = nodeDefinitionsFile;
417418
return content + "\r\nexport = ts;";
418419
}))
419-
.pipe(gulp.dest(".")),
420+
.pipe(gulp.dest("src/services")),
420421
completedDts.pipe(clone())
421422
.pipe(insert.transform((content, file) => {
422423
file.path = nodeStandaloneDefinitionsFile;
@@ -477,12 +478,12 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
477478
return merge2([
478479
js.pipe(prependCopyright())
479480
.pipe(sourcemaps.write("."))
480-
.pipe(gulp.dest(".")),
481+
.pipe(gulp.dest("src/server")),
481482
dts.pipe(prependCopyright(/*outputCopyright*/true))
482483
.pipe(insert.transform((content) => {
483484
return content + "\r\nexport = ts;\r\nexport as namespace ts;";
484485
}))
485-
.pipe(gulp.dest("."))
486+
.pipe(gulp.dest("src/server"))
486487
]);
487488
});
488489

@@ -749,7 +750,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
749750
const originalMap = file.sourceMap;
750751
const prebundledContent = file.contents.toString();
751752
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
752-
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
753+
originalMap.sources = originalMap.sources.map(s => path.resolve(path.join("src/harness", s)));
753754
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
754755
originalMap.file = "built/local/_stream_0.js";
755756

@@ -960,7 +961,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
960961
});
961962

962963
gulp.task("build-rules", "Compiles tslint rules to js", () => {
963-
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false);
964+
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", "lib": ["es6"] }, /*useBuiltCompiler*/ false);
964965
const dest = path.join(builtLocalDirectory, "tslint");
965966
return gulp.src("scripts/tslint/**/*.ts")
966967
.pipe(newer({
@@ -1019,40 +1020,16 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) =
10191020
}
10201021

10211022
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
1022-
const fileMatcher = RegExp(cmdLineOptions["files"]);
10231023
if (fold.isTravis()) console.log(fold.start("lint"));
1024-
1025-
let files: {stat: fs.Stats, path: string}[] = [];
1026-
return gulp.src(lintTargets, { read: false })
1027-
.pipe(through2.obj((chunk, enc, cb) => {
1028-
files.push(chunk);
1029-
cb();
1030-
}, (cb) => {
1031-
files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size);
1032-
const workerCount = cmdLineOptions["workers"];
1033-
for (let i = 0; i < workerCount; i++) {
1034-
spawnLintWorker(files, finished);
1035-
}
1036-
1037-
let completed = 0;
1038-
let failures = 0;
1039-
function finished(fails) {
1040-
completed++;
1041-
failures += fails;
1042-
if (completed === workerCount) {
1043-
if (fold.isTravis()) console.log(fold.end("lint"));
1044-
if (failures > 0) {
1045-
throw new Error(`Linter errors: ${failures}`);
1046-
}
1047-
else {
1048-
cb();
1049-
}
1050-
}
1051-
}
1052-
}));
1024+
const fileMatcher = cmdLineOptions["files"];
1025+
const files = fileMatcher
1026+
? `src/**/${fileMatcher}`
1027+
: "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts' --exclude 'src/harness/unittests/services/**/*.ts'";
1028+
const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`;
1029+
console.log("Linting: " + cmd);
1030+
child_process.execSync(cmd, { stdio: [0, 1, 2] });
10531031
});
10541032

1055-
10561033
gulp.task("default", "Runs 'local'", ["local"]);
10571034

10581035
gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => {

Jakefile.js

Lines changed: 21 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ var ts = require("./lib/typescript");
1111

1212
// Variables
1313
var compilerDirectory = "src/compiler/";
14-
var servicesDirectory = "src/services/";
1514
var serverDirectory = "src/server/";
16-
var typingsInstallerDirectory = "src/server/typingsInstaller";
17-
var cancellationTokenDirectory = "src/server/cancellationToken";
18-
var watchGuardDirectory = "src/server/watchGuard";
1915
var harnessDirectory = "src/harness/";
2016
var libraryDirectory = "src/lib/";
2117
var scriptsDirectory = "scripts/";
@@ -131,6 +127,7 @@ var harnessSources = harnessCoreSources.concat([
131127
"matchFiles.ts",
132128
"initializeTSConfig.ts",
133129
"printer.ts",
130+
"textChanges.ts",
134131
"transform.ts",
135132
"customTransforms.ts",
136133
].map(function (f) {
@@ -333,7 +330,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
333330
options += " --lib " + opts.lib
334331
}
335332
else {
336-
options += " --lib es5,scripthost"
333+
options += " --lib es5"
337334
}
338335
options += " --noUnusedLocals --noUnusedParameters";
339336

@@ -422,7 +419,7 @@ compileFile(buildProtocolJs,
422419
[buildProtocolTs],
423420
[],
424421
/*useBuiltCompiler*/ false,
425-
{noOutFile: true});
422+
{ noOutFile: true, lib: "es6" });
426423

427424
file(buildProtocolDts, [buildProtocolTs, buildProtocolJs, typescriptServicesDts], function() {
428425

@@ -584,16 +581,16 @@ compileFile(
584581
file(typescriptServicesDts, [servicesFile]);
585582

586583
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
587-
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: true });
584+
compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirectory].concat(cancellationTokenSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: true, lib: "es6" });
588585

589586
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
590-
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
587+
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6" });
591588

592589
var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js");
593-
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
590+
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], outDir: builtLocalDirectory, noOutFile: false, lib: "es6" });
594591

595592
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
596-
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true });
593+
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true, lib: "es6" });
597594
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
598595
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
599596
compileFile(
@@ -717,7 +714,7 @@ compileFile(
717714
/*prereqs*/[builtLocalDirectory, tscFile].concat(libraryTargets).concat(servicesSources).concat(harnessSources),
718715
/*prefixes*/[],
719716
/*useBuiltCompiler:*/ true,
720-
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"] });
717+
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"], lib: "es6" });
721718

722719
var internalTests = "internal/";
723720

@@ -1104,7 +1101,8 @@ var tslintRules = [
11041101
"noInOperatorRule",
11051102
"noIncrementDecrementRule",
11061103
"objectLiteralSurroundingSpaceRule",
1107-
"noTypeAssertionWhitespaceRule"
1104+
"noTypeAssertionWhitespaceRule",
1105+
"noBomRule"
11081106
];
11091107
var tslintRulesFiles = tslintRules.map(function (p) {
11101108
return path.join(tslintRuleDir, p + ".ts");
@@ -1179,43 +1177,16 @@ function spawnLintWorker(files, callback) {
11791177
}
11801178

11811179
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
1182-
task("lint", ["build-rules"], function () {
1180+
task("lint", ["build-rules"], () => {
11831181
if (fold.isTravis()) console.log(fold.start("lint"));
1184-
var startTime = mark();
1185-
var failed = 0;
1186-
var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || "");
1187-
var done = {};
1188-
for (var i in lintTargets) {
1189-
var target = lintTargets[i];
1190-
if (!done[target] && fileMatcher.test(target)) {
1191-
done[target] = fs.statSync(target).size;
1192-
}
1193-
}
1194-
1195-
var workerCount = (process.env.workerCount && +process.env.workerCount) || os.cpus().length;
1196-
1197-
var names = Object.keys(done).sort(function (namea, nameb) {
1198-
return done[namea] - done[nameb];
1182+
const fileMatcher = process.env.f || process.env.file || process.env.files;
1183+
const files = fileMatcher
1184+
? `src/**/${fileMatcher}`
1185+
: "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts' --exclude 'src/harness/unittests/services/**/*.ts'";
1186+
const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`;
1187+
console.log("Linting: " + cmd);
1188+
jake.exec([cmd], { interactive: true }, () => {
1189+
if (fold.isTravis()) console.log(fold.end("lint"));
1190+
complete();
11991191
});
1200-
1201-
for (var i = 0; i < workerCount; i++) {
1202-
spawnLintWorker(names, finished);
1203-
}
1204-
1205-
var completed = 0;
1206-
var failures = 0;
1207-
function finished(fails) {
1208-
completed++;
1209-
failures += fails;
1210-
if (completed === workerCount) {
1211-
measure(startTime);
1212-
if (fold.isTravis()) console.log(fold.end("lint"));
1213-
if (failures > 0) {
1214-
fail('Linter errors.', failed);
1215-
}
1216-
else {
1217-
complete();
1218-
}
1219-
}
1220-
}
1221-
}, { async: true });
1192+
});

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ with any additional questions or comments.
3939

4040
## Documentation
4141

42-
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
43-
* [Programming handbook](http://www.typescriptlang.org/Handbook)
42+
* [Quick tutorial](http://www.typescriptlang.org/docs/tutorial.html)
43+
* [Programming handbook](http://www.typescriptlang.org/docs/handbook/basic-types.html)
4444
* [Language specification](https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md)
4545
* [Homepage](http://www.typescriptlang.org/)
4646

@@ -95,4 +95,4 @@ node built/local/tsc.js hello.ts
9595

9696
## Roadmap
9797

98-
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).
98+
For details on our planned features and future direction please refer to our [roadmap](https://github.com/Microsoft/TypeScript/wiki/Roadmap).

doc/logo.svg

Lines changed: 10 additions & 15 deletions
Loading

issue_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->
33
<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->
44

5-
**TypeScript Version:** 2.1.1 / nightly (2.2.0-dev.201xxxxx)
5+
**TypeScript Version:** 2.2.1 / nightly (2.2.0-dev.201xxxxx)
66

77
**Code**
88

0 commit comments

Comments
 (0)