Merge branch 'master' into sourceMapAndBreakpointDecorators
This commit is contained in:
commit
a87169829c
22
Jakefile.js
22
Jakefile.js
|
@ -40,6 +40,7 @@ var compilerSources = [
|
|||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"sourcemap.ts",
|
||||
"declarationEmitter.ts",
|
||||
"emitter.ts",
|
||||
"program.ts",
|
||||
|
@ -59,6 +60,7 @@ var servicesSources = [
|
|||
"utilities.ts",
|
||||
"binder.ts",
|
||||
"checker.ts",
|
||||
"sourcemap.ts",
|
||||
"declarationEmitter.ts",
|
||||
"emitter.ts",
|
||||
"program.ts",
|
||||
|
@ -106,6 +108,16 @@ var serverCoreSources = [
|
|||
return path.join(serverDirectory, f);
|
||||
});
|
||||
|
||||
var scriptSources = [
|
||||
"tslint/booleanTriviaRule.ts",
|
||||
"tslint/nextLineRule.ts",
|
||||
"tslint/noNullRule.ts",
|
||||
"tslint/preferConstRule.ts",
|
||||
"tslint/typeOperatorSpacingRule.ts"
|
||||
].map(function (f) {
|
||||
return path.join(scriptsDirectory, f);
|
||||
});
|
||||
|
||||
var serverSources = serverCoreSources.concat(servicesSources);
|
||||
|
||||
var languageServiceLibrarySources = [
|
||||
|
@ -365,7 +377,6 @@ file(builtGeneratedDiagnosticMessagesJSON,[generatedDiagnosticMessagesJSON], fun
|
|||
desc("Generates a diagnostic file in TypeScript based on an input JSON file");
|
||||
task("generate-diagnostics", [diagnosticInfoMapTs]);
|
||||
|
||||
|
||||
// Publish nightly
|
||||
var configureNightlyJs = path.join(scriptsDirectory, "configureNightly.js");
|
||||
var configureNightlyTs = path.join(scriptsDirectory, "configureNightly.ts");
|
||||
|
@ -466,7 +477,7 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca
|
|||
var nodeDefinitionsFileContents = definitionFileContents + "\r\nexport = ts;";
|
||||
fs.writeFileSync(nodeDefinitionsFile, nodeDefinitionsFileContents);
|
||||
|
||||
// Node package definition file to be distributed without the package. Created by replacing
|
||||
// Node package definition file to be distributed without the package. Created by replacing
|
||||
// 'ts' namespace with '"typescript"' as a module.
|
||||
var nodeStandaloneDefinitionsFileContents = definitionFileContents.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
|
||||
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
|
||||
|
@ -875,7 +886,7 @@ var tslintRulesOutFiles = tslintRules.map(function(p) {
|
|||
desc("Compiles tslint rules to js");
|
||||
task("build-rules", tslintRulesOutFiles);
|
||||
tslintRulesFiles.forEach(function(ruleFile, i) {
|
||||
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
|
||||
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false, /*noOutFile*/ true, /*generateDeclarations*/ false, path.join(builtLocalDirectory, "tslint"));
|
||||
});
|
||||
|
||||
function getLinterOptions() {
|
||||
|
@ -909,7 +920,8 @@ function lintFileAsync(options, path, cb) {
|
|||
|
||||
var lintTargets = compilerSources
|
||||
.concat(harnessCoreSources)
|
||||
.concat(serverCoreSources);
|
||||
.concat(serverCoreSources)
|
||||
.concat(scriptSources);
|
||||
|
||||
desc("Runs tslint on the compiler sources");
|
||||
task("lint", ["build-rules"], function() {
|
||||
|
@ -937,7 +949,7 @@ function lintWatchFile(filename) {
|
|||
if (event !== "change") {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!lintSemaphores[filename]) {
|
||||
lintSemaphores[filename] = true;
|
||||
lintFileAsync(getLinterOptions(), filename, function(err, result) {
|
||||
|
|
|
@ -13,10 +13,10 @@ export class Rule extends Lint.Rules.AbstractRule {
|
|||
class TypeOperatorSpacingWalker extends Lint.RuleWalker {
|
||||
public visitNode(node: ts.Node) {
|
||||
if (node.kind === ts.SyntaxKind.UnionType || node.kind === ts.SyntaxKind.IntersectionType) {
|
||||
let types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
const types = (<ts.UnionOrIntersectionTypeNode>node).types;
|
||||
let expectedStart = types[0].end + 2; // space, | or &
|
||||
for (let i = 1; i < types.length; i++) {
|
||||
let currentType = types[i];
|
||||
const currentType = types[i];
|
||||
if (expectedStart !== currentType.pos || currentType.getLeadingTriviaWidth() !== 1) {
|
||||
const failure = this.createFailure(currentType.pos, currentType.getWidth(), Rule.FAILURE_STRING);
|
||||
this.addFailure(failure);
|
||||
|
|
|
@ -46,6 +46,7 @@ namespace ts {
|
|||
const compilerOptions = host.getCompilerOptions();
|
||||
const languageVersion = compilerOptions.target || ScriptTarget.ES3;
|
||||
const modulekind = compilerOptions.module ? compilerOptions.module : languageVersion === ScriptTarget.ES6 ? ModuleKind.ES6 : ModuleKind.None;
|
||||
const allowSyntheticDefaultImports = typeof compilerOptions.allowSyntheticDefaultImports !== "undefined" ? compilerOptions.allowSyntheticDefaultImports : modulekind === ModuleKind.System;
|
||||
|
||||
const emitResolver = createResolver();
|
||||
|
||||
|
@ -532,7 +533,7 @@ namespace ts {
|
|||
}
|
||||
|
||||
// Because of module/namespace merging, a module's exports are in scope,
|
||||
// yet we never want to treat an export specifier as putting a member in scope.
|
||||
// yet we never want to treat an export specifier as putting a member in scope.
|
||||
// Therefore, if the name we find is purely an export specifier, it is not actually considered in scope.
|
||||
// Two things to note about this:
|
||||
// 1. We have to check this without calling getSymbol. The problem with calling getSymbol
|
||||
|
@ -768,9 +769,12 @@ namespace ts {
|
|||
const moduleSymbol = resolveExternalModuleName(node, (<ImportDeclaration>node.parent).moduleSpecifier);
|
||||
if (moduleSymbol) {
|
||||
const exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
|
||||
if (!exportDefaultSymbol) {
|
||||
if (!exportDefaultSymbol && !allowSyntheticDefaultImports) {
|
||||
error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
|
||||
}
|
||||
else if (!exportDefaultSymbol && allowSyntheticDefaultImports) {
|
||||
return resolveSymbol(moduleSymbol.exports["export="]) || resolveSymbol(moduleSymbol);
|
||||
}
|
||||
return exportDefaultSymbol;
|
||||
}
|
||||
}
|
||||
|
@ -3197,7 +3201,7 @@ namespace ts {
|
|||
case SyntaxKind.BooleanKeyword:
|
||||
case SyntaxKind.SymbolKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return true;
|
||||
case SyntaxKind.ArrayType:
|
||||
return isIndependentType((<ArrayTypeNode>node).elementType);
|
||||
|
@ -3858,7 +3862,7 @@ namespace ts {
|
|||
paramSymbol = resolvedSymbol;
|
||||
}
|
||||
parameters.push(paramSymbol);
|
||||
if (param.type && param.type.kind === SyntaxKind.StringLiteral) {
|
||||
if (param.type && param.type.kind === SyntaxKind.StringLiteralType) {
|
||||
hasStringLiterals = true;
|
||||
}
|
||||
|
||||
|
@ -4527,8 +4531,7 @@ namespace ts {
|
|||
return links.resolvedType;
|
||||
}
|
||||
|
||||
function getStringLiteralType(node: StringLiteral): StringLiteralType {
|
||||
const text = node.text;
|
||||
function getStringLiteralTypeForText(text: string): StringLiteralType {
|
||||
if (hasProperty(stringLiteralTypes, text)) {
|
||||
return stringLiteralTypes[text];
|
||||
}
|
||||
|
@ -4538,10 +4541,10 @@ namespace ts {
|
|||
return type;
|
||||
}
|
||||
|
||||
function getTypeFromStringLiteral(node: StringLiteral): Type {
|
||||
function getTypeFromStringLiteralTypeNode(node: StringLiteralTypeNode): Type {
|
||||
const links = getNodeLinks(node);
|
||||
if (!links.resolvedType) {
|
||||
links.resolvedType = getStringLiteralType(node);
|
||||
links.resolvedType = getStringLiteralTypeForText(node.text);
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
|
@ -4583,8 +4586,8 @@ namespace ts {
|
|||
return voidType;
|
||||
case SyntaxKind.ThisType:
|
||||
return getTypeFromThisTypeNode(node);
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getTypeFromStringLiteral(<StringLiteral>node);
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return getTypeFromStringLiteralTypeNode(<StringLiteralTypeNode>node);
|
||||
case SyntaxKind.TypeReference:
|
||||
return getTypeFromTypeReference(<TypeReferenceNode>node);
|
||||
case SyntaxKind.TypePredicate:
|
||||
|
@ -8791,7 +8794,7 @@ namespace ts {
|
|||
// for the argument. In that case, we should check the argument.
|
||||
if (argType === undefined) {
|
||||
argType = arg.kind === SyntaxKind.StringLiteral && !reportErrors
|
||||
? getStringLiteralType(<StringLiteral>arg)
|
||||
? getStringLiteralTypeForText((<StringLiteral>arg).text)
|
||||
: checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
|
||||
}
|
||||
|
||||
|
@ -8986,7 +8989,7 @@ namespace ts {
|
|||
case SyntaxKind.Identifier:
|
||||
case SyntaxKind.NumericLiteral:
|
||||
case SyntaxKind.StringLiteral:
|
||||
return getStringLiteralType(<StringLiteral>element.name);
|
||||
return getStringLiteralTypeForText((<Identifier | LiteralExpression>element.name).text);
|
||||
|
||||
case SyntaxKind.ComputedPropertyName:
|
||||
const nameType = checkComputedPropertyName(<ComputedPropertyName>element.name);
|
||||
|
@ -9855,17 +9858,25 @@ namespace ts {
|
|||
return aggregatedTypes;
|
||||
}
|
||||
|
||||
// TypeScript Specification 1.0 (6.3) - July 2014
|
||||
// An explicitly typed function whose return type isn't the Void or the Any type
|
||||
// must have at least one return statement somewhere in its body.
|
||||
// An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
/*
|
||||
*TypeScript Specification 1.0 (6.3) - July 2014
|
||||
* An explicitly typed function whose return type isn't the Void or the Any type
|
||||
* must have at least one return statement somewhere in its body.
|
||||
* An exception to this rule is if the function implementation consists of a single 'throw' statement.
|
||||
* @param returnType - return type of the function, can be undefined if return type is not explicitly specified
|
||||
*/
|
||||
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func: FunctionLikeDeclaration, returnType: Type): void {
|
||||
if (!produceDiagnostics) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Functions that return 'void' or 'any' don't need any return expressions.
|
||||
if (returnType === voidType || isTypeAny(returnType)) {
|
||||
// Functions with with an explicitly specified 'void' or 'any' return type don't need any return expressions.
|
||||
if (returnType && (returnType === voidType || isTypeAny(returnType))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if return type is not specified then we'll do the check only if 'noImplicitReturns' option is set
|
||||
if (!returnType && !compilerOptions.noImplicitReturns) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9875,13 +9886,14 @@ namespace ts {
|
|||
return;
|
||||
}
|
||||
|
||||
if (func.flags & NodeFlags.HasExplicitReturn) {
|
||||
if (!returnType || func.flags & NodeFlags.HasExplicitReturn) {
|
||||
if (compilerOptions.noImplicitReturns) {
|
||||
error(func.type, Diagnostics.Not_all_code_paths_return_a_value);
|
||||
error(func.type || func, Diagnostics.Not_all_code_paths_return_a_value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This function does not conform to the specification.
|
||||
// NOTE: having returnType !== undefined is a precondition for entering this branch so func.type will always be present
|
||||
error(func.type, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value);
|
||||
}
|
||||
}
|
||||
|
@ -9956,14 +9968,10 @@ namespace ts {
|
|||
emitAwaiter = true;
|
||||
}
|
||||
|
||||
const returnType = node.type && getTypeFromTypeNode(node.type);
|
||||
let promisedType: Type;
|
||||
if (returnType && isAsync) {
|
||||
promisedType = checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
|
||||
if (returnType && !node.asteriskToken) {
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
|
||||
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
|
||||
if (!node.asteriskToken) {
|
||||
// return is not necessary in the body of generators
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
|
||||
}
|
||||
|
||||
if (node.body) {
|
||||
|
@ -9986,13 +9994,13 @@ namespace ts {
|
|||
// check assignability of the awaited type of the expression body against the promised type of
|
||||
// its return type annotation.
|
||||
const exprType = checkExpression(<Expression>node.body);
|
||||
if (returnType) {
|
||||
if (returnOrPromisedType) {
|
||||
if (isAsync) {
|
||||
const awaitedType = checkAwaitedType(exprType, node.body, Diagnostics.Expression_body_for_async_arrow_function_does_not_have_a_valid_callable_then_member);
|
||||
checkTypeAssignableTo(awaitedType, promisedType, node.body);
|
||||
checkTypeAssignableTo(awaitedType, returnOrPromisedType, node.body);
|
||||
}
|
||||
else {
|
||||
checkTypeAssignableTo(exprType, returnType, node.body);
|
||||
checkTypeAssignableTo(exprType, returnOrPromisedType, node.body);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10608,7 +10616,7 @@ namespace ts {
|
|||
function checkStringLiteralExpression(node: StringLiteral): Type {
|
||||
const contextualType = getContextualType(node);
|
||||
if (contextualType && contextualTypeIsStringLiteralType(contextualType)) {
|
||||
return getStringLiteralType(node);
|
||||
return getStringLiteralTypeForText(node.text);
|
||||
}
|
||||
|
||||
return stringType;
|
||||
|
@ -11431,7 +11439,9 @@ namespace ts {
|
|||
seen = c === node;
|
||||
}
|
||||
});
|
||||
if (subsequentNode) {
|
||||
// We may be here because of some extra junk between overloads that could not be parsed into a valid node.
|
||||
// In this case the subsequent node is not really consecutive (.pos !== node.end), and we must ignore it here.
|
||||
if (subsequentNode && subsequentNode.pos === node.end) {
|
||||
if (subsequentNode.kind === node.kind) {
|
||||
const errorNode: Node = (<FunctionLikeDeclaration>subsequentNode).name || subsequentNode;
|
||||
// TODO(jfreeman): These are methods, so handle computed name case
|
||||
|
@ -11442,7 +11452,7 @@ namespace ts {
|
|||
// we can get here in two cases
|
||||
// 1. mixed static and instance class members
|
||||
// 2. something with the same name was defined before the set of overloads that prevents them from merging
|
||||
// here we'll report error only for the first case since for second we should already report error in binder
|
||||
// here we'll report error only for the first case since for second we should already report error in binder
|
||||
if (reportError) {
|
||||
const diagnostic = node.flags & NodeFlags.Static ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static;
|
||||
error(errorNode, diagnostic);
|
||||
|
@ -12132,14 +12142,9 @@ namespace ts {
|
|||
}
|
||||
|
||||
checkSourceElement(node.body);
|
||||
if (node.type && !isAccessor(node.kind) && !node.asteriskToken) {
|
||||
const returnType = getTypeFromTypeNode(node.type);
|
||||
let promisedType: Type;
|
||||
if (isAsync) {
|
||||
promisedType = checkAsyncFunctionReturnType(node);
|
||||
}
|
||||
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, isAsync ? promisedType : returnType);
|
||||
if (!isAccessor(node.kind) && !node.asteriskToken) {
|
||||
const returnOrPromisedType = node.type && (isAsync ? checkAsyncFunctionReturnType(node) : getTypeFromTypeNode(node.type));
|
||||
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnOrPromisedType);
|
||||
}
|
||||
|
||||
if (produceDiagnostics && !node.type) {
|
||||
|
|
|
@ -280,10 +280,15 @@ namespace ts {
|
|||
type: "boolean",
|
||||
description: Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
type: "boolean",
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled,
|
||||
description: Diagnostics.Allow_javascript_files_to_be_compiled
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -488,7 +493,7 @@ namespace ts {
|
|||
fileNames: getFileNames(),
|
||||
errors
|
||||
};
|
||||
|
||||
|
||||
function getFileNames(): string[] {
|
||||
let fileNames: string[] = [];
|
||||
if (hasProperty(json, "files")) {
|
||||
|
|
|
@ -356,6 +356,33 @@ namespace ts {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reduce the properties of a map.
|
||||
*
|
||||
* @param map The map to reduce
|
||||
* @param callback An aggregation function that is called for each entry in the map
|
||||
* @param initial The initial value for the reduction.
|
||||
*/
|
||||
export function reduceProperties<T, U>(map: Map<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U {
|
||||
let result = initial;
|
||||
if (map) {
|
||||
for (const key in map) {
|
||||
if (hasProperty(map, key)) {
|
||||
result = callback(result, map[key], String(key));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests whether a value is an array.
|
||||
*/
|
||||
export function isArray(value: any): value is any[] {
|
||||
return Array.isArray ? Array.isArray(value) : value instanceof Array;
|
||||
}
|
||||
|
||||
export function memoize<T>(callback: () => T): () => T {
|
||||
let value: T;
|
||||
return () => {
|
||||
|
|
|
@ -357,7 +357,7 @@ namespace ts {
|
|||
case SyntaxKind.SymbolKeyword:
|
||||
case SyntaxKind.VoidKeyword:
|
||||
case SyntaxKind.ThisType:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return writeTextOfNode(currentText, type);
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
|
||||
|
@ -658,7 +658,7 @@ namespace ts {
|
|||
}
|
||||
else {
|
||||
write("require(");
|
||||
writeTextOfNode(currentText, getExternalModuleImportEqualsDeclarationExpression(node));
|
||||
emitExternalModuleSpecifier(node);
|
||||
write(");");
|
||||
}
|
||||
writer.writeLine();
|
||||
|
@ -715,14 +715,23 @@ namespace ts {
|
|||
}
|
||||
write(" from ");
|
||||
}
|
||||
emitExternalModuleSpecifier(node.moduleSpecifier);
|
||||
emitExternalModuleSpecifier(node);
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
}
|
||||
|
||||
function emitExternalModuleSpecifier(moduleSpecifier: Expression) {
|
||||
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit) {
|
||||
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, moduleSpecifier.parent as (ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration));
|
||||
function emitExternalModuleSpecifier(parent: ImportEqualsDeclaration | ImportDeclaration | ExportDeclaration) {
|
||||
let moduleSpecifier: Node;
|
||||
if (parent.kind === SyntaxKind.ImportEqualsDeclaration) {
|
||||
const node = parent as ImportEqualsDeclaration;
|
||||
moduleSpecifier = getExternalModuleImportEqualsDeclarationExpression(node);
|
||||
}
|
||||
else {
|
||||
const node = parent as (ImportDeclaration | ExportDeclaration);
|
||||
moduleSpecifier = node.moduleSpecifier;
|
||||
}
|
||||
if (moduleSpecifier.kind === SyntaxKind.StringLiteral && isBundledEmit && (compilerOptions.out || compilerOptions.outFile)) {
|
||||
const moduleName = getExternalModuleNameFromDeclaration(host, resolver, parent);
|
||||
if (moduleName) {
|
||||
write("\"");
|
||||
write(moduleName);
|
||||
|
@ -765,7 +774,7 @@ namespace ts {
|
|||
}
|
||||
if (node.moduleSpecifier) {
|
||||
write(" from ");
|
||||
emitExternalModuleSpecifier(node.moduleSpecifier);
|
||||
emitExternalModuleSpecifier(node);
|
||||
}
|
||||
write(";");
|
||||
writer.writeLine();
|
||||
|
|
|
@ -2117,6 +2117,10 @@
|
|||
"category": "Message",
|
||||
"code": 6010
|
||||
},
|
||||
"Allow default imports from modules with no default export. This does not affect code emit, just typechecking.": {
|
||||
"category": "Message",
|
||||
"code": 6011
|
||||
},
|
||||
"Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES2015' (experimental)": {
|
||||
"category": "Message",
|
||||
"code": 6015
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/// <reference path="checker.ts"/>
|
||||
/// <reference path="sourcemap.ts" />
|
||||
/// <reference path="declarationEmitter.ts"/>
|
||||
|
||||
/* @internal */
|
||||
|
@ -463,6 +464,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
const writer = createTextWriter(newLine);
|
||||
const { write, writeTextOfNode, writeLine, increaseIndent, decreaseIndent } = writer;
|
||||
|
||||
const sourceMap = compilerOptions.sourceMap || compilerOptions.inlineSourceMap ? createSourceMapWriter(host, writer) : getNullSourceMapWriter();
|
||||
const { setSourceFile, emitStart, emitEnd, emitPos, pushScope, popScope } = sourceMap;
|
||||
|
||||
let currentSourceFile: SourceFile;
|
||||
let currentText: string;
|
||||
let currentLineMap: number[];
|
||||
|
@ -497,38 +501,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
let exportEquals: ExportAssignment;
|
||||
let hasExportStars: boolean;
|
||||
|
||||
/** Write emitted output to disk */
|
||||
let writeEmittedFiles = writeJavaScriptFile;
|
||||
|
||||
let detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[];
|
||||
|
||||
let writeComment = writeCommentRange;
|
||||
|
||||
/** Emit a node */
|
||||
let emit = emitNodeWithCommentsAndWithoutSourcemap;
|
||||
|
||||
/** Called just before starting emit of a node */
|
||||
let emitStart = function (node: Node | TextRange) { };
|
||||
|
||||
/** Called once the emit of the node is done */
|
||||
let emitEnd = function (node: Node | TextRange) { };
|
||||
|
||||
/** Emit the text for the given token that comes after startPos
|
||||
* This by default writes the text provided with the given tokenKind
|
||||
* but if optional emitFn callback is provided the text is emitted using the callback instead of default text
|
||||
* @param tokenKind the kind of the token to search and emit
|
||||
* @param startPos the position in the source to start searching for the token
|
||||
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
|
||||
let emitToken = emitTokenText;
|
||||
|
||||
/** Called to before starting the lexical scopes as in function/class in the emitted code because of node
|
||||
* @param scopeDeclaration node that starts the lexical scope
|
||||
* @param scopeName Optional name of this scope instead of deducing one from the declaration node */
|
||||
let scopeEmitStart = function(scopeDeclaration: Node, scopeName?: string) { };
|
||||
|
||||
/** Called after coming out of the scope */
|
||||
let scopeEmitEnd = function() { };
|
||||
|
||||
/** Sourcemap data that will get encoded */
|
||||
let sourceMapData: SourceMapData;
|
||||
|
||||
|
@ -554,18 +528,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
[ModuleKind.CommonJS]() {},
|
||||
};
|
||||
|
||||
|
||||
return doEmit;
|
||||
|
||||
function doEmit(jsFilePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) {
|
||||
sourceMap.initialize(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);
|
||||
generatedNameSet = {};
|
||||
nodeToGeneratedName = [];
|
||||
isOwnFileEmit = !isBundledEmit;
|
||||
|
||||
if (compilerOptions.sourceMap || compilerOptions.inlineSourceMap) {
|
||||
initializeEmitterWithSourceMaps(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);
|
||||
}
|
||||
|
||||
// Emit helpers from all the files
|
||||
if (isBundledEmit && modulekind) {
|
||||
forEach(sourceFiles, emitEmitHelpers);
|
||||
|
@ -575,9 +545,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
forEach(sourceFiles, emitSourceFile);
|
||||
|
||||
writeLine();
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM);
|
||||
|
||||
const sourceMappingURL = sourceMap.getSourceMappingURL();
|
||||
if (sourceMappingURL) {
|
||||
write(`//# sourceMappingURL=${sourceMappingURL}`);
|
||||
}
|
||||
|
||||
writeEmittedFiles(writer.getText(), jsFilePath, sourceMapFilePath, /*writeByteOrderMark*/ compilerOptions.emitBOM);
|
||||
|
||||
// reset the state
|
||||
sourceMap.reset();
|
||||
writer.reset();
|
||||
currentSourceFile = undefined;
|
||||
currentText = undefined;
|
||||
|
@ -616,7 +593,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
currentFileIdentifiers = sourceFile.identifiers;
|
||||
isCurrentFileExternalModule = isExternalModule(sourceFile);
|
||||
|
||||
emit(sourceFile);
|
||||
setSourceFile(sourceFile);
|
||||
emitNodeWithCommentsAndWithoutSourcemap(sourceFile);
|
||||
}
|
||||
|
||||
function isUniqueName(name: string): boolean {
|
||||
|
@ -713,399 +691,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
return nodeToGeneratedName[id] || (nodeToGeneratedName[id] = unescapeIdentifier(generateNameForNode(node)));
|
||||
}
|
||||
|
||||
function initializeEmitterWithSourceMaps(jsFilePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) {
|
||||
let sourceMapDir: string; // The directory in which sourcemap will be
|
||||
|
||||
// Current source map file and its index in the sources list
|
||||
let sourceMapSourceIndex = -1;
|
||||
|
||||
// Names and its index map
|
||||
const sourceMapNameIndexMap: Map<number> = {};
|
||||
const sourceMapNameIndices: number[] = [];
|
||||
function getSourceMapNameIndex() {
|
||||
return sourceMapNameIndices.length ? lastOrUndefined(sourceMapNameIndices) : -1;
|
||||
/** Write emitted output to disk */
|
||||
function writeEmittedFiles(emitOutput: string, jsFilePath: string, sourceMapFilePath: string, writeByteOrderMark: boolean) {
|
||||
if (compilerOptions.sourceMap && !compilerOptions.inlineSourceMap) {
|
||||
writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap.getText(), /*writeByteOrderMark*/ false);
|
||||
}
|
||||
|
||||
// Last recorded and encoded spans
|
||||
let lastRecordedSourceMapSpan: SourceMapSpan;
|
||||
let lastEncodedSourceMapSpan: SourceMapSpan = {
|
||||
emittedLine: 1,
|
||||
emittedColumn: 1,
|
||||
sourceLine: 1,
|
||||
sourceColumn: 1,
|
||||
sourceIndex: 0
|
||||
};
|
||||
let lastEncodedNameIndex = 0;
|
||||
|
||||
// Encoding for sourcemap span
|
||||
function encodeLastRecordedSourceMapSpan() {
|
||||
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
|
||||
return;
|
||||
}
|
||||
|
||||
let prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
|
||||
// Line/Comma delimiters
|
||||
if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {
|
||||
// Emit comma to separate the entry
|
||||
if (sourceMapData.sourceMapMappings) {
|
||||
sourceMapData.sourceMapMappings += ",";
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Emit line delimiters
|
||||
for (let encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {
|
||||
sourceMapData.sourceMapMappings += ";";
|
||||
}
|
||||
prevEncodedEmittedColumn = 1;
|
||||
}
|
||||
|
||||
// 1. Relative Column 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);
|
||||
|
||||
// 2. Relative sourceIndex
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);
|
||||
|
||||
// 3. Relative sourceLine 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine);
|
||||
|
||||
// 4. Relative sourceColumn 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);
|
||||
|
||||
// 5. Relative namePosition 0 based
|
||||
if (lastRecordedSourceMapSpan.nameIndex >= 0) {
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);
|
||||
lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;
|
||||
}
|
||||
|
||||
lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;
|
||||
sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);
|
||||
|
||||
function base64VLQFormatEncode(inValue: number) {
|
||||
function base64FormatEncode(inValue: number) {
|
||||
if (inValue < 64) {
|
||||
return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(inValue);
|
||||
}
|
||||
throw TypeError(inValue + ": not a 64 based value");
|
||||
}
|
||||
|
||||
// Add a new least significant bit that has the sign of the value.
|
||||
// if negative number the least significant bit that gets added to the number has value 1
|
||||
// else least significant bit value that gets added is 0
|
||||
// eg. -1 changes to binary : 01 [1] => 3
|
||||
// +1 changes to binary : 01 [0] => 2
|
||||
if (inValue < 0) {
|
||||
inValue = ((-inValue) << 1) + 1;
|
||||
}
|
||||
else {
|
||||
inValue = inValue << 1;
|
||||
}
|
||||
|
||||
// Encode 5 bits at a time starting from least significant bits
|
||||
let encodedStr = "";
|
||||
do {
|
||||
let currentDigit = inValue & 31; // 11111
|
||||
inValue = inValue >> 5;
|
||||
if (inValue > 0) {
|
||||
// There are still more digits to decode, set the msb (6th bit)
|
||||
currentDigit = currentDigit | 32;
|
||||
}
|
||||
encodedStr = encodedStr + base64FormatEncode(currentDigit);
|
||||
} while (inValue > 0);
|
||||
|
||||
return encodedStr;
|
||||
}
|
||||
if (sourceMapDataList) {
|
||||
sourceMapDataList.push(sourceMap.getSourceMapData());
|
||||
}
|
||||
|
||||
function recordSourceMapSpan(pos: number) {
|
||||
const sourceLinePos = computeLineAndCharacterOfPosition(currentLineMap, pos);
|
||||
|
||||
// Convert the location to be one-based.
|
||||
sourceLinePos.line++;
|
||||
sourceLinePos.character++;
|
||||
|
||||
const emittedLine = writer.getLine();
|
||||
const emittedColumn = writer.getColumn();
|
||||
|
||||
// If this location wasn't recorded or the location in source is going backwards, record the span
|
||||
if (!lastRecordedSourceMapSpan ||
|
||||
lastRecordedSourceMapSpan.emittedLine !== emittedLine ||
|
||||
lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||
|
||||
(lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&
|
||||
(lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
|
||||
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {
|
||||
// Encode the last recordedSpan before assigning new
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
// New span
|
||||
lastRecordedSourceMapSpan = {
|
||||
emittedLine: emittedLine,
|
||||
emittedColumn: emittedColumn,
|
||||
sourceLine: sourceLinePos.line,
|
||||
sourceColumn: sourceLinePos.character,
|
||||
nameIndex: getSourceMapNameIndex(),
|
||||
sourceIndex: sourceMapSourceIndex
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Take the new pos instead since there is no change in emittedLine and column since last location
|
||||
lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;
|
||||
lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;
|
||||
lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
function recordEmitNodeStartSpan(node: Node | TextRange) {
|
||||
// Get the token pos after skipping to the token (ignoring the leading trivia)
|
||||
recordSourceMapSpan(skipTrivia(currentText, (node as Node).decorators ? (node as Node).decorators.end : node.pos));
|
||||
}
|
||||
|
||||
function recordEmitNodeEndSpan(node: Node | TextRange) {
|
||||
recordSourceMapSpan(node.end);
|
||||
}
|
||||
|
||||
function writeTextWithSpanRecord(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) {
|
||||
const tokenStartPos = ts.skipTrivia(currentText, startPos);
|
||||
recordSourceMapSpan(tokenStartPos);
|
||||
const tokenEndPos = emitTokenText(tokenKind, tokenStartPos, emitFn);
|
||||
recordSourceMapSpan(tokenEndPos);
|
||||
return tokenEndPos;
|
||||
}
|
||||
|
||||
function recordNewSourceFileStart(node: SourceFile) {
|
||||
// Add the file to tsFilePaths
|
||||
// If sourceroot option: Use the relative path corresponding to the common directory path
|
||||
// otherwise source locations relative to map file location
|
||||
const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
|
||||
|
||||
sourceMapData.sourceMapSources.push(getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
|
||||
node.fileName,
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true));
|
||||
sourceMapSourceIndex = sourceMapData.sourceMapSources.length - 1;
|
||||
|
||||
// The one that can be used from program to get the actual source file
|
||||
sourceMapData.inputSourceFileNames.push(node.fileName);
|
||||
|
||||
if (compilerOptions.inlineSources) {
|
||||
if (!sourceMapData.sourceMapSourcesContent) {
|
||||
sourceMapData.sourceMapSourcesContent = [];
|
||||
}
|
||||
sourceMapData.sourceMapSourcesContent.push(node.text);
|
||||
}
|
||||
}
|
||||
|
||||
function recordScopeNameOfNode(node: Node, scopeName?: string) {
|
||||
function recordScopeNameIndex(scopeNameIndex: number) {
|
||||
sourceMapNameIndices.push(scopeNameIndex);
|
||||
}
|
||||
|
||||
function recordScopeNameStart(scopeName: string) {
|
||||
let scopeNameIndex = -1;
|
||||
if (scopeName) {
|
||||
const parentIndex = getSourceMapNameIndex();
|
||||
if (parentIndex !== -1) {
|
||||
// Child scopes are always shown with a dot (even if they have no name),
|
||||
// unless it is a computed property. Then it is shown with brackets,
|
||||
// but the brackets are included in the name.
|
||||
const name = (<Declaration>node).name;
|
||||
if (!name || name.kind !== SyntaxKind.ComputedPropertyName) {
|
||||
scopeName = "." + scopeName;
|
||||
}
|
||||
scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName;
|
||||
}
|
||||
|
||||
scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName);
|
||||
if (scopeNameIndex === undefined) {
|
||||
scopeNameIndex = sourceMapData.sourceMapNames.length;
|
||||
sourceMapData.sourceMapNames.push(scopeName);
|
||||
sourceMapNameIndexMap[scopeName] = scopeNameIndex;
|
||||
}
|
||||
}
|
||||
recordScopeNameIndex(scopeNameIndex);
|
||||
}
|
||||
|
||||
if (scopeName) {
|
||||
// The scope was already given a name use it
|
||||
recordScopeNameStart(scopeName);
|
||||
}
|
||||
else if (node.kind === SyntaxKind.FunctionDeclaration ||
|
||||
node.kind === SyntaxKind.FunctionExpression ||
|
||||
node.kind === SyntaxKind.MethodDeclaration ||
|
||||
node.kind === SyntaxKind.MethodSignature ||
|
||||
node.kind === SyntaxKind.GetAccessor ||
|
||||
node.kind === SyntaxKind.SetAccessor ||
|
||||
node.kind === SyntaxKind.ModuleDeclaration ||
|
||||
node.kind === SyntaxKind.ClassDeclaration ||
|
||||
node.kind === SyntaxKind.EnumDeclaration) {
|
||||
// Declaration and has associated name use it
|
||||
if ((<Declaration>node).name) {
|
||||
const name = (<Declaration>node).name;
|
||||
// For computed property names, the text will include the brackets
|
||||
scopeName = name.kind === SyntaxKind.ComputedPropertyName
|
||||
? getTextOfNode(name)
|
||||
: (<Identifier>(<Declaration>node).name).text;
|
||||
}
|
||||
recordScopeNameStart(scopeName);
|
||||
}
|
||||
else {
|
||||
// Block just use the name from upper level scope
|
||||
recordScopeNameIndex(getSourceMapNameIndex());
|
||||
}
|
||||
}
|
||||
|
||||
function recordScopeNameEnd() {
|
||||
sourceMapNameIndices.pop();
|
||||
};
|
||||
|
||||
function writeCommentRangeWithMap(currentText: string, currentLineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) {
|
||||
recordSourceMapSpan(comment.pos);
|
||||
writeCommentRange(currentText, currentLineMap, writer, comment, newLine);
|
||||
recordSourceMapSpan(comment.end);
|
||||
}
|
||||
|
||||
function serializeSourceMapContents(version: number, file: string, sourceRoot: string, sources: string[], names: string[], mappings: string, sourcesContent?: string[]) {
|
||||
if (typeof JSON !== "undefined") {
|
||||
const map: any = {
|
||||
version,
|
||||
file,
|
||||
sourceRoot,
|
||||
sources,
|
||||
names,
|
||||
mappings
|
||||
};
|
||||
|
||||
if (sourcesContent !== undefined) {
|
||||
map.sourcesContent = sourcesContent;
|
||||
}
|
||||
|
||||
return JSON.stringify(map);
|
||||
}
|
||||
|
||||
return "{\"version\":" + version + ",\"file\":\"" + escapeString(file) + "\",\"sourceRoot\":\"" + escapeString(sourceRoot) + "\",\"sources\":[" + serializeStringArray(sources) + "],\"names\":[" + serializeStringArray(names) + "],\"mappings\":\"" + escapeString(mappings) + "\" " + (sourcesContent !== undefined ? ",\"sourcesContent\":[" + serializeStringArray(sourcesContent) + "]" : "") + "}";
|
||||
|
||||
function serializeStringArray(list: string[]): string {
|
||||
let output = "";
|
||||
for (let i = 0, n = list.length; i < n; i++) {
|
||||
if (i) {
|
||||
output += ",";
|
||||
}
|
||||
output += "\"" + escapeString(list[i]) + "\"";
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
function writeJavaScriptAndSourceMapFile(emitOutput: string, jsFilePath: string, writeByteOrderMark: boolean) {
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
const sourceMapText = serializeSourceMapContents(
|
||||
3,
|
||||
sourceMapData.sourceMapFile,
|
||||
sourceMapData.sourceMapSourceRoot,
|
||||
sourceMapData.sourceMapSources,
|
||||
sourceMapData.sourceMapNames,
|
||||
sourceMapData.sourceMapMappings,
|
||||
sourceMapData.sourceMapSourcesContent);
|
||||
|
||||
sourceMapDataList.push(sourceMapData);
|
||||
|
||||
let sourceMapUrl: string;
|
||||
if (compilerOptions.inlineSourceMap) {
|
||||
// Encode the sourceMap into the sourceMap url
|
||||
const base64SourceMapText = convertToBase64(sourceMapText);
|
||||
sourceMapData.jsSourceMappingURL = `data:application/json;base64,${base64SourceMapText}`;
|
||||
}
|
||||
else {
|
||||
// Write source map file
|
||||
writeFile(host, emitterDiagnostics, sourceMapData.sourceMapFilePath, sourceMapText, /*writeByteOrderMark*/ false);
|
||||
}
|
||||
sourceMapUrl = `//# sourceMappingURL=${sourceMapData.jsSourceMappingURL}`;
|
||||
|
||||
// Write sourcemap url to the js file and write the js file
|
||||
writeJavaScriptFile(emitOutput + sourceMapUrl, jsFilePath, writeByteOrderMark);
|
||||
}
|
||||
|
||||
// Initialize source map data
|
||||
sourceMapData = {
|
||||
sourceMapFilePath: sourceMapFilePath,
|
||||
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined,
|
||||
sourceMapFile: getBaseFileName(normalizeSlashes(jsFilePath)),
|
||||
sourceMapSourceRoot: compilerOptions.sourceRoot || "",
|
||||
sourceMapSources: [],
|
||||
inputSourceFileNames: [],
|
||||
sourceMapNames: [],
|
||||
sourceMapMappings: "",
|
||||
sourceMapSourcesContent: undefined,
|
||||
sourceMapDecodedMappings: []
|
||||
};
|
||||
|
||||
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
|
||||
// relative paths of the sources list in the sourcemap
|
||||
sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot);
|
||||
if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== CharacterCodes.slash) {
|
||||
sourceMapData.sourceMapSourceRoot += directorySeparator;
|
||||
}
|
||||
|
||||
if (compilerOptions.mapRoot) {
|
||||
sourceMapDir = normalizeSlashes(compilerOptions.mapRoot);
|
||||
if (!isBundledEmit) { // emitting single module file
|
||||
Debug.assert(sourceFiles.length === 1);
|
||||
// For modules or multiple emit files the mapRoot will have directory structure like the sources
|
||||
// So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map
|
||||
sourceMapDir = getDirectoryPath(getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir));
|
||||
}
|
||||
|
||||
if (!isRootedDiskPath(sourceMapDir) && !isUrl(sourceMapDir)) {
|
||||
// The relative paths are relative to the common directory
|
||||
sourceMapDir = combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
|
||||
sourceMapData.jsSourceMappingURL = getRelativePathToDirectoryOrUrl(
|
||||
getDirectoryPath(normalizePath(jsFilePath)), // get the relative sourceMapDir path based on jsFilePath
|
||||
combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true);
|
||||
}
|
||||
else {
|
||||
sourceMapData.jsSourceMappingURL = combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sourceMapDir = getDirectoryPath(normalizePath(jsFilePath));
|
||||
}
|
||||
|
||||
function emitNodeWithSourceMap(node: Node) {
|
||||
if (node) {
|
||||
if (nodeIsSynthesized(node)) {
|
||||
return emitNodeWithoutSourceMap(node);
|
||||
}
|
||||
if (node.kind !== SyntaxKind.SourceFile) {
|
||||
recordEmitNodeStartSpan(node);
|
||||
emitNodeWithoutSourceMap(node);
|
||||
recordEmitNodeEndSpan(node);
|
||||
}
|
||||
else {
|
||||
recordNewSourceFileStart(<SourceFile>node);
|
||||
emitNodeWithoutSourceMap(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function emitNodeWithCommentsAndWithSourcemap(node: Node) {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap);
|
||||
}
|
||||
|
||||
writeEmittedFiles = writeJavaScriptAndSourceMapFile;
|
||||
emit = emitNodeWithCommentsAndWithSourcemap;
|
||||
emitStart = recordEmitNodeStartSpan;
|
||||
emitEnd = recordEmitNodeEndSpan;
|
||||
emitToken = writeTextWithSpanRecord;
|
||||
scopeEmitStart = recordScopeNameOfNode;
|
||||
scopeEmitEnd = recordScopeNameEnd;
|
||||
writeComment = writeCommentRangeWithMap;
|
||||
}
|
||||
|
||||
function writeJavaScriptFile(emitOutput: string, jsFilePath: string, writeByteOrderMark: boolean) {
|
||||
writeFile(host, emitterDiagnostics, jsFilePath, emitOutput, writeByteOrderMark);
|
||||
}
|
||||
|
||||
|
@ -1144,7 +739,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function emitTokenText(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) {
|
||||
/** Emit the text for the given token that comes after startPos
|
||||
* This by default writes the text provided with the given tokenKind
|
||||
* but if optional emitFn callback is provided the text is emitted using the callback instead of default text
|
||||
* @param tokenKind the kind of the token to search and emit
|
||||
* @param startPos the position in the source to start searching for the token
|
||||
* @param emitFn if given will be invoked to emit the text instead of actual token emit */
|
||||
function emitToken(tokenKind: SyntaxKind, startPos: number, emitFn?: () => void) {
|
||||
const tokenStartPos = skipTrivia(currentText, startPos);
|
||||
emitPos(tokenStartPos);
|
||||
|
||||
const tokenString = tokenToString(tokenKind);
|
||||
if (emitFn) {
|
||||
emitFn();
|
||||
|
@ -1152,7 +756,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
else {
|
||||
write(tokenString);
|
||||
}
|
||||
return startPos + tokenString.length;
|
||||
|
||||
const tokenEndPos = tokenStartPos + tokenString.length;
|
||||
emitPos(tokenEndPos);
|
||||
return tokenEndPos;
|
||||
}
|
||||
|
||||
function emitOptional(prefix: string, node: Node) {
|
||||
|
@ -1276,7 +883,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function isBinaryOrOctalIntegerLiteral(node: LiteralExpression, text: string): boolean {
|
||||
function isBinaryOrOctalIntegerLiteral(node: LiteralLikeNode, text: string): boolean {
|
||||
if (node.kind === SyntaxKind.NumericLiteral && text.length > 1) {
|
||||
switch (text.charCodeAt(1)) {
|
||||
case CharacterCodes.b:
|
||||
|
@ -1290,7 +897,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
return false;
|
||||
}
|
||||
|
||||
function emitLiteral(node: LiteralExpression) {
|
||||
function emitLiteral(node: LiteralExpression | TemplateLiteralFragment) {
|
||||
const text = getLiteralText(node);
|
||||
|
||||
if ((compilerOptions.sourceMap || compilerOptions.inlineSourceMap) && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) {
|
||||
|
@ -1305,7 +912,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function getLiteralText(node: LiteralExpression) {
|
||||
function getLiteralText(node: LiteralExpression | TemplateLiteralFragment) {
|
||||
// Any template literal or string literal with an extended escape
|
||||
// (e.g. "\u{0067}") will need to be downleveled as a escaped string literal.
|
||||
if (languageVersion < ScriptTarget.ES6 && (isTemplateLiteralKind(node.kind) || node.hasExtendedUnicodeEscape)) {
|
||||
|
@ -1364,7 +971,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
write(`"${text}"`);
|
||||
}
|
||||
|
||||
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression) => void) {
|
||||
function emitDownlevelTaggedTemplateArray(node: TaggedTemplateExpression, literalEmitter: (literal: LiteralExpression | TemplateLiteralFragment) => void) {
|
||||
write("[");
|
||||
if (node.template.kind === SyntaxKind.NoSubstitutionTemplateLiteral) {
|
||||
literalEmitter(<LiteralExpression>node.template);
|
||||
|
@ -3093,7 +2700,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
|
||||
emitToken(SyntaxKind.OpenBraceToken, node.pos);
|
||||
increaseIndent();
|
||||
scopeEmitStart(node.parent);
|
||||
pushScope(node.parent);
|
||||
if (node.kind === SyntaxKind.ModuleBlock) {
|
||||
Debug.assert(node.parent.kind === SyntaxKind.ModuleDeclaration);
|
||||
emitCaptureThisForNodeIfNecessary(node.parent);
|
||||
|
@ -3105,7 +2712,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.statements.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
}
|
||||
|
||||
function emitEmbeddedStatement(node: Node) {
|
||||
|
@ -4971,7 +4578,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
|
||||
function emitDownLevelExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) {
|
||||
write(" {");
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
|
||||
increaseIndent();
|
||||
const outPos = writer.getTextPos();
|
||||
|
@ -5012,12 +4619,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
write("}");
|
||||
emitEnd(node.body);
|
||||
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
}
|
||||
|
||||
function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) {
|
||||
write(" {");
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
|
||||
const initialTextPos = writer.getTextPos();
|
||||
|
||||
|
@ -5052,7 +4659,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
|
||||
emitToken(SyntaxKind.CloseBraceToken, body.statements.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
}
|
||||
|
||||
function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement {
|
||||
|
@ -5338,7 +4945,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
let startIndex = 0;
|
||||
|
||||
write(" {");
|
||||
scopeEmitStart(node, "constructor");
|
||||
pushScope(node, "constructor");
|
||||
increaseIndent();
|
||||
if (ctor) {
|
||||
// Emit all the directive prologues (like "use strict"). These have to come before
|
||||
|
@ -5388,7 +4995,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
decreaseIndent();
|
||||
emitToken(SyntaxKind.CloseBraceToken, ctor ? (<Block>ctor.body).statements.end : node.members.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
emitEnd(<Node>ctor || node);
|
||||
if (ctor) {
|
||||
emitTrailingComments(ctor);
|
||||
|
@ -5525,14 +5132,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
|
||||
write(" {");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
writeLine();
|
||||
emitConstructor(node, baseTypeNode);
|
||||
emitMemberFunctionsForES6AndHigher(node);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
|
||||
// TODO(rbuckton): Need to go back to `let _a = class C {}` approach, removing the defineProperty call for now.
|
||||
|
||||
|
@ -5571,9 +5178,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
emitDecoratorsOfClass(node);
|
||||
}
|
||||
|
||||
if (!(node.flags & NodeFlags.Export)) {
|
||||
return;
|
||||
}
|
||||
// If this is an exported class, but not on the top level (i.e. on an internal
|
||||
// module), export it
|
||||
if (!isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Export)) {
|
||||
if (node.flags & NodeFlags.Default) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
writeLine();
|
||||
if (thisNodeIsDecorated && modulekind === ModuleKind.ES6) {
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
else if (modulekind === ModuleKind.System) {
|
||||
write(`${exportFunctionForFile}("default", `);
|
||||
emitDeclarationName(node);
|
||||
write(");");
|
||||
}
|
||||
else if (modulekind !== ModuleKind.ES6) {
|
||||
write(`exports.default = `);
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
else if (node.parent.kind !== SyntaxKind.SourceFile || (modulekind !== ModuleKind.ES6 && !(node.flags & NodeFlags.Default))) {
|
||||
writeLine();
|
||||
emitStart(node);
|
||||
emitModuleMemberName(node);
|
||||
|
@ -5582,13 +5211,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
emitEnd(node);
|
||||
write(";");
|
||||
}
|
||||
else if (isES6ExportedDeclaration(node) && (node.flags & NodeFlags.Default) && thisNodeIsDecorated) {
|
||||
// if this is a top level default export of decorated class, write the export after the declaration.
|
||||
writeLine();
|
||||
write("export default ");
|
||||
emitDeclarationName(node);
|
||||
write(";");
|
||||
}
|
||||
}
|
||||
|
||||
function emitClassLikeDeclarationBelowES6(node: ClassLikeDeclaration) {
|
||||
|
@ -5619,7 +5241,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
tempParameters = undefined;
|
||||
computedPropertyNamesToGeneratedNames = undefined;
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
if (baseTypeNode) {
|
||||
writeLine();
|
||||
emitStart(baseTypeNode);
|
||||
|
@ -5652,7 +5274,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
emitStart(node);
|
||||
write(")(");
|
||||
if (baseTypeNode) {
|
||||
|
@ -5950,7 +5572,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
|
||||
function emitSerializedTypeNode(node: TypeNode) {
|
||||
if (node) {
|
||||
|
||||
switch (node.kind) {
|
||||
case SyntaxKind.VoidKeyword:
|
||||
write("void 0");
|
||||
|
@ -5976,7 +5597,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
return;
|
||||
|
||||
case SyntaxKind.StringKeyword:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
write("String");
|
||||
return;
|
||||
|
||||
|
@ -6210,12 +5831,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
emitEnd(node.name);
|
||||
write(") {");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
emitLines(node.members);
|
||||
decreaseIndent();
|
||||
writeLine();
|
||||
emitToken(SyntaxKind.CloseBraceToken, node.members.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
write(")(");
|
||||
emitModuleMemberName(node);
|
||||
write(" || (");
|
||||
|
@ -6339,7 +5960,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
else {
|
||||
write("{");
|
||||
increaseIndent();
|
||||
scopeEmitStart(node);
|
||||
pushScope(node);
|
||||
emitCaptureThisForNodeIfNecessary(node);
|
||||
writeLine();
|
||||
emit(node.body);
|
||||
|
@ -6347,7 +5968,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
writeLine();
|
||||
const moduleBlock = <ModuleBlock>getInnerMostModuleDeclarationFromDottedModule(node).body;
|
||||
emitToken(SyntaxKind.CloseBraceToken, moduleBlock.statements.end);
|
||||
scopeEmitEnd();
|
||||
popScope();
|
||||
}
|
||||
write(")(");
|
||||
// write moduleDecl = containingModule.m only if it is not exported es6 module member
|
||||
|
@ -6792,7 +6413,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration): string {
|
||||
function getExternalModuleNameText(importNode: ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration, emitRelativePathAsModuleName: boolean): string {
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
|
||||
if (name) {
|
||||
return `"${name}"`;
|
||||
}
|
||||
}
|
||||
const moduleName = getExternalModuleName(importNode);
|
||||
if (moduleName.kind === SyntaxKind.StringLiteral) {
|
||||
return tryRenameExternalModule(<LiteralExpression>moduleName) || getLiteralText(<LiteralExpression>moduleName);
|
||||
|
@ -7352,7 +6979,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
const dependencyGroups: DependencyGroup[] = [];
|
||||
|
||||
for (let i = 0; i < externalImports.length; ++i) {
|
||||
let text = getExternalModuleNameText(externalImports[i]);
|
||||
const text = getExternalModuleNameText(externalImports[i], emitRelativePathAsModuleName);
|
||||
if (hasProperty(groupIndices, text)) {
|
||||
// deduplicate/group entries in dependency list by the dependency name
|
||||
const groupIndex = groupIndices[text];
|
||||
|
@ -7368,12 +6995,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
write(", ");
|
||||
}
|
||||
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, externalImports[i]);
|
||||
if (name) {
|
||||
text = `"${name}"`;
|
||||
}
|
||||
}
|
||||
write(text);
|
||||
}
|
||||
write(`], function(${exportFunctionForFile}) {`);
|
||||
|
@ -7416,14 +7037,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
|
||||
for (const importNode of externalImports) {
|
||||
// Find the name of the external module
|
||||
let externalModuleName = getExternalModuleNameText(importNode);
|
||||
|
||||
if (emitRelativePathAsModuleName) {
|
||||
const name = getExternalModuleNameFromDeclaration(host, resolver, importNode);
|
||||
if (name) {
|
||||
externalModuleName = `"${name}"`;
|
||||
}
|
||||
}
|
||||
const externalModuleName = getExternalModuleNameText(importNode, emitRelativePathAsModuleName);
|
||||
|
||||
// Find the name of the module alias, if there is one
|
||||
const importAliasName = getLocalNameForExternalImport(importNode);
|
||||
|
@ -7779,6 +7393,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
emitLeadingComments(node.endOfFileToken);
|
||||
}
|
||||
|
||||
function emit(node: Node): void {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithSourceMap);
|
||||
}
|
||||
|
||||
function emitNodeWithCommentsAndWithoutSourcemap(node: Node): void {
|
||||
emitNodeConsideringCommentsOption(node, emitNodeWithoutSourceMap);
|
||||
}
|
||||
|
@ -7807,6 +7425,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function emitNodeWithSourceMap(node: Node): void {
|
||||
if (node) {
|
||||
emitStart(node);
|
||||
emitNodeWithoutSourceMap(node);
|
||||
emitEnd(node);
|
||||
}
|
||||
}
|
||||
|
||||
function emitNodeWithoutSourceMap(node: Node): void {
|
||||
if (node) {
|
||||
emitJavaScriptWorker(node);
|
||||
|
@ -8199,6 +7825,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
|
|||
}
|
||||
}
|
||||
|
||||
function writeComment(text: string, lineMap: number[], writer: EmitTextWriter, comment: CommentRange, newLine: string) {
|
||||
emitPos(comment.pos);
|
||||
writeCommentRange(text, lineMap, writer, comment, newLine);
|
||||
emitPos(comment.end);
|
||||
}
|
||||
|
||||
function emitShebang() {
|
||||
const shebang = getShebang(currentText);
|
||||
if (shebang) {
|
||||
|
|
|
@ -1874,7 +1874,7 @@ namespace ts {
|
|||
function parseTemplateExpression(): TemplateExpression {
|
||||
const template = <TemplateExpression>createNode(SyntaxKind.TemplateExpression);
|
||||
|
||||
template.head = parseLiteralNode();
|
||||
template.head = parseTemplateLiteralFragment();
|
||||
Debug.assert(template.head.kind === SyntaxKind.TemplateHead, "Template head has wrong token kind");
|
||||
|
||||
const templateSpans = <NodeArray<TemplateSpan>>[];
|
||||
|
@ -1895,22 +1895,34 @@ namespace ts {
|
|||
const span = <TemplateSpan>createNode(SyntaxKind.TemplateSpan);
|
||||
span.expression = allowInAnd(parseExpression);
|
||||
|
||||
let literal: LiteralExpression;
|
||||
let literal: TemplateLiteralFragment;
|
||||
|
||||
if (token === SyntaxKind.CloseBraceToken) {
|
||||
reScanTemplateToken();
|
||||
literal = parseLiteralNode();
|
||||
literal = parseTemplateLiteralFragment();
|
||||
}
|
||||
else {
|
||||
literal = <LiteralExpression>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
|
||||
literal = <TemplateLiteralFragment>parseExpectedToken(SyntaxKind.TemplateTail, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, tokenToString(SyntaxKind.CloseBraceToken));
|
||||
}
|
||||
|
||||
span.literal = literal;
|
||||
return finishNode(span);
|
||||
}
|
||||
|
||||
function parseStringLiteralTypeNode(): StringLiteralTypeNode {
|
||||
return <StringLiteralTypeNode>parseLiteralLikeNode(SyntaxKind.StringLiteralType, /*internName*/ true);
|
||||
}
|
||||
|
||||
function parseLiteralNode(internName?: boolean): LiteralExpression {
|
||||
const node = <LiteralExpression>createNode(token);
|
||||
return <LiteralExpression>parseLiteralLikeNode(token, internName);
|
||||
}
|
||||
|
||||
function parseTemplateLiteralFragment(): TemplateLiteralFragment {
|
||||
return <TemplateLiteralFragment>parseLiteralLikeNode(token, /*internName*/ false);
|
||||
}
|
||||
|
||||
function parseLiteralLikeNode(kind: SyntaxKind, internName: boolean): LiteralLikeNode {
|
||||
const node = <LiteralExpression>createNode(kind);
|
||||
const text = scanner.getTokenValue();
|
||||
node.text = internName ? internIdentifier(text) : text;
|
||||
|
||||
|
@ -2397,7 +2409,7 @@ namespace ts {
|
|||
const node = tryParse(parseKeywordAndNoDot);
|
||||
return node || parseTypeReferenceOrTypePredicate();
|
||||
case SyntaxKind.StringLiteral:
|
||||
return <StringLiteral>parseLiteralNode(/*internName*/ true);
|
||||
return parseStringLiteralTypeNode();
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return parseTokenNode<TypeNode>();
|
||||
case SyntaxKind.ThisKeyword:
|
||||
|
@ -5416,11 +5428,13 @@ namespace ts {
|
|||
// reference comment.
|
||||
while (true) {
|
||||
const kind = triviaScanner.scan();
|
||||
if (kind === SyntaxKind.WhitespaceTrivia || kind === SyntaxKind.NewLineTrivia || kind === SyntaxKind.MultiLineCommentTrivia) {
|
||||
continue;
|
||||
}
|
||||
if (kind !== SyntaxKind.SingleLineCommentTrivia) {
|
||||
break;
|
||||
if (isTrivia(kind)) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const range = { pos: triviaScanner.getTokenPos(), end: triviaScanner.getTextPos(), kind: triviaScanner.getToken() };
|
||||
|
|
|
@ -395,7 +395,7 @@ namespace ts {
|
|||
getTypeChecker,
|
||||
getClassifiableNames,
|
||||
getDiagnosticsProducingTypeChecker,
|
||||
getCommonSourceDirectory: () => commonSourceDirectory,
|
||||
getCommonSourceDirectory,
|
||||
emit,
|
||||
getCurrentDirectory: () => currentDirectory,
|
||||
getNodeCount: () => getDiagnosticsProducingTypeChecker().getNodeCount(),
|
||||
|
@ -411,6 +411,25 @@ namespace ts {
|
|||
|
||||
return program;
|
||||
|
||||
function getCommonSourceDirectory() {
|
||||
if (typeof commonSourceDirectory === "undefined") {
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
// If a rootDir is specified and is valid use it as the commonSourceDirectory
|
||||
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
||||
}
|
||||
else {
|
||||
commonSourceDirectory = computeCommonSourceDirectory(files);
|
||||
}
|
||||
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
// start with / making it rooted path
|
||||
commonSourceDirectory += directorySeparator;
|
||||
}
|
||||
}
|
||||
return commonSourceDirectory;
|
||||
}
|
||||
|
||||
function getClassifiableNames() {
|
||||
if (!classifiableNames) {
|
||||
// Initialize a checker so that all our files are bound.
|
||||
|
@ -1234,24 +1253,12 @@ namespace ts {
|
|||
options.sourceRoot || // there is --sourceRoot specified
|
||||
options.mapRoot) { // there is --mapRoot specified
|
||||
|
||||
if (options.rootDir && checkSourceFilesBelongToPath(files, options.rootDir)) {
|
||||
// If a rootDir is specified and is valid use it as the commonSourceDirectory
|
||||
commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory);
|
||||
}
|
||||
else {
|
||||
// Compute the commonSourceDirectory from the input files
|
||||
commonSourceDirectory = computeCommonSourceDirectory(files);
|
||||
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
|
||||
if (options.outDir && commonSourceDirectory === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
}
|
||||
}
|
||||
// Precalculate and cache the common source directory
|
||||
const dir = getCommonSourceDirectory();
|
||||
|
||||
if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) {
|
||||
// Make sure directory path ends with directory separator so this string can directly
|
||||
// used to replace with "" to get the relative path of the source file and the relative path doesn't
|
||||
// start with / making it rooted path
|
||||
commonSourceDirectory += directorySeparator;
|
||||
// If we failed to find a good common directory, but outDir is specified and at least one of our files is on a windows drive/URL/other resource, add a failure
|
||||
if (options.outDir && dir === "" && forEach(files, file => getRootLength(file.fileName) > 1)) {
|
||||
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -425,6 +425,12 @@ namespace ts {
|
|||
|
||||
/* @internal */
|
||||
export function skipTrivia(text: string, pos: number, stopAfterLineBreak?: boolean): number {
|
||||
// Using ! with a greater than test is a fast way of testing the following conditions:
|
||||
// pos === undefined || pos === null || isNaN(pos) || pos < 0;
|
||||
if (!(pos >= 0)) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
// Keep in sync with couldStartTrivia
|
||||
while (true) {
|
||||
const ch = text.charCodeAt(pos);
|
||||
|
@ -567,12 +573,12 @@ namespace ts {
|
|||
}
|
||||
|
||||
/**
|
||||
* Extract comments from text prefixing the token closest following `pos`.
|
||||
* Extract comments from text prefixing the token closest following `pos`.
|
||||
* The return value is an array containing a TextRange for each comment.
|
||||
* Single-line comment ranges include the beginning '//' characters but not the ending line break.
|
||||
* Multi - line comment ranges include the beginning '/* and ending '<asterisk>/' characters.
|
||||
* The return value is undefined if no comments were found.
|
||||
* @param trailing
|
||||
* @param trailing
|
||||
* If false, whitespace is skipped until the first line break and comments between that location
|
||||
* and the next token are returned.
|
||||
* If true, comments occurring between the given position and the next line break are returned.
|
||||
|
|
417
src/compiler/sourcemap.ts
Normal file
417
src/compiler/sourcemap.ts
Normal file
|
@ -0,0 +1,417 @@
|
|||
/// <reference path="checker.ts"/>
|
||||
|
||||
/* @internal */
|
||||
namespace ts {
|
||||
export interface SourceMapWriter {
|
||||
getSourceMapData(): SourceMapData;
|
||||
setSourceFile(sourceFile: SourceFile): void;
|
||||
emitPos(pos: number): void;
|
||||
emitStart(range: TextRange): void;
|
||||
emitEnd(range: TextRange): void;
|
||||
pushScope(scopeDeclaration: Node, scopeName?: string): void;
|
||||
popScope(): void;
|
||||
getText(): string;
|
||||
getSourceMappingURL(): string;
|
||||
initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void;
|
||||
reset(): void;
|
||||
}
|
||||
|
||||
const nop = <(...args: any[]) => any>Function.prototype;
|
||||
let nullSourceMapWriter: SourceMapWriter;
|
||||
|
||||
export function getNullSourceMapWriter(): SourceMapWriter {
|
||||
if (nullSourceMapWriter === undefined) {
|
||||
nullSourceMapWriter = {
|
||||
getSourceMapData(): SourceMapData { return undefined; },
|
||||
setSourceFile(sourceFile: SourceFile): void { },
|
||||
emitStart(range: TextRange): void { },
|
||||
emitEnd(range: TextRange): void { },
|
||||
emitPos(pos: number): void { },
|
||||
pushScope(scopeDeclaration: Node, scopeName?: string): void { },
|
||||
popScope(): void { },
|
||||
getText(): string { return undefined; },
|
||||
getSourceMappingURL(): string { return undefined; },
|
||||
initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean): void { },
|
||||
reset(): void { },
|
||||
};
|
||||
}
|
||||
|
||||
return nullSourceMapWriter;
|
||||
}
|
||||
|
||||
export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter): SourceMapWriter {
|
||||
const compilerOptions = host.getCompilerOptions();
|
||||
let currentSourceFile: SourceFile;
|
||||
let sourceMapDir: string; // The directory in which sourcemap will be
|
||||
|
||||
// Current source map file and its index in the sources list
|
||||
let sourceMapSourceIndex: number;
|
||||
|
||||
// Names and its index map
|
||||
let sourceMapNameIndexMap: Map<number>;
|
||||
let sourceMapNameIndices: number[];
|
||||
|
||||
// Last recorded and encoded spans
|
||||
let lastRecordedSourceMapSpan: SourceMapSpan;
|
||||
let lastEncodedSourceMapSpan: SourceMapSpan;
|
||||
let lastEncodedNameIndex: number;
|
||||
|
||||
// Source map data
|
||||
let sourceMapData: SourceMapData;
|
||||
|
||||
return {
|
||||
getSourceMapData: () => sourceMapData,
|
||||
setSourceFile,
|
||||
emitPos,
|
||||
emitStart,
|
||||
emitEnd,
|
||||
pushScope,
|
||||
popScope,
|
||||
getText,
|
||||
getSourceMappingURL,
|
||||
initialize,
|
||||
reset,
|
||||
};
|
||||
|
||||
function initialize(filePath: string, sourceMapFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean) {
|
||||
if (sourceMapData) {
|
||||
reset();
|
||||
}
|
||||
|
||||
currentSourceFile = undefined;
|
||||
|
||||
// Current source map file and its index in the sources list
|
||||
sourceMapSourceIndex = -1;
|
||||
|
||||
// Names and its index map
|
||||
sourceMapNameIndexMap = {};
|
||||
sourceMapNameIndices = [];
|
||||
|
||||
// Last recorded and encoded spans
|
||||
lastRecordedSourceMapSpan = undefined;
|
||||
lastEncodedSourceMapSpan = {
|
||||
emittedLine: 1,
|
||||
emittedColumn: 1,
|
||||
sourceLine: 1,
|
||||
sourceColumn: 1,
|
||||
sourceIndex: 0
|
||||
};
|
||||
lastEncodedNameIndex = 0;
|
||||
|
||||
// Initialize source map data
|
||||
sourceMapData = {
|
||||
sourceMapFilePath: sourceMapFilePath,
|
||||
jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined,
|
||||
sourceMapFile: getBaseFileName(normalizeSlashes(filePath)),
|
||||
sourceMapSourceRoot: compilerOptions.sourceRoot || "",
|
||||
sourceMapSources: [],
|
||||
inputSourceFileNames: [],
|
||||
sourceMapNames: [],
|
||||
sourceMapMappings: "",
|
||||
sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined,
|
||||
sourceMapDecodedMappings: []
|
||||
};
|
||||
|
||||
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
|
||||
// relative paths of the sources list in the sourcemap
|
||||
sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot);
|
||||
if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== CharacterCodes.slash) {
|
||||
sourceMapData.sourceMapSourceRoot += directorySeparator;
|
||||
}
|
||||
|
||||
if (compilerOptions.mapRoot) {
|
||||
sourceMapDir = normalizeSlashes(compilerOptions.mapRoot);
|
||||
if (!isBundledEmit) { // emitting single module file
|
||||
Debug.assert(sourceFiles.length === 1);
|
||||
// For modules or multiple emit files the mapRoot will have directory structure like the sources
|
||||
// So if src\a.ts and src\lib\b.ts are compiled together user would be moving the maps into mapRoot\a.js.map and mapRoot\lib\b.js.map
|
||||
sourceMapDir = getDirectoryPath(getSourceFilePathInNewDir(sourceFiles[0], host, sourceMapDir));
|
||||
}
|
||||
|
||||
if (!isRootedDiskPath(sourceMapDir) && !isUrl(sourceMapDir)) {
|
||||
// The relative paths are relative to the common directory
|
||||
sourceMapDir = combinePaths(host.getCommonSourceDirectory(), sourceMapDir);
|
||||
sourceMapData.jsSourceMappingURL = getRelativePathToDirectoryOrUrl(
|
||||
getDirectoryPath(normalizePath(filePath)), // get the relative sourceMapDir path based on jsFilePath
|
||||
combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL), // this is where user expects to see sourceMap
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true);
|
||||
}
|
||||
else {
|
||||
sourceMapData.jsSourceMappingURL = combinePaths(sourceMapDir, sourceMapData.jsSourceMappingURL);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sourceMapDir = getDirectoryPath(normalizePath(filePath));
|
||||
}
|
||||
}
|
||||
|
||||
function reset() {
|
||||
currentSourceFile = undefined;
|
||||
sourceMapDir = undefined;
|
||||
sourceMapSourceIndex = undefined;
|
||||
sourceMapNameIndexMap = undefined;
|
||||
sourceMapNameIndices = undefined;
|
||||
lastRecordedSourceMapSpan = undefined;
|
||||
lastEncodedSourceMapSpan = undefined;
|
||||
lastEncodedNameIndex = undefined;
|
||||
sourceMapData = undefined;
|
||||
}
|
||||
|
||||
function getSourceMapNameIndex() {
|
||||
return sourceMapNameIndices.length ? lastOrUndefined(sourceMapNameIndices) : -1;
|
||||
}
|
||||
|
||||
// Encoding for sourcemap span
|
||||
function encodeLastRecordedSourceMapSpan() {
|
||||
if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) {
|
||||
return;
|
||||
}
|
||||
|
||||
let prevEncodedEmittedColumn = lastEncodedSourceMapSpan.emittedColumn;
|
||||
// Line/Comma delimiters
|
||||
if (lastEncodedSourceMapSpan.emittedLine === lastRecordedSourceMapSpan.emittedLine) {
|
||||
// Emit comma to separate the entry
|
||||
if (sourceMapData.sourceMapMappings) {
|
||||
sourceMapData.sourceMapMappings += ",";
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Emit line delimiters
|
||||
for (let encodedLine = lastEncodedSourceMapSpan.emittedLine; encodedLine < lastRecordedSourceMapSpan.emittedLine; encodedLine++) {
|
||||
sourceMapData.sourceMapMappings += ";";
|
||||
}
|
||||
prevEncodedEmittedColumn = 1;
|
||||
}
|
||||
|
||||
// 1. Relative Column 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn);
|
||||
|
||||
// 2. Relative sourceIndex
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex);
|
||||
|
||||
// 3. Relative sourceLine 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine);
|
||||
|
||||
// 4. Relative sourceColumn 0 based
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn);
|
||||
|
||||
// 5. Relative namePosition 0 based
|
||||
if (lastRecordedSourceMapSpan.nameIndex >= 0) {
|
||||
sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex - lastEncodedNameIndex);
|
||||
lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex;
|
||||
}
|
||||
|
||||
lastEncodedSourceMapSpan = lastRecordedSourceMapSpan;
|
||||
sourceMapData.sourceMapDecodedMappings.push(lastEncodedSourceMapSpan);
|
||||
}
|
||||
|
||||
function emitPos(pos: number) {
|
||||
if (pos === -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos);
|
||||
|
||||
// Convert the location to be one-based.
|
||||
sourceLinePos.line++;
|
||||
sourceLinePos.character++;
|
||||
|
||||
const emittedLine = writer.getLine();
|
||||
const emittedColumn = writer.getColumn();
|
||||
|
||||
// If this location wasn't recorded or the location in source is going backwards, record the span
|
||||
if (!lastRecordedSourceMapSpan ||
|
||||
lastRecordedSourceMapSpan.emittedLine !== emittedLine ||
|
||||
lastRecordedSourceMapSpan.emittedColumn !== emittedColumn ||
|
||||
(lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex &&
|
||||
(lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line ||
|
||||
(lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) {
|
||||
|
||||
// Encode the last recordedSpan before assigning new
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
// New span
|
||||
lastRecordedSourceMapSpan = {
|
||||
emittedLine: emittedLine,
|
||||
emittedColumn: emittedColumn,
|
||||
sourceLine: sourceLinePos.line,
|
||||
sourceColumn: sourceLinePos.character,
|
||||
nameIndex: getSourceMapNameIndex(),
|
||||
sourceIndex: sourceMapSourceIndex
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Take the new pos instead since there is no change in emittedLine and column since last location
|
||||
lastRecordedSourceMapSpan.sourceLine = sourceLinePos.line;
|
||||
lastRecordedSourceMapSpan.sourceColumn = sourceLinePos.character;
|
||||
lastRecordedSourceMapSpan.sourceIndex = sourceMapSourceIndex;
|
||||
}
|
||||
}
|
||||
|
||||
function emitStart(range: TextRange) {
|
||||
const rangeHasDecorators = !!(range as Node).decorators;
|
||||
emitPos(range.pos !== -1 ? skipTrivia(currentSourceFile.text, rangeHasDecorators ? (range as Node).decorators.end : range.pos) : -1);
|
||||
}
|
||||
|
||||
function emitEnd(range: TextRange) {
|
||||
emitPos(range.end);
|
||||
}
|
||||
|
||||
function setSourceFile(sourceFile: SourceFile) {
|
||||
currentSourceFile = sourceFile;
|
||||
|
||||
// Add the file to tsFilePaths
|
||||
// If sourceroot option: Use the relative path corresponding to the common directory path
|
||||
// otherwise source locations relative to map file location
|
||||
const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir;
|
||||
|
||||
const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath,
|
||||
currentSourceFile.fileName,
|
||||
host.getCurrentDirectory(),
|
||||
host.getCanonicalFileName,
|
||||
/*isAbsolutePathAnUrl*/ true);
|
||||
|
||||
sourceMapSourceIndex = indexOf(sourceMapData.sourceMapSources, source);
|
||||
if (sourceMapSourceIndex === -1) {
|
||||
sourceMapSourceIndex = sourceMapData.sourceMapSources.length;
|
||||
sourceMapData.sourceMapSources.push(source);
|
||||
|
||||
// The one that can be used from program to get the actual source file
|
||||
sourceMapData.inputSourceFileNames.push(sourceFile.fileName);
|
||||
|
||||
if (compilerOptions.inlineSources) {
|
||||
sourceMapData.sourceMapSourcesContent.push(sourceFile.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function recordScopeNameIndex(scopeNameIndex: number) {
|
||||
sourceMapNameIndices.push(scopeNameIndex);
|
||||
}
|
||||
|
||||
function recordScopeNameStart(scopeDeclaration: Node, scopeName: string) {
|
||||
let scopeNameIndex = -1;
|
||||
if (scopeName) {
|
||||
const parentIndex = getSourceMapNameIndex();
|
||||
if (parentIndex !== -1) {
|
||||
// Child scopes are always shown with a dot (even if they have no name),
|
||||
// unless it is a computed property. Then it is shown with brackets,
|
||||
// but the brackets are included in the name.
|
||||
const name = (<Declaration>scopeDeclaration).name;
|
||||
if (!name || name.kind !== SyntaxKind.ComputedPropertyName) {
|
||||
scopeName = "." + scopeName;
|
||||
}
|
||||
scopeName = sourceMapData.sourceMapNames[parentIndex] + scopeName;
|
||||
}
|
||||
|
||||
scopeNameIndex = getProperty(sourceMapNameIndexMap, scopeName);
|
||||
if (scopeNameIndex === undefined) {
|
||||
scopeNameIndex = sourceMapData.sourceMapNames.length;
|
||||
sourceMapData.sourceMapNames.push(scopeName);
|
||||
sourceMapNameIndexMap[scopeName] = scopeNameIndex;
|
||||
}
|
||||
}
|
||||
recordScopeNameIndex(scopeNameIndex);
|
||||
}
|
||||
|
||||
function pushScope(scopeDeclaration: Node, scopeName?: string) {
|
||||
if (scopeName) {
|
||||
// The scope was already given a name use it
|
||||
recordScopeNameStart(scopeDeclaration, scopeName);
|
||||
}
|
||||
else if (scopeDeclaration.kind === SyntaxKind.FunctionDeclaration ||
|
||||
scopeDeclaration.kind === SyntaxKind.FunctionExpression ||
|
||||
scopeDeclaration.kind === SyntaxKind.MethodDeclaration ||
|
||||
scopeDeclaration.kind === SyntaxKind.MethodSignature ||
|
||||
scopeDeclaration.kind === SyntaxKind.GetAccessor ||
|
||||
scopeDeclaration.kind === SyntaxKind.SetAccessor ||
|
||||
scopeDeclaration.kind === SyntaxKind.ModuleDeclaration ||
|
||||
scopeDeclaration.kind === SyntaxKind.ClassDeclaration ||
|
||||
scopeDeclaration.kind === SyntaxKind.EnumDeclaration) {
|
||||
// Declaration and has associated name use it
|
||||
if ((<Declaration>scopeDeclaration).name) {
|
||||
const name = (<Declaration>scopeDeclaration).name;
|
||||
// For computed property names, the text will include the brackets
|
||||
scopeName = name.kind === SyntaxKind.ComputedPropertyName
|
||||
? getTextOfNode(name)
|
||||
: (<Identifier>(<Declaration>scopeDeclaration).name).text;
|
||||
}
|
||||
|
||||
recordScopeNameStart(scopeDeclaration, scopeName);
|
||||
}
|
||||
else {
|
||||
// Block just use the name from upper level scope
|
||||
recordScopeNameIndex(getSourceMapNameIndex());
|
||||
}
|
||||
}
|
||||
|
||||
function popScope() {
|
||||
sourceMapNameIndices.pop();
|
||||
}
|
||||
|
||||
function getText() {
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
|
||||
return stringify({
|
||||
version: 3,
|
||||
file: sourceMapData.sourceMapFile,
|
||||
sourceRoot: sourceMapData.sourceMapSourceRoot,
|
||||
sources: sourceMapData.sourceMapSources,
|
||||
names: sourceMapData.sourceMapNames,
|
||||
mappings: sourceMapData.sourceMapMappings,
|
||||
sourcesContent: sourceMapData.sourceMapSourcesContent,
|
||||
});
|
||||
}
|
||||
|
||||
function getSourceMappingURL() {
|
||||
if (compilerOptions.inlineSourceMap) {
|
||||
// Encode the sourceMap into the sourceMap url
|
||||
const base64SourceMapText = convertToBase64(getText());
|
||||
return sourceMapData.jsSourceMappingURL = `data:application/json;base64,${base64SourceMapText}`;
|
||||
}
|
||||
else {
|
||||
return sourceMapData.jsSourceMappingURL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
function base64FormatEncode(inValue: number) {
|
||||
if (inValue < 64) {
|
||||
return base64Chars.charAt(inValue);
|
||||
}
|
||||
|
||||
throw TypeError(inValue + ": not a 64 based value");
|
||||
}
|
||||
|
||||
function base64VLQFormatEncode(inValue: number) {
|
||||
// Add a new least significant bit that has the sign of the value.
|
||||
// if negative number the least significant bit that gets added to the number has value 1
|
||||
// else least significant bit value that gets added is 0
|
||||
// eg. -1 changes to binary : 01 [1] => 3
|
||||
// +1 changes to binary : 01 [0] => 2
|
||||
if (inValue < 0) {
|
||||
inValue = ((-inValue) << 1) + 1;
|
||||
}
|
||||
else {
|
||||
inValue = inValue << 1;
|
||||
}
|
||||
|
||||
// Encode 5 bits at a time starting from least significant bits
|
||||
let encodedStr = "";
|
||||
do {
|
||||
let currentDigit = inValue & 31; // 11111
|
||||
inValue = inValue >> 5;
|
||||
if (inValue > 0) {
|
||||
// There are still more digits to decode, set the msb (6th bit)
|
||||
currentDigit = currentDigit | 32;
|
||||
}
|
||||
encodedStr = encodedStr + base64FormatEncode(currentDigit);
|
||||
} while (inValue > 0);
|
||||
|
||||
return encodedStr;
|
||||
}
|
||||
}
|
|
@ -205,6 +205,7 @@ namespace ts {
|
|||
IntersectionType,
|
||||
ParenthesizedType,
|
||||
ThisType,
|
||||
StringLiteralType,
|
||||
// Binding patterns
|
||||
ObjectBindingPattern,
|
||||
ArrayBindingPattern,
|
||||
|
@ -350,7 +351,7 @@ namespace ts {
|
|||
FirstFutureReservedWord = ImplementsKeyword,
|
||||
LastFutureReservedWord = YieldKeyword,
|
||||
FirstTypeNode = TypePredicate,
|
||||
LastTypeNode = ThisType,
|
||||
LastTypeNode = StringLiteralType,
|
||||
FirstPunctuation = OpenBraceToken,
|
||||
LastPunctuation = CaretEqualsToken,
|
||||
FirstToken = Unknown,
|
||||
|
@ -790,10 +791,13 @@ namespace ts {
|
|||
type: TypeNode;
|
||||
}
|
||||
|
||||
// Note that a StringLiteral AST node is both an Expression and a TypeNode. The latter is
|
||||
// because string literals can appear in type annotations as well.
|
||||
// @kind(SyntaxKind.StringLiteralType)
|
||||
export interface StringLiteralTypeNode extends LiteralLikeNode, TypeNode {
|
||||
_stringLiteralTypeBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.StringLiteral)
|
||||
export interface StringLiteral extends LiteralExpression, TypeNode {
|
||||
export interface StringLiteral extends LiteralExpression {
|
||||
_stringLiteralBrand: any;
|
||||
}
|
||||
|
||||
|
@ -911,24 +915,32 @@ namespace ts {
|
|||
body: ConciseBody;
|
||||
}
|
||||
|
||||
export interface LiteralLikeNode extends Node {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
}
|
||||
|
||||
// The text property of a LiteralExpression stores the interpreted value of the literal in text form. For a StringLiteral,
|
||||
// or any literal of a template, this means quotes have been removed and escapes have been converted to actual characters.
|
||||
// For a NumericLiteral, the stored value is the toString() representation of the number. For example 1, 1.00, and 1e0 are all stored as just "1".
|
||||
// @kind(SyntaxKind.NumericLiteral)
|
||||
// @kind(SyntaxKind.RegularExpressionLiteral)
|
||||
// @kind(SyntaxKind.NoSubstitutionTemplateLiteral)
|
||||
export interface LiteralExpression extends LiteralLikeNode, PrimaryExpression {
|
||||
_literalExpressionBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.TemplateHead)
|
||||
// @kind(SyntaxKind.TemplateMiddle)
|
||||
// @kind(SyntaxKind.TemplateTail)
|
||||
export interface LiteralExpression extends PrimaryExpression {
|
||||
text: string;
|
||||
isUnterminated?: boolean;
|
||||
hasExtendedUnicodeEscape?: boolean;
|
||||
export interface TemplateLiteralFragment extends LiteralLikeNode {
|
||||
_templateLiteralFragmentBrand: any;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.TemplateExpression)
|
||||
export interface TemplateExpression extends PrimaryExpression {
|
||||
head: LiteralExpression;
|
||||
head: TemplateLiteralFragment;
|
||||
templateSpans: NodeArray<TemplateSpan>;
|
||||
}
|
||||
|
||||
|
@ -937,7 +949,7 @@ namespace ts {
|
|||
// @kind(SyntaxKind.TemplateSpan)
|
||||
export interface TemplateSpan extends Node {
|
||||
expression: Expression;
|
||||
literal: LiteralExpression;
|
||||
literal: TemplateLiteralFragment;
|
||||
}
|
||||
|
||||
// @kind(SyntaxKind.ParenthesizedExpression)
|
||||
|
@ -2360,6 +2372,7 @@ namespace ts {
|
|||
noImplicitReturns?: boolean;
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
allowJs?: boolean;
|
||||
/* @internal */ stripInternal?: boolean;
|
||||
|
||||
|
|
|
@ -466,9 +466,6 @@ namespace ts {
|
|||
return true;
|
||||
case SyntaxKind.VoidKeyword:
|
||||
return node.parent.kind !== SyntaxKind.VoidExpression;
|
||||
case SyntaxKind.StringLiteral:
|
||||
// Specialized signatures can have string literals as their parameters' type names
|
||||
return node.parent.kind === SyntaxKind.Parameter;
|
||||
case SyntaxKind.ExpressionWithTypeArguments:
|
||||
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
|
||||
|
||||
|
@ -1892,7 +1889,7 @@ namespace ts {
|
|||
* Resolves a local path to a path which is absolute to the base of the emit
|
||||
*/
|
||||
export function getExternalModuleNameFromPath(host: EmitHost, fileName: string): string {
|
||||
const dir = host.getCurrentDirectory();
|
||||
const dir = toPath(host.getCommonSourceDirectory(), host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
|
||||
const relativePath = getRelativePathToDirectoryOrUrl(dir, fileName, dir, f => host.getCanonicalFileName(f), /*isAbsolutePathAnUrl*/ false);
|
||||
return removeFileExtension(relativePath);
|
||||
}
|
||||
|
@ -2397,6 +2394,55 @@ namespace ts {
|
|||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize an object graph into a JSON string. This is intended only for use on an acyclic graph
|
||||
* as the fallback implementation does not check for circular references by default.
|
||||
*/
|
||||
export const stringify: (value: any) => string = JSON && JSON.stringify
|
||||
? JSON.stringify
|
||||
: stringifyFallback;
|
||||
|
||||
/**
|
||||
* Serialize an object graph into a JSON string.
|
||||
*/
|
||||
function stringifyFallback(value: any): string {
|
||||
// JSON.stringify returns `undefined` here, instead of the string "undefined".
|
||||
return value === undefined ? undefined : stringifyValue(value);
|
||||
}
|
||||
|
||||
function stringifyValue(value: any): string {
|
||||
return typeof value === "string" ? `"${escapeString(value)}"`
|
||||
: typeof value === "number" ? isFinite(value) ? String(value) : "null"
|
||||
: typeof value === "boolean" ? value ? "true" : "false"
|
||||
: typeof value === "object" && value ? isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
|
||||
: /*fallback*/ "null";
|
||||
}
|
||||
|
||||
function cycleCheck(cb: (value: any) => string, value: any) {
|
||||
Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
|
||||
value.__cycle = true;
|
||||
const result = cb(value);
|
||||
delete value.__cycle;
|
||||
return result;
|
||||
}
|
||||
|
||||
function stringifyArray(value: any) {
|
||||
return `[${reduceLeft(value, stringifyElement, "")}]`;
|
||||
}
|
||||
|
||||
function stringifyElement(memo: string, value: any) {
|
||||
return (memo ? memo + "," : memo) + stringifyValue(value);
|
||||
}
|
||||
|
||||
function stringifyObject(value: any) {
|
||||
return `{${reduceProperties(value, stringifyProperty, "")}}`;
|
||||
}
|
||||
|
||||
function stringifyProperty(memo: string, value: any, key: string) {
|
||||
return value === undefined || typeof value === "function" || key === "__cycle" ? memo
|
||||
: (memo ? memo + "," : memo) + `"${escapeString(key)}":${stringifyValue(value)}`;
|
||||
}
|
||||
|
||||
const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
|
||||
/**
|
||||
|
|
|
@ -1901,7 +1901,7 @@ namespace ts {
|
|||
sourceMapText = text;
|
||||
}
|
||||
else {
|
||||
Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: " + name);
|
||||
Debug.assert(outputText === undefined, `Unexpected multiple outputs for the file: '${name}'`);
|
||||
outputText = text;
|
||||
}
|
||||
},
|
||||
|
@ -3372,6 +3372,7 @@ namespace ts {
|
|||
|
||||
function isInStringOrRegularExpressionOrTemplateLiteral(contextToken: Node): boolean {
|
||||
if (contextToken.kind === SyntaxKind.StringLiteral
|
||||
|| contextToken.kind === SyntaxKind.StringLiteralType
|
||||
|| contextToken.kind === SyntaxKind.RegularExpressionLiteral
|
||||
|| isTemplateLiteralKind(contextToken.kind)) {
|
||||
let start = contextToken.getStart();
|
||||
|
@ -4247,28 +4248,31 @@ namespace ts {
|
|||
}
|
||||
else {
|
||||
// Method/function type parameter
|
||||
let container = getContainingFunction(location);
|
||||
if (container) {
|
||||
let signatureDeclaration = <SignatureDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent;
|
||||
let signature = typeChecker.getSignatureFromDeclaration(signatureDeclaration);
|
||||
if (signatureDeclaration.kind === SyntaxKind.ConstructSignature) {
|
||||
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
|
||||
let declaration = <Node>getDeclarationOfKind(symbol, SyntaxKind.TypeParameter);
|
||||
Debug.assert(declaration !== undefined);
|
||||
declaration = declaration.parent;
|
||||
|
||||
if (declaration) {
|
||||
if (isFunctionLikeKind(declaration.kind)) {
|
||||
const signature = typeChecker.getSignatureFromDeclaration(<SignatureDeclaration>declaration);
|
||||
if (declaration.kind === SyntaxKind.ConstructSignature) {
|
||||
displayParts.push(keywordPart(SyntaxKind.NewKeyword));
|
||||
displayParts.push(spacePart());
|
||||
}
|
||||
else if (declaration.kind !== SyntaxKind.CallSignature && (<SignatureDeclaration>declaration).name) {
|
||||
addFullSymbolName(declaration.symbol);
|
||||
}
|
||||
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature));
|
||||
}
|
||||
else {
|
||||
// Type alias type parameter
|
||||
// For example
|
||||
// type list<T> = T[]; // Both T will go through same code path
|
||||
displayParts.push(keywordPart(SyntaxKind.TypeKeyword));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(declaration.symbol);
|
||||
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
|
||||
}
|
||||
else if (signatureDeclaration.kind !== SyntaxKind.CallSignature && signatureDeclaration.name) {
|
||||
addFullSymbolName(signatureDeclaration.symbol);
|
||||
}
|
||||
addRange(displayParts, signatureToDisplayParts(typeChecker, signature, sourceFile, TypeFormatFlags.WriteTypeArgumentsOfSignature));
|
||||
}
|
||||
else {
|
||||
// Type aliash type parameter
|
||||
// For example
|
||||
// type list<T> = T[]; // Both T will go through same code path
|
||||
let declaration = <TypeAliasDeclaration>getDeclarationOfKind(symbol, SyntaxKind.TypeParameter).parent;
|
||||
displayParts.push(keywordPart(SyntaxKind.TypeKeyword));
|
||||
displayParts.push(spacePart());
|
||||
addFullSymbolName(declaration.symbol);
|
||||
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6369,6 +6373,7 @@ namespace ts {
|
|||
case SyntaxKind.PropertyAccessExpression:
|
||||
case SyntaxKind.QualifiedName:
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
case SyntaxKind.FalseKeyword:
|
||||
case SyntaxKind.TrueKeyword:
|
||||
case SyntaxKind.NullKeyword:
|
||||
|
@ -6830,7 +6835,7 @@ namespace ts {
|
|||
else if (tokenKind === SyntaxKind.NumericLiteral) {
|
||||
return ClassificationType.numericLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.StringLiteral) {
|
||||
else if (tokenKind === SyntaxKind.StringLiteral || tokenKind === SyntaxKind.StringLiteralType) {
|
||||
return ClassificationType.stringLiteral;
|
||||
}
|
||||
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
|
||||
|
@ -7749,7 +7754,7 @@ namespace ts {
|
|||
addResult(start, end, classFromKind(token));
|
||||
|
||||
if (end >= text.length) {
|
||||
if (token === SyntaxKind.StringLiteral) {
|
||||
if (token === SyntaxKind.StringLiteral || token === SyntaxKind.StringLiteralType) {
|
||||
// Check to see if we finished up on a multiline string literal.
|
||||
let tokenText = scanner.getTokenText();
|
||||
if (scanner.isUnterminated()) {
|
||||
|
@ -7899,6 +7904,7 @@ namespace ts {
|
|||
case SyntaxKind.NumericLiteral:
|
||||
return ClassificationType.numericLiteral;
|
||||
case SyntaxKind.StringLiteral:
|
||||
case SyntaxKind.StringLiteralType:
|
||||
return ClassificationType.stringLiteral;
|
||||
case SyntaxKind.RegularExpressionLiteral:
|
||||
return ClassificationType.regularExpressionLiteral;
|
||||
|
|
|
@ -257,14 +257,14 @@ namespace ts {
|
|||
return syntaxList;
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and
|
||||
/* Gets the token whose text has range [start, end) and
|
||||
* position >= start and (position < end or (position === end && token is keyword or identifier))
|
||||
*/
|
||||
export function getTouchingWord(sourceFile: SourceFile, position: number): Node {
|
||||
return getTouchingToken(sourceFile, position, n => isWord(n.kind));
|
||||
}
|
||||
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
/* Gets the token whose text has range [start, end) and position >= start
|
||||
* and (position < end or (position === end && token is keyword or identifier or numeric\string litera))
|
||||
*/
|
||||
export function getTouchingPropertyName(sourceFile: SourceFile, position: number): Node {
|
||||
|
@ -391,8 +391,8 @@ namespace ts {
|
|||
const start = child.getStart(sourceFile);
|
||||
const lookInPreviousChild =
|
||||
(start >= position) || // cursor in the leading trivia
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
|
||||
(child.kind === SyntaxKind.JsxText && start === child.end); // whitespace only JsxText
|
||||
|
||||
if (lookInPreviousChild) {
|
||||
// actual start of the node is past the position - previous token should be at the end of previous child
|
||||
let candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i);
|
||||
|
@ -407,7 +407,7 @@ namespace ts {
|
|||
|
||||
Debug.assert(startNode !== undefined || n.kind === SyntaxKind.SourceFile);
|
||||
|
||||
// Here we know that none of child token nodes embrace the position,
|
||||
// Here we know that none of child token nodes embrace the position,
|
||||
// the only known case is when position is at the end of the file.
|
||||
// Try to find the rightmost token in the file without filtering.
|
||||
// Namely we are skipping the check: 'position < node.end'
|
||||
|
@ -429,7 +429,7 @@ namespace ts {
|
|||
|
||||
export function isInString(sourceFile: SourceFile, position: number) {
|
||||
let token = getTokenAtPosition(sourceFile, position);
|
||||
return token && token.kind === SyntaxKind.StringLiteral && position > token.getStart();
|
||||
return token && (token.kind === SyntaxKind.StringLiteral || token.kind === SyntaxKind.StringLiteralType) && position > token.getStart();
|
||||
}
|
||||
|
||||
export function isInComment(sourceFile: SourceFile, position: number) {
|
||||
|
@ -445,7 +445,7 @@ namespace ts {
|
|||
|
||||
if (token && position <= token.getStart()) {
|
||||
let commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
|
||||
|
||||
|
||||
// The end marker of a single-line comment does not include the newline character.
|
||||
// In the following case, we are inside a comment (^ denotes the cursor position):
|
||||
//
|
||||
|
@ -565,6 +565,7 @@ namespace ts {
|
|||
|
||||
export function isStringOrRegularExpressionOrTemplateLiteral(kind: SyntaxKind): boolean {
|
||||
if (kind === SyntaxKind.StringLiteral
|
||||
|| kind === SyntaxKind.StringLiteralType
|
||||
|| kind === SyntaxKind.RegularExpressionLiteral
|
||||
|| isTemplateLiteralKind(kind)) {
|
||||
return true;
|
||||
|
|
24
tests/baselines/reference/allowSyntheticDefaultImports1.js
Normal file
24
tests/baselines/reference/allowSyntheticDefaultImports1.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports1.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
"use strict";
|
||||
var Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports.Foo = Foo;
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"].Foo();
|
|
@ -0,0 +1,18 @@
|
|||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
|
42
tests/baselines/reference/allowSyntheticDefaultImports2.js
Normal file
42
tests/baselines/reference/allowSyntheticDefaultImports2.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports2.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,17 @@
|
|||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Namespace.Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
>Namespace : Symbol(Namespace, Decl(a.ts, 0, 6))
|
||||
>Foo : Symbol(Namespace.Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.ts, 0, 18))
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
=== tests/cases/compiler/a.ts ===
|
||||
import Namespace from "./b";
|
||||
>Namespace : typeof Namespace
|
||||
|
||||
export var x = new Namespace.Foo();
|
||||
>x : Namespace.Foo
|
||||
>new Namespace.Foo() : Namespace.Foo
|
||||
>Namespace.Foo : typeof Namespace.Foo
|
||||
>Namespace : typeof Namespace
|
||||
>Foo : typeof Namespace.Foo
|
||||
|
||||
=== tests/cases/compiler/b.ts ===
|
||||
export class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Namespace from "./b";
|
||||
~~~~~~~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
==== tests/cases/compiler/b.ts (0 errors) ====
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
43
tests/baselines/reference/allowSyntheticDefaultImports3.js
Normal file
43
tests/baselines/reference/allowSyntheticDefaultImports3.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports3.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
import Namespace from "./b";
|
||||
export var x = new Namespace.Foo();
|
||||
|
||||
//// [b.ts]
|
||||
export class Foo {
|
||||
member: string;
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
Foo = (function () {
|
||||
function Foo() {
|
||||
}
|
||||
return Foo;
|
||||
})();
|
||||
exports_1("Foo", Foo);
|
||||
}
|
||||
}
|
||||
});
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"].Foo());
|
||||
}
|
||||
}
|
||||
});
|
17
tests/baselines/reference/allowSyntheticDefaultImports4.js
Normal file
17
tests/baselines/reference/allowSyntheticDefaultImports4.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports4.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
"use strict";
|
||||
var b_1 = require("./b");
|
||||
exports.x = new b_1["default"]();
|
|
@ -0,0 +1,18 @@
|
|||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
28
tests/baselines/reference/allowSyntheticDefaultImports5.js
Normal file
28
tests/baselines/reference/allowSyntheticDefaultImports5.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports5.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
member: string;
|
||||
>member : Symbol(member, Decl(b.d.ts, 0, 19))
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Symbol(Foo, Decl(b.d.ts, 0, 0))
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Symbol(x, Decl(a.ts, 1, 10))
|
||||
>Foo : Symbol(Foo, Decl(a.ts, 0, 6))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
=== tests/cases/compiler/b.d.ts ===
|
||||
declare class Foo {
|
||||
>Foo : Foo
|
||||
|
||||
member: string;
|
||||
>member : string
|
||||
}
|
||||
export = Foo;
|
||||
>Foo : Foo
|
||||
|
||||
=== tests/cases/compiler/a.ts ===
|
||||
import Foo from "./b";
|
||||
>Foo : typeof Foo
|
||||
|
||||
export var x = new Foo();
|
||||
>x : Foo
|
||||
>new Foo() : Foo
|
||||
>Foo : typeof Foo
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
tests/cases/compiler/a.ts(1,8): error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
|
||||
|
||||
==== tests/cases/compiler/b.d.ts (0 errors) ====
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
==== tests/cases/compiler/a.ts (1 errors) ====
|
||||
import Foo from "./b";
|
||||
~~~
|
||||
!!! error TS1192: Module '"tests/cases/compiler/b"' has no default export.
|
||||
export var x = new Foo();
|
||||
|
28
tests/baselines/reference/allowSyntheticDefaultImports6.js
Normal file
28
tests/baselines/reference/allowSyntheticDefaultImports6.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
//// [tests/cases/compiler/allowSyntheticDefaultImports6.ts] ////
|
||||
|
||||
//// [b.d.ts]
|
||||
declare class Foo {
|
||||
member: string;
|
||||
}
|
||||
export = Foo;
|
||||
|
||||
//// [a.ts]
|
||||
import Foo from "./b";
|
||||
export var x = new Foo();
|
||||
|
||||
|
||||
//// [a.js]
|
||||
System.register(["./b"], function(exports_1) {
|
||||
"use strict";
|
||||
var b_1;
|
||||
var x;
|
||||
return {
|
||||
setters:[
|
||||
function (b_1_1) {
|
||||
b_1 = b_1_1;
|
||||
}],
|
||||
execute: function() {
|
||||
exports_1("x", x = new b_1["default"]());
|
||||
}
|
||||
}
|
||||
});
|
32
tests/baselines/reference/commonSourceDir5.js
Normal file
32
tests/baselines/reference/commonSourceDir5.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
//// [tests/cases/compiler/commonSourceDir5.ts] ////
|
||||
|
||||
//// [bar.ts]
|
||||
import {z} from "./foo";
|
||||
export var x = z + z;
|
||||
|
||||
//// [foo.ts]
|
||||
import {pi} from "B:/baz";
|
||||
export var i = Math.sqrt(-1);
|
||||
export var z = pi * pi;
|
||||
|
||||
//// [baz.ts]
|
||||
import {x} from "A:/bar";
|
||||
import {i} from "A:/foo";
|
||||
export var pi = Math.PI;
|
||||
export var y = x * i;
|
||||
|
||||
//// [concat.js]
|
||||
define("B:/baz", ["require", "exports", "A:/bar", "A:/foo"], function (require, exports, bar_1, foo_1) {
|
||||
"use strict";
|
||||
exports.pi = Math.PI;
|
||||
exports.y = bar_1.x * foo_1.i;
|
||||
});
|
||||
define("A:/foo", ["require", "exports", "B:/baz"], function (require, exports, baz_1) {
|
||||
"use strict";
|
||||
exports.i = Math.sqrt(-1);
|
||||
exports.z = baz_1.pi * baz_1.pi;
|
||||
});
|
||||
define("A:/bar", ["require", "exports", "A:/foo"], function (require, exports, foo_2) {
|
||||
"use strict";
|
||||
exports.x = foo_2.z + foo_2.z;
|
||||
});
|
42
tests/baselines/reference/commonSourceDir5.symbols
Normal file
42
tests/baselines/reference/commonSourceDir5.symbols
Normal file
|
@ -0,0 +1,42 @@
|
|||
=== A:/bar.ts ===
|
||||
import {z} from "./foo";
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
|
||||
export var x = z + z;
|
||||
>x : Symbol(x, Decl(bar.ts, 1, 10))
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
|
||||
=== A:/foo.ts ===
|
||||
import {pi} from "B:/baz";
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
|
||||
export var i = Math.sqrt(-1);
|
||||
>i : Symbol(i, Decl(foo.ts, 1, 10))
|
||||
>Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
|
||||
|
||||
export var z = pi * pi;
|
||||
>z : Symbol(z, Decl(foo.ts, 2, 10))
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
|
||||
=== B:/baz.ts ===
|
||||
import {x} from "A:/bar";
|
||||
>x : Symbol(x, Decl(baz.ts, 0, 8))
|
||||
|
||||
import {i} from "A:/foo";
|
||||
>i : Symbol(i, Decl(baz.ts, 1, 8))
|
||||
|
||||
export var pi = Math.PI;
|
||||
>pi : Symbol(pi, Decl(baz.ts, 2, 10))
|
||||
>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
|
||||
export var y = x * i;
|
||||
>y : Symbol(y, Decl(baz.ts, 3, 10))
|
||||
>x : Symbol(x, Decl(baz.ts, 0, 8))
|
||||
>i : Symbol(i, Decl(baz.ts, 1, 8))
|
||||
|
48
tests/baselines/reference/commonSourceDir5.types
Normal file
48
tests/baselines/reference/commonSourceDir5.types
Normal file
|
@ -0,0 +1,48 @@
|
|||
=== A:/bar.ts ===
|
||||
import {z} from "./foo";
|
||||
>z : number
|
||||
|
||||
export var x = z + z;
|
||||
>x : number
|
||||
>z + z : number
|
||||
>z : number
|
||||
>z : number
|
||||
|
||||
=== A:/foo.ts ===
|
||||
import {pi} from "B:/baz";
|
||||
>pi : number
|
||||
|
||||
export var i = Math.sqrt(-1);
|
||||
>i : number
|
||||
>Math.sqrt(-1) : number
|
||||
>Math.sqrt : (x: number) => number
|
||||
>Math : Math
|
||||
>sqrt : (x: number) => number
|
||||
>-1 : number
|
||||
>1 : number
|
||||
|
||||
export var z = pi * pi;
|
||||
>z : number
|
||||
>pi * pi : number
|
||||
>pi : number
|
||||
>pi : number
|
||||
|
||||
=== B:/baz.ts ===
|
||||
import {x} from "A:/bar";
|
||||
>x : number
|
||||
|
||||
import {i} from "A:/foo";
|
||||
>i : number
|
||||
|
||||
export var pi = Math.PI;
|
||||
>pi : number
|
||||
>Math.PI : number
|
||||
>Math : Math
|
||||
>PI : number
|
||||
|
||||
export var y = x * i;
|
||||
>y : number
|
||||
>x * i : number
|
||||
>x : number
|
||||
>i : number
|
||||
|
32
tests/baselines/reference/commonSourceDir6.js
Normal file
32
tests/baselines/reference/commonSourceDir6.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
//// [tests/cases/compiler/commonSourceDir6.ts] ////
|
||||
|
||||
//// [bar.ts]
|
||||
import {z} from "./foo";
|
||||
export var x = z + z;
|
||||
|
||||
//// [foo.ts]
|
||||
import {pi} from "../baz";
|
||||
export var i = Math.sqrt(-1);
|
||||
export var z = pi * pi;
|
||||
|
||||
//// [baz.ts]
|
||||
import {x} from "a/bar";
|
||||
import {i} from "a/foo";
|
||||
export var pi = Math.PI;
|
||||
export var y = x * i;
|
||||
|
||||
//// [concat.js]
|
||||
define("tests/cases/compiler/baz", ["require", "exports", "tests/cases/compiler/a/bar", "tests/cases/compiler/a/foo"], function (require, exports, bar_1, foo_1) {
|
||||
"use strict";
|
||||
exports.pi = Math.PI;
|
||||
exports.y = bar_1.x * foo_1.i;
|
||||
});
|
||||
define("tests/cases/compiler/a/foo", ["require", "exports", "tests/cases/compiler/baz"], function (require, exports, baz_1) {
|
||||
"use strict";
|
||||
exports.i = Math.sqrt(-1);
|
||||
exports.z = baz_1.pi * baz_1.pi;
|
||||
});
|
||||
define("tests/cases/compiler/a/bar", ["require", "exports", "tests/cases/compiler/a/foo"], function (require, exports, foo_2) {
|
||||
"use strict";
|
||||
exports.x = foo_2.z + foo_2.z;
|
||||
});
|
42
tests/baselines/reference/commonSourceDir6.symbols
Normal file
42
tests/baselines/reference/commonSourceDir6.symbols
Normal file
|
@ -0,0 +1,42 @@
|
|||
=== tests/cases/compiler/a/bar.ts ===
|
||||
import {z} from "./foo";
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
|
||||
export var x = z + z;
|
||||
>x : Symbol(x, Decl(bar.ts, 1, 10))
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
>z : Symbol(z, Decl(bar.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/a/foo.ts ===
|
||||
import {pi} from "../baz";
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
|
||||
export var i = Math.sqrt(-1);
|
||||
>i : Symbol(i, Decl(foo.ts, 1, 10))
|
||||
>Math.sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>sqrt : Symbol(Math.sqrt, Decl(lib.d.ts, --, --))
|
||||
|
||||
export var z = pi * pi;
|
||||
>z : Symbol(z, Decl(foo.ts, 2, 10))
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
>pi : Symbol(pi, Decl(foo.ts, 0, 8))
|
||||
|
||||
=== tests/cases/compiler/baz.ts ===
|
||||
import {x} from "a/bar";
|
||||
>x : Symbol(x, Decl(baz.ts, 0, 8))
|
||||
|
||||
import {i} from "a/foo";
|
||||
>i : Symbol(i, Decl(baz.ts, 1, 8))
|
||||
|
||||
export var pi = Math.PI;
|
||||
>pi : Symbol(pi, Decl(baz.ts, 2, 10))
|
||||
>Math.PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
>Math : Symbol(Math, Decl(lib.d.ts, --, --), Decl(lib.d.ts, --, --))
|
||||
>PI : Symbol(Math.PI, Decl(lib.d.ts, --, --))
|
||||
|
||||
export var y = x * i;
|
||||
>y : Symbol(y, Decl(baz.ts, 3, 10))
|
||||
>x : Symbol(x, Decl(baz.ts, 0, 8))
|
||||
>i : Symbol(i, Decl(baz.ts, 1, 8))
|
||||
|
48
tests/baselines/reference/commonSourceDir6.types
Normal file
48
tests/baselines/reference/commonSourceDir6.types
Normal file
|
@ -0,0 +1,48 @@
|
|||
=== tests/cases/compiler/a/bar.ts ===
|
||||
import {z} from "./foo";
|
||||
>z : number
|
||||
|
||||
export var x = z + z;
|
||||
>x : number
|
||||
>z + z : number
|
||||
>z : number
|
||||
>z : number
|
||||
|
||||
=== tests/cases/compiler/a/foo.ts ===
|
||||
import {pi} from "../baz";
|
||||
>pi : number
|
||||
|
||||
export var i = Math.sqrt(-1);
|
||||
>i : number
|
||||
>Math.sqrt(-1) : number
|
||||
>Math.sqrt : (x: number) => number
|
||||
>Math : Math
|
||||
>sqrt : (x: number) => number
|
||||
>-1 : number
|
||||
>1 : number
|
||||
|
||||
export var z = pi * pi;
|
||||
>z : number
|
||||
>pi * pi : number
|
||||
>pi : number
|
||||
>pi : number
|
||||
|
||||
=== tests/cases/compiler/baz.ts ===
|
||||
import {x} from "a/bar";
|
||||
>x : number
|
||||
|
||||
import {i} from "a/foo";
|
||||
>i : number
|
||||
|
||||
export var pi = Math.PI;
|
||||
>pi : number
|
||||
>Math.PI : number
|
||||
>Math : Math
|
||||
>PI : number
|
||||
|
||||
export var y = x * i;
|
||||
>y : number
|
||||
>x * i : number
|
||||
>x : number
|
||||
>i : number
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
//// [decoratedDefaultExportsGetExportedAmd.ts]
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedAmd.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
var decorator;
|
||||
let Foo = class {
|
||||
};
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
exports.default = Foo;
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedAmd.ts, 1, 30))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsAmd/decoratedDefaultExportsGetExportedAmd.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
//// [decoratedDefaultExportsGetExportedCommonjs.ts]
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedCommonjs.js]
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var decorator;
|
||||
let Foo = class {
|
||||
};
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
exports.default = Foo;
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedCommonjs.ts, 1, 30))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsCommonjs/decoratedDefaultExportsGetExportedCommonjs.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
//// [decoratedDefaultExportsGetExportedSystem.ts]
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedSystem.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var decorator, Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
let Foo = class {
|
||||
};
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
exports_1("default", Foo);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedSystem.ts, 1, 30))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsSystem/decoratedDefaultExportsGetExportedSystem.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//// [decoratedDefaultExportsGetExportedUmd.ts]
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
|
||||
@decorator
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [decoratedDefaultExportsGetExportedUmd.js]
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
var decorator;
|
||||
let Foo = class {
|
||||
};
|
||||
Foo = __decorate([
|
||||
decorator
|
||||
], Foo);
|
||||
exports.default = Foo;
|
||||
});
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
|
||||
>ClassDecorator : Symbol(ClassDecorator, Decl(lib.d.ts, --, --))
|
||||
|
||||
@decorator
|
||||
>decorator : Symbol(decorator, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 3))
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(decoratedDefaultExportsGetExportedUmd.ts, 1, 30))
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsUmd/decoratedDefaultExportsGetExportedUmd.ts ===
|
||||
|
||||
var decorator: ClassDecorator;
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
>ClassDecorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
@decorator
|
||||
>decorator : <TFunction extends Function>(target: TFunction) => TFunction | void
|
||||
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
11
tests/baselines/reference/defaultExportsGetExportedAmd.js
Normal file
11
tests/baselines/reference/defaultExportsGetExportedAmd.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
//// [defaultExportsGetExportedAmd.ts]
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [defaultExportsGetExportedAmd.js]
|
||||
define(["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
exports.default = Foo;
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedAmd.ts, 0, 0))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsAmd/defaultExportsGetExportedAmd.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
//// [defaultExportsGetExportedCommonjs.ts]
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [defaultExportsGetExportedCommonjs.js]
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
exports.default = Foo;
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedCommonjs.ts, 0, 0))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsCommonjs/defaultExportsGetExportedCommonjs.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
17
tests/baselines/reference/defaultExportsGetExportedSystem.js
Normal file
17
tests/baselines/reference/defaultExportsGetExportedSystem.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
//// [defaultExportsGetExportedSystem.ts]
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [defaultExportsGetExportedSystem.js]
|
||||
System.register([], function(exports_1) {
|
||||
"use strict";
|
||||
var Foo;
|
||||
return {
|
||||
setters:[],
|
||||
execute: function() {
|
||||
class Foo {
|
||||
}
|
||||
exports_1("default", Foo);
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedSystem.ts, 0, 0))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsSystem/defaultExportsGetExportedSystem.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
18
tests/baselines/reference/defaultExportsGetExportedUmd.js
Normal file
18
tests/baselines/reference/defaultExportsGetExportedUmd.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
//// [defaultExportsGetExportedUmd.ts]
|
||||
export default class Foo {}
|
||||
|
||||
|
||||
//// [defaultExportsGetExportedUmd.js]
|
||||
(function (factory) {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
var v = factory(require, exports); if (v !== undefined) module.exports = v;
|
||||
}
|
||||
else if (typeof define === 'function' && define.amd) {
|
||||
define(["require", "exports"], factory);
|
||||
}
|
||||
})(function (require, exports) {
|
||||
"use strict";
|
||||
class Foo {
|
||||
}
|
||||
exports.default = Foo;
|
||||
});
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Symbol(Foo, Decl(defaultExportsGetExportedUmd.ts, 0, 0))
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
=== tests/cases/conformance/es6/moduleExportsUmd/defaultExportsGetExportedUmd.ts ===
|
||||
export default class Foo {}
|
||||
>Foo : Foo
|
||||
|
|
@ -23,7 +23,7 @@ declare class Foo {
|
|||
x: string;
|
||||
y: number;
|
||||
}
|
||||
declare module "tests/cases/fourslash/inputFile3" {
|
||||
declare module "inputFile3" {
|
||||
export var foo: number;
|
||||
export var bar: string;
|
||||
}
|
||||
|
|
25
tests/baselines/reference/jsFileCompilationBindErrors.js
Normal file
25
tests/baselines/reference/jsFileCompilationBindErrors.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
//// [a.js]
|
||||
let C = "sss";
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
|
||||
function f() {
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
var C = "sss";
|
||||
var C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
function f() {
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
function b() {
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
let C = "sss";
|
||||
>C : Symbol(C, Decl(a.js, 0, 3))
|
||||
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
>C : Symbol(C, Decl(a.js, 1, 3))
|
||||
|
||||
function f() {
|
||||
>f : Symbol(f, Decl(a.js, 1, 10))
|
||||
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
>b : Symbol(b, Decl(a.js, 6, 1))
|
||||
|
||||
"use strict";
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
>arguments : Symbol(arguments, Decl(a.js, 10, 7))
|
||||
}
|
26
tests/baselines/reference/jsFileCompilationBindErrors.types
Normal file
26
tests/baselines/reference/jsFileCompilationBindErrors.types
Normal file
|
@ -0,0 +1,26 @@
|
|||
=== tests/cases/compiler/a.js ===
|
||||
let C = "sss";
|
||||
>C : string
|
||||
>"sss" : string
|
||||
|
||||
let C = 0; // Error: Cannot redeclare block-scoped variable 'C'.
|
||||
>C : number
|
||||
>0 : number
|
||||
|
||||
function f() {
|
||||
>f : () => void
|
||||
|
||||
return;
|
||||
return; // Error: Unreachable code detected.
|
||||
}
|
||||
|
||||
function b() {
|
||||
>b : () => void
|
||||
|
||||
"use strict";
|
||||
>"use strict" : string
|
||||
|
||||
var arguments = 0; // Error: Invalid use of 'arguments' in strict mode.
|
||||
>arguments : number
|
||||
>0 : number
|
||||
}
|
63
tests/baselines/reference/overloadConsecutiveness.errors.txt
Normal file
63
tests/baselines/reference/overloadConsecutiveness.errors.txt
Normal file
|
@ -0,0 +1,63 @@
|
|||
tests/cases/compiler/overloadConsecutiveness.ts(3,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(3,14): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(3,25): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(4,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(4,14): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(5,10): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(5,17): error TS1128: Declaration or statement expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(5,28): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(8,2): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(8,6): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(8,8): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(9,2): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(9,6): error TS1144: '{' or ';' expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(10,2): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(10,9): error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
tests/cases/compiler/overloadConsecutiveness.ts(10,11): error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
|
||||
==== tests/cases/compiler/overloadConsecutiveness.ts (16 errors) ====
|
||||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional.
|
||||
|
||||
function f1(), function f1();
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
function f2(), function f2() {}
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
function f3() {}, function f3();
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
|
||||
class C {
|
||||
m1(), m1();
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
m2(), m2() {}
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
m3() {}, m3();
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
~
|
||||
!!! error TS1068: Unexpected token. A constructor, method, accessor, or property was expected.
|
||||
~~
|
||||
!!! error TS2391: Function implementation is missing or not immediately following the declaration.
|
||||
}
|
||||
|
27
tests/baselines/reference/overloadConsecutiveness.js
Normal file
27
tests/baselines/reference/overloadConsecutiveness.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
//// [overloadConsecutiveness.ts]
|
||||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional.
|
||||
|
||||
function f1(), function f1();
|
||||
function f2(), function f2() {}
|
||||
function f3() {}, function f3();
|
||||
|
||||
class C {
|
||||
m1(), m1();
|
||||
m2(), m2() {}
|
||||
m3() {}, m3();
|
||||
}
|
||||
|
||||
|
||||
//// [overloadConsecutiveness.js]
|
||||
// Making sure compiler won't break with declarations that are consecutive in the AST but not consecutive in the source. Syntax errors intentional.
|
||||
function f2() { }
|
||||
function f3() { }
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
C.prototype.m1 = ;
|
||||
C.prototype.m2 = ;
|
||||
C.prototype.m2 = function () { };
|
||||
C.prototype.m3 = function () { };
|
||||
return C;
|
||||
})();
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ sources: ../ref/m1.ts,../../outputdir_module_multifolder_ref/m2.ts,../test.ts
|
|||
emittedFile:bin/test.js
|
||||
sourceFile:../ref/m1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m1_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -175,7 +175,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:../../outputdir_module_multifolder_ref/m2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m2_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -342,7 +342,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:../test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>> "use strict";
|
||||
>>> exports.a1 = 10;
|
||||
1 >^^^^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ sources: ../projects/outputdir_module_multifolder/ref/m1.ts,../projects/outputdi
|
|||
emittedFile:bin/test.js
|
||||
sourceFile:../projects/outputdir_module_multifolder/ref/m1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m1_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -175,7 +175,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:../projects/outputdir_module_multifolder_ref/m2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m2_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -342,7 +342,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:../projects/outputdir_module_multifolder/test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>> "use strict";
|
||||
>>> exports.a1 = 10;
|
||||
1 >^^^^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ sources: file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts,fil
|
|||
emittedFile:bin/test.js
|
||||
sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/ref/m1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m1_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -175,7 +175,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:file:///tests/cases/projects/outputdir_module_multifolder_ref/m2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m2_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -342,7 +342,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:file:///tests/cases/projects/outputdir_module_multifolder/test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>> "use strict";
|
||||
>>> exports.a1 = 10;
|
||||
1 >^^^^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref
|
|||
emittedFile:bin/test.js
|
||||
sourceFile:outputdir_module_multifolder/ref/m1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m1_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -175,7 +175,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:outputdir_module_multifolder_ref/m2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m2_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -342,7 +342,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:outputdir_module_multifolder/test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>> "use strict";
|
||||
>>> exports.a1 = 10;
|
||||
1 >^^^^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ sources: outputdir_module_multifolder/ref/m1.ts,outputdir_module_multifolder_ref
|
|||
emittedFile:bin/test.js
|
||||
sourceFile:outputdir_module_multifolder/ref/m1.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m1_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -175,7 +175,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:outputdir_module_multifolder_ref/m2.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>>define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
>>> "use strict";
|
||||
>>> exports.m2_a1 = 10;
|
||||
1 >^^^^
|
||||
|
@ -342,7 +342,7 @@ emittedFile:bin/test.js
|
|||
sourceFile:outputdir_module_multifolder/test.ts
|
||||
-------------------------------------------------------------------
|
||||
>>>});
|
||||
>>>define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>>define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
>>> "use strict";
|
||||
>>> exports.a1 = 10;
|
||||
1 >^^^^
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
declare module "ref/m1" {
|
||||
declare module "outputdir_module_multifolder/ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
|
@ -6,7 +6,7 @@ declare module "ref/m1" {
|
|||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
declare module "outputdir_module_multifolder_ref/m2" {
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
|
@ -15,8 +15,8 @@ declare module "../outputdir_module_multifolder_ref/m2" {
|
|||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
import m1 = require("outputdir_module_multifolder/ref/m1");
|
||||
import m2 = require("outputdir_module_multifolder_ref/m2");
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
define("ref/m1", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder/ref/m1", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m1_a1 = 10;
|
||||
var m1_c1 = (function () {
|
||||
|
@ -13,7 +13,7 @@ define("ref/m1", ["require", "exports"], function (require, exports) {
|
|||
}
|
||||
exports.m1_f1 = m1_f1;
|
||||
});
|
||||
define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
define("outputdir_module_multifolder_ref/m2", ["require", "exports"], function (require, exports) {
|
||||
"use strict";
|
||||
exports.m2_a1 = 10;
|
||||
var m2_c1 = (function () {
|
||||
|
@ -28,7 +28,7 @@ define("../outputdir_module_multifolder_ref/m2", ["require", "exports"], functio
|
|||
}
|
||||
exports.m2_f1 = m2_f1;
|
||||
});
|
||||
define("test", ["require", "exports", "ref/m1", "../outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
define("test", ["require", "exports", "outputdir_module_multifolder/ref/m1", "outputdir_module_multifolder_ref/m2"], function (require, exports, m1, m2) {
|
||||
"use strict";
|
||||
exports.a1 = 10;
|
||||
var c1 = (function () {
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
bin/test.d.ts(9,16): error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
bin/test.d.ts(19,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
bin/test.d.ts(19,25): error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
|
||||
|
||||
==== bin/test.d.ts (3 errors) ====
|
||||
declare module "ref/m1" {
|
||||
export var m1_a1: number;
|
||||
export class m1_c1 {
|
||||
m1_c1_p1: number;
|
||||
}
|
||||
export var m1_instance1: m1_c1;
|
||||
export function m1_f1(): m1_c1;
|
||||
}
|
||||
declare module "../outputdir_module_multifolder_ref/m2" {
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2436: Ambient module declaration cannot specify relative module name.
|
||||
export var m2_a1: number;
|
||||
export class m2_c1 {
|
||||
m2_c1_p1: number;
|
||||
}
|
||||
export var m2_instance1: m2_c1;
|
||||
export function m2_f1(): m2_c1;
|
||||
}
|
||||
declare module "test" {
|
||||
import m1 = require("ref/m1");
|
||||
import m2 = require("../outputdir_module_multifolder_ref/m2");
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2307: Cannot find module '../outputdir_module_multifolder_ref/m2'.
|
||||
export var a1: number;
|
||||
export class c1 {
|
||||
p1: number;
|
||||
}
|
||||
export var instance1: c1;
|
||||
export function f1(): c1;
|
||||
export var a2: typeof m1.m1_c1;
|
||||
export var a3: typeof m2.m2_c1;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue