Skip to content

Commit 7dd1bf4

Browse files
committed
Merge branch 'master' into javaScriptModules
# Conflicts: # lib/lib.es6.d.ts # lib/tsc.js # lib/tsserver.js # lib/typescript.d.ts # lib/typescript.js # lib/typescriptServices.d.ts # lib/typescriptServices.js # src/compiler/binder.ts # src/compiler/checker.ts # src/compiler/parser.ts # src/compiler/program.ts # src/harness/fourslash.ts
2 parents 3f4e5a4 + aa39994 commit 7dd1bf4

File tree

628 files changed

+58239
-19463
lines changed

Some content is hidden

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

628 files changed

+58239
-19463
lines changed

.gitignore

+1
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

+1
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

CONTRIBUTING.md

+13
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

+65-22
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 = "--module commonjs --noImplicitAny --noEmitOnError --pretty";
229232

230233
// Keep comments when specifically requested
231234
// or when in debug mode.
@@ -320,6 +323,8 @@ var processDiagnosticMessagesJs = path.join(scriptsDirectory, "processDiagnostic
320323
var processDiagnosticMessagesTs = path.join(scriptsDirectory, "processDiagnosticMessages.ts");
321324
var diagnosticMessagesJson = path.join(compilerDirectory, "diagnosticMessages.json");
322325
var diagnosticInfoMapTs = path.join(compilerDirectory, "diagnosticInformationMap.generated.ts");
326+
var generatedDiagnosticMessagesJSON = path.join(compilerDirectory, "diagnosticMessages.generated.json");
327+
var builtGeneratedDiagnosticMessagesJSON = path.join(builtLocalDirectory, "diagnosticMessages.generated.json");
323328

324329
file(processDiagnosticMessagesTs);
325330

@@ -348,6 +353,12 @@ file(diagnosticInfoMapTs, [processDiagnosticMessagesJs, diagnosticMessagesJson],
348353
ex.run();
349354
}, {async: true});
350355

356+
file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], function() {
357+
if (fs.existsSync(builtLocalDirectory)) {
358+
jake.cpR(generatedDiagnosticMessagesJSON, builtGeneratedDiagnosticMessagesJSON);
359+
}
360+
});
361+
351362
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
352363
task("generate-diagnostics", [diagnosticInfoMapTs]);
353364

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

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

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

481494
// Local target to build only tsc.js
482495
desc("Builds only the compiler");
@@ -626,9 +639,7 @@ function deleteTemporaryProjectOutput() {
626639
}
627640
}
628641

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() {
642+
function runConsoleTests(defaultReporter, defaultSubsets, postLint) {
632643
cleanTestDirs();
633644
var debug = process.env.debug || process.env.d;
634645
tests = process.env.test || process.env.tests || process.env.t;
@@ -638,7 +649,7 @@ task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
638649
fs.unlinkSync(testConfigFile);
639650
}
640651

641-
if(tests || light) {
652+
if (tests || light) {
642653
writeTestConfigFile(tests, light, testConfigFile);
643654
}
644655

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

649660
colors = process.env.colors || process.env.color
650661
colors = colors ? ' --no-colors ' : ' --colors ';
651-
tests = tests ? ' -g ' + tests : '';
652-
reporter = process.env.reporter || process.env.r || 'mocha-fivemat-progress-reporter';
662+
reporter = process.env.reporter || process.env.r || defaultReporter;
663+
653664
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
654665
// 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();
666+
var subsetRegexes;
667+
if(defaultSubsets.length === 0) {
668+
subsetRegexes = [tests]
669+
}
670+
else {
671+
var subsets = tests ? tests.split("|") : defaultSubsets;
672+
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
673+
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
674+
}
675+
subsetRegexes.forEach(function (subsetRegex) {
676+
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
677+
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
678+
console.log(cmd);
679+
exec(cmd, function () {
680+
deleteTemporaryProjectOutput();
681+
if (postLint) {
682+
var lint = jake.Task['lint'];
683+
lint.addListener('complete', function () {
684+
complete();
685+
});
686+
lint.invoke();
687+
}
688+
else {
689+
complete();
690+
}
662691
});
663-
lint.invoke();
664692
});
693+
}
694+
695+
var testTimeout = 20000;
696+
desc("Runs all the tests in parallel using the built run.js file. Optional arguments are: t[ests]=category1|category2|... d[ebug]=true.");
697+
task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], function() {
698+
runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']);
699+
}, {async: true});
700+
701+
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.");
702+
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
703+
runConsoleTests('mocha-fivemat-progress-reporter', [], /*postLint*/ true);
665704
}, {async: true});
666705

