Skip to content

Commit 1df3684

Browse files
committed
Merge pull request #6 from Microsoft/master
Sync
2 parents a7dad34 + 96995e7 commit 1df3684

File tree

820 files changed

+50018
-58957
lines changed

Some content is hidden

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

820 files changed

+50018
-58957
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Your pull request should:
2525
* Tests should include reasonable permutations of the target fix/change
2626
* Include baseline changes with your change
2727
* All changed code must have 100% code coverage
28-
* Follow the code conventions descriped in [Coding guidlines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidlines)
28+
* Follow the code conventions descriped in [Coding guidelines](https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines)
2929
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
3030

3131
## Running the Tests

Jakefile

+21-63
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,6 @@ var serverSources = [
105105
return path.join(serverDirectory, f);
106106
});
107107

108-
var definitionsRoots = [
109-
"compiler/types.d.ts",
110-
"compiler/scanner.d.ts",
111-
"compiler/parser.d.ts",
112-
"compiler/checker.d.ts",
113-
"compiler/program.d.ts",
114-
"services/services.d.ts",
115-
];
116-
117-
var internalDefinitionsRoots = [
118-
"compiler/core.d.ts",
119-
"compiler/sys.d.ts",
120-
"compiler/utilities.d.ts",
121-
"compiler/commandLineParser.d.ts",
122-
"services/utilities.d.ts",
123-
];
124-
125108
var harnessSources = [
126109
"harness.ts",
127110
"sourceMapRecorder.ts",
@@ -143,7 +126,8 @@ var harnessSources = [
143126
"services/colorization.ts",
144127
"services/documentRegistry.ts",
145128
"services/preProcessFile.ts",
146-
"services/patternMatcher.ts"
129+
"services/patternMatcher.ts",
130+
"versionCache.ts"
147131
].map(function (f) {
148132
return path.join(unittestsDirectory, f);
149133
})).concat([
@@ -222,15 +206,17 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu
222206
var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory;
223207
var options = "--module commonjs -noImplicitAny";
224208

225-
if (!keepComments) {
226-
options += " -removeComments";
209+
// Keep comments when specifically requested
210+
// or when in debug mode.
211+
if (!(keepComments || useDebugMode)) {
212+
options += " --removeComments";
227213
}
228214

229215
if (generateDeclarations) {
230216
options += " --declaration";
231217
}
232218

233-
if (useDebugMode || preserveConstEnums) {
219+
if (preserveConstEnums || useDebugMode) {
234220
options += " --preserveConstEnums";
235221
}
236222

@@ -350,60 +336,32 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
350336
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
351337

352338
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
339+
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
353340
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
341+
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
342+
354343
compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
355344
/*prefixes*/ [copyright],
356345
/*useBuiltCompiler*/ true,
357346
/*noOutFile*/ false,
358-
/*generateDeclarations*/ false,
347+
/*generateDeclarations*/ true,
359348
/*outDir*/ undefined,
360349
/*preserveConstEnums*/ true,
361-
/*keepComments*/ false,
350+
/*keepComments*/ true,
362351
/*noResolve*/ false,
363-
/*stripInternal*/ false,
352+
/*stripInternal*/ true,
364353
/*callback*/ function () {
365354
jake.cpR(servicesFile, nodePackageFile, {silent: true});
366-
});
367355

368-
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
369-
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
370-
var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts");
371-
var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts");
372-
var tempDirPath = path.join(builtLocalDirectory, "temptempdir");
373-
compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
374-
/*prefixes*/ undefined,
375-
/*useBuiltCompiler*/ true,
376-
/*noOutFile*/ true,
377-
/*generateDeclarations*/ true,
378-
/*outDir*/ tempDirPath,
379-
/*preserveConstEnums*/ true,
380-
/*keepComments*/ true,
381-
/*noResolve*/ true,
382-
/*stripInternal*/ true,
383-
/*callback*/ function () {
384-
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
385-
// Create the standalone definition file
386-
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
387-
return path.join(tempDirPath, f);
388-
}));
389-
prependFile(copyright, standaloneDefinitionsFile);
390-
391-
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
392-
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
393-
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
394-
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
395-
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
396-
}
356+
prependFile(copyright, standaloneDefinitionsFile);
397357

398-
// Create the public definition files
399-
makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile);
400-
401-
// Create the internal definition files
402-
makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile);
358+
// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
359+
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
360+
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
361+
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
362+
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
363+
});
403364

404-
// Delete the temp dir
405-
jake.rmRf(tempDirPath, {silent: true});
406-
});
407365

408366
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
409367
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
@@ -465,7 +423,7 @@ task("generate-spec", [specMd])
465423
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
466424
desc("Makes a new LKG out of the built js files");
467425
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
468-
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
426+
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
469427
var missingFiles = expectedFiles.filter(function (f) {
470428
return !fs.existsSync(f);
471429
});

