Allow r.js to digest typescriptServices.js

This commit is contained in:
Alex Dima 2016-10-06 17:03:10 +02:00
parent 376e97713a
commit 9a20b7c584
2 changed files with 41 additions and 41 deletions

View file

@ -72,7 +72,7 @@ gulp.task('release', ['clean-release','compile'], function() {
var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions)); var compilation = tsb.create(assign({ verbose: true }, require('./tsconfig.json').compilerOptions));
var tsSources = require('./tsconfig.json').include; var tsSources = require('./tsconfig.json').include.concat(require('./tsconfig.json').files);
function compileTask() { function compileTask() {
return merge( return merge(

View file

@ -1,18 +1,18 @@
/*! ***************************************************************************** /*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved. Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0 License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT. MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License. and limitations under the License.
***************************************************************************** */ ***************************************************************************** */
var __extends = (this && this.__extends) || function (d, b) { var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; } function __() { this.constructor = d; }
@ -12838,8 +12838,8 @@ var ts;
} }
function parseClassExpression() { function parseClassExpression() {
return parseClassDeclarationOrExpression( return parseClassDeclarationOrExpression(
/*fullStart*/ scanner.getStartPos(), /*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined, /*decorators*/ undefined,
/*modifiers*/ undefined, 192 /* ClassExpression */); /*modifiers*/ undefined, 192 /* ClassExpression */);
} }
function parseClassDeclaration(fullStart, decorators, modifiers) { function parseClassDeclaration(fullStart, decorators, modifiers) {
@ -16463,7 +16463,7 @@ var ts;
return false; return false;
} }
if (currentFlow === unreachableFlow) { if (currentFlow === unreachableFlow) {
var reportError = var reportError =
// report error on all statements except empty ones // report error on all statements except empty ones
(ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) || (ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) ||
// report error on class declarations // report error on class declarations
@ -29091,7 +29091,7 @@ var ts;
} }
else { else {
var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type); var leadingError = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type);
checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type, checkTypeAssignableTo(typePredicate.type, getTypeOfNode(parent.parameters[typePredicate.parameterIndex]), node.type,
/*headMessage*/ undefined, leadingError); /*headMessage*/ undefined, leadingError);
} }
} }
@ -30236,7 +30236,7 @@ var ts;
// Since the javascript won't do semantic analysis like typescript, // Since the javascript won't do semantic analysis like typescript,
// if the javascript file comes before the typescript file and both contain same name functions, // if the javascript file comes before the typescript file and both contain same name functions,
// checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function. // checkFunctionOrConstructorSymbol wouldn't be called if we didnt ignore javascript function.
var firstDeclaration = ts.forEach(localSymbol.declarations, var firstDeclaration = ts.forEach(localSymbol.declarations,
// Get first non javascript function declaration // Get first non javascript function declaration
function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ?
declaration : undefined; }); declaration : undefined; });
@ -30853,7 +30853,7 @@ var ts;
} }
else { else {
var leftType = checkExpression(varExpr); var leftType = checkExpression(varExpr);
checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement, checkReferenceExpression(varExpr, /*invalidReferenceMessage*/ ts.Diagnostics.Invalid_left_hand_side_in_for_of_statement,
/*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property); /*constantVariableMessage*/ ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_be_a_constant_or_a_read_only_property);
// iteratedType will be undefined if the rightType was missing properties/signatures // iteratedType will be undefined if the rightType was missing properties/signatures
// required to get its iteratedType (like [Symbol.iterator] or next). This may be // required to get its iteratedType (like [Symbol.iterator] or next). This may be
@ -32305,7 +32305,7 @@ var ts;
if (!node.parent.parent.moduleSpecifier) { if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name; var exportedName = node.propertyName || node.name;
// find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */, var symbol = resolveName(exportedName, exportedName.text, 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */,
/*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text);
@ -32800,7 +32800,7 @@ var ts;
} }
} }
if (entityName.parent.kind === 235 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) { if (entityName.parent.kind === 235 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
return resolveEntityName(entityName, return resolveEntityName(entityName,
/*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */); /*all meanings*/ 107455 /* Value */ | 793064 /* Type */ | 1920 /* Namespace */ | 8388608 /* Alias */);
} }
if (entityName.kind !== 172 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) { if (entityName.kind !== 172 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) {
@ -33389,7 +33389,7 @@ var ts;
} }
function getReferencedValueSymbol(reference) { function getReferencedValueSymbol(reference) {
return getNodeLinks(reference).resolvedSymbol || return getNodeLinks(reference).resolvedSymbol ||
resolveName(reference, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */, resolveName(reference, reference.text, 107455 /* Value */ | 1048576 /* ExportValue */ | 8388608 /* Alias */,
/*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined); /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined);
} }
function getReferencedValueDeclaration(reference) { function getReferencedValueDeclaration(reference) {
@ -34750,7 +34750,7 @@ var ts;
sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir); sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath sourceMapData.jsSourceMappingURL = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath
ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap ts.combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap
host.getCurrentDirectory(), host.getCanonicalFileName, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true); /*isAbsolutePathAnUrl*/ true);
} }
else { else {
@ -34907,7 +34907,7 @@ var ts;
// If sourceroot option: Use the relative path corresponding to the common directory path // If sourceroot option: Use the relative path corresponding to the common directory path
// otherwise source locations relative to map file location // otherwise source locations relative to map file location
var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName, var source = ts.getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, currentSourceFile.fileName, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true); /*isAbsolutePathAnUrl*/ true);
sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source); sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source);
if (sourceMapSourceIndex === -1) { if (sourceMapSourceIndex === -1) {
@ -35345,7 +35345,7 @@ var ts;
} }
} }
function emitEntityName(entityName) { function emitEntityName(entityName) {
var visibilityResult = resolver.isEntityNameVisible(entityName, var visibilityResult = resolver.isEntityNameVisible(entityName,
// Aliases can be written asynchronously so use correct enclosing declaration // Aliases can be written asynchronously so use correct enclosing declaration
entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration); entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration);
handleSymbolAccessibilityError(visibilityResult); handleSymbolAccessibilityError(visibilityResult);
@ -36524,7 +36524,7 @@ var ts;
ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile); ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile);
} }
if (declFileName) { if (declFileName) {
declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName, declFileName = ts.getRelativePathToDirectoryOrUrl(ts.getDirectoryPath(ts.normalizeSlashes(declarationFilePath)), declFileName, host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ false); /*isAbsolutePathAnUrl*/ false);
referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine; referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine;
} }
@ -38160,7 +38160,7 @@ var ts;
write("]"); write("]");
} }
else { else {
emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine, emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine,
/*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true); /*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true);
} }
} }
@ -43426,7 +43426,7 @@ var ts;
} }
} }
function isUseStrictPrologue(node) { function isUseStrictPrologue(node) {
return node.expression.text === "use strict"; return (node.expression.text === "use strict");
} }
function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) { function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) {
if (writeUseStrict) { if (writeUseStrict) {
@ -45819,7 +45819,7 @@ var ts;
modulesWithElidedImports[file.path] = true; modulesWithElidedImports[file.path] = true;
} }
else if (shouldAddFile) { else if (shouldAddFile) {
findSourceFile(resolution.resolvedFileName, resolvedPath, findSourceFile(resolution.resolvedFileName, resolvedPath,
/*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end); /*isDefaultLib*/ false, /*isReference*/ false, file, ts.skipTrivia(file.text, file.imports[i].pos), file.imports[i].end);
} }
if (isFromNodeModulesSearch) { if (isFromNodeModulesSearch) {
@ -48226,7 +48226,7 @@ var ts;
for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) { for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {
var span = wordSpans_1[_i]; var span = wordSpans_1[_i];
if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) {
return createPatternMatch(PatternMatchKind.substring, punctuationStripped, return createPatternMatch(PatternMatchKind.substring, punctuationStripped,
/*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false));
} }
} }
@ -49541,7 +49541,7 @@ var ts;
var children = n.getChildren(); var children = n.getChildren();
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
var child = children_1[_i]; var child = children_1[_i];
var shouldDiveInChildNode = var shouldDiveInChildNode =
// previous token is enclosed somewhere in the child // previous token is enclosed somewhere in the child
(child.pos <= previousToken.pos && child.end > previousToken.end) || (child.pos <= previousToken.pos && child.end > previousToken.end) ||
// previous token ends exactly at the beginning of child // previous token ends exactly at the beginning of child
@ -51624,7 +51624,7 @@ var ts;
///<reference path='ruleOperationContext.ts' /> ///<reference path='ruleOperationContext.ts' />
///<reference path='rules.ts' /> ///<reference path='rules.ts' />
///<reference path='rulesMap.ts' /> ///<reference path='rulesMap.ts' />
///<reference path='tokenRange.ts' /> ///<reference path='tokenRange.ts' />
/// <reference path="references.ts"/> /// <reference path="references.ts"/>
/* @internal */ /* @internal */
var ts; var ts;
@ -53772,8 +53772,8 @@ var ts;
}; };
SignatureObject.prototype.getDocumentationComment = function () { SignatureObject.prototype.getDocumentationComment = function () {
if (this.documentationComment === undefined) { if (this.documentationComment === undefined) {
this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration], this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration],
/*name*/ undefined, /*name*/ undefined,
/*canUseParsedParamTagComments*/ false) : []; /*canUseParsedParamTagComments*/ false) : [];
} }
return this.documentationComment; return this.documentationComment;
@ -57010,7 +57010,7 @@ var ts;
for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) { for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) {
var declaration = _a[_i]; var declaration = _a[_i];
if (ts.isClassLike(declaration)) { if (ts.isClassLike(declaration)) {
return tryAddSignature(declaration.members, return tryAddSignature(declaration.members,
/*selectConstructors*/ true, symbolKind, symbolName, containerName, result); /*selectConstructors*/ true, symbolKind, symbolName, containerName, result);
} }
} }
@ -61212,14 +61212,14 @@ var ts;
}; };
LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) { LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {
var _this = this; var _this = this;
return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")", return this.forwardJSONCall("getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")",
// directly serialize the spans out to a string. This is much faster to decode // directly serialize the spans out to a string. This is much faster to decode
// on the managed side versus a full JSON array. // on the managed side versus a full JSON array.
function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); }); function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });
}; };
LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) { LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {
var _this = this; var _this = this;
return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")", return this.forwardJSONCall("getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")",
// directly serialize the spans out to a string. This is much faster to decode // directly serialize the spans out to a string. This is much faster to decode
// on the managed side versus a full JSON array. // on the managed side versus a full JSON array.
function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); }); function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });
@ -61406,7 +61406,7 @@ var ts;
}; };
LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) { LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {
var _this = this; var _this = this;
return forwardCall(this.logger, "getEmitOutput('" + fileName + "')", return forwardCall(this.logger, "getEmitOutput('" + fileName + "')",
/*returnJson*/ false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance); /*returnJson*/ false, function () { return _this.languageService.getEmitOutput(fileName); }, this.logPerformance);
}; };
return LanguageServiceShimObject; return LanguageServiceShimObject;