diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f3fba142213f6..f76a2164d8b3f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3015,7 +3015,7 @@ namespace ts { const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | NodeBuilderFlags.IgnoreErrors | NodeBuilderFlags.WriteTypeParametersInQualifiedName); const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true }); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); - printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, writer); // TODO: GH#18217 + printer.writeNode(EmitHint.Unspecified, sig!, /*sourceFile*/ sourceFile, getTrailingSemicolonOmittingWriter(writer)); // TODO: GH#18217 return writer; } } diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index 00920325721a0..d8a916cbcbdfd 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -545,6 +545,12 @@ namespace ts { category: Diagnostics.Advanced_Options, description: Diagnostics.Show_verbose_diagnostic_information }, + { + name: "removeWhitespace", + type: "boolean", + category: Diagnostics.Advanced_Options, + description: Diagnostics.Do_not_emit_insignificant_whitespace_or_insignificant_trailing_semicolons_to_output + }, { name: "traceResolution", type: "boolean", diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index 7dfda66c96579..92423ac785cdd 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -155,13 +155,13 @@ namespace ts { writer.writeLine(); } else { - writer.write(" "); + writer.writeSpace(" "); } } function emitTrailingSynthesizedComment(comment: SynthesizedComment) { if (!writer.isAtStartOfLine()) { - writer.write(" "); + writer.writeSpace(" "); } writeSynthesizedComment(comment); if (comment.hasTrailingNewLine) { @@ -283,7 +283,7 @@ namespace ts { writer.writeLine(); } else if (kind === SyntaxKind.MultiLineCommentTrivia) { - writer.write(" "); + writer.writeSpace(" "); } } @@ -303,7 +303,7 @@ namespace ts { if (!shouldWriteComment(currentText, commentPos)) return; // trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/ if (!writer.isAtStartOfLine()) { - writer.write(" "); + writer.writeSpace(" "); } if (emitPos) emitPos(commentPos); @@ -342,7 +342,7 @@ namespace ts { writer.writeLine(); } else { - writer.write(" "); + writer.writeSpace(" "); } } diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 1eaab5b1b59e0..c1a5234afe369 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -428,8 +428,8 @@ namespace ts { array.length = outIndex; } - export function clear(array: {}[]): void { - array.length = 0; + export function clear(array: {}[] | undefined): void { + if (array) array.length = 0; } export function map(array: ReadonlyArray, f: (x: T, i: number) => U): U[]; diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 16b064f255cc4..4fa661a85d94d 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -3672,6 +3672,12 @@ "code": 6205 }, + "Do not emit insignificant whitespace or insignificant trailing semicolons to output.": { + "category": "Message", + "code": 6206 + }, + + "Projects to reference": { "category": "Message", "code": 6300 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index badbfc4fa3fa6..b13033d49c739 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -100,9 +100,10 @@ namespace ts { const sourceMapDataList: SourceMapData[] | undefined = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined; const emittedFilesList: string[] | undefined = compilerOptions.listEmittedFiles ? [] : undefined; const emitterDiagnostics = createDiagnosticCollection(); - const newLine = host.getNewLine(); + const newLine = getNewLineCharacter(compilerOptions, () => host.getNewLine()); const writer = createTextWriter(newLine); - const sourceMap = createSourceMapWriter(host, writer); + const javaScriptWriter = compilerOptions.removeWhitespace ? getWhitespaceRemovingTextWriter(writer) : writer; + const sourceMap = createSourceMapWriter(host, javaScriptWriter); const declarationSourceMap = createSourceMapWriter(host, writer, { sourceMap: compilerOptions.declarationMap, sourceRoot: compilerOptions.sourceRoot, @@ -161,8 +162,20 @@ namespace ts { // Transform the source files const transform = transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers!, /*allowDtsFiles*/ false); + const printerOptions: PrinterOptions = { + removeComments: compilerOptions.removeComments, + removeWhitespace: compilerOptions.removeWhitespace, + newLine: compilerOptions.newLine, + noEmitHelpers: compilerOptions.noEmitHelpers, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: compilerOptions.sourceMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + }; + // Create a printer to print the nodes - const printer = createPrinter({ ...compilerOptions, noEmitHelpers: compilerOptions.noEmitHelpers } as PrinterOptions, { + const printer = createPrinter(printerOptions, { // resolver hooks hasGlobalName: resolver.hasGlobalName, @@ -180,7 +193,7 @@ namespace ts { }); Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform"); - printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], bundleInfoPath, printer, sourceMap); + printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], bundleInfoPath, printer, sourceMap, javaScriptWriter); // Clean up emit nodes on parse tree transform.dispose(); @@ -205,7 +218,20 @@ namespace ts { emitterDiagnostics.add(diagnostic); } } - const declarationPrinter = createPrinter({ ...compilerOptions, onlyPrintJsDocStyle: true, noEmitHelpers: true } as PrinterOptions, { + + const printerOptions: PrinterOptions = { + removeComments: compilerOptions.removeComments, + newLine: compilerOptions.newLine, + noEmitHelpers: true, + module: compilerOptions.module, + target: compilerOptions.target, + sourceMap: compilerOptions.sourceMap, + inlineSourceMap: compilerOptions.inlineSourceMap, + extendedDiagnostics: compilerOptions.extendedDiagnostics, + onlyPrintJsDocStyle: true, + }; + + const declarationPrinter = createPrinter(printerOptions, { // resolver hooks hasGlobalName: resolver.hasGlobalName, @@ -223,7 +249,7 @@ namespace ts { emitSkipped = emitSkipped || declBlocked; if (!declBlocked || emitOnlyDtsFiles) { Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform"); - printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], /* bundleInfopath*/ undefined, declarationPrinter, declarationSourceMap); + printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], /* bundleInfopath*/ undefined, declarationPrinter, declarationSourceMap, writer); if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { const sourceFile = declarationTransform.transformed[0] as SourceFile; exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; @@ -246,7 +272,7 @@ namespace ts { forEachChild(node, collectLinkedAliases); } - function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, bundleInfoPath: string | undefined, printer: Printer, mapRecorder: SourceMapWriter) { + function printSourceFileOrBundle(jsFilePath: string, sourceMapFilePath: string | undefined, sourceFileOrBundle: SourceFile | Bundle, bundleInfoPath: string | undefined, printer: Printer, mapRecorder: SourceMapWriter, writer: EmitTextWriter) { const bundle = sourceFileOrBundle.kind === SyntaxKind.Bundle ? sourceFileOrBundle : undefined; const sourceFile = sourceFileOrBundle.kind === SyntaxKind.SourceFile ? sourceFileOrBundle : undefined; const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile!]; @@ -259,16 +285,22 @@ namespace ts { printer.writeFile(sourceFile!, writer); } - writer.writeLine(); - const sourceMappingURL = mapRecorder.getSourceMappingURL(); if (sourceMappingURL) { - writer.write(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Sometimes tools can sometimes see this line as a source mapping url comment + writer.flush(); + if (!writer.isAtStartOfLine()) writer.rawWrite(newLine); + writer.writeComment(`//# ${"sourceMappingURL"}=${sourceMappingURL}`); // Tools can sometimes see this line as a source mapping url comment + } + else { + writer.writeLine(); } // Write the source map - if (sourceMapFilePath) { - writeFile(host, emitterDiagnostics, sourceMapFilePath, mapRecorder.getText(), /*writeByteOrderMark*/ false, sourceFiles); + if (sourceMapFilePath && sourceMap) { + const sourceMap = mapRecorder.getText(); + if (sourceMap) { + writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, /*writeByteOrderMark*/ false, sourceFiles); + } } // Write the output file @@ -319,6 +351,7 @@ namespace ts { } = handlers; const newLine = getNewLineCharacter(printerOptions); + const removeWhitespace = printerOptions.removeWhitespace; const comments = createCommentWriter(printerOptions, onEmitSourceMapOfPosition); const { emitNodeWithComments, @@ -339,13 +372,6 @@ namespace ts { let writer: EmitTextWriter; let ownWriter: EmitTextWriter; let write = writeBase; - let commitPendingSemicolon: typeof commitPendingSemicolonInternal = noop; - let writeSemicolon: typeof writeSemicolonInternal = writeSemicolonInternal; - let pendingSemicolon = false; - if (printerOptions.omitTrailingSemicolon) { - commitPendingSemicolon = commitPendingSemicolonInternal; - writeSemicolon = deferWriteSemicolon; - } const syntheticParent: TextRange = { pos: -1, end: -1 }; const moduleKind = getEmitModuleKind(printerOptions); const bundledHelpers = createMap(); @@ -441,8 +467,8 @@ namespace ts { emitSyntheticTripleSlashReferencesIfNeeded(bundle); for (const prepend of bundle.prepends) { - print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined); writeLine(); + print(EmitHint.Unspecified, prepend, /*sourceFile*/ undefined); } if (bundleInfo) { @@ -503,6 +529,9 @@ namespace ts { } function setWriter(output: EmitTextWriter | undefined) { + if (output && printerOptions.omitTrailingSemicolon) { + output = getTrailingSemicolonOmittingWriter(output); + } writer = output!; // TODO: GH#18217 comments.setWriter(output!); } @@ -592,6 +621,10 @@ namespace ts { if (hint === EmitHint.SourceFile) return emitSourceFile(cast(node, isSourceFile)); if (hint === EmitHint.IdentifierName) return emitIdentifier(cast(node, isIdentifier)); if (hint === EmitHint.MappedTypeParameter) return emitMappedTypeParameter(cast(node, isTypeParameterDeclaration)); + if (hint === EmitHint.EmbeddedStatement) { + Debug.assertNode(node, isEmptyStatement); + return emitEmptyStatement(/*isEmbeddedStatement*/ true); + } if (hint === EmitHint.Unspecified) { if (isKeyword(node.kind)) return writeTokenNode(node, writeKeyword); @@ -692,10 +725,10 @@ namespace ts { case SyntaxKind.ImportType: return emitImportTypeNode(node); case SyntaxKind.JSDocAllType: - write("*"); + writePunctuation("*"); return; case SyntaxKind.JSDocUnknownType: - write("?"); + writePunctuation("?"); return; case SyntaxKind.JSDocNullableType: return emitJSDocNullableType(node as JSDocNullableType); @@ -727,7 +760,7 @@ namespace ts { case SyntaxKind.VariableStatement: return emitVariableStatement(node); case SyntaxKind.EmptyStatement: - return emitEmptyStatement(); + return emitEmptyStatement(/*isEmbeddedStatement*/ false); case SyntaxKind.ExpressionStatement: return emitExpressionStatement(node); case SyntaxKind.IfStatement: @@ -1143,7 +1176,7 @@ namespace ts { emitNodeWithWriter(node.name, writeProperty); emit(node.questionToken); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitPropertyDeclaration(node: PropertyDeclaration) { @@ -1154,7 +1187,7 @@ namespace ts { emit(node.exclamationToken); emitTypeAnnotation(node.type); emitInitializer(node.initializer, node.type ? node.type.end : node.questionToken ? node.questionToken.end : node.name.end, node); - writeSemicolon(); + writeTrailingSemicolon(); } function emitMethodSignature(node: MethodSignature) { @@ -1166,7 +1199,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1201,7 +1234,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1214,7 +1247,7 @@ namespace ts { emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); popNameGenerationScope(node); } @@ -1223,11 +1256,11 @@ namespace ts { emitModifiers(node, node.modifiers); emitParametersForIndexSignature(node, node.parameters); emitTypeAnnotation(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitSemicolonClassElement() { - writeSemicolon(); + writeTrailingSemicolon(); } // @@ -1259,26 +1292,26 @@ namespace ts { } function emitJSDocFunctionType(node: JSDocFunctionType) { - write("function"); + writeKeyword("function"); emitParameters(node, node.parameters); - write(":"); + writePunctuation(":"); emit(node.type); } function emitJSDocNullableType(node: JSDocNullableType) { - write("?"); + writePunctuation("?"); emit(node.type); } function emitJSDocNonNullableType(node: JSDocNonNullableType) { - write("!"); + writePunctuation("!"); emit(node.type); } function emitJSDocOptionalType(node: JSDocOptionalType) { emit(node.type); - write("="); + writePunctuation("="); } function emitConstructorType(node: ConstructorTypeNode) { @@ -1314,7 +1347,7 @@ namespace ts { } function emitRestOrJSDocVariadicType(node: RestTypeNode | JSDocVariadicType) { - write("..."); + writePunctuation("..."); emit(node.type); } @@ -1326,7 +1359,7 @@ namespace ts { function emitOptionalType(node: OptionalTypeNode) { emit(node.type); - write("?"); + writePunctuation("?"); } function emitUnionType(node: UnionTypeNode) { @@ -1414,7 +1447,7 @@ namespace ts { writePunctuation(":"); writeSpace(); emit(node.type); - writeSemicolon(); + writeTrailingSemicolon(); if (emitFlags & EmitFlags.SingleLine) { writeSpace(); } @@ -1502,7 +1535,7 @@ namespace ts { function emitPropertyAccessExpression(node: PropertyAccessExpression) { let indentBeforeDot = false; let indentAfterDot = false; - if (!(getEmitFlags(node) & EmitFlags.NoIndentation)) { + if (!(getEmitFlags(node) & EmitFlags.NoIndentation) && !removeWhitespace) { const dotRangeStart = node.expression.end; const dotRangeEnd = skipTrivia(currentSourceFile.text, node.expression.end) + 1; const dotToken = createToken(SyntaxKind.DotToken); @@ -1515,7 +1548,7 @@ namespace ts { emitExpression(node.expression); increaseIndentIf(indentBeforeDot); - const shouldEmitDotDot = !indentBeforeDot && needsDotDotForPropertyAccess(node.expression); + const shouldEmitDotDot = !indentBeforeDot && !removeWhitespace && needsDotDotForPropertyAccess(node.expression); if (shouldEmitDotDot) { writePunctuation("."); } @@ -1668,11 +1701,11 @@ namespace ts { const indentAfterOperator = needsIndentation(node, node.operatorToken, node.right); emitExpression(node.left); - increaseIndentIf(indentBeforeOperator, isCommaOperator ? " " : undefined); + increaseIndentIf(indentBeforeOperator, isCommaOperator); emitLeadingCommentsOfPosition(node.operatorToken.pos); - writeTokenNode(node.operatorToken, writeOperator); + writeTokenNode(node.operatorToken, node.operatorToken.kind === SyntaxKind.InKeyword ? writeKeyword : writeOperator); emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts - increaseIndentIf(indentAfterOperator, " "); + increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.right); decreaseIndentIf(indentBeforeOperator, indentAfterOperator); } @@ -1684,15 +1717,15 @@ namespace ts { const indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse); emitExpression(node.condition); - increaseIndentIf(indentBeforeQuestion, " "); + increaseIndentIf(indentBeforeQuestion, /*writeSpaceIfNotIndenting*/ true); emit(node.questionToken); - increaseIndentIf(indentAfterQuestion, " "); + increaseIndentIf(indentAfterQuestion, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.whenTrue); decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion); - increaseIndentIf(indentBeforeColon, " "); + increaseIndentIf(indentBeforeColon, /*writeSpaceIfNotIndenting*/ true); emit(node.colonToken); - increaseIndentIf(indentAfterColon, " "); + increaseIndentIf(indentAfterColon, /*writeSpaceIfNotIndenting*/ true); emitExpression(node.whenFalse); decreaseIndentIf(indentBeforeColon, indentAfterColon); } @@ -1771,17 +1804,24 @@ namespace ts { function emitVariableStatement(node: VariableStatement) { emitModifiers(node, node.modifiers); emit(node.declarationList); - writeSemicolon(); + writeTrailingSemicolon(); } - function emitEmptyStatement() { - writeSemicolon(); + function emitEmptyStatement(isEmbeddedStatement: boolean) { + // While most trailing semicolons are possibly insignificant, an embedded "empty" + // statement is significant and cannot be elided by the whitespace-removing writer. + if (isEmbeddedStatement) { + writePunctuation(";"); + } + else { + writeTrailingSemicolon(); + } } function emitExpressionStatement(node: ExpressionStatement) { emitExpression(node.expression); if (!isJsonSourceFile(currentSourceFile)) { - writeSemicolon(); + writeTrailingSemicolon(); } } @@ -1837,9 +1877,9 @@ namespace ts { writeSpace(); let pos = emitTokenWithComment(SyntaxKind.OpenParenToken, openParenPos, writePunctuation, /*contextNode*/ node); emitForBinding(node.initializer); - pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.initializer ? node.initializer.end : pos, writeSemicolon, node); + pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.initializer ? node.initializer.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.condition); - pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.condition ? node.condition.end : pos, writeSemicolon, node); + pos = emitTokenWithComment(SyntaxKind.SemicolonToken, node.condition ? node.condition.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.incrementor); emitTokenWithComment(SyntaxKind.CloseParenToken, node.incrementor ? node.incrementor.end : pos, writePunctuation, node); emitEmbeddedStatement(node, node.statement); @@ -1886,13 +1926,13 @@ namespace ts { function emitContinueStatement(node: ContinueStatement) { emitTokenWithComment(SyntaxKind.ContinueKeyword, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); - writeSemicolon(); + writeTrailingSemicolon(); } function emitBreakStatement(node: BreakStatement) { emitTokenWithComment(SyntaxKind.BreakKeyword, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); - writeSemicolon(); + writeTrailingSemicolon(); } function emitTokenWithComment(token: SyntaxKind, pos: number, writer: (s: string) => void, contextNode: Node, indentLeading?: boolean) { @@ -1922,7 +1962,7 @@ namespace ts { function emitReturnStatement(node: ReturnStatement) { emitTokenWithComment(SyntaxKind.ReturnKeyword, node.pos, writeKeyword, /*contextNode*/ node); emitExpressionWithLeadingSpace(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitWithStatement(node: WithStatement) { @@ -1954,7 +1994,7 @@ namespace ts { function emitThrowStatement(node: ThrowStatement) { emitTokenWithComment(SyntaxKind.ThrowKeyword, node.pos, writeKeyword, node); emitExpressionWithLeadingSpace(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitTryStatement(node: TryStatement) { @@ -1975,7 +2015,7 @@ namespace ts { function emitDebuggerStatement(node: DebuggerStatement) { writeToken(SyntaxKind.DebuggerKeyword, node.pos, writeKeyword); - writeSemicolon(); + writeTrailingSemicolon(); } // @@ -2046,7 +2086,7 @@ namespace ts { } else { emitSignatureHead(node); - writeSemicolon(); + writeTrailingSemicolon(); } } @@ -2192,7 +2232,7 @@ namespace ts { writePunctuation("="); writeSpace(); emit(node.type); - writeSemicolon(); + writeTrailingSemicolon(); } function emitEnumDeclaration(node: EnumDeclaration) { @@ -2216,7 +2256,7 @@ namespace ts { emit(node.name); let body = node.body; - if (!body) return writeSemicolon(); + if (!body) return writeTrailingSemicolon(); while (body.kind === SyntaxKind.ModuleDeclaration) { writePunctuation("."); emit((body).name); @@ -2249,7 +2289,7 @@ namespace ts { emitTokenWithComment(SyntaxKind.EqualsToken, node.name.end, writePunctuation, node); writeSpace(); emitModuleReference(node.moduleReference); - writeSemicolon(); + writeTrailingSemicolon(); } function emitModuleReference(node: ModuleReference) { @@ -2272,7 +2312,7 @@ namespace ts { writeSpace(); } emitExpression(node.moduleSpecifier); - writeSemicolon(); + writeTrailingSemicolon(); } function emitImportClause(node: ImportClause) { @@ -2311,7 +2351,7 @@ namespace ts { } writeSpace(); emitExpression(node.expression); - writeSemicolon(); + writeTrailingSemicolon(); } function emitExportDeclaration(node: ExportDeclaration) { @@ -2330,7 +2370,7 @@ namespace ts { writeSpace(); emitExpression(node.moduleSpecifier); } - writeSemicolon(); + writeTrailingSemicolon(); } function emitNamespaceExportDeclaration(node: NamespaceExportDeclaration) { @@ -2341,7 +2381,7 @@ namespace ts { nextPos = emitTokenWithComment(SyntaxKind.NamespaceKeyword, nextPos, writeKeyword, node); writeSpace(); emit(node.name); - writeSemicolon(); + writeTrailingSemicolon(); } function emitNamedExports(node: NamedExports) { @@ -2419,8 +2459,7 @@ namespace ts { } function emitJsxText(node: JsxText) { - commitPendingSemicolon(); - writer.writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); + writeLiteral(getTextOfNode(node, /*includeTrivia*/ true)); } function emitJsxClosingElementOrFragment(node: JsxClosingElement | JsxClosingFragment) { @@ -2576,6 +2615,10 @@ namespace ts { // function emitSourceFile(node: SourceFile) { + // NOTE: Our source map tests currently require each new source file be on a new + // generated line. Until we can rework the source map support in the test + // harness, ensure each source file is on a new line, even when using a + // whitespace-removing writer. writeLine(); const statements = node.statements; if (emitBodyWithDetachedComments) { @@ -2602,30 +2645,30 @@ namespace ts { function emitTripleSlashDirectives(hasNoDefaultLib: boolean, files: ReadonlyArray, types: ReadonlyArray) { if (hasNoDefaultLib) { - write(`/// `); + writeComment(`/// `); writeLine(); } if (currentSourceFile && currentSourceFile.moduleName) { - write(`/// `); + writeComment(`/// `); writeLine(); } if (currentSourceFile && currentSourceFile.amdDependencies) { for (const dep of currentSourceFile.amdDependencies) { if (dep.name) { - write(`/// `); + writeComment(`/// `); } else { - write(`/// `); + writeComment(`/// `); } writeLine(); } } for (const directive of files) { - write(`/// `); + writeComment(`/// `); writeLine(); } for (const directive of types) { - write(`/// `); + writeComment(`/// `); writeLine(); } } @@ -2697,7 +2740,7 @@ namespace ts { if (isSourceFile(sourceFileOrBundle)) { const shebang = getShebang(sourceFileOrBundle.text); if (shebang) { - write(shebang); + writeComment(shebang); writeLine(); return true; } @@ -2784,7 +2827,13 @@ namespace ts { else { writeLine(); increaseIndent(); - emit(node); + if (isEmptyStatement(node)) { + const pipelinePhase = getPipelinePhase(PipelinePhase.Notification, EmitHint.EmbeddedStatement); + pipelinePhase(EmitHint.EmbeddedStatement, node); + } + else { + emit(node); + } decreaseIndent(); } } @@ -3020,83 +3069,63 @@ namespace ts { } } - function commitPendingSemicolonInternal() { - if (pendingSemicolon) { - writeSemicolonInternal(); - pendingSemicolon = false; - } - } - function writeLiteral(s: string) { - commitPendingSemicolon(); writer.writeLiteral(s); } function writeStringLiteral(s: string) { - commitPendingSemicolon(); writer.writeStringLiteral(s); } function writeBase(s: string) { - commitPendingSemicolon(); writer.write(s); } function writeSymbol(s: string, sym: Symbol) { - commitPendingSemicolon(); writer.writeSymbol(s, sym); } function writePunctuation(s: string) { - commitPendingSemicolon(); writer.writePunctuation(s); } - function deferWriteSemicolon() { - pendingSemicolon = true; - } - - function writeSemicolonInternal() { - writer.writePunctuation(";"); + function writeTrailingSemicolon() { + writer.writeTrailingSemicolon(";"); } function writeKeyword(s: string) { - commitPendingSemicolon(); writer.writeKeyword(s); } function writeOperator(s: string) { - commitPendingSemicolon(); writer.writeOperator(s); } function writeParameter(s: string) { - commitPendingSemicolon(); writer.writeParameter(s); } + function writeComment(s: string) { + writer.writeComment(s); + } + function writeSpace() { - commitPendingSemicolon(); writer.writeSpace(" "); } function writeProperty(s: string) { - commitPendingSemicolon(); writer.writeProperty(s); } function writeLine() { - commitPendingSemicolon(); writer.writeLine(); } function increaseIndent() { - commitPendingSemicolon(); writer.increaseIndent(); } function decreaseIndent() { - commitPendingSemicolon(); writer.decreaseIndent(); } @@ -3141,18 +3170,18 @@ namespace ts { if (line.length) { writeLine(); write(line); - writeLine(); + writer.rawWrite(newLine); } } } - function increaseIndentIf(value: boolean, valueToWriteWhenNotIndenting?: string) { + function increaseIndentIf(value: boolean, writeSpaceIfNotIndenting?: boolean) { if (value) { increaseIndent(); writeLine(); } - else if (valueToWriteWhenNotIndenting) { - write(valueToWriteWhenNotIndenting); + else if (writeSpaceIfNotIndenting) { + writeSpace(); } } diff --git a/src/compiler/performance.ts b/src/compiler/performance.ts index 64709a12ba908..b51dc337865d6 100644 --- a/src/compiler/performance.ts +++ b/src/compiler/performance.ts @@ -19,6 +19,37 @@ namespace ts.performance { let marks: Map; let measures: Map; + export interface Timer { + enter(): void; + exit(): void; + } + + export function createTimer(measureName: string, startMarkName: string, endMarkName: string): Timer { + let enterCount = 0; + return { + enter, + exit + }; + + function enter() { + if (++enterCount === 1) { + mark(startMarkName); + } + } + + function exit() { + if (--enterCount === 0) { + mark(endMarkName); + measure(measureName, startMarkName, endMarkName); + } + else if (enterCount < 0) { + Debug.fail("enter/exit count does not match."); + } + } + } + + export const nullTimer: Timer = { enter: noop, exit: noop }; + /** * Marks a performance event. * diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index af74d69ceefbb..882140f177613 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -420,7 +420,8 @@ namespace ts { ch === CharacterCodes.paragraphSeparator; } - function isDigit(ch: number): boolean { + /* @internal */ + export function isDigit(ch: number): boolean { return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; } diff --git a/src/compiler/sourcemap.ts b/src/compiler/sourcemap.ts index eff543849cd39..0c5af012b9988 100644 --- a/src/compiler/sourcemap.ts +++ b/src/compiler/sourcemap.ts @@ -54,23 +54,14 @@ namespace ts { /** * Gets the text for the source map. */ - getText(): string; + getText(): string | undefined; /** * Gets the SourceMappingURL for the source map. */ - getSourceMappingURL(): string; + getSourceMappingURL(): string | undefined; } - // Used for initialize lastEncodedSourceMapSpan and reset lastEncodedSourceMapSpan when updateLastEncodedAndRecordedSpans - const defaultLastEncodedSourceMapSpan: SourceMapSpan = { - emittedLine: 0, - emittedColumn: 0, - sourceLine: 0, - sourceColumn: 0, - sourceIndex: 0 - }; - export interface SourceMapOptions { sourceMap?: boolean; inlineSourceMap?: boolean; @@ -80,24 +71,18 @@ namespace ts { extendedDiagnostics?: boolean; } - export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, compilerOptions: SourceMapOptions = host.getCompilerOptions()): SourceMapWriter { - const extendedDiagnostics = compilerOptions.extendedDiagnostics; + export function createSourceMapWriter(host: EmitHost, writer: EmitTextWriter, writerOptions: SourceMapOptions = host.getCompilerOptions()): SourceMapWriter { let currentSource: SourceMapSource; - let currentSourceText: string; + let currentSourceIndex = -1; let sourceMapDir: string; // The directory in which sourcemap will be - // Current source map file and its index in the sources list - let sourceMapSourceIndex: number; - - // Last recorded and encoded spans - let lastRecordedSourceMapSpan: SourceMapSpan | undefined; - let lastEncodedSourceMapSpan: SourceMapSpan | undefined; - let lastEncodedNameIndex: number | undefined; - // Source map data let sourceMapData: SourceMapData; let sourceMapDataList: SourceMapData[] | undefined; - let disabled: boolean = !(compilerOptions.sourceMap || compilerOptions.inlineSourceMap); + let disabled: boolean = !(writerOptions.sourceMap || writerOptions.inlineSourceMap); + + let sourceMapGenerator: SourceMapGenerator | undefined; + let sourceMapEmitter: SourceMapEmitter | undefined; return { initialize, @@ -114,7 +99,7 @@ namespace ts { * Skips trivia such as comments and white-space that can optionally overriden by the source map source */ function skipSourceTrivia(pos: number): number { - return currentSource.skipTrivia ? currentSource.skipTrivia(pos) : skipTrivia(currentSourceText, pos); + return currentSource.skipTrivia ? currentSource.skipTrivia(pos) : skipTrivia(currentSource.text, pos); } /** @@ -132,30 +117,20 @@ namespace ts { if (sourceMapData) { reset(); } - sourceMapDataList = outputSourceMapDataList; - currentSource = undefined!; - currentSourceText = undefined!; - - // Current source map file and its index in the sources list - sourceMapSourceIndex = -1; - - // Last recorded and encoded spans - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = defaultLastEncodedSourceMapSpan; - lastEncodedNameIndex = 0; + sourceMapDataList = outputSourceMapDataList; // Initialize source map data sourceMapData = { sourceMapFilePath, - jsSourceMappingURL: !compilerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined!, // TODO: GH#18217 + jsSourceMappingURL: !writerOptions.inlineSourceMap ? getBaseFileName(normalizeSlashes(sourceMapFilePath)) : undefined!, // TODO: GH#18217 sourceMapFile: getBaseFileName(normalizeSlashes(filePath)), - sourceMapSourceRoot: compilerOptions.sourceRoot || "", + sourceMapSourceRoot: writerOptions.sourceRoot || "", sourceMapSources: [], inputSourceFileNames: [], sourceMapNames: [], sourceMapMappings: "", - sourceMapSourcesContent: compilerOptions.inlineSources ? [] : undefined, + sourceMapSourcesContent: writerOptions.inlineSources ? [] : undefined, }; // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -165,8 +140,8 @@ namespace ts { sourceMapData.sourceMapSourceRoot += directorySeparator; } - if (compilerOptions.mapRoot) { - sourceMapDir = normalizeSlashes(compilerOptions.mapRoot); + if (writerOptions.mapRoot) { + sourceMapDir = normalizeSlashes(writerOptions.mapRoot); if (sourceFileOrBundle.kind === SyntaxKind.SourceFile) { // emitting single module file // 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 @@ -190,6 +165,12 @@ namespace ts { else { sourceMapDir = getDirectoryPath(normalizePath(filePath)); } + + // If sourceroot option: Use the relative path corresponding to the common directory path + // otherwise source locations relative to map file location + const sourcesDirectoryPath = writerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; + sourceMapGenerator = createSourceMapGenerator(host, sourceMapData, sourcesDirectoryPath, writerOptions); + sourceMapEmitter = getSourceMapEmitter(sourceMapGenerator, writer); } /** @@ -206,87 +187,11 @@ namespace ts { } currentSource = undefined!; + currentSourceIndex = -1; sourceMapDir = undefined!; - sourceMapSourceIndex = undefined!; - lastRecordedSourceMapSpan = undefined; - lastEncodedSourceMapSpan = undefined!; - lastEncodedNameIndex = undefined; sourceMapData = undefined!; sourceMapDataList = undefined!; - } - - type SourceMapSectionDefinition = - | { offset: { line: number, column: number }, url: string } // Included for completeness - | { offset: { line: number, column: number }, map: SourceMap }; - - interface SectionalSourceMap { - version: 3; - file: string; - sections: SourceMapSectionDefinition[]; - } - - type SourceMap = SectionalSourceMap | SourceMapSection; - - function captureSection(): SourceMapSection { - return { - version: 3, - file: sourceMapData.sourceMapFile, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sources: sourceMapData.sourceMapSources, - names: sourceMapData.sourceMapNames, - mappings: sourceMapData.sourceMapMappings, - sourcesContent: sourceMapData.sourceMapSourcesContent, - }; - } - - - // Encoding for sourcemap span - function encodeLastRecordedSourceMapSpan() { - if (!lastRecordedSourceMapSpan || lastRecordedSourceMapSpan === lastEncodedSourceMapSpan) { - return; - } - - Debug.assert(lastRecordedSourceMapSpan.emittedColumn >= 0, "lastEncodedSourceMapSpan.emittedColumn was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceIndex >= 0, "lastEncodedSourceMapSpan.sourceIndex was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceLine >= 0, "lastEncodedSourceMapSpan.sourceLine was negative"); - Debug.assert(lastRecordedSourceMapSpan.sourceColumn >= 0, "lastEncodedSourceMapSpan.sourceColumn was negative"); - - 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 = 0; - } - - // 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) { - Debug.assert(false, "We do not support name index right now, Make sure to update updateLastEncodedAndRecordedSpans when we start using this"); - sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.nameIndex! - lastEncodedNameIndex!); - lastEncodedNameIndex = lastRecordedSourceMapSpan.nameIndex; - } - - lastEncodedSourceMapSpan = lastRecordedSourceMapSpan; + sourceMapEmitter = undefined; } /** @@ -302,50 +207,8 @@ namespace ts { return; } - if (extendedDiagnostics) { - performance.mark("beforeSourcemap"); - } - - const sourceLinePos = getLineAndCharacterOfPosition(currentSource, pos); - - 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, - emittedColumn, - sourceLine: sourceLinePos.line, - sourceColumn: sourceLinePos.character, - 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; - } - - if (extendedDiagnostics) { - performance.mark("afterSourcemap"); - performance.measure("Source Map", "beforeSourcemap", "afterSourcemap"); - } - } - - function isPossiblySourceMap(x: {}): x is SourceMapSection { - return typeof x === "object" && !!(x as any).mappings && typeof (x as any).mappings === "string" && !!(x as any).sources; + const { line: sourceLine, character: sourceCharacter } = getLineAndCharacterOfPosition(currentSource, pos); + Debug.assertDefined(sourceMapEmitter, "Not initialized").emitMapping(currentSourceIndex, sourceLine, sourceCharacter, /*nameIndex*/ undefined); } /** @@ -362,60 +225,13 @@ namespace ts { if (node) { if (isUnparsedSource(node) && node.sourceMapText !== undefined) { - const text = node.sourceMapText; - let parsed: {} | undefined; - try { - parsed = JSON.parse(text); - } - catch { - // empty - } - if (!parsed || !isPossiblySourceMap(parsed)) { - return emitCallback(hint, node); - } - const offsetLine = writer.getLine(); - const firstLineColumnOffset = writer.getColumn(); - // First, decode the old component sourcemap - const originalMap = parsed; - - const sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; - const resolvedPathCache = createMap(); - const absolutePathCache = createMap(); - const sourcemapIterator = sourcemaps.decodeMappings(originalMap); - for (let { value: raw, done } = sourcemapIterator.next(); !done; { value: raw, done } = sourcemapIterator.next()) { - const pathCacheKey = "" + raw.sourceIndex; - // Apply offsets to each position and fixup source entries - if (!resolvedPathCache.has(pathCacheKey)) { - const rawPath = originalMap.sources[raw.sourceIndex]; - const relativePath = originalMap.sourceRoot ? combinePaths(originalMap.sourceRoot, rawPath) : rawPath; - const combinedPath = combinePaths(getDirectoryPath(node.sourceMapPath!), relativePath); - const resolvedPath = getRelativePathToDirectoryOrUrl( - sourcesDirectoryPath, - combinedPath, - host.getCurrentDirectory(), - host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true - ); - resolvedPathCache.set(pathCacheKey, resolvedPath); - absolutePathCache.set(pathCacheKey, getNormalizedAbsolutePath(resolvedPath, sourcesDirectoryPath)); - } - const resolvedPath = resolvedPathCache.get(pathCacheKey)!; - const absolutePath = absolutePathCache.get(pathCacheKey)!; - // tslint:disable-next-line:no-null-keyword - setupSourceEntry(absolutePath, originalMap.sourcesContent ? originalMap.sourcesContent[raw.sourceIndex] : null, resolvedPath); // TODO: Lookup content for inlining? - const newIndex = sourceMapData.sourceMapSources.indexOf(resolvedPath); - // Then reencode all the updated spans into the overall map - encodeLastRecordedSourceMapSpan(); - lastRecordedSourceMapSpan = { - ...raw, - emittedLine: raw.emittedLine + offsetLine, - emittedColumn: raw.emittedLine === 0 ? (raw.emittedColumn + firstLineColumnOffset) : raw.emittedColumn, - sourceIndex: newIndex, - }; + const parsed = tryParseRawSourceMap(node.sourceMapText); + if (parsed) { + Debug.assertDefined(sourceMapEmitter, "Not initialized").emitSourceMap(parsed, node.sourceMapPath!); } - // And actually emit the text these sourcemaps are for return emitCallback(hint, node); } + const emitNode = node.emitNode; const emitFlags = emitNode && emitNode.flags || EmitFlags.None; const range = emitNode && emitNode.sourceMapRange; @@ -502,40 +318,16 @@ namespace ts { } currentSource = sourceFile; - currentSourceText = currentSource.text; if (isJsonSourceMapSource(sourceFile)) { return; } - setupSourceEntry(sourceFile.fileName, sourceFile.text); - } - - function setupSourceEntry(fileName: string, content: string | null, source?: string) { - if (!source) { - // 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; + if (!sourceMapGenerator) return Debug.fail("Not initialized"); - source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, - fileName, - host.getCurrentDirectory(), - host.getCanonicalFileName, - /*isAbsolutePathAnUrl*/ true); - } - - sourceMapSourceIndex = sourceMapData.sourceMapSources.indexOf(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(fileName); - - if (compilerOptions.inlineSources) { - sourceMapData.sourceMapSourcesContent!.push(content); - } + currentSourceIndex = sourceMapGenerator.addSource(sourceFile.fileName); + if (writerOptions.inlineSources) { + sourceMapGenerator.setSourceContent(currentSourceIndex, sourceFile.text); } } @@ -544,12 +336,10 @@ namespace ts { */ function getText() { if (disabled || isJsonSourceMapSource(currentSource)) { - return undefined!; // TODO: GH#18217 + return undefined; } - encodeLastRecordedSourceMapSpan(); - - return JSON.stringify(captureSection()); + return Debug.assertDefined(sourceMapGenerator, "Not initialized").toString(); } /** @@ -557,12 +347,13 @@ namespace ts { */ function getSourceMappingURL() { if (disabled || isJsonSourceMapSource(currentSource)) { - return undefined!; // TODO: GH#18217 + return undefined; } - if (compilerOptions.inlineSourceMap) { + if (writerOptions.inlineSourceMap) { // Encode the sourceMap into the sourceMap url - const base64SourceMapText = base64encode(sys, getText()); + const sourceMapText = Debug.assertDefined(sourceMapGenerator, "Not initialized").toString(); + const base64SourceMapText = base64encode(sys, sourceMapText); return sourceMapData.jsSourceMappingURL = `data:application/json;base64,${base64SourceMapText}`; } else { @@ -571,15 +362,316 @@ namespace ts { } } - export interface SourceMapSection { - version: 3; - file: string; - sourceRoot?: string; - sources: string[]; - names?: string[]; - mappings: string; - sourcesContent?: (string | null)[]; - sections?: undefined; + interface SourceMapGeneratorOptions { + extendedDiagnostics?: boolean; + } + + function createSourceMapGenerator(host: EmitHost, sourceMapData: SourceMapData, sourcesDirectoryPath: string, generatorOptions: SourceMapGeneratorOptions): SourceMapGenerator { + const { enter, exit } = generatorOptions.extendedDiagnostics + ? performance.createTimer("Source Map", "beforeSourcemap", "afterSourcemap") + : performance.nullTimer; + + // Current source map file and its index in the sources list + const sourceToSourceIndexMap = createMap(); + let nameToNameIndexMap: Map | undefined; + + // Last recorded and encoded mappings + let lastGeneratedLine = 0; + let lastGeneratedCharacter = 0; + let lastSourceIndex = 0; + let lastSourceLine = 0; + let lastSourceCharacter = 0; + let lastNameIndex = 0; + let hasLast = false; + + let pendingGeneratedLine = 0; + let pendingGeneratedCharacter = 0; + let pendingSourceIndex = 0; + let pendingSourceLine = 0; + let pendingSourceCharacter = 0; + let pendingNameIndex = 0; + let hasPending = false; + let hasPendingSource = false; + let hasPendingName = false; + + return { + addSource, + setSourceContent, + addName, + addMapping, + appendSourceMap, + toJSON, + toString: () => JSON.stringify(toJSON()) + }; + + function addSource(fileName: string) { + enter(); + const source = getRelativePathToDirectoryOrUrl(sourcesDirectoryPath, + fileName, + host.getCurrentDirectory(), + host.getCanonicalFileName, + /*isAbsolutePathAnUrl*/ true); + + let sourceIndex = sourceToSourceIndexMap.get(source); + if (sourceIndex === undefined) { + sourceIndex = sourceMapData.sourceMapSources.length; + sourceMapData.sourceMapSources.push(source); + sourceMapData.inputSourceFileNames.push(fileName); + sourceToSourceIndexMap.set(source, sourceIndex); + } + exit(); + return sourceIndex; + } + + function setSourceContent(sourceIndex: number, content: string | null) { + enter(); + if (content !== null) { + if (!sourceMapData.sourceMapSourcesContent) sourceMapData.sourceMapSourcesContent = []; + while (sourceMapData.sourceMapSourcesContent.length < sourceIndex) { + // tslint:disable-next-line:no-null-keyword boolean-trivia + sourceMapData.sourceMapSourcesContent.push(null); + } + sourceMapData.sourceMapSourcesContent[sourceIndex] = content; + } + exit(); + } + + function addName(name: string) { + enter(); + if (!sourceMapData.sourceMapNames) sourceMapData.sourceMapNames = []; + if (!nameToNameIndexMap) nameToNameIndexMap = createMap(); + let nameIndex = nameToNameIndexMap.get(name); + if (nameIndex === undefined) { + nameIndex = sourceMapData.sourceMapNames.length; + sourceMapData.sourceMapNames.push(name); + nameToNameIndexMap.set(name, nameIndex); + } + exit(); + return nameIndex; + } + + function isNewGeneratedPosition(generatedLine: number, generatedCharacter: number) { + return !hasPending + || pendingGeneratedLine !== generatedLine + || pendingGeneratedCharacter !== generatedCharacter; + } + + function isBacktrackingSourcePosition(sourceIndex: number | undefined, sourceLine: number | undefined, sourceCharacter: number | undefined) { + return sourceIndex !== undefined + && sourceLine !== undefined + && sourceCharacter !== undefined + && pendingSourceIndex === sourceIndex + && (pendingSourceLine > sourceLine + || pendingSourceLine === sourceLine && pendingSourceCharacter > sourceCharacter); + } + + function addMapping(generatedLine: number, generatedCharacter: number, sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); + Debug.assert(sourceIndex === undefined || sourceIndex >= 0, "sourceIndex cannot be negative"); + Debug.assert(sourceLine === undefined || sourceLine >= 0, "sourceLine cannot be negative"); + Debug.assert(sourceCharacter === undefined || sourceCharacter >= 0, "sourceCharacter cannot be negative"); + enter(); + // If this location wasn't recorded or the location in source is going backwards, record the mapping + if (isNewGeneratedPosition(generatedLine, generatedCharacter) || + isBacktrackingSourcePosition(sourceIndex, sourceLine, sourceCharacter)) { + commitPendingMapping(); + pendingGeneratedLine = generatedLine; + pendingGeneratedCharacter = generatedCharacter; + hasPendingSource = false; + hasPendingName = false; + hasPending = true; + } + + if (sourceIndex !== undefined && sourceLine !== undefined && sourceCharacter !== undefined) { + pendingSourceIndex = sourceIndex; + pendingSourceLine = sourceLine; + pendingSourceCharacter = sourceCharacter; + hasPendingSource = true; + if (nameIndex !== undefined) { + pendingNameIndex = nameIndex; + hasPendingName = true; + } + } + exit(); + } + + function appendSourceMap(generatedLine: number, generatedCharacter: number, map: RawSourceMap, sourceMapPath: string) { + Debug.assert(generatedLine >= pendingGeneratedLine, "generatedLine cannot backtrack"); + Debug.assert(generatedCharacter >= 0, "generatedCharacter cannot be negative"); + enter(); + // First, decode the old component sourcemap + const sourceIndexToNewSourceIndexMap: number[] = []; + let nameIndexToNewNameIndexMap: number[] | undefined; + const mappingIterator = sourcemaps.decodeMappings(map); + for (let { value: raw, done } = mappingIterator.next(); !done; { value: raw, done } = mappingIterator.next()) { + // Then reencode all the updated mappings into the overall map + let newSourceIndex: number | undefined; + let newSourceLine: number | undefined; + let newSourceCharacter: number | undefined; + let newNameIndex: number | undefined; + if (raw.sourceIndex !== undefined) { + newSourceIndex = sourceIndexToNewSourceIndexMap[raw.sourceIndex]; + if (newSourceIndex === undefined) { + // Apply offsets to each position and fixup source entries + const rawPath = map.sources[raw.sourceIndex]; + const relativePath = map.sourceRoot ? combinePaths(map.sourceRoot, rawPath) : rawPath; + const combinedPath = combinePaths(getDirectoryPath(sourceMapPath), relativePath); + sourceIndexToNewSourceIndexMap[raw.sourceIndex] = newSourceIndex = addSource(combinedPath); + if (map.sourcesContent && typeof map.sourcesContent[raw.sourceIndex] === "string") { + setSourceContent(newSourceIndex, map.sourcesContent[raw.sourceIndex]); + } + } + + newSourceLine = raw.sourceLine; + newSourceCharacter = raw.sourceColumn; + if (map.names && raw.nameIndex !== undefined) { + if (!nameIndexToNewNameIndexMap) nameIndexToNewNameIndexMap = []; + newNameIndex = nameIndexToNewNameIndexMap[raw.nameIndex]; + if (newNameIndex === undefined) { + nameIndexToNewNameIndexMap[raw.nameIndex] = newNameIndex = addName(map.names[raw.nameIndex]); + } + } + } + + const newGeneratedLine = raw.emittedLine + generatedLine; + const newGeneratedCharacter = raw.emittedLine === 0 ? raw.emittedColumn + generatedCharacter : raw.emittedColumn; + addMapping(newGeneratedLine, newGeneratedCharacter, newSourceIndex, newSourceLine, newSourceCharacter, newNameIndex); + } + exit(); + } + + function shouldCommitMapping() { + return !hasLast + || lastGeneratedLine !== pendingGeneratedLine + || lastGeneratedCharacter !== pendingGeneratedCharacter + || lastSourceIndex !== pendingSourceIndex + || lastSourceLine !== pendingSourceLine + || lastSourceCharacter !== pendingSourceCharacter + || lastNameIndex !== pendingNameIndex; + } + + // Encoding for sourcemap span + function commitPendingMapping() { + if (!hasPending || !shouldCommitMapping()) { + return; + } + + enter(); + + // Line/Comma delimiters + if (lastGeneratedLine < pendingGeneratedLine) { + // Emit line delimiters + do { + sourceMapData.sourceMapMappings += ";"; + lastGeneratedLine++; + lastGeneratedCharacter = 0; + } + while (lastGeneratedLine < pendingGeneratedLine); + } + else { + Debug.assertEqual(lastGeneratedLine, pendingGeneratedLine, "generatedLine cannot backtrack"); + // Emit comma to separate the entry + if (hasLast) { + sourceMapData.sourceMapMappings += ","; + } + } + + // 1. Relative generated character + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingGeneratedCharacter - lastGeneratedCharacter); + lastGeneratedCharacter = pendingGeneratedCharacter; + + if (hasPendingSource) { + // 2. Relative sourceIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceIndex - lastSourceIndex); + lastSourceIndex = pendingSourceIndex; + + // 3. Relative source line + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceLine - lastSourceLine); + lastSourceLine = pendingSourceLine; + + // 4. Relative source character + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingSourceCharacter - lastSourceCharacter); + lastSourceCharacter = pendingSourceCharacter; + + if (hasPendingName) { + // 5. Relative nameIndex + sourceMapData.sourceMapMappings += base64VLQFormatEncode(pendingNameIndex - lastNameIndex); + lastNameIndex = pendingNameIndex; + } + } + + hasLast = true; + exit(); + } + + function toJSON(): RawSourceMap { + commitPendingMapping(); + return { + version: 3, + file: sourceMapData.sourceMapFile, + sourceRoot: sourceMapData.sourceMapSourceRoot, + sources: sourceMapData.sourceMapSources, + names: sourceMapData.sourceMapNames, + mappings: sourceMapData.sourceMapMappings, + sourcesContent: sourceMapData.sourceMapSourcesContent, + }; + } + } + + function getSourceMapEmitter(generator: SourceMapGenerator, writer: EmitTextWriter): SourceMapEmitter { + if (writer.getSourceMapEmitter) { + return writer.getSourceMapEmitter(generator); + } + + return createSourceMapEmitter(generator, writer); + } + + function createSourceMapEmitter(generator: SourceMapGenerator, writer: EmitTextWriter) { + return { + emitMapping, + emitSourceMap + }; + + function emitMapping(sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + return generator.addMapping(writer.getLine(), writer.getColumn(), sourceIndex!, sourceLine!, sourceCharacter!, nameIndex); + } + + function emitSourceMap(sourceMap: RawSourceMap, sourceMapPath: string): void { + return generator.appendSourceMap(writer.getLine(), writer.getColumn(), sourceMap, sourceMapPath); + } + } + + function isStringOrNull(x: any) { + // tslint:disable-next-line:no-null-keyword + return typeof x === "string" || x === null; + } + + export function isRawSourceMap(x: any): x is RawSourceMap { + // tslint:disable-next-line:no-null-keyword + return x !== null + && typeof x === "object" + && x.version === 3 + && typeof x.file === "string" + && typeof x.mappings === "string" + && isArray(x.sources) && every(x.sources, isString) + && (x.sourceRoot === undefined || x.sourceRoot === null || typeof x.sourceRoot === "string") + && (x.sourcesContent === undefined || x.sourcesContent === null || isArray(x.sourcesContent) && every(x.sourcesContent, isStringOrNull)) + && (x.names === undefined || x.names === null || isArray(x.names) && every(x.names, isString)); + } + + export function tryParseRawSourceMap(text: string) { + try { + const parsed = JSON.parse(text); + if (isRawSourceMap(parsed)) { + return parsed; + } + } + catch { + // empty + } + + return undefined; } const base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; diff --git a/src/compiler/sourcemapDecoder.ts b/src/compiler/sourcemapDecoder.ts index 28cbbe39cf550..8cd274491e022 100644 --- a/src/compiler/sourcemapDecoder.ts +++ b/src/compiler/sourcemapDecoder.ts @@ -30,16 +30,6 @@ namespace ts { /* @internal */ namespace ts.sourcemaps { - export interface SourceMapData { - version?: number; - file?: string; - sourceRoot?: string; - sources: string[]; - sourcesContent?: (string | null)[]; - names?: string[]; - mappings: string; - } - export interface SourceMappableLocation { fileName: string; position: number; @@ -59,7 +49,7 @@ namespace ts.sourcemaps { log(text: string): void; } - export function decode(host: SourceMapDecodeHost, mapPath: string, map: SourceMapData, program?: Program, fallbackCache = createSourceFileLikeCache(host)): SourceMapper { + export function decode(host: SourceMapDecodeHost, mapPath: string, map: RawSourceMap, program?: Program, fallbackCache = createSourceFileLikeCache(host)): SourceMapper { const currentDirectory = getDirectoryPath(mapPath); const sourceRoot = map.sourceRoot ? getNormalizedAbsolutePath(map.sourceRoot, currentDirectory) : currentDirectory; let decodedMappings: ProcessedSourceMapPosition[]; @@ -82,7 +72,7 @@ namespace ts.sourcemaps { if (!maps[targetIndex] || comparePaths(loc.fileName, maps[targetIndex].sourcePath, sourceRoot) !== 0) { return loc; } - return { fileName: toPath(map.file!, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos + return { fileName: toPath(map.file, sourceRoot, host.getCanonicalFileName), position: maps[targetIndex].emittedPosition }; // Closest pos } function getOriginalPosition(loc: SourceMappableLocation): SourceMappableLocation { @@ -140,7 +130,7 @@ namespace ts.sourcemaps { function processPosition(position: RawSourceMapPosition): ProcessedSourceMapPosition { const sourcePath = map.sources[position.sourceIndex]; return { - emittedPosition: getPositionOfLineAndCharacterUsingName(map.file!, currentDirectory, position.emittedLine, position.emittedColumn), + emittedPosition: getPositionOfLineAndCharacterUsingName(map.file, currentDirectory, position.emittedLine, position.emittedColumn), sourcePosition: getPositionOfLineAndCharacterUsingName(sourcePath, sourceRoot, position.sourceLine, position.sourceColumn), sourcePath, // TODO: Consider using `name` field to remap the expected identifier to scan for renames to handle another tool renaming oout output @@ -157,7 +147,7 @@ namespace ts.sourcemaps { } /*@internal*/ - export function decodeMappings(map: SourceMapData): MappingsDecoder { + export function decodeMappings(map: Pick): MappingsDecoder { const state: DecoderState = { encodedText: map.mappings, currentNameIndex: undefined, @@ -191,7 +181,7 @@ namespace ts.sourcemaps { }; } - function calculateDecodedMappings(map: SourceMapData, processPosition: (position: RawSourceMapPosition) => T, host?: { log?(s: string): void }): T[] { + function calculateDecodedMappings(map: RawSourceMap, processPosition: (position: RawSourceMapPosition) => T, host?: { log?(s: string): void }): T[] { const decoder = decodeMappings(map); const positions = arrayFrom(decoder, processPosition); if (decoder.error) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index e490179ce0df3..a5522ab000778 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4382,6 +4382,7 @@ namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -5062,6 +5063,7 @@ namespace ts { IdentifierName, // Emitting an IdentifierName MappedTypeParameter, // Emitting a TypeParameterDeclaration inside of a MappedTypeNode Unspecified, // Emitting an otherwise unspecified node + EmbeddedStatement, // Emitting an embedded statement } /* @internal */ @@ -5314,12 +5316,84 @@ namespace ts { /*@internal*/ inlineSourceMap?: boolean; /*@internal*/ extendedDiagnostics?: boolean; /*@internal*/ onlyPrintJsDocStyle?: boolean; + /*@internal*/ removeWhitespace?: boolean; + } + + /* @internal */ + export interface RawSourceMap { + version: 3; + file: string; + sourceRoot?: string | null; + sources: string[]; + sourcesContent?: (string | null)[] | null; + mappings: string; + names?: string[] | null; + } + + /** + * Generates a source map. + * @internal + */ + export interface SourceMapGenerator { + /** + * Adds a source to the source map. + */ + addSource(fileName: string): number; + /** + * Set the content for a source. + */ + setSourceContent(sourceIndex: number, content: string | null): void; + /** + * Adds a name. + */ + addName(name: string): number; + /** + * Adds a mapping without source information. + */ + addMapping(generatedLine: number, generatedCharacter: number): void; + /** + * Adds a mapping with source information. + */ + addMapping(generatedLine: number, generatedCharacter: number, sourceIndex: number, sourceLine: number, sourceCharacter: number, nameIndex?: number): void; + /** + * Appends a source map. + */ + appendSourceMap(generatedLine: number, generatedCharacter: number, sourceMap: RawSourceMap, sourceMapPath: string): void; + /** + * Gets the source map as a `RawSourceMap` object. + */ + toJSON(): RawSourceMap; + /** + * Gets the string representation of the source map. + */ + toString(): string; + } + + /** + * Emits SourceMap information through an entangled `EmitTextWriter` + * @internal + */ + export interface SourceMapEmitter { + /** + * Emits a mapping without source information. + */ + emitMapping(): void; + /** + * Emits a mapping with source information. + */ + emitMapping(sourceIndex: number, sourceLine: number, sourceCharacter: number, nameIndex?: number): void; + /** + * Emits a source map. + */ + emitSourceMap(sourceMap: RawSourceMap, sourceMapPath: string): void; } /* @internal */ export interface EmitTextWriter extends SymbolWriter { write(s: string): void; - writeTextOfNode(text: string, node: Node): void; + writeTrailingSemicolon(text: string): void; + writeComment(text: string): void; + flush(): void; getText(): string; rawWrite(s: string): void; writeLiteral(s: string): void; @@ -5328,6 +5402,7 @@ namespace ts { getColumn(): number; getIndent(): number; isAtStartOfLine(): boolean; + getSourceMapEmitter?(generator: SourceMapGenerator): SourceMapEmitter; } export interface GetEffectiveTypeRootsHost { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 536409b8a09da..7e72d53b87989 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -61,11 +61,10 @@ namespace ts { let str = ""; const writeText: (text: string) => void = text => str += text; - return { + const writer: EmitTextWriter = { getText: () => str, write: writeText, rawWrite: writeText, - writeTextOfNode: writeText, writeKeyword: writeText, writeOperator: writeText, writePunctuation: writeText, @@ -74,7 +73,9 @@ namespace ts { writeLiteral: writeText, writeParameter: writeText, writeProperty: writeText, - writeSymbol: writeText, + writeSymbol: (s, _) => writeText(s), + writeTrailingSemicolon: writeText, + writeComment: writeText, getTextPos: () => str.length, getLine: () => 0, getColumn: () => 0, @@ -87,11 +88,13 @@ namespace ts { increaseIndent: noop, decreaseIndent: noop, clear: () => str = "", + flush: noop, trackSymbol: noop, reportInaccessibleThisError: noop, reportInaccessibleUniqueSymbolError: noop, - reportPrivateInBaseOfClassExpression: noop, + reportPrivateInBaseOfClassExpression: noop }; + return writer; } export function toPath(fileName: string, basePath: string | undefined, getCanonicalFileName: (path: string) => string): Path { @@ -3112,18 +3115,11 @@ namespace ts { } } - function writeTextOfNode(text: string, node: Node) { - const s = getTextOfNodeFromSourceText(text, node); - write(s); - updateLineCountAndPosFor(s); - } - reset(); - return { + const writer: EmitTextWriter = { write, rawWrite, - writeTextOfNode, writeLiteral, writeLine, increaseIndent: () => { indent++; }, @@ -3135,6 +3131,7 @@ namespace ts { getText: () => output, isAtStartOfLine: () => lineStart, clear: reset, + flush: noop, reportInaccessibleThisError: noop, reportPrivateInBaseOfClassExpression: noop, reportInaccessibleUniqueSymbolError: noop, @@ -3146,7 +3143,368 @@ namespace ts { writePunctuation: write, writeSpace: write, writeStringLiteral: write, - writeSymbol: write + writeSymbol: (s, _) => write(s), + writeTrailingSemicolon: write, + writeComment: write + }; + + return writer; + } + + export function getTrailingSemicolonOmittingWriter(writer: EmitTextWriter): EmitTextWriter { + let pendingTrailingSemicolon = false; + + function commitPendingTrailingSemicolon() { + if (pendingTrailingSemicolon) { + writer.writeTrailingSemicolon(";"); + pendingTrailingSemicolon = false; + } + } + + return { + ...writer, + writeTrailingSemicolon() { + pendingTrailingSemicolon = true; + }, + writeLiteral(s) { + commitPendingTrailingSemicolon(); + writer.writeLiteral(s); + }, + writeStringLiteral(s) { + commitPendingTrailingSemicolon(); + writer.writeStringLiteral(s); + }, + writeSymbol(s, sym) { + commitPendingTrailingSemicolon(); + writer.writeSymbol(s, sym); + }, + writePunctuation(s) { + commitPendingTrailingSemicolon(); + writer.writePunctuation(s); + }, + writeKeyword(s) { + commitPendingTrailingSemicolon(); + writer.writeKeyword(s); + }, + writeOperator(s) { + commitPendingTrailingSemicolon(); + writer.writeOperator(s); + }, + writeParameter(s) { + commitPendingTrailingSemicolon(); + writer.writeParameter(s); + }, + writeSpace(s) { + commitPendingTrailingSemicolon(); + writer.writeSpace(s); + }, + writeProperty(s) { + commitPendingTrailingSemicolon(); + writer.writeProperty(s); + }, + writeComment(s) { + commitPendingTrailingSemicolon(); + writer.writeComment(s); + }, + writeLine() { + commitPendingTrailingSemicolon(); + writer.writeLine(); + }, + increaseIndent() { + commitPendingTrailingSemicolon(); + writer.increaseIndent(); + }, + decreaseIndent() { + commitPendingTrailingSemicolon(); + writer.decreaseIndent(); + } + }; + } + + enum SourceMapInfoKind { + emitMapping, + emitSourceMap, + } + + type SourceMapInfo = + | { kind: SourceMapInfoKind.emitMapping, sourceIndex: number | undefined, sourceLine: number | undefined, sourceCharacter: number | undefined, nameIndex: number | undefined } + | { kind: SourceMapInfoKind.emitSourceMap, map: RawSourceMap, sourceMapPath: string }; + + const enum WriteKind { + none, + write, + writeKeyword, + writeOperator, + writePunctuation, + writeTrailingSemicolon, + writeStringLiteral, + writeLiteral, + writeParameter, + writeProperty, + writeComment, + writeSymbol, + } + + export function getWhitespaceRemovingTextWriter(writer: EmitTextWriter): EmitTextWriter { + let pendingWrite = WriteKind.none; + let pendingText = ""; + let pendingSymbol: Symbol | undefined; + let pendingSourceMapInfo: SourceMapInfo[] | undefined; + let requestedSourceMapInfoBeforeSpace: SourceMapInfo[] | undefined; + let requestedSourceMapInfoAfterSpace: SourceMapInfo[] | undefined; + let requestedSpace = false; + let sourceMapGenerator: SourceMapGenerator | undefined; + let sourceMapEmitter: SourceMapEmitter | undefined; + + function getRequestedSourceMapInfoArray(): SourceMapInfo[] { + return requestedSpace + ? requestedSourceMapInfoAfterSpace || (requestedSourceMapInfoAfterSpace = []) + : requestedSourceMapInfoBeforeSpace || (requestedSourceMapInfoBeforeSpace = []); + } + + function pushMapping(sourceIndex?: number, sourceLine?: number, sourceCharacter?: number, nameIndex?: number) { + getRequestedSourceMapInfoArray().push({ kind: SourceMapInfoKind.emitMapping, sourceIndex, sourceLine, sourceCharacter, nameIndex }); + } + + function pushSourceMap(map: RawSourceMap, sourceMapPath: string) { + getRequestedSourceMapInfoArray().push({ kind: SourceMapInfoKind.emitSourceMap, map, sourceMapPath }); + } + + function pushRequestedSourceMapInfo(requestedSourceMapInfo: SourceMapInfo[] | undefined) { + if (some(requestedSourceMapInfo)) { + if (!pendingSourceMapInfo) pendingSourceMapInfo = []; + pendingSourceMapInfo.push(...requestedSourceMapInfo); + clear(requestedSourceMapInfo); + } + } + + function pushWrite(kind: WriteKind, text: string) { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + pushRequestedSourceMapInfo(requestedSourceMapInfoAfterSpace); + pendingWrite = kind; + pendingText = text; + } + + function commitPendingSourceMapInfo() { + forEach(pendingSourceMapInfo, processPendingSourceMapInfo); + clear(pendingSourceMapInfo); + } + + function commitPendingWrite() { + commitPendingSourceMapInfo(); + processPendingWrite(); + discardPendingWrite(); + } + + function discardPendingWrite() { + pendingWrite = WriteKind.none; + pendingText = ""; + pendingSymbol = undefined; + if (some(pendingSourceMapInfo)) { + if (!requestedSourceMapInfoBeforeSpace) requestedSourceMapInfoBeforeSpace = []; + requestedSourceMapInfoBeforeSpace.unshift(...pendingSourceMapInfo); + } + } + + function processPendingSourceMapInfo(info: SourceMapInfo) { + switch (info.kind) { + case SourceMapInfoKind.emitMapping: return sourceMapGenerator!.addMapping(writer.getLine(), writer.getColumn(), info.sourceIndex!, info.sourceLine!, info.sourceCharacter!, info.nameIndex); + case SourceMapInfoKind.emitSourceMap: return sourceMapGenerator!.appendSourceMap(writer.getLine(), writer.getColumn(), info.map, info.sourceMapPath); + default: return Debug.assertNever(info); + } + } + + function processPendingWrite() { + switch (pendingWrite) { + case WriteKind.none: return; + case WriteKind.write: return writer.write(pendingText); + case WriteKind.writeKeyword: return writer.writeKeyword(pendingText); + case WriteKind.writeOperator: return writer.writeOperator(pendingText); + case WriteKind.writePunctuation: return writer.writePunctuation(pendingText); + case WriteKind.writeTrailingSemicolon: return writer.writeTrailingSemicolon(pendingText); + case WriteKind.writeStringLiteral: return writer.writeStringLiteral(pendingText); + case WriteKind.writeLiteral: return writer.writeLiteral(pendingText); + case WriteKind.writeParameter: return writer.writeParameter(pendingText); + case WriteKind.writeProperty: return writer.writeProperty(pendingText); + case WriteKind.writeComment: return writer.writeComment(pendingText); + case WriteKind.writeSymbol: return writer.writeSymbol(pendingText, pendingSymbol!); + default: return Debug.assertNever(pendingWrite); + } + } + + function flush() { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + pushRequestedSourceMapInfo(requestedSourceMapInfoAfterSpace); + commitPendingSourceMapInfo(); + } + + function beforeWrite() { + commitPendingWrite(); + pushRequestedSourceMapInfo(requestedSourceMapInfoBeforeSpace); + commitPendingSourceMapInfo(); + } + + function writeSpace() { + beforeWrite(); + writer.writeSpace(" "); + requestedSpace = false; + } + + function writeSpaceBeforeWordIfNeeded() { + if (!requestedSpace) return; + if (pendingWrite === WriteKind.writeKeyword || + pendingWrite === WriteKind.writeParameter || + pendingWrite === WriteKind.writeProperty || + pendingWrite === WriteKind.write) { + writeSpace(); + } + } + + function writeSpaceBeforeLiteralIfNeeded(s: string) { + if (isIdentifierPart(s.charCodeAt(0), /*languageVersion*/ undefined)) { + writeSpaceBeforeWordIfNeeded(); + } + } + + function writeSpaceBeforeOperatorIfNeeded(s: string) { + if (!requestedSpace || pendingWrite !== WriteKind.writeOperator) return; + if (pendingText === "+" && (s === "+" || s === "++") || + pendingText === "-" && (s === "-" || s === "--")) { + writeSpace(); + } + } + + function writeDotBeforeDotIfNeeded(s: string) { + if (s === "." && pendingWrite === WriteKind.writeStringLiteral) { + const ch = pendingText.charCodeAt(0); + if (ch === CharacterCodes._0 && pendingText.length > 1) { + // prefixed literals (00, 0o, 0x, 0b, etc.) do not need a `.`. Also catches 0. and 0e + return; + } + if (ch === CharacterCodes.dot) { + // decimal literal with leading `.` does not require a `.` + return; + } + if (isDigit(ch)) { + for (let i = 1; i < pendingText.length; i++) { + const ch = pendingText.charCodeAt(i); + if (ch === CharacterCodes.dot || ch === CharacterCodes.E || ch === CharacterCodes.e) { + // decimal literal with a `.` or scientific notation does not require a `.` + return; + } + } + } + pushWrite(WriteKind.writePunctuation, "."); + requestedSpace = false; + } + } + + function discardTrailingSemicolonBeforeEndBrace(s: string) { + if (s === "}" && pendingWrite === WriteKind.writeTrailingSemicolon) { + discardPendingWrite(); + } + } + + function discardTrailingSemicolonBeforeTrailingSemicolon() { + if (pendingWrite === WriteKind.writeTrailingSemicolon) { + discardPendingWrite(); + } + } + + return { + getTextPos: writer.getTextPos, + getLine: writer.getLine, + getColumn: writer.getColumn, + getIndent: writer.getIndent, + isAtStartOfLine: writer.isAtStartOfLine, + increaseIndent: noop, + decreaseIndent: noop, + clear() { + writer.clear(); + discardPendingWrite(); + clear(requestedSourceMapInfoBeforeSpace); + clear(requestedSourceMapInfoAfterSpace); + requestedSpace = false; + sourceMapGenerator = undefined; + }, + flush, + write(s) { + writeSpaceBeforeWordIfNeeded(); + pushWrite(WriteKind.write, s); + }, + rawWrite(s) { + flush(); + writer.rawWrite(s); + }, + writeKeyword(s) { + writeSpaceBeforeWordIfNeeded(); + pushWrite(WriteKind.writeKeyword, s); + }, + writeOperator(s) { + writeSpaceBeforeOperatorIfNeeded(s); + pushWrite(WriteKind.writeOperator, s); + }, + writePunctuation(s) { + discardTrailingSemicolonBeforeEndBrace(s); + writeDotBeforeDotIfNeeded(s); + pushWrite(WriteKind.writePunctuation, s); + }, + writeTrailingSemicolon(s) { + discardTrailingSemicolonBeforeTrailingSemicolon(); + pushWrite(WriteKind.writeTrailingSemicolon, s); + }, + writeSpace(_) { + requestedSpace = true; + }, + writeStringLiteral(s) { + writeSpaceBeforeLiteralIfNeeded(s); + pushWrite(WriteKind.writeStringLiteral, s); + }, + writeLiteral(s) { + writeSpaceBeforeLiteralIfNeeded(s); + pushWrite(WriteKind.writeLiteral, s); + }, + writeParameter(s) { + pushWrite(WriteKind.writeParameter, s); + }, + writeProperty(s) { + pushWrite(WriteKind.writeProperty, s); + }, + writeComment(s) { + pushWrite(WriteKind.writeComment, s); + }, + writeSymbol(text, symbol) { + writeSpaceBeforeWordIfNeeded(); + pendingWrite = WriteKind.writeSymbol; + pendingText = text; + pendingSymbol = symbol; + }, + writeLine() { + if (pendingWrite === WriteKind.writeComment) { + flush(); + writer.writeLine(); + requestedSpace = false; + } + else { + requestedSpace = true; + } + }, + getText() { + flush(); + return writer.getText(); + }, + getSourceMapEmitter(writer) { + sourceMapGenerator = writer; + if (!sourceMapEmitter) { + sourceMapEmitter = { + emitMapping: pushMapping, + emitSourceMap: pushSourceMap + }; + } + return sourceMapEmitter; + } }; } @@ -3426,13 +3784,13 @@ namespace ts { writeComment: (text: string, lineMap: ReadonlyArray, writer: EmitTextWriter, commentPos: number, commentEnd: number, newLine: string) => void) { if (comments && comments.length > 0) { if (leadingSeparator) { - writer.write(" "); + writer.writeSpace(" "); } let emitInterveningSeparator = false; for (const comment of comments) { if (emitInterveningSeparator) { - writer.write(" "); + writer.writeSpace(" "); emitInterveningSeparator = false; } @@ -3446,7 +3804,7 @@ namespace ts { } if (emitInterveningSeparator && trailingSeparator) { - writer.write(" "); + writer.writeSpace(" "); } } } @@ -3580,7 +3938,7 @@ namespace ts { } else { // Single line comment of style //.... - writer.write(text.substring(commentPos, commentEnd)); + writer.writeComment(text.substring(commentPos, commentEnd)); } } @@ -3589,14 +3947,14 @@ namespace ts { const currentLineText = text.substring(pos, end).replace(/^\s+|\s+$/g, ""); if (currentLineText) { // trimmed forward and ending spaces text - writer.write(currentLineText); + writer.writeComment(currentLineText); if (end !== commentEnd) { writer.writeLine(); } } else { // Empty string - make sure we write empty line - writer.writeLiteral(newLine); + writer.rawWrite(newLine); } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 58a63bc84c098..67d309719f55c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1648,6 +1648,7 @@ namespace Harness { let sourceMapCode = ""; result.maps.forEach(sourceMap => { + if (sourceMapCode) sourceMapCode += "\r\n"; sourceMapCode += fileOutput(sourceMap, harnessSettings); }); @@ -1675,6 +1676,9 @@ namespace Harness { let jsCode = ""; result.js.forEach(file => { + if (jsCode.length && jsCode.charCodeAt(jsCode.length - 1) !== ts.CharacterCodes.lineFeed) { + jsCode += "\r\n"; + } jsCode += fileOutput(file, harnessSettings); }); diff --git a/src/harness/sourceMapRecorder.ts b/src/harness/sourceMapRecorder.ts index a1aa07f8733d0..65236e78cb7bd 100644 --- a/src/harness/sourceMapRecorder.ts +++ b/src/harness/sourceMapRecorder.ts @@ -19,11 +19,7 @@ namespace Harness.SourceMapRecorder { decodingIndex = 0; sourceMapMappings = sourceMapData.sourceMapMappings; mappings = ts.sourcemaps.decodeMappings({ - version: 3, - file: sourceMapData.sourceMapFile, sources: sourceMapData.sourceMapSources, - sourceRoot: sourceMapData.sourceMapSourceRoot, - sourcesContent: sourceMapData.sourceMapSourcesContent, mappings: sourceMapData.sourceMapMappings, names: sourceMapData.sourceMapNames }); @@ -130,12 +126,19 @@ namespace Harness.SourceMapRecorder { } export function recordNewSourceFileSpan(sourceMapSpan: ts.SourceMapSpan, newSourceFileCode: string) { - assert.isTrue(spansOnSingleLine.length === 0 || spansOnSingleLine[0].sourceMapSpan.emittedLine !== sourceMapSpan.emittedLine, "new file source map span should be on new line. We currently handle only that scenario"); + let continuesLine = false; + if (spansOnSingleLine.length > 0 && spansOnSingleLine[0].sourceMapSpan.emittedLine === sourceMapSpan.emittedLine) { + writeRecordedSpans(); + spansOnSingleLine = []; + nextJsLineToWrite--; // walk back one line to reprint the line + continuesLine = true; + } + recordSourceMapSpan(sourceMapSpan); assert.isTrue(spansOnSingleLine.length === 1); sourceMapRecorder.WriteLine("-------------------------------------------------------------------"); - sourceMapRecorder.WriteLine("emittedFile:" + jsFile.file); + sourceMapRecorder.WriteLine("emittedFile:" + jsFile.file + (continuesLine ? ` (${sourceMapSpan.emittedLine + 1}, ${sourceMapSpan.emittedColumn + 1})` : "")); sourceMapRecorder.WriteLine("sourceFile:" + sourceMapSources[spansOnSingleLine[0].sourceMapSpan.sourceIndex]); sourceMapRecorder.WriteLine("-------------------------------------------------------------------"); diff --git a/src/services/sourcemaps.ts b/src/services/sourcemaps.ts index 1833c415be4d1..8ad5385a40848 100644 --- a/src/services/sourcemaps.ts +++ b/src/services/sourcemaps.ts @@ -42,14 +42,8 @@ namespace ts { } function convertDocumentToSourceMapper(file: { sourceMapper?: sourcemaps.SourceMapper }, contents: string, mapFileName: string) { - let maps: sourcemaps.SourceMapData | undefined; - try { - maps = JSON.parse(contents); - } - catch { - // swallow error - } - if (!maps || !maps.sources || !maps.file || !maps.mappings) { + const map = tryParseRawSourceMap(contents); + if (!map || !map.sources || !map.file || !map.mappings) { // obviously invalid map return file.sourceMapper = sourcemaps.identitySourceMapper; } @@ -58,7 +52,7 @@ namespace ts { fileExists: s => host.fileExists!(s), // TODO: GH#18217 getCanonicalFileName, log, - }, mapFileName, maps, getProgram(), sourcemappedFileCache); + }, mapFileName, map, getProgram(), sourcemappedFileCache); } function getSourceMapper(fileName: string, file: SourceFileLike): sourcemaps.SourceMapper { diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 51e60d08741f8..98872ea49880c 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -878,6 +878,9 @@ namespace ts.textChanges { this.writer.write(s); this.setLastNonTriviaPosition(s, /*force*/ false); } + writeComment(s: string): void { + this.writer.writeComment(s); + } writeKeyword(s: string): void { this.writer.writeKeyword(s); this.setLastNonTriviaPosition(s, /*force*/ false); @@ -890,6 +893,10 @@ namespace ts.textChanges { this.writer.writePunctuation(s); this.setLastNonTriviaPosition(s, /*force*/ false); } + writeTrailingSemicolon(s: string): void { + this.writer.writeTrailingSemicolon(s); + this.setLastNonTriviaPosition(s, /*force*/ false); + } writeParameter(s: string): void { this.writer.writeParameter(s); this.setLastNonTriviaPosition(s, /*force*/ false); @@ -910,9 +917,6 @@ namespace ts.textChanges { this.writer.writeSymbol(s, sym); this.setLastNonTriviaPosition(s, /*force*/ false); } - writeTextOfNode(text: string, node: Node): void { - this.writer.writeTextOfNode(text, node); - } writeLine(): void { this.writer.writeLine(); } @@ -948,6 +952,9 @@ namespace ts.textChanges { isAtStartOfLine(): boolean { return this.writer.isAtStartOfLine(); } + flush(): void { + this.writer.flush(); + } clear(): void { this.writer.clear(); this.lastNonTriviaPosition = 0; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 9e7b823fe54c4..1a5bea13eec76 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1431,6 +1431,7 @@ namespace ts { writeKeyword: text => writeKind(text, SymbolDisplayPartKind.keyword), writeOperator: text => writeKind(text, SymbolDisplayPartKind.operator), writePunctuation: text => writeKind(text, SymbolDisplayPartKind.punctuation), + writeTrailingSemicolon: text => writeKind(text, SymbolDisplayPartKind.punctuation), writeSpace: text => writeKind(text, SymbolDisplayPartKind.space), writeStringLiteral: text => writeKind(text, SymbolDisplayPartKind.stringLiteral), writeParameter: text => writeKind(text, SymbolDisplayPartKind.parameterName), @@ -1439,7 +1440,7 @@ namespace ts { writeSymbol, writeLine, write: unknownWrite, - writeTextOfNode: unknownWrite, + writeComment: unknownWrite, getText: () => "", getTextPos: () => 0, getColumn: () => 0, @@ -1450,6 +1451,7 @@ namespace ts { increaseIndent: () => { indent++; }, decreaseIndent: () => { indent--; }, clear: resetWriter, + flush: noop, trackSymbol: noop, reportInaccessibleThisError: noop, reportInaccessibleUniqueSymbolError: noop, diff --git a/src/testRunner/projectsRunner.ts b/src/testRunner/projectsRunner.ts index f3b4a0bca235e..62a186d4526a2 100644 --- a/src/testRunner/projectsRunner.ts +++ b/src/testRunner/projectsRunner.ts @@ -431,6 +431,7 @@ namespace project { skipDefaultLibCheck: false, moduleResolution: ts.ModuleResolutionKind.Classic, module: moduleKind, + newLine: ts.NewLineKind.CarriageReturnLineFeed, mapRoot: testCase.resolveMapRoot && testCase.mapRoot ? vpath.resolve(vfs.srcFolder, testCase.mapRoot) : testCase.mapRoot, diff --git a/src/testRunner/unittests/customTransforms.ts b/src/testRunner/unittests/customTransforms.ts index 8cbc42f759929..4217469e31e36 100644 --- a/src/testRunner/unittests/customTransforms.ts +++ b/src/testRunner/unittests/customTransforms.ts @@ -18,7 +18,7 @@ namespace ts { writeFile: (fileName, text) => outputs.set(fileName, text), }; - const program = createProgram(arrayFrom(fileMap.keys()), options, host); + const program = createProgram(arrayFrom(fileMap.keys()), { newLine: NewLineKind.LineFeed, ...options }, host); program.emit(/*targetSourceFile*/ undefined, host.writeFile, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ false, customTransformers); Harness.Baseline.runBaseline(`customTransforms/${name}.js`, () => { let content = ""; diff --git a/src/testRunner/unittests/tsserverProjectSystem.ts b/src/testRunner/unittests/tsserverProjectSystem.ts index 81c62ed808961..d35461d5da122 100644 --- a/src/testRunner/unittests/tsserverProjectSystem.ts +++ b/src/testRunner/unittests/tsserverProjectSystem.ts @@ -9201,7 +9201,7 @@ export function Test2() { const configContent = JSON.stringify({ compilerOptions }); const aTsconfig: File = { path: "/a/tsconfig.json", content: configContent }; - const aDtsMapContent: SourceMapSection = { + const aDtsMapContent: RawSourceMap = { version: 3, file: "a.d.ts", sourceRoot: "", @@ -9225,7 +9225,7 @@ export function Test2() { }; const bTsconfig: File = { path: "/b/tsconfig.json", content: configContent }; - const bDtsMapContent: SourceMapSection = { + const bDtsMapContent: RawSourceMap = { version: 3, file: "b.d.ts", sourceRoot: "", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index a16288c6c2725..f6765d46f5738 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -2482,6 +2482,7 @@ declare namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -2753,7 +2754,8 @@ declare namespace ts { Expression = 1, IdentifierName = 2, MappedTypeParameter = 3, - Unspecified = 4 + Unspecified = 4, + EmbeddedStatement = 5 } interface TransformationContext { /** Gets the compiler options supplied to the transformer. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 096362cc6a767..818e5d7222427 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2482,6 +2482,7 @@ declare namespace ts { jsxFactory?: string; composite?: boolean; removeComments?: boolean; + removeWhitespace?: boolean; rootDir?: string; rootDirs?: string[]; skipLibCheck?: boolean; @@ -2753,7 +2754,8 @@ declare namespace ts { Expression = 1, IdentifierName = 2, MappedTypeParameter = 3, - Unspecified = 4 + Unspecified = 4, + EmbeddedStatement = 5 } interface TransformationContext { /** Gets the compiler options supplied to the transformer. */ diff --git a/tests/baselines/reference/declarationMapsMultifile.js.map b/tests/baselines/reference/declarationMapsMultifile.js.map index cf1f1472a6081..80d8ac624c64a 100644 --- a/tests/baselines/reference/declarationMapsMultifile.js.map +++ b/tests/baselines/reference/declarationMapsMultifile.js.map @@ -1,3 +1,4 @@ //// [a.d.ts.map] -{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd"}//// [index.d.ts.map] +{"version":3,"file":"a.d.ts","sourceRoot":"","sources":["a.ts"],"names":[],"mappings":"AAAA,qBAAa,GAAG;IACZ,OAAO,CAAC,CAAC,EAAE;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd"} +//// [index.d.ts.map] {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,eAAO,IAAI,CAAC;;CAAqB,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/declarationMapsWithSourceMap.js.map b/tests/baselines/reference/declarationMapsWithSourceMap.js.map index 41114d427d00e..9a442371965dd 100644 --- a/tests/baselines/reference/declarationMapsWithSourceMap.js.map +++ b/tests/baselines/reference/declarationMapsWithSourceMap.js.map @@ -1,3 +1,4 @@ //// [bundle.js.map] -{"version":3,"file":"bundle.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,qBAAO,GAAP,UAAQ,CAAc;QAClB,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC;IACpB,CAAC;IACM,QAAI,GAAX;QACI,OAAO,IAAI,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;ACPD,IAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC;AAEnB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC"}//// [bundle.d.ts.map] +{"version":3,"file":"bundle.js","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA;IAAA;IAOA,CAAC;IANG,qBAAO,GAAP,UAAQ,CAAc;QAClB,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC;IACpB,CAAC;IACM,QAAI,GAAX;QACI,OAAO,IAAI,GAAG,EAAE,CAAC;IACrB,CAAC;IACL,UAAC;AAAD,CAAC,AAPD,IAOC;ACPD,IAAM,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;AACpB,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC;AAEnB,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAC,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC"} +//// [bundle.d.ts.map] {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["tests/cases/compiler/a.ts","tests/cases/compiler/index.ts"],"names":[],"mappings":"AAAA,cAAM,GAAG;IACL,OAAO,CAAC,GAAG;QAAC,CAAC,EAAE,MAAM,CAAA;KAAC;;;IAGtB,MAAM,CAAC,IAAI;CAGd;ACPD,QAAA,MAAM,CAAC,KAAY,CAAC;AAGpB,QAAA,IAAI,CAAC;;CAAqB,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryIdentifier.js b/tests/baselines/reference/jsxFactoryIdentifier.js index 817ef769d5304..a5ed7e66035fd 100644 --- a/tests/baselines/reference/jsxFactoryIdentifier.js +++ b/tests/baselines/reference/jsxFactoryIdentifier.js @@ -68,7 +68,8 @@ exports.createElement = Element.createElement; function toCamelCase(text) { return text[0].toLowerCase() + text.substring(1); } -//# sourceMappingURL=Element.js.map//// [test.js] +//# sourceMappingURL=Element.js.map +//// [test.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Element_1 = require("./Element"); diff --git a/tests/baselines/reference/jsxFactoryIdentifier.js.map b/tests/baselines/reference/jsxFactoryIdentifier.js.map index ea0db5040efbc..5ecfbe9d87ec4 100644 --- a/tests/baselines/reference/jsxFactoryIdentifier.js.map +++ b/tests/baselines/reference/jsxFactoryIdentifier.js.map @@ -1,3 +1,4 @@ //// [Element.js.map] -{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map] +{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"} +//// [test.js.map] {"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AACnC,IAAI,aAAa,GAAG,iBAAO,CAAC,aAAa,CAAC;AAC1C,IAAI,CAIH,CAAC;AAEF,MAAM,CAAC;IACN,IAAI;QACH,OAAO;YACN,wBAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,wBAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/tests/baselines/reference/jsxFactoryQualifiedName.js b/tests/baselines/reference/jsxFactoryQualifiedName.js index 63b45e878dd0f..14906d7a08770 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedName.js +++ b/tests/baselines/reference/jsxFactoryQualifiedName.js @@ -67,7 +67,8 @@ exports.createElement = Element.createElement; function toCamelCase(text) { return text[0].toLowerCase() + text.substring(1); } -//# sourceMappingURL=Element.js.map//// [test.js] +//# sourceMappingURL=Element.js.map +//// [test.js] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Element_1 = require("./Element"); diff --git a/tests/baselines/reference/jsxFactoryQualifiedName.js.map b/tests/baselines/reference/jsxFactoryQualifiedName.js.map index 4767276bd1039..619537c50ef26 100644 --- a/tests/baselines/reference/jsxFactoryQualifiedName.js.map +++ b/tests/baselines/reference/jsxFactoryQualifiedName.js.map @@ -1,3 +1,4 @@ //// [Element.js.map] -{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"}//// [test.js.map] +{"version":3,"file":"Element.js","sourceRoot":"","sources":["Element.ts"],"names":[],"mappings":";;AAYA,IAAiB,OAAO,CAUvB;AAVD,WAAiB,OAAO;IACpB,SAAgB,SAAS,CAAC,EAAO;QAC7B,OAAO,EAAE,CAAC,wBAAwB,KAAK,SAAS,CAAC;IACrD,CAAC;IAFe,iBAAS,YAExB,CAAA;IAED,SAAgB,aAAa,CAAC,IAAW;QAErC,OAAO,EACN,CAAA;IACL,CAAC;IAJe,qBAAa,gBAI5B,CAAA;AACL,CAAC,EAVgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAUvB;AAEU,QAAA,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;AAEjD,SAAS,WAAW,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC"} +//// [test.js.map] {"version":3,"file":"test.js","sourceRoot":"","sources":["test.tsx"],"names":[],"mappings":";;AAAA,uCAAmC;AAEnC,IAAI,CAIH,CAAC;AAEF,MAAM,CAAC;IACN,IAAI;QACH,OAAO;YACN,0CAAM,OAAO,EAAC,YAAY,GAAQ;YAClC,0CAAM,OAAO,EAAE,CAAC,CAAC,CAAE,CAAC,CAAC,GAAS;SAC9B,CAAC;IACH,CAAC;CACD"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.js b/tests/baselines/reference/removeWhitespace.outDir.js new file mode 100644 index 0000000000000..edd726321e9ca --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.js @@ -0,0 +1,231 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts] //// + +//// [global.d.ts] +declare let obj: any, i: any, fn; + +//// [propertyAccess.ts] +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +//// [elementAccess.ts] +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +//// [update.ts] +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +//// [switch.ts] +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +//// [keywords.ts] +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +//// [statements.ts] +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +//// [variables.ts] +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +//// [for.ts] +for(;;){} + +//// [embeddedStatement.ts] +{while(true);} + +//// [propertyAccess.js] +obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj// comment +.// comment +a;// comment +obj/* comment */./* comment */a;/* comment */ +1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1.// comment +.// comment +valueOf;// comment +1./* comment */./* comment */valueOf;/* comment */ +1..valueOf;1..valueOf;1// comment +.// comment +valueOf;// comment +1/* comment */./* comment */valueOf;/* comment */ +//# sourceMappingURL=propertyAccess.js.map +//// [elementAccess.js] +obj["a"];obj["a"];obj["a"];obj["a"];obj// comment +[// comment +"a"// comment +];// comment +obj/* comment */[/* comment */"a"/* comment */];/* comment */ +//# sourceMappingURL=elementAccess.js.map +//// [update.js] +i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +//# sourceMappingURL=update.js.map +//// [switch.js] +switch(i){case 0:break;case 1:break;default:break} +//# sourceMappingURL=switch.js.map +//// [keywords.js] +delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +//# sourceMappingURL=keywords.js.map +//// [statements.js] +obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +//# sourceMappingURL=statements.js.map +//// [variables.js] +var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +//# sourceMappingURL=variables.js.map +//// [for.js] +for(;;){} +//# sourceMappingURL=for.js.map +//// [embeddedStatement.js] +{while(true);} +//# sourceMappingURL=embeddedStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.js.map b/tests/baselines/reference/removeWhitespace.outDir.js.map new file mode 100644 index 0000000000000..2a8e9eefc99e4 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.js.map @@ -0,0 +1,18 @@ +//// [propertyAccess.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,CAAC,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,CAAC,CAAC,aAAa;AAEnB,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAG,UAAU;CACP,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,EAAG,aAAa,CACV,aACF,OAAO,CAAC,aAAa;AAEzB,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAE,UAAU;CACN,UAAU;AACZ,OAAO,CAAC,UAAU;AAEtB,CAAE,aAAa,CACT,aACF,OAAO,CAAC,aAAa"} +//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAI,UAAU;CACR,UAAU;AACZ,GAAI,UAAU;CACb,CAAC,UAAU;AAEhB,GAAI,aAAa,CACX,aACF,GAAI,aAAa,CAChB,CAAC,aAAa"} +//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"} +//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"} +//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"} +//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"} +//// [variables.js.map] +{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"} +//// [for.js.map] +{"version":3,"file":"for.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/for.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE"} +//// [embeddedStatement.js.map] +{"version":3,"file":"embeddedStatement.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/embeddedStatement.ts"],"names":[],"mappings":"AAAA,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt b/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt new file mode 100644 index 0000000000000..96207f593c876 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.sourcemap.txt @@ -0,0 +1,1888 @@ +=================================================================== +JsFile: propertyAccess.js +mapUrl: propertyAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/propertyAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/propertyAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/propertyAccess.ts +------------------------------------------------------------------- +>>>obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj// comment +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^ +18> ^^^ +19> ^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^ +25> ^ +26> ^^^ +27> ^ +28> ^ +29> ^ +30> ^^^ +31> ^^^^^^^^^^ +1 > +2 >obj +3 > . +4 > a +5 > + > +6 > obj +7 > . +8 > a +9 > + > +10> obj +11> . +12> a +13> + > +14> obj +15> . +16> a +17> + > + > +18> obj +19> . + > +20> a +21> + > + > +22> obj +23> + > . +24> a +25> + > + > +26> obj +27> + > . + > +28> a +29> + > + > +30> obj +31> // comment +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +5 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 4) + SourceIndex(0) +7 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +8 >Emitted(1, 12) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 13) Source(3, 1) + SourceIndex(0) +10>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +11>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +12>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +13>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +14>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +15>Emitted(1, 23) Source(4, 7) + SourceIndex(0) +16>Emitted(1, 24) Source(4, 8) + SourceIndex(0) +17>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +18>Emitted(1, 28) Source(6, 4) + SourceIndex(0) +19>Emitted(1, 29) Source(7, 5) + SourceIndex(0) +20>Emitted(1, 30) Source(7, 6) + SourceIndex(0) +21>Emitted(1, 31) Source(9, 1) + SourceIndex(0) +22>Emitted(1, 34) Source(9, 4) + SourceIndex(0) +23>Emitted(1, 35) Source(10, 6) + SourceIndex(0) +24>Emitted(1, 36) Source(10, 7) + SourceIndex(0) +25>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +26>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +27>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +28>Emitted(1, 42) Source(14, 6) + SourceIndex(0) +29>Emitted(1, 43) Source(16, 1) + SourceIndex(0) +30>Emitted(1, 46) Source(16, 5) + SourceIndex(0) +31>Emitted(1, 56) Source(16, 15) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^-> +1 > + > . +2 > // comment +1 >Emitted(2, 2) Source(17, 7) + SourceIndex(0) +2 >Emitted(2, 12) Source(17, 17) + SourceIndex(0) +--- +>>>a;// comment +1-> +2 >^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >a +3 > +4 > // comment +1->Emitted(3, 1) Source(18, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(18, 6) + SourceIndex(0) +3 >Emitted(3, 3) Source(18, 7) + SourceIndex(0) +4 >Emitted(3, 13) Source(18, 17) + SourceIndex(0) +--- +>>>obj/* comment */./* comment */a;/* comment */ +1-> +2 >^^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^ +9 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > + > +2 >obj +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > a +7 > +8 > /* comment */ +1->Emitted(4, 1) Source(20, 1) + SourceIndex(0) +2 >Emitted(4, 4) Source(20, 5) + SourceIndex(0) +3 >Emitted(4, 17) Source(20, 18) + SourceIndex(0) +4 >Emitted(4, 18) Source(21, 7) + SourceIndex(0) +5 >Emitted(4, 31) Source(22, 5) + SourceIndex(0) +6 >Emitted(4, 32) Source(22, 6) + SourceIndex(0) +7 >Emitted(4, 33) Source(22, 7) + SourceIndex(0) +8 >Emitted(4, 46) Source(22, 20) + SourceIndex(0) +--- +>>>1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1.// comment +1-> +2 >^^ +3 > ^ +4 > ^^^^^^^ +5 > ^ +6 > ^^ +7 > ^ +8 > ^^^^^^^ +9 > ^ +10> ^^ +11> ^ +12> ^^^^^^^ +13> ^ +14> ^^ +15> ^ +16> ^^^^^^^ +17> ^ +18> ^ +19> ^^ +20> ^^^^^^^ +21> ^ +22> ^ +23> ^^ +24> ^^^^^^^ +25> ^ +26> ^^ +27> ^ +28> ^^^^^^^ +29> ^ +30> ^^ +31> ^ +32> ^^^^^^^ +33> ^ +34> ^^ +35> ^ +36> ^^^^^^^ +37> ^ +38> ^^ +39> ^^^^^^^^^^ +1-> + > + > +2 >1. +3 > . +4 > valueOf +5 > + > +6 > 1. +7 > . +8 > valueOf +9 > + > +10> 1. +11> . +12> valueOf +13> + > +14> 1. +15> . +16> valueOf +17> + > +18> 1 +19> . +20> valueOf +21> + > +22> 1 +23> . +24> valueOf +25> + > + > +26> 1. +27> . + > +28> valueOf +29> + > + > +30> 1. +31> + > . +32> valueOf +33> + > + > +34> 1. +35> + > . + > +36> valueOf +37> + > + > +38> 1. +39> // comment +1->Emitted(5, 1) Source(24, 1) + SourceIndex(0) +2 >Emitted(5, 3) Source(24, 3) + SourceIndex(0) +3 >Emitted(5, 4) Source(24, 4) + SourceIndex(0) +4 >Emitted(5, 11) Source(24, 11) + SourceIndex(0) +5 >Emitted(5, 12) Source(25, 1) + SourceIndex(0) +6 >Emitted(5, 14) Source(25, 3) + SourceIndex(0) +7 >Emitted(5, 15) Source(25, 5) + SourceIndex(0) +8 >Emitted(5, 22) Source(25, 12) + SourceIndex(0) +9 >Emitted(5, 23) Source(26, 1) + SourceIndex(0) +10>Emitted(5, 25) Source(26, 3) + SourceIndex(0) +11>Emitted(5, 26) Source(26, 5) + SourceIndex(0) +12>Emitted(5, 33) Source(26, 12) + SourceIndex(0) +13>Emitted(5, 34) Source(27, 1) + SourceIndex(0) +14>Emitted(5, 36) Source(27, 3) + SourceIndex(0) +15>Emitted(5, 37) Source(27, 6) + SourceIndex(0) +16>Emitted(5, 44) Source(27, 13) + SourceIndex(0) +17>Emitted(5, 45) Source(28, 1) + SourceIndex(0) +18>Emitted(5, 46) Source(28, 2) + SourceIndex(0) +19>Emitted(5, 48) Source(28, 4) + SourceIndex(0) +20>Emitted(5, 55) Source(28, 11) + SourceIndex(0) +21>Emitted(5, 56) Source(29, 1) + SourceIndex(0) +22>Emitted(5, 57) Source(29, 2) + SourceIndex(0) +23>Emitted(5, 59) Source(29, 5) + SourceIndex(0) +24>Emitted(5, 66) Source(29, 12) + SourceIndex(0) +25>Emitted(5, 67) Source(31, 1) + SourceIndex(0) +26>Emitted(5, 69) Source(31, 3) + SourceIndex(0) +27>Emitted(5, 70) Source(32, 5) + SourceIndex(0) +28>Emitted(5, 77) Source(32, 12) + SourceIndex(0) +29>Emitted(5, 78) Source(34, 1) + SourceIndex(0) +30>Emitted(5, 80) Source(34, 3) + SourceIndex(0) +31>Emitted(5, 81) Source(35, 6) + SourceIndex(0) +32>Emitted(5, 88) Source(35, 13) + SourceIndex(0) +33>Emitted(5, 89) Source(37, 1) + SourceIndex(0) +34>Emitted(5, 91) Source(37, 3) + SourceIndex(0) +35>Emitted(5, 92) Source(39, 5) + SourceIndex(0) +36>Emitted(5, 99) Source(39, 12) + SourceIndex(0) +37>Emitted(5, 100) Source(41, 1) + SourceIndex(0) +38>Emitted(5, 102) Source(41, 4) + SourceIndex(0) +39>Emitted(5, 112) Source(41, 14) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^^^^^^-> +1 > + > . +2 > // comment +1 >Emitted(6, 2) Source(42, 7) + SourceIndex(0) +2 >Emitted(6, 12) Source(42, 17) + SourceIndex(0) +--- +>>>valueOf;// comment +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >valueOf +3 > +4 > // comment +1->Emitted(7, 1) Source(43, 5) + SourceIndex(0) +2 >Emitted(7, 8) Source(43, 12) + SourceIndex(0) +3 >Emitted(7, 9) Source(43, 13) + SourceIndex(0) +4 >Emitted(7, 19) Source(43, 23) + SourceIndex(0) +--- +>>>1./* comment */./* comment */valueOf;/* comment */ +1-> +2 >^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^ +1-> + > + > +2 >1. +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > valueOf +7 > +8 > /* comment */ +1->Emitted(8, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(8, 3) Source(45, 4) + SourceIndex(0) +3 >Emitted(8, 16) Source(45, 17) + SourceIndex(0) +4 >Emitted(8, 17) Source(46, 7) + SourceIndex(0) +5 >Emitted(8, 30) Source(47, 5) + SourceIndex(0) +6 >Emitted(8, 37) Source(47, 12) + SourceIndex(0) +7 >Emitted(8, 38) Source(47, 13) + SourceIndex(0) +8 >Emitted(8, 51) Source(47, 26) + SourceIndex(0) +--- +>>>1..valueOf;1..valueOf;1// comment +1 > +2 >^ +3 > ^^ +4 > ^^^^^^^ +5 > ^ +6 > ^ +7 > ^^ +8 > ^^^^^^^ +9 > ^ +10> ^ +11> ^^^^^^^^^^ +1 > + > + > +2 >1 +3 > + > . +4 > valueOf +5 > + > + > +6 > 1 +7 > + > . + > +8 > valueOf +9 > + > + > +10> 1 +11> // comment +1 >Emitted(9, 1) Source(49, 1) + SourceIndex(0) +2 >Emitted(9, 2) Source(49, 2) + SourceIndex(0) +3 >Emitted(9, 4) Source(50, 6) + SourceIndex(0) +4 >Emitted(9, 11) Source(50, 13) + SourceIndex(0) +5 >Emitted(9, 12) Source(52, 1) + SourceIndex(0) +6 >Emitted(9, 13) Source(52, 2) + SourceIndex(0) +7 >Emitted(9, 15) Source(54, 5) + SourceIndex(0) +8 >Emitted(9, 22) Source(54, 12) + SourceIndex(0) +9 >Emitted(9, 23) Source(56, 1) + SourceIndex(0) +10>Emitted(9, 24) Source(56, 3) + SourceIndex(0) +11>Emitted(9, 34) Source(56, 13) + SourceIndex(0) +--- +>>>.// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^^^^^^-> +1 > + > . +2 > // comment +1 >Emitted(10, 2) Source(57, 7) + SourceIndex(0) +2 >Emitted(10, 12) Source(57, 17) + SourceIndex(0) +--- +>>>valueOf;// comment +1-> +2 >^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1-> + > +2 >valueOf +3 > +4 > // comment +1->Emitted(11, 1) Source(58, 5) + SourceIndex(0) +2 >Emitted(11, 8) Source(58, 12) + SourceIndex(0) +3 >Emitted(11, 9) Source(58, 13) + SourceIndex(0) +4 >Emitted(11, 19) Source(58, 23) + SourceIndex(0) +--- +>>>1/* comment */./* comment */valueOf;/* comment */ +1-> +2 >^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^^^^^ +7 > ^ +8 > ^^^^^^^^^^^^^ +1-> + > + > +2 >1 +3 > /* comment */ +4 > + > . +5 > /* comment */ + > +6 > valueOf +7 > +8 > /* comment */ +1->Emitted(12, 1) Source(60, 1) + SourceIndex(0) +2 >Emitted(12, 2) Source(60, 3) + SourceIndex(0) +3 >Emitted(12, 15) Source(60, 16) + SourceIndex(0) +4 >Emitted(12, 16) Source(61, 7) + SourceIndex(0) +5 >Emitted(12, 29) Source(62, 5) + SourceIndex(0) +6 >Emitted(12, 36) Source(62, 12) + SourceIndex(0) +7 >Emitted(12, 37) Source(62, 13) + SourceIndex(0) +8 >Emitted(12, 50) Source(62, 26) + SourceIndex(0) +--- +>>>//# sourceMappingURL=propertyAccess.js.map=================================================================== +JsFile: elementAccess.js +mapUrl: elementAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/elementAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/elementAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/elementAccess.ts +------------------------------------------------------------------- +>>>obj["a"];obj["a"];obj["a"];obj["a"];obj// comment +1 > +2 >^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^^^ +18> ^ +19> ^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^^^^^^^ +1 > +2 >obj +3 > [ +4 > "a" +5 > ] +6 > + > +7 > obj +8 > [ +9 > "a" +10> ] +11> + > + > +12> obj +13> [ + > +14> "a" +15> ] +16> + > + > +17> obj +18> + > [ + > +19> "a" +20> + > ] +21> + > + > +22> obj +23> // comment +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 13) Source(2, 4) + SourceIndex(0) +8 >Emitted(1, 14) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 17) Source(2, 10) + SourceIndex(0) +10>Emitted(1, 18) Source(2, 12) + SourceIndex(0) +11>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +13>Emitted(1, 23) Source(5, 5) + SourceIndex(0) +14>Emitted(1, 26) Source(5, 8) + SourceIndex(0) +15>Emitted(1, 27) Source(5, 10) + SourceIndex(0) +16>Emitted(1, 28) Source(7, 1) + SourceIndex(0) +17>Emitted(1, 31) Source(7, 4) + SourceIndex(0) +18>Emitted(1, 32) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 35) Source(9, 8) + SourceIndex(0) +20>Emitted(1, 36) Source(10, 6) + SourceIndex(0) +21>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +22>Emitted(1, 40) Source(12, 5) + SourceIndex(0) +23>Emitted(1, 50) Source(12, 15) + SourceIndex(0) +--- +>>>[// comment +1 >^ +2 > ^^^^^^^^^^ +3 > ^^^-> +1 > + > [ +2 > // comment +1 >Emitted(2, 2) Source(13, 7) + SourceIndex(0) +2 >Emitted(2, 12) Source(13, 17) + SourceIndex(0) +--- +>>>"a"// comment +1-> +2 >^^^ +3 > ^^^^^^^^^^ +1-> + > +2 >"a" +3 > // comment +1->Emitted(3, 1) Source(14, 5) + SourceIndex(0) +2 >Emitted(3, 4) Source(14, 9) + SourceIndex(0) +3 >Emitted(3, 14) Source(14, 19) + SourceIndex(0) +--- +>>>];// comment +1 >^ +2 > ^ +3 > ^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + > ] +2 > +3 > // comment +1 >Emitted(4, 2) Source(15, 6) + SourceIndex(0) +2 >Emitted(4, 3) Source(15, 7) + SourceIndex(0) +3 >Emitted(4, 13) Source(15, 17) + SourceIndex(0) +--- +>>>obj/* comment */[/* comment */"a"/* comment */];/* comment */ +1-> +2 >^^^ +3 > ^^^^^^^^^^^^^ +4 > ^ +5 > ^^^^^^^^^^^^^ +6 > ^^^ +7 > ^^^^^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^^^^^^^^^^^^ +1-> + > + > +2 >obj +3 > /* comment */ +4 > + > [ +5 > /* comment */ + > +6 > "a" +7 > /* comment */ +8 > + > ] +9 > +10> /* comment */ +1->Emitted(5, 1) Source(17, 1) + SourceIndex(0) +2 >Emitted(5, 4) Source(17, 5) + SourceIndex(0) +3 >Emitted(5, 17) Source(17, 18) + SourceIndex(0) +4 >Emitted(5, 18) Source(18, 7) + SourceIndex(0) +5 >Emitted(5, 31) Source(19, 5) + SourceIndex(0) +6 >Emitted(5, 34) Source(19, 9) + SourceIndex(0) +7 >Emitted(5, 47) Source(19, 22) + SourceIndex(0) +8 >Emitted(5, 48) Source(20, 6) + SourceIndex(0) +9 >Emitted(5, 49) Source(20, 7) + SourceIndex(0) +10>Emitted(5, 62) Source(20, 20) + SourceIndex(0) +--- +>>>//# sourceMappingURL=elementAccess.js.map=================================================================== +JsFile: update.js +mapUrl: update.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/update.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/update.js +sourceFile:../tests/cases/conformance/removeWhitespace/update.ts +------------------------------------------------------------------- +>>>i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +1 > +2 >^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^ +19> ^ +20> ^ +21> ^ +22> ^ +23> ^^ +24> ^^ +25> ^ +26> ^ +27> ^ +28> ^^ +29> ^^ +30> ^ +31> ^ +32> ^ +33> ^^ +34> ^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^^ +40> ^ +41> ^ +42> ^ +43> ^^ +44> ^ +45> ^ +46> ^ +47> ^ +48> ^^ +49> ^ +50> ^ +51> ^ +52> ^ +53> ^^ +54> ^ +55> ^ +56> ^ +57> ^ +58> ^^ +59> ^ +60> ^ +61> ^ +62> ^ +63> ^^ +64> ^ +65> ^ +66> ^ +67> ^ +68> ^^ +69> ^ +70> ^ +71> ^ +72> ^ +73> ^^ +74> ^ +75> ^ +76> ^ +77> ^ +78> ^^ +79> ^ +80> ^ +81> ^ +82> ^ +83> ^^ +84> ^ +85> ^ +86> ^ +87> ^ +88> ^^ +89> ^^ +90> ^ +91> ^ +92> ^ +93> ^^ +94> ^^ +95> ^ +96> ^ +97> ^ +98> ^^ +99> ^^ +100> ^ +101> ^ +102> ^ +103> ^^ +104> ^^ +105> ^ +106> ^ +107> ^ +108> ^^ +109> ^ +110> ^ +111> ^ +112> ^ +113> ^^ +114> ^ +115> ^ +116> ^ +117> ^ +118> ^^ +119> ^ +120> ^ +121> ^ +122> ^ +123> ^^ +124> ^ +125> ^ +126> ^ +127> ^ +128> ^^ +129> ^ +130> ^ +131> ^ +1 > +2 >i +3 > + +4 > + +5 > i +6 > + > +7 > i +8 > + +9 > + +10> i +11> + > +12> i +13> + +14> + +15> i +16> + > +17> i +18> + +19> + +20> i +21> + > + > +22> i +23> + +24> ++ +25> i +26> + > +27> i +28> + +29> ++ +30> i +31> + > +32> i +33> + +34> ++ +35> i +36> + > +37> i +38> + +39> ++ +40> i +41> + > + > +42> i +43> ++ +44> + +45> i +46> + > +47> i +48> ++ +49> + +50> i +51> + > +52> i +53> ++ +54> + +55> i +56> + > +57> i +58> ++ +59> + +60> i +61> + > +62> i +63> ++ +64> + +65> i +66> + > + > +67> i +68> - +69> - +70> i +71> + > +72> i +73> - +74> - +75> i +76> + > +77> i +78> - +79> - +80> i +81> + > +82> i +83> - +84> - +85> i +86> + > + > +87> i +88> - +89> -- +90> i +91> + > +92> i +93> - +94> -- +95> i +96> + > +97> i +98> - +99> -- +100> i +101> + > +102> i +103> - +104> -- +105> i +106> + > + > +107> i +108> -- +109> - +110> i +111> + > +112> i +113> -- +114> - +115> i +116> + > +117> i +118> -- +119> - +120> i +121> + > +122> i +123> -- +124> - +125> i +126> + > +127> i +128> -- +129> - +130> i +131> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 4) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +5 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +6 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 8) Source(2, 2) + SourceIndex(0) +8 >Emitted(1, 10) Source(2, 5) + SourceIndex(0) +9 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +10>Emitted(1, 12) Source(2, 7) + SourceIndex(0) +11>Emitted(1, 13) Source(3, 1) + SourceIndex(0) +12>Emitted(1, 14) Source(3, 2) + SourceIndex(0) +13>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +14>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +15>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +16>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +17>Emitted(1, 20) Source(4, 2) + SourceIndex(0) +18>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +19>Emitted(1, 23) Source(4, 5) + SourceIndex(0) +20>Emitted(1, 24) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +22>Emitted(1, 26) Source(6, 2) + SourceIndex(0) +23>Emitted(1, 28) Source(6, 5) + SourceIndex(0) +24>Emitted(1, 30) Source(6, 8) + SourceIndex(0) +25>Emitted(1, 31) Source(6, 9) + SourceIndex(0) +26>Emitted(1, 32) Source(7, 1) + SourceIndex(0) +27>Emitted(1, 33) Source(7, 2) + SourceIndex(0) +28>Emitted(1, 35) Source(7, 5) + SourceIndex(0) +29>Emitted(1, 37) Source(7, 7) + SourceIndex(0) +30>Emitted(1, 38) Source(7, 8) + SourceIndex(0) +31>Emitted(1, 39) Source(8, 1) + SourceIndex(0) +32>Emitted(1, 40) Source(8, 2) + SourceIndex(0) +33>Emitted(1, 42) Source(8, 4) + SourceIndex(0) +34>Emitted(1, 44) Source(8, 7) + SourceIndex(0) +35>Emitted(1, 45) Source(8, 8) + SourceIndex(0) +36>Emitted(1, 46) Source(9, 1) + SourceIndex(0) +37>Emitted(1, 47) Source(9, 2) + SourceIndex(0) +38>Emitted(1, 49) Source(9, 4) + SourceIndex(0) +39>Emitted(1, 51) Source(9, 6) + SourceIndex(0) +40>Emitted(1, 52) Source(9, 7) + SourceIndex(0) +41>Emitted(1, 53) Source(11, 1) + SourceIndex(0) +42>Emitted(1, 54) Source(11, 2) + SourceIndex(0) +43>Emitted(1, 56) Source(11, 5) + SourceIndex(0) +44>Emitted(1, 57) Source(11, 8) + SourceIndex(0) +45>Emitted(1, 58) Source(11, 9) + SourceIndex(0) +46>Emitted(1, 59) Source(12, 1) + SourceIndex(0) +47>Emitted(1, 60) Source(12, 2) + SourceIndex(0) +48>Emitted(1, 62) Source(12, 5) + SourceIndex(0) +49>Emitted(1, 63) Source(12, 7) + SourceIndex(0) +50>Emitted(1, 64) Source(12, 8) + SourceIndex(0) +51>Emitted(1, 65) Source(13, 1) + SourceIndex(0) +52>Emitted(1, 66) Source(13, 2) + SourceIndex(0) +53>Emitted(1, 68) Source(13, 4) + SourceIndex(0) +54>Emitted(1, 69) Source(13, 7) + SourceIndex(0) +55>Emitted(1, 70) Source(13, 8) + SourceIndex(0) +56>Emitted(1, 71) Source(14, 1) + SourceIndex(0) +57>Emitted(1, 72) Source(14, 2) + SourceIndex(0) +58>Emitted(1, 74) Source(14, 4) + SourceIndex(0) +59>Emitted(1, 75) Source(14, 6) + SourceIndex(0) +60>Emitted(1, 76) Source(14, 7) + SourceIndex(0) +61>Emitted(1, 77) Source(15, 1) + SourceIndex(0) +62>Emitted(1, 78) Source(15, 2) + SourceIndex(0) +63>Emitted(1, 80) Source(15, 4) + SourceIndex(0) +64>Emitted(1, 81) Source(15, 5) + SourceIndex(0) +65>Emitted(1, 82) Source(15, 6) + SourceIndex(0) +66>Emitted(1, 83) Source(17, 1) + SourceIndex(0) +67>Emitted(1, 84) Source(17, 2) + SourceIndex(0) +68>Emitted(1, 86) Source(17, 5) + SourceIndex(0) +69>Emitted(1, 87) Source(17, 7) + SourceIndex(0) +70>Emitted(1, 88) Source(17, 8) + SourceIndex(0) +71>Emitted(1, 89) Source(18, 1) + SourceIndex(0) +72>Emitted(1, 90) Source(18, 2) + SourceIndex(0) +73>Emitted(1, 92) Source(18, 5) + SourceIndex(0) +74>Emitted(1, 93) Source(18, 6) + SourceIndex(0) +75>Emitted(1, 94) Source(18, 7) + SourceIndex(0) +76>Emitted(1, 95) Source(19, 1) + SourceIndex(0) +77>Emitted(1, 96) Source(19, 2) + SourceIndex(0) +78>Emitted(1, 98) Source(19, 4) + SourceIndex(0) +79>Emitted(1, 99) Source(19, 6) + SourceIndex(0) +80>Emitted(1, 100) Source(19, 7) + SourceIndex(0) +81>Emitted(1, 101) Source(20, 1) + SourceIndex(0) +82>Emitted(1, 102) Source(20, 2) + SourceIndex(0) +83>Emitted(1, 104) Source(20, 4) + SourceIndex(0) +84>Emitted(1, 105) Source(20, 5) + SourceIndex(0) +85>Emitted(1, 106) Source(20, 6) + SourceIndex(0) +86>Emitted(1, 107) Source(22, 1) + SourceIndex(0) +87>Emitted(1, 108) Source(22, 2) + SourceIndex(0) +88>Emitted(1, 110) Source(22, 5) + SourceIndex(0) +89>Emitted(1, 112) Source(22, 8) + SourceIndex(0) +90>Emitted(1, 113) Source(22, 9) + SourceIndex(0) +91>Emitted(1, 114) Source(23, 1) + SourceIndex(0) +92>Emitted(1, 115) Source(23, 2) + SourceIndex(0) +93>Emitted(1, 117) Source(23, 5) + SourceIndex(0) +94>Emitted(1, 119) Source(23, 7) + SourceIndex(0) +95>Emitted(1, 120) Source(23, 8) + SourceIndex(0) +96>Emitted(1, 121) Source(24, 1) + SourceIndex(0) +97>Emitted(1, 122) Source(24, 2) + SourceIndex(0) +98>Emitted(1, 124) Source(24, 4) + SourceIndex(0) +99>Emitted(1, 126) Source(24, 7) + SourceIndex(0) +100>Emitted(1, 127) Source(24, 8) + SourceIndex(0) +101>Emitted(1, 128) Source(25, 1) + SourceIndex(0) +102>Emitted(1, 129) Source(25, 2) + SourceIndex(0) +103>Emitted(1, 131) Source(25, 4) + SourceIndex(0) +104>Emitted(1, 133) Source(25, 6) + SourceIndex(0) +105>Emitted(1, 134) Source(25, 7) + SourceIndex(0) +106>Emitted(1, 135) Source(27, 1) + SourceIndex(0) +107>Emitted(1, 136) Source(27, 2) + SourceIndex(0) +108>Emitted(1, 138) Source(27, 5) + SourceIndex(0) +109>Emitted(1, 139) Source(27, 8) + SourceIndex(0) +110>Emitted(1, 140) Source(27, 9) + SourceIndex(0) +111>Emitted(1, 141) Source(28, 1) + SourceIndex(0) +112>Emitted(1, 142) Source(28, 2) + SourceIndex(0) +113>Emitted(1, 144) Source(28, 5) + SourceIndex(0) +114>Emitted(1, 145) Source(28, 7) + SourceIndex(0) +115>Emitted(1, 146) Source(28, 8) + SourceIndex(0) +116>Emitted(1, 147) Source(29, 1) + SourceIndex(0) +117>Emitted(1, 148) Source(29, 2) + SourceIndex(0) +118>Emitted(1, 150) Source(29, 4) + SourceIndex(0) +119>Emitted(1, 151) Source(29, 7) + SourceIndex(0) +120>Emitted(1, 152) Source(29, 8) + SourceIndex(0) +121>Emitted(1, 153) Source(30, 1) + SourceIndex(0) +122>Emitted(1, 154) Source(30, 2) + SourceIndex(0) +123>Emitted(1, 156) Source(30, 4) + SourceIndex(0) +124>Emitted(1, 157) Source(30, 6) + SourceIndex(0) +125>Emitted(1, 158) Source(30, 7) + SourceIndex(0) +126>Emitted(1, 159) Source(31, 1) + SourceIndex(0) +127>Emitted(1, 160) Source(31, 2) + SourceIndex(0) +128>Emitted(1, 162) Source(31, 4) + SourceIndex(0) +129>Emitted(1, 163) Source(31, 5) + SourceIndex(0) +130>Emitted(1, 164) Source(31, 6) + SourceIndex(0) +131>Emitted(1, 165) Source(31, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=update.js.map=================================================================== +JsFile: switch.js +mapUrl: switch.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/switch.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/switch.js +sourceFile:../tests/cases/conformance/removeWhitespace/switch.ts +------------------------------------------------------------------- +>>>switch(i){case 0:break;case 1:break;default:break} +1 > +2 >^^^^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +9 > ^^^^^^ +10> ^^^^^ +11> ^ +12> ^ +13> ^^^^^^ +14> ^^^^^^^ +15> ^ +16> ^^^^^ +17> ^ +1 > +2 >switch ( +3 > i +4 > ) +5 > { + > +6 > case +7 > 0 +8 > : +9 > break; + > +10> case +11> 1 +12> : +13> break; + > +14> default +15> : +16> break; +17> + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 9) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 10) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 11) Source(2, 5) + SourceIndex(0) +6 >Emitted(1, 16) Source(2, 10) + SourceIndex(0) +7 >Emitted(1, 17) Source(2, 11) + SourceIndex(0) +8 >Emitted(1, 18) Source(2, 13) + SourceIndex(0) +9 >Emitted(1, 24) Source(3, 5) + SourceIndex(0) +10>Emitted(1, 29) Source(3, 10) + SourceIndex(0) +11>Emitted(1, 30) Source(3, 11) + SourceIndex(0) +12>Emitted(1, 31) Source(3, 13) + SourceIndex(0) +13>Emitted(1, 37) Source(4, 5) + SourceIndex(0) +14>Emitted(1, 44) Source(4, 12) + SourceIndex(0) +15>Emitted(1, 45) Source(4, 14) + SourceIndex(0) +16>Emitted(1, 50) Source(4, 20) + SourceIndex(0) +17>Emitted(1, 51) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=switch.js.map=================================================================== +JsFile: keywords.js +mapUrl: keywords.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/keywords.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/keywords.js +sourceFile:../tests/cases/conformance/removeWhitespace/keywords.ts +------------------------------------------------------------------- +>>>delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +1 > +2 >^^^^^^^ +3 > ^^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^^^^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^^^^^ +21> ^^^ +22> ^ +23> ^ +24> ^ +25> ^^^^ +26> ^ +27> ^^^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^^ +33> ^^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^^^^^ +39> ^^^ +40> ^ +41> ^ +42> ^ +43> ^^^^^^ +44> ^ +45> ^^^ +46> ^ +47> ^ +48> ^ +49> ^ +50> ^^^^^^ +51> ^^ +52> ^ +53> ^ +54> ^ +55> ^ +56> ^^^^^^^^^ +57> ^^ +58> ^^^ +59> ^^^^^^^ +60> ^^^^^^^ +61> ^^^ +62> ^ +63> ^^^^^^ +64> ^^^^^^^^ +65> ^ +66> ^^ +67> ^^^ +68> ^^^^^^ +69> ^ +70> ^ +71> ^^^^^^ +72> ^^^ +73> ^ +74> ^^^^^ +75> ^ +76> ^^^ +77> ^ +78> ^ +79> ^^^^^ +80> ^^ +81> ^ +82> ^^^^^ +83> ^ +84> ^^ +85> ^ +86> ^^^^^ +87> ^ +88> ^^ +89> ^ +90> ^^^^^ +91> ^ +92> ^^ +93> ^ +94> ^^^^^ +95> ^ +96> ^ +97> ^ +98> ^^^^^^ +99> ^^^^^ +100> ^ +101> ^^^^^^ +102> ^^^^^^^ +103> ^^^ +104> ^ +105> ^^^^^^ +106> ^^^^^ +107> ^^^ +108> ^ +109> ^^^^^^ +110> ^^^^^^^ +111> ^^^ +112> ^ +113> ^ +114> ^ +115> ^^^^^^ +116> ^ +117> ^ +118> ^^^^^^ +119> ^^^ +120> ^ +121> ^^^^ +122> ^^^^^ +123> ^ +124> ^^^^^^ +125> ^ +126> ^^^ +127> ^^ +128> ^ +129> ^ +130> ^^^^^^^ +131> ^^^^^^ +132> ^^^^^^ +133> ^^^ +134> ^ +135> ^^^^^^^ +136> ^^^^^^ +137> ^ +138> ^^ +139> ^^^^^^^ +140> ^^^^^^^ +141> ^^^^^^^^^^^^ +142> ^ +1 > +2 >delete +3 > obj +4 > . +5 > a +6 > + > +7 > delete +8 > ( +9 > obj +10> ) +11> . +12> a +13> + > +14> delete +15> [] +16> [ +17> 0 +18> ] +19> + > +20> void +21> obj +22> . +23> a +24> + > +25> void +26> ( +27> obj +28> ) +29> . +30> a +31> + > +32> void +33> [] +34> [ +35> 0 +36> ] +37> + > +38> typeof +39> obj +40> . +41> a +42> + > +43> typeof +44> ( +45> obj +46> ) +47> . +48> a +49> + > +50> typeof +51> [] +52> [ +53> 0 +54> ] +55> + > +56> function +57> f1 +58> () { + > +59> return +60> typeof +61> obj + > +62> } + > +63> async +64> function +65> * +66> f2 +67> () { + > +68> yield +69> 1 +70> + > +71> yield +72> obj +73> + > +74> yield +75> ( +76> obj +77> ) +78> + > +79> yield +80> [] +81> + > +82> yield +83> * +84> [] +85> + > +86> yield +87> * +88> [] +89> + > +90> yield +91> * +92> [] +93> + > +94> yield +95> + > +96> i +97> + > +98> yield +99> yield +100> + > +101> yield +102> typeof +103> obj +104> + > +105> yield +106> void +107> obj +108> + > +109> yield +110> delete +111> obj +112> . +113> a +114> + > +115> await +116> 1 +117> + > +118> await +119> obj +120> + > +121> for +122> await +123> ( +124> const +125> x +126> of +127> [] +128> ) +129> ; + > +130> return +131> yield +132> await +133> obj + > +134> } + > +135> export +136> class +137> C +138> {} + > +139> export +140> default +141> function() { +142> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 20) Source(2, 8) + SourceIndex(0) +8 >Emitted(1, 21) Source(2, 9) + SourceIndex(0) +9 >Emitted(1, 24) Source(2, 12) + SourceIndex(0) +10>Emitted(1, 25) Source(2, 13) + SourceIndex(0) +11>Emitted(1, 26) Source(2, 14) + SourceIndex(0) +12>Emitted(1, 27) Source(2, 15) + SourceIndex(0) +13>Emitted(1, 28) Source(3, 1) + SourceIndex(0) +14>Emitted(1, 34) Source(3, 8) + SourceIndex(0) +15>Emitted(1, 36) Source(3, 10) + SourceIndex(0) +16>Emitted(1, 37) Source(3, 11) + SourceIndex(0) +17>Emitted(1, 38) Source(3, 12) + SourceIndex(0) +18>Emitted(1, 39) Source(3, 13) + SourceIndex(0) +19>Emitted(1, 40) Source(4, 1) + SourceIndex(0) +20>Emitted(1, 45) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 48) Source(4, 9) + SourceIndex(0) +22>Emitted(1, 49) Source(4, 10) + SourceIndex(0) +23>Emitted(1, 50) Source(4, 11) + SourceIndex(0) +24>Emitted(1, 51) Source(5, 1) + SourceIndex(0) +25>Emitted(1, 55) Source(5, 6) + SourceIndex(0) +26>Emitted(1, 56) Source(5, 7) + SourceIndex(0) +27>Emitted(1, 59) Source(5, 10) + SourceIndex(0) +28>Emitted(1, 60) Source(5, 11) + SourceIndex(0) +29>Emitted(1, 61) Source(5, 12) + SourceIndex(0) +30>Emitted(1, 62) Source(5, 13) + SourceIndex(0) +31>Emitted(1, 63) Source(6, 1) + SourceIndex(0) +32>Emitted(1, 67) Source(6, 6) + SourceIndex(0) +33>Emitted(1, 69) Source(6, 8) + SourceIndex(0) +34>Emitted(1, 70) Source(6, 9) + SourceIndex(0) +35>Emitted(1, 71) Source(6, 10) + SourceIndex(0) +36>Emitted(1, 72) Source(6, 11) + SourceIndex(0) +37>Emitted(1, 73) Source(7, 1) + SourceIndex(0) +38>Emitted(1, 80) Source(7, 8) + SourceIndex(0) +39>Emitted(1, 83) Source(7, 11) + SourceIndex(0) +40>Emitted(1, 84) Source(7, 12) + SourceIndex(0) +41>Emitted(1, 85) Source(7, 13) + SourceIndex(0) +42>Emitted(1, 86) Source(8, 1) + SourceIndex(0) +43>Emitted(1, 92) Source(8, 8) + SourceIndex(0) +44>Emitted(1, 93) Source(8, 9) + SourceIndex(0) +45>Emitted(1, 96) Source(8, 12) + SourceIndex(0) +46>Emitted(1, 97) Source(8, 13) + SourceIndex(0) +47>Emitted(1, 98) Source(8, 14) + SourceIndex(0) +48>Emitted(1, 99) Source(8, 15) + SourceIndex(0) +49>Emitted(1, 100) Source(9, 1) + SourceIndex(0) +50>Emitted(1, 106) Source(9, 8) + SourceIndex(0) +51>Emitted(1, 108) Source(9, 10) + SourceIndex(0) +52>Emitted(1, 109) Source(9, 11) + SourceIndex(0) +53>Emitted(1, 110) Source(9, 12) + SourceIndex(0) +54>Emitted(1, 111) Source(9, 13) + SourceIndex(0) +55>Emitted(1, 112) Source(10, 1) + SourceIndex(0) +56>Emitted(1, 121) Source(10, 10) + SourceIndex(0) +57>Emitted(1, 123) Source(10, 12) + SourceIndex(0) +58>Emitted(1, 126) Source(11, 5) + SourceIndex(0) +59>Emitted(1, 133) Source(11, 12) + SourceIndex(0) +60>Emitted(1, 140) Source(11, 19) + SourceIndex(0) +61>Emitted(1, 143) Source(12, 1) + SourceIndex(0) +62>Emitted(1, 144) Source(13, 1) + SourceIndex(0) +63>Emitted(1, 150) Source(13, 6) + SourceIndex(0) +64>Emitted(1, 158) Source(13, 15) + SourceIndex(0) +65>Emitted(1, 159) Source(13, 17) + SourceIndex(0) +66>Emitted(1, 161) Source(13, 19) + SourceIndex(0) +67>Emitted(1, 164) Source(14, 5) + SourceIndex(0) +68>Emitted(1, 170) Source(14, 11) + SourceIndex(0) +69>Emitted(1, 171) Source(14, 12) + SourceIndex(0) +70>Emitted(1, 172) Source(15, 5) + SourceIndex(0) +71>Emitted(1, 178) Source(15, 11) + SourceIndex(0) +72>Emitted(1, 181) Source(15, 14) + SourceIndex(0) +73>Emitted(1, 182) Source(16, 5) + SourceIndex(0) +74>Emitted(1, 187) Source(16, 11) + SourceIndex(0) +75>Emitted(1, 188) Source(16, 12) + SourceIndex(0) +76>Emitted(1, 191) Source(16, 15) + SourceIndex(0) +77>Emitted(1, 192) Source(16, 16) + SourceIndex(0) +78>Emitted(1, 193) Source(17, 5) + SourceIndex(0) +79>Emitted(1, 198) Source(17, 11) + SourceIndex(0) +80>Emitted(1, 200) Source(17, 13) + SourceIndex(0) +81>Emitted(1, 201) Source(18, 5) + SourceIndex(0) +82>Emitted(1, 206) Source(18, 10) + SourceIndex(0) +83>Emitted(1, 207) Source(18, 12) + SourceIndex(0) +84>Emitted(1, 209) Source(18, 14) + SourceIndex(0) +85>Emitted(1, 210) Source(19, 5) + SourceIndex(0) +86>Emitted(1, 215) Source(19, 11) + SourceIndex(0) +87>Emitted(1, 216) Source(19, 12) + SourceIndex(0) +88>Emitted(1, 218) Source(19, 14) + SourceIndex(0) +89>Emitted(1, 219) Source(20, 5) + SourceIndex(0) +90>Emitted(1, 224) Source(20, 11) + SourceIndex(0) +91>Emitted(1, 225) Source(20, 13) + SourceIndex(0) +92>Emitted(1, 227) Source(20, 15) + SourceIndex(0) +93>Emitted(1, 228) Source(21, 5) + SourceIndex(0) +94>Emitted(1, 233) Source(21, 10) + SourceIndex(0) +95>Emitted(1, 234) Source(22, 5) + SourceIndex(0) +96>Emitted(1, 235) Source(22, 6) + SourceIndex(0) +97>Emitted(1, 236) Source(23, 5) + SourceIndex(0) +98>Emitted(1, 242) Source(23, 11) + SourceIndex(0) +99>Emitted(1, 247) Source(23, 16) + SourceIndex(0) +100>Emitted(1, 248) Source(24, 5) + SourceIndex(0) +101>Emitted(1, 254) Source(24, 11) + SourceIndex(0) +102>Emitted(1, 261) Source(24, 18) + SourceIndex(0) +103>Emitted(1, 264) Source(24, 21) + SourceIndex(0) +104>Emitted(1, 265) Source(25, 5) + SourceIndex(0) +105>Emitted(1, 271) Source(25, 11) + SourceIndex(0) +106>Emitted(1, 276) Source(25, 16) + SourceIndex(0) +107>Emitted(1, 279) Source(25, 19) + SourceIndex(0) +108>Emitted(1, 280) Source(26, 5) + SourceIndex(0) +109>Emitted(1, 286) Source(26, 11) + SourceIndex(0) +110>Emitted(1, 293) Source(26, 18) + SourceIndex(0) +111>Emitted(1, 296) Source(26, 21) + SourceIndex(0) +112>Emitted(1, 297) Source(26, 22) + SourceIndex(0) +113>Emitted(1, 298) Source(26, 23) + SourceIndex(0) +114>Emitted(1, 299) Source(27, 5) + SourceIndex(0) +115>Emitted(1, 305) Source(27, 11) + SourceIndex(0) +116>Emitted(1, 306) Source(27, 12) + SourceIndex(0) +117>Emitted(1, 307) Source(28, 5) + SourceIndex(0) +118>Emitted(1, 313) Source(28, 11) + SourceIndex(0) +119>Emitted(1, 316) Source(28, 14) + SourceIndex(0) +120>Emitted(1, 317) Source(29, 5) + SourceIndex(0) +121>Emitted(1, 321) Source(29, 9) + SourceIndex(0) +122>Emitted(1, 326) Source(29, 14) + SourceIndex(0) +123>Emitted(1, 327) Source(29, 16) + SourceIndex(0) +124>Emitted(1, 333) Source(29, 22) + SourceIndex(0) +125>Emitted(1, 334) Source(29, 23) + SourceIndex(0) +126>Emitted(1, 337) Source(29, 27) + SourceIndex(0) +127>Emitted(1, 339) Source(29, 29) + SourceIndex(0) +128>Emitted(1, 340) Source(29, 30) + SourceIndex(0) +129>Emitted(1, 341) Source(30, 5) + SourceIndex(0) +130>Emitted(1, 348) Source(30, 12) + SourceIndex(0) +131>Emitted(1, 354) Source(30, 18) + SourceIndex(0) +132>Emitted(1, 360) Source(30, 24) + SourceIndex(0) +133>Emitted(1, 363) Source(31, 1) + SourceIndex(0) +134>Emitted(1, 364) Source(32, 1) + SourceIndex(0) +135>Emitted(1, 371) Source(32, 7) + SourceIndex(0) +136>Emitted(1, 377) Source(32, 14) + SourceIndex(0) +137>Emitted(1, 378) Source(32, 15) + SourceIndex(0) +138>Emitted(1, 380) Source(33, 1) + SourceIndex(0) +139>Emitted(1, 387) Source(33, 8) + SourceIndex(0) +140>Emitted(1, 394) Source(33, 15) + SourceIndex(0) +141>Emitted(1, 406) Source(33, 28) + SourceIndex(0) +142>Emitted(1, 407) Source(33, 29) + SourceIndex(0) +--- +>>>//# sourceMappingURL=keywords.js.map=================================================================== +JsFile: statements.js +mapUrl: statements.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/statements.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/statements.js +sourceFile:../tests/cases/conformance/removeWhitespace/statements.ts +------------------------------------------------------------------- +>>>obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +1 > +2 >^^^ +3 > ^ +4 > ^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^ +8 > ^^^ +9 > ^^^ +10> ^^^ +11> ^ +12> ^^ +13> ^^ +14> ^ +15> ^^^^^^^^^ +16> ^ +17> ^^^ +18> ^ +19> ^^^^^^^ +20> ^^^^^^^^^ +21> ^ +22> ^^^ +23> ^ +24> ^ +1 > +2 >obj +3 > ; + > +4 > fn +5 > (); + > +6 > ; + > +7 > function +8 > fn3 +9 > () { + > +10> obj +11> ; + > +12> fn +13> (); + > +14> ; + > +15> function +16> f +17> () { +18> } + > +19> return; + > +20> function +21> g +22> () { +23> } + > +24> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +4 >Emitted(1, 7) Source(2, 3) + SourceIndex(0) +5 >Emitted(1, 9) Source(3, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(4, 1) + SourceIndex(0) +7 >Emitted(1, 19) Source(4, 10) + SourceIndex(0) +8 >Emitted(1, 22) Source(4, 13) + SourceIndex(0) +9 >Emitted(1, 25) Source(5, 5) + SourceIndex(0) +10>Emitted(1, 28) Source(5, 8) + SourceIndex(0) +11>Emitted(1, 29) Source(6, 5) + SourceIndex(0) +12>Emitted(1, 31) Source(6, 7) + SourceIndex(0) +13>Emitted(1, 33) Source(7, 5) + SourceIndex(0) +14>Emitted(1, 34) Source(8, 5) + SourceIndex(0) +15>Emitted(1, 43) Source(8, 14) + SourceIndex(0) +16>Emitted(1, 44) Source(8, 15) + SourceIndex(0) +17>Emitted(1, 47) Source(8, 19) + SourceIndex(0) +18>Emitted(1, 48) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 55) Source(10, 5) + SourceIndex(0) +20>Emitted(1, 64) Source(10, 14) + SourceIndex(0) +21>Emitted(1, 65) Source(10, 15) + SourceIndex(0) +22>Emitted(1, 68) Source(10, 19) + SourceIndex(0) +23>Emitted(1, 69) Source(11, 1) + SourceIndex(0) +24>Emitted(1, 70) Source(11, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=statements.js.map=================================================================== +JsFile: variables.js +mapUrl: variables.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/variables.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/variables.js +sourceFile:../tests/cases/conformance/removeWhitespace/variables.ts +------------------------------------------------------------------- +>>>var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^^^ +20> ^ +21> ^^^^ +22> ^ +23> ^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^ +33> ^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^ +39> ^ +1 > +2 >var +3 > a +4 > = +5 > 0 +6 > , +7 > b +8 > , +9 > { +10> c +11> } +12> = +13> obj +14> , +15> [ +16> d +17> ] +18> = +19> obj +20> ; + > +21> let +22> e +23> = +24> 0 +25> , +26> f +27> , +28> { +29> g +30> } +31> = +32> obj +33> , +34> [ +35> h +36> ] +37> = +38> obj +39> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 9) Source(1, 12) + SourceIndex(0) +7 >Emitted(1, 10) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 11) Source(1, 15) + SourceIndex(0) +9 >Emitted(1, 12) Source(1, 17) + SourceIndex(0) +10>Emitted(1, 13) Source(1, 18) + SourceIndex(0) +11>Emitted(1, 14) Source(1, 20) + SourceIndex(0) +12>Emitted(1, 15) Source(1, 23) + SourceIndex(0) +13>Emitted(1, 18) Source(1, 26) + SourceIndex(0) +14>Emitted(1, 19) Source(1, 28) + SourceIndex(0) +15>Emitted(1, 20) Source(1, 29) + SourceIndex(0) +16>Emitted(1, 21) Source(1, 30) + SourceIndex(0) +17>Emitted(1, 22) Source(1, 31) + SourceIndex(0) +18>Emitted(1, 23) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 26) Source(1, 37) + SourceIndex(0) +20>Emitted(1, 27) Source(2, 1) + SourceIndex(0) +21>Emitted(1, 31) Source(2, 5) + SourceIndex(0) +22>Emitted(1, 32) Source(2, 6) + SourceIndex(0) +23>Emitted(1, 33) Source(2, 9) + SourceIndex(0) +24>Emitted(1, 34) Source(2, 10) + SourceIndex(0) +25>Emitted(1, 35) Source(2, 12) + SourceIndex(0) +26>Emitted(1, 36) Source(2, 13) + SourceIndex(0) +27>Emitted(1, 37) Source(2, 15) + SourceIndex(0) +28>Emitted(1, 38) Source(2, 17) + SourceIndex(0) +29>Emitted(1, 39) Source(2, 18) + SourceIndex(0) +30>Emitted(1, 40) Source(2, 20) + SourceIndex(0) +31>Emitted(1, 41) Source(2, 23) + SourceIndex(0) +32>Emitted(1, 44) Source(2, 26) + SourceIndex(0) +33>Emitted(1, 45) Source(2, 28) + SourceIndex(0) +34>Emitted(1, 46) Source(2, 29) + SourceIndex(0) +35>Emitted(1, 47) Source(2, 30) + SourceIndex(0) +36>Emitted(1, 48) Source(2, 31) + SourceIndex(0) +37>Emitted(1, 49) Source(2, 34) + SourceIndex(0) +38>Emitted(1, 52) Source(2, 37) + SourceIndex(0) +39>Emitted(1, 53) Source(2, 38) + SourceIndex(0) +--- +>>>//# sourceMappingURL=variables.js.map=================================================================== +JsFile: for.js +mapUrl: for.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/for.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/for.js +sourceFile:../tests/cases/conformance/removeWhitespace/for.ts +------------------------------------------------------------------- +>>>for(;;){} +1 > +2 >^^^^^^^ +3 > ^^ +4 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >for(;;) +3 > {} +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 10) Source(1, 10) + SourceIndex(0) +--- +>>>//# sourceMappingURL=for.js.map=================================================================== +JsFile: embeddedStatement.js +mapUrl: embeddedStatement.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/embeddedStatement.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/embeddedStatement.js +sourceFile:../tests/cases/conformance/removeWhitespace/embeddedStatement.ts +------------------------------------------------------------------- +>>>{while(true);} +1 > +2 >^ +3 > ^^^^^^ +4 > ^^^^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >{ +3 > while( +4 > true +5 > ) +6 > ; +7 > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(1, 14) + SourceIndex(0) +7 >Emitted(1, 15) Source(1, 15) + SourceIndex(0) +--- +>>>//# sourceMappingURL=embeddedStatement.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.symbols b/tests/baselines/reference/removeWhitespace.outDir.symbols new file mode 100644 index 0000000000000..5743a1a0ab80a --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.symbols @@ -0,0 +1,398 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj .a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj . a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + .a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . + a + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . // comment + a // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . /* comment */ + a /* comment */ + +1..valueOf +>1..valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. valueOf +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. .valueOf +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. . valueOf +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 .valueOf +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 . valueOf +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. // comment +>1. // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 // comment +>1 // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ "a" ] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + "a" ] + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ + "a" + ] + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ // comment + "a" // comment + ] // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i---i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + case 0: break; + case 1: break; + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete [][0] +void obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void [][0] +typeof obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof [][0] +function f1() { +>f1 : Symbol(f1, Decl(keywords.ts, 8, 12)) + + return typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +async function* f2() { +>f2 : Symbol(f2, Decl(keywords.ts, 11, 1)) + + yield 1 + yield obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield (obj) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield [] + yield* [] + yield *[] + yield * [] + yield + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + yield yield + yield typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield void obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + await 1 + await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + for await (const x of []); +>x : Symbol(x, Decl(keywords.ts, 28, 20)) + + return yield await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +export class C {} +>C : Symbol(C, Decl(keywords.ts, 30, 1)) + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +; +function fn3() { +>fn3 : Symbol(fn3, Decl(statements.ts, 2, 1)) + + obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + + ; + function f() {} +>f : Symbol(f, Decl(statements.ts, 6, 5)) + + return; + function g() {} +>g : Symbol(g, Decl(statements.ts, 8, 11)) +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : Symbol(a, Decl(variables.ts, 0, 3)) +>b : Symbol(b, Decl(variables.ts, 0, 10)) +>c : Symbol(c, Decl(variables.ts, 0, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>d : Symbol(d, Decl(variables.ts, 0, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +let e = 0, f, { g } = obj, [h] = obj; +>e : Symbol(e, Decl(variables.ts, 1, 3)) +>f : Symbol(f, Decl(variables.ts, 1, 10)) +>g : Symbol(g, Decl(variables.ts, 1, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>h : Symbol(h, Decl(variables.ts, 1, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +=== tests/cases/conformance/removeWhitespace/for.ts === +for(;;){} +No type information for this code. +No type information for this code.=== tests/cases/conformance/removeWhitespace/embeddedStatement.ts === +{while(true);} +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outDir.types b/tests/baselines/reference/removeWhitespace.outDir.types new file mode 100644 index 0000000000000..a26e8735f7692 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outDir.types @@ -0,0 +1,582 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : any +>i : any +>fn : any + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj.a : any +>obj : any +>a : any + +obj .a +>obj .a : any +>obj : any +>a : any + +obj. a +>obj. a : any +>obj : any +>a : any + +obj . a +>obj . a : any +>obj : any +>a : any + +obj. +>obj. a : any +>obj : any + + a +>a : any + +obj +>obj .a : any +>obj : any + + .a +>a : any + +obj +>obj . a : any +>obj : any + + . + a +>a : any + +obj // comment +>obj // comment . // comment a : any +>obj : any + + . // comment + a // comment +>a : any + +obj /* comment */ +>obj /* comment */ . /* comment */ a : any +>obj : any + + . /* comment */ + a /* comment */ +>a : any + +1..valueOf +>1..valueOf : () => number +>1. : 1 +>valueOf : () => number + +1.. valueOf +>1.. valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. .valueOf +>1. .valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. . valueOf +>1. . valueOf : () => number +>1. : 1 +>valueOf : () => number + +1 .valueOf +>1 .valueOf : () => number +>1 : 1 +>valueOf : () => number + +1 . valueOf +>1 . valueOf : () => number +>1 : 1 +>valueOf : () => number + +1.. +>1.. valueOf : () => number +>1. : 1 + + valueOf +>valueOf : () => number + +1. +>1. .valueOf : () => number +>1. : 1 + + .valueOf +>valueOf : () => number + +1. +>1. . valueOf : () => number +>1. : 1 + + . + valueOf +>valueOf : () => number + +1. // comment +>1. // comment . // comment valueOf : () => number +>1. : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : () => number +>1. : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +1 +>1 .valueOf : () => number +>1 : 1 + + .valueOf +>valueOf : () => number + +1 +>1 . valueOf : () => number +>1 : 1 + + . + valueOf +>valueOf : () => number + +1 // comment +>1 // comment . // comment valueOf : () => number +>1 : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : () => number +>1 : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj["a"] : any +>obj : any +>"a" : "a" + +obj [ "a" ] +>obj [ "a" ] : any +>obj : any +>"a" : "a" + +obj [ +>obj [ "a" ] : any +>obj : any + + "a" ] +>"a" : "a" + +obj +>obj [ "a" ] : any +>obj : any + + [ + "a" +>"a" : "a" + + ] + +obj // comment +>obj // comment [ // comment "a" // comment ] : any +>obj : any + + [ // comment + "a" // comment +>"a" : "a" + + ] // comment + +obj /* comment */ +>obj /* comment */ [ /* comment */ "a" /* comment */ ] : any +>obj : any + + [ /* comment */ + "a" /* comment */ +>"a" : "a" + + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i + + i : any +>i : any +>+ i : number +>i : any + +i + +i +>i + +i : any +>i : any +>+i : number +>i : any + +i+ + i +>i+ + i : any +>i : any +>+ i : number +>i : any + +i+ +i +>i+ +i : any +>i : any +>+i : number +>i : any + +i + ++ i +>i + ++ i : any +>i : any +>++ i : number +>i : any + +i + ++i +>i + ++i : any +>i : any +>++i : number +>i : any + +i+ ++ i +>i+ ++ i : any +>i : any +>++ i : number +>i : any + +i+ ++i +>i+ ++i : any +>i : any +>++i : number +>i : any + +i ++ + i +>i ++ + i : any +>i ++ : number +>i : any +>i : any + +i ++ +i +>i ++ +i : any +>i ++ : number +>i : any +>i : any + +i++ + i +>i++ + i : any +>i++ : number +>i : any +>i : any + +i++ +i +>i++ +i : any +>i++ : number +>i : any +>i : any + +i+++i +>i+++i : any +>i++ : number +>i : any +>i : any + +i - - i +>i - - i : number +>i : any +>- i : number +>i : any + +i - -i +>i - -i : number +>i : any +>-i : number +>i : any + +i- - i +>i- - i : number +>i : any +>- i : number +>i : any + +i- -i +>i- -i : number +>i : any +>-i : number +>i : any + +i - -- i +>i - -- i : number +>i : any +>-- i : number +>i : any + +i - --i +>i - --i : number +>i : any +>--i : number +>i : any + +i- -- i +>i- -- i : number +>i : any +>-- i : number +>i : any + +i- --i +>i- --i : number +>i : any +>--i : number +>i : any + +i -- - i +>i -- - i : number +>i -- : number +>i : any +>i : any + +i -- -i +>i -- -i : number +>i -- : number +>i : any +>i : any + +i-- - i +>i-- - i : number +>i-- : number +>i : any +>i : any + +i-- -i +>i-- -i : number +>i-- : number +>i : any +>i : any + +i---i +>i---i : number +>i-- : number +>i : any +>i : any + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : any + + case 0: break; +>0 : 0 + + case 1: break; +>1 : 1 + + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + +delete (obj).a +>delete (obj).a : boolean +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +delete [][0] +>delete [][0] : boolean +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +void obj.a +>void obj.a : undefined +>obj.a : any +>obj : any +>a : any + +void (obj).a +>void (obj).a : undefined +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +void [][0] +>void [][0] : undefined +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +typeof obj.a +>typeof obj.a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj.a : any +>obj : any +>a : any + +typeof (obj).a +>typeof (obj).a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +typeof [][0] +>typeof [][0] : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +function f1() { +>f1 : () => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" + + return typeof obj +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any +} +async function* f2() { +>f2 : () => AsyncIterableIterator + + yield 1 +>yield 1 : any +>1 : 1 + + yield obj +>yield obj : any +>obj : any + + yield (obj) +>yield (obj) : any +>(obj) : any +>obj : any + + yield [] +>yield [] : any +>[] : undefined[] + + yield* [] +>yield* [] : any +>[] : undefined[] + + yield *[] +>yield *[] : any +>[] : undefined[] + + yield * [] +>yield * [] : any +>[] : undefined[] + + yield +>yield : any + + i +>i : any + + yield yield +>yield yield : any +>yield : any + + yield typeof obj +>yield typeof obj : any +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any + + yield void obj +>yield void obj : any +>void obj : undefined +>obj : any + + yield delete obj.a +>yield delete obj.a : any +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + + await 1 +>await 1 : 1 +>1 : 1 + + await obj +>await obj : any +>obj : any + + for await (const x of []); +>x : any +>[] : undefined[] + + return yield await obj +>yield await obj : any +>await obj : any +>obj : any +} +export class C {} +>C : C + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : any + +fn(); +>fn() : any +>fn : any + +; +function fn3() { +>fn3 : () => void + + obj; +>obj : any + + fn(); +>fn() : any +>fn : any + + ; + function f() {} +>f : () => void + + return; + function g() {} +>g : () => void +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : number +>0 : 0 +>b : any +>c : any +>obj : any +>d : any +>obj : any + +let e = 0, f, { g } = obj, [h] = obj; +>e : number +>0 : 0 +>f : any +>g : any +>obj : any +>h : any +>obj : any + +=== tests/cases/conformance/removeWhitespace/for.ts === +for(;;){} +No type information for this code. +No type information for this code.=== tests/cases/conformance/removeWhitespace/embeddedStatement.ts === +{while(true);} +>true : true + diff --git a/tests/baselines/reference/removeWhitespace.outFile.errors.txt b/tests/baselines/reference/removeWhitespace.outFile.errors.txt new file mode 100644 index 0000000000000..89fe837f2ce69 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.errors.txt @@ -0,0 +1,16 @@ +error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. + + +!!! error TS6082: Only 'amd' and 'system' modules are supported alongside --outFile. +==== tests/cases/conformance/removeWhitespace/a.ts (0 errors) ==== + let a = 1; + +==== tests/cases/conformance/removeWhitespace/b.ts (0 errors) ==== + let b = 2; + +==== tests/cases/conformance/removeWhitespace/c.ts (0 errors) ==== + class C {} + +==== tests/cases/conformance/removeWhitespace/d.ts (0 errors) ==== + function d() {} + \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.js b/tests/baselines/reference/removeWhitespace.outFile.js new file mode 100644 index 0000000000000..1b55ecdfb39f0 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.js @@ -0,0 +1,18 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts] //// + +//// [a.ts] +let a = 1; + +//// [b.ts] +let b = 2; + +//// [c.ts] +class C {} + +//// [d.ts] +function d() {} + + +//// [combined.js] +let a=1;let b=2;class C{}function d(){} +//# sourceMappingURL=combined.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.js.map b/tests/baselines/reference/removeWhitespace.outFile.js.map new file mode 100644 index 0000000000000..fa5ca6efbec05 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.js.map @@ -0,0 +1,2 @@ +//// [combined.js.map] +{"version":3,"file":"combined.js","sourceRoot":"","sources":["tests/cases/conformance/removeWhitespace/a.ts","tests/cases/conformance/removeWhitespace/b.ts","tests/cases/conformance/removeWhitespace/c.ts","tests/cases/conformance/removeWhitespace/d.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CCAT,IAAI,CAAC,CAAG,CAAC,CCAT,MAAM,CAAC,ECAP,SAAS,CAAC,GAAI,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt b/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt new file mode 100644 index 0000000000000..b3a96f4f0e792 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.sourcemap.txt @@ -0,0 +1,88 @@ +=================================================================== +JsFile: combined.js +mapUrl: combined.js.map +sourceRoot: +sources: tests/cases/conformance/removeWhitespace/a.ts,tests/cases/conformance/removeWhitespace/b.ts,tests/cases/conformance/removeWhitespace/c.ts,tests/cases/conformance/removeWhitespace/d.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:combined.js +sourceFile:tests/cases/conformance/removeWhitespace/a.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >let +3 > a +4 > = +5 > 1 +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 9) +sourceFile:tests/cases/conformance/removeWhitespace/b.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^ +2 > ^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^^^^^^^^^^^^^^^^-> +1-> +2 > let +3 > b +4 > = +5 > 2 +1->Emitted(1, 9) Source(1, 1) + SourceIndex(1) +2 >Emitted(1, 13) Source(1, 5) + SourceIndex(1) +3 >Emitted(1, 14) Source(1, 6) + SourceIndex(1) +4 >Emitted(1, 15) Source(1, 9) + SourceIndex(1) +5 >Emitted(1, 16) Source(1, 10) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 17) +sourceFile:tests/cases/conformance/removeWhitespace/c.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^^^^^^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^-> +1-> +2 > class +3 > C +1->Emitted(1, 17) Source(1, 1) + SourceIndex(2) +2 >Emitted(1, 23) Source(1, 7) + SourceIndex(2) +3 >Emitted(1, 24) Source(1, 8) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:combined.js (1, 26) +sourceFile:tests/cases/conformance/removeWhitespace/d.ts +------------------------------------------------------------------- +>>>let a=1;let b=2;class C{}function d(){} +1->^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^ +1-> +2 > function +3 > d +4 > () { +5 > } +1->Emitted(1, 26) Source(1, 1) + SourceIndex(3) +2 >Emitted(1, 35) Source(1, 10) + SourceIndex(3) +3 >Emitted(1, 36) Source(1, 11) + SourceIndex(3) +4 >Emitted(1, 39) Source(1, 15) + SourceIndex(3) +5 >Emitted(1, 40) Source(1, 16) + SourceIndex(3) +--- +>>>//# sourceMappingURL=combined.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespace.outFile.symbols b/tests/baselines/reference/removeWhitespace.outFile.symbols new file mode 100644 index 0000000000000..034861c49ba15 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.symbols @@ -0,0 +1,16 @@ +=== tests/cases/conformance/removeWhitespace/a.ts === +let a = 1; +>a : Symbol(a, Decl(a.ts, 0, 3)) + +=== tests/cases/conformance/removeWhitespace/b.ts === +let b = 2; +>b : Symbol(b, Decl(b.ts, 0, 3)) + +=== tests/cases/conformance/removeWhitespace/c.ts === +class C {} +>C : Symbol(C, Decl(c.ts, 0, 0)) + +=== tests/cases/conformance/removeWhitespace/d.ts === +function d() {} +>d : Symbol(d, Decl(d.ts, 0, 0)) + diff --git a/tests/baselines/reference/removeWhitespace.outFile.types b/tests/baselines/reference/removeWhitespace.outFile.types new file mode 100644 index 0000000000000..b20742f4a7859 --- /dev/null +++ b/tests/baselines/reference/removeWhitespace.outFile.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/removeWhitespace/a.ts === +let a = 1; +>a : number +>1 : 1 + +=== tests/cases/conformance/removeWhitespace/b.ts === +let b = 2; +>b : number +>2 : 2 + +=== tests/cases/conformance/removeWhitespace/c.ts === +class C {} +>C : C + +=== tests/cases/conformance/removeWhitespace/d.ts === +function d() {} +>d : () => void + diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js new file mode 100644 index 0000000000000..d05461354a33c --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js @@ -0,0 +1,204 @@ +//// [tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts] //// + +//// [global.d.ts] +declare let obj: any, i: any, fn; + +//// [propertyAccess.ts] +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +//// [elementAccess.ts] +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +//// [update.ts] +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +//// [switch.ts] +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +//// [keywords.ts] +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +//// [statements.ts] +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +//// [variables.ts] +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +//// [propertyAccess.js] +obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf; +//# sourceMappingURL=propertyAccess.js.map +//// [elementAccess.js] +obj["a"];obj["a"];obj["a"];obj["a"];obj["a"];obj["a"]; +//# sourceMappingURL=elementAccess.js.map +//// [update.js] +i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +//# sourceMappingURL=update.js.map +//// [switch.js] +switch(i){case 0:break;case 1:break;default:break} +//# sourceMappingURL=switch.js.map +//// [keywords.js] +delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +//# sourceMappingURL=keywords.js.map +//// [statements.js] +obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +//# sourceMappingURL=statements.js.map +//// [variables.js] +var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +//# sourceMappingURL=variables.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map new file mode 100644 index 0000000000000..83145f6f3e762 --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.js.map @@ -0,0 +1,14 @@ +//// [propertyAccess.js.map] +{"version":3,"file":"propertyAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/propertyAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,CAAC,CACL,GAAG,CAAE,CAAC,CACN,GAAG,CAAE,CAAC,CACN,GAAG,CAAG,CAAC,CAEP,GAAG,CACC,CAAC,CAEL,GAAG,CACE,CAAC,CAEN,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,GAAG,CAEC,CAAC,CAEL,EAAE,CAAC,OAAO,CACV,EAAE,CAAE,OAAO,CACX,EAAE,CAAE,OAAO,CACX,EAAE,CAAG,OAAO,CACZ,CAAC,EAAE,OAAO,CACV,CAAC,EAAG,OAAO,CAEX,EAAE,CACE,OAAO,CAEX,EAAE,CACG,OAAO,CAEZ,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,EAAE,CAEE,OAAO,CAEX,CAAC,EACI,OAAO,CAEZ,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAEX,CAAC,EAEG,OAAO,CAAA"} +//// [elementAccess.js.map] +{"version":3,"file":"elementAccess.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/elementAccess.ts"],"names":[],"mappings":"AAAA,GAAG,CAAC,GAAG,CAAC,CACR,GAAG,CAAG,GAAG,CAAE,CAEX,GAAG,CACC,GAAG,CAAE,CAET,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAEL,GAAG,CAEC,GAAG,CACF,CAAA"} +//// [update.js.map] +{"version":3,"file":"update.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/update.ts"],"names":[],"mappings":"AAAA,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAG,CAAC,CAAC,CACN,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAEL,CAAC,EAAG,EAAG,CAAC,CACR,CAAC,EAAG,EAAE,CAAC,CACP,CAAC,EAAE,EAAG,CAAC,CACP,CAAC,EAAE,EAAE,CAAC,CAEN,CAAC,EAAG,CAAG,CAAC,CACR,CAAC,EAAG,CAAE,CAAC,CACP,CAAC,EAAE,CAAG,CAAC,CACP,CAAC,EAAE,CAAE,CAAC,CACN,CAAC,EAAE,CAAC,CAAC,CAAA"} +//// [switch.js.map] +{"version":3,"file":"switch.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/switch.ts"],"names":[],"mappings":"AAAA,OAAQ,CAAC,CAAE,CACP,KAAK,CAAC,CAAE,MACR,KAAK,CAAC,CAAE,MACR,OAAO,CAAE,KAAM,CAClB"} +//// [keywords.js.map] +{"version":3,"file":"keywords.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/keywords.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,KAAK,GAAG,CAAC,CAAC,CACV,IAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CACZ,IAAK,EAAE,CAAC,CAAC,CAAC,CACV,OAAO,GAAG,CAAC,CAAC,CACZ,MAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACd,MAAO,EAAE,CAAC,CAAC,CAAC,CACZ,SAAS,EAAE,GACP,OAAO,OAAO,GAClB,CACA,MAAK,QAAS,CAAE,EAAE,GACd,MAAM,CAAC,CACP,MAAM,GAAG,CACT,KAAM,CAAC,GAAG,CAAC,CACX,KAAM,EAAE,CACR,KAAK,CAAE,EAAE,CACT,KAAM,CAAC,EAAE,CACT,KAAM,CAAE,EAAE,CACV,KAAK,CACL,CAAC,CACD,MAAM,KAAK,CACX,MAAM,OAAO,GAAG,CAChB,MAAM,KAAK,GAAG,CACd,MAAM,OAAO,GAAG,CAAC,CAAC,CAClB,MAAM,CAAC,CACP,MAAM,GAAG,CACT,IAAI,KAAK,CAAE,MAAM,CAAC,GAAI,EAAE,CAAC,CACzB,OAAO,MAAM,MAAM,GACvB,CACA,OAAM,MAAO,CAAC,EACd,OAAO,OAAO,YAAa,CAAC"} +//// [statements.js.map] +{"version":3,"file":"statements.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/statements.ts"],"names":[],"mappings":"AAAA,GAAG,CACH,EAAE,EACF,CACA,SAAS,GAAG,GACR,GAAG,CACH,EAAE,EACF,CACA,SAAS,CAAC,GAAI,CACd,OACA,SAAS,CAAC,GAAI,CAClB,CAAC"} +//// [variables.js.map] +{"version":3,"file":"variables.js","sourceRoot":"","sources":["../tests/cases/conformance/removeWhitespace/variables.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CACpC,IAAI,CAAC,CAAG,CAAC,CAAE,CAAC,CAAE,CAAE,CAAC,CAAE,CAAG,GAAG,CAAE,CAAC,CAAC,CAAC,CAAG,GAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt b/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt new file mode 100644 index 0000000000000..4af3413ace25e --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.sourcemap.txt @@ -0,0 +1,1685 @@ +=================================================================== +JsFile: propertyAccess.js +mapUrl: propertyAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/propertyAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/propertyAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/propertyAccess.ts +------------------------------------------------------------------- +>>>obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;obj.a;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf;1..valueOf; +1 > +2 >^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^ +7 > ^ +8 > ^ +9 > ^ +10> ^^^ +11> ^ +12> ^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^ +18> ^^^ +19> ^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^ +25> ^ +26> ^^^ +27> ^ +28> ^ +29> ^ +30> ^^^ +31> ^ +32> ^ +33> ^ +34> ^^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^ +40> ^^^^^^^ +41> ^ +42> ^^ +43> ^ +44> ^^^^^^^ +45> ^ +46> ^^ +47> ^ +48> ^^^^^^^ +49> ^ +50> ^^ +51> ^ +52> ^^^^^^^ +53> ^ +54> ^ +55> ^^ +56> ^^^^^^^ +57> ^ +58> ^ +59> ^^ +60> ^^^^^^^ +61> ^ +62> ^^ +63> ^ +64> ^^^^^^^ +65> ^ +66> ^^ +67> ^ +68> ^^^^^^^ +69> ^ +70> ^^ +71> ^ +72> ^^^^^^^ +73> ^ +74> ^^ +75> ^ +76> ^^^^^^^ +77> ^ +78> ^^ +79> ^ +80> ^^^^^^^ +81> ^ +82> ^ +83> ^^ +84> ^^^^^^^ +85> ^ +86> ^ +87> ^^ +88> ^^^^^^^ +89> ^ +90> ^ +91> ^^ +92> ^^^^^^^ +93> ^ +94> ^ +95> ^^ +96> ^^^^^^^ +97> ^ +1 > +2 >obj +3 > . +4 > a +5 > + > +6 > obj +7 > . +8 > a +9 > + > +10> obj +11> . +12> a +13> + > +14> obj +15> . +16> a +17> + > + > +18> obj +19> . + > +20> a +21> + > + > +22> obj +23> + > . +24> a +25> + > + > +26> obj +27> + > . + > +28> a +29> + > + > +30> obj +31> // comment + > . // comment + > +32> a +33> // comment + > + > +34> obj +35> /* comment */ + > . /* comment */ + > +36> a +37> /* comment */ + > + > +38> 1. +39> . +40> valueOf +41> + > +42> 1. +43> . +44> valueOf +45> + > +46> 1. +47> . +48> valueOf +49> + > +50> 1. +51> . +52> valueOf +53> + > +54> 1 +55> . +56> valueOf +57> + > +58> 1 +59> . +60> valueOf +61> + > + > +62> 1. +63> . + > +64> valueOf +65> + > + > +66> 1. +67> + > . +68> valueOf +69> + > + > +70> 1. +71> + > . + > +72> valueOf +73> + > + > +74> 1. +75> // comment + > . // comment + > +76> valueOf +77> // comment + > + > +78> 1. +79> /* comment */ + > . /* comment */ + > +80> valueOf +81> /* comment */ + > + > +82> 1 +83> + > . +84> valueOf +85> + > + > +86> 1 +87> + > . + > +88> valueOf +89> + > + > +90> 1 +91> // comment + > . // comment + > +92> valueOf +93> // comment + > + > +94> 1 +95> /* comment */ + > . /* comment */ + > +96> valueOf +97> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +5 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 4) + SourceIndex(0) +7 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +8 >Emitted(1, 12) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 13) Source(3, 1) + SourceIndex(0) +10>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +11>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +12>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +13>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +14>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +15>Emitted(1, 23) Source(4, 7) + SourceIndex(0) +16>Emitted(1, 24) Source(4, 8) + SourceIndex(0) +17>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +18>Emitted(1, 28) Source(6, 4) + SourceIndex(0) +19>Emitted(1, 29) Source(7, 5) + SourceIndex(0) +20>Emitted(1, 30) Source(7, 6) + SourceIndex(0) +21>Emitted(1, 31) Source(9, 1) + SourceIndex(0) +22>Emitted(1, 34) Source(9, 4) + SourceIndex(0) +23>Emitted(1, 35) Source(10, 6) + SourceIndex(0) +24>Emitted(1, 36) Source(10, 7) + SourceIndex(0) +25>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +26>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +27>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +28>Emitted(1, 42) Source(14, 6) + SourceIndex(0) +29>Emitted(1, 43) Source(16, 1) + SourceIndex(0) +30>Emitted(1, 46) Source(16, 4) + SourceIndex(0) +31>Emitted(1, 47) Source(18, 5) + SourceIndex(0) +32>Emitted(1, 48) Source(18, 6) + SourceIndex(0) +33>Emitted(1, 49) Source(20, 1) + SourceIndex(0) +34>Emitted(1, 52) Source(20, 4) + SourceIndex(0) +35>Emitted(1, 53) Source(22, 5) + SourceIndex(0) +36>Emitted(1, 54) Source(22, 6) + SourceIndex(0) +37>Emitted(1, 55) Source(24, 1) + SourceIndex(0) +38>Emitted(1, 57) Source(24, 3) + SourceIndex(0) +39>Emitted(1, 58) Source(24, 4) + SourceIndex(0) +40>Emitted(1, 65) Source(24, 11) + SourceIndex(0) +41>Emitted(1, 66) Source(25, 1) + SourceIndex(0) +42>Emitted(1, 68) Source(25, 3) + SourceIndex(0) +43>Emitted(1, 69) Source(25, 5) + SourceIndex(0) +44>Emitted(1, 76) Source(25, 12) + SourceIndex(0) +45>Emitted(1, 77) Source(26, 1) + SourceIndex(0) +46>Emitted(1, 79) Source(26, 3) + SourceIndex(0) +47>Emitted(1, 80) Source(26, 5) + SourceIndex(0) +48>Emitted(1, 87) Source(26, 12) + SourceIndex(0) +49>Emitted(1, 88) Source(27, 1) + SourceIndex(0) +50>Emitted(1, 90) Source(27, 3) + SourceIndex(0) +51>Emitted(1, 91) Source(27, 6) + SourceIndex(0) +52>Emitted(1, 98) Source(27, 13) + SourceIndex(0) +53>Emitted(1, 99) Source(28, 1) + SourceIndex(0) +54>Emitted(1, 100) Source(28, 2) + SourceIndex(0) +55>Emitted(1, 102) Source(28, 4) + SourceIndex(0) +56>Emitted(1, 109) Source(28, 11) + SourceIndex(0) +57>Emitted(1, 110) Source(29, 1) + SourceIndex(0) +58>Emitted(1, 111) Source(29, 2) + SourceIndex(0) +59>Emitted(1, 113) Source(29, 5) + SourceIndex(0) +60>Emitted(1, 120) Source(29, 12) + SourceIndex(0) +61>Emitted(1, 121) Source(31, 1) + SourceIndex(0) +62>Emitted(1, 123) Source(31, 3) + SourceIndex(0) +63>Emitted(1, 124) Source(32, 5) + SourceIndex(0) +64>Emitted(1, 131) Source(32, 12) + SourceIndex(0) +65>Emitted(1, 132) Source(34, 1) + SourceIndex(0) +66>Emitted(1, 134) Source(34, 3) + SourceIndex(0) +67>Emitted(1, 135) Source(35, 6) + SourceIndex(0) +68>Emitted(1, 142) Source(35, 13) + SourceIndex(0) +69>Emitted(1, 143) Source(37, 1) + SourceIndex(0) +70>Emitted(1, 145) Source(37, 3) + SourceIndex(0) +71>Emitted(1, 146) Source(39, 5) + SourceIndex(0) +72>Emitted(1, 153) Source(39, 12) + SourceIndex(0) +73>Emitted(1, 154) Source(41, 1) + SourceIndex(0) +74>Emitted(1, 156) Source(41, 3) + SourceIndex(0) +75>Emitted(1, 157) Source(43, 5) + SourceIndex(0) +76>Emitted(1, 164) Source(43, 12) + SourceIndex(0) +77>Emitted(1, 165) Source(45, 1) + SourceIndex(0) +78>Emitted(1, 167) Source(45, 3) + SourceIndex(0) +79>Emitted(1, 168) Source(47, 5) + SourceIndex(0) +80>Emitted(1, 175) Source(47, 12) + SourceIndex(0) +81>Emitted(1, 176) Source(49, 1) + SourceIndex(0) +82>Emitted(1, 177) Source(49, 2) + SourceIndex(0) +83>Emitted(1, 179) Source(50, 6) + SourceIndex(0) +84>Emitted(1, 186) Source(50, 13) + SourceIndex(0) +85>Emitted(1, 187) Source(52, 1) + SourceIndex(0) +86>Emitted(1, 188) Source(52, 2) + SourceIndex(0) +87>Emitted(1, 190) Source(54, 5) + SourceIndex(0) +88>Emitted(1, 197) Source(54, 12) + SourceIndex(0) +89>Emitted(1, 198) Source(56, 1) + SourceIndex(0) +90>Emitted(1, 199) Source(56, 2) + SourceIndex(0) +91>Emitted(1, 201) Source(58, 5) + SourceIndex(0) +92>Emitted(1, 208) Source(58, 12) + SourceIndex(0) +93>Emitted(1, 209) Source(60, 1) + SourceIndex(0) +94>Emitted(1, 210) Source(60, 2) + SourceIndex(0) +95>Emitted(1, 212) Source(62, 5) + SourceIndex(0) +96>Emitted(1, 219) Source(62, 12) + SourceIndex(0) +97>Emitted(1, 220) Source(62, 12) + SourceIndex(0) +--- +>>>//# sourceMappingURL=propertyAccess.js.map=================================================================== +JsFile: elementAccess.js +mapUrl: elementAccess.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/elementAccess.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/elementAccess.js +sourceFile:../tests/cases/conformance/removeWhitespace/elementAccess.ts +------------------------------------------------------------------- +>>>obj["a"];obj["a"];obj["a"];obj["a"];obj["a"];obj["a"]; +1 > +2 >^^^ +3 > ^ +4 > ^^^ +5 > ^ +6 > ^ +7 > ^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^^^ +15> ^ +16> ^ +17> ^^^ +18> ^ +19> ^^^ +20> ^ +21> ^ +22> ^^^ +23> ^ +24> ^^^ +25> ^ +26> ^ +27> ^^^ +28> ^ +29> ^^^ +30> ^ +31> ^ +1 > +2 >obj +3 > [ +4 > "a" +5 > ] +6 > + > +7 > obj +8 > [ +9 > "a" +10> ] +11> + > + > +12> obj +13> [ + > +14> "a" +15> ] +16> + > + > +17> obj +18> + > [ + > +19> "a" +20> + > ] +21> + > + > +22> obj +23> // comment + > [ // comment + > +24> "a" +25> // comment + > ] +26> // comment + > + > +27> obj +28> /* comment */ + > [ /* comment */ + > +29> "a" +30> /* comment */ + > ] +31> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +5 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +6 >Emitted(1, 10) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 13) Source(2, 4) + SourceIndex(0) +8 >Emitted(1, 14) Source(2, 7) + SourceIndex(0) +9 >Emitted(1, 17) Source(2, 10) + SourceIndex(0) +10>Emitted(1, 18) Source(2, 12) + SourceIndex(0) +11>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +13>Emitted(1, 23) Source(5, 5) + SourceIndex(0) +14>Emitted(1, 26) Source(5, 8) + SourceIndex(0) +15>Emitted(1, 27) Source(5, 10) + SourceIndex(0) +16>Emitted(1, 28) Source(7, 1) + SourceIndex(0) +17>Emitted(1, 31) Source(7, 4) + SourceIndex(0) +18>Emitted(1, 32) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 35) Source(9, 8) + SourceIndex(0) +20>Emitted(1, 36) Source(10, 6) + SourceIndex(0) +21>Emitted(1, 37) Source(12, 1) + SourceIndex(0) +22>Emitted(1, 40) Source(12, 4) + SourceIndex(0) +23>Emitted(1, 41) Source(14, 5) + SourceIndex(0) +24>Emitted(1, 44) Source(14, 8) + SourceIndex(0) +25>Emitted(1, 45) Source(15, 6) + SourceIndex(0) +26>Emitted(1, 46) Source(17, 1) + SourceIndex(0) +27>Emitted(1, 49) Source(17, 4) + SourceIndex(0) +28>Emitted(1, 50) Source(19, 5) + SourceIndex(0) +29>Emitted(1, 53) Source(19, 8) + SourceIndex(0) +30>Emitted(1, 54) Source(20, 6) + SourceIndex(0) +31>Emitted(1, 55) Source(20, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=elementAccess.js.map=================================================================== +JsFile: update.js +mapUrl: update.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/update.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/update.js +sourceFile:../tests/cases/conformance/removeWhitespace/update.ts +------------------------------------------------------------------- +>>>i+ +i;i+ +i;i+ +i;i+ +i;i+ ++i;i+ ++i;i+ ++i;i+ ++i;i+++i;i+++i;i+++i;i+++i;i+++i;i- -i;i- -i;i- -i;i- -i;i- --i;i- --i;i- --i;i- --i;i---i;i---i;i---i;i---i;i---i; +1 > +2 >^ +3 > ^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^ +19> ^ +20> ^ +21> ^ +22> ^ +23> ^^ +24> ^^ +25> ^ +26> ^ +27> ^ +28> ^^ +29> ^^ +30> ^ +31> ^ +32> ^ +33> ^^ +34> ^^ +35> ^ +36> ^ +37> ^ +38> ^^ +39> ^^ +40> ^ +41> ^ +42> ^ +43> ^^ +44> ^ +45> ^ +46> ^ +47> ^ +48> ^^ +49> ^ +50> ^ +51> ^ +52> ^ +53> ^^ +54> ^ +55> ^ +56> ^ +57> ^ +58> ^^ +59> ^ +60> ^ +61> ^ +62> ^ +63> ^^ +64> ^ +65> ^ +66> ^ +67> ^ +68> ^^ +69> ^ +70> ^ +71> ^ +72> ^ +73> ^^ +74> ^ +75> ^ +76> ^ +77> ^ +78> ^^ +79> ^ +80> ^ +81> ^ +82> ^ +83> ^^ +84> ^ +85> ^ +86> ^ +87> ^ +88> ^^ +89> ^^ +90> ^ +91> ^ +92> ^ +93> ^^ +94> ^^ +95> ^ +96> ^ +97> ^ +98> ^^ +99> ^^ +100> ^ +101> ^ +102> ^ +103> ^^ +104> ^^ +105> ^ +106> ^ +107> ^ +108> ^^ +109> ^ +110> ^ +111> ^ +112> ^ +113> ^^ +114> ^ +115> ^ +116> ^ +117> ^ +118> ^^ +119> ^ +120> ^ +121> ^ +122> ^ +123> ^^ +124> ^ +125> ^ +126> ^ +127> ^ +128> ^^ +129> ^ +130> ^ +131> ^ +1 > +2 >i +3 > + +4 > + +5 > i +6 > + > +7 > i +8 > + +9 > + +10> i +11> + > +12> i +13> + +14> + +15> i +16> + > +17> i +18> + +19> + +20> i +21> + > + > +22> i +23> + +24> ++ +25> i +26> + > +27> i +28> + +29> ++ +30> i +31> + > +32> i +33> + +34> ++ +35> i +36> + > +37> i +38> + +39> ++ +40> i +41> + > + > +42> i +43> ++ +44> + +45> i +46> + > +47> i +48> ++ +49> + +50> i +51> + > +52> i +53> ++ +54> + +55> i +56> + > +57> i +58> ++ +59> + +60> i +61> + > +62> i +63> ++ +64> + +65> i +66> + > + > +67> i +68> - +69> - +70> i +71> + > +72> i +73> - +74> - +75> i +76> + > +77> i +78> - +79> - +80> i +81> + > +82> i +83> - +84> - +85> i +86> + > + > +87> i +88> - +89> -- +90> i +91> + > +92> i +93> - +94> -- +95> i +96> + > +97> i +98> - +99> -- +100> i +101> + > +102> i +103> - +104> -- +105> i +106> + > + > +107> i +108> -- +109> - +110> i +111> + > +112> i +113> -- +114> - +115> i +116> + > +117> i +118> -- +119> - +120> i +121> + > +122> i +123> -- +124> - +125> i +126> + > +127> i +128> -- +129> - +130> i +131> +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 2) Source(1, 2) + SourceIndex(0) +3 >Emitted(1, 4) Source(1, 5) + SourceIndex(0) +4 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +5 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +6 >Emitted(1, 7) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 8) Source(2, 2) + SourceIndex(0) +8 >Emitted(1, 10) Source(2, 5) + SourceIndex(0) +9 >Emitted(1, 11) Source(2, 6) + SourceIndex(0) +10>Emitted(1, 12) Source(2, 7) + SourceIndex(0) +11>Emitted(1, 13) Source(3, 1) + SourceIndex(0) +12>Emitted(1, 14) Source(3, 2) + SourceIndex(0) +13>Emitted(1, 16) Source(3, 4) + SourceIndex(0) +14>Emitted(1, 17) Source(3, 6) + SourceIndex(0) +15>Emitted(1, 18) Source(3, 7) + SourceIndex(0) +16>Emitted(1, 19) Source(4, 1) + SourceIndex(0) +17>Emitted(1, 20) Source(4, 2) + SourceIndex(0) +18>Emitted(1, 22) Source(4, 4) + SourceIndex(0) +19>Emitted(1, 23) Source(4, 5) + SourceIndex(0) +20>Emitted(1, 24) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 25) Source(6, 1) + SourceIndex(0) +22>Emitted(1, 26) Source(6, 2) + SourceIndex(0) +23>Emitted(1, 28) Source(6, 5) + SourceIndex(0) +24>Emitted(1, 30) Source(6, 8) + SourceIndex(0) +25>Emitted(1, 31) Source(6, 9) + SourceIndex(0) +26>Emitted(1, 32) Source(7, 1) + SourceIndex(0) +27>Emitted(1, 33) Source(7, 2) + SourceIndex(0) +28>Emitted(1, 35) Source(7, 5) + SourceIndex(0) +29>Emitted(1, 37) Source(7, 7) + SourceIndex(0) +30>Emitted(1, 38) Source(7, 8) + SourceIndex(0) +31>Emitted(1, 39) Source(8, 1) + SourceIndex(0) +32>Emitted(1, 40) Source(8, 2) + SourceIndex(0) +33>Emitted(1, 42) Source(8, 4) + SourceIndex(0) +34>Emitted(1, 44) Source(8, 7) + SourceIndex(0) +35>Emitted(1, 45) Source(8, 8) + SourceIndex(0) +36>Emitted(1, 46) Source(9, 1) + SourceIndex(0) +37>Emitted(1, 47) Source(9, 2) + SourceIndex(0) +38>Emitted(1, 49) Source(9, 4) + SourceIndex(0) +39>Emitted(1, 51) Source(9, 6) + SourceIndex(0) +40>Emitted(1, 52) Source(9, 7) + SourceIndex(0) +41>Emitted(1, 53) Source(11, 1) + SourceIndex(0) +42>Emitted(1, 54) Source(11, 2) + SourceIndex(0) +43>Emitted(1, 56) Source(11, 5) + SourceIndex(0) +44>Emitted(1, 57) Source(11, 8) + SourceIndex(0) +45>Emitted(1, 58) Source(11, 9) + SourceIndex(0) +46>Emitted(1, 59) Source(12, 1) + SourceIndex(0) +47>Emitted(1, 60) Source(12, 2) + SourceIndex(0) +48>Emitted(1, 62) Source(12, 5) + SourceIndex(0) +49>Emitted(1, 63) Source(12, 7) + SourceIndex(0) +50>Emitted(1, 64) Source(12, 8) + SourceIndex(0) +51>Emitted(1, 65) Source(13, 1) + SourceIndex(0) +52>Emitted(1, 66) Source(13, 2) + SourceIndex(0) +53>Emitted(1, 68) Source(13, 4) + SourceIndex(0) +54>Emitted(1, 69) Source(13, 7) + SourceIndex(0) +55>Emitted(1, 70) Source(13, 8) + SourceIndex(0) +56>Emitted(1, 71) Source(14, 1) + SourceIndex(0) +57>Emitted(1, 72) Source(14, 2) + SourceIndex(0) +58>Emitted(1, 74) Source(14, 4) + SourceIndex(0) +59>Emitted(1, 75) Source(14, 6) + SourceIndex(0) +60>Emitted(1, 76) Source(14, 7) + SourceIndex(0) +61>Emitted(1, 77) Source(15, 1) + SourceIndex(0) +62>Emitted(1, 78) Source(15, 2) + SourceIndex(0) +63>Emitted(1, 80) Source(15, 4) + SourceIndex(0) +64>Emitted(1, 81) Source(15, 5) + SourceIndex(0) +65>Emitted(1, 82) Source(15, 6) + SourceIndex(0) +66>Emitted(1, 83) Source(17, 1) + SourceIndex(0) +67>Emitted(1, 84) Source(17, 2) + SourceIndex(0) +68>Emitted(1, 86) Source(17, 5) + SourceIndex(0) +69>Emitted(1, 87) Source(17, 7) + SourceIndex(0) +70>Emitted(1, 88) Source(17, 8) + SourceIndex(0) +71>Emitted(1, 89) Source(18, 1) + SourceIndex(0) +72>Emitted(1, 90) Source(18, 2) + SourceIndex(0) +73>Emitted(1, 92) Source(18, 5) + SourceIndex(0) +74>Emitted(1, 93) Source(18, 6) + SourceIndex(0) +75>Emitted(1, 94) Source(18, 7) + SourceIndex(0) +76>Emitted(1, 95) Source(19, 1) + SourceIndex(0) +77>Emitted(1, 96) Source(19, 2) + SourceIndex(0) +78>Emitted(1, 98) Source(19, 4) + SourceIndex(0) +79>Emitted(1, 99) Source(19, 6) + SourceIndex(0) +80>Emitted(1, 100) Source(19, 7) + SourceIndex(0) +81>Emitted(1, 101) Source(20, 1) + SourceIndex(0) +82>Emitted(1, 102) Source(20, 2) + SourceIndex(0) +83>Emitted(1, 104) Source(20, 4) + SourceIndex(0) +84>Emitted(1, 105) Source(20, 5) + SourceIndex(0) +85>Emitted(1, 106) Source(20, 6) + SourceIndex(0) +86>Emitted(1, 107) Source(22, 1) + SourceIndex(0) +87>Emitted(1, 108) Source(22, 2) + SourceIndex(0) +88>Emitted(1, 110) Source(22, 5) + SourceIndex(0) +89>Emitted(1, 112) Source(22, 8) + SourceIndex(0) +90>Emitted(1, 113) Source(22, 9) + SourceIndex(0) +91>Emitted(1, 114) Source(23, 1) + SourceIndex(0) +92>Emitted(1, 115) Source(23, 2) + SourceIndex(0) +93>Emitted(1, 117) Source(23, 5) + SourceIndex(0) +94>Emitted(1, 119) Source(23, 7) + SourceIndex(0) +95>Emitted(1, 120) Source(23, 8) + SourceIndex(0) +96>Emitted(1, 121) Source(24, 1) + SourceIndex(0) +97>Emitted(1, 122) Source(24, 2) + SourceIndex(0) +98>Emitted(1, 124) Source(24, 4) + SourceIndex(0) +99>Emitted(1, 126) Source(24, 7) + SourceIndex(0) +100>Emitted(1, 127) Source(24, 8) + SourceIndex(0) +101>Emitted(1, 128) Source(25, 1) + SourceIndex(0) +102>Emitted(1, 129) Source(25, 2) + SourceIndex(0) +103>Emitted(1, 131) Source(25, 4) + SourceIndex(0) +104>Emitted(1, 133) Source(25, 6) + SourceIndex(0) +105>Emitted(1, 134) Source(25, 7) + SourceIndex(0) +106>Emitted(1, 135) Source(27, 1) + SourceIndex(0) +107>Emitted(1, 136) Source(27, 2) + SourceIndex(0) +108>Emitted(1, 138) Source(27, 5) + SourceIndex(0) +109>Emitted(1, 139) Source(27, 8) + SourceIndex(0) +110>Emitted(1, 140) Source(27, 9) + SourceIndex(0) +111>Emitted(1, 141) Source(28, 1) + SourceIndex(0) +112>Emitted(1, 142) Source(28, 2) + SourceIndex(0) +113>Emitted(1, 144) Source(28, 5) + SourceIndex(0) +114>Emitted(1, 145) Source(28, 7) + SourceIndex(0) +115>Emitted(1, 146) Source(28, 8) + SourceIndex(0) +116>Emitted(1, 147) Source(29, 1) + SourceIndex(0) +117>Emitted(1, 148) Source(29, 2) + SourceIndex(0) +118>Emitted(1, 150) Source(29, 4) + SourceIndex(0) +119>Emitted(1, 151) Source(29, 7) + SourceIndex(0) +120>Emitted(1, 152) Source(29, 8) + SourceIndex(0) +121>Emitted(1, 153) Source(30, 1) + SourceIndex(0) +122>Emitted(1, 154) Source(30, 2) + SourceIndex(0) +123>Emitted(1, 156) Source(30, 4) + SourceIndex(0) +124>Emitted(1, 157) Source(30, 6) + SourceIndex(0) +125>Emitted(1, 158) Source(30, 7) + SourceIndex(0) +126>Emitted(1, 159) Source(31, 1) + SourceIndex(0) +127>Emitted(1, 160) Source(31, 2) + SourceIndex(0) +128>Emitted(1, 162) Source(31, 4) + SourceIndex(0) +129>Emitted(1, 163) Source(31, 5) + SourceIndex(0) +130>Emitted(1, 164) Source(31, 6) + SourceIndex(0) +131>Emitted(1, 165) Source(31, 6) + SourceIndex(0) +--- +>>>//# sourceMappingURL=update.js.map=================================================================== +JsFile: switch.js +mapUrl: switch.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/switch.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/switch.js +sourceFile:../tests/cases/conformance/removeWhitespace/switch.ts +------------------------------------------------------------------- +>>>switch(i){case 0:break;case 1:break;default:break} +1 > +2 >^^^^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^^^^^ +7 > ^ +8 > ^ +9 > ^^^^^^ +10> ^^^^^ +11> ^ +12> ^ +13> ^^^^^^ +14> ^^^^^^^ +15> ^ +16> ^^^^^ +17> ^ +1 > +2 >switch ( +3 > i +4 > ) +5 > { + > +6 > case +7 > 0 +8 > : +9 > break; + > +10> case +11> 1 +12> : +13> break; + > +14> default +15> : +16> break; +17> + > } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 9) + SourceIndex(0) +3 >Emitted(1, 9) Source(1, 10) + SourceIndex(0) +4 >Emitted(1, 10) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 11) Source(2, 5) + SourceIndex(0) +6 >Emitted(1, 16) Source(2, 10) + SourceIndex(0) +7 >Emitted(1, 17) Source(2, 11) + SourceIndex(0) +8 >Emitted(1, 18) Source(2, 13) + SourceIndex(0) +9 >Emitted(1, 24) Source(3, 5) + SourceIndex(0) +10>Emitted(1, 29) Source(3, 10) + SourceIndex(0) +11>Emitted(1, 30) Source(3, 11) + SourceIndex(0) +12>Emitted(1, 31) Source(3, 13) + SourceIndex(0) +13>Emitted(1, 37) Source(4, 5) + SourceIndex(0) +14>Emitted(1, 44) Source(4, 12) + SourceIndex(0) +15>Emitted(1, 45) Source(4, 14) + SourceIndex(0) +16>Emitted(1, 50) Source(4, 20) + SourceIndex(0) +17>Emitted(1, 51) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=switch.js.map=================================================================== +JsFile: keywords.js +mapUrl: keywords.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/keywords.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/keywords.js +sourceFile:../tests/cases/conformance/removeWhitespace/keywords.ts +------------------------------------------------------------------- +>>>delete obj.a;delete(obj).a;delete[][0];void obj.a;void(obj).a;void[][0];typeof obj.a;typeof(obj).a;typeof[][0];function f1(){return typeof obj}async function*f2(){yield 1;yield obj;yield(obj);yield[];yield*[];yield*[];yield*[];yield;i;yield yield;yield typeof obj;yield void obj;yield delete obj.a;await 1;await obj;for await(const x of[]);return yield await obj}export class C{}export default function(){} +1 > +2 >^^^^^^^ +3 > ^^^ +4 > ^ +5 > ^ +6 > ^ +7 > ^^^^^^ +8 > ^ +9 > ^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^ +15> ^^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^^^^^ +21> ^^^ +22> ^ +23> ^ +24> ^ +25> ^^^^ +26> ^ +27> ^^^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^^ +33> ^^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^^^^^ +39> ^^^ +40> ^ +41> ^ +42> ^ +43> ^^^^^^ +44> ^ +45> ^^^ +46> ^ +47> ^ +48> ^ +49> ^ +50> ^^^^^^ +51> ^^ +52> ^ +53> ^ +54> ^ +55> ^ +56> ^^^^^^^^^ +57> ^^ +58> ^^^ +59> ^^^^^^^ +60> ^^^^^^^ +61> ^^^ +62> ^ +63> ^^^^^^ +64> ^^^^^^^^ +65> ^ +66> ^^ +67> ^^^ +68> ^^^^^^ +69> ^ +70> ^ +71> ^^^^^^ +72> ^^^ +73> ^ +74> ^^^^^ +75> ^ +76> ^^^ +77> ^ +78> ^ +79> ^^^^^ +80> ^^ +81> ^ +82> ^^^^^ +83> ^ +84> ^^ +85> ^ +86> ^^^^^ +87> ^ +88> ^^ +89> ^ +90> ^^^^^ +91> ^ +92> ^^ +93> ^ +94> ^^^^^ +95> ^ +96> ^ +97> ^ +98> ^^^^^^ +99> ^^^^^ +100> ^ +101> ^^^^^^ +102> ^^^^^^^ +103> ^^^ +104> ^ +105> ^^^^^^ +106> ^^^^^ +107> ^^^ +108> ^ +109> ^^^^^^ +110> ^^^^^^^ +111> ^^^ +112> ^ +113> ^ +114> ^ +115> ^^^^^^ +116> ^ +117> ^ +118> ^^^^^^ +119> ^^^ +120> ^ +121> ^^^^ +122> ^^^^^ +123> ^ +124> ^^^^^^ +125> ^ +126> ^^^ +127> ^^ +128> ^ +129> ^ +130> ^^^^^^^ +131> ^^^^^^ +132> ^^^^^^ +133> ^^^ +134> ^ +135> ^^^^^^^ +136> ^^^^^^ +137> ^ +138> ^^ +139> ^^^^^^^ +140> ^^^^^^^ +141> ^^^^^^^^^^^^ +142> ^ +1 > +2 >delete +3 > obj +4 > . +5 > a +6 > + > +7 > delete +8 > ( +9 > obj +10> ) +11> . +12> a +13> + > +14> delete +15> [] +16> [ +17> 0 +18> ] +19> + > +20> void +21> obj +22> . +23> a +24> + > +25> void +26> ( +27> obj +28> ) +29> . +30> a +31> + > +32> void +33> [] +34> [ +35> 0 +36> ] +37> + > +38> typeof +39> obj +40> . +41> a +42> + > +43> typeof +44> ( +45> obj +46> ) +47> . +48> a +49> + > +50> typeof +51> [] +52> [ +53> 0 +54> ] +55> + > +56> function +57> f1 +58> () { + > +59> return +60> typeof +61> obj + > +62> } + > +63> async +64> function +65> * +66> f2 +67> () { + > +68> yield +69> 1 +70> + > +71> yield +72> obj +73> + > +74> yield +75> ( +76> obj +77> ) +78> + > +79> yield +80> [] +81> + > +82> yield +83> * +84> [] +85> + > +86> yield +87> * +88> [] +89> + > +90> yield +91> * +92> [] +93> + > +94> yield +95> + > +96> i +97> + > +98> yield +99> yield +100> + > +101> yield +102> typeof +103> obj +104> + > +105> yield +106> void +107> obj +108> + > +109> yield +110> delete +111> obj +112> . +113> a +114> + > +115> await +116> 1 +117> + > +118> await +119> obj +120> + > +121> for +122> await +123> ( +124> const +125> x +126> of +127> [] +128> ) +129> ; + > +130> return +131> yield +132> await +133> obj + > +134> } + > +135> export +136> class +137> C +138> {} + > +139> export +140> default +141> function() { +142> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 8) Source(1, 8) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 11) + SourceIndex(0) +4 >Emitted(1, 12) Source(1, 12) + SourceIndex(0) +5 >Emitted(1, 13) Source(1, 13) + SourceIndex(0) +6 >Emitted(1, 14) Source(2, 1) + SourceIndex(0) +7 >Emitted(1, 20) Source(2, 8) + SourceIndex(0) +8 >Emitted(1, 21) Source(2, 9) + SourceIndex(0) +9 >Emitted(1, 24) Source(2, 12) + SourceIndex(0) +10>Emitted(1, 25) Source(2, 13) + SourceIndex(0) +11>Emitted(1, 26) Source(2, 14) + SourceIndex(0) +12>Emitted(1, 27) Source(2, 15) + SourceIndex(0) +13>Emitted(1, 28) Source(3, 1) + SourceIndex(0) +14>Emitted(1, 34) Source(3, 8) + SourceIndex(0) +15>Emitted(1, 36) Source(3, 10) + SourceIndex(0) +16>Emitted(1, 37) Source(3, 11) + SourceIndex(0) +17>Emitted(1, 38) Source(3, 12) + SourceIndex(0) +18>Emitted(1, 39) Source(3, 13) + SourceIndex(0) +19>Emitted(1, 40) Source(4, 1) + SourceIndex(0) +20>Emitted(1, 45) Source(4, 6) + SourceIndex(0) +21>Emitted(1, 48) Source(4, 9) + SourceIndex(0) +22>Emitted(1, 49) Source(4, 10) + SourceIndex(0) +23>Emitted(1, 50) Source(4, 11) + SourceIndex(0) +24>Emitted(1, 51) Source(5, 1) + SourceIndex(0) +25>Emitted(1, 55) Source(5, 6) + SourceIndex(0) +26>Emitted(1, 56) Source(5, 7) + SourceIndex(0) +27>Emitted(1, 59) Source(5, 10) + SourceIndex(0) +28>Emitted(1, 60) Source(5, 11) + SourceIndex(0) +29>Emitted(1, 61) Source(5, 12) + SourceIndex(0) +30>Emitted(1, 62) Source(5, 13) + SourceIndex(0) +31>Emitted(1, 63) Source(6, 1) + SourceIndex(0) +32>Emitted(1, 67) Source(6, 6) + SourceIndex(0) +33>Emitted(1, 69) Source(6, 8) + SourceIndex(0) +34>Emitted(1, 70) Source(6, 9) + SourceIndex(0) +35>Emitted(1, 71) Source(6, 10) + SourceIndex(0) +36>Emitted(1, 72) Source(6, 11) + SourceIndex(0) +37>Emitted(1, 73) Source(7, 1) + SourceIndex(0) +38>Emitted(1, 80) Source(7, 8) + SourceIndex(0) +39>Emitted(1, 83) Source(7, 11) + SourceIndex(0) +40>Emitted(1, 84) Source(7, 12) + SourceIndex(0) +41>Emitted(1, 85) Source(7, 13) + SourceIndex(0) +42>Emitted(1, 86) Source(8, 1) + SourceIndex(0) +43>Emitted(1, 92) Source(8, 8) + SourceIndex(0) +44>Emitted(1, 93) Source(8, 9) + SourceIndex(0) +45>Emitted(1, 96) Source(8, 12) + SourceIndex(0) +46>Emitted(1, 97) Source(8, 13) + SourceIndex(0) +47>Emitted(1, 98) Source(8, 14) + SourceIndex(0) +48>Emitted(1, 99) Source(8, 15) + SourceIndex(0) +49>Emitted(1, 100) Source(9, 1) + SourceIndex(0) +50>Emitted(1, 106) Source(9, 8) + SourceIndex(0) +51>Emitted(1, 108) Source(9, 10) + SourceIndex(0) +52>Emitted(1, 109) Source(9, 11) + SourceIndex(0) +53>Emitted(1, 110) Source(9, 12) + SourceIndex(0) +54>Emitted(1, 111) Source(9, 13) + SourceIndex(0) +55>Emitted(1, 112) Source(10, 1) + SourceIndex(0) +56>Emitted(1, 121) Source(10, 10) + SourceIndex(0) +57>Emitted(1, 123) Source(10, 12) + SourceIndex(0) +58>Emitted(1, 126) Source(11, 5) + SourceIndex(0) +59>Emitted(1, 133) Source(11, 12) + SourceIndex(0) +60>Emitted(1, 140) Source(11, 19) + SourceIndex(0) +61>Emitted(1, 143) Source(12, 1) + SourceIndex(0) +62>Emitted(1, 144) Source(13, 1) + SourceIndex(0) +63>Emitted(1, 150) Source(13, 6) + SourceIndex(0) +64>Emitted(1, 158) Source(13, 15) + SourceIndex(0) +65>Emitted(1, 159) Source(13, 17) + SourceIndex(0) +66>Emitted(1, 161) Source(13, 19) + SourceIndex(0) +67>Emitted(1, 164) Source(14, 5) + SourceIndex(0) +68>Emitted(1, 170) Source(14, 11) + SourceIndex(0) +69>Emitted(1, 171) Source(14, 12) + SourceIndex(0) +70>Emitted(1, 172) Source(15, 5) + SourceIndex(0) +71>Emitted(1, 178) Source(15, 11) + SourceIndex(0) +72>Emitted(1, 181) Source(15, 14) + SourceIndex(0) +73>Emitted(1, 182) Source(16, 5) + SourceIndex(0) +74>Emitted(1, 187) Source(16, 11) + SourceIndex(0) +75>Emitted(1, 188) Source(16, 12) + SourceIndex(0) +76>Emitted(1, 191) Source(16, 15) + SourceIndex(0) +77>Emitted(1, 192) Source(16, 16) + SourceIndex(0) +78>Emitted(1, 193) Source(17, 5) + SourceIndex(0) +79>Emitted(1, 198) Source(17, 11) + SourceIndex(0) +80>Emitted(1, 200) Source(17, 13) + SourceIndex(0) +81>Emitted(1, 201) Source(18, 5) + SourceIndex(0) +82>Emitted(1, 206) Source(18, 10) + SourceIndex(0) +83>Emitted(1, 207) Source(18, 12) + SourceIndex(0) +84>Emitted(1, 209) Source(18, 14) + SourceIndex(0) +85>Emitted(1, 210) Source(19, 5) + SourceIndex(0) +86>Emitted(1, 215) Source(19, 11) + SourceIndex(0) +87>Emitted(1, 216) Source(19, 12) + SourceIndex(0) +88>Emitted(1, 218) Source(19, 14) + SourceIndex(0) +89>Emitted(1, 219) Source(20, 5) + SourceIndex(0) +90>Emitted(1, 224) Source(20, 11) + SourceIndex(0) +91>Emitted(1, 225) Source(20, 13) + SourceIndex(0) +92>Emitted(1, 227) Source(20, 15) + SourceIndex(0) +93>Emitted(1, 228) Source(21, 5) + SourceIndex(0) +94>Emitted(1, 233) Source(21, 10) + SourceIndex(0) +95>Emitted(1, 234) Source(22, 5) + SourceIndex(0) +96>Emitted(1, 235) Source(22, 6) + SourceIndex(0) +97>Emitted(1, 236) Source(23, 5) + SourceIndex(0) +98>Emitted(1, 242) Source(23, 11) + SourceIndex(0) +99>Emitted(1, 247) Source(23, 16) + SourceIndex(0) +100>Emitted(1, 248) Source(24, 5) + SourceIndex(0) +101>Emitted(1, 254) Source(24, 11) + SourceIndex(0) +102>Emitted(1, 261) Source(24, 18) + SourceIndex(0) +103>Emitted(1, 264) Source(24, 21) + SourceIndex(0) +104>Emitted(1, 265) Source(25, 5) + SourceIndex(0) +105>Emitted(1, 271) Source(25, 11) + SourceIndex(0) +106>Emitted(1, 276) Source(25, 16) + SourceIndex(0) +107>Emitted(1, 279) Source(25, 19) + SourceIndex(0) +108>Emitted(1, 280) Source(26, 5) + SourceIndex(0) +109>Emitted(1, 286) Source(26, 11) + SourceIndex(0) +110>Emitted(1, 293) Source(26, 18) + SourceIndex(0) +111>Emitted(1, 296) Source(26, 21) + SourceIndex(0) +112>Emitted(1, 297) Source(26, 22) + SourceIndex(0) +113>Emitted(1, 298) Source(26, 23) + SourceIndex(0) +114>Emitted(1, 299) Source(27, 5) + SourceIndex(0) +115>Emitted(1, 305) Source(27, 11) + SourceIndex(0) +116>Emitted(1, 306) Source(27, 12) + SourceIndex(0) +117>Emitted(1, 307) Source(28, 5) + SourceIndex(0) +118>Emitted(1, 313) Source(28, 11) + SourceIndex(0) +119>Emitted(1, 316) Source(28, 14) + SourceIndex(0) +120>Emitted(1, 317) Source(29, 5) + SourceIndex(0) +121>Emitted(1, 321) Source(29, 9) + SourceIndex(0) +122>Emitted(1, 326) Source(29, 14) + SourceIndex(0) +123>Emitted(1, 327) Source(29, 16) + SourceIndex(0) +124>Emitted(1, 333) Source(29, 22) + SourceIndex(0) +125>Emitted(1, 334) Source(29, 23) + SourceIndex(0) +126>Emitted(1, 337) Source(29, 27) + SourceIndex(0) +127>Emitted(1, 339) Source(29, 29) + SourceIndex(0) +128>Emitted(1, 340) Source(29, 30) + SourceIndex(0) +129>Emitted(1, 341) Source(30, 5) + SourceIndex(0) +130>Emitted(1, 348) Source(30, 12) + SourceIndex(0) +131>Emitted(1, 354) Source(30, 18) + SourceIndex(0) +132>Emitted(1, 360) Source(30, 24) + SourceIndex(0) +133>Emitted(1, 363) Source(31, 1) + SourceIndex(0) +134>Emitted(1, 364) Source(32, 1) + SourceIndex(0) +135>Emitted(1, 371) Source(32, 7) + SourceIndex(0) +136>Emitted(1, 377) Source(32, 14) + SourceIndex(0) +137>Emitted(1, 378) Source(32, 15) + SourceIndex(0) +138>Emitted(1, 380) Source(33, 1) + SourceIndex(0) +139>Emitted(1, 387) Source(33, 8) + SourceIndex(0) +140>Emitted(1, 394) Source(33, 15) + SourceIndex(0) +141>Emitted(1, 406) Source(33, 28) + SourceIndex(0) +142>Emitted(1, 407) Source(33, 29) + SourceIndex(0) +--- +>>>//# sourceMappingURL=keywords.js.map=================================================================== +JsFile: statements.js +mapUrl: statements.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/statements.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/statements.js +sourceFile:../tests/cases/conformance/removeWhitespace/statements.ts +------------------------------------------------------------------- +>>>obj;fn();function fn3(){obj;fn();function f(){}return;function g(){}} +1 > +2 >^^^ +3 > ^ +4 > ^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^ +8 > ^^^ +9 > ^^^ +10> ^^^ +11> ^ +12> ^^ +13> ^^ +14> ^ +15> ^^^^^^^^^ +16> ^ +17> ^^^ +18> ^ +19> ^^^^^^^ +20> ^^^^^^^^^ +21> ^ +22> ^^^ +23> ^ +24> ^ +1 > +2 >obj +3 > ; + > +4 > fn +5 > (); + > +6 > ; + > +7 > function +8 > fn3 +9 > () { + > +10> obj +11> ; + > +12> fn +13> (); + > +14> ; + > +15> function +16> f +17> () { +18> } + > +19> return; + > +20> function +21> g +22> () { +23> } + > +24> } +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 4) Source(1, 4) + SourceIndex(0) +3 >Emitted(1, 5) Source(2, 1) + SourceIndex(0) +4 >Emitted(1, 7) Source(2, 3) + SourceIndex(0) +5 >Emitted(1, 9) Source(3, 1) + SourceIndex(0) +6 >Emitted(1, 10) Source(4, 1) + SourceIndex(0) +7 >Emitted(1, 19) Source(4, 10) + SourceIndex(0) +8 >Emitted(1, 22) Source(4, 13) + SourceIndex(0) +9 >Emitted(1, 25) Source(5, 5) + SourceIndex(0) +10>Emitted(1, 28) Source(5, 8) + SourceIndex(0) +11>Emitted(1, 29) Source(6, 5) + SourceIndex(0) +12>Emitted(1, 31) Source(6, 7) + SourceIndex(0) +13>Emitted(1, 33) Source(7, 5) + SourceIndex(0) +14>Emitted(1, 34) Source(8, 5) + SourceIndex(0) +15>Emitted(1, 43) Source(8, 14) + SourceIndex(0) +16>Emitted(1, 44) Source(8, 15) + SourceIndex(0) +17>Emitted(1, 47) Source(8, 19) + SourceIndex(0) +18>Emitted(1, 48) Source(9, 5) + SourceIndex(0) +19>Emitted(1, 55) Source(10, 5) + SourceIndex(0) +20>Emitted(1, 64) Source(10, 14) + SourceIndex(0) +21>Emitted(1, 65) Source(10, 15) + SourceIndex(0) +22>Emitted(1, 68) Source(10, 19) + SourceIndex(0) +23>Emitted(1, 69) Source(11, 1) + SourceIndex(0) +24>Emitted(1, 70) Source(11, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=statements.js.map=================================================================== +JsFile: variables.js +mapUrl: variables.js.map +sourceRoot: +sources: ../tests/cases/conformance/removeWhitespace/variables.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:dist/variables.js +sourceFile:../tests/cases/conformance/removeWhitespace/variables.ts +------------------------------------------------------------------- +>>>var a=0,b,{c}=obj,[d]=obj;let e=0,f,{g}=obj,[h]=obj; +1 > +2 >^^^^ +3 > ^ +4 > ^ +5 > ^ +6 > ^ +7 > ^ +8 > ^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^^^ +20> ^ +21> ^^^^ +22> ^ +23> ^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ +30> ^ +31> ^ +32> ^^^ +33> ^ +34> ^ +35> ^ +36> ^ +37> ^ +38> ^^^ +39> ^ +1 > +2 >var +3 > a +4 > = +5 > 0 +6 > , +7 > b +8 > , +9 > { +10> c +11> } +12> = +13> obj +14> , +15> [ +16> d +17> ] +18> = +19> obj +20> ; + > +21> let +22> e +23> = +24> 0 +25> , +26> f +27> , +28> { +29> g +30> } +31> = +32> obj +33> , +34> [ +35> h +36> ] +37> = +38> obj +39> ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 7) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 8) Source(1, 10) + SourceIndex(0) +6 >Emitted(1, 9) Source(1, 12) + SourceIndex(0) +7 >Emitted(1, 10) Source(1, 13) + SourceIndex(0) +8 >Emitted(1, 11) Source(1, 15) + SourceIndex(0) +9 >Emitted(1, 12) Source(1, 17) + SourceIndex(0) +10>Emitted(1, 13) Source(1, 18) + SourceIndex(0) +11>Emitted(1, 14) Source(1, 20) + SourceIndex(0) +12>Emitted(1, 15) Source(1, 23) + SourceIndex(0) +13>Emitted(1, 18) Source(1, 26) + SourceIndex(0) +14>Emitted(1, 19) Source(1, 28) + SourceIndex(0) +15>Emitted(1, 20) Source(1, 29) + SourceIndex(0) +16>Emitted(1, 21) Source(1, 30) + SourceIndex(0) +17>Emitted(1, 22) Source(1, 31) + SourceIndex(0) +18>Emitted(1, 23) Source(1, 34) + SourceIndex(0) +19>Emitted(1, 26) Source(1, 37) + SourceIndex(0) +20>Emitted(1, 27) Source(2, 1) + SourceIndex(0) +21>Emitted(1, 31) Source(2, 5) + SourceIndex(0) +22>Emitted(1, 32) Source(2, 6) + SourceIndex(0) +23>Emitted(1, 33) Source(2, 9) + SourceIndex(0) +24>Emitted(1, 34) Source(2, 10) + SourceIndex(0) +25>Emitted(1, 35) Source(2, 12) + SourceIndex(0) +26>Emitted(1, 36) Source(2, 13) + SourceIndex(0) +27>Emitted(1, 37) Source(2, 15) + SourceIndex(0) +28>Emitted(1, 38) Source(2, 17) + SourceIndex(0) +29>Emitted(1, 39) Source(2, 18) + SourceIndex(0) +30>Emitted(1, 40) Source(2, 20) + SourceIndex(0) +31>Emitted(1, 41) Source(2, 23) + SourceIndex(0) +32>Emitted(1, 44) Source(2, 26) + SourceIndex(0) +33>Emitted(1, 45) Source(2, 28) + SourceIndex(0) +34>Emitted(1, 46) Source(2, 29) + SourceIndex(0) +35>Emitted(1, 47) Source(2, 30) + SourceIndex(0) +36>Emitted(1, 48) Source(2, 31) + SourceIndex(0) +37>Emitted(1, 49) Source(2, 34) + SourceIndex(0) +38>Emitted(1, 52) Source(2, 37) + SourceIndex(0) +39>Emitted(1, 53) Source(2, 38) + SourceIndex(0) +--- +>>>//# sourceMappingURL=variables.js.map \ No newline at end of file diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols b/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols new file mode 100644 index 0000000000000..f4c1bbb7e293d --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.symbols @@ -0,0 +1,392 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj .a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj . a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj. +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + .a + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . + a + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . // comment + a // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + . /* comment */ + a /* comment */ + +1..valueOf +>1..valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. valueOf +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. .valueOf +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. . valueOf +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 .valueOf +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 . valueOf +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1.. +>1.. valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. +>1. . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. // comment +>1. // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 .valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + .valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 +>1 . valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . + valueOf +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 // comment +>1 // comment . // comment valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . // comment + valueOf // comment +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + + . /* comment */ + valueOf /* comment */ +>valueOf : Symbol(Number.valueOf, Decl(lib.es5.d.ts, --, --)) + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ "a" ] +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +obj [ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + "a" ] + +obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ + "a" + ] + +obj // comment +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ // comment + "a" // comment + ] // comment + +obj /* comment */ +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i + ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++ i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+ ++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i ++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i++ +i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i+++i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i - --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- -- i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i- --i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i -- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- - i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i-- -i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +i---i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + case 0: break; + case 1: break; + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +delete [][0] +void obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +void [][0] +typeof obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof (obj).a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +typeof [][0] +function f1() { +>f1 : Symbol(f1, Decl(keywords.ts, 8, 12)) + + return typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +async function* f2() { +>f2 : Symbol(f2, Decl(keywords.ts, 11, 1)) + + yield 1 + yield obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield (obj) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield [] + yield* [] + yield *[] + yield * [] + yield + i +>i : Symbol(i, Decl(global.d.ts, 0, 21)) + + yield yield + yield typeof obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield void obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + yield delete obj.a +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + await 1 + await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + for await (const x of []); +>x : Symbol(x, Decl(keywords.ts, 28, 20)) + + return yield await obj +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +} +export class C {} +>C : Symbol(C, Decl(keywords.ts, 30, 1)) + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + +; +function fn3() { +>fn3 : Symbol(fn3, Decl(statements.ts, 2, 1)) + + obj; +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + + fn(); +>fn : Symbol(fn, Decl(global.d.ts, 0, 29)) + + ; + function f() {} +>f : Symbol(f, Decl(statements.ts, 6, 5)) + + return; + function g() {} +>g : Symbol(g, Decl(statements.ts, 8, 11)) +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : Symbol(a, Decl(variables.ts, 0, 3)) +>b : Symbol(b, Decl(variables.ts, 0, 10)) +>c : Symbol(c, Decl(variables.ts, 0, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>d : Symbol(d, Decl(variables.ts, 0, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + +let e = 0, f, { g } = obj, [h] = obj; +>e : Symbol(e, Decl(variables.ts, 1, 3)) +>f : Symbol(f, Decl(variables.ts, 1, 10)) +>g : Symbol(g, Decl(variables.ts, 1, 15)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) +>h : Symbol(h, Decl(variables.ts, 1, 28)) +>obj : Symbol(obj, Decl(global.d.ts, 0, 11)) + diff --git a/tests/baselines/reference/removeWhitespaceAndComments.outDir.types b/tests/baselines/reference/removeWhitespaceAndComments.outDir.types new file mode 100644 index 0000000000000..2d892d03e0490 --- /dev/null +++ b/tests/baselines/reference/removeWhitespaceAndComments.outDir.types @@ -0,0 +1,575 @@ +=== tests/cases/conformance/removeWhitespace/global.d.ts === +declare let obj: any, i: any, fn; +>obj : any +>i : any +>fn : any + +=== tests/cases/conformance/removeWhitespace/propertyAccess.ts === +obj.a +>obj.a : any +>obj : any +>a : any + +obj .a +>obj .a : any +>obj : any +>a : any + +obj. a +>obj. a : any +>obj : any +>a : any + +obj . a +>obj . a : any +>obj : any +>a : any + +obj. +>obj. a : any +>obj : any + + a +>a : any + +obj +>obj .a : any +>obj : any + + .a +>a : any + +obj +>obj . a : any +>obj : any + + . + a +>a : any + +obj // comment +>obj // comment . // comment a : any +>obj : any + + . // comment + a // comment +>a : any + +obj /* comment */ +>obj /* comment */ . /* comment */ a : any +>obj : any + + . /* comment */ + a /* comment */ +>a : any + +1..valueOf +>1..valueOf : () => number +>1. : 1 +>valueOf : () => number + +1.. valueOf +>1.. valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. .valueOf +>1. .valueOf : () => number +>1. : 1 +>valueOf : () => number + +1. . valueOf +>1. . valueOf : () => number +>1. : 1 +>valueOf : () => number + +1 .valueOf +>1 .valueOf : () => number +>1 : 1 +>valueOf : () => number + +1 . valueOf +>1 . valueOf : () => number +>1 : 1 +>valueOf : () => number + +1.. +>1.. valueOf : () => number +>1. : 1 + + valueOf +>valueOf : () => number + +1. +>1. .valueOf : () => number +>1. : 1 + + .valueOf +>valueOf : () => number + +1. +>1. . valueOf : () => number +>1. : 1 + + . + valueOf +>valueOf : () => number + +1. // comment +>1. // comment . // comment valueOf : () => number +>1. : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1. /* comment */ +>1. /* comment */ . /* comment */ valueOf : () => number +>1. : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +1 +>1 .valueOf : () => number +>1 : 1 + + .valueOf +>valueOf : () => number + +1 +>1 . valueOf : () => number +>1 : 1 + + . + valueOf +>valueOf : () => number + +1 // comment +>1 // comment . // comment valueOf : () => number +>1 : 1 + + . // comment + valueOf // comment +>valueOf : () => number + +1 /* comment */ +>1 /* comment */ . /* comment */ valueOf : () => number +>1 : 1 + + . /* comment */ + valueOf /* comment */ +>valueOf : () => number + +=== tests/cases/conformance/removeWhitespace/elementAccess.ts === +obj["a"] +>obj["a"] : any +>obj : any +>"a" : "a" + +obj [ "a" ] +>obj [ "a" ] : any +>obj : any +>"a" : "a" + +obj [ +>obj [ "a" ] : any +>obj : any + + "a" ] +>"a" : "a" + +obj +>obj [ "a" ] : any +>obj : any + + [ + "a" +>"a" : "a" + + ] + +obj // comment +>obj // comment [ // comment "a" // comment ] : any +>obj : any + + [ // comment + "a" // comment +>"a" : "a" + + ] // comment + +obj /* comment */ +>obj /* comment */ [ /* comment */ "a" /* comment */ ] : any +>obj : any + + [ /* comment */ + "a" /* comment */ +>"a" : "a" + + ] /* comment */ + +=== tests/cases/conformance/removeWhitespace/update.ts === +i + + i +>i + + i : any +>i : any +>+ i : number +>i : any + +i + +i +>i + +i : any +>i : any +>+i : number +>i : any + +i+ + i +>i+ + i : any +>i : any +>+ i : number +>i : any + +i+ +i +>i+ +i : any +>i : any +>+i : number +>i : any + +i + ++ i +>i + ++ i : any +>i : any +>++ i : number +>i : any + +i + ++i +>i + ++i : any +>i : any +>++i : number +>i : any + +i+ ++ i +>i+ ++ i : any +>i : any +>++ i : number +>i : any + +i+ ++i +>i+ ++i : any +>i : any +>++i : number +>i : any + +i ++ + i +>i ++ + i : any +>i ++ : number +>i : any +>i : any + +i ++ +i +>i ++ +i : any +>i ++ : number +>i : any +>i : any + +i++ + i +>i++ + i : any +>i++ : number +>i : any +>i : any + +i++ +i +>i++ +i : any +>i++ : number +>i : any +>i : any + +i+++i +>i+++i : any +>i++ : number +>i : any +>i : any + +i - - i +>i - - i : number +>i : any +>- i : number +>i : any + +i - -i +>i - -i : number +>i : any +>-i : number +>i : any + +i- - i +>i- - i : number +>i : any +>- i : number +>i : any + +i- -i +>i- -i : number +>i : any +>-i : number +>i : any + +i - -- i +>i - -- i : number +>i : any +>-- i : number +>i : any + +i - --i +>i - --i : number +>i : any +>--i : number +>i : any + +i- -- i +>i- -- i : number +>i : any +>-- i : number +>i : any + +i- --i +>i- --i : number +>i : any +>--i : number +>i : any + +i -- - i +>i -- - i : number +>i -- : number +>i : any +>i : any + +i -- -i +>i -- -i : number +>i -- : number +>i : any +>i : any + +i-- - i +>i-- - i : number +>i-- : number +>i : any +>i : any + +i-- -i +>i-- -i : number +>i-- : number +>i : any +>i : any + +i---i +>i---i : number +>i-- : number +>i : any +>i : any + +=== tests/cases/conformance/removeWhitespace/switch.ts === +switch (i) { +>i : any + + case 0: break; +>0 : 0 + + case 1: break; +>1 : 1 + + default: break; +} + +=== tests/cases/conformance/removeWhitespace/keywords.ts === +delete obj.a +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + +delete (obj).a +>delete (obj).a : boolean +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +delete [][0] +>delete [][0] : boolean +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +void obj.a +>void obj.a : undefined +>obj.a : any +>obj : any +>a : any + +void (obj).a +>void (obj).a : undefined +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +void [][0] +>void [][0] : undefined +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +typeof obj.a +>typeof obj.a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj.a : any +>obj : any +>a : any + +typeof (obj).a +>typeof (obj).a : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>(obj).a : any +>(obj) : any +>obj : any +>a : any + +typeof [][0] +>typeof [][0] : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>[][0] : undefined +>[] : undefined[] +>0 : 0 + +function f1() { +>f1 : () => "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" + + return typeof obj +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any +} +async function* f2() { +>f2 : () => AsyncIterableIterator + + yield 1 +>yield 1 : any +>1 : 1 + + yield obj +>yield obj : any +>obj : any + + yield (obj) +>yield (obj) : any +>(obj) : any +>obj : any + + yield [] +>yield [] : any +>[] : undefined[] + + yield* [] +>yield* [] : any +>[] : undefined[] + + yield *[] +>yield *[] : any +>[] : undefined[] + + yield * [] +>yield * [] : any +>[] : undefined[] + + yield +>yield : any + + i +>i : any + + yield yield +>yield yield : any +>yield : any + + yield typeof obj +>yield typeof obj : any +>typeof obj : "string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function" +>obj : any + + yield void obj +>yield void obj : any +>void obj : undefined +>obj : any + + yield delete obj.a +>yield delete obj.a : any +>delete obj.a : boolean +>obj.a : any +>obj : any +>a : any + + await 1 +>await 1 : 1 +>1 : 1 + + await obj +>await obj : any +>obj : any + + for await (const x of []); +>x : any +>[] : undefined[] + + return yield await obj +>yield await obj : any +>await obj : any +>obj : any +} +export class C {} +>C : C + +export default function() {} + +=== tests/cases/conformance/removeWhitespace/statements.ts === +obj; +>obj : any + +fn(); +>fn() : any +>fn : any + +; +function fn3() { +>fn3 : () => void + + obj; +>obj : any + + fn(); +>fn() : any +>fn : any + + ; + function f() {} +>f : () => void + + return; + function g() {} +>g : () => void +} + +=== tests/cases/conformance/removeWhitespace/variables.ts === +var a = 0, b, { c } = obj, [d] = obj; +>a : number +>0 : 0 +>b : any +>c : any +>obj : any +>d : any +>obj : any + +let e = 0, f, { g } = obj, [h] = obj; +>e : number +>0 : 0 +>f : any +>g : any +>obj : any +>h : any +>obj : any + diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js index 7b7abae996c67..490f38acf4452 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js @@ -18,7 +18,8 @@ var c = /** @class */ (function () { } return c; }()); -//# sourceMappingURL=app.js.map//// [app2.js] +//# sourceMappingURL=app.js.map +//// [app2.js] var d = /** @class */ (function () { function d() { } diff --git a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map index 7a172c4e0a7f9..b517b5694b0ae 100644 --- a/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,4 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["../testFiles/app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,wIAAwI;AACxI;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} +//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["../testFiles/app2.ts"],"names":[],"mappings":"AAAA;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js index 3487a70dc7bb3..6e49d774aa982 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js @@ -18,7 +18,8 @@ var c = /** @class */ (function () { } return c; }()); -//# sourceMappingURL=app.js.map//// [app2.js] +//# sourceMappingURL=app.js.map +//// [app2.js] var d = /** @class */ (function () { function d() { } diff --git a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map index 5025ed2212ac2..ef9951d251933 100644 --- a/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map +++ b/tests/baselines/reference/sourceMapWithNonCaseSensitiveFileNamesAndOutDir.js.map @@ -1,3 +1,4 @@ //// [app.js.map] -{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"}//// [app2.js.map] +{"version":3,"file":"app.js","sourceRoot":"","sources":["app.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0GAA0G;AAC1G;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} +//// [app2.js.map] {"version":3,"file":"app2.js","sourceRoot":"","sources":["app2.ts"],"names":[],"mappings":"AAAA;IAAA;IACA,CAAC;IAAD,QAAC;AAAD,CAAC,AADD,IACC"} \ No newline at end of file diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts b/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts new file mode 100644 index 0000000000000..54406e64b12d3 --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespace.outDir.ts @@ -0,0 +1,191 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @sourceMap: true +// @outDir: dist +// @filename: global.d.ts +declare let obj: any, i: any, fn; + +// @filename: propertyAccess.ts +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +// @filename: elementAccess.ts +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +// @filename: update.ts +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +// @filename: switch.ts +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +// @filename: keywords.ts +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +// @filename: statements.ts +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +// @filename: variables.ts +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; + +// @filename: for.ts +for(;;){} + +// @filename: embeddedStatement.ts +{while(true);} \ No newline at end of file diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts b/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts new file mode 100644 index 0000000000000..076eea11b7cd0 --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespace.outFile.ts @@ -0,0 +1,16 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @sourceMap: true +// @outFile: combined.js +// @filename: a.ts +let a = 1; + +// @filename: b.ts +let b = 2; + +// @filename: c.ts +class C {} + +// @filename: d.ts +function d() {} diff --git a/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts b/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts new file mode 100644 index 0000000000000..4ac4ca251447f --- /dev/null +++ b/tests/cases/conformance/removeWhitespace/removeWhitespaceAndComments.outDir.ts @@ -0,0 +1,186 @@ +// @target: esnext +// @module: esnext +// @removeWhiteSpace: true +// @removeComments: true +// @sourceMap: true +// @outDir: dist +// @filename: global.d.ts +declare let obj: any, i: any, fn; + +// @filename: propertyAccess.ts +obj.a +obj .a +obj. a +obj . a + +obj. + a + +obj + .a + +obj + . + a + +obj // comment + . // comment + a // comment + +obj /* comment */ + . /* comment */ + a /* comment */ + +1..valueOf +1.. valueOf +1. .valueOf +1. . valueOf +1 .valueOf +1 . valueOf + +1.. + valueOf + +1. + .valueOf + +1. + . + valueOf + +1. // comment + . // comment + valueOf // comment + +1. /* comment */ + . /* comment */ + valueOf /* comment */ + +1 + .valueOf + +1 + . + valueOf + +1 // comment + . // comment + valueOf // comment + +1 /* comment */ + . /* comment */ + valueOf /* comment */ + +// @filename: elementAccess.ts +obj["a"] +obj [ "a" ] + +obj [ + "a" ] + +obj + [ + "a" + ] + +obj // comment + [ // comment + "a" // comment + ] // comment + +obj /* comment */ + [ /* comment */ + "a" /* comment */ + ] /* comment */ + +// @filename: update.ts +i + + i +i + +i +i+ + i +i+ +i + +i + ++ i +i + ++i +i+ ++ i +i+ ++i + +i ++ + i +i ++ +i +i++ + i +i++ +i +i+++i + +i - - i +i - -i +i- - i +i- -i + +i - -- i +i - --i +i- -- i +i- --i + +i -- - i +i -- -i +i-- - i +i-- -i +i---i + +// @filename: switch.ts +switch (i) { + case 0: break; + case 1: break; + default: break; +} + +// @filename: keywords.ts +delete obj.a +delete (obj).a +delete [][0] +void obj.a +void (obj).a +void [][0] +typeof obj.a +typeof (obj).a +typeof [][0] +function f1() { + return typeof obj +} +async function* f2() { + yield 1 + yield obj + yield (obj) + yield [] + yield* [] + yield *[] + yield * [] + yield + i + yield yield + yield typeof obj + yield void obj + yield delete obj.a + await 1 + await obj + for await (const x of []); + return yield await obj +} +export class C {} +export default function() {} + +// @filename: statements.ts +obj; +fn(); +; +function fn3() { + obj; + fn(); + ; + function f() {} + return; + function g() {} +} + +// @filename: variables.ts +var a = 0, b, { c } = obj, [d] = obj; +let e = 0, f, { g } = obj, [h] = obj; \ No newline at end of file