bin/lib.core.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ interface RegExp {
838838
*/
839839
test(string: string): boolean;
840840

841-
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
841+
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
842842
source: string;
843843

844844
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
@@ -1183,4 +1183,4 @@ interface TypedPropertyDescriptor<T> {
11831183
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
11841184
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
11851185
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
1186-
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
1186+
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;

bin/lib.core.es6.d.ts

+39-32
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ interface RegExp {
838838
*/
839839
test(string: string): boolean;
840840

841-
/** Returns a copy of the text of the regular expression pattern. Read-only. The rgExp argument is a Regular expression object. It can be a variable name or a literal. */
841+
/** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
842842
source: string;
843843

844844
/** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
@@ -1183,7 +1183,7 @@ interface TypedPropertyDescriptor<T> {
11831183
declare type ClassDecorator = <TFunction extends Function>(target: TFunction) => TFunction | void;
11841184
declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void;
11851185
declare type MethodDecorator = <T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
1186-
declare type ParameterDecorator = (target: Function, propertyKey: string | symbol, parameterIndex: number) => void;
1186+
declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
11871187
declare type PropertyKey = string | number | symbol;
11881188

11891189
interface Symbol {
@@ -1236,26 +1236,21 @@ interface SymbolConstructor {
12361236
*/
12371237
isConcatSpreadable: symbol;
12381238

1239-
/**
1240-
* A Boolean value that if true indicates that an object may be used as a regular expression.
1241-
*/
1242-
isRegExp: symbol;
1243-
12441239
/**
12451240
* A method that returns the default iterator for an object.Called by the semantics of the
1246-
* for-of statement.
1241+
* for-of statement.
12471242
*/
12481243
iterator: symbol;
12491244

12501245
/**
12511246
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
1252-
* abstract operation.
1247+
* abstract operation.
12531248
*/
12541249
toPrimitive: symbol;
12551250

12561251
/**
1257-
* A String value that is used in the creation of the default string description of an object.
1258-
* Called by the built- in method Object.prototype.toString.
1252+
* A String value that is used in the creation of the default string description of an object.
1253+
* Called by the built-in method Object.prototype.toString.
12591254
*/
12601255
toStringTag: symbol;
12611256

@@ -1297,7 +1292,7 @@ interface ObjectConstructor {
12971292
getOwnPropertySymbols(o: any): symbol[];
12981293

12991294
/**
1300-
* Returns true if the values are the same value, false otherwise.
1295+
* Returns true if the values are the same value, false otherwise.
13011296
* @param value1 The first value.
13021297
* @param value2 The second value.
13031298
*/
@@ -1784,8 +1779,6 @@ interface Math {
17841779
}
17851780

17861781
interface RegExp {
1787-
[Symbol.isRegExp]: boolean;
1788-
17891782
/**
17901783
* Matches a string with a regular expression, and returns an array containing the results of
17911784
* that search.
@@ -1817,6 +1810,20 @@ interface RegExp {
18171810
*/
18181811
split(string: string, limit?: number): string[];
18191812

1813+
/**
1814+
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
1815+
* The characters in this string are sequenced and concatenated in the following order:
1816+
*
1817+
* - "g" for global
1818+
* - "i" for ignoreCase
1819+
* - "m" for multiline
1820+
* - "u" for unicode
1821+
* - "y" for sticky
1822+
*
1823+
* If no flags are set, the value is the empty string.
1824+
*/
1825+
flags: string;
1826+
18201827
/**
18211828
* Returns a Boolean value indicating the state of the sticky flag (y) used with a regular
18221829
* expression. Default is false. Read-only.
@@ -4699,27 +4706,27 @@ interface ProxyHandler<T> {
46994706

47004707
interface ProxyConstructor {
47014708
revocable<T>(target: T, handler: ProxyHandler<T>): { proxy: T; revoke: () => void; };
4702-
new <T>(target: T, handeler: ProxyHandler<T>): T
4709+
new <T>(target: T, handler: ProxyHandler<T>): T
47034710
}
47044711
declare var Proxy: ProxyConstructor;
47054712

4706-
declare var Reflect: {
4707-
apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
4708-
construct(target: Function, argumentsList: ArrayLike<any>): any;
4709-
defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
4710-
deleteProperty(target: any, propertyKey: PropertyKey): boolean;
4711-
enumerate(target: any): IterableIterator<any>;
4712-
get(target: any, propertyKey: PropertyKey, receiver?: any): any;
4713-
getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
4714-
getPrototypeOf(target: any): any;
4715-
has(target: any, propertyKey: string): boolean;
4716-
has(target: any, propertyKey: symbol): boolean;
4717-
isExtensible(target: any): boolean;
4718-
ownKeys(target: any): Array<PropertyKey>;
4719-
preventExtensions(target: any): boolean;
4720-
set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
4721-
setPrototypeOf(target: any, proto: any): boolean;
4722-
};
4713+
declare module Reflect {
4714+
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
4715+
function construct(target: Function, argumentsList: ArrayLike<any>): any;
4716+
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
4717+
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
4718+
function enumerate(target: any): IterableIterator<any>;
4719+
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
4720+
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
4721+
function getPrototypeOf(target: any): any;
4722+
function has(target: any, propertyKey: string): boolean;
4723+
function has(target: any, propertyKey: symbol): boolean;
4724+
function isExtensible(target: any): boolean;
4725+
function ownKeys(target: any): Array<PropertyKey>;
4726+
function preventExtensions(target: any): boolean;
4727+
function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean;
4728+
function setPrototypeOf(target: any, proto: any): boolean;
4729+
}
47234730

47244731
/**
47254732
* Represents the completion of an asynchronous operation

0 commit comments

Comments
 (0)