667706
desc("Generates code coverage data via instanbul");
@@ -820,7 +859,9 @@ var tslintRuleDir = "scripts/tslint";
820859
var tslintRules = ([
821860
"nextLineRule",
822861
"noNullRule",
823-
"booleanTriviaRule"
862+
"preferConstRule",
863+
"booleanTriviaRule",
864+
"typeOperatorSpacingRule"
824865
]);
825866
var tslintRulesFiles = tslintRules.map(function(p) {
826867
return path.join(tslintRuleDir, p + ".ts");
@@ -863,7 +904,9 @@ function lintFileAsync(options, path, cb) {
863904
});
864905
}
865906

866-
var lintTargets = compilerSources.concat(harnessCoreSources);
907+
var lintTargets = compilerSources
908+
.concat(harnessCoreSources)
909+
.concat(serverCoreSources);
867910

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

lib/README.md

+4
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.d.ts

+63-3
Original file line numberDiff line numberDiff line change
@@ -6234,6 +6234,68 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven
62346234
createElement(tagName: "x-ms-webview"): MSHTMLWebViewElement;
62356235
createElement(tagName: "xmp"): HTMLBlockElement;
62366236
createElement(tagName: string): HTMLElement;
6237+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement
6238+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "circle"): SVGCircleElement
6239+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "clipPath"): SVGClipPathElement
6240+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "componentTransferFunction"): SVGComponentTransferFunctionElement
6241+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "defs"): SVGDefsElement
6242+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "desc"): SVGDescElement
6243+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "ellipse"): SVGEllipseElement
6244+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feBlend"): SVGFEBlendElement
6245+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feColorMatrix"): SVGFEColorMatrixElement
6246+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComponentTransfer"): SVGFEComponentTransferElement
6247+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feComposite"): SVGFECompositeElement
6248+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feConvolveMatrix"): SVGFEConvolveMatrixElement
6249+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDiffuseLighting"): SVGFEDiffuseLightingElement
6250+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDisplacementMap"): SVGFEDisplacementMapElement
6251+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feDistantLight"): SVGFEDistantLightElement
6252+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFlood"): SVGFEFloodElement
6253+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncA"): SVGFEFuncAElement
6254+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncB"): SVGFEFuncBElement
6255+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncG"): SVGFEFuncGElement
6256+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feFuncR"): SVGFEFuncRElement
6257+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feGaussianBlur"): SVGFEGaussianBlurElement
6258+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feImage"): SVGFEImageElement
6259+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMerge"): SVGFEMergeElement
6260+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMergeNode"): SVGFEMergeNodeElement
6261+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feMorphology"): SVGFEMorphologyElement
6262+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feOffset"): SVGFEOffsetElement
6263+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "fePointLight"): SVGFEPointLightElement
6264+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpecularLighting"): SVGFESpecularLightingElement
6265+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feSpotLight"): SVGFESpotLightElement
6266+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTile"): SVGFETileElement
6267+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "feTurbulence"): SVGFETurbulenceElement
6268+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "filter"): SVGFilterElement
6269+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "foreignObject"): SVGForeignObjectElement
6270+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "g"): SVGGElement
6271+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "image"): SVGImageElement
6272+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "gradient"): SVGGradientElement
6273+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "line"): SVGLineElement
6274+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "linearGradient"): SVGLinearGradientElement
6275+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "marker"): SVGMarkerElement
6276+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "mask"): SVGMaskElement
6277+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "path"): SVGPathElement
6278+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "metadata"): SVGMetadataElement
6279+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "pattern"): SVGPatternElement
6280+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polygon"): SVGPolygonElement
6281+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "polyline"): SVGPolylineElement
6282+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "radialGradient"): SVGRadialGradientElement
6283+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "rect"): SVGRectElement
6284+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "svg"): SVGSVGElement
6285+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement
6286+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "stop"): SVGStopElement
6287+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement
6288+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "switch"): SVGSwitchElement
6289+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "symbol"): SVGSymbolElement
6290+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "tspan"): SVGTSpanElement
6291+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textContent"): SVGTextContentElement
6292+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "text"): SVGTextElement
6293+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPath"): SVGTextPathElement
6294+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "textPositioning"): SVGTextPositioningElement
6295+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement
6296+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "use"): SVGUseElement
6297+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "view"): SVGViewElement
6298+
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement
62376299
createElementNS(namespaceURI: string, qualifiedName: string): Element;
62386300
createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
62396301
createNSResolver(nodeResolver: Node): XPathNSResolver;
@@ -11055,14 +11117,12 @@ interface ImageData {
1105511117
width: number;
1105611118
}
1105711119

11058-
interface ImageDataConstructor {
11120+
declare var ImageData: {
1105911121
prototype: ImageData;
1106011122
new(width: number, height: number): ImageData;
1106111123
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
1106211124
}
1106311125

11064-
declare var ImageData: ImageDataConstructor;
11065-
1106611126
interface KeyboardEvent extends UIEvent {
1106711127
altKey: boolean;
1106811128
char: string;

0 commit comments

Comments
 (0)