Allow r.js to digest typescriptServices.js

pull/2748/head
Alex Dima 9 years ago
parent 376e97713a
commit 9a20b7c584

@ -72,7 +72,7 @@ gulp.task('release', ['clean-release','compile'], function() {
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() {
return merge(

@ -1,18 +1,18 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
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
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
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
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
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
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
@ -12838,8 +12838,8 @@ var ts;
}
function parseClassExpression() {
return parseClassDeclarationOrExpression(
/*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined,
/*fullStart*/ scanner.getStartPos(),
/*decorators*/ undefined,
/*modifiers*/ undefined, 192 /* ClassExpression */);
}
function parseClassDeclaration(fullStart, decorators, modifiers) {
@ -16463,7 +16463,7 @@ var ts;
return false;
}
if (currentFlow === unreachableFlow) {
var reportError =
var reportError =
// report error on all statements except empty ones
(ts.isStatement(node) && node.kind !== 201 /* EmptyStatement */) ||
// report error on class declarations
@ -29091,7 +29091,7 @@ var ts;
}
else {
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);
}
}
@ -30236,7 +30236,7 @@ var ts;
// 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,
// 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
function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ?
declaration : undefined; });
@ -30853,7 +30853,7 @@ var ts;
}
else {
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);
// iteratedType will be undefined if the rightType was missing properties/signatures
// required to get its iteratedType (like [Symbol.iterator] or next). This may be
@ -32305,7 +32305,7 @@ var ts;
if (!node.parent.parent.moduleSpecifier) {
var exportedName = node.propertyName || node.name;
// 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);
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);
@ -32800,7 +32800,7 @@ var ts;
}
}
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 */);
}
if (entityName.kind !== 172 /* PropertyAccessExpression */ && isInRightSideOfImportOrExportAssignment(entityName)) {
@ -33389,7 +33389,7 @@ var ts;
}
function getReferencedValueSymbol(reference) {
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);
}
function getReferencedValueDeclaration(reference) {
@ -34750,7 +34750,7 @@ var ts;
sourceMapDir = ts.combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
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
host.getCurrentDirectory(), host.getCanonicalFileName,
host.getCurrentDirectory(), host.getCanonicalFileName,
/*isAbsolutePathAnUrl*/ true);
}
else {
@ -34907,7 +34907,7 @@ var ts;
// If sourceroot option: Use the relative path corresponding to the common directory path
// otherwise source locations relative to map file location
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);
sourceMapSourceIndex = ts.indexOf(sourceMapData.sourceMapSources, source);
if (sourceMapSourceIndex === -1) {
@ -35345,7 +35345,7 @@ var ts;
}
}
function emitEntityName(entityName) {
var visibilityResult = resolver.isEntityNameVisible(entityName,
var visibilityResult = resolver.isEntityNameVisible(entityName,
// Aliases can be written asynchronously so use correct enclosing declaration
entityName.parent.kind === 229 /* ImportEqualsDeclaration */ ? entityName.parent : enclosingDeclaration);
handleSymbolAccessibilityError(visibilityResult);
@ -36524,7 +36524,7 @@ var ts;
ts.forEachExpectedEmitFile(host, getDeclFileName, referencedFile);
}
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);
referencesOutput += "/// <reference path=\"" + declFileName + "\" />" + newLine;
}
@ -38160,7 +38160,7 @@ var ts;
write("]");
}
else {
emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine,
emitListWithSpread(elements, /*needsUniqueCopy*/ true, /*multiLine*/ node.multiLine,
/*trailingComma*/ elements.hasTrailingComma, /*useConcat*/ true);
}
}
@ -43426,7 +43426,7 @@ var ts;
}
}
function isUseStrictPrologue(node) {
return node.expression.text === "use strict";
return (node.expression.text === "use strict");
}
function ensureUseStrictPrologue(startWithNewLine, writeUseStrict) {
if (writeUseStrict) {
@ -45819,7 +45819,7 @@ var ts;
modulesWithElidedImports[file.path] = true;
}
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);
}
if (isFromNodeModulesSearch) {
@ -48226,7 +48226,7 @@ var ts;
for (var _i = 0, wordSpans_1 = wordSpans; _i < wordSpans_1.length; _i++) {
var span = wordSpans_1[_i];
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));
}
}
@ -49541,7 +49541,7 @@ var ts;
var children = n.getChildren();
for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
var child = children_1[_i];
var shouldDiveInChildNode =
var shouldDiveInChildNode =
// previous token is enclosed somewhere in the child
(child.pos <= previousToken.pos && child.end > previousToken.end) ||
// previous token ends exactly at the beginning of child
@ -51624,7 +51624,7 @@ var ts;
///<reference path='ruleOperationContext.ts' />
///<reference path='rules.ts' />
///<reference path='rulesMap.ts' />
///<reference path='tokenRange.ts' />
///<reference path='tokenRange.ts' />
/// <reference path="references.ts"/>
/* @internal */
var ts;
@ -53772,8 +53772,8 @@ var ts;
};
SignatureObject.prototype.getDocumentationComment = function () {
if (this.documentationComment === undefined) {
this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration],
/*name*/ undefined,
this.documentationComment = this.declaration ? getJsDocCommentsFromDeclarations([this.declaration],
/*name*/ undefined,
/*canUseParsedParamTagComments*/ false) : [];
}
return this.documentationComment;
@ -57010,7 +57010,7 @@ var ts;
for (var _i = 0, _a = symbol.getDeclarations(); _i < _a.length; _i++) {
var declaration = _a[_i];
if (ts.isClassLike(declaration)) {
return tryAddSignature(declaration.members,
return tryAddSignature(declaration.members,
/*selectConstructors*/ true, symbolKind, symbolName, containerName, result);
}
}
@ -61212,14 +61212,14 @@ var ts;
};
LanguageServiceShimObject.prototype.getEncodedSyntacticClassifications = function (fileName, start, length) {
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
// on the managed side versus a full JSON array.
function () { return convertClassifications(_this.languageService.getEncodedSyntacticClassifications(fileName, ts.createTextSpan(start, length))); });
};
LanguageServiceShimObject.prototype.getEncodedSemanticClassifications = function (fileName, start, length) {
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
// on the managed side versus a full JSON array.
function () { return convertClassifications(_this.languageService.getEncodedSemanticClassifications(fileName, ts.createTextSpan(start, length))); });
@ -61406,7 +61406,7 @@ var ts;
};
LanguageServiceShimObject.prototype.getEmitOutputObject = function (fileName) {
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);
};
return LanguageServiceShimObject;

Loading…
Cancel
Save