diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 4d639272d24..2ad6caf9896 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -2868,6 +2868,15 @@ namespace ts { declarationMapPath: string | undefined, buildInfoPath: string | undefined ): InputFiles; + export function createInputFiles( + javascriptText: string, + declarationText: string, + javascriptMapPath: string | undefined, + javascriptMapText: string | undefined, + declarationMapPath: string | undefined, + declarationMapText: string | undefined + ): InputFiles; + /*@internal*/ export function createInputFiles( javascriptText: string, declarationText: string, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 7778897b09f..bb4f5dabb9f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2838,7 +2838,7 @@ namespace ts { export interface UnparsedSectionText extends UnparsedSection { kind: SyntaxKind.UnparsedSectionText; parent: UnparsedSource; - section: BundleFileSection; + /*@internal*/ section: BundleFileSection; } export interface JsonSourceFile extends SourceFile { diff --git a/src/testRunner/unittests/tsbuildWatchMode.ts b/src/testRunner/unittests/tsbuildWatchMode.ts index 1f410667c60..ed779614ffe 100644 --- a/src/testRunner/unittests/tsbuildWatchMode.ts +++ b/src/testRunner/unittests/tsbuildWatchMode.ts @@ -348,9 +348,9 @@ function myFunc() { return 10; }`); // TODO:: local change does not build logic.js because builder doesnt find any changes in input files to generate output // Make local change to function bar verifyChangeInCore(`${coreIndex.content} -function myFunc() { return 100; }`); +function myFunc() { return 100; }`, /*isLocal*/ true); - function verifyChangeInCore(content: string) { + function verifyChangeInCore(content: string, isLocal?: boolean) { const outputFileStamps = getOutputFileStamps(); host.writeFile(coreIndex.path, content); @@ -363,12 +363,14 @@ function myFunc() { return 100; }`); emptyArray ); host.checkTimeoutQueueLengthAndRun(1); // Builds logic + const changedLogicOutput = getOutputFileNames(SubProject.logic, "index"); const changedLogic = getOutputFileStamps(); verifyChangedFiles( changedLogic, changedCore, - getOutputFileNames(SubProject.logic, "index"), - emptyArray + // Only js file is written and d.ts is modified timestamp if its local change + isLocal ? [changedLogicOutput[0]] : getOutputFileNames(SubProject.logic, "index"), + isLocal ? [changedLogicOutput[1]] : emptyArray ); host.checkTimeoutQueueLength(0); checkOutputErrorsIncremental(host, emptyArray); diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 2eb25821731..25b102ac3ed 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -359,40 +359,41 @@ declare namespace ts { UnparsedPrependText = 280, UnparsedText = 281, UnparsedSourceMapUrl = 282, - SourceFile = 283, - Bundle = 284, - UnparsedSource = 285, - InputFiles = 286, - JSDocTypeExpression = 287, - JSDocAllType = 288, - JSDocUnknownType = 289, - JSDocNullableType = 290, - JSDocNonNullableType = 291, - JSDocOptionalType = 292, - JSDocFunctionType = 293, - JSDocVariadicType = 294, - JSDocComment = 295, - JSDocTypeLiteral = 296, - JSDocSignature = 297, - JSDocTag = 298, - JSDocAugmentsTag = 299, - JSDocClassTag = 300, - JSDocCallbackTag = 301, - JSDocEnumTag = 302, - JSDocParameterTag = 303, - JSDocReturnTag = 304, - JSDocThisTag = 305, - JSDocTypeTag = 306, - JSDocTemplateTag = 307, - JSDocTypedefTag = 308, - JSDocPropertyTag = 309, - SyntaxList = 310, - NotEmittedStatement = 311, - PartiallyEmittedExpression = 312, - CommaListExpression = 313, - MergeDeclarationMarker = 314, - EndOfDeclarationMarker = 315, - Count = 316, + UnparsedSectionText = 283, + SourceFile = 284, + Bundle = 285, + UnparsedSource = 286, + InputFiles = 287, + JSDocTypeExpression = 288, + JSDocAllType = 289, + JSDocUnknownType = 290, + JSDocNullableType = 291, + JSDocNonNullableType = 292, + JSDocOptionalType = 293, + JSDocFunctionType = 294, + JSDocVariadicType = 295, + JSDocComment = 296, + JSDocTypeLiteral = 297, + JSDocSignature = 298, + JSDocTag = 299, + JSDocAugmentsTag = 300, + JSDocClassTag = 301, + JSDocCallbackTag = 302, + JSDocEnumTag = 303, + JSDocParameterTag = 304, + JSDocReturnTag = 305, + JSDocThisTag = 306, + JSDocTypeTag = 307, + JSDocTemplateTag = 308, + JSDocTypedefTag = 309, + JSDocPropertyTag = 310, + SyntaxList = 311, + NotEmittedStatement = 312, + PartiallyEmittedExpression = 313, + CommaListExpression = 314, + MergeDeclarationMarker = 315, + EndOfDeclarationMarker = 316, + Count = 317, FirstAssignment = 59, LastAssignment = 71, FirstCompoundAssignment = 60, @@ -418,10 +419,10 @@ declare namespace ts { FirstBinaryOperator = 28, LastBinaryOperator = 71, FirstNode = 148, - FirstJSDocNode = 287, - LastJSDocNode = 309, - FirstJSDocTagNode = 298, - LastJSDocTagNode = 309 + FirstJSDocNode = 288, + LastJSDocNode = 310, + FirstJSDocTagNode = 299, + LastJSDocTagNode = 310 } enum NodeFlags { None = 0, @@ -1738,7 +1739,6 @@ declare namespace ts { declarationText: string; declarationMapPath?: string; declarationMapText?: string; - buildInfoPath?: string; } interface UnparsedSource extends Node { kind: SyntaxKind.UnparsedSource; @@ -1754,7 +1754,7 @@ declare namespace ts { sourceMapText?: string; texts: ReadonlyArray; } - type UnparsedSourceText = UnparsedPrependText | UnparsedText | UnparsedSourceMapUrl; + type UnparsedSourceText = UnparsedPrependText | UnparsedText | UnparsedSourceMapUrl | UnparsedSectionText; type UnparsedNode = UnparsedPrologue | UnparsedSourceText; interface UnparsedSection extends Node { kind: SyntaxKind; @@ -1779,6 +1779,10 @@ declare namespace ts { kind: SyntaxKind.UnparsedSourceMapUrl; parent: UnparsedSource; } + interface UnparsedSectionText extends UnparsedSection { + kind: SyntaxKind.UnparsedSectionText; + parent: UnparsedSource; + } interface JsonSourceFile extends SourceFile { statements: NodeArray; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 16a9b0a2e87..1c853897ea7 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -359,40 +359,41 @@ declare namespace ts { UnparsedPrependText = 280, UnparsedText = 281, UnparsedSourceMapUrl = 282, - SourceFile = 283, - Bundle = 284, - UnparsedSource = 285, - InputFiles = 286, - JSDocTypeExpression = 287, - JSDocAllType = 288, - JSDocUnknownType = 289, - JSDocNullableType = 290, - JSDocNonNullableType = 291, - JSDocOptionalType = 292, - JSDocFunctionType = 293, - JSDocVariadicType = 294, - JSDocComment = 295, - JSDocTypeLiteral = 296, - JSDocSignature = 297, - JSDocTag = 298, - JSDocAugmentsTag = 299, - JSDocClassTag = 300, - JSDocCallbackTag = 301, - JSDocEnumTag = 302, - JSDocParameterTag = 303, - JSDocReturnTag = 304, - JSDocThisTag = 305, - JSDocTypeTag = 306, - JSDocTemplateTag = 307, - JSDocTypedefTag = 308, - JSDocPropertyTag = 309, - SyntaxList = 310, - NotEmittedStatement = 311, - PartiallyEmittedExpression = 312, - CommaListExpression = 313, - MergeDeclarationMarker = 314, - EndOfDeclarationMarker = 315, - Count = 316, + UnparsedSectionText = 283, + SourceFile = 284, + Bundle = 285, + UnparsedSource = 286, + InputFiles = 287, + JSDocTypeExpression = 288, + JSDocAllType = 289, + JSDocUnknownType = 290, + JSDocNullableType = 291, + JSDocNonNullableType = 292, + JSDocOptionalType = 293, + JSDocFunctionType = 294, + JSDocVariadicType = 295, + JSDocComment = 296, + JSDocTypeLiteral = 297, + JSDocSignature = 298, + JSDocTag = 299, + JSDocAugmentsTag = 300, + JSDocClassTag = 301, + JSDocCallbackTag = 302, + JSDocEnumTag = 303, + JSDocParameterTag = 304, + JSDocReturnTag = 305, + JSDocThisTag = 306, + JSDocTypeTag = 307, + JSDocTemplateTag = 308, + JSDocTypedefTag = 309, + JSDocPropertyTag = 310, + SyntaxList = 311, + NotEmittedStatement = 312, + PartiallyEmittedExpression = 313, + CommaListExpression = 314, + MergeDeclarationMarker = 315, + EndOfDeclarationMarker = 316, + Count = 317, FirstAssignment = 59, LastAssignment = 71, FirstCompoundAssignment = 60, @@ -418,10 +419,10 @@ declare namespace ts { FirstBinaryOperator = 28, LastBinaryOperator = 71, FirstNode = 148, - FirstJSDocNode = 287, - LastJSDocNode = 309, - FirstJSDocTagNode = 298, - LastJSDocTagNode = 309 + FirstJSDocNode = 288, + LastJSDocNode = 310, + FirstJSDocTagNode = 299, + LastJSDocTagNode = 310 } enum NodeFlags { None = 0, @@ -1738,7 +1739,6 @@ declare namespace ts { declarationText: string; declarationMapPath?: string; declarationMapText?: string; - buildInfoPath?: string; } interface UnparsedSource extends Node { kind: SyntaxKind.UnparsedSource; @@ -1754,7 +1754,7 @@ declare namespace ts { sourceMapText?: string; texts: ReadonlyArray; } - type UnparsedSourceText = UnparsedPrependText | UnparsedText | UnparsedSourceMapUrl; + type UnparsedSourceText = UnparsedPrependText | UnparsedText | UnparsedSourceMapUrl | UnparsedSectionText; type UnparsedNode = UnparsedPrologue | UnparsedSourceText; interface UnparsedSection extends Node { kind: SyntaxKind; @@ -1779,6 +1779,10 @@ declare namespace ts { kind: SyntaxKind.UnparsedSourceMapUrl; parent: UnparsedSource; } + interface UnparsedSectionText extends UnparsedSection { + kind: SyntaxKind.UnparsedSectionText; + parent: UnparsedSource; + } interface JsonSourceFile extends SourceFile { statements: NodeArray; }